blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4c644f9639c9b64b6c3324653290b09425ef1e55 | 0f744048c337276fffce392572a6dd558a80e5c9 | /src/main/java/com/mycompany/class1/Student.java | 7e53370d3a219f371c3c697e746deb5557b4bda4 | [] | no_license | Beyzv/Homework | 8811d28839032f73239368a91c9e837fcd183bbb | b71084b8dd1cea400ab48b37dbd76850324751fd | refs/heads/master | 2023-05-01T20:29:53.187852 | 2021-05-01T16:21:54 | 2021-05-01T16:21:54 | 363,454,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | 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 com.mycompany.class1;
/**
*
* @author omerfaruk
*/
public class Student extends User {
String completionRate;
public Student (){
}
public Student (int id,String firstName,String lastName,String email,String completionRate,String password){
this.getId();
this.getFirstName();
this.getLastName();
this.getEmail();
this.getPassword();
this.completionRate=completionRate;
}
}
| [
"77547830+Beyzv@users.noreply.github.com"
] | 77547830+Beyzv@users.noreply.github.com |
95953eb4f31dfcf002cb7d1eb47e58b3d4f7df16 | aa424c208191a7bcd14a4248f74f9963a2dc2a1d | /src/main/java/vn/mog/ewallet/operation/web/thirdparty/system/integration/sofcash/contract/transaction/AuthorisationRequestType.java | 9a9c8f57ec105eaf19ba8bffc42cc5ad0d62ef6a | [] | no_license | duongvic/wallet-operation-web | 50f85669461d337740a25d8f602e2865f1d3503e | 11f0c5c10054f780ea45faa3b610cb1ab1b7818b | refs/heads/master | 2023-07-02T17:49:59.324117 | 2021-08-18T04:59:36 | 2021-08-18T04:59:36 | 397,476,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,791 | java | package vn.mog.ewallet.operation.web.thirdparty.system.integration.sofcash.contract.transaction;
import java.io.Serializable;
import vn.mog.framework.contract.base.MobiliserRequestType;
public class AuthorisationRequestType extends MobiliserRequestType implements Serializable {
private static final long serialVersionUID = 1L;
protected String serviceId;
protected Long payerPiId;
protected Long payeePiId;
protected Long amount;
protected String orderInfo;
protected Boolean autoCapture;
protected String orderChannel;
protected String orderId;
public Long getPayeePiId() {
return payeePiId;
}
public void setPayeePiId(Long payeePiId) {
this.payeePiId = payeePiId;
}
public Long getPayerPiId() {
return payerPiId;
}
public void setPayerPiId(Long payerPiId) {
this.payerPiId = payerPiId;
}
public Long getAmount() {
return this.amount;
}
public void setAmount(Long value) {
this.amount = value;
}
public String getOrderId() {
return this.orderId;
}
public void setOrderId(String value) {
this.orderId = value;
}
public String getOrderInfo() {
return orderInfo;
}
public void setOrderInfo(String orderInfo) {
this.orderInfo = orderInfo;
}
public boolean isAutoCapture() {
if (this.autoCapture == null) {
return false;
}
return this.autoCapture.booleanValue();
}
public void setAutoCapture(Boolean value) {
this.autoCapture = value;
}
public String getOrderChannel() {
return this.orderChannel;
}
public void setOrderChannel(String value) {
this.orderChannel = value;
}
public String getServiceId() {
return this.serviceId;
}
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
}
| [
"DuongNH43@fpt.com.vn"
] | DuongNH43@fpt.com.vn |
d845a15ed91f1c26648a751873daee77c3ef4c24 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /dts-20200101/src/main/java/com/aliyun/dts20200101/models/UpgradeTwoWayResponse.java | 26d687f8ff90ad105cd7afd70895906223500ade | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,347 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.dts20200101.models;
import com.aliyun.tea.*;
public class UpgradeTwoWayResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public UpgradeTwoWayResponseBody body;
public static UpgradeTwoWayResponse build(java.util.Map<String, ?> map) throws Exception {
UpgradeTwoWayResponse self = new UpgradeTwoWayResponse();
return TeaModel.build(map, self);
}
public UpgradeTwoWayResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public UpgradeTwoWayResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public UpgradeTwoWayResponse setBody(UpgradeTwoWayResponseBody body) {
this.body = body;
return this;
}
public UpgradeTwoWayResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
eb7fe55fbec616183ec8acf43516a81958fbd776 | dc520dbc6c151bd026cb0483058ada2a9acf6f75 | /SP20170629StringSqlJdbcTemp/src/com/study/spring/test/JDBCTest.java | 8c16d431dd57735e2194206e8064b20f8da86597 | [] | no_license | fendou666/frameBySpring | 965b253b252cd75bf1e455b16f616c5a2aa1feff | 3a9e458cfb6a8bb17d8a7644379c765471c22050 | refs/heads/master | 2021-01-21T16:10:14.190480 | 2017-10-11T10:03:54 | 2017-10-11T10:03:54 | 95,399,655 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 5,713 | java | package com.study.spring.test;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.study.mvc.model.dao.StudentDAOImp;
import com.study.mvc.model.javabean.PageSpliteInfo;
import com.study.mvc.model.javabean.StudentInfo;
import com.study.mvc.model.service.IStudentService;
import com.study.mvc.model.service.StudentServiceImp;
import com.study.mvc.tools.DBUtil;
public class JDBCTest {
@Test
public void AcBeanTest(){
ApplicationContext ac = new ClassPathXmlApplicationContext("com/study/spring/config/BackSpringAC.xml");
DBUtil jdbc1 = ac.getBean("dbutil", DBUtil.class);
DBUtil jdbc2 = ac.getBean("dbutil", DBUtil.class);
StudentDAOImp dao1 = ac.getBean("DAO", StudentDAOImp.class);
StudentDAOImp dao2 = ac.getBean("DAO", StudentDAOImp.class);
// 这个是为什么
System.out.println("bean 1" + jdbc1.hashCode());
jdbc1.setErrInfo("aaaaaaaa1111");
System.out.println("bean 2" + jdbc2.hashCode());
System.out.println("bean1==bean2 " + (jdbc1 == jdbc2));
System.out.println(jdbc2.getErrInfo());
System.out.println("DAO1==DAO2 " + (dao1 == dao2));
}
@Test
public void testPage(){
ApplicationContext ac = new ClassPathXmlApplicationContext("com/study/spring/config/BackSpringAC.xml");
PageSpliteInfo page1 = ac.getBean("pageSP", PageSpliteInfo.class);
PageSpliteInfo page2 = ac.getBean("pageSP", PageSpliteInfo.class);
// 这个是为什么
System.out.println("page 1" + page1.hashCode());
page1.setPageMaxIndex(10);
page1.setCurrentPageIndex(2);
System.out.println("page 2" + page2.hashCode());
System.out.println(page1.getCurrentPageIndex());
System.out.println(page2.getCurrentPageIndex());
System.out.println("page1==page2 " + (page1 == page1));
}
@Test
public void DBUtilTest(){
ApplicationContext ac = new ClassPathXmlApplicationContext("com/study/spring/config/BackSpringAC.xml");
DBUtil jdbc = ac.getBean("dbutil", DBUtil.class);
String sql = "INSERT INTO firstTB VALUES(2, '小明', 22)";
int insertrst = jdbc.updateSql(sql, null);
if(insertrst!=0){
System.out.println("数据插入成功");
}
// String querySql = "SELECT name FROM studentInfoA WHERE id=502";
// ResultSet rs = jdbc.queryData(querySql, null);
// try {
// while(rs.next()){
// System.out.println(rs.getObject("name"));
// }
// } catch (SQLException e) {
// e.printStackTrace();
// }
// String updtsql = "UPDATE studentInfoA SET stuNum=105022, name='ls-105022', sex='男', age=23, gradeFrom='桂云山庄' WHERE id=502";
// int updateRst = jdbc.updateSql(updtsql, null);
// if(updateRst!=0){
// System.out.println("数据更新成功");
// }
// String delsql = "DELETE FROM studentInfoA WHERE id=502";
// int delRst = jdbc.updateSql(delsql, null);
// if(delRst!=0){
// System.out.println("数据更新成功");
// }
}
@Test
public void DAOTest(){
ApplicationContext ac = new ClassPathXmlApplicationContext("com/study/spring/config/BackSpringAC.xml");
// 这里使用接口试一试
StudentDAOImp DAO = ac.getBean("DAO",StudentDAOImp.class);
//StudentInfo stu = new StudentInfo(503, 10503, "ls-10503", "女", 22, "长安大学");
// ================DAO插入数据
// boolean insertSign = DAO.insertStudentInfo(stu);
// if(insertSign){
// System.out.println("DAO插入数据成功");
// }
// ================DAO查询数据
// HashMap stuMap = DAO.getStudentByCondition(0, "123", "男", 20, 22, "zz");
// if(!stuMap.isEmpty()){
// System.out.println("获取到数据");
// }
//
// // ===============DAO更新数据
// stu.setName("小红");
// boolean updSign = DAO.saveStudentInfo(stu);
// if(updSign == true){
// System.out.println("更新成功");
// }
//
// // ===============DAO删除数据
}
// ================service测试=================
@Test
public void serviceTest(){
ApplicationContext ac = new ClassPathXmlApplicationContext("com/study/spring/config/BackSpringAC.xml");
// 这里使用接口试一试
IStudentService service = ac.getBean("service",StudentServiceImp.class);
//StudentInfo stu = new StudentInfo(502, 10502, "ls-10502", "女", 22, "长安大学");
// // ================service插入数据
// boolean insertSign = service.insertStudentInfo(stu);
// if(insertSign){
// System.out.println("service插入数据成功");
// }
// // ================service查询数据
// List<StudentInfo> stuList = service.getStudentByCondition(0, "123", "男", 20, 22, "zz");
// if(stuList.size()<1){
// System.out.println("没有获取到数据");
// }
//
// // ===============service更新数据
// stu.setName("小红");
// boolean updSign = service.saveStudentInfo(stu);
// if(updSign == true){
// System.out.println("更新成功");
// }
// ===============service删除数据
// boolean delSign = service.deleteStudentInfo(stu.getId());
// if(delSign == true){
// System.out.println("删除成功");
// }
}
@Test
public void txTest(){
ApplicationContext ac = new ClassPathXmlApplicationContext("com/study/spring/config/BackSpringAC.xml");
// Object bean = ac.getBean("service");
StudentInfo stu = new StudentInfo(511, 10503, "ls-10503", "女", 22, "长安大学");
// System.out.println(((IStudentService)bean).insertStudentInfo(stu));
IStudentService svc = ac.getBean("service", IStudentService.class);
System.out.println(svc.insertStudentInfo(stu));
// StudentServiceImp svc2 = ac.getBean("service", StudentServiceImp.class);
// System.out.println(svc2.insertStudentInfo(stu));
}
}
| [
"ls_code@126.com"
] | ls_code@126.com |
02564025ea408aca344502e0389e2c260dab6d0a | 3ef63dece68297d09beeb93b62c6bbda3d845c77 | /slideshow/src/main/java/com/ndhzs/slideshow/viewpager2/transformer/RotateYTransformer.java | 3ee3d708f667c503d96e5c167c71a1d1dfa3feb5 | [] | no_license | hall-of-fame/HallOfFame_Android | 6efc3e614b2c97c9cf50b98608ba79cda06593bb | cfaab2c9318e226eff94d6294c56cc91df295454 | refs/heads/master | 2023-07-22T11:23:47.073534 | 2021-09-06T13:20:54 | 2021-09-06T13:20:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,652 | java | package com.ndhzs.slideshow.viewpager2.transformer;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.viewpager2.widget.ViewPager2;
public class RotateYTransformer implements ViewPager2.PageTransformer {
private static final float DEFAULT_CENTER = 0.5f;
private static final float DEFAULT_MAX_ROTATE = 20f;
private float mMaxRotate = DEFAULT_MAX_ROTATE;
public RotateYTransformer() {
}
public RotateYTransformer(float maxRotate) {
mMaxRotate = maxRotate;
}
@Override
public void transformPage(@NonNull View view, float position) {
view.setPivotY(view.getHeight()/2F);
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setRotationY(-1 * mMaxRotate);
view.setPivotX(view.getWidth());
} else if (position <= 1) { // [-1,1]
// Modify the default slide transition to shrink the page as well
view.setRotationY(position * mMaxRotate);
//[0,-1]
if (position < 0) {
view.setPivotX(view.getWidth() * (DEFAULT_CENTER + DEFAULT_CENTER * (-position)));
view.setPivotX(view.getWidth());
} else {//[1,0]
view.setPivotX(view.getWidth() * DEFAULT_CENTER * (1 - position));
view.setPivotX(0);
}
// Scale the page down (between MIN_SCALE and 1)
} else {
// (1,+Infinity]
// This page is way off-screen to the right.
view.setRotationY(1 * mMaxRotate);
view.setPivotX(0);
}
}
}
| [
"2767465918@qq.com"
] | 2767465918@qq.com |
55f501254372399172a44d398454759b969065a6 | 5d7ab2ab1dc4eef3490fa9099060ffb3a64a38fe | /graduate2.0/src/main/java/com/example/graduatedesign/Model/OrganizationComment.java | 6e847618e05bfcb58f5c988f6e878de27bf7e75a | [] | no_license | HuangXiaoFengGitHub/graduatedesign | fab57b14492d1c5344c708dacf3e1cad48cf7e0e | 6ebdbee978eddaf1dc5ac438d16d6a46fb97f327 | refs/heads/master | 2020-05-07T09:47:31.659567 | 2019-05-09T10:32:08 | 2019-05-09T10:32:08 | 180,391,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.example.test1.demo.Model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.Calendar;
@Data
@Builder
@Entity(name="t_organization_comment")
@AllArgsConstructor
@NoArgsConstructor
public class OrganizationComment {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long commentId;
@ManyToOne
@JoinColumn(name="user_id")
private User user;
@ManyToOne
@JoinColumn(name="activity_id")
private Organization organization;
@Column(columnDefinition = "longtext")
private String content;
private long parentId;
private int commentLikeCount;
private Calendar createTime;
private Calendar updateTime;
}
| [
"2018hxf@gmail.com"
] | 2018hxf@gmail.com |
46d53d2d84c82674361bc9a9140255080f8959a2 | 12efd93581ba435dc6276882fb97f199690b9d7f | /task-planner-system/src/main/java/com/rjnsh/tps/service/SprintProcessor.java | cb6000504e712d8734ea355250057124f13f3b02 | [] | no_license | RajneeshDubey/jira-task-planner-system | 52496bf318f32ccb02f14f75acbd204598121488 | 01d60263bf9bac2b3602d4140a7e74c1695b1c14 | refs/heads/master | 2022-01-13T21:21:21.002244 | 2019-08-05T09:14:08 | 2019-08-05T09:14:08 | 200,622,598 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 978 | java | package com.rjnsh.tps.service;
import com.rjnsh.tps.entity.Sprint;
import com.rjnsh.tps.entity.Task;
import com.rjnsh.tps.exeptions.SprintNotFoundException;
import com.rjnsh.tps.exeptions.TaskNotFoundException;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("sprintProcessor")
public interface SprintProcessor {
// storing data store in static variable
public static Map<String, Sprint> sprints = new HashMap<String, Sprint>();
public Boolean createSprint(String sprintId);
public Boolean deleteSprint(String sprintId) throws SprintNotFoundException;
public Boolean addTask(String sprintId, String taskId) throws SprintNotFoundException, TaskNotFoundException;
public Boolean removeTask(String sprintId, String taskId) throws SprintNotFoundException, TaskNotFoundException;
public String displaySprintSnapshot(String sprintId) throws SprintNotFoundException;
}
| [
"rajneeshdubey@emc.com"
] | rajneeshdubey@emc.com |
803885e98acfc03257c58b52d10863e587e40fae | dc2697bc0c64471ed57742893f5ea3961f106432 | /EMaulWebServer/src/main/java/com/jaha/web/emaul/config/FaviconConfiguration.java | 94d0665405d9a9b71a93267b9a8accdf2e838005 | [] | no_license | sms8884/EmaulWeb | 49c097c74365312c4532079b793d73b7bcac5031 | 7ec9a1f8dbe8ed481c9df7c7d195d7d8ea0bf0fc | refs/heads/master | 2021-01-01T19:36:47.116987 | 2017-08-18T04:46:56 | 2017-08-18T04:46:56 | 98,624,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,728 | java | package com.jaha.web.emaul.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Configuration
public class FaviconConfiguration {
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
"/META-INF/resources/", "/resources/",
"/static/", "/public/" };
@Bean
public SimpleUrlHandlerMapping faviconHandlerMapping() {
SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
mapping.setOrder(Integer.MIN_VALUE + 1);
mapping.setUrlMap(Collections.singletonMap("**/favicon.ico",
faviconRequestHandler()));
return mapping;
}
@Bean
public ResourceHttpRequestHandler faviconRequestHandler() {
ResourceHttpRequestHandler requestHandler = new ResourceHttpRequestHandler();
requestHandler.setLocations(getLocations());
requestHandler.setCacheSeconds(0);
return requestHandler;
}
private List<Resource> getLocations() {
List<Resource> locations = new ArrayList<Resource>(
CLASSPATH_RESOURCE_LOCATIONS.length + 1);
for (String location : CLASSPATH_RESOURCE_LOCATIONS) {
locations.add(new ClassPathResource(location));
}
locations.add(new ClassPathResource("/"));
return Collections.unmodifiableList(locations);
}
} | [
"sms8884@nate.com"
] | sms8884@nate.com |
059943ea6e3388200b1eab63a6f12841e7523402 | c5b6b07e7d6c32f326393f20b3a937fa04125f02 | /FatimaApp/src/main/java/com/foohyfooh/fatima/sports/data/NavigationItem.java | c8f8d6ed1da2e131b49b6ae16efab5043c2c1ef6 | [] | no_license | foohyfooh/FatimaAppProject | 3450b17776ea8ab0cc41ae5d209877ae240ad228 | 71dbcb1aa40f2e3a8ad6778099bce8997e952f83 | refs/heads/master | 2020-05-20T10:17:21.525927 | 2014-07-09T12:25:58 | 2014-07-09T12:25:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | package com.foohyfooh.fatima.sports.data;
import com.foohyfooh.fatima.sports.R;
public class NavigationItem {
public String title;
public final boolean isHeader;
private NavigationItem(String title, boolean isHeader){
this.title = title;
this.isHeader = isHeader;
}
public static NavigationItem newItem(String title){
return new NavigationItem(title, false);
}
public static NavigationItem newTitle(String title){
return new NavigationItem(title, true);
}
public int getLayoutResource(){
return isHeader ? R.layout.navigation_title : R.layout.navigation_item;
}
}
| [
"foohyfooh@gmail.com"
] | foohyfooh@gmail.com |
ca5ca40b93a9a889f747172b88abefc882baa7fb | ca115e90fea786d3ccf87cda3cf9fcafaf0c709a | /cascading-core/src/main/java/cascading/flow/stream/element/FunctionEachStage.java | dde29e69af69cc5201325176fd40a437bb553471 | [
"Apache-2.0"
] | permissive | tdyas/cascading | b82d8eebbbac2f071de6441de41ae872b7ef4b0b | 05720bf78c05d80606f0f81c3e68cc37139b8bda | refs/heads/wip-3.0 | 2021-01-18T00:00:39.486664 | 2015-02-25T05:34:29 | 2015-02-25T05:34:29 | 31,339,199 | 0 | 0 | null | 2015-02-25T22:29:51 | 2015-02-25T22:29:51 | null | UTF-8 | Java | false | false | 3,004 | java | /*
* Copyright (c) 2007-2014 Concurrent, Inc. All Rights Reserved.
*
* Project and contact information: http://www.cascading.org/
*
* This file is part of the Cascading project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cascading.flow.stream.element;
import java.io.IOException;
import cascading.CascadingException;
import cascading.flow.FlowProcess;
import cascading.flow.stream.duct.Duct;
import cascading.operation.Function;
import cascading.pipe.Each;
import cascading.pipe.OperatorException;
import cascading.tuple.Fields;
import cascading.tuple.Tuple;
import cascading.tuple.TupleEntry;
import cascading.tuple.TupleEntryCollector;
import cascading.tuple.Tuples;
/**
*
*/
public class FunctionEachStage extends EachStage
{
private Function function;
public FunctionEachStage( FlowProcess flowProcess, Each each )
{
super( flowProcess, each );
}
@Override
protected Fields getIncomingPassThroughFields()
{
return incomingScopes.get( 0 ).getIncomingFunctionPassThroughFields();
}
@Override
protected Fields getIncomingArgumentsFields()
{
return incomingScopes.get( 0 ).getIncomingFunctionArgumentFields();
}
@Override
public void initialize()
{
super.initialize();
function = each.getFunction();
operationCall.setArguments( argumentsEntry );
operationCall.setOutputCollector( new TupleEntryCollector( getOperationDeclaredFields() )
{
@Override
protected void collect( TupleEntry input ) throws IOException
{
Tuple outgoing = outgoingBuilder.makeResult( incomingEntry.getTuple(), input.getTuple() );
outgoingEntry.setTuple( outgoing );
try
{
next.receive( FunctionEachStage.this, outgoingEntry );
}
finally
{
Tuples.asModifiable( outgoing );
}
}
} );
}
@Override
public void receive( Duct previous, TupleEntry incomingEntry )
{
this.incomingEntry = incomingEntry;
argumentsEntry.setTuple( argumentsBuilder.makeResult( incomingEntry.getTuple(), null ) );
try
{
function.operate( flowProcess, operationCall ); // adds results to collector
}
catch( CascadingException exception )
{
handleException( exception, argumentsEntry );
}
catch( Throwable throwable )
{
handleException( new OperatorException( each, "operator Each failed executing operation", throwable ), argumentsEntry );
}
}
}
| [
"chris@wensel.net"
] | chris@wensel.net |
09820db0a712c8b04006ee7eda8d490a3fd12b66 | 354d62251347f9e93105d104ba20da9bfed44b0e | /app/src/main/java/com/example/comercioemrede/helper/ConfiguracaoFirebase.java | 81811c991cd2057e4de830869f304fcfcc590abf | [] | no_license | comercioemredes/ComercioEmRede | a51258824370b287e211a09cc28ca69bd219e169 | 24dfccde3d226c173c3f59fa0d1f2abf6a235581 | refs/heads/master | 2022-12-11T02:05:20.217017 | 2020-09-02T16:28:58 | 2020-09-02T16:28:58 | 291,486,633 | 0 | 0 | null | 2020-08-30T14:30:17 | 2020-08-30T14:30:16 | null | UTF-8 | Java | false | false | 802 | java | package com.example.comercioemrede.helper;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class ConfiguracaoFirebase {
private static DatabaseReference referenciaFirebase;
private static FirebaseAuth referenciaAutenticacao;
public static DatabaseReference getFirebase(){
if ( referenciaFirebase==null ){
referenciaFirebase = FirebaseDatabase.getInstance().getReference();
}
return referenciaFirebase;
}
public static FirebaseAuth getReferenciaAutenticacao(){
if ( referenciaAutenticacao==null ){
referenciaAutenticacao = FirebaseAuth.getInstance();
}
return referenciaAutenticacao;
}
}
| [
"50850563+Veqtru@users.noreply.github.com"
] | 50850563+Veqtru@users.noreply.github.com |
47219b75bf14cd97495f4a9499e48bc4d791c08f | f84611a363f015633dab9eb59f345a45d2a1448e | /src/test/java/online/zhaopei/myproject/sqlprovide/gjent/test/PersonalInfoSqlProvideTest.java | d0eb40ed2eb52fca6f8af39b6f9b494baf62a4a8 | [
"MIT"
] | permissive | lilylian/maintain | e09f76e7c9467723a843d399516ae61b856f7b51 | ebb6b656fc437b85d3e525a90881e18b72f99173 | refs/heads/master | 2020-03-18T08:10:52.049347 | 2018-05-11T12:08:35 | 2018-05-11T12:08:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package online.zhaopei.myproject.sqlprovide.gjent.test;
import online.zhaopei.myproject.domain.gjent.PersonalInfo;
import online.zhaopei.myproject.sqlprovide.gjent.PersonalInfoSqlProvide;
import org.junit.Test;
/**
* Created by zhaopei on 17/11/6.
*/
public class PersonalInfoSqlProvideTest {
@Test
public void statisticsPersonalInfoSqlTest() throws Exception {
System.out.println("Test");
PersonalInfoSqlProvide pisp = new PersonalInfoSqlProvide();
PersonalInfo pi = new PersonalInfo();
pi.setGroupOne("to_char(pil1.sys_date, 'yyyy-mm-dd')");
pi.setGroupTwo("to_char(pil1.sys_date, 'yyyy-mm-dd hh24')");
pi.setBeginSysDate("2017-11-01");
pi.setEndSysDate("2017-11-02");
pi.setSysDateStr("2017-11-03");
System.out.println(pisp.statisticsPersonalInfoSql(pi));
}
}
| [
"zhaopei0418@aol.com"
] | zhaopei0418@aol.com |
7505b80c92fd7132605dbf85c4fdde15bd7e7511 | a6ca30b40964d038b76504f444e98c31b82b7325 | /Mobile-Web/src/main/java/com/mobilous/mobileweb/ui/Label.java | 2cc3532a709563303c58d23d2d598df7132b178c | [] | no_license | hunkysatish007/hunkysatish007 | 38ac314a48860ca60a9d0b49837a086c61dab5af | 61981025f42393aaa6bf76f46985f53cebf2e907 | refs/heads/master | 2023-04-27T23:57:38.508540 | 2021-05-18T09:34:29 | 2021-05-18T09:34:29 | 368,468,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,796 | java | package com.mobilous.mobileweb.ui;
import java.util.ArrayList;
import com.mobilous.mobileweb.attribute.Color;
import com.mobilous.mobileweb.attribute.DateFormat;
import com.mobilous.mobileweb.attribute.Font;
import com.mobilous.mobileweb.attribute.NumberFormat;
import com.mobilous.mobileweb.etc.Size;
import com.mobilous.mobileweb.event.Event;
public class Label extends BaseView {
private String viewType = "Label";
private String type = "";
private String text = "";
private String link = "";
private int optionIndex = 0;
private String textAlignment = "";
private String lineBreakMode = "";
private String baseLineAdjustment = "";
private boolean adjustsFontSizeToFitWidth = false;
private boolean highlighted = false;
private int numberOfLines = -1;
private int minimumFontSize = -1;
private Font font = null;
private NumberFormat numberFormat = null;
private DateFormat dateFormat = null;
private Color highlightedTextColor = null;
private Color shadowColor = null;
private Size shadowOffset = null;
private String borderStyle = null;
private String borderWidth = "0";
private Padding padding = null;
private Color borderColor = null;
private Color backgroundColor = null;
private int tabOrder=0;
private String formatType = "";
private String formatSubtype = "";
private String specifierType = "";
private String formatSpecifier = "";
private boolean trim = false;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getTextAlignment() {
return textAlignment;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public int getOptionIndex() {
return optionIndex;
}
public void setOptionIndex(int optionIndex) {
this.optionIndex = optionIndex;
}
public void setTextAlignment(String textAlignment) {
this.textAlignment = textAlignment;
}
public String getLineBreakMode() {
return lineBreakMode;
}
public void setLineBreakMode(String lineBreakMode) {
this.lineBreakMode = lineBreakMode;
}
public String getBaseLineAdjustment() {
return baseLineAdjustment;
}
public void setBaseLineAdjustment(String baseLineAdjustment) {
this.baseLineAdjustment = baseLineAdjustment;
}
public boolean isAdjustsFontSizeToFitWidth() {
return adjustsFontSizeToFitWidth;
}
public void setAdjustsFontSizeToFitWidth(boolean adjustsFontSizeToFitWidth) {
this.adjustsFontSizeToFitWidth = adjustsFontSizeToFitWidth;
}
public boolean isHighlighted() {
return highlighted;
}
public void setHighlighted(boolean highlighted) {
this.highlighted = highlighted;
}
public int getNumberOfLines() {
return numberOfLines;
}
public void setNumberOfLines(int numberOfLines) {
this.numberOfLines = numberOfLines;
}
public int getMinimumFontSize() {
return minimumFontSize;
}
public void setMinimumFontSize(int minimumFontSize) {
this.minimumFontSize = minimumFontSize;
}
public Font getFont() {
return font;
}
public void setFont(Font font) {
this.font = font;
}
public NumberFormat getNumberFormat() {
return numberFormat;
}
public void setNumberFormat(NumberFormat numberFormat) {
this.numberFormat = numberFormat;
}
public DateFormat getDateFormat() {
return dateFormat;
}
public void setDateFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat;
}
public Color getHighlightedTextColor() {
return highlightedTextColor;
}
public void setHighlightedTextColor(Color highlightedTextColor) {
this.highlightedTextColor = highlightedTextColor;
}
public Color getShadowColor() {
return shadowColor;
}
public void setShadowColor(Color shadowColor) {
this.shadowColor = shadowColor;
}
public Size getShadowOffset() {
return shadowOffset;
}
public void setShadowOffset(Size shadowOffset) {
this.shadowOffset = shadowOffset;
}
public String getBorderStyle() {
return borderStyle;
}
public void setBorderStyle(String borderStyle) {
this.borderStyle = borderStyle;
}
public String getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(String borderWidth) {
this.borderWidth = borderWidth;
}
public Padding getPadding() {
return padding;
}
public void setPadding(Padding padding) {
this.padding = padding;
}
public Color getBorderColor() {
return borderColor;
}
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
public Color getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(Color backgroundColor) {
this.backgroundColor = backgroundColor;
}
@Override
public String getViewType() {
return viewType;
}
@Override
public String toString() {
return null;
}
@Override
public ArrayList<Event> getEvent() {
return null;
}
public int getTabOrder() {
return tabOrder;
}
public void setTabOrder(int tabOrder) {
this.tabOrder = tabOrder;
}
public String getFormatType() {
return formatType;
}
public void setFormatType(String formatType) {
this.formatType = formatType;
}
public String getFormatSubtype() {
return formatSubtype;
}
public void setFormatSubtype(String formatSubtype) {
this.formatSubtype = formatSubtype;
}
public String getSpecifierType() {
return specifierType;
}
public void setSpecifierType(String specifierType) {
this.specifierType = specifierType;
}
public String getFormatSpecifier() {
return formatSpecifier;
}
public void setFormatSpecifier(String formatSpecifier) {
this.formatSpecifier = formatSpecifier;
}
public boolean isTrim() {
return trim;
}
public void setTrim(boolean trim) {
this.trim = trim;
}
}
| [
"tiwarismmarty356@gmail.com"
] | tiwarismmarty356@gmail.com |
c4609f6846c6d9612a997697451ac4488ad9ab92 | 5909f61093bc45510ce14013e494f20793a063c5 | /src/com/chaipoint/thirdparty/helper/shadowfax/ResponseOrder.java | 2871e890b16830703e09f7f1f641adf38febdd80 | [] | no_license | anandhumohan/onetoten | ea238df7215ba25ce8f42b1b1f36fede51093921 | fcfb1c9176603b0f6b7ec0647b290fe640cb8865 | refs/heads/master | 2021-01-10T13:48:40.554568 | 2016-02-03T12:17:12 | 2016-02-03T12:17:12 | 50,995,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package com.chaipoint.thirdparty.helper.shadowfax;
public class ResponseOrder {
private String message;
private DataTrack data;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public DataTrack getData() {
return data;
}
public void setData(DataTrack data) {
this.data = data;
}
}
| [
"anandhu"
] | anandhu |
dbbd872e859720e27758edea4f0321cf09dd3990 | e8ad1c96481e064b01d5d27e007da3cf3a7c56b7 | /src/java/auth/Auth.java | 5f4b35443727b2d3952b372b7a4a0a6eda2fabee | [] | no_license | HisbikalHaqqi/JAVA_WEB_CRUD | 552e1feffe09aed4bd21a14b83a548dc08b2247f | 273ca8f4d2787b1f713a7db35a6beb6ad909e60b | refs/heads/master | 2023-01-21T09:11:26.893811 | 2020-11-22T07:33:05 | 2020-11-22T07:33:05 | 314,983,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,014 | 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 auth;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
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 koneksi.Koneksi;
import javax.servlet.http.HttpSession;
/**
*
* @author NetTech
*/
@WebServlet(name = "Auth", urlPatterns = {"/Auth"})
public class Auth extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession(true);
try{
String userid = request.getParameter("username");
String pwd = request.getParameter("password");
Connection con = Koneksi.connect_db();
Statement stat = con.createStatement();
ResultSet rs;
rs = stat.executeQuery("SELECT * FROM user WHERE username = '"+userid+"' and password = '"+pwd+"'");
if(rs.next())
{
session.setAttribute("user",userid);
out.println("Welcome"+userid);
out.println("<a href='logout.jsp'>Logout</a>");
if(rs.getString("username").equals("admin"))
{
response.sendRedirect("dashboard.jsp");
}
else
{
response.sendRedirect("index.jsp");
}
}
else
{
out.println("<div class='col-md-4 offset-md-4'>");
out.println("<div class='alert alert-danger'>Username Or Password Not Correct</div>");
out.println("</div");
RequestDispatcher rd = request.getRequestDispatcher("index.jsp");
rd.include(request, response);
}
}
catch(SQLException ex)
{
ex.printStackTrace();
}
}
}
| [
"it.lovers.1998@gmail.com"
] | it.lovers.1998@gmail.com |
c928380b101e1c70968c4b96bcf4e7906178bbdc | 005a358a3501b3f6620dcbb42303c543ae0c41c6 | /src/main/java/me/webapp/exception/CacheException.java | d522561c66cf9a0b212fbedd558a35144d41c58f | [] | no_license | paranoidq/archetype-springboot | c03d6c445477e46beac04d69c708b67d6929f566 | 19097ee78de431a92a1266da96d67ec767a03748 | refs/heads/master | 2020-03-19T01:07:33.938144 | 2018-06-14T14:45:54 | 2018-06-14T14:45:54 | 135,524,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package me.webapp.exception;
/**
* @author paranoidq
* @since 1.0.0
*/
public class CacheException extends AppException {
public CacheException() {
}
public CacheException(String message) {
super(message);
}
public CacheException(String message, Throwable cause) {
super(message, cause);
}
public CacheException(Throwable cause) {
super(cause);
}
public CacheException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"paranoid.qian@gmail.com"
] | paranoid.qian@gmail.com |
961456f5d340aecff7cb2c82219864c6f7bab3b4 | b078b53194ae049b92186c1855cce18e7a1e1a5d | /src/main/java/com/yineng/stream/window/ReduceFunctionMain.java | 9526391e852c72725a261c458ac8a19e43260bb3 | [] | no_license | renyineng/flink-learning | f5f93a8db260b750fa02327169837ad3a87a8eac | 9f4768f2187664a4a15b28c3deea7dc612acf1f3 | refs/heads/master | 2023-08-04T08:41:45.239461 | 2020-05-08T15:31:37 | 2020-05-08T15:31:37 | 247,504,617 | 2 | 0 | null | 2023-07-23T08:46:20 | 2020-03-15T16:24:29 | Java | UTF-8 | Java | false | false | 2,593 | java | package com.yineng.stream.window;
import com.alibaba.fastjson.JSONObject;
import com.sun.javadoc.Type;
import com.yineng.common.connectors.FlinkOrderSource;
import com.yineng.stream.pojo.Order;
import org.apache.flink.api.common.functions.ReduceFunction;
import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.windowing.time.Time;
import java.math.BigDecimal;
/**
* ReduceFunction 学习
* 接收两个类型相同的数据,并将其结合输出为一个类型相同的值
* 当有新数据加入窗口时:该函数被调用,并传入新数据和窗口状态值作为参数。
* 优点:
* 窗口状态恒定而且数据量小;
* 接口简单;
* 缺点:
* 输入输出类型必须相同,可用于简单的聚合需求
* https://xieyuanpeng.com/2019/02/21/flink-learning-4/
* timeWindow 只能用于keyedStream
* demo:统计各个商家的累计销售额和销售量
* 注意点: 此处的map 用了lambda 则必须使用returns 强调返回的类型,否则会报错
*/
public class ReduceFunctionMain {
public static void main(String[] args) throws Exception{
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<String> text = env.socketTextStream("127.0.0.1", 9000, "\n");
SingleOutputStreamOperator<Tuple3<Long, BigDecimal, Long>> source = text
.map(s -> {
JSONObject json = JSONObject.parseObject(s);
return Tuple3.of(json.getLongValue("shop_id"), json.getBigDecimal("amount"), 1L);
}).returns(Types.TUPLE(Types.LONG, Types.BIG_DEC, Types.LONG));
SingleOutputStreamOperator<Tuple3<Long, BigDecimal, Long>> reduce = source
.keyBy(0)
// .timeWindow(Time.seconds(10))
.reduce(new ReduceFunction<Tuple3<Long, BigDecimal, Long>>() {
@Override
public Tuple3<Long, BigDecimal, Long> reduce(Tuple3<Long, BigDecimal, Long> t1, Tuple3<Long, BigDecimal, Long> t2) throws Exception {
return Tuple3.of(t1.f0, t1.f1.add(t2.f1), t1.f2+1L);
}
});
reduce.printToErr();
env.execute("reduce compute");
}
}
| [
"renyineng@100tal.com"
] | renyineng@100tal.com |
7a623e1cc089e9add7d2ae81516c250c6c3fa592 | 883dc767927b1b5a83cbadf218b3f19fdf2ea7e1 | /cloudplatform-webportal-data-model/src/main/java/com/letv/portal/service/elasticcalc/gce/IEcGceClusterService.java | e7da3d7793f74faa2d10d64c445206af2b2c8c52 | [] | no_license | mayl666/cloud_tv | cd72844453f5a56dd5cd2c9556e825eae9720bf8 | cc268c5c3ddc67f66705995172b60e43b79dba0c | refs/heads/master | 2021-05-06T02:28:27.243399 | 2017-09-20T04:05:40 | 2017-09-20T04:05:40 | 114,590,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 700 | java | /**
*
* Copyright (c) 2016 乐视云计算有限公司(lecloud.com). All rights reserved
*
*/
package com.letv.portal.service.elasticcalc.gce;
import com.letv.portal.model.elasticcalc.gce.EcGceCluster;
import com.letv.portal.service.IBaseService;
/**
* IEcGceClusterService
* @author linzhanbo .
* @since 2016年6月29日, 上午10:07:50 .
* @version 1.0 .
*/
public interface IEcGceClusterService extends IBaseService<EcGceCluster> {
/**
* 使用集群名判断该集群是否存在
* @param string
* @return
* @author linzhanbo .
* @since 2016年6月29日, 上午10:15:36 .
* @version 1.0 .
*/
Boolean isExistByName(String clusterName);
}
| [
"linzhanbo@le.com"
] | linzhanbo@le.com |
bccac6186224810b4fddbec68e5482c77551eac7 | 6339cdedf2d83a5908583326f16cf1d36db6b76f | /src/main/java/pt/isel/si/firstserie/commands/ICommand.java | 35c09c9afec554cb79fce3cabfdd82730deefb93 | [
"MIT"
] | permissive | no0law1/SI-1617SI-G3-Serie1 | df9608af4dcacd85036cd3afc336293cd595e438 | 1b9546e190bb3956b7decb9b8b72331746a1d9a0 | refs/heads/master | 2021-03-27T12:00:30.890263 | 2018-07-13T14:45:08 | 2018-07-13T14:45:08 | 71,816,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package pt.isel.si.firstserie.commands;
import java.io.File;
/**
* Commands interface
* All commands should implement this interface
*/
public interface ICommand {
/**
* Executes the command
*
* @param jwt file to cipher or decipher
* @param cert .cert or .pfx file
* @throws Exception
*/
void execute(File jwt, File cert) throws Exception;
}
| [
"carlosmflorencio@gmail.com"
] | carlosmflorencio@gmail.com |
2a19f450d557cc11c02162ce03292c92d17c9ae4 | b9fa8c7ac7fd9b7b2d6427d860352dc88eed8df4 | /src/Protocol/AuthMethod/AuthMethod.java | fae2ccb8e93909f6715b1eb4341bc4d6162d5e25 | [
"MIT"
] | permissive | CtheSky/JSocks | e1d38568c1bc9cabb1892789a49c373a0bdcc662 | b3ccf3b2cbe35390f4bb5735918c4a3d18784e59 | refs/heads/master | 2021-03-28T18:43:00.399737 | 2018-09-02T13:44:39 | 2018-09-02T13:44:39 | 118,349,674 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package Protocol.AuthMethod;
import Protocol.SocksProtocol;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public interface AuthMethod {
byte bytecode();
void sendRequest(DataInputStream in, DataOutputStream out) throws IOException;
void handleRequest(DataInputStream in, DataOutputStream out) throws IOException;
static void sendRequest(DataInputStream in, DataOutputStream out, AuthMethod[] supported) throws IOException {
out.writeByte(5);
out.writeByte(supported.length);
for (AuthMethod method : supported)
out.writeByte(method.bytecode());
out.flush();
byte version = SocksProtocol.checkVersion(in);
byte methodByte = SocksProtocol.checkMethod(in);
for (AuthMethod method : supported) {
if (method.bytecode() == methodByte) {
method.sendRequest(in, out);
return;
}
}
throw new IllegalStateException("Server authentication methods are not supported");
}
}
| [
"cthesky@yeah.net"
] | cthesky@yeah.net |
e113e798b5ec0417301d6fb6c196b0dfbee7214a | cc75245b32ab5e99a2f48020ae4c2af7b3fdc087 | /src/Person.java | ffd4dcffedaf4d9f7a0b3b74b4fcdeb31b410043 | [] | no_license | bassam127/StreamInJava8 | aac77634644f162279db09bc1cb6d51f9466059a | a80056adb650929ea068683eff6bece7beb8ded6 | refs/heads/master | 2021-01-19T19:22:24.291603 | 2017-04-16T13:56:26 | 2017-04-16T13:56:26 | 88,414,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,117 | java |
public class Person {
public String firstName,lastName;
public int age;
public Gender gender;
public Person(String firstName, String lastName, int age,Gender g)
{
this.firstName=firstName;
this.lastName=lastName;
this.age=age;
this.gender=g;
}
public Person(String firstName, int age,Gender g)
{
this(firstName.split(" ")[0],firstName.split(" ")[1],age,g);
}
public static int comparName(Person p1,Person p2)
{
return p1.firstName.compareTo(p2.firstName);
}
public static int comparSurName(Person p1,Person p2)
{
return p1.lastName.compareTo(p2.lastName);
}
public static int comparAge(Person p1,Person p2)
{
return Integer.compare(p1.age,p2.age);
}
public static int comparGender(Person p1,Person p2)
{
return p1.gender==p2.gender?0:p1.gender==Gender.MAIL?1:-1;
}
public static enum Gender
{
MAIL(),FEMAIL();
}
@Override
public String toString() {
return this.firstName +" "+this.lastName+" : "+this.age+"year old " +this.gender.toString();
}
}
| [
"beso.127.d@gmail.com"
] | beso.127.d@gmail.com |
d505d7b436f3c3535959a26e9fba2079d338d1f8 | b10240d47dbff91cdfa7cf44c42838a685c64df2 | /app/src/main/java/com/example/psath/moviemanager/activities/MainActivity.java | 4bd3528fce2d0803a5871e8e62b8ea8a2d8fd482 | [] | no_license | p16996/MovieManager | a572507d076595bf4f5acc851190a6e6f84346d4 | c1c187495b79e27ab27771cb381805296b4a8f9d | refs/heads/master | 2021-07-02T21:01:31.918221 | 2017-09-23T18:18:30 | 2017-09-23T18:18:30 | 104,587,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,950 | java | package com.example.psath.moviemanager.activities;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.example.psath.moviemanager.R;
import com.example.psath.moviemanager.fragments.NowPlayingFragment;
import com.example.psath.moviemanager.fragments.UpcomingFragment;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
showFragment(NowPlayingFragment.class);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
Class fragment=null;
if (id == R.id.nowPlaying) {
fragment= NowPlayingFragment.class;
showFragment(fragment);
} else if (id == R.id.upcoming) {
fragment= UpcomingFragment.class;
showFragment(fragment);
} else if (id == R.id.logout) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
private void showFragment(Class fragmentClass) {
Fragment fragment = null;
try {
fragment = (Fragment) fragmentClass.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.fl, fragment).commit();
}
}
| [
"sai.prathyusha08@gmail.com"
] | sai.prathyusha08@gmail.com |
07ac71396ffa51af715e481e1d3581c62a87ac94 | 87cb5b2300bb3c00d0d69512ecfc54124d95ee0c | /app/src/main/java/functions/basic/Exp.java | 6389851a443d851ecdd3221db4a1eab911dd71e9 | [] | no_license | Zakpav1/Sigma710 | 62cece525754898a16171fbdb3a4a7324066860f | 6c0d6ca57734c3eb74b3873098bc11078b383e12 | refs/heads/master | 2023-05-10T04:26:22.196713 | 2021-06-11T05:21:27 | 2021-06-11T05:21:27 | 369,609,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,034 | java | package functions.basic;
//CE - показательная функция
import functions.Function;
import functions.meta.Mult;
public class Exp implements Function {
private Const base;
public Exp(double a) {
if (a>0 && a!=1)
base = new Const(a);
else
throw new IllegalArgumentException("Недопустимое основание! (Wrong base!)");
}
@Override
public double getValueAt(double x) {
if (x == 0)
return 1;
if (x == 1)
return base.getValue();
return Math.pow(base.getValue(), x);
}
public Function derivative() {
if (Math.abs(base.getValue()-Math.E)<Double.MIN_VALUE)
return new Exp(Math.E);
return new Mult(new Const((new Log(Math.E)).getValueAt(base.getValue())), new Exp(base.getValue()));
}
public String toString() {
StringBuilder res = new StringBuilder("");
res.append(base.toString() + "^(x)");
return res.toString();
}
}//\CE | [
"egor.chitorckin@yandex.ru"
] | egor.chitorckin@yandex.ru |
d66da351409ea22aba5fae186a294a27277fc9d9 | d76cdb4b6a484c3c28a12dc1edcf198f2a93fc50 | /PlanetHA/src/com/avadesign/ha/frame/CusPreference.java | 7a3bdc518414cd3dbd924351a0b2d9391f9193d8 | [] | no_license | kratoswu/avaDGWall | e8b92149bfb1a717490181e62cc9b5f1a273b4ee | 1047661ae2364f3a61dbeb22fe11c1df621e6815 | refs/heads/master | 2021-01-01T06:33:20.331437 | 2015-04-17T06:55:02 | 2015-04-17T06:55:02 | 33,917,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,803 | java | package com.avadesign.ha.frame;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.StreamCorruptedException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.util.Base64;
public class CusPreference {
private SharedPreferences setting;
private Editor editor;
@SuppressLint("CommitPrefEdits")
public CusPreference(Context context)
{
setting = context.getSharedPreferences("SETTING_PREF", 0);
editor = setting.edit();
}
@SuppressWarnings("unchecked")
public ArrayList<HashMap<String,String>> getIcon_Image()
{
String wordBase64 = setting.getString("newWord", "");
byte[] base64Bytes = Base64.decode(wordBase64.getBytes(), 0);
ByteArrayInputStream bais = new ByteArrayInputStream(base64Bytes);
ObjectInputStream ois;
try
{
ois = new ObjectInputStream(bais);
ArrayList<HashMap<String,String>> result = (ArrayList<HashMap<String,String>>) ois.readObject();
return result;
}
catch (StreamCorruptedException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
return null;
}
public boolean setIcon_Image(ArrayList<HashMap<String,String>> image_array)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream(3000);
ObjectOutputStream oos=null;
try
{
oos = new ObjectOutputStream(baos);
oos.writeObject(image_array);
}
catch (IOException e)
{
e.printStackTrace();
}
String newWord = new String(Base64.encode(baos.toByteArray(),0));
editor.putString("newWord", newWord);
editor.commit();
return editor.commit();
}
@SuppressWarnings("unchecked")
public ArrayList<HashMap<String,Object>> getGatewayHistory()
{
String wordBase64 = setting.getString("history", "");
byte[] base64Bytes = Base64.decode(wordBase64.getBytes(), 0);
ByteArrayInputStream bais = new ByteArrayInputStream(base64Bytes);
ObjectInputStream ois;
try
{
ois = new ObjectInputStream(bais);
ArrayList<HashMap<String, Object>> result = (ArrayList<HashMap<String,Object>>) ois.readObject();
return result;
}
catch (StreamCorruptedException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
return null;
}
public boolean setGatewayHistory(ArrayList<HashMap<String,Object>> his_array)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream(3000);
ObjectOutputStream oos=null;
try
{
oos = new ObjectOutputStream(baos);
oos.writeObject(his_array);
}
catch (IOException e)
{
e.printStackTrace();
}
String newWord = new String(Base64.encode(baos.toByteArray(),0));
editor.putString("history", newWord);
editor.commit();
return editor.commit();
}
// setController----------------------------------------------------------------------------
public boolean setControllerMAC(String mac)
{
editor.putString("C_MAC", mac.toUpperCase(Locale.getDefault()));
return editor.commit();
}
public String getControllerMAC()
{
return setting.getString("C_MAC", "");
}
public boolean setControllerIP(String ip)
{
editor.putString("C_IP", ip);
return editor.commit();
}
public String getControllerIP()
{
return setting.getString("C_IP", "");
}
public boolean setControllerAcc(String acc)
{
editor.putString("C_ACC", acc);
return editor.commit();
}
public String getControllerAcc()
{
return setting.getString("C_ACC", "");
}
public boolean setControllerPwd(String pwd)
{
editor.putString("C_PWD", pwd);
return editor.commit();
}
public String getControllerPwd()
{
return setting.getString("C_PWD", "");
}
public boolean setControllerPort(int port)
{
editor.putInt("C_PORT", port);
return editor.commit();
}
public int getControllerPort()
{
return setting.getInt("C_PORT", 0);
}
public boolean setControllerVersion(String version)
{
editor.putString("C_VERSION", version);
return editor.commit();
}
public String getControllerVersion()
{
return setting.getString("C_VERSION", "");
}
// ----------------------------------------------------------------------------
public boolean setUpdateTime(long time)
{
editor.putLong("C_UpdateTime", time);
return editor.commit();
}
public Long getUpdateTime()
{
return setting.getLong("C_UpdateTime", 0);
}
public boolean setIsLocalUsed(boolean value) {
editor.putBoolean("IS_LOCAL", value);
return editor.commit();
}
public boolean isLocalUsed(){
return setting.getBoolean("IS_LOCAL", true);
}
public boolean setIsPush(boolean value) {
editor.putBoolean("IsPush", value);
return editor.commit();
}
public boolean isPush(){
return setting.getBoolean("IsPush", true);
}
public boolean setUserAccount(String value) {
editor.putString("ADMIN_NAME", value);
return editor.commit();
}
public String getUserAccount(){
return setting.getString("ADMIN_NAME", "");
}
public boolean setUserPassword(String value) {
editor.putString("ADMIN_PWD", value);
return editor.commit();
}
public String getUserPassword(){
return setting.getString("ADMIN_PWD", "");
}
public boolean setAutoLogin(boolean value) {
editor.putBoolean("AUTO_LOGIN", value);
return editor.commit();
}
public boolean getAutoLogin(){ //when got error, like http 401
return setting.getBoolean("AUTO_LOGIN", false);
}
public boolean setStopPolling(boolean value) {
editor.putBoolean("STOP_POLLING", value);
return editor.commit();
}
public boolean isStopPolling(){ //when got error, like http 401
return setting.getBoolean("STOP_POLLING", false);
}
public boolean setFilter(int filter) {
editor.putInt("filter", filter);
return editor.commit();
}
public int getFilter(){
return setting.getInt("filter", 0);
}
}
| [
"yen.tsai@avadesign.com.tw"
] | yen.tsai@avadesign.com.tw |
a44e82e5c9064e85e78aaf131b95ee838a589f24 | 6e0f184ddc384400f9b1e547eee73d20a9e00908 | /app/src/main/java/com/technosales/net/buslocationannouncement/network/PassengerCountUpdate.java | 34a6b02bbb5b8b63ea868ef01f7f32a52000d266 | [] | no_license | euphoriatech25/TicketApp_MOSAMBEE | 7ed4c5e8ef9ad9325e94df77ba1287230fd388fa | cc9fb098d09dff0b602b813e526223fa067a25a5 | refs/heads/master | 2023-06-25T15:36:59.588468 | 2021-07-21T11:46:15 | 2021-07-21T11:46:15 | 337,678,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,060 | java | package com.technosales.net.buslocationannouncement.network;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import com.technosales.net.buslocationannouncement.APIToken.TokenManager;
import com.technosales.net.buslocationannouncement.TicketBusApp;
import com.technosales.net.buslocationannouncement.pojo.ApiError;
import com.technosales.net.buslocationannouncement.serverconn.RetrofitInterface;
import com.technosales.net.buslocationannouncement.serverconn.ServerConfigNew;
import com.technosales.net.buslocationannouncement.utils.GeneralUtils;
import com.technosales.net.buslocationannouncement.utils.UtilStrings;
import java.util.List;
import java.util.Map;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static android.content.Context.MODE_PRIVATE;
public class PassengerCountUpdate {
public static void pushPassengerCount(final Context context, final String totalCount) {
TokenManager tokenManager;
tokenManager = TokenManager.getInstance(TicketBusApp.getContext().getSharedPreferences("prefs", MODE_PRIVATE));
context.getSharedPreferences(UtilStrings.SHARED_PREFERENCES, 0).edit().putBoolean(UtilStrings.DATA_SENDING, true).apply();
if (GeneralUtils.isNetworkAvailable(context)) {
RetrofitInterface post = ServerConfigNew.createServiceWithAuth(RetrofitInterface.class, tokenManager);
Call<ResponseBody> call = post.updatePassengerCount( context.getSharedPreferences(UtilStrings.SHARED_PREFERENCES, 0).getString(UtilStrings.DEVICE_ID, ""),totalCount);
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
if (response.isSuccessful()) {
} else if (response.code() == 404) {
handleError(response.errorBody(), context);
} else if (response.code() == 401) {
} else if (response.code() == 400) {
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
// Toast.makeText(context, t.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
Log.i("TAG", "onFailure: " + t.getLocalizedMessage());
}
});
}
}
private static void handleError(ResponseBody errorBody, Context context) {
ApiError apiErrors = GeneralUtils.convertErrors(errorBody);
if (errorBody != null) {
for (Map.Entry<String, List<String>> error : apiErrors.getErrors().entrySet()) {
if (error.getKey().equals("message")) {
Toast.makeText(context, error.getValue().get(0), Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(context, "something went wrong", Toast.LENGTH_SHORT).show();
}
}
}
| [
"sadikshyamishra2526@gmail.com"
] | sadikshyamishra2526@gmail.com |
a672b497d680f4e3c5b74314e9b0cd36e5b3b094 | f3be2c4d332c7a3045deab281112695f8646dcdb | /src/main/java/com/algaworks/algafood/api/domain/repository/CozinhaRepository.java | 510eb6a8788fd2d03fed125c78e4b50374c622cc | [] | no_license | reijunior1/algafood-api-rest | 4c52d182fdd5114d47aa5ffdca6ee7da75d579e0 | fecc39db0312da5c83b06e9f6acacc4e0277d666 | refs/heads/master | 2022-11-10T06:22:15.929876 | 2020-06-30T21:55:54 | 2020-06-30T21:55:54 | 275,047,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package com.algaworks.algafood.api.domain.repository;
import java.util.List;
import com.algaworks.algafood.api.domain.model.Cozinha;
public interface CozinhaRepository {
List<Cozinha> todas();
Cozinha porId(Long id);
Cozinha adicionar(Cozinha cozinha);
void remover(Cozinha cozinha);
}
| [
"reijunior1@hotmail.com"
] | reijunior1@hotmail.com |
e00c271f2d2cc619520329823e3ffaeb816330fe | 458682c31b577015f73fba04a4311938f3a24633 | /src/main/java/com/unitedremote/store/config/LoggingAspectConfiguration.java | 5f1146e03fa528a37d6ec97da24d11bebc0d8573 | [] | no_license | controle1992/coding-challenge | 6dfe192e9a41608dc018c3f1dbdb02505455d786 | fd9214c91947ed44df51fc6c794d10f242881db8 | refs/heads/master | 2022-12-23T19:27:36.421520 | 2019-12-15T17:35:13 | 2019-12-15T17:35:13 | 111,962,265 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package com.unitedremote.store.config;
import com.unitedremote.store.aop.logging.LoggingAspect;
import io.github.jhipster.config.JHipsterConstants;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
@Configuration
@EnableAspectJAutoProxy
public class LoggingAspectConfiguration {
@Bean
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public LoggingAspect loggingAspect(Environment env) {
return new LoggingAspect(env);
}
}
| [
"c.moussaddaq@gmail.com"
] | c.moussaddaq@gmail.com |
4ad7d3e138f6a04d33cd7ec73f4417343f5d1a8c | 50d0f12d4362d221477e86233094193786c6794d | /src/main/java/com/swg/acs/message/struct/DeviceIdStruct.java | 2fb4949af2bc5d10444224b98ad853a3dfc5161d | [] | no_license | xwxwya/acs | b5adf2875db1146b1e05acea28b58ed5e6b7fb4a | df6eff9a986e87e878829ab85cd855723a15b8ef | refs/heads/master | 2023-08-29T14:59:17.435735 | 2021-10-28T06:04:32 | 2021-10-28T06:04:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,305 | java | /**
*
*/
package com.swg.acs.message.struct;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author satriaprayoga
*
*/
public class DeviceIdStruct implements Serializable {
private static final long serialVersionUID = 2607823294795434673L;
private Long deviceId;
private String messageId;
private String manufacturer;
private String oui;
private String productClass;
private String serialNumber;
private Timestamp dt;
public DeviceIdStruct() {
}
public DeviceIdStruct(String manufacturer, String oui, String productClass,
String serialNumber) {
this.manufacturer = manufacturer;
this.oui = oui;
this.productClass = productClass;
this.serialNumber = serialNumber;
}
public String getManufacturer() {
return manufacturer;
}
public String getOui() {
return oui;
}
public String getProductClass() {
return productClass;
}
public String getSerialNumber() {
return serialNumber;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public void setOui(String oui) {
this.oui = oui;
}
public void setProductClass(String productClass) {
this.productClass = productClass;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public Long getDeviceId() {
return deviceId;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public String getMessageId() {
return messageId;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
public Timestamp getDt() {
return dt;
}
public void setDt(Timestamp dt) {
this.dt = dt;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DeviceIdStruct [deviceId=");
builder.append(deviceId);
builder.append(", messageId=");
builder.append(messageId);
builder.append(", manufacturer=");
builder.append(manufacturer);
builder.append(", oui=");
builder.append(oui);
builder.append(", productClass=");
builder.append(productClass);
builder.append(", serialNumber=");
builder.append(serialNumber);
builder.append(", dt=");
builder.append(dt);
builder.append("]");
return builder.toString();
}
}
| [
"841202690@qq.com"
] | 841202690@qq.com |
0ea84fdadd42a7ad16302d7411426d165ad5fe0f | 9b9b9b855eba93c8dd9e3c2997d53c6f4728bc5a | /src/kr/ac/kopo/과제/20200428/2060340014_나성주_과제/Lotto/BinarySearch/LottoNum.java | 1e04747179811421648c66b4e47f091b45c34807 | [] | no_license | jhw-polytech/kopo_java | 3508569a3021ffe584f107152ad659bd1c1dd9fd | 191372687bdf78259789f472f8e948b6a91d1b6d | refs/heads/master | 2022-12-06T13:47:35.461835 | 2020-08-17T13:38:32 | 2020-08-17T13:38:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,197 | java | package homework.day12.Lotto.BinarySearch;
import java.util.Random;
public class LottoNum {
private int[] lottoNums = new int[7];
public int[] getLottoNums(String msg) {
Random r = new Random();
System.out.println(msg);
for (int i = 0; i < 7; i++) {
loops:
while (true) {
lottoNums[i] = r.nextInt(45) + 1;
for (int j = 0; j < i; j++) {
if (lottoNums[i] == lottoNums[j]) {
continue loops;
}
}
break;
}
}
return lottoNums;
}
}
/*
for (int j = 0; i > 0 && j < i; j++) {
if (lottoNums7[i] == lottoNums7[j]) {
System.out.println("기존에 골랐던 숫자입니다. 다시 고르세요.");
*/
// throw new DuplicateLottoNumException("기존에 골랐던 숫자입니다. 다시 고르세요.");
// }
// }
// } catch (DuplicateLottoNumException dlne) {
// System.out.println("DuplicateLottoNum: " + dlne.getMessage());
// }
| [
"2060340007@office.kopo.ac.kr"
] | 2060340007@office.kopo.ac.kr |
062e2ac442451675a0985ea97ce010289d102b79 | 474e9eb8f597a9af12359b449f61fbc70f4b2666 | /SelPractice/src/main/java/tests/AdminLoginLogout.java | fbe58e54d3ee7939119e3acf2b851d8e410b9c39 | [] | no_license | electricaledition/SelPractice | 47d8c8c9922886dbb9fffdbc5bd22c40d5ff204b | 435a40bc9e5f69211355a420e73a955852a64bfc | refs/heads/master | 2021-12-25T16:12:50.867612 | 2020-03-09T19:04:29 | 2020-03-09T19:04:29 | 232,476,401 | 0 | 0 | null | 2021-12-14T21:39:11 | 2020-01-08T04:18:33 | HTML | UTF-8 | Java | false | false | 1,436 | java | package tests;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import pages.LoginLogoutPage;
import properties.BrowserProperties;
import static utilities.urlAddress.*;
public class AdminLoginLogout {
BrowserProperties bp = new BrowserProperties();
WebDriver driver = bp.getChromeWebdriver();
LoginLogoutPage onPage = new LoginLogoutPage(driver);
@BeforeSuite
private void openBrowser() {
driver.get(BASE_URL);
}
@Test
public void loginAdminPage() {
onPage.emailPath().sendKeys(USER_NAME);
onPage.passwordPath().sendKeys(PASSWORD);
onPage.loginbtnPath().click();
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.titleContains("Dashboard"));
Assert.assertEquals( driver.getTitle(),"Dashboard");
}
@Test(dependsOnMethods = { "loginAdminPage" })
public void logoutAdminPage() {
onPage.logoutPath().click();
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.titleContains("Administator Login"));
Assert.assertEquals( driver.getTitle(),"Administator Login");
}
@AfterSuite
private void closeBrowser() {
driver.close();
}
}
| [
"Balasti's@DESKTOP-2JS3099"
] | Balasti's@DESKTOP-2JS3099 |
7f5fd57d92fc522ee169366a742411b404aef644 | adc60003df5a5f339bdd53be116e0f478698e481 | /tyre5/src/main/java/com/kkbc/entity/DeviceString.java | 79d7b747e60ac1ec7ecc4fb8559b0fd428129590 | [] | no_license | shanghaif/ineutech | 39cac67c1a71d3dc77dc714c8ea39199fbbbddf0 | 9fab2e91cff8408452652c4aba8d8e0e3fd2cb5b | refs/heads/master | 2023-03-18T09:13:15.377277 | 2020-12-28T06:31:09 | 2020-12-28T06:31:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,228 | java | package com.kkbc.entity;
import java.util.Date;
/**
* 字符串包数据
**/
public class DeviceString
{
/**
* 表名
*/
public static final String TB_N="device_string";
private Long id;
private String dtu_id;
private Date create_time;
private Date caiji_time;
private Integer dtu_tpms_status;
private String yuliu1_phone;
private String yuliu2_phone;
private String yuliu3_phone;
private String yuliu4_phone;
private String dtu_no;
private String dtu_trucks_id;
private String sim;
private Double latitude;
private Integer latitude_type;
private Double longitude;
private Integer longitude_type;
private String fasheqi_ids_value;
private String trucks_id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDtu_id() {
return dtu_id;
}
public void setDtu_id(String dtu_id) {
this.dtu_id = dtu_id;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Date getCaiji_time() {
return caiji_time;
}
public void setCaiji_time(Date caiji_time) {
this.caiji_time = caiji_time;
}
public Integer getDtu_tpms_status() {
return dtu_tpms_status;
}
public void setDtu_tpms_status(Integer dtu_tpms_status) {
this.dtu_tpms_status = dtu_tpms_status;
}
public String getYuliu1_phone() {
return yuliu1_phone;
}
public void setYuliu1_phone(String yuliu1_phone) {
this.yuliu1_phone = yuliu1_phone;
}
public String getYuliu2_phone() {
return yuliu2_phone;
}
public void setYuliu2_phone(String yuliu2_phone) {
this.yuliu2_phone = yuliu2_phone;
}
public String getYuliu3_phone() {
return yuliu3_phone;
}
public void setYuliu3_phone(String yuliu3_phone) {
this.yuliu3_phone = yuliu3_phone;
}
public String getYuliu4_phone() {
return yuliu4_phone;
}
public void setYuliu4_phone(String yuliu4_phone) {
this.yuliu4_phone = yuliu4_phone;
}
public String getDtu_no() {
return dtu_no;
}
public void setDtu_no(String dtu_no) {
this.dtu_no = dtu_no;
}
public String getDtu_trucks_id() {
return dtu_trucks_id;
}
public void setDtu_trucks_id(String dtu_trucks_id) {
this.dtu_trucks_id = dtu_trucks_id;
}
public String getSim() {
return sim;
}
public void setSim(String sim) {
this.sim = sim;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Integer getLatitude_type() {
return latitude_type;
}
public void setLatitude_type(Integer latitude_type) {
this.latitude_type = latitude_type;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Integer getLongitude_type() {
return longitude_type;
}
public void setLongitude_type(Integer longitude_type) {
this.longitude_type = longitude_type;
}
public String getFasheqi_ids_value() {
return fasheqi_ids_value;
}
public void setFasheqi_ids_value(String fasheqi_ids_value) {
this.fasheqi_ids_value = fasheqi_ids_value;
}
public String getTrucks_id() {
return trucks_id;
}
public void setTrucks_id(String trucks_id) {
this.trucks_id = trucks_id;
}
}
| [
"543979100@qq.com"
] | 543979100@qq.com |
f5e9181543baa78c3c5dd6e4e0ab2222a6c9d6de | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_bc99c56b42e4caab6def9a651e4b89501dcf8a57/LocationHelper/3_bc99c56b42e4caab6def9a651e4b89501dcf8a57_LocationHelper_s.java | 920e7aa30de6d95c8f9aeca9481c0e674aa29be1 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,106 | java | /**
*
*/
package fr.utc.nf33.ins.location;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import android.database.Cursor;
/**
*
* @author
*
*/
public final class LocationHelper {
//
private static final double DEGREES_TO_RADIANS = Math.PI / 180.0;
//
private static final double RADIUS_OF_THE_EARTH = 6371.009;
//
public static final byte SNR_THRESHOLD = 35;
//
private static final double SQUARED_MAX_DISTANCE = 100.0;
//
private static final double SQUARED_RADIUS_OF_THE_EARTH = RADIUS_OF_THE_EARTH
* RADIUS_OF_THE_EARTH;
//
static final List<Building> getCloseBuildings(final double latitude, final double longitude,
Cursor cursor) {
List<Building> closeBuildings = new ArrayList<Building>();
int _idIdx = cursor.getColumnIndexOrThrow("_id");
int bNameIdx = cursor.getColumnIndexOrThrow("bName");
int epNameIdx = cursor.getColumnIndexOrThrow("epName");
int epFloorIdx = cursor.getColumnIndexOrThrow("epFloor");
int epLatitudeIdx = cursor.getColumnIndexOrThrow("epLatitude");
int epLongitudeIdx = cursor.getColumnIndexOrThrow("epLongitude");
Building currentBuilding = null;
int currentId = -1;
while (cursor.moveToNext()) {
double epLatitude = cursor.getDouble(epLatitudeIdx);
double epLongitude = cursor.getDouble(epLongitudeIdx);
double sqDist = squaredDistanceBetween(latitude, longitude, epLatitude, epLongitude);
if (sqDist <= SQUARED_MAX_DISTANCE) {
int id = cursor.getInt(_idIdx);
if (currentId != id) {
currentId = id;
String bName = cursor.getString(bNameIdx);
currentBuilding = new Building(bName, new ArrayList<EntryPoint>());
closeBuildings.add(currentBuilding);
}
String epName = cursor.getString(epNameIdx);
byte epFloor = (byte) cursor.getInt(epFloorIdx);
currentBuilding.getEntryPoints().add(
new EntryPoint(epName, epFloor, epLatitude, epLongitude));
}
}
for (Building b : closeBuildings) {
List<EntryPoint> entryPoints = b.getEntryPoints();
Collections.sort(entryPoints, new Comparator<EntryPoint>() {
@Override
public final int compare(EntryPoint lhs, EntryPoint rhs) {
double lhsSqDist =
squaredDistanceBetween(latitude, longitude, lhs.getLatitude(), lhs.getLongitude());
double rhsSqDist =
squaredDistanceBetween(latitude, longitude, rhs.getLatitude(), rhs.getLongitude());
if (lhsSqDist < rhsSqDist)
return -1;
else if (lhsSqDist == rhsSqDist)
return 0;
else
return 1;
}
});
}
Collections.sort(closeBuildings, new Comparator<Building>() {
@Override
public final int compare(Building lhs, Building rhs) {
double lhsSqDist =
squaredDistanceBetween(latitude, longitude, lhs.getEntryPoints().get(0).getLatitude(),
lhs.getEntryPoints().get(0).getLongitude());
double rhsSqDist =
squaredDistanceBetween(latitude, longitude, rhs.getEntryPoints().get(0).getLatitude(),
rhs.getEntryPoints().get(0).getLongitude());
if (lhsSqDist < rhsSqDist)
return -1;
else if (lhsSqDist == rhsSqDist)
return 0;
else
return 1;
}
});
return closeBuildings;
}
/**
*
* @param snr
* @param closeBuildings
* @return
*/
public static final boolean shouldGoIndoor(float snr, List<Building> closeBuildings) {
if ((snr >= SNR_THRESHOLD) || (closeBuildings.size() != 1)) return false;
return closeBuildings.get(0).getEntryPoints().size() == 1;
}
/**
*
* @param snr
* @return
*/
public static final boolean shouldGoOutdoor(float snr) {
return snr >= SNR_THRESHOLD;
}
/**
* Computes the approximate squared distance in meters between two locations.
*
* @param startLatitude the starting latitude
* @param startLongitude the starting longitude
* @param endLatitude the ending latitude
* @param endLongitude the ending longitude
* @return the computed squared distance
*/
private static final double squaredDistanceBetween(double startLatitude, double startLongitude,
double endLatitude, double endLongitude) {
double sLat = startLatitude * DEGREES_TO_RADIANS;
double sLon = startLongitude * DEGREES_TO_RADIANS;
double eLat = endLatitude * DEGREES_TO_RADIANS;
double eLon = endLongitude * DEGREES_TO_RADIANS;
double diffLat = eLat - sLat;
double diffLon = eLon - sLon;
double meanLat = (sLat + eLat) / 2.0;
double a = Math.cos(meanLat) * diffLon;
return SQUARED_RADIUS_OF_THE_EARTH * ((diffLat * diffLat) + (a * a)) * 1000;
}
// Suppress default constructor for noninstantiability.
private LocationHelper() {
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
795dd5b32020b0b199892481e7392b9c3d908f76 | 605103f246aa6d1bd4ccccadd68120184c378ba0 | /ParseXml/src/main/java/com/yuk/BuildXml.java | 006b7a0c4d02eb1fb58ae730c4a2fda5984a5257 | [] | no_license | Yukhankishore/parseXML | 2ad339f4dd8ec7e430d88e0a83c378fa0924205e | 56b588f218628e40f1d29b1321eb0c6b172c7581 | refs/heads/main | 2023-04-17T08:37:15.983606 | 2021-05-07T20:01:21 | 2021-05-07T20:01:21 | 365,260,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,757 | java | package com.yuk;
import java.io.File;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
//import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
//import javax.xml.transform.TransformerConfigurationException;
//import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class BuildXml {
public void xmlBuild(List<User> contactList,List<Salary> salaryList){
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder;
try {
dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.newDocument();
// add elements to Document
Element rootElement = doc.createElement("persondata");
// append root element to document
doc.appendChild(rootElement);
for(User user : contactList) {
System.out.println("name"+user.getName()+"address"+user.getAddress()+"phone"+user.getPhoneNumber());
}
for(Salary salary : salaryList) {
System.out.println("name"+salary.getName()+"salary"+salary.getSalary()+"pension"+salary.getPension());
}
for(User user : contactList) {
for(Salary salary : salaryList) {
if(user.getName().equals(salary.getName())) {
// System.out.println(" name "+salary.getName()+" salary "+salary.getSalary()+" pension "+salary.getPension()+" address "+user.getAddress()+" phone "+user.getPhoneNumber());
rootElement.appendChild(createUserElement(doc, salary.getName(), user.getAddress(), user.getPhoneNumber(), salary.getSalary(), salary.getPension()));
}
}
}
// for output to file, console
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
// for pretty print
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
DOMSource source = new DOMSource(doc);
// write to console or file
StreamResult console = new StreamResult(System.out);
StreamResult file = new StreamResult(new File("persondata.xml"));
// write data
transformer.transform(source, console);
transformer.transform(source, file);
// return file;
} catch (Exception e) {
e.printStackTrace();
}
// return null;
}
private static Node createUserElement(Document doc, String name, String address, String phonenumber, String salary,String pension) {
Element person = doc.createElement("person");
// set id attribute
person.setAttribute("name", name);
// create firstName element
person.appendChild(createUserElements(doc, person, "address", address));
// create lastName element
person.appendChild(createUserElements(doc, person, "phonenumber", phonenumber));
// create age element
person.appendChild(createUserElements(doc, person, "salary", salary));
// create gender element
person.appendChild(createUserElements(doc, person, "pension", pension));
return person;
}
// utility method to create text node
private static Node createUserElements(Document doc, Element element, String name, String value) {
Element node = doc.createElement(name);
node.appendChild(doc.createTextNode(value));
return node;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
4a3ac7e92e6ab4aedc41496ee7325d32ba2de16f | 82c29931ed0b34384b4766b2a929306de6c3c4c8 | /src/com/milkcu/app/ui/base/BaseActivity.java | 2deda3fbd866ba3c372f66fc073da1e0c6d5088e | [] | no_license | milkcu/campus-app | ddedb5540936aca2d585a0b63c99a0556a0a60ba | c44dbe27dceac0944c8be522b557f6162fc638ea | refs/heads/master | 2020-04-20T11:44:00.429932 | 2014-07-27T14:34:30 | 2014-07-27T14:34:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,454 | java | package com.milkcu.app.ui.base;
import java.lang.reflect.Field;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import com.milkcu.app.R;
import com.milkcu.app.utils.LogUtil;
import com.umeng.analytics.MobclickAgent;
public class BaseActivity extends Activity {
private static final String TAG = "BaseActivity";
protected AlertDialog mAlertDialog;
protected AsyncTask mRunningTask;
/******************************** 【Activity LifeCycle For Debug】 *******************************************/
@Override
protected void onCreate(Bundle savedInstanceState) {
LogUtil.d(TAG, this.getClass().getSimpleName()
+ " onCreate() invoked!!");
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
MobclickAgent.onError(this);
}
@Override
protected void onStart() {
LogUtil.d(TAG, this.getClass().getSimpleName() + " onStart() invoked!!");
super.onStart();
}
@Override
protected void onRestart() {
LogUtil.d(TAG, this.getClass().getSimpleName()
+ " onRestart() invoked!!");
super.onRestart();
}
@Override
protected void onResume() {
LogUtil.d(TAG, this.getClass().getSimpleName()
+ " onResume() invoked!!");
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
LogUtil.d(TAG, this.getClass().getSimpleName() + " onPause() invoked!!");
super.onPause();
try {
MobclickAgent.onPause(this);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onStop() {
LogUtil.d(TAG, this.getClass().getSimpleName() + " onStop() invoked!!");
super.onStop();
}
@Override
public void onDestroy() {
LogUtil.d(TAG, this.getClass().getSimpleName()
+ " onDestroy() invoked!!");
super.onDestroy();
if (mRunningTask != null && mRunningTask.isCancelled() == false) {
mRunningTask.cancel(false);
mRunningTask = null;
}
if (mAlertDialog != null) {
mAlertDialog.dismiss();
mAlertDialog = null;
}
}
public void recommandToYourFriend(String url, String shareTitle) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, shareTitle + " " + url);
Intent itn = Intent.createChooser(intent, "分享");
startActivity(itn);
}
/******************************** 【Activity LifeCycle For Debug】 *******************************************/
protected void showShortToast(int pResId) {
showShortToast(getString(pResId));
}
protected void showLongToast(String pMsg) {
Toast.makeText(this, pMsg, Toast.LENGTH_LONG).show();
}
protected void showShortToast(String pMsg) {
Toast.makeText(this, pMsg, Toast.LENGTH_SHORT).show();
}
protected boolean hasExtra(String pExtraKey) {
if (getIntent() != null) {
return getIntent().hasExtra(pExtraKey);
}
return false;
}
protected void openActivity(Class<?> pClass) {
openActivity(pClass, null);
}
protected void openActivity(Class<?> pClass, Bundle pBundle) {
Intent intent = new Intent(this, pClass);
if (pBundle != null) {
intent.putExtras(pBundle);
}
startActivity(intent);
}
protected void openActivity(String pAction) {
openActivity(pAction, null);
}
protected void openActivity(String pAction, Bundle pBundle) {
Intent intent = new Intent(pAction);
if (pBundle != null) {
intent.putExtras(pBundle);
}
startActivity(intent);
}
/**
* 通过反射来设置对话框是否要关闭,在表单校验时很管用, 因为在用户填写出错时点确定时默认Dialog会消失, 所以达不到校验的效果
* 而mShowing字段就是用来控制是否要消失的,而它在Dialog中是私有变量, 所有只有通过反射去解决此问题
*
* @param pDialog
* @param pIsClose
*/
public void setAlertDialogIsClose(DialogInterface pDialog, Boolean pIsClose) {
try {
Field field = pDialog.getClass().getSuperclass()
.getDeclaredField("mShowing");
field.setAccessible(true);
field.set(pDialog, pIsClose);
} catch (Exception e) {
e.printStackTrace();
}
}
protected AlertDialog showAlertDialog(String TitleID, String Message) {
mAlertDialog = new AlertDialog.Builder(this).setTitle(TitleID)
.setMessage(Message).show();
return mAlertDialog;
}
protected AlertDialog showAlertDialog(int pTitelResID, String pMessage,
DialogInterface.OnClickListener pOkClickListener) {
String title = getResources().getString(pTitelResID);
return showAlertDialog(title, pMessage, pOkClickListener, null, null);
}
protected AlertDialog showAlertDialog(String pTitle, String pMessage,
DialogInterface.OnClickListener pOkClickListener,
DialogInterface.OnClickListener pCancelClickListener,
DialogInterface.OnDismissListener pDismissListener) {
mAlertDialog = new AlertDialog.Builder(this)
.setTitle(pTitle)
.setMessage(pMessage)
.setPositiveButton(android.R.string.ok, pOkClickListener)
.setNegativeButton(android.R.string.cancel,
pCancelClickListener).show();
if (pDismissListener != null) {
mAlertDialog.setOnDismissListener(pDismissListener);
}
return mAlertDialog;
}
protected AlertDialog showAlertDialog(String pTitle, String pMessage,
String pPositiveButtonLabel, String pNegativeButtonLabel,
DialogInterface.OnClickListener pOkClickListener,
DialogInterface.OnClickListener pCancelClickListener,
DialogInterface.OnDismissListener pDismissListener) {
mAlertDialog = new AlertDialog.Builder(this).setTitle(pTitle)
.setMessage(pMessage)
.setPositiveButton(pPositiveButtonLabel, pOkClickListener)
.setNegativeButton(pNegativeButtonLabel, pCancelClickListener)
.show();
if (pDismissListener != null) {
mAlertDialog.setOnDismissListener(pDismissListener);
}
return mAlertDialog;
}
protected ProgressDialog showProgressDialog(int pTitelResID,
String pMessage,
DialogInterface.OnCancelListener pCancelClickListener) {
String title = getResources().getString(pTitelResID);
return showProgressDialog(title, pMessage, pCancelClickListener);
}
protected ProgressDialog showProgressDialog(String pTitle, String pMessage,
DialogInterface.OnCancelListener pCancelClickListener) {
mAlertDialog = ProgressDialog.show(this, pTitle, pMessage, true, true);
mAlertDialog.setOnCancelListener(pCancelClickListener);
return (ProgressDialog) mAlertDialog;
}
protected void hideKeyboard(View view) {
InputMethodManager imm = (InputMethodManager) this
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
protected void handleOutmemoryError() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(BaseActivity.this, "内存空间不足!", Toast.LENGTH_SHORT)
.show();
// finish();
}
});
}
private int network_err_count = 0;
protected void handleNetworkError() {
network_err_count++;
runOnUiThread(new Runnable() {
@Override
public void run() {
if (network_err_count < 3) {
Toast.makeText(BaseActivity.this, "网速好像不怎么给力啊!",
Toast.LENGTH_SHORT).show();
} else if (network_err_count < 5) {
Toast.makeText(BaseActivity.this, "网速真的不给力!",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(BaseActivity.this, "唉,今天的网络怎么这么差劲!",
Toast.LENGTH_SHORT).show();
}
// finish();
}
});
}
protected void handleMalformError() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(BaseActivity.this, "数据格式错误!", Toast.LENGTH_SHORT)
.show();
// finish();
}
});
}
protected void handleFatalError() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(BaseActivity.this, "发生了一点意外,程序终止!",
Toast.LENGTH_SHORT).show();
finish();
}
});
}
public void finish()
{
super.finish();
overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
}
public void defaultFinish()
{
super.finish();
}
}
| [
"milkcu@gmail.com"
] | milkcu@gmail.com |
cadb99721e6eb8d179d3efeca50a7cf33b3428e3 | 827eeb7783b8fd3bef8dc737e4351124817d2533 | /void-common/src/main/java/com/phantomsaber/common/enums/DataSourceType.java | ab8daa3875f56d5beb4602050eb8ea5ae8265eaa | [
"MIT"
] | permissive | phantomVoid/void-vue | 278cfb8ddb957ca1c59ccbdca17e002c30b62c34 | ec055c4fa505a84818ddbc7dc776959e58dfaa12 | refs/heads/master | 2022-12-06T00:54:57.430120 | 2020-08-09T15:18:21 | 2020-08-09T15:18:21 | 286,258,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package com.phantomsaber.common.enums;
/**
* 数据源
*
* @author phantomsaber
*/
public enum DataSourceType
{
/**
* 主库
*/
MASTER,
/**
* 从库
*/
SLAVE
}
| [
"phantomsaber@foxmail.com"
] | phantomsaber@foxmail.com |
2c812877b44ecdd294282642b86f8981a3303582 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_94f9e34ab623883ed8709bc69f2723c924b811f8/LogList/3_94f9e34ab623883ed8709bc69f2723c924b811f8_LogList_t.java | c720be48defdc8589869e16a734e359a2b88e3bd | [] | 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 | 3,737 | java | /**
* Copyright (c) 2009-2012, Netbout.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are PROHIBITED without prior written permission from
* the author. This product may NOT be used anywhere and on any computer
* except the server platform of netBout Inc. located at www.netbout.com.
* Federal copyright law prohibits unauthorized reproduction by any means
* and imposes fines up to $25,000 for violation. If you received
* this code occasionally and without intent to use it, please report this
* incident to the author by email.
*
* 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
* OWNER 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 com.netbout.rest.log;
import com.jcabi.log.Logger;
import com.netbout.spi.text.SecureString;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
/**
* List of log events.
*
* <p>The class is used in {@link BaseRs#log()}.
*
* <p>The class is NOT thread-safe.
*
* @author Yegor Bugayenko (yegor@netbout.com)
* @version $Id$
*/
public final class LogList {
/**
* Separator.
*/
private static final String SEP = "><";
/**
* List of log events.
*/
private final transient List<String> list = new LinkedList<String>();
/**
* Public ctor.
*/
public LogList() {
WebAppender.start();
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
final StringBuilder text = new StringBuilder();
for (String event : this.events()) {
text.append(StringEscapeUtils.escapeXml(event))
.append(LogList.SEP);
}
return new SecureString(text.toString()).toString();
}
/**
* Append events from packed text.
* @param text The text with packed log events inside
* @see BaseRs#setLog(String)
*/
public void append(final String text) {
try {
final String[] events = StringUtils.splitPreserveAllTokens(
SecureString.valueOf(text).text(),
LogList.SEP
);
for (String event : events) {
if (event.isEmpty()) {
continue;
}
this.list.add(StringEscapeUtils.unescapeXml(event));
}
} catch (com.netbout.spi.text.StringDecryptionException ex) {
Logger.warn(this, "#append(%s): %[exception]s", text, ex);
}
}
/**
* Get list of events.
* @return The list
*/
@SuppressWarnings("unchecked")
public List<String> events() {
return ListUtils.union(this.list, WebAppender.get());
}
/**
* Clear the list.
*/
public void clear() {
this.list.clear();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
79a724324adbef0f59664b9c1e35ac38cb3dacab | 7c3d6f97f8d35b65e06c8a777770c174aecbaa14 | /src/main/java/com/marciosilva/cursomc/resources/PedidoResource.java | 7fe8e77c05cf5ed95d969a511ecb8b95e6c047f7 | [] | no_license | marcioworks/cursoMc | 685b40275a596d991ed759b5cc729f341dbae3a5 | 4d5eb01414b29e81c951deea9109115d1206c717 | refs/heads/master | 2020-07-18T08:34:19.278774 | 2019-10-17T01:42:31 | 2019-10-17T01:42:31 | 206,214,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package com.marciosilva.cursomc.resources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.marciosilva.cursomc.domain.Pedido;
import com.marciosilva.cursomc.services.PedidoService;
@RestController
@RequestMapping(value="/pedidos")
public class PedidoResource {
@Autowired
private PedidoService service;
@RequestMapping(value ="/{id}", method = RequestMethod.GET)
public ResponseEntity<?> find( @PathVariable Integer id) {
Pedido obj = service.buscar(id);
return ResponseEntity.ok().body(obj);
}
}
| [
"marcioadsworks@gmail.com"
] | marcioadsworks@gmail.com |
3ff25cf6ec98d75537991e3b8ac5278df10b295c | d94e58f51438f42af3a2d2d20e4df7a43b797ed1 | /src/Inner_function.java | db43aaf170f02992675612125bd786745cf98f80 | [] | no_license | w268wang/HelloWorld | 12d0f8106a89f7a0e97f5a06e91c40b1eb05cb1a | 8ab41989899593a06547921b94ff2903339752b6 | refs/heads/master | 2021-01-25T10:14:54.641912 | 2014-05-21T02:02:50 | 2014-05-21T02:02:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java |
public class Inner_function
{
public static void main(String[] args)
{
Inner_function i_f = new Inner_function();
System.out.print(i_f.calculate(5,5));
}
int sum(int n, int x)
{
int z;
if(n<=0)
z=1;
else if(n==1)
z=x;
else
z=(((2*n-1)*x*sum(n-1,x)-(n-1)*sum(n-2,x))/n);
return z;
}
public int calculate(int time, int input)
{
int output;
output=sum(time,input);
return output;
}
}
| [
"w268wang@gmail.com"
] | w268wang@gmail.com |
07318cb19275c5dd6a64b8fbf103875feaca35c0 | 78233be0f58bdf081bdfce10d9d9fb67aa2897e2 | /DonationAppAndroid/app/src/main/java/com/example/psweeney/donationappandroid/feed/PostContainer.java | d61328075c000e5427987612f03e54e424113c7c | [] | no_license | pink/donationAndroid | 048e7039ab937944873f7d42b4a94ce05f0fd9f6 | 61c80e98e54b9a7ad8782fd998bb32f7c4c1202a | refs/heads/master | 2021-05-31T10:34:33.999293 | 2016-05-12T12:00:17 | 2016-05-12T12:00:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,934 | java | package com.example.psweeney.donationappandroid.feed;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.psweeney.donationappandroid.R;
/**
* Created by psweeney on 4/19/16.
*
* LinearLayout extension that stores a PostData object
*
*/
public class PostContainer extends LinearLayout {
private PostData _data;
public PostContainer(Context context) {
super(context);
init(null, 0);
}
public PostContainer(Context context, AttributeSet attrs) {
super(context, attrs);
init(attrs, 0);
}
public PostContainer(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(attrs, defStyleAttr);
}
private void init(AttributeSet attrs, int defStyle){
}
public void updateViews(){
ImageView authorIcon = (ImageView) findViewById(R.id.imageViewAuthorIcon);
TextView titleText = (TextView) findViewById(R.id.textViewTitleLine);
TextView dateText = (TextView) findViewById(R.id.textViewDateLine);
ImageView likeIconDisabled = (ImageView) findViewById(R.id.imageViewLikeIconDisabled);
ImageView likeIconEnabled = (ImageView) findViewById(R.id.imageViewLikeIconEnabled);
TextView likeNumText = (TextView) findViewById(R.id.textViewLikeNum);
TextView commentNumText = (TextView) findViewById(R.id.textViewCommentNum);
if(_data == null || authorIcon == null || titleText == null || dateText == null || likeIconDisabled == null
|| likeIconEnabled == null || likeNumText == null || commentNumText == null){
return;
}
authorIcon.setImageDrawable(getResources().getDrawable(_data.getAuthorIconId()));
titleText.setText(_data.getTitleDisplayString());
dateText.setText(_data.getDateDisplayString());
if(_data instanceof CharityPostData){
TextView bodyText = (TextView) findViewById(R.id.textViewBody);
ImageView bodyImage = (ImageView) findViewById(R.id.imageViewBody);
if(bodyText != null ){
if(((CharityPostData) _data).useBodyText() && ((CharityPostData) _data).getBodyText().length() > 0){
bodyText.setText(((CharityPostData) _data).getBodyText());
bodyText.setVisibility(VISIBLE);
} else {
bodyText.setVisibility(GONE);
}
}
if(bodyImage != null){
if(((CharityPostData) _data).useBodyImage()){
bodyImage.setImageDrawable(getResources().getDrawable(((CharityPostData) _data).getBodyImageId()));
bodyImage.setVisibility(VISIBLE);
} else {
bodyImage.setVisibility(GONE);
}
}
}
if(_data.likedByUser()){
likeIconEnabled.setVisibility(View.VISIBLE);
likeIconDisabled.setVisibility(View.GONE);
} else {
likeIconEnabled.setVisibility(View.GONE);
likeIconDisabled.setVisibility(View.VISIBLE);
}
likeNumText.setText(Integer.toString(_data.getNumLikes()));
if(_data.getNumLikes() > 0){
likeNumText.setVisibility(View.VISIBLE);
} else {
likeNumText.setVisibility(View.GONE);
}
commentNumText.setText(Integer.toString(_data.getComments().size()));
if(_data.getComments().size() > 0){
commentNumText.setVisibility(View.VISIBLE);
} else {
commentNumText.setVisibility(View.GONE);
}
invalidate();
}
public void setData(PostData data){
_data = data;
}
public PostData getData(){
return _data;
}
}
| [
"psweeney716@gmail.com"
] | psweeney716@gmail.com |
900804b3fc1bfc9efe19e4a1db8cde98e25ada20 | a4ec059ebe3d40b6680f3054e95fb8787a803c52 | /walec.java | a01849b348ebfcc467fe44d09689ba7e70a35fb4 | [] | no_license | welniasty/lab2 | d896d6c04873caffd9a511523aef1cccca35e2c4 | a1ea0692b30140c46ae0e0ec974a13519e547eb6 | refs/heads/master | 2021-01-11T13:51:02.530591 | 2017-03-29T21:39:51 | 2017-03-29T21:39:51 | 86,631,842 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 1,588 | java | package labolatorium_1_;
public class walec extends punkt_materialny { //klasa walec dziedziczy z klasy punkt_materialny
private int promien;
double glowny_moment_bezwladnosci;
public walec(){ //konstruktor domyslny
super.setMasa(1);
this.promien=2;
}
public walec(int masa, int promien){ //konstruktor z parametrami
super(masa); //odwolanie do dziedziczonego parametru
this.promien=promien;
}
//gettery i settery do atrybutw klasy walec
public int getPromien(){
return promien;
}
public void setPromien(int promien){
this.promien=promien;
}
//przesłonięta metoda wyliczająca glówny moment bezwładności walca
public double glowny_moment(){
glowny_moment_bezwladnosci = 0.5*(super.getMasa())*Math.pow(promien, 2);
return glowny_moment_bezwladnosci;
}
//przesłonięta metoda wyliczająca moment bezwładności z tw.Steinera dla walca
public double steiner(int odleglosc){
double steiner = glowny_moment_bezwladnosci + super.getMasa()*Math.pow(odleglosc, 2);
return steiner;
}
public void opis(){ //opis obiektu
System.out.println("Obiekt klasy walec");
}
public String toString(){ // metoda służąca wyświetleniu informacji o danym obiekcie(opis, dane, wartość głównego momentu bezwładności)
return "Nazwa: " + getClass().getName()+ ", masa: " + super.getMasa() + ", Promień walca: " + promien + ", Główny moment bezwladności walca jest równy: " + glowny_moment();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
2fca79175e0b2ad0714866a3103362cabe80ee41 | a879d67f23fe9c14f42e01134638def9705bc856 | /app/src/main/java/application/MyApplication.java | b8b086b8fc04761f9148f613da17662cb13fa7f5 | [
"Apache-2.0"
] | permissive | wgzzgw/UDP | 745615174ba601ac459e3eca02c18abae578faa7 | 1e1d3c12540162102fffdbd12ad773b323b082f8 | refs/heads/master | 2020-03-21T10:31:55.511847 | 2018-06-25T07:53:51 | 2018-06-25T07:53:51 | 138,456,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 547 | java | package application;
import android.app.Application;
import android.content.Context;
/**
* Created by yy on 2018/6/22.
*/
public class MyApplication extends Application {
private static MyApplication app;
private static Context appContext;
@Override
public void onCreate() {
super.onCreate();
app = this;
appContext = getApplicationContext();
}
public static MyApplication getApplication() {
return app;
}
public static Context getContext() {
return appContext;
}
}
| [
"975787945@qq.com"
] | 975787945@qq.com |
7827849533fbe6159ea78840d555462bedd8b1ab | 37f3fe90e0a35b281f93a7f9ff4a4f04d1369126 | /app/src/main/java/com/taylor_johnson/realsocialnew/Model/Notice.java | 96c20688aa79504b754de5349f62f322d2289d59 | [] | no_license | raziel214/Tucoop_Social | 449bada3bc16c2b913313e22c9e28a3b2e31d8af | 82d622fff2e7368a2da642a19bac931678ecb477 | refs/heads/master | 2021-01-25T11:57:17.801707 | 2018-03-01T15:08:53 | 2018-03-01T15:08:53 | 123,449,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,465 | java | package com.taylor_johnson.realsocialnew.Model;
/**
* Created by desarrolladorjf on 24/02/2017.
*/
public class Notice {
/*esta variable sera usada por el recyclerview de los convenios llamado
* agreement para la presentacion de todos las noticias se debe cambiar a string cuando se llame desde los web services*/
public String descripcion;
public int ID;
public String activo;
public String empresa;
public String expiraDias;
public String fecha;
public String imagen;
public String titulo;
public String link;
public Notice(int ID, String activo, String empresa, String expiraDias) {
this.descripcion = descripcion;
this.ID = ID;
this.activo = activo;
this.empresa = empresa;
this.expiraDias = expiraDias;
this.fecha = fecha;
this.imagen = imagen;
this.titulo = titulo;
this.link = link;
//Notice = notice;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public int getID() {
return ID;
}
public void setID(int ID) {
this.ID = ID;
}
public String getActivo() {
return activo;
}
public void setActivo(String activo) {
this.activo = activo;
}
public String getEmpresa() {
return empresa;
}
public void setEmpresa(String empresa) {
this.empresa = empresa;
}
public String getExpiraDias() {
return expiraDias;
}
public void setExpiraDias(String expiraDias) {
this.expiraDias = expiraDias;
}
public String getFecha() {
return fecha;
}
public void setFecha(String fecha) {
this.fecha = fecha;
}
public String getImagen() {
return imagen;
}
public void setImagen(String imagen) {
this.imagen = imagen;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
private int Notice;
public Notice(int notice) {
Notice = notice;
}
public int getNotice() {
return Notice;
}
public void setNotice(int notice) {
Notice = notice;
}
}
| [
"john.quimbaya@taylor-johnson.com"
] | john.quimbaya@taylor-johnson.com |
a887aa29ea107a66e91500cd814c52f61a338f5d | 3eca6278418d9eef7f5f850b23714a8356ef525f | /tumi/CobranzaEJB/ejbModule/pe/com/tumi/cobranza/planilla/bo/SolicitudCtaCteBloqueoBO.java | b4986f239cc314e706c9af6bb0a1c93a30cdde6a | [] | no_license | cdelosrios88/tumiws-bizarq | 2728235b3f3239f12f14b586bb6349e2f9b8cf4f | 7b32fa5765a4384b8d219c5f95327b2e14dd07ac | refs/heads/master | 2021-01-23T22:53:21.052873 | 2014-07-05T05:19:58 | 2014-07-05T05:19:58 | 32,641,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,655 | java | package pe.com.tumi.cobranza.planilla.bo;
import java.util.HashMap;
import java.util.List;
import pe.com.tumi.cobranza.planilla.dao.SolicitudCtaCteBloqueoDao;
import pe.com.tumi.cobranza.planilla.dao.impl.SolicitudCtaCteBloqueoDaoIbatis;
import pe.com.tumi.cobranza.planilla.domain.SolicitudCtaCteBloqueo;
import pe.com.tumi.framework.negocio.exception.BusinessException;
import pe.com.tumi.framework.negocio.exception.DAOException;
import pe.com.tumi.framework.negocio.factory.TumiFactory;
import pe.com.tumi.movimiento.concepto.domain.BloqueoCuenta;
public class SolicitudCtaCteBloqueoBO{
private SolicitudCtaCteBloqueoDao dao = (SolicitudCtaCteBloqueoDao)TumiFactory.get(SolicitudCtaCteBloqueoDaoIbatis.class);
public SolicitudCtaCteBloqueo grabarSolicitudCtaCteBloqueo(SolicitudCtaCteBloqueo o) throws BusinessException{
SolicitudCtaCteBloqueo dto = null;
try{
dto = dao.grabar(o);
}catch(DAOException e){
throw new BusinessException(e);
}catch(Exception e){
throw new BusinessException(e);
}
return dto;
}
public List<SolicitudCtaCteBloqueo> getListaPorTipoSolicitud(Integer intPersEmpresaPk,Integer intTipoSolicitud) throws BusinessException{
List<SolicitudCtaCteBloqueo> lista = null;
try{
HashMap<String,Object> mapa = new HashMap<String,Object>();
mapa.put("intPersEmpresasolctacte",intPersEmpresaPk);
mapa.put("intTipoSolicitudctacte",intTipoSolicitud);
lista = dao.getListaPorTipoSol(mapa);
}catch(DAOException e){
throw new BusinessException(e);
}catch(Exception e) {
throw new BusinessException(e);
}
return lista;
}
} | [
"cdelosrios@bizarq.com@b3a863b4-f5f8-5366-a268-df30542ed8c1"
] | cdelosrios@bizarq.com@b3a863b4-f5f8-5366-a268-df30542ed8c1 |
f948aaad2a9c23a59997e4195c90b0c9eb0c7efe | d32de3cc24cf98844586dd14343ce426079471e2 | /src/com/ds/MyWordReverse.java | b8c84b386c5581f065659464fd90f24a21f6c133 | [] | no_license | dushyantnasit/javaprograms | 6a9aa99e9fa720d786e016246482ce91284d242e | 4d27f666498568805fc15bb86042b3f506fc294a | refs/heads/master | 2020-04-14T23:39:43.681452 | 2019-01-16T13:44:11 | 2019-01-16T13:44:11 | 164,210,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,004 | java | package com.ds;
public class MyWordReverse {
public String reverseWord(String word){
StringBuilder sb = new StringBuilder();
int size = word.length();
StackImpl stack = new StackImpl(size);
for(int i=0;i<size;i++){
stack.push(word.charAt(i));
}
while(!stack.isStackEmpty()){
sb.append(stack.pop());
}
return sb.toString();
}
public static void main(String a[]){
MyWordReverse mwr = new MyWordReverse();
System.out.println("Java2Novice == "+mwr.reverseWord("Java2Novice"));
System.out.println("Java == "+mwr.reverseWord("Java"));
System.out.println("program == "+mwr.reverseWord("program"));
}
}
class StackImpl {
private int stackSize;
private char[] stackArr;
private int top;
/**
* constructor to create stack with size
* @param size
*/
public StackImpl(int size) {
this.stackSize = size;
this.stackArr = new char[stackSize];
this.top = -1;
}
/**
* This method adds new entry to the top
* of the stack
* @param entry
* @throws Exception
*/
public void push(char entry) {
this.stackArr[++top] = entry;
}
/**
* This method removes an entry from the
* top of the stack.
* @return
* @throws Exception
*/
public char pop() {
char entry = this.stackArr[top--];
return entry;
}
/**
* This method returns top of the stack
* without removing it.
* @return
*/
public char peek() {
return stackArr[top];
}
/**
* This method returns true if the stack is
* empty
* @return
*/
public boolean isStackEmpty() {
return (top == -1);
}
/**
* This method returns true if the stack is full
* @return
*/
public boolean isStackFull() {
return (top == stackSize - 1);
}
} | [
"amit@tendril.in"
] | amit@tendril.in |
62ae875730e968e6c3bcbad4e4473f5557a94c44 | 392b183ece3b41beaec08ab88dcafd504e8cf4e9 | /me/shatteredhej/railhack/railhackmod/manager/EventManager.java | b3a1070afbdf3b70e34d14a2a700e81615bb289a | [
"MIT"
] | permissive | 3000IQPlay/RailHack-0.5.9-Src | 552decf5749ee744b565494415f89af948257a98 | 9c1396d095a72f7a414f24cfb1720fc294a9f24a | refs/heads/main | 2023-06-27T16:58:42.177134 | 2021-08-04T15:53:07 | 2021-08-04T15:53:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,698 | java | package me.shatteredhej.railhack.railhackmod.manager;
import java.util.Iterator;
import me.shatteredhej.railhack.RailHack;
import me.shatteredhej.railhack.railhackmod.command.Command;
import me.shatteredhej.railhack.railhackmod.command.Commands;
import me.shatteredhej.railhack.railhackmod.event.Event;
import me.shatteredhej.railhack.railhackmod.event.events.EventGameOverlay;
import me.shatteredhej.railhack.railhackmod.helper.draw.RenderHelp;
import me.shatteredhej.railhack.railhackmod.util.MessageUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.passive.AbstractHorse;
import net.minecraftforge.client.event.ClientChatEvent;
import net.minecraftforge.client.event.InputUpdateEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Post;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
public class EventManager {
private final Minecraft mc = Minecraft.getMinecraft();
@SubscribeEvent
public void onUpdate(LivingUpdateEvent event) {
if (!event.isCanceled()) {
;
}
}
@SubscribeEvent
public void onTick(ClientTickEvent event) {
if (this.mc.player != null) {
RailHack.get_hack_manager().onUpdate();
}
}
@SubscribeEvent
public void onWorldRender(RenderWorldLastEvent event) {
if (!event.isCanceled()) {
RailHack.get_hack_manager().render(event);
}
}
@SubscribeEvent
public void onRender(Post event) {
if (!event.isCanceled()) {
Event.EVENT_BUS.post(new EventGameOverlay(event.getPartialTicks(), new ScaledResolution(this.mc)));
ElementType target = ElementType.EXPERIENCE;
if (!this.mc.player.isCreative() && this.mc.player.getRidingEntity() instanceof AbstractHorse) {
target = ElementType.HEALTHMOUNT;
}
if (event.getType() == target) {
RailHack.get_hack_manager().render();
if (!RailHack.get_hack_manager().getModuleWithTag("GUI").isActive()) {
RailHack.get_hud_manager().render();
}
GL11.glPushMatrix();
GL11.glEnable(3553);
GL11.glEnable(3042);
GlStateManager.enableBlend();
GL11.glPopMatrix();
RenderHelp.release_gl();
}
}
}
@SubscribeEvent(
priority = EventPriority.NORMAL,
receiveCanceled = true
)
public void onKeyInput(KeyInputEvent event) {
if (Keyboard.getEventKeyState()) {
RailHack.get_hack_manager().bind(Keyboard.getEventKey());
}
}
@SubscribeEvent(
priority = EventPriority.NORMAL
)
public void onChat(ClientChatEvent event) {
String message = event.getMessage();
String[] message_args = CommandManager.commandList.getMessage(event.getMessage());
boolean true_command = false;
if (message_args.length > 0) {
event.setCanceled(true);
this.mc.ingameGUI.getChatGUI().addToSentMessages(event.getMessage());
Iterator iterator = Commands.getPureCommandList().iterator();
while (iterator.hasNext()) {
Command command = (Command) iterator.next();
try {
if (CommandManager.commandList.getMessage(event.getMessage())[0].equalsIgnoreCase(command.getName())) {
true_command = command.getMessage(CommandManager.commandList.getMessage(event.getMessage()));
}
} catch (Exception exception) {
;
}
}
if (!true_command && CommandManager.commandList.hasPrefix(event.getMessage())) {
MessageUtil.send_client_message("Try using " + CommandManager.getPrefix() + "help list to see all commands");
true_command = false;
}
}
}
@SubscribeEvent
public void onInputUpdate(InputUpdateEvent event) {
Event.EVENT_BUS.post(event);
}
}
| [
"56791945+AfkBranta@users.noreply.github.com"
] | 56791945+AfkBranta@users.noreply.github.com |
a5e5698130bcf4e42c6be01578979979296606b0 | a93fa55dde925f2a9a9a6bf886588e8078e5b5b8 | /src/main/java/com/panda/msscbeerservice/model/Beer.java | 552b2d0cf9f4ab9f712d85d085e2da6b10a0b639 | [] | no_license | dinesh-panda/mssc-beer-service | 12ea6c676989549a4e316d45763a233f9fb86bf9 | 48b4deec3996f48b9bcc731d47ef122655f242fe | refs/heads/master | 2022-11-21T14:56:40.697387 | 2020-07-07T17:27:04 | 2020-07-07T17:27:04 | 268,997,010 | 0 | 0 | null | 2020-07-07T16:52:32 | 2020-06-03T05:25:41 | Java | UTF-8 | Java | false | false | 1,338 | java | package com.panda.msscbeerservice.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Version;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.UUID;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
public class Beer {
@Id
@GeneratedValue(generator = "UUID")
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
@Column(length = 36, columnDefinition = "varchar", updatable = false, nullable = false)
private UUID id;
@Version
private Long version;
@CreationTimestamp
@Column(updatable = false)
private Timestamp createdDate;
@UpdateTimestamp
private Timestamp lastModifiedDate;
private String beerName;
private String beerStyle;
@Column(unique = true)
private Long upc;
private BigDecimal price;
private Integer minOnHand;
private Integer quantityToBrew;
}
| [
"pandadinesh68@gmail.com"
] | pandadinesh68@gmail.com |
309e68aef0b93cfd2163965d17b0c7f7f4c71a09 | 339f039ece2168fdede647d0b6ca6960acaaf3a0 | /src/test/java/org/kohsuke/file_leak_detector/PipeDemo.java | b2fc7d97c532cd3842ae9436e3ee345019453ad0 | [
"MIT"
] | permissive | bassista/file-leak-detector | f212af85a6838d502452340bb1d483ac6cf2e711 | fd97aab7493d017ae5644ddd88b5cce77b5bc5f2 | refs/heads/master | 2021-05-04T13:02:07.066866 | 2017-12-15T22:12:39 | 2017-12-15T22:12:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package org.kohsuke.file_leak_detector;
import com.sun.tools.attach.VirtualMachine;
import sun.nio.ch.IOUtil;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.channels.Pipe;
import java.util.Scanner;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @author Denis Joubert
*/
public class PipeDemo {
public static void attachGivenAgentToThisVM(String pathToAgentJar,String arg) {
try {
String nameOfRunningVM = ManagementFactory.getRuntimeMXBean().getName();
String pid = nameOfRunningVM.substring(0, nameOfRunningVM.indexOf('@'));
VirtualMachine vm = VirtualMachine.attach(pid);
vm.loadAgent(pathToAgentJar, arg);
vm.detach();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws IOException {
attachGivenAgentToThisVM(args[0],args[1]);
final Pipe s = Pipe.open();
//s.sink().close();
s.source().close();
System.out.println("Dumping the table");
Listener.dump(System.out);
System.out.println("done");
}
}
| [
"djoubert@cloudbees.com"
] | djoubert@cloudbees.com |
e9b556346c9e32c2a975f8e0dd9f29509f0e7926 | 72cc2bde376e24d940ef19a47a13fe632690d85f | /src/Task.java | f419f13291587d4e5c3c87415aea1871653e028d | [] | no_license | xxs1993/GA | 57af918c85e84026a683ffe3febb1a49777eecaa | 26770d8678cb1500fffe1baff1e06c1339ae6814 | refs/heads/master | 2020-04-07T06:01:49.937003 | 2019-05-19T03:22:33 | 2019-05-19T03:22:33 | 158,119,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | import java.util.Random;
public class Task {
private int workload;
private int id;
public Task(int id){
Random random = new Random();
this.workload =random.nextInt(GAConfiguration.task_using_time_range)+1;
this.id = id;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getWorkload() {
return workload;
}
public void setWorkload(int workload) {
this.workload = workload;
}
}
| [
"xiao.x@husky.neu.edu"
] | xiao.x@husky.neu.edu |
57691d622096e57ce89f1133d54e1758d23cc347 | a55bbe5445733d74689f1f338d54bce89a03d7b5 | /src/group6/Query11.java | 81885539e99c6fa851b413d9bf42e063729699e9 | [] | no_license | ninojoey/cecs323Group6Public | e0ed211643ecbfefbc4ca875e8376f77faa9f5f8 | fa7d15f5560e2597585b8ae8bd0fd37ed5629bab | refs/heads/master | 2023-02-20T04:43:00.638137 | 2019-12-10T22:50:58 | 2019-12-10T22:50:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,482 | 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 group6;
/**
*
* @author Michael
*/
public class Query11 extends javax.swing.JFrame {
static String user;
static String pass;
static Database db;
/**
* Creates new form Query11
*/
public Query11(String u, String p, Database data) {
initComponents();
user = u;
pass = p;
db = data;
Customer dummy = new Customer();
db.Database(user, pass, 11, dummy);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel1.setText("All cars with the same fuel type");
jButton1.setText("Ok");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(173, 173, 173)
.addComponent(jButton1)
.addContainerGap(182, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
setVisible(false);
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info
: javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Query11.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Query11.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Query11.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Query11.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Query11(user, pass, db).setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
}
| [
"jeemouseman2@gmail.com"
] | jeemouseman2@gmail.com |
048ed3eb167f8ca4eef6ef474d1b2924c9b8c3e0 | 7a8e2cf3b11e0054f2a29726e9f03554456a5d3c | /src/com/shoppingstreet/dao/OrderDao.java | 738ca1408b6eef0bbc6a28721f6fe5960a0e9488 | [] | no_license | zch345/shoppingstreet2 | a9eb25c6574a425c81ec1b00f65523f5433e2ada | 713350e54b18385ed6ec5e146915605170bfff50 | refs/heads/master | 2020-04-14T16:23:31.790877 | 2019-01-03T08:47:47 | 2019-01-03T08:47:47 | 163,950,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package com.shoppingstreet.dao;
import com.shoppingstreet.entity.Order;
public interface OrderDao extends IBaseDao {
public void add(Order order) ;
}
| [
"1344972653@qq.com"
] | 1344972653@qq.com |
86a06f45bff26b419ea60ee865551dad82434a79 | 6f8ebf41bdb0cafb8f85a13a662b6c9471469c3f | /src/main/java/KeywordDrivenTestFramework/Entities/DataRow.java | 7b1c29643fffffdc2176bdad3fa0fdb14137146d | [] | no_license | Mark-Bar/Simplify-Auto-v5 | a1afdaf30fd8ec6faf2c57ebd8e08e1b60d12ef0 | 8158c8e515be4cbee6b900559cad05e219f29f1f | refs/heads/master | 2020-03-19T01:37:43.038938 | 2018-05-31T07:21:31 | 2018-05-31T07:21:31 | 135,558,957 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | 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 KeywordDrivenTestFramework.Entities;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Brendan
*/
public class DataRow
{
public List<DataColumn> DataColumns;
public DataRow()
{
DataColumns = new ArrayList<>();
}
}
| [
"Brendan@testheroes.co.za"
] | Brendan@testheroes.co.za |
81bb042769b9d9d6e6954a7619f03a0e657ef3d2 | 27d17dcffbfdbee9d0d2b31124e9b4e2d8032658 | /src/mmm/transactions/AddImage_Transaction.java | a977813e211d9e52e65e540b1bb46b8fc5a3642d | [] | no_license | StevenMaio/Metro-Map-Maker | d3b11d8e781e757f3c284de49cb83074ebb0bde6 | 2bc3c5377a9c68179829f6c237aaa30f2c7906c9 | refs/heads/master | 2020-03-11T15:31:35.641443 | 2018-07-03T21:20:08 | 2018-07-03T21:20:08 | 130,086,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package mmm.transactions;
import jtps.jTPS_Transaction;
import mmm.gui.draggable.DraggableImage;
import mmm.data.MMMData;
/**
* Transaction for adding an image for a metro map.
*
* @author Steven Maio
*/
public class AddImage_Transaction implements jTPS_Transaction {
private MMMData data;
private DraggableImage image;
public AddImage_Transaction(MMMData data, DraggableImage image) {
this.data = data;
this.image = image;
}
@Override
public void doTransaction() {
data.getShapes().add(image);
}
@Override
public void undoTransaction() {
data.getShapes().remove(image);
}
}
| [
"Stevenmaio.321@gmail.com"
] | Stevenmaio.321@gmail.com |
43cda3aa4add2ccbbc3ade238c29fba9361dd626 | 34e30729e876eddd84f4f589ad601174f44eec3d | /Android/HJBleDemo/app/src/main/java/com/wise/ble/scan/bluetoothcompat/ObjectsCompat.java | ee280d6648665706ed9065c839f9bf3f682c3d32 | [
"Apache-2.0"
] | permissive | linny006/HJBleDemo | 84957d008821a1f33bcd47ef425a8968915da004 | f67ce131262de360f2ff297b30a067b2825982cb | refs/heads/master | 2023-06-30T01:20:58.640467 | 2021-07-31T04:45:18 | 2021-07-31T04:45:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,582 | java | /*
* Copyright (C) 2013 The Android Open Source Project
* Copyright (C) 2015 Joe Rogers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wise.ble.scan.bluetoothcompat;
import java.util.Arrays;
/**
* Subset of utility methods for objects, used by the existing bluetooth framework
*/
/* package */ class ObjectsCompat {
/* package */ static String toString(Object o) {
return (o == null) ? "null" : o.toString();
}
/* package */ static int hash(Object... values) {
return Arrays.hashCode(values);
}
/* package */ static boolean equals(Object a, Object b) {
return (a == null) ? (b == null) : a.equals(b);
}
/* package */ static boolean deepEquals(Object a, Object b) {
if (a == null || b == null) {
return a == b;
}
else if (a instanceof Object[] && b instanceof Object[]) {
return Arrays.deepEquals((Object[]) a, (Object[]) b);
}
else if (a instanceof boolean[] && b instanceof boolean[]) {
return Arrays.equals((boolean[]) a, (boolean[]) b);
}
else if (a instanceof byte[] && b instanceof byte[]) {
return Arrays.equals((byte[]) a, (byte[]) b);
}
else if (a instanceof char[] && b instanceof char[]) {
return Arrays.equals((char[]) a, (char[]) b);
}
else if (a instanceof double[] && b instanceof double[]) {
return Arrays.equals((double[]) a, (double[]) b);
}
else if (a instanceof float[] && b instanceof float[]) {
return Arrays.equals((float[]) a, (float[]) b);
}
else if (a instanceof int[] && b instanceof int[]) {
return Arrays.equals((int[]) a, (int[]) b);
}
else if (a instanceof long[] && b instanceof long[]) {
return Arrays.equals((long[]) a, (long[]) b);
}
else if (a instanceof short[] && b instanceof short[]) {
return Arrays.equals((short[]) a, (short[]) b);
}
return a.equals(b);
}
}
| [
"99487616@qq.com"
] | 99487616@qq.com |
5b0b7208a890a26e2623afdcce3f10ac5f962405 | 99da73f27c54bac8d8a563544e4952183911e8fb | /core/src/main/java/com/github/edgar615/direwolves/core/rpc/http/SimpleHttpHandler.java | a234e2932cf4fb23b65056ddf3588243beee6e12 | [
"Apache-2.0"
] | permissive | learningtcc/direwolves | 4e65adfd0068a2cb712aff9e92e7fb932290a495 | c313259111cce07ef82cf19febd8202fb64b89b6 | refs/heads/master | 2021-05-14T18:38:12.963750 | 2017-12-25T15:17:55 | 2017-12-25T15:17:55 | 116,080,618 | 1 | 0 | null | 2018-01-03T02:22:04 | 2018-01-03T02:22:04 | null | UTF-8 | Java | false | false | 10,137 | java | package com.github.edgar615.direwolves.core.rpc.http;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.github.edgar615.direwolves.core.definition.SimpleHttpEndpoint;
import com.github.edgar615.direwolves.core.rpc.RpcHandler;
import com.github.edgar615.direwolves.core.rpc.RpcRequest;
import com.github.edgar615.direwolves.core.rpc.RpcResponse;
import com.github.edgar615.util.log.Log;
import com.github.edgar615.util.log.LogType;
import com.github.edgar615.direwolves.core.utils.MultimapUtils;
import com.github.edgar615.util.exception.DefaultErrorCode;
import com.github.edgar615.util.exception.SystemException;
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientRequest;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.json.JsonObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Edgar on 2016/12/30.
*
* @author Edgar Date 2016/12/30
*/
public class SimpleHttpHandler implements RpcHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleHttpHandler.class);
private final HttpClient httpClient;
public SimpleHttpHandler(Vertx vertx, JsonObject config) {
this.httpClient = vertx.createHttpClient();
}
// @Override
public Future<RpcResponse> handle(RpcRequest rpcRequest) {
SimpleHttpRequest request = (SimpleHttpRequest) rpcRequest;
if (checkMethod(request)) {
return Future.failedFuture(
SystemException.create(DefaultErrorCode.INVALID_ARGS)
.set("details", "Method must be GET | POST | PUT | DELETE")
);
}
if (checkBody(request)) {
return Future.failedFuture(
SystemException.create(DefaultErrorCode.MISSING_ARGS)
.set("details", "POST or PUT method must contains request body")
);
}
logClientSend(request);
Future<RpcResponse> future = Future.future();
String path = requestPath(request);
final Duration duration = new Duration();
HttpClientRequest httpClientRequest =
httpClient
.request(request.method(), request.port(), request.host(), path)
.putHeader("content-type", "application/json; charset=utf-8");
httpClientRequest.handler(response -> {
duration.setRepliedOn(System.currentTimeMillis());
response.bodyHandler(body -> {
duration.setBodyHandledOn(System.currentTimeMillis());
RpcResponse rpcResponse =
RpcResponse.create(request.id(),
response.statusCode(),
body,
duration.duration());
logClientReceived(rpcResponse, body, duration);
future.complete(rpcResponse);
}).exceptionHandler(throwable -> {
if (!future.isComplete()) {
logRequestError(rpcRequest, duration, throwable);
future.fail(throwable);
}
});
}).connectionHandler(conn -> {
duration.setConnectedOn(System.currentTimeMillis());
}).endHandler(v -> {
duration.setEndedOn(System.currentTimeMillis());
});
header(request, httpClientRequest);
exceptionHandler(future, httpClientRequest);
timeout(request, httpClientRequest);
endRequest(request, httpClientRequest);
return future;
}
@Override
public String type() {
return SimpleHttpEndpoint.TYPE;
}
private String urlEncode(String path) {
try {
return URLEncoder.encode(path, "UTF-8");
} catch (UnsupportedEncodingException e) {
return path;
}
}
private boolean checkBody(HttpRpcRequest request) {
return (request.method() == HttpMethod.POST
|| request.method() == HttpMethod.PUT)
&& request.body() == null;
}
private void header(HttpRpcRequest rpcRequest, HttpClientRequest request) {
rpcRequest.headers().asMap().forEach((headerName, headerValues) -> {
request.putHeader(headerName, headerValues);
});
}
private void exceptionHandler(Future<RpcResponse> future, HttpClientRequest request) {
request.exceptionHandler(throwable -> {
if (!future.isComplete()) {
future.fail(throwable);
}
});
}
private void timeout(HttpRpcRequest rpcRequest, HttpClientRequest request) {
if (rpcRequest.timeout() > 100) {
request.setTimeout(rpcRequest.timeout());
}
}
private void endRequest(HttpRpcRequest rpcRequest, HttpClientRequest request) {
if (rpcRequest.method() == HttpMethod.GET) {
request.end();
} else if (rpcRequest.method() == HttpMethod.DELETE) {
request.end();
} else if (rpcRequest.method() == HttpMethod.POST) {
request.setChunked(true)
.end(rpcRequest.body().encode());
} else if (rpcRequest.method() == HttpMethod.PUT) {
request.setChunked(true)
.end(rpcRequest.body().encode());
}
}
private boolean checkMethod(HttpRpcRequest rpcRequest) {
return rpcRequest.method() != HttpMethod.GET
&& rpcRequest.method() != HttpMethod.DELETE
&& rpcRequest.method() != HttpMethod.POST
&& rpcRequest.method() != HttpMethod.PUT;
}
private String requestPath(HttpRpcRequest rpcRequest) {
List<String> query = new ArrayList<>(rpcRequest.params().size());
for (String key : rpcRequest.params().keySet()) {
String value = rpcRequest.params().get(key).iterator().next();
if (value != null) {
query.add(key + "=" + urlEncode(value));
}
}
String queryString = Joiner.on("&").join(query);
String path = rpcRequest.path();
if (!path.startsWith("/")) {
path = "/" + path;
}
if (!Strings.isNullOrEmpty(queryString)) {
if (path.indexOf("?") > 0) {
path += "&" + queryString;
} else {
path += "?" + queryString;
}
}
return path;
}
private void logRequestError(RpcRequest rpcRequest, Duration duration, Throwable throwable) {
Log.create(LOGGER)
.setTraceId(rpcRequest.id())
.setLogType(LogType.CR)
.setEvent("HTTP")
.addData("ct", duration.getCreatedon() == 0 ? 0 : duration.getCreatedon() -
duration.getCreatedon())
.addData("et", duration.getEndedOn() == 0 ? 0 :
duration.getEndedOn() - duration.getCreatedon())
.addData("rt", duration.getRepliedOn() == 0 ? 0 :
duration.getRepliedOn() - duration.getCreatedon())
.addData("bt", duration.getBodyHandledOn() == 0 ? 0 :
duration.getBodyHandledOn() - duration.getCreatedon())
.setThrowable(throwable)
.error();
}
private void logClientReceived(RpcResponse rpcResponse, Buffer body, Duration duration) {
Log.create(LOGGER)
.setTraceId(rpcResponse.id())
.setLogType(LogType.CR)
.setEvent("HTTP")
.addData("ct", duration.getCreatedon() == 0 ? 0 : duration.getCreatedon() -
duration.getCreatedon())
.addData("et", duration.getEndedOn() == 0 ? 0 :
duration.getEndedOn() - duration.getCreatedon())
.addData("rt", duration.getRepliedOn() == 0 ? 0 :
duration.getRepliedOn() - duration.getCreatedon())
.addData("bt", duration.getBodyHandledOn() == 0 ? 0 :
duration.getBodyHandledOn() - duration.getCreatedon())
.setMessage(" [{}] [{}ms] [{} bytes]")
.addArg(rpcResponse.statusCode())
.addArg(rpcResponse.elapsedTime())
.addArg(body.getBytes().length)
.info();
}
private void logClientSend(HttpRpcRequest httpRpcRequest) {
Log.create(LOGGER)
.setTraceId(httpRpcRequest.id())
.setLogType(LogType.CS)
.setEvent("HTTP")
.addData("server", httpRpcRequest.host() + ":" + httpRpcRequest.port())
.setMessage("[{}] [{}] [{}] [{}]")
.addArg(httpRpcRequest.method().name() + " " + httpRpcRequest.path())
.addArg(MultimapUtils.convertToString(httpRpcRequest.headers(), "no header"))
.addArg(MultimapUtils.convertToString(httpRpcRequest.params(), "no param"))
.addArg(httpRpcRequest.body() == null ? "no body" : httpRpcRequest.body().encode())
.info();
}
/**
* 为了更准确的度量http请求的性能,需要记录HTTP各个阶段的时间。
*/
private class Duration {
/**
* 创建时间
*/
private long createdon = System.currentTimeMillis();
/**
* 发送请求时间
*/
private long endedOn;
/**
* 连接时间
*/
private long connectedOn;
/**
* 服务端响应时间
*/
private long repliedOn;
/**
* body处理时间:body处理会比收到response慢一点点
*/
private long bodyHandledOn;
public long duration() {
return bodyHandledOn - createdon;
}
public long getCreatedon() {
return createdon;
}
public void setCreatedon(long createdon) {
this.createdon = createdon;
}
public long getEndedOn() {
return endedOn;
}
public void setEndedOn(long endedOn) {
this.endedOn = endedOn;
}
public long getConnectedOn() {
return connectedOn;
}
public void setConnectedOn(long connectedOn) {
this.connectedOn = connectedOn;
}
public long getRepliedOn() {
return repliedOn;
}
public void setRepliedOn(long repliedOn) {
this.repliedOn = repliedOn;
}
public long getBodyHandledOn() {
return bodyHandledOn;
}
public void setBodyHandledOn(long bodyHandledOn) {
this.bodyHandledOn = bodyHandledOn;
}
}
}
| [
"edgar615@gmail.com"
] | edgar615@gmail.com |
d6fa89aea9654fb5205bab09205be7b55b118eb6 | 00f27ef0231a560aa0bcc89d0bb4d242b7ccfe9e | /app/src/main/java/dev/hoanghiep/project1/MainActivity.java | effae9df0335db39aa385d2760dfa778aa82d7b7 | [] | no_license | h0AnGHIeP/hust_project_1 | 179b1ddb11d7edf7f04199825df3be7b25349bc7 | 3e9a48c591e3d40310be658a019b95f0af34fd45 | refs/heads/master | 2020-09-16T01:09:09.767253 | 2019-12-19T16:47:36 | 2019-12-19T16:47:36 | 223,606,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | package dev.hoanghiep.project1;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
public abstract class MainActivity extends AppCompatActivity {
public abstract Fragment getFragment();
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment);
FragmentManager fm = getSupportFragmentManager();
Fragment fragment= fm.findFragmentById(R.id.fragment_container);
if(fragment==null){
fragment = getFragment();
fm.beginTransaction()
.add(R.id.fragment_container, fragment)
.commit();
}
}
}
| [
"hiepga3001@gmail.com"
] | hiepga3001@gmail.com |
da8a46617a21dcb5679dcd5604b904324f363489 | ed331ac84d07caad8815a3d56c55cb51d8139725 | /StartHere/src/main/java/com/lambdaschool/starthere/controllers/BookController.java | 7b1987a1f6e455f17542a3a8d31a8d6e6722acba | [
"MIT"
] | permissive | steven-barrett/Sprint-Challenge--Java-Frameworks-java-bookstore | fb1b8b7072665303b17fc3cd72af499e0e5c1224 | 8e1c28c7f3e22d50d5672de911156ec082e12056 | refs/heads/master | 2020-06-24T17:54:03.679608 | 2019-07-27T15:09:48 | 2019-07-27T15:09:48 | 199,037,608 | 0 | 0 | MIT | 2019-07-27T15:09:49 | 2019-07-26T15:09:36 | null | UTF-8 | Java | false | false | 3,788 | java | package com.lambdaschool.starthere.controllers;
import com.lambdaschool.starthere.models.Book;
import com.lambdaschool.starthere.models.ErrorDetail;
import com.lambdaschool.starthere.services.BookService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
@RequestMapping(value = "/books")
public class BookController
{
private static final Logger logger = LoggerFactory.getLogger(BookController.class);
@Autowired
private BookService bookService;
@ApiOperation(value = "returns all Courses with Paging Ability",
responseContainer = "List")
@ApiImplicitParams({@ApiImplicitParam(name = "page",
dataType = "integer",
paramType = "query",
value = "Results page you want to retrieve (0..N)"), @ApiImplicitParam(name = "size",
dataType = "integer",
paramType = "query",
value = "Number of records per page."), @ApiImplicitParam(name = "sort",
allowMultiple = true,
dataType = "string",
paramType = "query",
value = "Sorting criteria in the format: property(,asc|desc). " + "Default sort order is ascending. " + "Multiple sort criteria are supported.")})
@GetMapping(value = "/books", produces = {"application/json"})
public ResponseEntity<?> listAllBooks(HttpServletRequest request, @PageableDefault(page = 0, size = 6)
Pageable pageable)
{
logger.info(request.getMethod() + " " + request.getRequestURI() + " accessed");
List<Book> myBooks = bookService.findAll(pageable);
return new ResponseEntity<>(myBooks, HttpStatus.OK);
}
@ApiOperation(value = "Updates an existing book",
response = Book.class)
@ApiResponses(value = {@ApiResponse(code = 201,
message = "Book Updated",
response = void.class), @ApiResponse(code = 500,
message = "Error updating book",
response = ErrorDetail.class)})
@PutMapping(value = "/book/{bookid}")
public ResponseEntity<?> addBookToAuthor(
HttpServletRequest request,
@RequestBody
Book updateBook,
@ApiParam(value = "The student id",
required = true,
example = "1")
@PathVariable
long bookid)
{
logger.info(request.getMethod() + " " + request.getRequestURI() + " accessed");
bookService.update(updateBook, bookid);
return new ResponseEntity<>(HttpStatus.OK);
}
@ApiOperation(value = "Deletes an existing book",
response = void.class)
@ApiResponses(value = {@ApiResponse(code = 201,
message = "Book Deleted",
response = void.class), @ApiResponse(code = 500,
message = "Error deleting book",
response = ErrorDetail.class)})
@DeleteMapping("/delete/{bookid}")
public ResponseEntity<?> deleteBookById(
@ApiParam(value = "The book id",
required = true,
example = "1")
@PathVariable
long bookid,
HttpServletRequest request)
{
logger.info(request.getMethod() + " " + request.getRequestURI() + " accessed");
bookService.delete(bookid);
return new ResponseEntity<>(HttpStatus.OK);
}
}
| [
"steven122185@gmail.com"
] | steven122185@gmail.com |
befbe4a6fe5966fb69a62b98f6fd05d91990fcbd | 3ea9e1d64d80ba74a70f326a4b9af89ea3e0d0c7 | /src/com/sforce/soap/enterprise/sobject/TaskFeed.java | af4ed483f0aefb5839f3e04654832caea768d1bd | [
"LicenseRef-scancode-zuora-software"
] | permissive | deverma/Zilla-J | d4c369adce5dcd18edbb235fa067b589c416c9fa | c0c64519af4796a84f4ddcacb23da5504b75a182 | refs/heads/master | 2021-01-22T15:04:09.659210 | 2015-07-08T15:00:29 | 2015-07-08T15:00:29 | 37,580,179 | 0 | 1 | null | 2015-06-17T07:42:10 | 2015-06-17T07:42:10 | null | UTF-8 | Java | false | false | 35,886 | java | /**
* TaskFeed.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.sforce.soap.enterprise.sobject;
public class TaskFeed extends com.sforce.soap.enterprise.sobject.SObject implements java.io.Serializable {
private java.lang.String body;
private java.lang.Integer commentCount;
private byte[] contentData;
private java.lang.String contentDescription;
private java.lang.String contentFileName;
private java.lang.Integer contentSize;
private java.lang.String contentType;
private com.sforce.soap.enterprise.sobject.SObject createdBy;
private java.lang.String createdById;
private java.util.Calendar createdDate;
private com.sforce.soap.enterprise.QueryResult feedComments;
private com.sforce.soap.enterprise.QueryResult feedLikes;
private com.sforce.soap.enterprise.QueryResult feedTrackedChanges;
private com.sforce.soap.enterprise.sobject.SObject insertedBy;
private java.lang.String insertedById;
private java.lang.Boolean isDeleted;
private java.util.Calendar lastModifiedDate;
private java.lang.Integer likeCount;
private java.lang.String linkUrl;
private com.sforce.soap.enterprise.sobject.Task parent;
private java.lang.String parentId;
private java.lang.String relatedRecordId;
private java.util.Calendar systemModstamp;
private java.lang.String title;
private java.lang.String type;
public TaskFeed() {
}
public TaskFeed(
java.lang.String[] fieldsToNull,
java.lang.String id,
java.lang.String body,
java.lang.Integer commentCount,
byte[] contentData,
java.lang.String contentDescription,
java.lang.String contentFileName,
java.lang.Integer contentSize,
java.lang.String contentType,
com.sforce.soap.enterprise.sobject.SObject createdBy,
java.lang.String createdById,
java.util.Calendar createdDate,
com.sforce.soap.enterprise.QueryResult feedComments,
com.sforce.soap.enterprise.QueryResult feedLikes,
com.sforce.soap.enterprise.QueryResult feedTrackedChanges,
com.sforce.soap.enterprise.sobject.SObject insertedBy,
java.lang.String insertedById,
java.lang.Boolean isDeleted,
java.util.Calendar lastModifiedDate,
java.lang.Integer likeCount,
java.lang.String linkUrl,
com.sforce.soap.enterprise.sobject.Task parent,
java.lang.String parentId,
java.lang.String relatedRecordId,
java.util.Calendar systemModstamp,
java.lang.String title,
java.lang.String type) {
super(
fieldsToNull,
id);
this.body = body;
this.commentCount = commentCount;
this.contentData = contentData;
this.contentDescription = contentDescription;
this.contentFileName = contentFileName;
this.contentSize = contentSize;
this.contentType = contentType;
this.createdBy = createdBy;
this.createdById = createdById;
this.createdDate = createdDate;
this.feedComments = feedComments;
this.feedLikes = feedLikes;
this.feedTrackedChanges = feedTrackedChanges;
this.insertedBy = insertedBy;
this.insertedById = insertedById;
this.isDeleted = isDeleted;
this.lastModifiedDate = lastModifiedDate;
this.likeCount = likeCount;
this.linkUrl = linkUrl;
this.parent = parent;
this.parentId = parentId;
this.relatedRecordId = relatedRecordId;
this.systemModstamp = systemModstamp;
this.title = title;
this.type = type;
}
/**
* Gets the body value for this TaskFeed.
*
* @return body
*/
public java.lang.String getBody() {
return body;
}
/**
* Sets the body value for this TaskFeed.
*
* @param body
*/
public void setBody(java.lang.String body) {
this.body = body;
}
/**
* Gets the commentCount value for this TaskFeed.
*
* @return commentCount
*/
public java.lang.Integer getCommentCount() {
return commentCount;
}
/**
* Sets the commentCount value for this TaskFeed.
*
* @param commentCount
*/
public void setCommentCount(java.lang.Integer commentCount) {
this.commentCount = commentCount;
}
/**
* Gets the contentData value for this TaskFeed.
*
* @return contentData
*/
public byte[] getContentData() {
return contentData;
}
/**
* Sets the contentData value for this TaskFeed.
*
* @param contentData
*/
public void setContentData(byte[] contentData) {
this.contentData = contentData;
}
/**
* Gets the contentDescription value for this TaskFeed.
*
* @return contentDescription
*/
public java.lang.String getContentDescription() {
return contentDescription;
}
/**
* Sets the contentDescription value for this TaskFeed.
*
* @param contentDescription
*/
public void setContentDescription(java.lang.String contentDescription) {
this.contentDescription = contentDescription;
}
/**
* Gets the contentFileName value for this TaskFeed.
*
* @return contentFileName
*/
public java.lang.String getContentFileName() {
return contentFileName;
}
/**
* Sets the contentFileName value for this TaskFeed.
*
* @param contentFileName
*/
public void setContentFileName(java.lang.String contentFileName) {
this.contentFileName = contentFileName;
}
/**
* Gets the contentSize value for this TaskFeed.
*
* @return contentSize
*/
public java.lang.Integer getContentSize() {
return contentSize;
}
/**
* Sets the contentSize value for this TaskFeed.
*
* @param contentSize
*/
public void setContentSize(java.lang.Integer contentSize) {
this.contentSize = contentSize;
}
/**
* Gets the contentType value for this TaskFeed.
*
* @return contentType
*/
public java.lang.String getContentType() {
return contentType;
}
/**
* Sets the contentType value for this TaskFeed.
*
* @param contentType
*/
public void setContentType(java.lang.String contentType) {
this.contentType = contentType;
}
/**
* Gets the createdBy value for this TaskFeed.
*
* @return createdBy
*/
public com.sforce.soap.enterprise.sobject.SObject getCreatedBy() {
return createdBy;
}
/**
* Sets the createdBy value for this TaskFeed.
*
* @param createdBy
*/
public void setCreatedBy(com.sforce.soap.enterprise.sobject.SObject createdBy) {
this.createdBy = createdBy;
}
/**
* Gets the createdById value for this TaskFeed.
*
* @return createdById
*/
public java.lang.String getCreatedById() {
return createdById;
}
/**
* Sets the createdById value for this TaskFeed.
*
* @param createdById
*/
public void setCreatedById(java.lang.String createdById) {
this.createdById = createdById;
}
/**
* Gets the createdDate value for this TaskFeed.
*
* @return createdDate
*/
public java.util.Calendar getCreatedDate() {
return createdDate;
}
/**
* Sets the createdDate value for this TaskFeed.
*
* @param createdDate
*/
public void setCreatedDate(java.util.Calendar createdDate) {
this.createdDate = createdDate;
}
/**
* Gets the feedComments value for this TaskFeed.
*
* @return feedComments
*/
public com.sforce.soap.enterprise.QueryResult getFeedComments() {
return feedComments;
}
/**
* Sets the feedComments value for this TaskFeed.
*
* @param feedComments
*/
public void setFeedComments(com.sforce.soap.enterprise.QueryResult feedComments) {
this.feedComments = feedComments;
}
/**
* Gets the feedLikes value for this TaskFeed.
*
* @return feedLikes
*/
public com.sforce.soap.enterprise.QueryResult getFeedLikes() {
return feedLikes;
}
/**
* Sets the feedLikes value for this TaskFeed.
*
* @param feedLikes
*/
public void setFeedLikes(com.sforce.soap.enterprise.QueryResult feedLikes) {
this.feedLikes = feedLikes;
}
/**
* Gets the feedTrackedChanges value for this TaskFeed.
*
* @return feedTrackedChanges
*/
public com.sforce.soap.enterprise.QueryResult getFeedTrackedChanges() {
return feedTrackedChanges;
}
/**
* Sets the feedTrackedChanges value for this TaskFeed.
*
* @param feedTrackedChanges
*/
public void setFeedTrackedChanges(com.sforce.soap.enterprise.QueryResult feedTrackedChanges) {
this.feedTrackedChanges = feedTrackedChanges;
}
/**
* Gets the insertedBy value for this TaskFeed.
*
* @return insertedBy
*/
public com.sforce.soap.enterprise.sobject.SObject getInsertedBy() {
return insertedBy;
}
/**
* Sets the insertedBy value for this TaskFeed.
*
* @param insertedBy
*/
public void setInsertedBy(com.sforce.soap.enterprise.sobject.SObject insertedBy) {
this.insertedBy = insertedBy;
}
/**
* Gets the insertedById value for this TaskFeed.
*
* @return insertedById
*/
public java.lang.String getInsertedById() {
return insertedById;
}
/**
* Sets the insertedById value for this TaskFeed.
*
* @param insertedById
*/
public void setInsertedById(java.lang.String insertedById) {
this.insertedById = insertedById;
}
/**
* Gets the isDeleted value for this TaskFeed.
*
* @return isDeleted
*/
public java.lang.Boolean getIsDeleted() {
return isDeleted;
}
/**
* Sets the isDeleted value for this TaskFeed.
*
* @param isDeleted
*/
public void setIsDeleted(java.lang.Boolean isDeleted) {
this.isDeleted = isDeleted;
}
/**
* Gets the lastModifiedDate value for this TaskFeed.
*
* @return lastModifiedDate
*/
public java.util.Calendar getLastModifiedDate() {
return lastModifiedDate;
}
/**
* Sets the lastModifiedDate value for this TaskFeed.
*
* @param lastModifiedDate
*/
public void setLastModifiedDate(java.util.Calendar lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
/**
* Gets the likeCount value for this TaskFeed.
*
* @return likeCount
*/
public java.lang.Integer getLikeCount() {
return likeCount;
}
/**
* Sets the likeCount value for this TaskFeed.
*
* @param likeCount
*/
public void setLikeCount(java.lang.Integer likeCount) {
this.likeCount = likeCount;
}
/**
* Gets the linkUrl value for this TaskFeed.
*
* @return linkUrl
*/
public java.lang.String getLinkUrl() {
return linkUrl;
}
/**
* Sets the linkUrl value for this TaskFeed.
*
* @param linkUrl
*/
public void setLinkUrl(java.lang.String linkUrl) {
this.linkUrl = linkUrl;
}
/**
* Gets the parent value for this TaskFeed.
*
* @return parent
*/
public com.sforce.soap.enterprise.sobject.Task getParent() {
return parent;
}
/**
* Sets the parent value for this TaskFeed.
*
* @param parent
*/
public void setParent(com.sforce.soap.enterprise.sobject.Task parent) {
this.parent = parent;
}
/**
* Gets the parentId value for this TaskFeed.
*
* @return parentId
*/
public java.lang.String getParentId() {
return parentId;
}
/**
* Sets the parentId value for this TaskFeed.
*
* @param parentId
*/
public void setParentId(java.lang.String parentId) {
this.parentId = parentId;
}
/**
* Gets the relatedRecordId value for this TaskFeed.
*
* @return relatedRecordId
*/
public java.lang.String getRelatedRecordId() {
return relatedRecordId;
}
/**
* Sets the relatedRecordId value for this TaskFeed.
*
* @param relatedRecordId
*/
public void setRelatedRecordId(java.lang.String relatedRecordId) {
this.relatedRecordId = relatedRecordId;
}
/**
* Gets the systemModstamp value for this TaskFeed.
*
* @return systemModstamp
*/
public java.util.Calendar getSystemModstamp() {
return systemModstamp;
}
/**
* Sets the systemModstamp value for this TaskFeed.
*
* @param systemModstamp
*/
public void setSystemModstamp(java.util.Calendar systemModstamp) {
this.systemModstamp = systemModstamp;
}
/**
* Gets the title value for this TaskFeed.
*
* @return title
*/
public java.lang.String getTitle() {
return title;
}
/**
* Sets the title value for this TaskFeed.
*
* @param title
*/
public void setTitle(java.lang.String title) {
this.title = title;
}
/**
* Gets the type value for this TaskFeed.
*
* @return type
*/
public java.lang.String getType() {
return type;
}
/**
* Sets the type value for this TaskFeed.
*
* @param type
*/
public void setType(java.lang.String type) {
this.type = type;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof TaskFeed)) return false;
TaskFeed other = (TaskFeed) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.body==null && other.getBody()==null) ||
(this.body!=null &&
this.body.equals(other.getBody()))) &&
((this.commentCount==null && other.getCommentCount()==null) ||
(this.commentCount!=null &&
this.commentCount.equals(other.getCommentCount()))) &&
((this.contentData==null && other.getContentData()==null) ||
(this.contentData!=null &&
java.util.Arrays.equals(this.contentData, other.getContentData()))) &&
((this.contentDescription==null && other.getContentDescription()==null) ||
(this.contentDescription!=null &&
this.contentDescription.equals(other.getContentDescription()))) &&
((this.contentFileName==null && other.getContentFileName()==null) ||
(this.contentFileName!=null &&
this.contentFileName.equals(other.getContentFileName()))) &&
((this.contentSize==null && other.getContentSize()==null) ||
(this.contentSize!=null &&
this.contentSize.equals(other.getContentSize()))) &&
((this.contentType==null && other.getContentType()==null) ||
(this.contentType!=null &&
this.contentType.equals(other.getContentType()))) &&
((this.createdBy==null && other.getCreatedBy()==null) ||
(this.createdBy!=null &&
this.createdBy.equals(other.getCreatedBy()))) &&
((this.createdById==null && other.getCreatedById()==null) ||
(this.createdById!=null &&
this.createdById.equals(other.getCreatedById()))) &&
((this.createdDate==null && other.getCreatedDate()==null) ||
(this.createdDate!=null &&
this.createdDate.equals(other.getCreatedDate()))) &&
((this.feedComments==null && other.getFeedComments()==null) ||
(this.feedComments!=null &&
this.feedComments.equals(other.getFeedComments()))) &&
((this.feedLikes==null && other.getFeedLikes()==null) ||
(this.feedLikes!=null &&
this.feedLikes.equals(other.getFeedLikes()))) &&
((this.feedTrackedChanges==null && other.getFeedTrackedChanges()==null) ||
(this.feedTrackedChanges!=null &&
this.feedTrackedChanges.equals(other.getFeedTrackedChanges()))) &&
((this.insertedBy==null && other.getInsertedBy()==null) ||
(this.insertedBy!=null &&
this.insertedBy.equals(other.getInsertedBy()))) &&
((this.insertedById==null && other.getInsertedById()==null) ||
(this.insertedById!=null &&
this.insertedById.equals(other.getInsertedById()))) &&
((this.isDeleted==null && other.getIsDeleted()==null) ||
(this.isDeleted!=null &&
this.isDeleted.equals(other.getIsDeleted()))) &&
((this.lastModifiedDate==null && other.getLastModifiedDate()==null) ||
(this.lastModifiedDate!=null &&
this.lastModifiedDate.equals(other.getLastModifiedDate()))) &&
((this.likeCount==null && other.getLikeCount()==null) ||
(this.likeCount!=null &&
this.likeCount.equals(other.getLikeCount()))) &&
((this.linkUrl==null && other.getLinkUrl()==null) ||
(this.linkUrl!=null &&
this.linkUrl.equals(other.getLinkUrl()))) &&
((this.parent==null && other.getParent()==null) ||
(this.parent!=null &&
this.parent.equals(other.getParent()))) &&
((this.parentId==null && other.getParentId()==null) ||
(this.parentId!=null &&
this.parentId.equals(other.getParentId()))) &&
((this.relatedRecordId==null && other.getRelatedRecordId()==null) ||
(this.relatedRecordId!=null &&
this.relatedRecordId.equals(other.getRelatedRecordId()))) &&
((this.systemModstamp==null && other.getSystemModstamp()==null) ||
(this.systemModstamp!=null &&
this.systemModstamp.equals(other.getSystemModstamp()))) &&
((this.title==null && other.getTitle()==null) ||
(this.title!=null &&
this.title.equals(other.getTitle()))) &&
((this.type==null && other.getType()==null) ||
(this.type!=null &&
this.type.equals(other.getType())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getBody() != null) {
_hashCode += getBody().hashCode();
}
if (getCommentCount() != null) {
_hashCode += getCommentCount().hashCode();
}
if (getContentData() != null) {
for (int i=0;
i<java.lang.reflect.Array.getLength(getContentData());
i++) {
java.lang.Object obj = java.lang.reflect.Array.get(getContentData(), i);
if (obj != null &&
!obj.getClass().isArray()) {
_hashCode += obj.hashCode();
}
}
}
if (getContentDescription() != null) {
_hashCode += getContentDescription().hashCode();
}
if (getContentFileName() != null) {
_hashCode += getContentFileName().hashCode();
}
if (getContentSize() != null) {
_hashCode += getContentSize().hashCode();
}
if (getContentType() != null) {
_hashCode += getContentType().hashCode();
}
if (getCreatedBy() != null) {
_hashCode += getCreatedBy().hashCode();
}
if (getCreatedById() != null) {
_hashCode += getCreatedById().hashCode();
}
if (getCreatedDate() != null) {
_hashCode += getCreatedDate().hashCode();
}
if (getFeedComments() != null) {
_hashCode += getFeedComments().hashCode();
}
if (getFeedLikes() != null) {
_hashCode += getFeedLikes().hashCode();
}
if (getFeedTrackedChanges() != null) {
_hashCode += getFeedTrackedChanges().hashCode();
}
if (getInsertedBy() != null) {
_hashCode += getInsertedBy().hashCode();
}
if (getInsertedById() != null) {
_hashCode += getInsertedById().hashCode();
}
if (getIsDeleted() != null) {
_hashCode += getIsDeleted().hashCode();
}
if (getLastModifiedDate() != null) {
_hashCode += getLastModifiedDate().hashCode();
}
if (getLikeCount() != null) {
_hashCode += getLikeCount().hashCode();
}
if (getLinkUrl() != null) {
_hashCode += getLinkUrl().hashCode();
}
if (getParent() != null) {
_hashCode += getParent().hashCode();
}
if (getParentId() != null) {
_hashCode += getParentId().hashCode();
}
if (getRelatedRecordId() != null) {
_hashCode += getRelatedRecordId().hashCode();
}
if (getSystemModstamp() != null) {
_hashCode += getSystemModstamp().hashCode();
}
if (getTitle() != null) {
_hashCode += getTitle().hashCode();
}
if (getType() != null) {
_hashCode += getType().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(TaskFeed.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "TaskFeed"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("body");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "Body"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("commentCount");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "CommentCount"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("contentData");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "ContentData"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "base64Binary"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("contentDescription");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "ContentDescription"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("contentFileName");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "ContentFileName"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("contentSize");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "ContentSize"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("contentType");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "ContentType"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("createdBy");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "CreatedBy"));
elemField.setXmlType(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "sObject"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("createdById");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "CreatedById"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("createdDate");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "CreatedDate"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("feedComments");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "FeedComments"));
elemField.setXmlType(new javax.xml.namespace.QName("urn:enterprise.soap.sforce.com", "QueryResult"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("feedLikes");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "FeedLikes"));
elemField.setXmlType(new javax.xml.namespace.QName("urn:enterprise.soap.sforce.com", "QueryResult"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("feedTrackedChanges");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "FeedTrackedChanges"));
elemField.setXmlType(new javax.xml.namespace.QName("urn:enterprise.soap.sforce.com", "QueryResult"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("insertedBy");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "InsertedBy"));
elemField.setXmlType(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "sObject"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("insertedById");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "InsertedById"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("isDeleted");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "IsDeleted"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("lastModifiedDate");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "LastModifiedDate"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("likeCount");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "LikeCount"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("linkUrl");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "LinkUrl"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("parent");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "Parent"));
elemField.setXmlType(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "Task"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("parentId");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "ParentId"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("relatedRecordId");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "RelatedRecordId"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("systemModstamp");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "SystemModstamp"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("title");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "Title"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("type");
elemField.setXmlName(new javax.xml.namespace.QName("urn:sobject.enterprise.soap.sforce.com", "Type"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"deepak.cricket@gmail.com"
] | deepak.cricket@gmail.com |
95d64a8422b16d9885795dd2e1c77ca2aef7d3bf | 144cbb5eb0ccbc29dbc6d2f3d4a68ba2ba8cbf0f | /project_euler/src/project_euler/q32.java | 5380791054ac6de52824501a4c972cc31506d52c | [] | no_license | kwojcicki/coding_questions | 3349359e16204b77a3504e8a84a84bb4353f889b | 524487bca6751ddc74084281580a7f64934f96da | refs/heads/master | 2023-09-01T15:45:31.446929 | 2023-08-22T04:19:11 | 2023-08-22T04:19:11 | 146,682,896 | 2 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,695 | java | package project_euler;
import java.util.Arrays;
import java.util.HashSet;
public class q32 {
/**
*
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.
The product 7254 is unusual, as the identity, 39 × 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.
Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.
HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.
*/
public static void main(String[] args) {
long sum = 0;
HashSet<Long> seen = new HashSet<Long>();
for(long i = 1; i < 10_000; i++) {
for(long j = 1; j < 10_000; j++) {
long total = i * j;
boolean[] chars = new boolean[10];
if(Long.toString(i).length() + Long.toString(j).length() + Long.toString(total).length() == 9) {
for(char c: Long.toString(i).toCharArray()) {
chars[c - '0'] = true;
}
for(char c: Long.toString(j).toCharArray()) {
chars[c - '0'] = true;
}
for(char c: Long.toString(total).toCharArray()) {
chars[c - '0'] = true;
}
boolean flag = !chars[0] && chars[1] && chars[2] && chars[3] && chars[4] && chars[5] && chars[6] && chars[7] && chars[8] && chars[9];
if(flag && !seen.contains(total)) {
System.out.println(Arrays.toString(chars));
System.out.println(i + " " + j + " " + total);
sum += total;
seen.add(total);
}
}
}
}
System.out.println(sum);
}
}
| [
"kwojcicki@sympatico.ca"
] | kwojcicki@sympatico.ca |
0048d69095f2d897f2cdd221a5f73a0c50d4a236 | fa9555d91509848f273f9c734c59b169d9547568 | /java/com/xchinfo/erp/common/HrDBConnectInfo.java | cccef2544efbd8fbd4580be286b1d34e68d8c387 | [] | no_license | useryansong/javaProject | f3701791cbd928b72c7cdacf27339dc45d01878d | 1fbfd24e3eeb45d175ace903290193bca022e383 | refs/heads/master | 2021-04-12T17:19:46.766450 | 2020-03-22T02:07:41 | 2020-03-22T02:07:41 | 249,095,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,049 | java | package com.xchinfo.erp.common;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.yecat.mybatis.utils.jdbc.DBConnectInfo;
@Component
@ConfigurationProperties(prefix="hrDBConnectInfo")
public class HrDBConnectInfo extends DBConnectInfo {
@Override
public String getUsername() {
return super.username;
}
@Override
public void setUsername(String username) {
super.username = username;
}
@Override
public String getPassword() {
return super.password;
}
@Override
public void setPassword(String password) {
super.password = password;
}
@Override
public String getUrl() {
return super.url;
}
@Override
public void setUrl(String url) {
this.url = url;
}
@Override
public String getDriverName() {
return driverName;
}
@Override
public void setDriverName(String driverName) {
this.driverName = driverName;
}
}
| [
"useryansong@gmail.com"
] | useryansong@gmail.com |
e9409fd3f535fc3ec03805b8a23512998cc1e7ac | 6731424bb55bc5fb320cf21fd1c192e5d0ccf7bf | /AbstractDemo/Employee.java | 4a7a4db8e612e9cd637a4c7000f087e9395cf4f1 | [] | no_license | suifengzs/runnob-s-code | 9c64e65dee34ee755172b0d4168f656da6fffdca | 20c03c83fb211a87cc276cd5245140c7b7a13ddc | refs/heads/master | 2020-03-26T14:28:32.078052 | 2018-08-23T08:53:42 | 2018-08-23T08:53:42 | 144,989,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | public abstract class Employee{
private String name;
private String address;
private int number;
public Employee(String name,String address,int number){
System.out.println("Constructing an Employee");
this.name = name ;
this.address = address;
this.number = number;
}
public double computerPay(){
System.out.println("Inside Employee computerPay");
return 0.0;
}
public void mailCheck(){
System.out.println("Mailing a check to"+this.name+" "+this.address);
}
public String toString(){
return name+" "+address+" "+number;
}
public String getName(){
return name;
}
public void setAddress(String newAddress){
address = newAddress;
}
public int getNumber(){
return number;
}
abstract boolean printinfo();
}
| [
"zs@qq.com"
] | zs@qq.com |
7b1dbc5ecc445dd239875d1e10299c0a3112931d | 2a8e1bbae262a2c2a8f91e81cd354cb9388b26de | /app/src/main/java/com/yijiu/e520/base/SimpleFragment.java | e11811cbd5fb52949b7fc5fe7cd2f138195ce79f | [] | no_license | dengluo/e5202 | 4d50e8fb6082b08be303449950931c93310ed555 | 97d011d0e5ce0f70ca1c0d9c6eed78a188b732e0 | refs/heads/master | 2020-06-02T08:12:33.475583 | 2019-06-10T03:55:20 | 2019-06-10T03:55:20 | 191,093,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,006 | java | package com.yijiu.e520.base;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import me.yokeyword.fragmentation.SupportFragment;
/**
* Created by Mr.yang on 2017/12/04
* 无MVP的Fragment基类
*/
public abstract class SimpleFragment extends SupportFragment {
protected View mView;
protected Activity mActivity;
protected Context mContext;
private Unbinder mUnBinder;
protected boolean isInited = false;
@Override
public void onAttach(Context context) {
mActivity = (Activity) context;
mContext = context;
super.onAttach(context);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mView = inflater.inflate(getLayoutId(), null);
mUnBinder = ButterKnife.bind(this, mView);
return mView;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (savedInstanceState == null) {
if (!isHidden()) {
isInited = true;
initEventAndData();
}
} else {
if (!isSupportHidden()) {
isInited = true;
initEventAndData();
}
}
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (!isInited && !hidden) {
isInited = true;
initEventAndData();
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
mUnBinder.unbind();
}
protected abstract int getLayoutId();
protected abstract void initEventAndData();
}
| [
"dengluo2008@163.com"
] | dengluo2008@163.com |
bbd8999782b214df322eccb579edb95f59ea3ad8 | 510a7b9d5ff094c5eac80be98a2002192e3a35c6 | /Sorting the first half of the array in ascending order and the second half of the array in descending order./Main.java | ff2064f016afd992b889cbe6789086bd7bcc7a49 | [] | no_license | mukulchauhan97/Playground | 46dc0997937891975698091a8b6b6570b5135aa4 | 0d87010178e8cb68af4e3a5598d8405dda08fe50 | refs/heads/master | 2020-04-23T16:19:34.502142 | 2019-04-17T07:16:38 | 2019-04-17T07:16:38 | 171,294,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 980 | java | #include<stdio.h>
int insert(int n,int list[])
{
for (int idx1 = 1; idx1 < n/2; idx1++)
{
int key = list[idx1];
int idx2 = idx1 - 1;
while((idx2 >= 0) && (list[idx2] > key))
{
list[idx2 + 1] = list[idx2];
idx2--;
}
list[idx2 + 1] = key;
}
for (int idx1 = n/2; idx1 < n; idx1++)
{
int key = list[idx1];
int idx2 = idx1 - 1;
while((idx2 >= n/2) && (list[idx2] < key))
{
list[idx2 + 1] = list[idx2];
idx2--;
}
list[idx2 + 1] = key;
}
for(int i = 0; i < n; i++)
{
printf("%d ", list[i]);
}
return 0;
}
int main()
{
int n;
scanf("%d",&n);
int list[n];
for(int index = 0;index < n; index++)
{
scanf("%d",&list[index]);
}
insert(n,list);
return 0;
}
| [
"42331958+mukulchauhan97@users.noreply.github.com"
] | 42331958+mukulchauhan97@users.noreply.github.com |
7e75a146fc28734594ff2c79f553f817d2d72c78 | 02b7c9c09e3a2da174f9a85f4b4de617488b3390 | /Example1. Generic-Dao-with-interface/src/main/java/raj/java/generic/exception/MySqlException.java | 3c431d2772306cc08d5d59410f94378bb1cdf176 | [] | no_license | rajbhatta/Java-generic-scaffolding-archieve | b9d7ef78808255ac435b4e901f33576bef0ff38f | 6185c9700bfc1b8781ada836d25553565855f836 | refs/heads/master | 2023-01-10T15:51:37.581458 | 2020-11-09T01:36:16 | 2020-11-09T01:36:16 | 289,752,844 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package raj.java.generic.exception;
public class MySqlException extends Exception {
public MySqlException() {}
public MySqlException(String message) {
super(message);
}
public MySqlException(String message, Throwable cause) {
super(message, cause);
}
public MySqlException(Throwable cause) {
super(cause);
}
public MySqlException(
String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"bhattaraj21@gmail.com"
] | bhattaraj21@gmail.com |
ae8ab1a3ce7baeaa6135123723e1b6e0a1cd62d8 | df4029553fdc826815e4e170b4b99bf249f6d271 | /src/main/java/gal/caronte/sw/manager/ImaxeManager.java | 359784429b3b6d85afa064322d88887335dcd0b6 | [] | no_license | ElessarTasardur/SWCaronte | 7d31a42de06f12c29a87f71914f26f7f73edd9de | f74cedc492bab59dad4c019ca31072a3d0bd467a | refs/heads/master | 2021-05-07T13:38:41.275032 | 2018-06-20T21:48:49 | 2018-06-20T21:48:49 | 109,598,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package gal.caronte.sw.manager;
import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
import gal.caronte.sw.modelo.imaxe.Imaxe;
public interface ImaxeManager {
Integer store(MultipartFile file, short idEdificio, short idPoi, String nome, String descricion);
Resource loadAsResource(String filename, int idImaxe);
boolean eliminarImaxe(short idImaxe);
void modificarDatosImaxe(Imaxe imaxe);
}
| [
"elessar.tasardur@gmail.com"
] | elessar.tasardur@gmail.com |
e04c44e50411a291825e221b825cbe2ecbb65fff | 502a5e498dcbacec573bb75b4d45fd1402e3a959 | /project/src/cn/zhjb/service/UserService.java | 6970180f5749d7a158bbd5a1c1a3e158eaa81725 | [] | no_license | CHN1116/MyProject | 2851bfeec9474eee1f263eea032fb47baca64b0a | 2adc93a2e1aede6e52be45a9d4fd0a3b7ae3e356 | refs/heads/master | 2020-07-30T08:13:17.121985 | 2019-09-22T13:16:53 | 2019-09-22T13:16:53 | 210,149,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 156 | java | package cn.zhjb.service;
import cn.zhjb.pojo.User;
public interface UserService {
User getUserInfoService(String username, String userpwd);
}
| [
"noreply@github.com"
] | noreply@github.com |
9e24be1d559d5eb21a7744de67ad8943b43b7e2c | 2f6eb700d66f8787dc92964c20e4ee523a8fd080 | /stars-travel-service/src/main/java/com/stars/upload/UploadUtils.java | 773acd0360a3bad24c43d46a233d9ce7c59a0914 | [] | no_license | guoguo1227/xgtravel | 04f08c03a4bf38b7347bb03c0deaf1cbfdc585ca | bf4d90ca352e5ce763428b7f1d5d3290348818e0 | refs/heads/master | 2020-04-12T08:58:54.221677 | 2016-11-23T14:56:21 | 2016-11-23T14:56:21 | 58,798,190 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,113 | java | package com.stars.upload;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;
public class UploadUtils {
/**
* 36个小写字母和数字
*/
public static final char[] N36_CHARS = { '0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z' };
public static final DateFormat MONTH_FORMAT = new SimpleDateFormat("/yyyyMM/ddHHmmss");
public static final DateFormat YEAR_MONTH_FORMAT = new SimpleDateFormat("yyyyMM");
public static final DateFormat SHORT_FORMAT = new SimpleDateFormat("ddHHmmss");
public static String generateMonthname(){
return YEAR_MONTH_FORMAT.format(new Date());
}
public static String generateFilename(String path,String ext){
return path + MONTH_FORMAT.format(new Date()) + RandomStringUtils.random(4, N36_CHARS) + "." + ext;
}
public static String generateByFilename(String path,String filename,String ext){
return path + filename +"."+ ext;
}
public static final Pattern ILLEGAL_CURRENT_FOLDER_PATTERN = Pattern.compile("^[^/]|[^/]$|/\\.{1,2}|\\\\|\\||:|\\?|\\*|\"|<|>|\\p{Cntrl}");
public static String sanitizeFileName(final String filename) {
if (StringUtils.isBlank(filename))
return filename;
String name = forceSingleExtension(filename);
// Remove \ / | : ? * " < > 'Control Chars' with _
return name.replaceAll("\\\\|/|\\||:|\\?|\\*|\"|<|>|\\p{Cntrl}", "_");
}
public static String sanitizeFolderName(final String folderName) {
if (StringUtils.isBlank(folderName))
return folderName;
// Remove . \ / | : ? * " < > 'Control Chars' with _
return folderName.replaceAll(
"\\.|\\\\|/|\\||:|\\?|\\*|\"|<|>|\\p{Cntrl}", "_");
}
public static boolean isValidPath(final String path) {
if (StringUtils.isBlank(path))
return false;
if (ILLEGAL_CURRENT_FOLDER_PATTERN.matcher(path).find())
return false;
return true;
}
public static String forceSingleExtension(final String filename) {
return filename.replaceAll("\\.(?![^.]+$)", "_");
}
public static boolean isSingleExtension(final String filename) {
return filename.matches("[^\\.]+\\.[^\\.]+");
}
public static void checkDirAndCreate(File dir) {
if (!dir.exists())
dir.mkdirs();
}
public static File getUniqueFile(final File file) {
if (!file.exists())
return file;
File tmpFile = new File(file.getAbsolutePath());
File parentDir = tmpFile.getParentFile();
int count = 1;
String extension = FilenameUtils.getExtension(tmpFile.getName());
String baseName = FilenameUtils.getBaseName(tmpFile.getName());
do {
tmpFile = new File(parentDir, baseName + "(" + count++ + ")."
+ extension);
} while (tmpFile.exists());
return tmpFile;
}
public static void main(String[] args) {
System.out.println(generateFilename("/base", "gif"));
}
}
| [
"346670256@qq.com"
] | 346670256@qq.com |
6d2f3c717273cd39239f723d23978bf1f2fc0846 | f062adbceda4a296ee6750fcab727db733bb6a09 | /src/main/java/com/ynyes/ganzhi/service/TdManagerService.java | 97292701d1340be99d41be7c08dcbefed2d48161 | [] | no_license | Max3215/ganzhi | eba03755973bd27e17dedc64a85f57f7d015f072 | 501fc19078f1df74b599cd24845991bfa748c007 | refs/heads/master | 2020-04-27T10:25:40.713008 | 2019-03-07T02:15:17 | 2019-03-07T02:15:17 | 174,253,225 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,864 | java | package com.ynyes.ganzhi.service;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ynyes.ganzhi.entity.TdManager;
import com.ynyes.ganzhi.repository.TdManagerRepo;
/**
* TdManager 服务类
*
* @author Sharon
*
*/
@Service
@Transactional
public class TdManagerService {
@Autowired
TdManagerRepo repository;
/**
* 删除
*
* @param id 菜单项ID
*/
public void delete(Long id)
{
if (null != id)
{
repository.delete(id);
}
}
/**
* 删除
*
* @param e 菜单项
*/
public void delete(TdManager e)
{
if (null != e)
{
repository.delete(e);
}
}
public void delete(List<TdManager> entities)
{
if (null != entities)
{
repository.delete(entities);
}
}
/**
* 查找
*
* @param id ID
* @return
*/
public TdManager findOne(Long id)
{
if (null == id)
{
return null;
}
return repository.findOne(id);
}
public TdManager findByUsernameAndIsEnableTrue(String username)
{
if (null == username)
{
return null;
}
return repository.findByUsernameAndIsEnableTrue(username);
}
/**
* 查找
*
* @param ids
* @return
*/
public List<TdManager> findAll(Iterable<Long> ids)
{
return (List<TdManager>) repository.findAll(ids);
}
public List<TdManager> findAll()
{
return (List<TdManager>) repository.findAll();
}
public Page<TdManager> findAllOrderBySortIdAsc(int page, int size)
{
PageRequest pageRequest = new PageRequest(page, size, new Sort(Direction.ASC, "sortId"));
return repository.findAll(pageRequest);
}
public List<TdManager> findAllOrderBySortIdAsc()
{
return (List<TdManager>) repository.findAll(new Sort(Direction.ASC, "sortId"));
}
/**
* 保存
*
* @param e
* @return
*/
public TdManager save(TdManager e)
{
if (null == e.getCreateTime())
{
e.setCreateTime(new Date());
}
return repository.save(e);
}
public List<TdManager> save(List<TdManager> entities)
{
return (List<TdManager>) repository.save(entities);
}
}
| [
"981829761@qq.com"
] | 981829761@qq.com |
c562e2bcc7595aa9ecc28c69b54319fa30d51a8e | 07f244649472da93d38c91e8c50ee589e423b7a2 | /hht-entrance-service/src/main/java/com/honghe/entrance/controller/EntranceController.java | 97bc38922b25957e76851f8bb786697b63ab8f13 | [] | no_license | shisibihua/entrance | 39f81a917c83d2a2324208b63f54f590a78886af | d21abfc344c75049b4379d301c06b1e42aa253d0 | refs/heads/master | 2020-05-17T22:44:44.851005 | 2019-04-29T06:30:41 | 2019-04-29T06:30:41 | 184,011,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,880 | java | package com.honghe.entrance.controller;
import com.alibaba.fastjson.JSONArray;
import com.honghe.entrance.common.pojo.model.Result;
import com.honghe.entrance.common.util.DateUtil;
import com.honghe.entrance.common.util.ParamUtil;
import com.honghe.entrance.hitecloud.DataSynchronizationService;
import com.honghe.entrance.service.*;
import com.honghe.entrance.servicemanager.ServiceAnnotation;
import com.honghe.entrance.servicemanager.ServiceManager;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;
/**
* 入口服务控制层
* @author caoqian
* @date 20190221
*/
@CrossOrigin
@RestController("entranceCommand")
@ServiceAnnotation(ServiceName = "entrance")
public class EntranceController {
@Autowired
private EntranceConfigService entranceConfigService;
@Autowired
private UserService userService;
@Autowired
private AreaService areaService;
@Autowired
private DeviceService deviceService;
@Autowired
private DataSynchronizationService dataSynchronizationService;
@Autowired
private SysModuleService sysModuleService;
@Autowired
private OrganizationService organizationService;
@Autowired
private RoleService roleService;
/**
* 统一分发接口
* @param request
* @return
* @author caoqian
*/
@RequestMapping(value = "service/cloud/httpCommandService")
public Result execute(HttpServletRequest request){
Map requestMap = ParamUtil.getParams(request);
return ServiceManager.getInstance().execute(requestMap);
}
/**
* 查询验证配置
* author caoqian
*/
public Result searchEntranceConfig(){
return entranceConfigService.getEntranceConfig();
}
/**
* 导入用户信息
* @param fileName 文件名
* author caoqian
*/
public Result initUsers(String fileName){
return userService.importUsers(fileName);
}
/**
* 导入地点信息
* @param fileName 文件名
* author caoqian
*/
public Result initAreas(String fileName){
return areaService.importAreas(fileName);
}
/**
* 导入设备信息(调用集控设备导入接口)
* @param fileName 文件名
* author caoqian
*/
public Result initDevices(String fileName) throws IOException{
return deviceService.uploadFile(fileName);
}
/**
* 登录接口
* @param loginName 用户名
* @param userPwd 密码
* @param userCode 手机验证码
* @author caoqian
*/
public Result userCheck(String loginName, String userPwd ,String userCode){
return userService.userCheck(loginName,userPwd,userCode);
}
/**
* 验证用户是否是首次登录
* true:首次登录,需要手机验证码验证;false:已绑定到爱学
* @param loginName 用户名
* @author caoqian
* @return
*/
public Result checkUserIsFirstLogin(String loginName){
return userService.checkUserIsFirstLoginByName(loginName);
}
/**
* 根据用户名验证是否修改过密码 true:已重置过密码;false:未重置密码
* @param loginName 用户名
* @return
*/
public Result checkUserIsUpdatePwd(String loginName){
return userService.checkUserIsUpdatePwd(loginName);
}
/**
* 根据手机号获取爱学班班验证码
* @param mobile 手机号
* @author caoqian
* @return
*/
public Result getMobileCode(String mobile){
Result result=new Result(Result.Code.Success.value());
result.setResult(dataSynchronizationService.sendMobileCode(mobile));
return result;
}
/**
* 根据用户id查询用户信息
* @param userId 用户id
* @return
*/
public Result userSearch(String userId) {
return userService.userSearch(userId);
}
/**
* 修改用户信息
* @param userId 用户id
* @param userRealName 用户真实名称
* @param userName 用户名
* @param userType 用户类型
* @param userMobile 手机号
* @param userRemark 备注
* @author caoqian
* @return
*/
public Result userUpdate(String userId, String userRealName, String userName,String userType, String userMobile,
String userRemark) {
return userService.userUpdate(userId,userRealName,userName,userType,userMobile,userRemark);
}
/**
* 添加用户信息
*
* @param userName 用户名
* @param userRealName 真实姓名
* @param userMobile 手机号
* @param userType 用户类型:老师;管理员
* @param remark 备注
* @return 用户Id
*/
public Result userAdd(String userName,String userRealName, String userMobile,String userType,String remark){
Map<String,Object> resultMap=userService.userAdd(userName,userRealName, userMobile, userType,remark);
Result result=new Result(Result.Code.Success.value());
if(resultMap.containsKey("addUserId")){
result.setResult(Long.parseLong(String.valueOf(resultMap.get("addUserId"))));
}else{
result.setResult(0);
}
return result;
}
/**
* 删除用户,支持批量用户
* @param userId 用户id,多个","连接,如1,2,3
* @return boolean 是否成功
* @author caoqian
*/
public Result userDelete(String userId){
return userService.userDelete(userId);
}
/**
* 修改密码
*
* @param userId
* @param oldPassword
* @param newPassword
* @return
*/
public Result userChangePassword(String userId, String oldPassword, String newPassword){
return userService.userChangePassword(userId, oldPassword, newPassword);
}
/**
* 分页查询用户列表
* @param pageSize 页大小
* @param pageCount 第几页
* @param userType 用户类型
* @param searchKey 查询关键字
* @param userId 用户id
* @author caoqian
*/
public Result userList(String pageSize, String pageCount , String userType,String searchKey,String userId){
return userService.userList(Integer.parseInt(pageSize), Integer.parseInt(pageCount) , userType, searchKey,userId);
}
/**
* 导入用户信息
* @param fileName 文件名
* @return
* @author caoqian
*/
public Result importUsers(String fileName){
return userService.importUsers(fileName);
}
/**
* 导出用户信息
* @param userId 用户id
* @param userType 用户类型
* @param searchKey 关键字
* @return
* @author caoqian
*/
public Result exportUsers(String userId,String userType,String searchKey){
return userService.exportUsers(userId,userType,searchKey);
}
/**
* 根据userToken获取用户Id(单点登录使用)
*
* @param userToken 用户令牌
* @return
* @author caoqian
*/
public Result userInfoByToken(String userToken){
return userService.searchUserInfoByToken(userToken);
}
/**
* 入口服务心跳接口
* @return
* @author caoqian
*/
public Result keep_alive() {
return userService.keepAlive();
}
/**
* 添加爱学用户时,根据手机号拉取爱学班班用户信息
* @param userMobile 手机号
* @author caoqian
* @return
*/
public Result getUserByMobile(String userMobile){
if(StringUtils.isEmpty(userMobile)){
return new Result(Result.Code.ParamError.value(),"根据手机号拉取用户失败");
}
Result result=new Result(Result.Code.Success.value());
result.setResult(userService.getHiteCloudUserByMobile(userMobile));
return result;
}
/**
* 重置密码
* @param userId 用户id
* @author caoqian
* @return
*/
public Result resetPwd(String userId){
return userService.resetPwd(userId);
}
/**
* 更新角色的权限
*
* @param roleId
* @param authorityIds
* @return
* @update by hwx20190223
*/
public Result updatePermission(String roleId,String authorityIds){
return roleService.updatePermission(roleId,authorityIds);
}
/**
* 获取所有带标记的模块权限
* @param roleId 角色Id
* @param ip 浏览器ip
* @return com.honghe.entrance.entity.sysModule.Permissions
* @Create Wangzy 2018/8/3 10:53
* @Update Wangzy 2018/8/3 10:53
*/
public Result getMarkedPermissions(String roleId,String ip){
return sysModuleService.getMarkedModules(roleId,ip);
}
/**
* 获取用户有权限的模块信息
* @param userId 用户id
* @param searchKey 查询key
* @param status 模块状态0 禁用 1启用 不填所有
* @param ip
* @return java.util.List<com.honghe.entrance.entity.sysModule.UserSysPosition>
* @Create Wangzy 2018/8/4 11:30
* @Update caoqian 2018/12/4
*/
public Result sysGetAllEnableModule(String userId, String searchKey, String status, String ip){
return sysModuleService.sysGetEnableModule(userId, searchKey, status,ip);
}
/**
* 删除模块
* @param userId 用户id
* @param moduleIds 模块id以,分割
* @return
*/
public Result deleteSysModules(String userId, String moduleIds){
return sysModuleService.deleteSysModules(userId, moduleIds);
}
/**
* 添加模块及用户与模块对应关系
* @param moduleStr 模块信息字符串
* @return
*/
public Result sysAddModulePositionInfo(String moduleStr){
return sysModuleService.addUserSysModules(moduleStr);
}
/**
* 获取新增的模块id
* @author caoqian
* @return
*/
public Result getMaxModuleId(){
return sysModuleService.getMaxModuleId();
}
/**
* 移动模块时修改布局
* @param moduleStr 用户id
* @author caiqian
* @date 20190108
* @return
*/
public Result updateModulePosition(String moduleStr){
return sysModuleService.updateModulePosition(moduleStr);
}
/**
* 更新模块状态
* @param userSysModuleIds 模块id
* @param status 模块状态
* @return
* @author caoqian
* @date 20190227
*/
public Result updateModuleStatus(String userSysModuleIds, String status){
return sysModuleService.updateModuleStatus(userSysModuleIds, status);
}
/**
* 更新模块及用户与模块对应关系 单个json(临时)
** @param moduleStr 用户id
* @return
* @author caoqian
* @date 20190227
*/
public Result sysSetModulePositionInfoSolo(String moduleStr){
return sysModuleService.updateUserSysSoloModules(moduleStr);
}
/**
* 主题设置
*
* @param user_id
* @param themeTitle
* @param themeEnTitle
* @param themeLogo
* @param themeLoginBackGround
* @param themeBackGround
* @return
* @author caoqian
*/
public Result themeSet(String user_id, String themeTitle, String themeEnTitle, String themeLogo,
String themeLoginBackGround, String themeBackGround){
return sysModuleService.themeSet(user_id, themeTitle, themeEnTitle, themeLogo, themeLoginBackGround, themeBackGround);
}
/**
* 恢复入口背景、logo初始化设置
* @return
* @author caoqian
* @date 20190121
*/
public Result resetTheme(){
return sysModuleService.resetTheme();
}
/**
* 获取当前主题数据
* @ip ip地址
* @update caoqian
* @date 20190228
*/
public Result getCurrentThem(String ip){
return sysModuleService.getCurrentTheme(ip);
}
/**
* 添加根节点组织机构
* @param orgName 学校名称
* @param orgName 学校code码
* @return
* @author caoqian
*/
public Result addRootOrg(String orgName,String code){
return organizationService.saveRootOrg(orgName,code);
}
/**
* 查询地区
* @param parentId 父级id
* @param level 级别,1:省;2:市;3:区/县;
* @return
* @author caoqian
*/
public Result searchArea(String parentId, String level){
JSONArray area = dataSynchronizationService.searchArea(Integer.parseInt(parentId),Integer.parseInt(level));
Result result=new Result(Result.Code.Success.value());
result.setResult(area);
return result;
}
/**
* 查询学校列表
* @param areaId 地区id
* @param schoolName 学校名,关键字,非必需
* @return
*/
public Result searchSchools(String areaId, String schoolName){
JSONArray area = dataSynchronizationService.searchSchools(Integer.parseInt(areaId),schoolName);
Result result=new Result(Result.Code.Success.value());
result.setResult(area);
return result;
}
/**
* 删除根目录组织机构
* @return
* @author caoqian
*/
public Result deleteRootOrg(){
return organizationService.deleteRootOrg();
}
public Result clearRedis(String token){
return userService.clearRedis(token);
}
}
| [
"820466903@qq.com"
] | 820466903@qq.com |
fe5a795a41ddc664facbab46c5bb6ca47478fdc2 | 8d05dd96f90cc9b97b25df55cb18041c18504071 | /lab12/Search.java | 49d3838b88838902ab507eb3c95a5c87cd82173c | [] | no_license | Liliia111/Java_- | 62ee94f0a460404c0ed4f42fc5ed0d26df52c61e | 715df9da38539919a62f65c387531cee3708e245 | refs/heads/master | 2018-07-11T10:21:26.462544 | 2018-06-01T08:16:30 | 2018-06-01T08:16:30 | 124,911,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,100 | java | package ua.lpnuai.oop.ryvak11;
import java.util.LinkedList;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Search {
private LinkedC<FilmInfo> conteiner;// films
private Map<Integer,LinkedC<FilmInfo>> mapOfData;//films
public Search(LinkedC<FilmInfo> conteiner) {
this.conteiner = conteiner;
}
public boolean find(String regex) {
Data data = new Data(conteiner);
mapOfData = data.createDataMap();
for (Map.Entry<Integer, LinkedC<FilmInfo>> entry : mapOfData.entrySet()) {
LinkedC<FilmInfo> films = entry.getValue();
LinkedList<String> list1 = films.get(0).getMDemandsfilm().getfdirector();
LinkedList<String> list2 = films.get(1).getMDemandsfilm().getfdirector();
if (specialFinder(list1, regex, parseRegex(regex)) && specialFinder(list2, regex, parseRegex(regex)))
printSpecClient(films);
}
return true;
}
private void printSpecClient(LinkedC<FilmInfo> films) {
System.out.println(" Фільми з однаковим режисером ");
ConsoleWork work = new ConsoleWork();
for (FilmInfo film : films) {
work.printFilm(film);
}
System.out.println();
}
private boolean specialFinder(LinkedList<String> list, String PATTERN, LinkedList<LinkedList<String>> specialKeys) {
Pattern pattern = Pattern.compile(PATTERN);
for (String data : list) {
Matcher matcher = pattern.matcher(data);
if (matcher.find())
return true;
}
return deepSearching(list, specialKeys);
}
private boolean deepSearching(LinkedList<String> list, LinkedList<LinkedList<String>> specialKeys) {
int numberOfWord[] = new int[specialKeys.size()];
int sum = 0;
for (String text : list) {
String arraOfWords[] = text.split(" ");
for (int n : numberOfWord)
sum += n;
if (sum >= specialKeys.size()) {
for (int n : numberOfWord){
if (n == 0)
return false;
}
return true;
} else {
sum = 0;
numberOfWord = new int[specialKeys.size()];
}
for (String str : arraOfWords) {
StringBuilder word = new StringBuilder(str);
char ch = word.charAt(word.length() - 1);
if (ch == '.' || ch == ',' || ch == '!' || ch == '?') {
word.delete(word.length() - 1, word.length());
}
goThrow:
for (int i = 0; i < specialKeys.size(); i++) {
if (numberOfWord[i] != 0)
continue;
LinkedList<String> list1 = specialKeys.get(i);
if (list1.getLast().equals("?"))
numberOfWord[i]++;
for (String word2 : list1) {
if (word.toString().equals(word2)) {
numberOfWord[i]++;
break goThrow;
}
}
}
}
}
for (int n : numberOfWord)
sum += n;
if (sum >= specialKeys.size()) {
for (int n : numberOfWord){
if (n == 0)
return false;
}
return true;
}
return false;
}
private LinkedList<LinkedList<String>> parseRegex(String regex) {
LinkedList<LinkedList<String>> list = new LinkedList<>();
LinkedList<String> listOfString = new LinkedList<>();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < regex.length(); i++) {
char ch = regex.charAt(i);
if (ch == '|') {
listOfString.add(builder.toString());
builder.delete(0, builder.length());
} else if (ch == '?') {
listOfString = list.get(list.size() - 1);
listOfString.add("?");
listOfString = new LinkedList<>();
} else if (ch != '(' && ch != ')' && ch != ' ') {
builder.append(ch);
} else {
if (!builder.toString().isEmpty()) {
listOfString.add(builder.toString());
list.add(listOfString);
listOfString = new LinkedList<>();
}
builder.delete(0, builder.length());
}
}
return list;
}
} | [
"noreply@github.com"
] | noreply@github.com |
3a8ca64bafed9212bb8885143dd65badc5e6a61a | 010f1dc51544cae060a28b5292b4e5c16704b111 | /Joc BraveBots/TheGameOfTheRobot.java | 44556717d7af172d873b71fb73d5592e489cb221 | [
"MIT"
] | permissive | AntoniuMerla/BraveBots | 9c68240c8b559a09be54a7cc5175f20f0a181ee8 | 7b5109229decd7086a01e9a226f1811573b93484 | refs/heads/master | 2022-06-08T01:06:13.631772 | 2020-05-03T15:27:11 | 2020-05-03T15:27:11 | 260,858,332 | 1 | 0 | MIT | 2020-05-03T15:23:23 | 2020-05-03T08:20:45 | Java | UTF-8 | Java | false | false | 7,444 | java | import greenfoot.*;
import java.util.*;
import java.io.*;
import java.net.URL;
public class TheGameOfTheRobot extends World
{
Platform Platform = new Platform();
Base Base= new Base();
Chassis Chassis= new Chassis();
Wheel W[]={new Wheel(-50),new Wheel(50)};
Arm Arm = new Arm();
ArmWheel AW= new ArmWheel();
FirstArmWheel FAW = new FirstArmWheel();
Claw Claw = new Claw();
ReferenceForYB RFYB = new ReferenceForYB();
CurrentScore CS=new CurrentScore();
boolean alive = true;
Noice1 N1=new Noice1();
Noice2 N2=new Noice2();
int attack_time=0;
TheArmor TheArmor=new TheArmor();
//private BraveBotsRoboticsClub BBRC;
public TheGameOfTheRobot(/*BraveBotsRoboticsClub BBC*/)
{
super(1300, 800, 1);
GreenfootImage bg = new GreenfootImage("audience.jpg");
bg.scale(getWidth()+220,getHeight()+80);
setBackground(bg);
//Greenfoot.start();
addObject(N1,50,50);
addObject(N2,1250,50);
addObject(Platform,getWidth()/2,750);
addObject(Base,getWidth()/2,630);
addObject(Claw,getWidth()/2-30,613);
addObject(Arm,getWidth()/2+45,620);
try
{
URL path = getClass().getClassLoader().getResource("BoughtArmor.txt");
InputStream stream=path.openStream();
BufferedReader input=new BufferedReader(new InputStreamReader(stream));
ba=Integer.parseInt(input.readLine());
input.close();
}catch (Exception e) {}
if(ba==2)
addObject(TheArmor,getWidth()/2+60,605);
addObject(Chassis,getWidth()/2,660);
addObject(W[0],getWidth()/2-50,720);
addObject(W[1],getWidth()/2+50,720);
addObject(AW,getWidth()/2+50,613);
addObject(FAW,getWidth()/2+57,607);
addObject(RFYB,getWidth()/2-244,600);
addObject(CS,getWidth()/2,50);
//BBRC=BBC;
}
public int bds=0;
public int bg=0;
public int ds_used=0;
public int g_used=0;
public int ba=0;
public void Read()
{
try
{
URL path = getClass().getClassLoader().getResource("BoughtDS.txt");
InputStream stream=path.openStream();
BufferedReader input=new BufferedReader(new InputStreamReader(stream));
bds=Integer.parseInt(input.readLine());
input.close();
}catch (Exception e) {}
try
{
URL path = getClass().getClassLoader().getResource("BoughtGelu.txt");
InputStream stream=path.openStream();
BufferedReader input=new BufferedReader(new InputStreamReader(stream));
bg=Integer.parseInt(input.readLine());
input.close();
}catch (Exception e) {}
}
public void act()
{
Read();
setPaintOrder(Resource.class,Playground.class);
setPaintOrder(Robot.class,Tower.class);
setPaintOrder(GameOver.class,KBoom.class);
setPaintOrder(BackButtonText.class,Resource.class,Noice1.class);
setPaintOrder(BackButtonText.class,Resource.class,Noice2.class);
// setPaintOrder(FirstArmWheel.class,TheArmor.class);
//setPaintOrder(ArmWheel.class,TheArmor.class);
//setPaintOrder(Noice1.class,YellowBrick.class);
//setPaintOrder(Noice2.class,YellowBrick.class);
yeeted();
if(alive)
{
legos();
spawn();
fire();
if(attack_time%200==0) fight();
attack_time++;
} else attack_time=0;
}
int time = 8000;
int pause = 500;
int nooflegos=0;
int noofrb=0;
YellowBrick YB[]={new YellowBrick(),new YellowBrick(),new YellowBrick(),new YellowBrick(),new YellowBrick()};
RedBeam RB[]={new RedBeam(),new RedBeam(),new RedBeam(),new RedBeam(),new RedBeam()};
public void legos()
{
int i,j;
check();
if(time==0) time = 8000;
else
{
check();
if(time%1013==0&&pause>100) pause--;
check();
if(time%pause==0)
{
if(nooflegos==5) nooflegos=0;
check();
addObject(YB[nooflegos],300+Greenfoot.getRandomNumber(700),50);
check();
//here[nooflegos]=true;
check();
nooflegos++;
check();
}
time--;
check();
}
}
public void check()
{
List <YellowBrick> YBL=getObjects(YellowBrick.class);
int i;
for(i=0; i<YBL.size(); i++)
{
if(YBL.get(i).getY()==360)
{
addObject(RB[i],YBL.get(i).getX(),800);
}
}
}
int time_respawn = 7999;
boolean stright=false;
boolean stleft=false;
StormTrooper ST = new StormTrooper();
StormTrooper2 ST2= new StormTrooper2();
public void spawn()
{
if(time_respawn%1000==0&&!stright)
{
addObject(ST,1300,540);
stright=true;
}
if((time_respawn-500)%1000==0&&!stleft)
{
addObject(ST2,0,540);
stleft=true;
}
time_respawn--;
if(time_respawn==-1) time_respawn=7999;
if(getObjects(StormTrooper.class).size()==0) stright=false;
if(getObjects(StormTrooper2.class).size()==0) stleft=false;
}
int timef[]={8313,8000};
int pausef[]={500,500};
GreenBeam GB= new GreenBeam(100);
GreenBeam2 GB2= new GreenBeam2(100);
public void fire()
{
if(stright)
{
if(timef[0]==313) timef[0]=8313;
else
{
if(timef[0]%1013==0&&pausef[0]>100) pausef[0]--;
if(timef[0]%pausef[0]==0)
{
addObject(GB,1050,525); //505
}
timef[0]--;
}
if(getObjects(GreenBeam.class).size()==0) GB=new GreenBeam(100);
}
if(stleft)
{
if(timef[1]==0) timef[1]=8000;
else
{
if(timef[1]%1013==0&&pausef[1]>100) pausef[1]--;
if(timef[1]%pausef[1]==0)
{
addObject(GB2,175,525); //505
}
timef[1]--;
}
if(getObjects(GreenBeam2.class).size()==0) GB2=new GreenBeam2(100);
}
}
public void yeeted()
{
if(getObjects(GameOver.class).size()!=0)
{
alive=false;
if(Greenfoot.isKeyDown("M")) {Greenfoot.setWorld(new BraveBotsRoboticsClub());/*Greenfoot.setWorld(BBRC);*/ alive=true;}
if(Greenfoot.isKeyDown("Enter")) {Greenfoot.setWorld(new TheGameOfTheRobot());/*Greenfoot.setWorld(new TheGameOfTheRobot(BBRC));*/ alive=true;}
}
}
public void fight()
{
if(getObjects(StormTrooper.class).size()!=0&&getObjects(StormTrooper2.class).size()!=0)
{if(Greenfoot.isKeyDown("1")&&bg==1&&g_used<=1) {addObject(new Gelu(),50,0); g_used++;}
if(Greenfoot.isKeyDown("2")&&bds==1&&ds_used==0) {addObject(new Dinu_s_Sword(),1200,0); ds_used++; }}
}
}
| [
"64725704+AntoniuMerla@users.noreply.github.com"
] | 64725704+AntoniuMerla@users.noreply.github.com |
06770928ca38c6e95afc57cc0e81f5f9e9080dab | 6c8c16e211253bdef38a57e19314661acf9c4dc9 | /SouGongCheng/src/com/sougongcheng/ui/widget/TextWatcherAdapter.java | 941baf8c23175014e7ce68cc514afbc87e6fc3c1 | [] | no_license | zhang71896/sougongcheng | e1083e47557d6cbc0df5eaba84576cca36921faa | 8fe349e81c5fa194e740900298639a143bed1ba9 | refs/heads/master | 2021-01-25T10:21:50.449533 | 2015-07-13T03:26:08 | 2015-07-13T03:26:08 | 39,544,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package com.sougongcheng.ui.widget;
import android.text.Editable;
import android.text.TextWatcher;
public class TextWatcherAdapter implements TextWatcher {
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
}
| [
"365114157@qq.com"
] | 365114157@qq.com |
67cbdb16bdcc9cfcda0a37672801224420108971 | bade84d62e5e133487ecd8a2b82271e96e8f57af | /src/com/proxy/kiwi/core/utils/FileListener.java | cc9677a44c07ebf1b44e6e320fad3afa54183ac5 | [] | no_license | 12yuens2/kiwi | 58480fb1041f358d8c4cc29550e6eed777921650 | 49210e1f3425debb4424cb31d9429432a67257df | refs/heads/master | 2021-04-28T08:19:56.876185 | 2018-02-20T19:42:08 | 2018-02-20T19:42:08 | 122,246,428 | 0 | 0 | null | 2018-02-20T19:38:10 | 2018-02-20T19:38:01 | Java | UTF-8 | Java | false | false | 760 | java | package com.proxy.kiwi.core.utils;
import java.io.File;
public class FileListener {
private long lastModified;
public static FileListener create(String path, Runnable onChange) {
return new FileListener(path, onChange);
}
public FileListener(String path, Runnable onChange) {
this.lastModified = new File(path).lastModified();
new Thread( ()-> {
while (true) {
try {
Thread.sleep(1000);
File file = new File(path);
long newTime = file.lastModified();
if (newTime > lastModified) {
onChange.run();
this.lastModified = newTime;
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).start();
}
}
| [
"daniel.koudouna@gmail.com"
] | daniel.koudouna@gmail.com |
14ee37cd57b314f26d496d37f0305ab5ad7ad050 | a5bd73d042c54c40484902e9bf9b50286403eab9 | /src/main/java/org/terasology/manualLabor/components/MetalSubstanceComponent.java | ad10199f49e3c9c9e225e9100189e83176392aac | [] | no_license | ktksan/ManualLabor | c72ce9462ddf665037c3d0855f3aeb53dad4e10d | 1816f12cdf68ec45a7c1976bad485d66463734fa | refs/heads/master | 2021-05-21T19:11:34.484214 | 2020-04-12T15:38:19 | 2020-04-12T15:38:19 | 252,765,728 | 0 | 0 | null | 2020-04-03T15:06:50 | 2020-04-03T15:06:50 | null | UTF-8 | Java | false | false | 754 | java | /*
* Copyright 2015 MovingBlocks
*
* 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.terasology.manualLabor.components;
import org.terasology.entitySystem.Component;
public class MetalSubstanceComponent implements Component {
}
| [
"josh.owie@gmail.com"
] | josh.owie@gmail.com |
33c46304ec5856f52803bdfc1ab415709300d288 | 374ea56b0cdea93872a59db08333de523ee85d00 | /src/java/java/servlets/UserServlet.java | 9b1ad02c711d0284c7837082b5291d5a6d9ad4de | [] | no_license | binzhangsait/Week10Lab_Ajax | 5c7b739736b09a74f3c4769ce5427b173c01ffe5 | 15781dfc8f89bd5d521c7c3c207e3728b55b7e4e | refs/heads/master | 2022-04-27T07:06:39.085617 | 2020-04-16T19:39:39 | 2020-04-16T19:39:39 | 256,312,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,877 | java | package servlets;
import com.google.gson.Gson;
import services.UserService;
import models.User;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import viewmodels.UserViewModel;
public class UserServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
boolean ajax = "XMLHttpRequest".equals(request.getHeader("X-Requested-With"));
if (ajax) {
System.out.println("AJAX Request! (UserServlet.doGet)");
}
UserService us = new UserService();
String action = request.getParameter("action");
if (action != null && action.equals("view")) {
String selectedUsername = request.getParameter("selectedUsername");
try {
User user = us.get(selectedUsername);
if (ajax) {
Gson gson = new Gson();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
UserViewModel userVM = new UserViewModel(user);
String str = gson.toJson(userVM);
response.getWriter().write(str);
return;
}
request.setAttribute("selectedUser", user);
} catch (Exception ex) {
Logger.getLogger(UserServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
List<User> users = null;
try {
users = us.getAll();
} catch (Exception ex) {
Logger.getLogger(UserServlet.class.getName()).log(Level.SEVERE, null, ex);
}
request.setAttribute("users", users);
getServletContext().getRequestDispatcher("/WEB-INF/users.jsp").forward(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
boolean ajax = "XMLHttpRequest".equals(request.getHeader("X-Requested-With"));
if (ajax) {
System.out.println("AJAX Request! (UserServlet.doPost)");
}
String action = request.getParameter("action");
String username = request.getParameter("username");
String password = request.getParameter("password");
String firstname = request.getParameter("firstname");
String lastname = request.getParameter("lastname");
String email = request.getParameter("email");
UserService us = new UserService();
try {
if (action.equals("delete")) {
String selectedUsername = request.getParameter("selectedUsername");
us.delete(selectedUsername);
} else if (action.equals("edit")) {
us.update(username, password, firstname, lastname, email);
} else if (action.equals("add")) {
us.insert(username, password, firstname, lastname, email);
}
} catch (Exception ex) {
request.setAttribute("errorMessage", "Whoops. Could not perform that action.");
}
List<User> users = null;
try {
users = us.getAll();
} catch (Exception ex) {
Logger.getLogger(UserServlet.class.getName()).log(Level.SEVERE, null, ex);
}
request.setAttribute("users", users);
getServletContext().getRequestDispatcher("/WEB-INF/users.jsp").forward(request, response);
}
}
| [
"binzhangab@gmail.com"
] | binzhangab@gmail.com |
bf9cb6222e6fbc28870a7acfe07281e90cd517e8 | 7bedee9aa5138c7efd939da14d07d61996e30438 | /data/tdm/client/src/main/generated/restclient/com/catenax/tdm/api/v1/auth/Authentication.java | 0c0d086e6474ed77f883ecb5cf01aabe0b915054 | [
"Apache-2.0"
] | permissive | sn0wcat/tractusx | 24d8f230d5ddda0e806a4d4451eb1416b9983ebf | 1f584a2439d1d0a38438b6ab1c0197d871c35e5e | refs/heads/main | 2023-08-29T00:47:09.516258 | 2021-10-25T07:16:55 | 2021-10-25T07:16:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package com.catenax.tdm.api.v1.auth;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
public interface Authentication {
/**
* Apply authentication settings to header and / or query parameters.
* @param queryParams The query parameters for the request
* @param headerParams The header parameters for the request
*/
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams);
}
| [
"noreply@github.com"
] | noreply@github.com |
4355035b388b4e554a569c50e7b2829eb41a81c4 | e52c8053da7df971a3b2333684039d838914974f | /DesignModel/DelegateAndStrategy/Order.java | bbfdf573d2d4c02ef96d02eca542ce5e082c9e2e | [] | no_license | Alex2019Github/MyCode | 5093cf0e01a4735a41110daaadc82a4619095148 | 049e4b62075b6e062b04dba6ea924dd5ff94ac8e | refs/heads/master | 2020-04-27T23:55:47.694130 | 2019-03-24T09:14:45 | 2019-03-24T09:14:45 | 174,796,986 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 884 | java | package gupao_edu.part1.designModel.strategy;
public class Order {
private String uid;
private String oid;
private double amount;
public Order(String uid, String oid, double amount) {
super();
this.uid = uid;
this.oid = oid;
this.amount = amount;
}
public MsgResult payment(String key){
PayMode payMode = PayStrategy.getPayKey(key);
System.out.println("欢迎使用 [" + payMode.getName() + "]");
System.out.println("本次交易金额为: " + amount);
return payMode.pay(uid, amount);
}
public String getUid() {
return uid;
}
public String getOid() {
return oid;
}
public double getAmount() {
return amount;
}
public void setUid(String uid) {
this.uid = uid;
}
public void setOid(String oid) {
this.oid = oid;
}
public void setAmount(double amount) {
this.amount = amount;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
7753521bcd6613bb01b8fab46363294ac375f94f | 43517a0bb4cb11352ad019b2ad0150ef56de16f2 | /src/main/java/edu/pe/upeu/Paxi/modelo/Fecha.java | 23f0042121af7092e84348fb3fa6df6047e7d02c | [] | no_license | franspaxi/TrabajoNetbeans | 45185100f06928634d43861a0e18ae71a974d959 | 69be626fb43659f6f4f0f6dea4a9856bc0b3f7b9 | refs/heads/master | 2020-03-29T04:27:14.451218 | 2018-09-20T01:37:06 | 2018-09-20T01:37:06 | 149,532,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,154 | 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 edu.pe.upeu.Paxi.modelo;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author TOSHIBA
*/
@Entity
@Table(name = "fecha")
@NamedQueries({
@NamedQuery(name = "Fecha.findAll", query = "SELECT f FROM Fecha f")})
public class Fecha implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "idfecha")
@Getter @Setter
private Integer idfecha;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 30)
@Column(name = "fechainicio")
@Getter @Setter
private String fechainicio;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 30)
@Column(name = "fechafin")
@Getter @Setter
private String fechafin;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 30)
@Column(name = "costo")
@Getter @Setter
private String costo;
@JoinColumn(name = "idpersona", referencedColumnName = "idpersona")
@Getter @Setter
@ManyToOne(optional = false)
private Persona idpersona;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idfecha")
@Getter @Setter
private Collection<Total> totalCollection;
public Fecha() {
}
public Fecha(Integer idfecha) {
this.idfecha = idfecha;
}
public Fecha(Integer idfecha, String fechainicio, String fechafin, String costo) {
this.idfecha = idfecha;
this.fechainicio = fechainicio;
this.fechafin = fechafin;
this.costo = costo;
}
public Collection<Total> getTotalCollection() {
return totalCollection;
}
public void setTotalCollection(Collection<Total> totalCollection) {
this.totalCollection = totalCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (idfecha != null ? idfecha.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Fecha)) {
return false;
}
Fecha other = (Fecha) object;
if ((this.idfecha == null && other.idfecha != null) || (this.idfecha != null && !this.idfecha.equals(other.idfecha))) {
return false;
}
return true;
}
@Override
public String toString() {
return "" + idfecha ;
}
}
| [
"frans_adv@hotmail.com"
] | frans_adv@hotmail.com |
9eaebb0df5f176adf83764e7301ae23491f187b2 | 79c4b53d46b23f479fc847cc51c3f67b839d30f1 | /app/src/main/java/com/example/gargc/chatapp1/SectionsPagerAdapter.java | 41a15aae003824d052b29b7caa9768ac57fd1199 | [] | no_license | chinurox/ChatApp | bad9f535351f0e958be5aba2bfebfc7f6aefd90a | 8494b0b9efd20e2915eb2a61fe5d088267e2f19b | refs/heads/master | 2021-07-08T00:55:52.187197 | 2017-10-02T14:58:33 | 2017-10-02T14:58:33 | 101,186,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,253 | java | package com.example.gargc.chatapp1;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm)
{
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position){
case 0:
RequestsFragment requestsFragment=new RequestsFragment();
return requestsFragment;
case 1:
ChatsFragment chatsFragment=new ChatsFragment();
return chatsFragment;
case 2:
FriendsFragment friendsFragment=new FriendsFragment();
return friendsFragment;
default:
return null;
}
}
@Override
public int getCount() {
return 3;
}
public CharSequence getPageTitle(int position)
{
switch (position)
{
case 0:
return "REQUESTS";
case 1:
return "CHATS";
case 2:
return "FRIENDS";
default:
return null;
}
}
}
| [
"gargcheenu57@gmail.com"
] | gargcheenu57@gmail.com |
49a565b2515dc075af8eea66116e0e3fb738df86 | 2203f9e82de6157d337aae1fdffcbb11def70a62 | /pc2/src/main/java/edu/csus/ecs/pc2/ui/FrameUtilities.java | 88714d7ed9742e6d4a79b7a833d94c3c4b17d249 | [] | no_license | Kamo98/DIPLOM_NEW | c55b59ccd0610d4d2867619ca40c9fed0957a786 | 4434a43acedc44fc7b041214f66204a4936ffe6b | refs/heads/master | 2023-04-27T18:22:32.869058 | 2020-05-21T13:21:30 | 2020-05-21T13:21:30 | 265,855,486 | 0 | 0 | null | 2021-05-12T00:29:54 | 2020-05-21T13:27:35 | Java | UTF-8 | Java | false | false | 11,363 | java | package edu.csus.ecs.pc2.ui;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Rectangle;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.UIManager;
import edu.csus.ecs.pc2.VersionInfo;
import edu.csus.ecs.pc2.core.IInternalController;
import edu.csus.ecs.pc2.core.log.Log;
import edu.csus.ecs.pc2.core.model.IInternalContest;
/**
* Methods to center frame, change cursor, etc. <br>
* Contains method to change look and feel, set cursor state, center windows and a yes no dialog with cancel as default.
*
* @author pc2@ecs.csus
* @version $Id$
*/
// $HeadURL$
public final class FrameUtilities {
/**
*
* @author pc2@ecs.csus.edu
* @version $Id$
*/
public enum HorizontalPosition {
LEFT, RIGHT, CENTER, NO_CHANGE
};
/**
*
* @author pc2@ecs.csus.edu
* @version $Id$
*/
public enum VerticalPosition {
TOP, CENTER, BOTTOM, NO_CHANGE
}
private FrameUtilities() {
// Constructor required by CheckEclipse
}
/**
* Set Native Look and Feel.
*
*/
public static void setNativeLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
System.out.println("Error setting native LAF: " + e);
}
}
/**
* Set Java Look and Feel.
*
*/
public static void setJavaLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
System.out.println("Error setting native LAF: " + e);
}
}
/**
* Center this frame/component on the screen.
*
* @param component
*/
public static void centerFrame(Component component) {
java.awt.Dimension screenDim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
component.setLocation(screenDim.width / 2 - component.getSize().width / 2, screenDim.height / 2 - component.getSize().height / 2);
}
/**
* Center frame/component at top of screen.
*
* @param component
*/
public static void centerFrameTop(Component component) {
java.awt.Dimension screenDim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
component.setLocation(screenDim.width / 2 - component.getSize().width / 2, 20);
}
/**
*
* Center frame/component over a parentFrame. If parentFrame is null
* centers across screen. If the parent is smaller, match the x and/or y.
*
* @param parentFrame
* @param component
*/
public static void centerFrameOver(Component parentFrame, Component component) {
if (parentFrame == null) {
centerFrame(component);
} else {
Rectangle parentRect = parentFrame.getBounds();
Rectangle myRect = component.getBounds();
int x, y;
if (myRect.width > parentRect.width) {
x = parentRect.x;
} else {
x = (parentRect.width - myRect.width)/2 + parentRect.x;
}
if (myRect.height > parentRect.height) {
y = parentRect.y;
} else {
y = (parentRect.height - myRect.height)/2 + parentRect.y;
}
component.setBounds(x, y, myRect.width, myRect.height);
}
}
/**
* Center frame at top of screen.
*
* @param component
*/
public static void setFrameWindowWidth(Component component) {
java.awt.Dimension screenDim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
component.setSize(new Dimension(screenDim.width, component.getHeight()));
}
/**
* Display mouse Busy or Wait cusor (usually hourglass)
*
* @param component
*/
public static void waitCursor(Component component) {
component.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
}
/**
* Display mouse Default cursor (usually pointer)
*
* @param component
*/
public static void regularCursor(Component component) {
component.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
}
/**
* Puts this frame/component to right of input frame.
*
* @param sourceComponent
* component relative to otherComponent
* @param otherComponent
* component to be to the right of the sourceComponent
*/
public static void windowToRight(Component sourceComponent, Component otherComponent) {
int rightX = sourceComponent.getX() + sourceComponent.getWidth();
otherComponent.setLocation(rightX, otherComponent.getY());
}
/**
* Yes No Cancel dialog, default selection is Cancel.
*
* Unlike showConfirmDialog, this dialog defaults to Cancel.
*
* @see JOptionPane#showConfirmDialog(java.awt.Component, java.lang.Object, java.lang.String, int, int, javax.swing.Icon)
* @param title
* @param message
* @return the result
*/
public static int yesNoCancelDialog(Component parentFrame, String message, String title) {
if (message == null) {
throw new IllegalArgumentException("message is null");
}
Object[] options = { "Yes", "No", "Cancel" };
int result = JOptionPane.showOptionDialog(parentFrame, message, title, JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]);
return result;
}
/**
* Create this lovely window with full height of screen
*/
public static void centerFrameFullScreenHeight(Component component) {
java.awt.Dimension screenDim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
Dimension currDim = component.getSize();
int newHeight = screenDim.height - 120; // save some pixels on top and bottom
component.setSize(currDim.getSize().width, newHeight);
component.setLocation(screenDim.width / 2 - component.getSize().width / 2, screenDim.height / 2 - component.getSize().height / 2);
}
public static void setFramePosition(Component component, HorizontalPosition horizontalPosition, VerticalPosition verticalPosition) {
java.awt.Dimension screenDim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
int newX = component.getX();
int newY = component.getY();
if (verticalPosition == VerticalPosition.TOP){
newY = 20;
} else if (verticalPosition == VerticalPosition.BOTTOM){
newY = screenDim.height - component.getSize().height - 20;
} else if (verticalPosition == VerticalPosition.CENTER){
newY = screenDim.height / 2 - component.getSize().height / 2;
}
if (horizontalPosition == HorizontalPosition.LEFT) {
newX = 20;
} else if (horizontalPosition == HorizontalPosition.RIGHT) {
newX = screenDim.width - component.getSize().width - 20;
} else if (horizontalPosition == HorizontalPosition.CENTER) {
newX = screenDim.width / 2 - component.getSize().width / 2;
} // else no change
component.setLocation(newX, newY);
}
public static void showMessage(JFrame parentFrame, String strTitle, String displayString) {
final JDialog dialog = new JDialog(parentFrame, strTitle, true);
final JOptionPane optionPane = new JOptionPane(displayString, JOptionPane.INFORMATION_MESSAGE);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
optionPane.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
// If you were going to check something
// before closing the window, you'd do
// it here.
dialog.setVisible(false);
}
}
});
dialog.setContentPane(optionPane);
dialog.pack();
centerFrameOver(parentFrame, dialog);
dialog.setVisible(true);
}
/**
* Set a PC^2 Frame title.
*
* Form:
* PC^2 moduleName [clockstate] ver#-build#
* <br>
* Example: PC^2 Server (Site 1) [STOPPED] 9.1.4-1908 <br>
* PC^2 TEAM 1 (Site 1) [STARTED] 9.1.4-1908 <br>
*
* @param frame
* @param moduleName
* @param versionInfo
*/
public static void setFrameTitle(Frame frame, String moduleName, boolean clockStarted, VersionInfo versionInfo) {
String clockStateString = "STOPPED";
if (clockStarted) {
clockStateString = "RUNNING";
}
String versionNumber = versionInfo.getVersionNumber();
String[] parts = versionNumber.split(" ");
if (parts.length == 2) {
versionNumber = parts[0];
}
frame.setTitle("PC^2 " + moduleName + " [" + clockStateString + "] " + versionNumber + "-" + versionInfo.getBuildNumber());
}
/**
* Show message to user.
* @param component
* @param title
* @param message
*/
public static void showMessage(Component component, String title, String message) {
JOptionPane.showMessageDialog(component, message, title, JOptionPane.INFORMATION_MESSAGE);
}
/**
* Creates a frame with the input plugin.
*
* @param plugin
* @param contest
* @param controller
* @return
*/
public static JFramePlugin createPluginFrame(JPanePlugin plugin, IInternalContest contest, IInternalController controller) {
JFramePluginImpl frame = new JFramePluginImpl(plugin);
frame.setContestAndController(contest, controller);
return frame;
}
public static void viewFile(String filename, String title, Log log) {
MultipleFileViewer multipleFileViewer = new MultipleFileViewer(log);
multipleFileViewer.addFilePane(title, filename);
multipleFileViewer.setTitle("PC^2 View File (Build " + new VersionInfo().getBuildNumber() + ")");
FrameUtilities.centerFrameFullScreenHeight(multipleFileViewer);
multipleFileViewer.setVisible(true);
}
public static void updateRowHeights(JTable table) {
try {
for (int row = 0; row < table.getRowCount(); row++) {
int rowHeight = table.getRowHeight();
for (int column = 0; column < table.getColumnCount(); column++) {
Component comp = table.prepareRenderer(table.getCellRenderer(row, column), row, column);
rowHeight = Math.max(rowHeight, comp.getPreferredSize().height);
}
table.setRowHeight(row, rowHeight);
}
} catch (ClassCastException e) {
// ignore this exception
System.out.println("Ignore "+e.getMessage());
}
}
}
| [
"avanesjan.k@gmail.com"
] | avanesjan.k@gmail.com |
a7b440478fc30c5967a4df7d45e82989dcb9f065 | 39e4a330b2e6eb15b2747827d3c76faa39aece5d | /pivot-wtk/src/org/apache/pivot/wtk/skin/CalendarSkin.java | b11536840e638628a892522a18319a3652315d96 | [] | no_license | barchart/barchart-pivot | 4ae13ba3ccfcef5c210f4762f55cba457d4cfc34 | f901f3eae63a1fa94aa072c1e62127951545432e | refs/heads/master | 2023-07-05T00:40:05.424903 | 2021-10-04T22:12:15 | 2021-10-04T22:12:15 | 3,960,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,498 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.pivot.wtk.skin;
import org.apache.pivot.wtk.Calendar;
import org.apache.pivot.wtk.CalendarListener;
import org.apache.pivot.wtk.CalendarSelectionListener;
import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.skin.ContainerSkin;
/**
* Abstract base class for calendar skins.
*/
public abstract class CalendarSkin extends ContainerSkin
implements CalendarListener, CalendarSelectionListener {
@Override
public void install(Component component) {
super.install(component);
Calendar calendar = (Calendar)component;
calendar.getCalendarListeners().add(this);
calendar.getCalendarSelectionListeners().add(this);
}
}
| [
"Andrei.Pozolotin@gmail.com"
] | Andrei.Pozolotin@gmail.com |
a22d1be2f98e8b66f98f60af44411fa2a03362e3 | a7a715bb0052a9b1bd226150437fa09403ca3cad | /Klient/SqlCreate.java | 63e8532ba8d4f3c97e24d49a531d9c98b576db2a | [] | no_license | Arekaaa/KonsolowyCzatSieciowy | 263d850df2d0b6ec22e1c35769f6bbe9cd91109c | c95ce07f15af2b17515481d21c4d208466e9ed78 | refs/heads/master | 2022-08-28T02:29:39.906432 | 2020-05-29T17:41:47 | 2020-05-29T17:41:47 | 267,919,001 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class SqlCreate implements Runnable {
@Override
public void run() {
// TODO Auto-generated method stub
try {
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306", "root", "");
Statement statement = connection.createStatement();
statement.executeUpdate("CREATE DATABASE IF NOT EXISTS czat_sieciowy");
statement.close();
connection.close();
} catch (SQLException cd) {
cd.printStackTrace();
}
try {
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/czat_sieciowy", "root",
"");
Statement statement = connection.createStatement();
statement.executeUpdate("CREATE TABLE IF NOT EXISTS uzytkownik "
+ " (ID INTEGER not NULL AUTO_INCREMENT," + " imie VARCHAR(30) not NULL,"
+ " nazwaAdres VARCHAR(80) not NULL," + " PRIMARY KEY (ID))");
statement.close();
connection.close();
} catch (SQLException ct) {
ct.printStackTrace();
}
}
public void createDb() {
Thread t = new Thread(new SqlCreate());
t.start();
}
} | [
"Arekaaa16@interia.pl"
] | Arekaaa16@interia.pl |
1603383162ddb84d33341709e1ac9a2a371c4143 | 37364e3f130e94a2d472d7078eba3b34af25a405 | /app/src/main/java/com/example/hideki/touchandvibration/game/state/MenuState.java | 5f8ca0374a730b372780313c2a36fe1d8f8a0391 | [] | no_license | dannhideki/TouchAndVibration | 5ca3e80a19ee26ce633650bfc837930d7eda420a | 330a691e8f78a5b9cd870d55371efda70e0ada91 | refs/heads/master | 2021-01-20T20:57:10.763936 | 2015-05-16T21:45:40 | 2015-05-16T21:45:40 | 35,706,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,577 | java | package com.example.hideki.touchandvibration.game.state;
import android.content.Context;
import android.view.MotionEvent;
import com.example.hideki.touchandvibration.controller.Assets;
import com.example.hideki.touchandvibration.framework.util.Painter;
import com.example.hideki.touchandvibration.framework.util.UIButton;
public class MenuState extends State {
private UIButton playButton, scoreButton;
private Context context;
public MenuState(Context context){
this.context = context;
}
@Override
public void init() {
playButton = new UIButton(316, 227, 484, 286, Assets.start,
Assets.startDown);
scoreButton = new UIButton(316, 300, 484, 359, Assets.score,
Assets.scoreDown);
}
@Override
public void update(float delta) {
}
@Override
public void render(Painter g) {
g.drawImage(Assets.welcome, 0, 0);
playButton.render(g);
scoreButton.render(g);
}
@Override
public boolean onTouch(MotionEvent e, int scaledX, int scaledY) {
if (e.getAction() == MotionEvent.ACTION_DOWN) {
playButton.onTouchDown(scaledX, scaledY);
scoreButton.onTouchDown(scaledX, scaledY);
}
if (e.getAction() == MotionEvent.ACTION_UP) {
if (playButton.isPressed(scaledX, scaledY)) {
playButton.cancel();
setCurrentState(new PlayState(context));
} else if (scoreButton.isPressed(scaledX, scaledY)) {
scoreButton.cancel();
setCurrentState(new ScoreState(context));
} else {
playButton.cancel();
scoreButton.cancel();
}
}
return true;
}
} | [
"dann.hideki@gmail.com"
] | dann.hideki@gmail.com |
b8f154edc8eb91e2b977759c79bbb23dcb6762e4 | 48f56ed19d2b77c5c98e8b2ed9168ee550756530 | /rpc-common/src/main/java/com/frozen/rpccommon/res/NULLBody.java | 05b255d7ef83f3b16faa232eade33ecafb2e22dc | [] | no_license | jdfrozen/J-frozen2 | 1bf4927bb768c5e5e24d5803e206bd222e4e6661 | 15e355f8d6792b479be045398bedeab8096aaf04 | refs/heads/master | 2022-06-24T17:47:18.440305 | 2021-01-26T03:48:05 | 2021-01-26T03:48:05 | 224,824,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.frozen.rpccommon.res;
/**
* Function:空对象,用在泛型中,表示没有额外的请求参数或者返回参数
*
* @author crossoverJie
* Date: 2017/6/7 下午11:57
* @since JDK 1.8
*/
public class NULLBody {
public NULLBody() {}
public static NULLBody create(){
return new NULLBody();
}
}
| [
"616769416@qq.com"
] | 616769416@qq.com |
5d09a80a680a765e1a677a916f4baaaef6bef4b0 | 694d574b989e75282326153d51bd85cb8b83fb9f | /google-ads/src/main/java/com/google/ads/googleads/v1/services/stub/CustomerExtensionSettingServiceStub.java | 213e9a6a0074fb023c0c17059d6b53d6034f8021 | [
"Apache-2.0"
] | permissive | tikivn/google-ads-java | 99201ef20efd52f884d651755eb5a3634e951e9b | 1456d890e5c6efc5fad6bd276b4a3cd877175418 | refs/heads/master | 2023-08-03T13:02:40.730269 | 2020-07-17T16:33:40 | 2020-07-17T16:33:40 | 280,845,720 | 0 | 0 | Apache-2.0 | 2023-07-23T23:39:26 | 2020-07-19T10:51:35 | null | UTF-8 | Java | false | false | 2,100 | java | /*
* Copyright 2019 Google LLC
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.ads.googleads.v1.services.stub;
import com.google.ads.googleads.v1.resources.CustomerExtensionSetting;
import com.google.ads.googleads.v1.services.GetCustomerExtensionSettingRequest;
import com.google.ads.googleads.v1.services.MutateCustomerExtensionSettingsRequest;
import com.google.ads.googleads.v1.services.MutateCustomerExtensionSettingsResponse;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.UnaryCallable;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Base stub class for Google Ads API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator")
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class CustomerExtensionSettingServiceStub implements BackgroundResource {
public UnaryCallable<GetCustomerExtensionSettingRequest, CustomerExtensionSetting>
getCustomerExtensionSettingCallable() {
throw new UnsupportedOperationException(
"Not implemented: getCustomerExtensionSettingCallable()");
}
public UnaryCallable<
MutateCustomerExtensionSettingsRequest, MutateCustomerExtensionSettingsResponse>
mutateCustomerExtensionSettingsCallable() {
throw new UnsupportedOperationException(
"Not implemented: mutateCustomerExtensionSettingsCallable()");
}
@Override
public abstract void close();
}
| [
"nwbirnie@gmail.com"
] | nwbirnie@gmail.com |
1610fd0a22920cb05c99007bd53c651713160780 | 2665f5572376cf3f3b0f649db26badec520d1bbd | /app/src/main/java/com/grocery/fragment/fragmentLiveCustomer/FragmentLiveCusAllCategory.java | e66a2e0962d4704986c64bcc60357cef3a68254f | [] | no_license | BruceleeThanh/grocery | 693360dd1c12022f42d2818d8c7715a08146276b | ae00f562139b3cb3ca71425b6ef823f006a8e553 | refs/heads/master | 2020-03-25T10:05:00.083056 | 2018-08-06T06:19:58 | 2018-08-06T06:19:58 | 143,683,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,589 | java | package com.grocery.fragment.fragmentLiveCustomer;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.grocery.R;
import com.grocery.adapter.LiveCustomerAdapter;
import com.grocery.common.CRecyclerView;
import com.grocery.model.ItemCategory;
import java.util.ArrayList;
/**
* Created by ThanhBeo on 18/07/2017.
*/
public class FragmentLiveCusAllCategory extends Fragment {
private ArrayList<ItemCategory> arrData;
private CRecyclerView lvLiveCustomer;
private LiveCustomerAdapter liveCustomerAdapter;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.live_customers_all_category, container, false);
initView(view);
initListener();
return view;
}
private void initListener() {
}
private void initView(View view) {
arrData = new ArrayList<>();
lvLiveCustomer = (CRecyclerView) view.findViewById(R.id.lv_live_customer);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),
5, GridLayoutManager.VERTICAL, false);
lvLiveCustomer.setLayoutManager(gridLayoutManager);
liveCustomerAdapter = new LiveCustomerAdapter(getActivity(), arrData);
lvLiveCustomer.setAdapter(liveCustomerAdapter);
}
}
| [
"nguyentrungthanh602@gmail.com"
] | nguyentrungthanh602@gmail.com |
90a00fe6555db5880f1af7d4f0aaf5f5cc036b56 | 6d007ca21772249801957c5109fbf7177748f100 | /app/src/main/java/com/youyi/ywl/adapter/ExampleExplainFragmentAdapter.java | b8c223388837a6a4fff6728d4b379418f2e9ac29 | [] | no_license | gpitcast/ProjectOne | d9b5ac1807c761a79eddf89d932e5083affd80b8 | 11a905e7ec98a182024fb4bf95e5dd82430d5919 | refs/heads/master | 2020-03-07T02:41:37.597117 | 2018-10-18T02:58:31 | 2018-10-18T02:58:31 | 127,214,554 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,578 | java | package com.youyi.ywl.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.youyi.ywl.R;
import com.youyi.ywl.inter.RecyclerViewOnItemClickListener;
import com.youyi.ywl.util.GlideUtil;
import java.util.HashMap;
import java.util.List;
/**
* Created by Administrator on 2018/9/12.
* 学习轨迹 -- 习题讲解fragment的适配器
*/
public class ExampleExplainFragmentAdapter extends RecyclerView.Adapter {
private Context context;
private List<HashMap<String, Object>> dataList;
private RecyclerViewOnItemClickListener itemClickListener;
public ExampleExplainFragmentAdapter(Context context, List<HashMap<String, Object>> dataList) {
this.context = context;
this.dataList = dataList;
}
public void setOnItemClickListener(RecyclerViewOnItemClickListener itemClickListener) {
this.itemClickListener = itemClickListener;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new MyViewHolder(LayoutInflater.from(context).inflate(R.layout.item_example_explain_fragment, null), itemClickListener);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
MyViewHolder vh = (MyViewHolder) holder;
HashMap<String, Object> map = dataList.get(position);
vh.tv_time.setText(map.get("date") + "");
GlideUtil.loadNetImageView(context, map.get("himg") + "", vh.imageView);
vh.tv_title.setText(map.get("title") + "");
vh.tv_tag.setText(map.get("version") + " · " + map.get("grade") + " · " + map.get("subject"));
}
@Override
public int getItemCount() {
return dataList == null ? 0 : dataList.size();
}
private class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private final LinearLayout ll_time;
private final FrameLayout fl_line;
private final TextView tv_time;
private final ImageView imageView;
private final TextView tv_title;
private final TextView tv_tag;
private final LinearLayout ll_base;
private RecyclerViewOnItemClickListener itemClickListener;
public MyViewHolder(View itemView, RecyclerViewOnItemClickListener itemClickListener) {
super(itemView);
ll_base = ((LinearLayout) itemView.findViewById(R.id.ll_base));
ll_time = ((LinearLayout) itemView.findViewById(R.id.ll_time));
fl_line = ((FrameLayout) itemView.findViewById(R.id.fl_line));
tv_time = ((TextView) itemView.findViewById(R.id.tv_time));
imageView = ((ImageView) itemView.findViewById(R.id.imageView));
tv_title = ((TextView) itemView.findViewById(R.id.tv_title));
tv_tag = ((TextView) itemView.findViewById(R.id.tv_tag));
this.itemClickListener = itemClickListener;
ll_base.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.ll_base:
if (itemClickListener != null) {
itemClickListener.OnItemClick(ll_base, getPosition() - 3);
}
break;
}
}
}
}
| [
"324264817@qq.com"
] | 324264817@qq.com |
d9a9878a6bce55472047a1ef779e58d99a56ee34 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/18/18_d3fa485a63c0b9fd24d5561f90e24e9e95dcb75b/SyncStoreCCProvider/18_d3fa485a63c0b9fd24d5561f90e24e9e95dcb75b_SyncStoreCCProvider_s.java | fe152d7cb9d63e0fec016cc18b7b55032471f4f4 | [] | 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 | 15,671 | java | package org.sdnplatform.sync.internal.config;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import java.util.Random;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.util.SingletonTask;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import org.sdnplatform.sync.IClosableIterator;
import org.sdnplatform.sync.IStoreClient;
import org.sdnplatform.sync.IStoreListener;
import org.sdnplatform.sync.ISyncService.Scope;
import org.sdnplatform.sync.Versioned;
import org.sdnplatform.sync.error.ObsoleteVersionException;
import org.sdnplatform.sync.error.SyncException;
import org.sdnplatform.sync.internal.SyncManager;
import org.sdnplatform.sync.internal.config.bootstrap.Bootstrap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Joiner;
import com.google.common.net.HostAndPort;
/**
* Configure sync service from a persistent sync store, and support
* bootstrapping without manually configuring it.
* @author readams
*/
public class SyncStoreCCProvider
implements IClusterConfigProvider {
protected static final Logger logger =
LoggerFactory.getLogger(SyncStoreCCProvider.class);
private SyncManager syncManager;
private IThreadPoolService threadPool;
private SingletonTask bootstrapTask;
private IStoreClient<Short, Node> nodeStoreClient;
private IStoreClient<String, String> unsyncStoreClient;
private volatile AuthScheme authScheme;
private volatile String keyStorePath;
private volatile String keyStorePassword;
private static final String PREFIX =
SyncManager.class.getCanonicalName();
public static final String SYSTEM_NODE_STORE =
PREFIX + ".systemNodeStore";
public static final String SYSTEM_UNSYNC_STORE =
PREFIX + ".systemUnsyncStore";
protected static final String SEEDS = "seeds";
public static final String LOCAL_NODE_ID = "localNodeId";
public static final String LOCAL_NODE_IFACE = "localNodeIface";
public static final String LOCAL_NODE_HOSTNAME = "localNodeHostname";
public static final String LOCAL_NODE_PORT = "localNodePort";
public static final String AUTH_SCHEME = "authScheme";
public static final String KEY_STORE_PATH = "keyStorePath";
public static final String KEY_STORE_PASSWORD = "keyStorePassword";
// **********************
// IClusterConfigProvider
// **********************
@Override
public void init(SyncManager syncManager, FloodlightModuleContext context)
throws SyncException {
this.syncManager = syncManager;
threadPool = context.getServiceImpl(IThreadPoolService.class);
syncManager.registerPersistentStore(SYSTEM_NODE_STORE, Scope.GLOBAL);
syncManager.registerPersistentStore(SYSTEM_UNSYNC_STORE,
Scope.UNSYNCHRONIZED);
this.nodeStoreClient =
syncManager.getStoreClient(SYSTEM_NODE_STORE,
Short.class, Node.class);
this.nodeStoreClient.addStoreListener(new ShortListener());
this.unsyncStoreClient =
syncManager.getStoreClient(SYSTEM_UNSYNC_STORE,
String.class, String.class);
this.unsyncStoreClient.addStoreListener(new StringListener());
}
@Override
public ClusterConfig getConfig() throws SyncException {
if (bootstrapTask == null)
bootstrapTask = new SingletonTask(threadPool.getScheduledExecutor(),
new BootstrapTask());
keyStorePath = unsyncStoreClient.getValue(KEY_STORE_PATH);
keyStorePassword =
unsyncStoreClient.getValue(KEY_STORE_PASSWORD);
try {
authScheme =
AuthScheme.valueOf(unsyncStoreClient.
getValue(AUTH_SCHEME));
} catch (Exception e) {
authScheme = AuthScheme.NO_AUTH;
}
Short localNodeId = getLocalNodeId();
if (localNodeId == null) {
String seedStr =
unsyncStoreClient.getValue(SyncStoreCCProvider.SEEDS);
if (seedStr == null) {
throw new SyncException("No local node ID and no seeds");
}
bootstrapTask.reschedule(0, TimeUnit.SECONDS);
throw new SyncException("Local node ID not yet configured");
}
IClosableIterator<Entry<Short, Versioned<Node>>> iter =
nodeStoreClient.entries();
List<Node> nodes = new ArrayList<Node>();
try {
while (iter.hasNext()) {
Entry<Short, Versioned<Node>> e = iter.next();
if (e.getValue().getValue() != null) {
if (e.getValue().getValue().getNodeId() == localNodeId)
continue;
nodes.add(e.getValue().getValue());
}
}
Node oldLocalNode = null;
Node newLocalNode = null;
while (true) {
try {
Versioned<Node> v =
nodeStoreClient.get(Short.valueOf(localNodeId));
oldLocalNode = v.getValue();
if (oldLocalNode != null) {
newLocalNode = getLocalNode(oldLocalNode.getNodeId(),
oldLocalNode.getDomainId());
v.setValue(newLocalNode);
}
break;
} catch (ObsoleteVersionException e) { }
}
nodes.add(newLocalNode);
if (oldLocalNode == null || !oldLocalNode.equals(newLocalNode)) {
// If we have no local node or our hostname or port changes,
// we should trigger a new cluster join to ensure that the
// new value can propagate everywhere
bootstrapTask.reschedule(0, TimeUnit.SECONDS);
throw new SyncException("Local node configuration has changed");
}
ClusterConfig config = new ClusterConfig(nodes, localNodeId,
authScheme,
keyStorePath,
keyStorePassword);
updateSeeds(syncManager.getClusterConfig());
return config;
} finally {
iter.close();
}
}
// *************
// Local methods
// *************
private Short getLocalNodeId() throws SyncException {
String localNodeIdStr = unsyncStoreClient.getValue(LOCAL_NODE_ID);
if (localNodeIdStr == null)
return null;
short localNodeId;
try {
localNodeId = Short.parseShort(localNodeIdStr);
} catch (NumberFormatException e) {
throw new SyncException("Failed to parse local node ID: " +
localNodeIdStr, e);
}
return localNodeId;
}
private void updateSeeds(ClusterConfig config) throws SyncException {
List<String> hosts = new ArrayList<String>();
for (Node n : config.getNodes()) {
if (!config.getNode().equals(n)) {
HostAndPort h =
HostAndPort.fromParts(n.getHostname(), n.getPort());
hosts.add(h.toString());
}
}
Collections.sort(hosts);
String seeds = Joiner.on(',').join(hosts);
while (true) {
try {
Versioned<String> sv = unsyncStoreClient.get(SEEDS);
if (sv.getValue() == null || !sv.getValue().equals(seeds)) {
if (logger.isDebugEnabled()) {
logger.debug("Updating seeds to {} from {}",
seeds, sv.getValue());
}
unsyncStoreClient.put(SEEDS, seeds);
}
break;
} catch (ObsoleteVersionException e) { }
}
}
private Node getLocalNode(short nodeId, short domainId)
throws SyncException {
String hostname = unsyncStoreClient.getValue(LOCAL_NODE_HOSTNAME);
if (hostname == null)
hostname = getLocalHostname();
int port = 6642;
String portStr = unsyncStoreClient.getValue(LOCAL_NODE_PORT);
if (portStr != null) {
port = Integer.parseInt(portStr);
}
return new Node(hostname, port, nodeId, domainId);
}
private String getLocalHostname() throws SyncException {
String ifaceStr = unsyncStoreClient.getValue(LOCAL_NODE_IFACE);
try {
Enumeration<NetworkInterface> ifaces =
NetworkInterface.getNetworkInterfaces();
InetAddress bestAddr = null;
for (NetworkInterface iface : Collections.list(ifaces)) {
if (iface.isLoopback()) continue;
if (ifaceStr != null) {
if (!ifaceStr.equals(iface.getName()))
continue;
}
Enumeration<InetAddress> addrs = iface.getInetAddresses();
try {
for (InetAddress addr : Collections.list(addrs)) {
if (bestAddr == null ||
(!addr.isLinkLocalAddress() &&
bestAddr.isLinkLocalAddress()) ||
(addr instanceof Inet6Address &&
bestAddr instanceof Inet4Address)) {
bestAddr = addr;
}
}
} catch (Exception e) {
logger.debug("Failed to examine address", e);
}
}
if (bestAddr != null)
return bestAddr.getHostName();
} catch (Exception e) {
throw new SyncException("Failed to find interface addresses", e);
}
throw new SyncException("No usable interface addresses found");
}
protected class BootstrapTask implements Runnable {
@Override
public void run() {
try {
Node localNode = null;
Short localNodeId = getLocalNodeId();
if (localNodeId != null)
localNode = nodeStoreClient.getValue(localNodeId);
String seedStr =
unsyncStoreClient.getValue(SyncStoreCCProvider.SEEDS);
if (seedStr == null) return;
logger.debug("[{}] Attempting to bootstrap cluster",
localNodeId);
if (seedStr.equals("")) {
localNode = setupLocalNode(localNode, true);
if (logger.isDebugEnabled()) {
logger.debug("[{}] First node configuration: {}",
localNode.getNodeId(), localNode);
}
while (true) {
try {
nodeStoreClient.put(localNode.getNodeId(),
localNode);
break;
} catch (ObsoleteVersionException e) {}
}
while (true) {
try {
unsyncStoreClient.put(LOCAL_NODE_ID,
Short.toString(localNode.
getNodeId()));
break;
} catch (ObsoleteVersionException e) {}
}
if (logger.isDebugEnabled()) {
logger.debug("[{}] Successfully bootstrapped",
localNode.getNodeId());
}
} else {
localNode = setupLocalNode(localNode, false);
if (logger.isDebugEnabled()) {
logger.debug("[{}] Adding new node from seeds {}: {}",
new Object[]{localNodeId, seedStr,
localNode});
}
String[] seeds = seedStr.split(",");
ArrayList<HostAndPort> hosts = new ArrayList<HostAndPort>();
for (String s : seeds) {
hosts.add(HostAndPort.fromString(s).
withDefaultPort(6642));
}
Bootstrap bs = new Bootstrap(syncManager,
authScheme,
keyStorePath,
keyStorePassword);
bs.init();
try {
for (HostAndPort host : hosts) {
if (bs.bootstrap(host, localNode))
break;
}
} finally {
bs.shutdown();
}
if (logger.isDebugEnabled()) {
logger.debug("[{}] Successfully bootstrapped",
unsyncStoreClient.getValue(LOCAL_NODE_ID));
}
}
syncManager.updateConfiguration();
} catch (Exception e) {
logger.error("Failed to bootstrap cluster", e);
}
}
private Node setupLocalNode(Node localNode, boolean firstNode)
throws SyncException {
short nodeId = -1;
short domainId = -1;
if (localNode != null) {
nodeId = localNode.getNodeId();
domainId = localNode.getDomainId();
} else if (firstNode) {
domainId = nodeId =
(short)(new Random().nextInt(Short.MAX_VALUE));
}
Node n = getLocalNode(nodeId, domainId);
return n;
}
}
protected class ShortListener implements IStoreListener<Short> {
@Override
public void keysModified(Iterator<Short> keys, UpdateType type) {
syncManager.updateConfiguration();
}
}
protected class StringListener implements IStoreListener<String> {
@Override
public void keysModified(Iterator<String> keys, UpdateType type) {
syncManager.updateConfiguration();
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
c2eb2fb61310de47180a838424cba145376aaa49 | 7ad4c192c3d97bf4cbca1141b834b3c2af63c629 | /src/main/java/net/asfun/jangod/lib/Filter.java | 6aeb0ee4045625ff79aa596ec3302a343fb08122 | [] | no_license | lyx030405/jangod | 7937b7aaf0366d0d1360aff7553915af58e43a50 | 6b1f250f9541c2194baa7ade0ea3d3b1be9e0d24 | refs/heads/master | 2021-01-17T21:51:19.346001 | 2011-11-21T15:13:56 | 2011-11-21T15:13:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,019 | java | /**********************************************************************
Copyright (c) 2009 Asfun Net.
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 net.asfun.jangod.lib;
import net.asfun.jangod.interpret.InterpretException;
import net.asfun.jangod.interpret.JangodInterpreter;
public interface Filter extends Importable {
Object filter(Object object, JangodInterpreter interpreter, String... arg)
throws InterpretException;
}
| [
"igor.mihalik@gmail.com"
] | igor.mihalik@gmail.com |
d390edba29450c9002e2e968f33dc73785bc3423 | b14502961b43b1e1813ce3a198827c864dbdaf4d | /src/presentation/Prueba.java | 956be13dc88fde4e4cbe43afebf164dd529af58d | [] | no_license | lokocharry/Karaoke | bf92cf98e2b451bee390b0993b29d40867ca2bd9 | 27a2fb33d7d17fecde465452c2a290a398a750c7 | refs/heads/master | 2021-01-25T03:26:20.971450 | 2014-04-14T15:43:46 | 2014-04-14T15:43:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,367 | java | package presentation;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
public class Prueba extends JFrame {
String a="aaaaa";
JTextPane textPane = new JTextPane();
StyledDocument doc = textPane.getStyledDocument();
public Prueba(){
add(textPane);
}
public void surtale(){
for (int i = 0; i < a.length(); i++) {
System.out.println(a.substring(0,i));
System.out.println(a.substring(i, a.length()));
System.out.println("--------------------------");
Style style = textPane.addStyle("I'm a Style", null);
StyleConstants.setForeground(style, Color.red);
try { doc.insertString(doc.getLength(), a.substring(0,i),style); }
catch (BadLocationException e){}
StyleConstants.setForeground(style, Color.blue);
try { doc.insertString(doc.getLength(), a.substring(i, a.length()),style); }
catch (BadLocationException e){}
try {
Thread.sleep(1000);
textPane.setText("");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
Prueba p=new Prueba();
p.setSize(300, 300);
p.setVisible(true);
p.surtale();
}
}
| [
"jolberto_63@hotmail.com"
] | jolberto_63@hotmail.com |
65264ff5b07a79e9feb72736e73502addb5f3778 | 465b4beb34e17c511a1d1f4ce9f7162414856fe6 | /src/main/java/com/baojie/threadpool/RejectedHandler.java | 5194054a54aa966ad968360423bd6019e9b86312 | [] | no_license | lizengqing/hahaseda | e075cd87c7778379056f083a856fd2e229aa2768 | cb9b366695625366f621fd76da7af62ef45b20e0 | refs/heads/master | 2020-12-04T23:18:44.972569 | 2018-06-19T09:54:08 | 2018-06-19T09:54:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,519 | java | package com.baojie.threadpool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Queue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;
public class RejectedHandler implements RejectedExecutionHandler {
private static final Logger log = LoggerFactory.getLogger(RejectedHandler.class);
private final String rejectedHandlerName;
// inner loop times
private static final int LoopSubmit = 6;
private static final int LoopTime = 60;
private RejectedHandler(final String rejectedHandlerName) {
this.rejectedHandlerName = rejectedHandlerName;
}
public static RejectedHandler create(final String rejectedHandlerName) {
return new RejectedHandler(rejectedHandlerName);
}
@Override
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor executor) {
final Queue<Runnable> taskQueue = executor.getQueue();
if (taskQueue.offer(runnable)) {
log.debug("Resubmit success. RejectedHandlerName is : " + rejectedHandlerName
+ ", TaskQueue in threadpool is : " + taskQueue.size());
} else {
log.info("Loopsubmit start, RejectedHandlerName is : " + rejectedHandlerName + ", loopsubmit times is : "
+ LoopSubmit + ", loopsubmit period time is : " + LoopTime + " milliseconds.");
innerLoopSubmit(runnable, taskQueue);
}
}
private void innerLoopSubmit(final Runnable runnable, final Queue<Runnable> taskQueue) {
int testLoop = 0;
boolean loopSuccess = false;
while (testLoop <= LoopSubmit) {
if (taskQueue.offer(runnable)) {
loopSuccess = true;
log.debug("Loopsubmit success. RejectedHandlerName is :" + rejectedHandlerName
+ ", TaskQueue in threadpool is : " + taskQueue.size());
break;
} else {
testLoop++;
LockSupport.parkNanos(TimeUnit.NANOSECONDS.convert(LoopTime, TimeUnit.MILLISECONDS));
}
}
checkLoopState(loopSuccess, runnable);
}
private void checkLoopState(final boolean loopSuccess, final Runnable runnable) {
if (loopSuccess) {
return;
} else {
submitRunnableIntoRejectedThreadPool(runnable);
log.warn("Loopsubmit failue. Submit task into YunRejectedThreadPool. RejectedHandlerName is : "
+ rejectedHandlerName + ".");
}
}
private void submitRunnableIntoRejectedThreadPool(final Runnable runnable) {
RejectedPool.getInstance().submit(runnable);
}
public String getRejectedHandlerName() {
return rejectedHandlerName;
}
}
| [
"1039245098@qq.com"
] | 1039245098@qq.com |
036f173eb5b412203f9b1cdcaed6c7fbc7a25392 | ec54c55e82e5d97cf1fd33e93bc55faff2a66362 | /service/src/main/java/com/fish/idle/service/util/MD5.java | 46a11cad8d968059c42bdcbd717eb0511385c48d | [] | no_license | dongshengzheng/bothadmin | 17033b51493d74a95f2b671bfaf1693ed4a1e3c3 | fc21fcde1914a35edd76860fea1d9805a851d948 | refs/heads/master | 2020-05-26T21:08:08.331656 | 2017-03-01T02:55:28 | 2017-03-01T02:55:28 | 82,503,726 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | /*
*
* ALL RIGHTS RESERVED.
*
* No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
* on any form or by any means, electronic, mechanical, photocopying, recording,
* or otherwise, without the prior written permission of ShenZhen GreatVision Network Technology Co., Ltd.
*
* Amendment History:
*
* Date By Description
* ------------------- ----------- -------------------------------------------
* Apr 17, 2015 Sun.Han Create the class
*/
package com.fish.idle.service.util;
import java.security.MessageDigest;
/**
* @author Sun.Han
* @version 1.0
* @FileName MD5.java
* @Description:
* @Date Apr 19, 2015
*/
public class MD5 {
public static String md5(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");
buf.append(Integer.toHexString(i));
}
str = buf.toString();
} catch (Exception e) {
e.printStackTrace();
}
return str;
}
public static void main(String[] args) {
System.out.println(md5("fsafs" + "123456"));
System.out.println(md5("dfafds"));
}
}
| [
"szy@szydeMacBook-Pro.local"
] | szy@szydeMacBook-Pro.local |
a10f89cc969cb6f24eaccde9d8b55db5cdfd8125 | b6e08ab801c49f5fa2db90d85f77e44146bd91a7 | /framework-cloud/framework-openshift-operator/src/main/java/org/kie/cloud/openshift/operator/scenario/builder/AbstractOpenshiftScenarioBuilderOperator.java | 70c5a93749015fa1c2bd708ffb7d671e28d138da | [
"Apache-2.0"
] | permissive | jakubschwan/kie-cloud-tests | 72f720b5602f871ea9a2804a781bd273bcb4275d | 4de96e452435380a02daa6354014d2c9caf54c02 | refs/heads/master | 2023-08-06T05:58:16.861690 | 2021-06-17T16:41:11 | 2021-06-18T13:35:21 | 98,167,453 | 0 | 1 | Apache-2.0 | 2019-01-17T12:15:06 | 2017-07-24T08:26:54 | Java | UTF-8 | Java | false | false | 1,262 | java | /*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
* 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.kie.cloud.openshift.operator.scenario.builder;
import org.kie.cloud.openshift.deployment.external.ExternalDeploymentFactory;
import org.kie.cloud.openshift.operator.deployment.external.ExternalDeploymentFactoryOperator;
import org.kie.cloud.openshift.scenario.builder.AbstractOpenshiftScenarioBuilder;
public abstract class AbstractOpenshiftScenarioBuilderOperator<T> extends AbstractOpenshiftScenarioBuilder<T> {
private ExternalDeploymentFactory factory = new ExternalDeploymentFactoryOperator();
@Override
protected ExternalDeploymentFactory getExternalDeploymentFactory() {
return factory;
}
}
| [
"krlsuta@gmail.com"
] | krlsuta@gmail.com |
1ad9acf019969852dc2f7111a8ade841166fe458 | 0ebbf386147ebfb43079355e887fb9d3db7fb93f | /Client/src/views/DialogRegsitry.java | 5ff0d8ee2cc6b5337f9f1c95c9f4bed227d97c12 | [] | no_license | DanielGaona2798/Sockets | 769ece92c8d192efb49fd13e7de5312f0e740516 | 3bc35b43310d80703cb3475e69e342c67f6f4e42 | refs/heads/master | 2020-03-18T02:11:40.164406 | 2018-05-24T16:54:15 | 2018-05-24T16:54:15 | 134,179,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,043 | java | package views;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import controller.Actions;
import controller.Controller;
public class DialogRegsitry extends JDialog{
private static final long serialVersionUID = 1L;
private JTextField tfName;
private JButton btnAccept;
public DialogRegsitry(Controller controller) {
setLocationRelativeTo(null);
setSize(250, 300);
setLayout(new BorderLayout());
tfName = new JTextField();
tfName.setBorder(new TitledBorder("Input your Username"));
add(tfName, BorderLayout.CENTER);
btnAccept = new JButton("Registry");
btnAccept.setActionCommand(Actions.ACCEPT.toString());
btnAccept.addActionListener(controller);
btnAccept.setForeground(Color.WHITE);
btnAccept.setFont(new Font("Comic Sans Ms", Font.BOLD, 15));
add(btnAccept, BorderLayout.SOUTH);
}
public String getName(){
return tfName.getText();
}
}
| [
"daniel.gaona01@uptc.edu.co"
] | daniel.gaona01@uptc.edu.co |
0727fb8601508aa04b3588945ef54542fbe2a0c2 | 06b2eb7f520f9fc092d4e71b633f5206cd45d69a | /basex-core/src/main/java/org/basex/query/value/item/DTDur.java | a4fe443b61103863bde5baa0748e1781826415f5 | [
"BSD-3-Clause"
] | permissive | dkanda/basex | 1cfd7ca46202e867115c5e71495768f052d5b462 | 86fe69fbf75d26fef835f836a770d1fccfa45e73 | refs/heads/master | 2020-04-05T14:32:21.113355 | 2018-11-10T00:55:38 | 2018-11-10T00:55:38 | 156,934,200 | 0 | 0 | NOASSERTION | 2018-11-10T00:53:07 | 2018-11-10T00:53:07 | null | UTF-8 | Java | false | false | 4,756 | java | package org.basex.query.value.item;
import static org.basex.query.QueryError.*;
import static org.basex.query.QueryText.*;
import java.math.*;
import java.util.regex.*;
import org.basex.query.*;
import org.basex.query.util.collation.*;
import org.basex.query.value.type.*;
import org.basex.util.*;
/**
* DayTime Duration item ({@code xs:dayTimeDuration}).
*
* @author BaseX Team 2005-18, BSD License
* @author Christian Gruen
*/
public final class DTDur extends Dur {
/**
* Constructor.
* @param dur duration item
*/
public DTDur(final Dur dur) {
super(AtomType.DTD);
sec = dur.sec == null ? BigDecimal.ZERO : dur.sec;
}
/**
* Timezone constructor.
* @param hours hours
* @param minutes minutes
*/
public DTDur(final long hours, final long minutes) {
super(AtomType.DTD);
sec = BigDecimal.valueOf(hours).multiply(BD60).add(BigDecimal.valueOf(minutes)).multiply(BD60);
}
/**
* Timezone constructor.
* @param sec seconds
*/
public DTDur(final BigDecimal sec) {
super(AtomType.DTD);
this.sec = sec;
}
/**
* Constructor.
* @param dur duration item
* @param add duration to be added/subtracted
* @param plus plus/minus flag
* @param info input info
* @throws QueryException query exception
*/
public DTDur(final DTDur dur, final DTDur add, final boolean plus, final InputInfo info)
throws QueryException {
this(dur);
sec = plus ? sec.add(add.sec) : sec.subtract(add.sec);
final double d = sec.doubleValue();
if(d <= Long.MIN_VALUE || d >= Long.MAX_VALUE) throw SECDURRANGE_X.get(info, d);
}
/**
* Constructor.
* @param dur duration item
* @param factor factor
* @param mult multiplication flag
* @param info input info
* @throws QueryException query exception
*/
public DTDur(final Dur dur, final double factor, final boolean mult, final InputInfo info)
throws QueryException {
this(dur);
if(Double.isNaN(factor)) throw DATECALC_X_X.get(info, description(), factor);
if(mult ? Double.isInfinite(factor) : factor == 0) throw DATEZERO_X_X.get(info, type, factor);
if(mult ? factor == 0 : Double.isInfinite(factor)) {
sec = BigDecimal.ZERO;
} else {
BigDecimal d = BigDecimal.valueOf(factor);
try {
sec = mult ? sec.multiply(d) : sec.divide(d, MathContext.DECIMAL64);
} catch(final ArithmeticException ex) {
Util.debug(ex);
// catch cases in which a computation yields no exact result; eg:
// xs:dayTimeDuration("P1D") div xs:double("-1.7976931348623157E308")
d = BigDecimal.valueOf(1 / factor);
sec = mult ? sec.divide(d, MathContext.DECIMAL64) : sec.multiply(d);
}
}
if(Math.abs(sec.doubleValue()) < 1.0E-13) sec = BigDecimal.ZERO;
}
/**
* Constructor.
* @param date date item
* @param sub date/time to be subtracted
* @param info input info
* @throws QueryException query exception
*/
public DTDur(final ADate date, final ADate sub, final InputInfo info) throws QueryException {
super(AtomType.DTD);
sec = date.days().subtract(sub.days()).multiply(DAYSECONDS).add(
date.seconds().subtract(sub.seconds()));
final double d = sec.doubleValue();
if(d <= Long.MIN_VALUE || d >= Long.MAX_VALUE) throw SECRANGE_X.get(info, d);
}
/**
* Constructor.
* @param value value
* @param info input info
* @throws QueryException query exception
*/
public DTDur(final byte[] value, final InputInfo info) throws QueryException {
super(AtomType.DTD);
final String val = Token.string(value).trim();
final Matcher mt = DTD.matcher(val);
if(!mt.matches() || val.endsWith("P") || val.endsWith("T")) throw dateError(value, XDTD, info);
dayTime(value, mt, 2, info);
}
/**
* Returns the date and time.
* @return year
*/
public BigDecimal dtd() {
return sec;
}
@Override
public byte[] string(final InputInfo info) {
final TokenBuilder tb = new TokenBuilder();
final int ss = sec.signum();
if(ss < 0) tb.add('-');
tb.add('P');
if(day() != 0) { tb.addLong(Math.abs(day())); tb.add('D'); }
time(tb);
if(ss == 0) tb.add("T0S");
return tb.finish();
}
@Override
public int diff(final Item item, final Collation coll, final InputInfo info)
throws QueryException {
if(item.type == type) return sec.subtract(((ADateDur) item).sec).signum();
throw diffError(item, this, info);
}
/**
* Returns a dayTimeDuration item for the specified milliseconds.
* @param ms milliseconds
* @return dateTime instance
*/
public static DTDur get(final long ms) {
return new DTDur(BigDecimal.valueOf(ms).divide(BD1000, MathContext.DECIMAL64));
}
}
| [
"christian.gruen@gmail.com"
] | christian.gruen@gmail.com |
8486f14d5cd37fc9e6fa0c9509c3b9e233f97684 | 770002b50264a683984970507dee9946ac6f9174 | /Search in Rotated Sorted Array II.java | 567a66750b683d9c50c3886a92df8fd9d63cf74f | [] | no_license | guolinaileen/abc | 72c11fdd18c1c822cbf39ddc4684d17acd6d3e41 | 895849c476bdac17eab59e5d2d8471da75c49453 | refs/heads/master | 2021-03-12T23:11:50.839627 | 2020-06-23T06:15:54 | 2020-06-23T06:15:54 | 7,063,352 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,394 | java | public class Solution {
public int search(int[] A, int target) {
// Start typing your Java solution below
// DO NOT write main() function
return find(A, target, 0, A.length-1);
}
int find(int[] A, int target, int start, int end)
{
if(start>end) return -1;
int mid=start+(end-start)/2;
if(A[mid]==target)
{
return mid;
}
else if(A[mid]<target)
{
if(A[end]>=A[mid])
{
int left=find(A, target, start, mid-1);
if(left!=-1) return left;
int right=find(A, target, mid+1, end);
return right;
}else
{
return find(A, target, mid+1, end);
}
}else
{
if(A[end]<=A[mid])
{
int left=find(A, target, start, mid-1);
if(left!=-1) return left;
int right=find(A, target, mid+1, end);
return right;
}else
{
return find(A, target, start, mid-1);
}
}
}
}
/*
another solution
*/
public class Solution {
public boolean search(int[] A, int target) {
// Start typing your Java solution below
// DO NOT write main() function
if(find(A, target, 0, A.length-1)!=-1) return true;
return false;
}
int find(int[] A, int target, int start, int end)
{
if(start>end) return -1;
int mid=start+(end-start)/2;
if(A[mid]==target)
{
return mid;
}
else if (A[start]==A[mid])
{
int left=find(A, target, start, mid-1);
if(left!=-1) return left;
int right=find(A, target, mid+1, end);
return right;
}
else if (A[start]<A[mid])
{
if(A[start]<=target && target<A[mid])
{
return find(A, target, start, mid-1);
}else
{
return find(A, target, mid+1, end);
}
}else
{
if(A[mid]<target && target<=A[end])
{
return find(A, target, mid+1, end);
}else
{
return find(A, target, start, mid-1);
}
}
}
}
| [
"guolinaileen@gmail.com"
] | guolinaileen@gmail.com |
cb4fe404c830a08092b3974477738c25ecb6f2d6 | 40db906187a57160a7492b7db3de27c6331d43f0 | /app/src/main/java/cn/qijianke/kkt/utils/SPUtil.java | b957a334949c4d97fd7ca21fdd4c30de823de314 | [] | no_license | liudong1991/KKKT | 1f5d5e6a028c102494c453b2b786c53c78c9b520 | 2e9e4cc1fab350700ac741ed19681d69356b5db8 | refs/heads/master | 2020-04-06T09:57:47.546954 | 2018-11-13T10:39:33 | 2018-11-13T10:39:33 | 157,363,536 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package cn.qijianke.kkt.utils;
import android.content.Context;
import android.content.SharedPreferences;
import cn.qijianke.kkt.KKTApplication;
public class SPUtil {
private static SharedPreferences sp;
static {
sp = KKTApplication.getInstance().getSharedPreferences("kkt", Context.MODE_PRIVATE);
}
public static void put(String key, String value) {
sp.edit().putString(key, value).apply();
}
public static String get(String key) {
return sp.getString(key, "");
}
}
| [
"412242918@qq.com"
] | 412242918@qq.com |
475bea612ae5ea0e1385a48bd86ef854b2b9f0c2 | a31f7a8e8bff5df80092f5ea96d577285e1bf50a | /src/main/java/net/virtualinfinity/atrobots/measures/NewClazz001793556769186061AngleBracket.java | 085fcd250785dc8b71728c7d03f1a8f956311280 | [] | no_license | YoelSerf/at-robots | 7d6b99791f8a30f7691a2c5131a6842cddf9d479 | be19d87dc5137dfd5b36575bb4f3ae277a0c0917 | refs/heads/master | 2023-04-05T01:36:50.377546 | 2021-03-24T22:10:38 | 2021-03-24T22:10:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 599 | java | package net.virtualinfinity.atrobots.measures;
public class NewClazz001793556769186061AngleBracket {
private double x;
private double y;
private double radius;
public NewClazz001793556769186061AngleBracket(double x, double y, double radius) {
this.x = x;
this.y = y;
this.radius = radius;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getRadius() {
return radius;
}
public void setRadius(double radius) {
this.radius = radius;
}
} | [
"rodrigomorales2@acm.org"
] | rodrigomorales2@acm.org |
7ed3928804b021e819a26fa7b223dbf379288eb1 | c26c02279dc287a9c0ace21177c251e2d8e6d34e | /src/main/java/com/github/dentou/chat/IRCMessageReader.java | f6abf1618ba0bd7f45de69b3aa8f2c06881ddbad | [] | no_license | dentou/IRCServer | e0f9760dc952c7c4bc8d78eb7791a8ae7402a4fc | aa0082f01279c5cae5e2138e16fd52bd8c11d8a0 | refs/heads/master | 2020-03-22T00:43:14.100732 | 2018-06-30T15:57:08 | 2018-06-30T15:57:08 | 139,261,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,255 | java | package com.github.dentou.chat;
import com.github.dentou.utils.ServerConstants;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class IRCMessageReader { // todo handle partial read (for file transfer)
private ByteBuffer buffer = ByteBuffer.allocate(ServerConstants.MESSAGE_BUFFER_SIZE);
private IRCSocket ircSocket;
private int bufferPosition = 0;
public IRCMessageReader(IRCSocket ircSocket) {
this.ircSocket = ircSocket;
}
public List<IRCMessage> read() throws IOException {
int totalBytesRead = ircSocket.read(this.buffer);
buffer.flip();
List<IRCMessage> messages = parseMessages(this.buffer.array(), 0, buffer.limit());
buffer.position(bufferPosition);
buffer.compact();
return messages;
}
public List<IRCMessage> parseMessages(byte[] src, int startIndex, int endIndex) {
//System.out.println(src);
int beginOfMessage = startIndex;
List<IRCMessage> messages = new ArrayList<IRCMessage>();
while (true) {
//Find end of message
int endOfMessage = findNextLineBreak(src, beginOfMessage, endIndex);
//System.out.println("End of message: " + endOfMessage);
if (endOfMessage == -1) {
break;
}
String content = new String(Arrays.copyOfRange(src, beginOfMessage, endOfMessage - 1)); // Ignore line break
if (content.length() > 510) {
content = content.substring(0, 510);
}
IRCMessage message = new IRCMessage(content, ircSocket.getId(), 0); // 0 is server
messages.add(message);
beginOfMessage = endOfMessage + 1;
}
this.bufferPosition = beginOfMessage;
//System.out.println(messages);
return messages;
}
public int findNextLineBreak(byte[] src, int startIndex, int endIndex) {
for (int index = startIndex; index < endIndex; index++) {
if (src[index] == '\n') {
if (src[index - 1] == '\r') {
return index;
}
}
}
return -1;
}
}
| [
"trantienhuy.phys@gmail.com"
] | trantienhuy.phys@gmail.com |
2eb143530a5fa2c84a006c441ad5e3a1c8a74f12 | 4dd52a042b9f2520e90441e6f1ae61ca1df51d02 | /IncPOD/IncPOD/incpod/src/input/Input.java | 7badd09bea210032de0c11237d241cba8e5ad953 | [] | no_license | avudzor/Alg | caf710694c894300108b1bc6ca69e8e73ff3a214 | c408668e6945a8671a52fb541621ede992d2fefe | refs/heads/master | 2022-10-06T07:35:12.576692 | 2020-06-11T01:59:21 | 2020-06-11T01:59:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,791 | java | package input;
import java.util.ArrayList;
import java.util.List;
import helpers.IndexProvider;
public class Input {
private final int lineCount;
private final List<ParsedColumn<?>> parsedColumns;
private final String name;
public Input(RelationalInput relationalInput,RelationalInput incInput, int rowLimit,int incrowLimit) {
final int columnCount = relationalInput.numberOfColumns();
Column[] columns = new Column[columnCount];
for (int i = 0; i < columnCount; ++i) {
columns[i] = new Column(relationalInput.relationName(), relationalInput.columnNames()[i]);
}
int lineCount = 0;
boolean flag=false;
while (lineCount<rowLimit+incrowLimit) {
List<String> line=new ArrayList<String>();
if(flag) {if(incInput.hasNext()) line = incInput.next();else System.out.println("incdata error");}
else
{if(relationalInput.hasNext()) line = relationalInput.next();else System.out.println("data error");}
for (int i = 0; i < columnCount; ++i) {
columns[i].addLine(line.get(i));
}
++lineCount;
if (rowLimit > 0 && lineCount >= rowLimit)
flag=true;
if(lineCount>=rowLimit+incrowLimit)
break;
}
this.lineCount = lineCount;
parsedColumns = new ArrayList<>(columns.length);
createParsedColumns(relationalInput, columns);
name = relationalInput.relationName();
}
private void createParsedColumns(RelationalInput relationalInput, Column[] columns) {
int i = 0;
for (Column c : columns) {
switch (c.getType()) {
case Integer:
case LONG: {
ParsedColumn<Long> parsedColumn = new ParsedColumn<Long>(relationalInput.relationName(), c.getName(),
Long.class, i);
for (int l = 0; l < lineCount; ++l) {
parsedColumn.addLine(c.getLong(l));
}
parsedColumns.add(parsedColumn);
}
break;
case NUMERIC: {
ParsedColumn<Double> parsedColumn = new ParsedColumn<Double>(relationalInput.relationName(),
c.getName(), Double.class, i);
for (int l = 0; l < lineCount; ++l) {
parsedColumn.addLine(c.getDouble(l));
}
parsedColumns.add(parsedColumn);
}
break;
case STRING: {
ParsedColumn<String> parsedColumn = new ParsedColumn<String>(relationalInput.relationName(),
c.getName(), String.class, i);
for (int l = 0; l < lineCount; ++l) {
parsedColumn.addLine(c.getString(l));
}
parsedColumns.add(parsedColumn);
}
break;
default:
break;
}
++i;
}
}
public int getLineCount() {
return lineCount;
}
public ParsedColumn<?>[] getColumns() {
return parsedColumns.toArray(new ParsedColumn[0]);
}
public String getName() {
return name;
}
public int[][] getInts() {
final int COLUMN_COUNT = parsedColumns.size();
final int ROW_COUNT = getLineCount();
long time = System.currentTimeMillis();
int[][] input2s = new int[ROW_COUNT][COLUMN_COUNT];
IndexProvider<String> providerS = new IndexProvider<>();
IndexProvider<Long> providerL = new IndexProvider<>();
IndexProvider<Double> providerD = new IndexProvider<>();
for (int col = 0; col < COLUMN_COUNT; ++col) {
if (parsedColumns.get(col).getType() == String.class) {
for (int line = 0; line < ROW_COUNT; ++line) {
input2s[line][col] = providerS.getIndex((String) parsedColumns.get(col).getValue(line)).intValue();
}
} else if (parsedColumns.get(col).getType() == Double.class) {
for (int line = 0; line < ROW_COUNT; ++line) {
input2s[line][col] = providerD.getIndex((Double) parsedColumns.get(col).getValue(line)).intValue();
}
} else if (parsedColumns.get(col).getType() == Long.class) {
for (int line = 0; line < ROW_COUNT; ++line) {
input2s[line][col] = providerL.getIndex((Long) parsedColumns.get(col).getValue(line)).intValue();
}
}
}
providerS = IndexProvider.getSorted(providerS);
providerL = IndexProvider.getSorted(providerL);
providerD = IndexProvider.getSorted(providerD);
for (int col = 0; col < COLUMN_COUNT; ++col) {
if (parsedColumns.get(col).getType() == String.class) {
for (int line = 0; line < ROW_COUNT; ++line) {
input2s[line][col] = providerS.getIndex((String) parsedColumns.get(col).getValue(line)).intValue();
}
} else if (parsedColumns.get(col).getType() == Double.class) {
for (int line = 0; line < ROW_COUNT; ++line) {
input2s[line][col] = providerD.getIndex((Double) parsedColumns.get(col).getValue(line)).intValue();
}
} else if (parsedColumns.get(col).getType() == Long.class) {
for (int line = 0; line < ROW_COUNT; ++line) {
input2s[line][col] = providerL.getIndex((Long) parsedColumns.get(col).getValue(line)).intValue();
}
}
}
//log.info("rebuild: " + (System.currentTimeMillis() - time));
return input2s;
}
// private static Logger log = LoggerFactory.getLogger(Input.class);
}
| [
"Fudan_Tan@163.com"
] | Fudan_Tan@163.com |
df98d538ba60354e783b8d893b9152791f3ac79a | 35d4e0e719f5368bed6d871f38a5a5712c651800 | /src/visitors/SiteVisitor.java | 176c0dbd15a0533323504482f5f34dea7ff5a61b | [] | no_license | nightwolfz/sitemapper | 50450f8886736cd6572585a5b0720ff3a4caebdd | e854a0cffd5cba9488d720d6a52caf2c032a90f2 | refs/heads/master | 2020-12-27T12:00:25.933676 | 2015-09-26T18:04:46 | 2015-09-26T18:04:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,389 | java | package visitors;
import java.io.IOException;
import java.util.List;
import main.SiteMapper;
import org.jsoup.Jsoup;
import url.verifiers.Verifiable;
/**
*
* @author mikeecb
*
*/
public abstract class SiteVisitor implements Runnable {
protected final String URL;
protected final SiteMapper mapper;
protected final Verifiable URLVerifier;
public SiteVisitor(String URL, SiteMapper mapper, Verifiable URLVerifier) {
this.URL = URL;
this.mapper = mapper;
this.URLVerifier = URLVerifier;
}
@Override
public void run() {
try {
if (!mapper.ifShouldVisitMarkVisited(URL)) {
return;
}
System.out.println("Visiting " + URL);
String html = null;
try {
html = getHTML(URL);
} catch (IOException e) {
System.err.println("Error visiting url " + URL);
return;
}
addURLsToVisitAndStoreURLAssets(URL, html);
} finally {
mapper.visitorExited();
}
}
protected String getHTML(String URL) throws IOException {
return Jsoup.connect(URL)
.timeout(60000)
.get()
.html();
}
protected void visit(List<String> URLs) {
try {
mapper.addPagesToVisit(URLs);
} catch (Exception e) {
return;
}
}
protected void storeAssets(String URL, List<String> URLs) {
mapper.storePageAssets(URL, URLs);
}
protected abstract void addURLsToVisitAndStoreURLAssets(String URL, String html);
}
| [
"mikeecb@gmail.com"
] | mikeecb@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.