blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
289017f0224165781c1e4b5439551f40d13be7df | 0d681cc3e93e75b713937beb409b48ecf423e137 | /hw07-0036479615/src/main/java/hr/fer/zemris/optjava/dz7/algorithms/swarm/IInertionScaler.java | 00b61b48d77e96efccf0d0ec8670d22e1a77f46c | [] | no_license | svennjegac/FER-java-optjava | fe86ead9bd80b4ef23944ef9234909353673eaab | 89d9aa124e2e2e32b0f8f1ba09157f03ecd117c6 | refs/heads/master | 2020-03-29T04:17:20.952593 | 2018-09-20T08:59:01 | 2018-09-20T08:59:01 | 149,524,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package hr.fer.zemris.optjava.dz7.algorithms.swarm;
public interface IInertionScaler {
public double getInertion(int iteration);
}
| [
"sven.njegac@fer.hr"
] | sven.njegac@fer.hr |
ace4c95020090f9b8a90ed68295c2af86a85a6a3 | 5455e5def661a6f7beee944b4bdba98447587839 | /modules/web/src/com/groupstp/workflowstp/web/workflowinstance/dialog/WorkflowStepChooserDialog.java | 0af19397bdf5968d14658362c3261868656ced61 | [] | no_license | bizblocks/workflow-stp | ca3e907ddbc85e22914465a7238a0da04172d3fe | 66d96542b59fa1c51859c7646387a17ab6ef07ee | refs/heads/master | 2022-08-03T19:50:37.482830 | 2019-09-02T06:32:37 | 2019-09-02T06:32:37 | 145,367,679 | 3 | 3 | null | 2022-07-17T10:20:59 | 2018-08-20T04:51:18 | Java | UTF-8 | Java | false | false | 2,475 | java | package com.groupstp.workflowstp.web.workflowinstance.dialog;
import com.groupstp.workflowstp.entity.Step;
import com.groupstp.workflowstp.entity.Workflow;
import com.haulmont.bali.util.ParamsMap;
import com.haulmont.bali.util.Preconditions;
import com.haulmont.cuba.core.global.DataManager;
import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.gui.components.AbstractWindow;
import com.haulmont.cuba.gui.components.Frame;
import com.haulmont.cuba.gui.components.LookupField;
import org.apache.commons.collections4.CollectionUtils;
import javax.inject.Inject;
import java.util.Map;
import java.util.TreeMap;
/**
* Special workflow steps chooser dialog
*
* @author adiatullin
*/
public class WorkflowStepChooserDialog extends AbstractWindow {
private static final String SCREEN_ID = "workflow-step-chooser-dialog";
private static final String WORKFLOW_PARAMETER = "workflow";
/**
* Show to user a dialog to choose the step from the workflow instance
*
* @param frame calling UI frame
* @param workflow current workflow entity
* @return opened dialog
*/
public static WorkflowStepChooserDialog show(Frame frame, Workflow workflow) {
Preconditions.checkNotNullArgument(frame);
Preconditions.checkNotNullArgument(workflow);
return (WorkflowStepChooserDialog) frame.openWindow(SCREEN_ID, WindowManager.OpenType.DIALOG,
ParamsMap.of(WORKFLOW_PARAMETER, workflow));
}
@Inject
protected DataManager dataManager;
@Inject
protected LookupField stepField;
/**
* @return user selected step from provided workflow
*/
public Step getStep() {
return stepField.getValue();
}
@Override
public void init(Map<String, Object> params) {
super.init(params);
initStepField(dataManager.reload((Workflow) params.get(WORKFLOW_PARAMETER), "workflow-edit"));
}
protected void initStepField(Workflow workflow) {
Map<String, Step> options = new TreeMap<>();
if (!CollectionUtils.isEmpty(workflow.getSteps())) {
for (Step step : workflow.getSteps()) {
options.put(step.getStage().getName(), step);
}
}
stepField.setOptionsMap(options);
}
public void onOk() {
if (validateAll()) {
close(COMMIT_ACTION_ID, true);
}
}
public void onCancel() {
close(CLOSE_ACTION_ID, true);
}
}
| [
"gecrepo@gmail.com"
] | gecrepo@gmail.com |
c21c072783789a58fff950d676a0bc4f4f85557e | fb16eb21a1a0aec361109a104311a9402cae1f28 | /spring03pjt-07-modelattr2/src/main/java/yuhan/spring/model3/UserController.java | a0fb15eda2bdd199a7abde031b09ec71bffd9c0e | [] | no_license | ko-itbuddy/study_spring | c5e814c9a2a1a3803dd24539145090f8804c071a | 8020ab976b74feafaa01462b47843ee17019a1eb | refs/heads/master | 2022-06-17T02:23:48.283636 | 2019-10-28T10:41:42 | 2019-10-28T10:41:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,447 | java | package yuhan.spring.model3;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class UserController {
@ModelAttribute("hitCar")
public String[] refHitCar() {//개발자 임의의 함수
return new String[] {"현대차","대우차","쌍용차","기아차"};
}
@RequestMapping(value = "userForm")
public String nuserFrom() {
return "user/userForm1";
}
@RequestMapping(value = "userInfo", method = RequestMethod.POST)
public ModelAndView userSave(UserVo userVo, Model model) {
model.addAttribute("msg","자동차 정보 출력");
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("/user/userForm1");
modelAndView.addObject("userVo",userVo);
return null;
}
@ModelAttribute("userVo")
public UserVo init(HttpServletRequest request) {
if(request.getMethod())
}
@RequestMapping("/userView")
public Model userView() {
// modeldl 상속된 더큰
Model model = new ExtendedModelMap();
model.addAttribute("msg", "자동차 회사 출력 정보");
return model;
}
}
| [
"skvudrms54@gmail.com"
] | skvudrms54@gmail.com |
08090fc90481421c72861935ffd8608c8bea7276 | 2cf5f5c93e6aab8e7b48e3d175d4aebbe3300613 | /src/main/java/swt6/spring/dao/ProjectRepository.java | 93417866d859a06ca8113ba3524bd6aa7aeae9dd | [] | no_license | alexanderkraemer/Spring-Framework | e9c887434ef6f6623c99d46127c2d3dd4377c2f4 | f6f88dfc21229e1f650d0a324f5e55937b00c5d7 | refs/heads/master | 2021-01-23T06:39:55.179804 | 2017-04-02T10:49:55 | 2017-04-02T10:49:55 | 86,387,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 273 | java | package swt6.spring.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import swt6.spring.domain.Project;
@Repository
public interface ProjectRepository extends JpaRepository<Project, Long> {
}
| [
"office@alexanderkraemer.com"
] | office@alexanderkraemer.com |
0d38529781f7138d284a6b8d29f8b348aaf1a6b3 | 530c66eb89559bd0c2a9599f0af75d6cc7588115 | /rrk-common/src/main/java/com/rrk/common/modules/product/dto/DelSkuDtos.java | 46ee61c7dd05d74ffbf6e1c8438966fda7e633f3 | [] | no_license | dinghaoxiaoqin/boot_project | 699ba89c447062675cec50ebe9309924a581a5fe | c328a64900cfc7fd5a0372f36f3b91823100235e | refs/heads/master | 2023-03-04T09:59:25.170392 | 2021-02-14T13:57:14 | 2021-02-14T13:57:14 | 305,099,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 274 | java | package com.rrk.common.modules.product.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @date 2020 7-20
* 批量sku的实体
* @author dinghao
*/
@Data
public class DelSkuDtos implements Serializable {
/**
* ids
*/
private String ids;
}
| [
"1399801745@qq.com"
] | 1399801745@qq.com |
decdf5d5143002b8c2bcdfff098aaca442a8760b | e7754843c75542ada10dc68dcb5691970c4491ae | /app/src/main/java/com/codepath/apps/restclienttemplate/models/Tweet.java | a5f234d901916209539e7ccc30d9a3b130af4ccd | [
"Apache-2.0",
"MIT"
] | permissive | brittenyoko/Mysimpletweets | 25b1d7f5db9d9bbf43b4f5bcac992538544c3de4 | 9e7e8a33e04f50f7b47f9f923e71096370e0d6ce | refs/heads/master | 2020-06-15T11:37:00.468253 | 2019-07-06T01:20:10 | 2019-07-06T01:20:10 | 195,288,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,457 | java | package com.codepath.apps.restclienttemplate.models;
import org.json.JSONException;
import org.json.JSONObject;
import org.parceler.Parcel;
@Parcel
public class Tweet {
// list out the atttributes
public String body;
public long uid; // database ID for the tweet
public User user;
public String createdAt;
public String likes;
public String retweets;
public String mediaUrl;
//public String replies;
// derialize the JSON
public static Tweet fromJSON(JSONObject jsonObject) throws JSONException {
Tweet tweet = new Tweet();
//extract the values from JSON
tweet.body = jsonObject.getString("text");
tweet.uid = jsonObject.getLong("id");
tweet.createdAt = jsonObject.getString("created_at");
tweet.user = User.fromJSON(jsonObject.getJSONObject("user"));
tweet.likes = jsonObject.getString("favorite_count");
tweet.retweets = jsonObject.getString("retweet_count");
if (jsonObject.has("extended_entities")) {
if (jsonObject.getJSONObject("entities").getJSONArray("media").getJSONObject(0).getString("type").equals("photo")) {
tweet.mediaUrl = jsonObject.getJSONObject("extended_entities").getJSONArray("media").getJSONObject(0).getString("media_url_https");
}
}
//tweet.replies = jsonObject.getString("reply_count");
return tweet;
}
public Tweet(){
}
}
| [
"bokoromachuonye@college.harvard.edu"
] | bokoromachuonye@college.harvard.edu |
9c429660aa553ee1a2fb4105c4ff24b0f217df6b | ce8076b19dae2935663c67727813a37a00a3aaef | /src/main/java/com/bidanet/hibernate/lambda/proxy/MapListProxy.java | 8e737a1a086f24510dff5cb8df21e3d4d789f542 | [] | no_license | zeau/lean_pro | ab3a8e0e10436ec9517e5f8c21b2f3db73bdde0f | ddff604aee214ac6df208f8bbd74ae12c254ab2b | refs/heads/master | 2021-01-21T20:42:54.444678 | 2017-05-25T05:32:30 | 2017-05-25T05:32:30 | 92,271,062 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,308 | java | package com.bidanet.hibernate.lambda.proxy;
import com.bidanet.hibernate.lambda.common.PropertyNameTool;
import org.hibernate.sql.JoinType;
import javax.persistence.Entity;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by xuejike on 2017/3/10.
*/
public class MapListProxy extends GeterSeterMethodInterceptor {
protected String prefix="";
protected Map<String,List<Object>> mapList;
protected Map<String,MapListProxy> fieldMapListProxy=new HashMap<>(1);
protected Map<String,JoinType> joinFieldMap=new HashMap<>(1);
public MapListProxy(Map<String, List<Object>> mapList) {
this.mapList = mapList;
}
public MapListProxy() {
this.mapList=new HashMap<>();
}
public MapListProxy(String prefix, Map<String, List<Object>> mapList) {
this.prefix = prefix;
this.mapList = mapList;
}
public Map<String, List<Object>> getMapList() {
return mapList;
}
@Override
public void execSeterMethod(Object obj, Method method, String property, Object val) {
List<Object> list = mapList.get(property);
if (list==null){
list= new ArrayList<Object>();
mapList.put(prefix+property,list);
}
if (list.indexOf(val)<0){
list.add(val);
}
}
@Override
public Object execGeterMethod(Object obj, Method method, String property, Object val) {
// super.execGeterMethod(obj, method, property, val);
if (method.getReturnType()!=List.class){
Entity entity = method.getReturnType().getDeclaredAnnotation(Entity.class);
if (entity!=null){
JoinType joinType = JoinType.INNER_JOIN;
joinFieldMap.put(property,joinType);
MapListProxy mapListProxy = fieldMapListProxy.get(property);
if (mapListProxy==null){
mapListProxy=new MapListProxy(PropertyNameTool.JOIN_ALIAS_PREFIX+property+".",mapList);
}
return Proxy.proxy(method.getReturnType(),mapListProxy);
}
}
return val;
}
public Map<String, JoinType> getJoinFieldMap() {
return joinFieldMap;
}
}
| [
"zeau163@163.com"
] | zeau163@163.com |
5036badab0f0469e46f14c9c5268721370400ad6 | a4dbcc4303506c650eee618fdb4249f06fe0b98e | /cjsj-oa/seal/src/main/java/cn/cjsj/im/utils/WebViewCacheClearUtil.java | a3fca052ac4ded2f54161a6553b57808ddebcf3f | [
"MIT"
] | permissive | JoshuaRuo/test | 9a03d2779c6d7c36402d851d85c8cfb60d892b3a | 4563d1f195c83da78d2e7e8bc1614c0263dfa579 | refs/heads/master | 2020-04-14T11:35:42.994124 | 2019-02-12T08:57:42 | 2019-02-12T08:57:42 | 163,818,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package cn.cjsj.im.utils;
import android.content.Context;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebView;
/**
* Created by LuoYang on 2018/8/28 11:04
*
* 清楚WebView缓存
*/
public class WebViewCacheClearUtil {
public static void clearCache(WebView webView, Context context) {
//清空所有Cookie
CookieSyncManager.createInstance(context); //Create a singleton CookieSyncManager within a context
CookieManager cookieManager = CookieManager.getInstance(); // the singleton CookieManager instance
cookieManager.removeAllCookie();// Removes all cookies.
CookieSyncManager.getInstance().sync(); // forces sync manager to sync now
webView.setWebChromeClient(null);
webView.setWebViewClient(null);
webView.getSettings().setJavaScriptEnabled(false);
webView.clearCache(true);
}
}
| [
"123456"
] | 123456 |
b073a37a9724fd2002ad656cdeaa168c0e1b59c8 | cd30065b4026712d3ad828dea58acaa0606d3205 | /jse/src/oop04/abstraction/ProductController.java | 87cf4f0c9f18538f6e0f0f14cde240ef7ac1cce2 | [] | no_license | vneld110/jse2 | 413e81352052c15ee94b79c60ec0589e127dbbd9 | 74c9d0a17d1b5fcafc9291fb3b76e5002e1a16e6 | refs/heads/master | 2020-05-20T16:52:54.241777 | 2015-05-26T12:50:24 | 2015-05-26T12:50:24 | 35,476,449 | 0 | 10 | null | null | null | null | UHC | Java | false | false | 578 | java | package oop04.abstraction;
public class ProductController {
public static void main(String[] args) {
ComputerInfo ci = new ComputerInfo();
ci.setComputerInfo("삼성", "센스", "a-1234-4567", "DUAL-CORE", "8G", "500GB");
ci.displayProductInfo();
System.out.println();
TVInfo ti = new TVInfo();
/* 메소드 호출
TV정보
회사 : LG
제품명 : X캔버스
제품ID : x-1234
화면사이즈 : 42인치
화면비율 : 16:9
*/
ti.setTVInfo("LG", "X캔버스", "x-1234", "42인치", "16:9");
ti.displayProductInfo();
}
}
| [
"취업반PM@ITBANK23"
] | 취업반PM@ITBANK23 |
ae65b4649f2691393028abc6bb6bec5e862ece1b | 2bc492417f557300e37feb73a4812b3a4bf1ef8c | /user-service/src/main/java/com/plantify/user/service/UserServiceImpl.java | f87421009f9740fec31bac75cf6471afadabd1cc | [] | no_license | saif7159/Plantify | 0295f0467575335379f7cceec56c6cdf0fe13d22 | a3a5cfb18b437b86298284c60e9857a88ba86b74 | refs/heads/master | 2022-12-02T01:49:27.971222 | 2020-08-19T16:05:42 | 2020-08-19T16:05:42 | 288,039,605 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package com.plantify.user.service;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.plantify.user.dao.UserDetailsDao;
import com.plantify.user.model.Login;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserDetailsDao userdao;
@Override
public Login createUser(Login login) {
return userdao.save(login);
}
@Override
public Optional<Login> getUser(int id) {
return userdao.findById(id);
}
@Override
public Login findByEmail(String email) {
return userdao.findByEmail(email);
}
}
| [
"saiful.haque@cognizant.com"
] | saiful.haque@cognizant.com |
89e69610a4a6c90be81eb2b5ba386a19f2346ced | fb103b2e18c51be2f9c99dba08246393bdf03908 | /src/org/bee/tl/samples/CaseFunction.java | 8165e30ad90d74072be49349bae12dd359962b8a | [] | no_license | xiandafu/beetl1.2 | 4482c391388eb897300eba26cebb228bd2358e1e | e842250d571350ef4ae69695a304beaa461cfe93 | refs/heads/master | 2021-01-15T22:15:07.203977 | 2013-08-31T05:41:30 | 2013-08-31T05:41:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,136 | java | /*
[The "BSD license"]
Copyright (c) 2011-2013 Joel Li (李家智)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.bee.tl.samples;
import org.bee.tl.core.Context;
import org.bee.tl.core.Function;
public class CaseFunction implements Function {
public Object call(Object[] paras, Context ctx) {
boolean hasDefault = true;
int size = paras.length;
if (paras.length % 2 == 1) {
hasDefault = false;
} else {
size = size - 1;
}
Object o = paras[0];
for (int i = 1; i < size; i++) {
if (o.equals(paras[i])) {
return paras[i + 1];
} else {
i++;
}
}
if (hasDefault) {
return paras[paras.length - 1];
} else {
throw new RuntimeException("没有找到匹配的值");
}
}
}
| [
"javamonkey@163.com"
] | javamonkey@163.com |
e8f1e7c03d10ac9f0e8932ae3942234b19bbdc1f | c83a779824f3f7bdc2e19fc0b4b0dd102eb42f99 | /src/Lexer.java | adbfa857262d866f709dc4bc698e89963896f56d | [] | no_license | harshithapr/Inference-Engine | 14ce2cc404b50989c8eac7a227e0abbee6575554 | cd3948d18da71c4e4d722a8c746ca2d088dfe7ea | refs/heads/master | 2020-12-02T09:56:55.058556 | 2017-07-09T06:17:11 | 2017-07-09T06:17:11 | 96,665,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,524 | java |
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Lexer
{
String pattern;
Lexer(String pattern)
{
this.pattern=pattern;
}
public ArrayList<Token> getTokens(String line)
{
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(line);
int i=0;
char[] buffer=line.toCharArray();
ArrayList<Token> tokens=new ArrayList<Token>();
while(i<line.length())
{
if(buffer[i]=='~')
{
tokens.add(new Token(TokenTypes.NEG,"~"));
i++;
}
else if(buffer[i]=='&')
{
tokens.add(new Token(TokenTypes.AND,"&"));
i++;
}
else if(buffer[i]=='|')
{
tokens.add(new Token(TokenTypes.OR,"|"));
i++;
}
else if(buffer[i]=='=' && buffer[i+1]=='>')
{
tokens.add(new Token(TokenTypes.IMP,"=>"));
i=i+2;
}
else if(buffer[i]=='(')
{
tokens.add(new Token(TokenTypes.LPAREN,"("));
i++;
}
else if(buffer[i]==')')
{
tokens.add(new Token(TokenTypes.RPAREN,")"));
i++;
}
else if(buffer[i]==' ')
{
i++;
}
else
{
m.find();
tokens.add(new Token(TokenTypes.SYMB,line.substring(m.start(),m.end())));
i=m.end();
}
}
return tokens;
}
}
| [
"hparames@usc.edu"
] | hparames@usc.edu |
b2b39f65d51e7be9c95d6eb6bfcf70a6de786061 | 2fd5b17cc26990aff0dd9d32fc8ab599c20e3576 | /src/main/java/com/ochafik/swing/ui/SimplisticProgressBarUI.java | ac63c81b803d662a34a4189a4dbd178fcde48962 | [
"MIT"
] | permissive | ochafik/nabab | fddbee030fb51fe00813b23b9b2e112256d09097 | 38ca6bc1f8946a29648b9c26806071202b5968a0 | refs/heads/master | 2020-04-05T23:28:03.141113 | 2016-12-13T02:28:21 | 2016-12-13T02:28:21 | 1,278,011 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,924 | java | /*
* Copyright (C) 2006-2011 by Olivier Chafik (http://ochafik.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.ochafik.swing.ui;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Paint;
import javax.swing.JComponent;
import javax.swing.JProgressBar;
import javax.swing.plaf.ProgressBarUI;
import com.ochafik.util.listenable.Pair;
public class SimplisticProgressBarUI extends ProgressBarUI {
Dimension preferredSize;
static boolean useGradients;
static {
useGradients = System.getProperty("ochafik.swing.ui.useGradients", "true").equals("true");
};
public SimplisticProgressBarUI(Dimension preferredSize) {
this.preferredSize = preferredSize;
}
@Override
public Dimension getPreferredSize(JComponent c) {
Insets in = c.getInsets();
return new Dimension(preferredSize.width + in.left + in.right, preferredSize.height + in.top + in.bottom);
}
@Override
public void installUI(JComponent c) {
c.setOpaque(false);
}
static Color brighter(Color color) {
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
float deltaS = 0 , deltaB = 0.1f;//05f;
return Color.getHSBColor(hsb[0], hsb[1]-deltaS, hsb[2]+deltaB);
}
static Pair<Color,Color> darkerBrighter(Color color) {
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
float deltaS = 0 , deltaB = 0.1f;//05f;
return new Pair<Color,Color>(Color.getHSBColor(hsb[0], hsb[1]+deltaS, hsb[2]-deltaB),Color.getHSBColor(hsb[0], hsb[1]-deltaS, hsb[2]+deltaB));
}
GradientPaint cachedPaint;
Color cachedBaseColor;
int cachedBarWidth;
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2d = (Graphics2D)g;
JProgressBar bar = (JProgressBar)c;
Dimension size = bar.getSize();
Insets in = bar.getInsets();
double p = bar.getPercentComplete();
Color color = bar.getForeground();
int x = in.left, y = in.top, w = size.width - in.left - in.right, h = size.height - in.top - in.bottom;
int barWidth = p < 0.5 ? (int)Math.ceil((w-2) * p) : (int)((w-2) * p);
Paint oldPaint = null;
if (useGradients) {
GradientPaint paint = cachedPaint;
if (cachedBaseColor == null || !cachedBaseColor.equals(color) || cachedBarWidth != barWidth) {
Pair<Color,Color> darkerBrighter = darkerBrighter(cachedBaseColor = color);
cachedBarWidth = barWidth;
paint = cachedPaint = new GradientPaint(x+1,y, darkerBrighter.getSecond(), x+barWidth, y, darkerBrighter.getFirst());
}
oldPaint = g2d.getPaint();
g2d.setPaint(paint);
} else {
g2d.setColor(color);
}
g2d.fillRect(x+1, y, barWidth+1, h);
if (useGradients) {
g2d.setPaint(oldPaint);
g2d.setColor(color);
}
g2d.setColor(color);
g2d.drawRect(x, y, w, h);
}
}
| [
"olivier.chafik@gmail.com"
] | olivier.chafik@gmail.com |
d9297a05ba2485f97aa50dd5d6c328551a216534 | bf3ffe4db975c59733ee137151a4c775bd9e06f1 | /SelFrameAugust/src/main/java/tests/FirstTestCase.java | 8748d7453b47312076c36295a8287631ace5815d | [] | no_license | RineshS/POM-Model-Framework | 88d59f70dd5dc35884ca3da65a7a514d8f906e7e | e1d6369011f6532ad04311a3c7978df3886cdae8 | refs/heads/master | 2021-01-20T04:58:20.571137 | 2017-08-26T08:56:08 | 2017-08-26T08:56:08 | 101,402,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,492 | java | package tests;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
public class FirstTestCase {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
// Using chrome driver
/*System.setProperty("webdriver.chrome.driver","./drivers/chromedriver.exe");
WebDriver driver = new ChromeDriver();*/
//Using IE Driver
System.setProperty("webdriver.ie.driver", "./drivers/IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.get("http://leaftaps.com/opentaps");
driver.manage().window().maximize();
driver.findElement(By.id("username")).sendKeys("DemoSalesManager");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("crmsfa");
driver.findElement(By.xpath("//input[@value='Login']")).click();
driver.findElement(By.linkText("CRM/SFA")).click();
driver.findElement(By.linkText("Leads")).click();
driver.findElement(By.linkText("Find Leads")).click();
driver.findElement(By.xpath("(//input[@name='firstName'])[3]")).sendKeys("bb");
driver.findElement(By.xpath("//button[text()='Find Leads']")).click();
//driver.findElement(By.name("firstName")).sendKeys("yassar");
Thread.sleep(5000);
driver.findElement(By.xpath("//div[@class='x-grid3-cell-inner x-grid3-col-partyId']/a")).click();
String title = driver.getTitle();
if(title.equalsIgnoreCase("View Lead | opentaps CRM")){
driver.findElement(By.linkText("Edit")).click();
driver.findElement(By.id("updateLeadForm_companyName")).clear();
driver.findElement(By.id("updateLeadForm_companyName")).sendKeys("Glencore");
driver.findElement(By.xpath("//input[@value='Update']")).click();
String companyName = driver.findElement(By.id("viewLead_companyName_sp")).getText();
if(companyName.contains("Glencore")){
System.out.println("The Company Name is updated");
}
}
else{
System.out.println("The Title did not match");
}
driver.close();
}
}
| [
"rineshkhanna89@yahoo.com"
] | rineshkhanna89@yahoo.com |
74fd8402e630a2b1c5e5620876cee734e781c7b8 | 440e5bff3d6aaed4b07eca7f88f41dd496911c6b | /myapplication/src/main/java/com/tencent/open/b/c.java | e2c498f8f5cdf9201c44a3a5197b09abf2d247d5 | [] | no_license | freemanZYQ/GoogleRankingHook | 4d4968cf6b2a6c79335b3ba41c1c9b80e964ddd3 | bf9affd70913127f4cd0f374620487b7e39b20bc | refs/heads/master | 2021-04-29T06:55:00.833701 | 2018-01-05T06:14:34 | 2018-01-05T06:14:34 | 77,991,340 | 7 | 5 | null | null | null | null | UTF-8 | Java | false | false | 4,575 | java | package com.tencent.open.b;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Environment;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import com.baidu.mobads.interfaces.utils.IXAdSystemUtils;
import com.tencent.open.a.j;
import com.tencent.open.d.e;
import java.util.Locale;
public class c {
static String a = null;
static String b = null;
static String c = null;
private static String d;
private static String e = null;
public static String a() {
try {
Context a = e.a();
if (a == null) {
return "";
}
WifiManager wifiManager = (WifiManager) a.getSystemService(IXAdSystemUtils.NT_WIFI);
if (wifiManager == null) {
return "";
}
WifiInfo connectionInfo = wifiManager.getConnectionInfo();
return connectionInfo == null ? "" : connectionInfo.getMacAddress();
} catch (Throwable e) {
j.a("openSDK_LOG.MobileInfoUtil", "getLocalMacAddress>>>", e);
return "";
}
}
public static String a(Context context) {
if (!TextUtils.isEmpty(d)) {
return d;
}
if (context == null) {
return "";
}
d = "";
WindowManager windowManager = (WindowManager) context.getSystemService("window");
if (windowManager != null) {
int width = windowManager.getDefaultDisplay().getWidth();
d = width + "x" + windowManager.getDefaultDisplay().getHeight();
}
return d;
}
public static String b() {
return Locale.getDefault().getLanguage();
}
public static String b(Context context) {
if (a != null && a.length() > 0) {
return a;
}
if (context == null) {
return "";
}
try {
a = ((TelephonyManager) context.getSystemService("phone")).getDeviceId();
return a;
} catch (Exception e) {
return "";
}
}
public static String c(Context context) {
if (b != null && b.length() > 0) {
return b;
}
if (context == null) {
return "";
}
try {
b = ((TelephonyManager) context.getSystemService("phone")).getSimSerialNumber();
return b;
} catch (Exception e) {
return "";
}
}
public static String d(Context context) {
if (c != null && c.length() > 0) {
return c;
}
if (context == null) {
return "";
}
try {
c = Secure.getString(context.getContentResolver(), "android_id");
return c;
} catch (Exception e) {
return "";
}
}
public static String e(Context context) {
try {
if (e == null) {
WindowManager windowManager = (WindowManager) context.getSystemService("window");
DisplayMetrics displayMetrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("imei=").append(b(context)).append('&');
stringBuilder.append("model=").append(Build.MODEL).append('&');
stringBuilder.append("os=").append(VERSION.RELEASE).append('&');
stringBuilder.append("apilevel=").append(VERSION.SDK_INT).append('&');
String b = a.b(context);
if (b == null) {
b = "";
}
stringBuilder.append("network=").append(b).append('&');
stringBuilder.append("sdcard=").append(Environment.getExternalStorageState().equals("mounted") ? 1 : 0).append('&');
stringBuilder.append("display=").append(displayMetrics.widthPixels).append('*').append(displayMetrics.heightPixels).append('&');
stringBuilder.append("manu=").append(Build.MANUFACTURER).append("&");
stringBuilder.append("wifi=").append(a.e(context));
e = stringBuilder.toString();
}
return e;
} catch (Exception e) {
return null;
}
}
}
| [
"zhengyuqin@youmi.net"
] | zhengyuqin@youmi.net |
060e5d04a6fc9d4861023f11039ab65db8f13a8e | 39bb67d27c696a47e82ced53bb77a8cce9b87d7f | /src/design_mode/observer/test/Test.java | f704d63fa13dee0bb90c5b5aa341ca8378f460d0 | [] | no_license | Automannn/designMode | 1976a3b64c105c089cb847de9774f98180e7357a | a5d2516f1c583afabacac6b617eb14091ddfa6f4 | refs/heads/master | 2020-03-30T12:27:54.029735 | 2018-10-02T09:11:41 | 2018-10-02T09:12:20 | 151,225,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,791 | java | package design_mode.observer.test;
import com.automannn.design_mode.observer.OOP_class.Bridge;
import com.automannn.design_mode.observer.OOP_class.ShieldBuilder;
import com.automannn.design_mode.observer.OOP_class.VehicleAbstractFactory;
import com.automannn.design_mode.observer.OOP_class.WeaponIterator;
import com.automannn.design_mode.observer.OOP_interface.AnswerPhone;
import com.automannn.design_mode.observer.OOP_interface.Observer;
import com.automannn.design_mode.observer.OOP_interface.Weapon;
import com.automannn.design_mode.observer.entity_alive.*;
import com.automannn.design_mode.observer.entity_logicalOperation.*;
import com.automannn.design_mode.observer.entity_nonliving.*;
import com.automannn.design_mode.observer.exception.SingletonException;
/**
* @author automannn@163.com
* @time 2018/9/13 15:06
*/
public class Test {
static LongGe longGe= new LongGe();
public static void main(String[] args) {
//龙哥的适配管理器
AdapterManager am = new AdapterManager();
new Thread(am).start();
YuGe yuGe = new YuGe();
//龙哥通过迭代器的方式拿武器,于哥不知道它的车身到底有什么武器
WeaponIterator wp = longGe.weaponItertor();
//因为武器在车上,所以龙哥可以拿来攻击
while (wp.haseNext()){
Weapon weapon = (Weapon) wp.next();
System.out.print(longGe.getName()+": ");
weapon.attack();
}
//于哥有些慌张,想要去龙哥的车子抢夺刀,后者斧子,或者枪
System.out.println(yuGe.getName()+"愤然反抗,去车里抢夺 刀,或者 枪, 或者 斧子");
//这时候,于哥不知道总共有什么武器和多少武器,于是随便去拿
try {
//做好了拿刀的手势,却发现是斧子...
Knife knife = (Knife) longGe.getBmw_car().getWeapon(0);
}catch (ClassCastException e){
System.out.print(yuGe.getName()+": ");
System.out.println("迭代器模式真是厉害,我甘拜下风。");
}
//突然龙哥的刀掉了,情急之下,忘记了自己的宝马车上有哪些武器
WeaponDescriptor descriptor= new WeaponDescriptor(60.0f,300.0f);
longGe.setAdapter(new WeaponAdapter(descriptor));
longGe.setAssosation(am);
longGe.AssosationDo();
//龙哥使用适配器模式,拿到了一把枪,可是他不知道怎么用,于是按照枪使用的模板使用
System.out.println(longGe.getName()+"通过模板模式,使用枪支:");
Weapon wpp = am.getWeapon();
try {
Gun gg = (Gun) wpp;
new SimpleGunTemplate().run();
}catch (ClassCastException e){
System.out.println("适配器出错!");
}
//于哥发现龙哥欺人太甚了,想用点什么来防御一下,但是自己制作太费时间,于是使用工厂模式生产防弹衣
ArmorFactory armorFactory = new ArmorFactory();
armorFactory.produceWithCahce();
yuGe.setArmor((Armor) armorFactory.getProduct());
System.out.print(yuGe.getName()+" 通过 工厂模式 生产的 ");
yuGe.getArmor().run();
//在打斗中,于哥发现旁边旁边有个台阶,于是站上去以便更好的防御
try {
HighStep highStep = HighStep.getInstance(yuGe);
} catch (SingletonException e) {
System.out.println(e.getMessage());
}
//龙哥本来就比于哥矮,于是肯定不甘心,于是追着站上去
try {
HighStep highStep = HighStep.getInstance(longGe);
} catch (SingletonException e) {
System.out.println(e.getMessage());
}
System.out.println("龙哥不甘心,开始想象要是自己先站上去就好了");
System.out.println("龙哥开始想象:~~~~");
//于哥发现站不上去了,脑海中想着要是有个分身先站上去就好了
//以下是他的想象:
new Thread(()->{
try {
HighStepThreadSafe highStepThreadSafe = HighStepThreadSafe.getInstance(longGe);
} catch (Exception e) {
System.out.println("~~~~"+e.getMessage());
}
}).start();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
HighStepThreadSafe highStepThreadSafe = HighStepThreadSafe.getInstance(yuGe);
} catch (Exception e) {
System.out.println("~~~~"+e.getMessage());
}
System.out.println("-------------------------");
//于哥发现掉血有点严重,再通过工厂模式生产防弹衣代价太大,于是通过原型模式复制一个防弹衣就ok了
ArmorPrototypeManager armorPrototypeManager= new ArmorPrototypeManager();
armorPrototypeManager.register("newArmor",yuGe.getArmor());
Armor newArmor= (Armor) armorPrototypeManager.create("newArmor");
System.out.println(yuGe.getName()+" 通过原型模式,复制了一个防弹衣");
newArmor.run();
//于哥决定防弹衣不行,还得弄个盾牌
Shield shield = new Shield();
shield.run();
System.out.println("这个盾牌太low了,需要一个更强大的");
//于哥用通过了一个盾牌构造器构造一个盾牌
System.out.println("使用盾牌构造器");
ShieldBuilder shieldBuilder = new ShieldBuilder();
Shield shield1= shieldBuilder.addParam("金刚石组成").addParam("具有条纹").addParam("可以防子弹").build();
shield1.run();
//他们都有点累了,心想回车里坐一下吧,于是通过抽象工厂,龙哥召唤出小汽车,于哥召唤出摩托车
VehicleAbstractFactory carFactory= VehicleAbstractFactory.getFactory("com.automannn.design_mode.observer." +
"entity_logicalOperation.CarFactory");
carFactory.createShell();
carFactory.createWheel();
System.out.println(longGe.getName()+" 坐骑:");
carFactory.run();
VehicleAbstractFactory carFactory1= VehicleAbstractFactory.getFactory("com.automannn.design_mode.observer." +
"entity_logicalOperation.MotorFactory");
carFactory1.createShell();
carFactory1.createWheel();
System.out.println(yuGe.getName() +" 坐骑:");
carFactory1.run();
//龙哥觉得工厂造出来的车子不舒服,还是自己的宝马车安逸
//并且使用了装饰器模式,洋洋洒洒的一通操作
System.out.println("龙哥选择了他的宝马车,并用装饰器模式一顿操作猛如虎");
new CarDecorator(longGe.getBmw_car()).run();
//于哥觉得比较明智的就是报警,可由于自己放不开手,于是只能委托一个路人报警
new HelperPersonProxy(yuGe).help();
//突然前面遇到了一个红绿灯,龙哥害怕呀, 因为他不知道交通规则 于是使用门面模式,才得以安全过去
System.out.println("龙哥,通过门面模式,通过一个红绿灯路口转弯");
new CrossRoadFacade().cross();
//这个时候,路边有个卖冰淇凌的。 龙哥和于哥都想买
Bridge bridge = new SpoonBridge();
System.out.println("于哥想要吃粘稠一点的冰激凌,通过桥接模式:");
bridge.setSpoon(new SpoonLiquid());
bridge.run();
System.out.println("龙哥想要吃干一点的冰激凌,通过桥接模式:");
bridge.setSpoon(new SpoonSolid());
bridge.run();
//龙哥掏出了他的手机, 准备叫小弟
System.out.println(longGe.getName()+"掏出了手机:");
Phone aifeng= new Phone("爱疯叉");
aifeng.addCorePart(new Phone.Part("A8处理器"));
aifeng.addCorePart(new Phone.Part("定制主板"));
aifeng.addOtherParts(new Phone.Part("定制电池"));
aifeng.setShell(new Phone.Part("金属外壳"));
aifeng.run();
//在这种情况,如果下雨,
System.out.println("下雨了。。。");
yuGe.setStation("雨天");
yuGe.stationDo();
System.out.println("天晴了。。。");
longGe.setStation("晴天");
longGe.stationDo();
//这时候龙哥的电话被小弟接到了
AnswerPhone answerPhone = new Xiaodi("");
answerPhone.answer();
answerPhone = new Xiaodi("心情好");
answerPhone.answer();
//这时候警局的电话正被警元小张,和 小李观察,监听着电话
FixedTelephone fixedTelephone = new FixedTelephone();
fixedTelephone.addObserver( new Xiaoli());
fixedTelephone.addObserver( new Xiaozhang());
fixedTelephone.operate();
}
public static class Trigger{
MessageQueue queue= new MessageQueue();
public void trigger(){
queue.cacheMessage();
}
}
private static class AdapterManager extends Trigger implements Runnable{
private Weapon weapon;
@Override
public void run() {
while (true){
if (queue.hasMessage()&& longGe.getAdapter()!=null){
weapon = (Weapon) longGe.getAdapter().getTarget();
System.out.print(longGe.getName()+" 通过适配器取得了武器。又开始了攻击");
weapon.attack();
}
}
}
public Weapon getWeapon() {
return weapon;
}
}
private static class MessageQueue{
//接收五个信号用作缓冲,,这里没有用到,但是它逻辑上是存在的
boolean[] bb = new boolean[5];
//以0 记录队列头
int top =0;
//游标,控制队列的位置
int corsor=0;
private void cacheMessage(){
//bb[corsor]=true;
move();
}
public boolean hasMessage(){
if (top == corsor) return false;
Tmove();
return true;
}
//定义浮标移动的方式
private void move(){
//若当前的游标已经到达线性尾部,则回到头部
if ((corsor+1)%5==0){
corsor=0;
return;
}
corsor++;
}
private void Tmove(){
//若当前的游标已经到达线性尾部,则回到头部
if ((top+1)%5==0){
top=0;
return;
}
top++;
}
}
}
| [
"Automannn@163.com"
] | Automannn@163.com |
ae5836d91458220994ed5f996c3eb5a385e1003f | 63de443b4085584967682007c41063efa60d6daa | /com.phponacid.contacts.common/src/main/java/com/phponacid/contacts/common/util/CommonDateUtils.java | 6fa426be7d598cd97df90d0e794edd507744b355 | [] | no_license | topherPedersen/AlternativeDialerFork | 4f28cb061e95e12bf1c3000df4e291df34fe1704 | b98e837c1666471fbed69d44548cbcca6e22ca6f | refs/heads/master | 2021-01-24T03:48:14.199162 | 2018-02-26T03:04:54 | 2018-02-26T03:04:54 | 122,905,223 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,494 | java | /*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.phponacid.contacts.common.util;
import java.text.SimpleDateFormat;
import java.util.Locale;
/**
* Common date utilities.
*/
public class CommonDateUtils {
// All the SimpleDateFormats in this class use the UTC timezone
public static final SimpleDateFormat NO_YEAR_DATE_FORMAT =
new SimpleDateFormat("--MM-dd", Locale.US);
public static final SimpleDateFormat FULL_DATE_FORMAT =
new SimpleDateFormat("yyyy-MM-dd", Locale.US);
public static final SimpleDateFormat DATE_AND_TIME_FORMAT =
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
public static final SimpleDateFormat NO_YEAR_DATE_AND_TIME_FORMAT =
new SimpleDateFormat("--MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
/**
* Exchange requires 8:00 for birthdays
*/
public final static int DEFAULT_HOUR = 8;
}
| [
"15feetaway"
] | 15feetaway |
a0172a6bcfbd7f80639ff885c926e4edb56e2df0 | 775a0c4bb5e492b2c950040e709bb0dafc0dc683 | /java110-spring-ioc/src/main/java/ex11/step4/Test03.java | 3dc73b7479343df87fd79a333bae11384277c12a | [] | no_license | SOO-1/java110 | 99f4c2b7d0a46e4da4b625d11871e4c405afa7d4 | 22e3b6ff88c2a73a5ccbc8b251df85d9879b56a5 | refs/heads/master | 2020-03-27T21:41:36.358050 | 2018-11-06T06:18:39 | 2018-11-06T06:18:39 | 147,168,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,441 | java | // AOP : 다양한 AOP 설정 방법
package ex11.step4;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test03 {
// app-context-?.xml 파일을 확인하라!
public static void main(String[] args) {
ApplicationContext iocContainer =
new ClassPathXmlApplicationContext("ex11/step4/app-context-3.xml");
// IoC 컨테이너에 들어있는 객체의 목록 출력하기
printObjectList(iocContainer);
Service proxy = (Service)iocContainer.getBean(Service.class);
proxy.add();
proxy.update();
proxy.delete();
proxy.list();
proxy.addPhoto();
}
public static void printObjectList(ApplicationContext iocContainer) {
System.out.println("===========================");
// 컨테이너에 들어 있는 객체의 갯수와 이름 알아내기
int count = iocContainer.getBeanDefinitionCount();
System.out.printf("bean 갯수 = %d\n", count);
String[] names = iocContainer.getBeanDefinitionNames();
for(String name : names) {
System.out.printf("==> %s : %s\n",
name,
iocContainer.getType(name).getName());
}
System.out.println("===========================");
}
}
| [
"sjchoi0408@hanmail.net"
] | sjchoi0408@hanmail.net |
c851fd7a3cece08d4ac265278de98d3b0184652a | acf7a28473eb2186dc40f069fa5b8a6a673ee8d3 | /src/com/desklampstudios/edab/GoogleOAuthClient.java | 6a440cd15cd3c5434106478a12895233a3294772 | [
"BSD-3-Clause"
] | permissive | gengkev/eDAB | 4f196ea23edf75619b234f76a1ed9039fbea105a | f4c19a27329f3e19c5edd5811abc31a2edbaaeb6 | refs/heads/master | 2021-01-10T18:54:35.577532 | 2015-04-05T05:41:04 | 2015-04-05T05:41:04 | 7,462,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,777 | java | package com.desklampstudios.edab;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.UriBuilder;
import com.desklampstudios.edab.User.Gender;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class GoogleOAuthClient {
private static final Logger log = Logger.getLogger(GoogleOAuthClient.class.getName());
private static final String LOGIN_PATH = "/logincallback";
private static final String SCOPES = "profile email";
private static final String AUTH_ENDPOINT = "https://accounts.google.com/o/oauth2/auth";
private static final String TOKEN_ENDPOINT = "https://accounts.google.com/o/oauth2/token";
private static final String PROFILE_ENDPOINT = "https://www.googleapis.com/plus/v1/people/me";
/*
protected static String getRedirectURL() {
if (LoginCallbackServlet.isProduction) {
return getRedirectURL(SERVER_HOST);
} else {
return getRedirectURL(DEBUG_HOST);
}
}
*/
protected static String getRedirectURL(String host) {
return host + LOGIN_PATH;
}
protected static String getRequestHost(HttpServletRequest req) {
return req.getScheme() + "://" +
req.getServerName() + ":" +
req.getServerPort();
}
protected static String getEndpointURL(String host, String csrfToken) {
UriBuilder uri = UriBuilder.fromUri(AUTH_ENDPOINT);
uri.queryParam("response_type", "code");
uri.queryParam("client_id", Config.CLIENT_ID);
uri.queryParam("redirect_uri", getRedirectURL(host));
uri.queryParam("scope", SCOPES);
uri.queryParam("hd", "fcpsschools.net");
uri.queryParam("state", csrfToken);
return uri.build().toString();
}
protected static String getAccessToken(String authCode, String host) throws Exception {
// Open the connection to the access token thing
UriBuilder uri = UriBuilder.fromPath("");
uri.queryParam("code", authCode);
uri.queryParam("client_id", Config.CLIENT_ID);
uri.queryParam("client_secret", Config.CLIENT_SECRET);
uri.queryParam("redirect_uri", getRedirectURL(host));
uri.queryParam("grant_type", "authorization_code");
// substring(1) to get rid of the ? that's found in urls
String params = uri.build().toString().substring(1);
String output = null;
try {
output = Utils.fetchURL(
"POST",
TOKEN_ENDPOINT,
params,
"application/x-www-form-urlencoded;charset=UTF-8");
} catch (IOException e) {
throw e;
}
log.log(Level.FINER, "Google OAuth2 Token endpoint returned:\n" + output);
// Parse the JSON.
// TODO: Take advantage of the JWT.
String access_token = null;
try {
ObjectMapper m = new ObjectMapper();
JsonNode rootNode = m.readTree(output);
access_token = rootNode.path("access_token").textValue();
} catch (Exception e) {
log.log(Level.INFO, "Error parsing JSON:\n" + output);
throw e;
}
if (access_token == null) {
log.log(Level.WARNING, "No access token found in JSON:\n" + output);
throw new Exception("No access token found in JSON!");
}
return access_token;
}
protected static User getUserData(String access_token) throws Exception {
// Call Google+ API people.get endpoint.
String input = null;
HttpURLConnection connection = null;
try {
URL url = new URL(PROFILE_ENDPOINT);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer " + access_token);
} catch (IOException e) {
throw e;
}
// Send connection
input = Utils.readInputStream(connection.getInputStream());
log.log(Level.FINER, "Google people.get endpoint returned:\n" + input);
// Parse the JSON.
String id, name, email, gender;
try {
ObjectMapper m = new ObjectMapper();
JsonNode rootNode = m.readTree(input);
id = rootNode.path("id").textValue();
name = rootNode.path("displayName").textValue();
email = rootNode.path("emails").get(0).path("value").textValue();
gender = rootNode.path("gender").textValue();
if (name == null || email == null) {
throw new Exception("missing fields");
}
// must be fcpsschools.net
if (email.length() < 16 || !email.substring(email.length() - 16).equalsIgnoreCase("@fcpsschools.net")) {
throw new Exception("Invalid email address: " + email);
}
} catch (Exception e) {
log.log(Level.INFO, "JSON that failed: " + input);
throw e;
}
User user = new User(id);
user.name = name;
user.real_name = name;
user.fcps_id = email.substring(0, email.length() - 16);
if (gender != null) {
user.gender = Gender.valueOf(gender.toUpperCase());
}
return user;
}
}
| [
"gengkev@gmail.com"
] | gengkev@gmail.com |
74dacdfc526bd0c90d46be9912aefeb9e64f72d5 | 380d75d9b13f359ab5d699eea8d2968608df91e3 | /LubanCustom/app/src/main/java/com/lubandj/master/utils/SPUtils.java | 52714911bcac2b82f9754cfc4e441cb699751f81 | [] | no_license | zhaoshuzhen01/project | 52e02711686f734bb7036c714510bb5343030e08 | 9f9a8e918dfe59e02ada0983e86f8d7eb9be70e8 | refs/heads/master | 2021-09-14T13:54:19.688454 | 2018-05-14T16:10:44 | 2018-05-14T16:10:44 | 111,704,036 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 11,193 | java | package com.lubandj.master.utils;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.v4.util.SimpleArrayMap;
import com.lubandj.master.TApplication;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/08/02
* desc : SP 相关工具类
* </pre>
*/
@SuppressLint("ApplySharedPref")
public final class SPUtils {
private static SimpleArrayMap<String, SPUtils> SP_UTILS_MAP = new SimpleArrayMap<>();
private SharedPreferences sp;
/**
* 获取 SP 实例
*
* @return {@link SPUtils}
*/
public static SPUtils getInstance() {
return getInstance("");
}
/**
* 获取 SP 实例
*
* @param spName sp 名
* @return {@link SPUtils}
*/
public static SPUtils getInstance(String spName) {
if (isSpace(spName)) spName = "spUtils";
SPUtils spUtils = SP_UTILS_MAP.get(spName);
if (spUtils == null) {
spUtils = new SPUtils(spName);
SP_UTILS_MAP.put(spName, spUtils);
}
return spUtils;
}
private SPUtils(final String spName) {
sp = TApplication.context.getSharedPreferences(spName, Context.MODE_PRIVATE);
}
/**
* SP 中写入 String
*
* @param key 键
* @param value 值
*/
public void put(@NonNull final String key, @NonNull final String value) {
put(key, value, false);
}
/**
* SP 中写入 String
*
* @param key 键
* @param value 值
* @param isCommit {@code true}: {@link SharedPreferences.Editor#commit()}<br>
* {@code false}: {@link SharedPreferences.Editor#apply()}
*/
public void put(@NonNull final String key, @NonNull final String value, final boolean isCommit) {
if (isCommit) {
sp.edit().putString(key, value).commit();
} else {
sp.edit().putString(key, value).apply();
}
}
/**
* SP 中读取 String
*
* @param key 键
* @return 存在返回对应值,不存在返回默认值{@code ""}
*/
public String getString(@NonNull final String key) {
return getString(key, "");
}
/**
* SP 中读取 String
*
* @param key 键
* @param defaultValue 默认值
* @return 存在返回对应值,不存在返回默认值{@code defaultValue}
*/
public String getString(@NonNull final String key, @NonNull final String defaultValue) {
return sp.getString(key, defaultValue);
}
/**
* SP 中写入 int
*
* @param key 键
* @param value 值
*/
public void put(@NonNull final String key, final int value) {
put(key, value, false);
}
/**
* SP 中写入 int
*
* @param key 键
* @param value 值
* @param isCommit {@code true}: {@link SharedPreferences.Editor#commit()}<br>
* {@code false}: {@link SharedPreferences.Editor#apply()}
*/
public void put(@NonNull final String key, final int value, final boolean isCommit) {
if (isCommit) {
sp.edit().putInt(key, value).commit();
} else {
sp.edit().putInt(key, value).apply();
}
}
/**
* SP 中读取 int
*
* @param key 键
* @return 存在返回对应值,不存在返回默认值-1
*/
public int getInt(@NonNull final String key) {
return getInt(key, 0);
}
/**
* SP 中读取 int
*
* @param key 键
* @param defaultValue 默认值
* @return 存在返回对应值,不存在返回默认值{@code defaultValue}
*/
public int getInt(@NonNull final String key, final int defaultValue) {
return sp.getInt(key, defaultValue);
}
/**
* SP 中写入 long
*
* @param key 键
* @param value 值
*/
public void put(@NonNull final String key, final long value) {
put(key, value, false);
}
/**
* SP 中写入 long
*
* @param key 键
* @param value 值
* @param isCommit {@code true}: {@link SharedPreferences.Editor#commit()}<br>
* {@code false}: {@link SharedPreferences.Editor#apply()}
*/
public void put(@NonNull final String key, final long value, final boolean isCommit) {
if (isCommit) {
sp.edit().putLong(key, value).commit();
} else {
sp.edit().putLong(key, value).apply();
}
}
/**
* SP 中读取 long
*
* @param key 键
* @return 存在返回对应值,不存在返回默认值-1
*/
public long getLong(@NonNull final String key) {
return getLong(key, -1L);
}
/**
* SP 中读取 long
*
* @param key 键
* @param defaultValue 默认值
* @return 存在返回对应值,不存在返回默认值{@code defaultValue}
*/
public long getLong(@NonNull final String key, final long defaultValue) {
return sp.getLong(key, defaultValue);
}
/**
* SP 中写入 float
*
* @param key 键
* @param value 值
*/
public void put(@NonNull final String key, final float value) {
put(key, value, false);
}
/**
* SP 中写入 float
*
* @param key 键
* @param value 值
* @param isCommit {@code true}: {@link SharedPreferences.Editor#commit()}<br>
* {@code false}: {@link SharedPreferences.Editor#apply()}
*/
public void put(@NonNull final String key, final float value, final boolean isCommit) {
if (isCommit) {
sp.edit().putFloat(key, value).commit();
} else {
sp.edit().putFloat(key, value).apply();
}
}
/**
* SP 中读取 float
*
* @param key 键
* @return 存在返回对应值,不存在返回默认值-1
*/
public float getFloat(@NonNull final String key) {
return getFloat(key, -1f);
}
/**
* SP 中读取 float
*
* @param key 键
* @param defaultValue 默认值
* @return 存在返回对应值,不存在返回默认值{@code defaultValue}
*/
public float getFloat(@NonNull final String key, final float defaultValue) {
return sp.getFloat(key, defaultValue);
}
/**
* SP 中写入 boolean
*
* @param key 键
* @param value 值
*/
public void put(@NonNull final String key, final boolean value) {
put(key, value, false);
}
/**
* SP 中写入 boolean
*
* @param key 键
* @param value 值
* @param isCommit {@code true}: {@link SharedPreferences.Editor#commit()}<br>
* {@code false}: {@link SharedPreferences.Editor#apply()}
*/
public void put(@NonNull final String key, final boolean value, final boolean isCommit) {
if (isCommit) {
sp.edit().putBoolean(key, value).commit();
} else {
sp.edit().putBoolean(key, value).apply();
}
}
/**
* SP 中读取 boolean
*
* @param key 键
* @return 存在返回对应值,不存在返回默认值{@code false}
*/
public boolean getBoolean(@NonNull final String key) {
return getBoolean(key, false);
}
/**
* SP 中读取 boolean
*
* @param key 键
* @param defaultValue 默认值
* @return 存在返回对应值,不存在返回默认值{@code defaultValue}
*/
public boolean getBoolean(@NonNull final String key, final boolean defaultValue) {
return sp.getBoolean(key, defaultValue);
}
/**
* SP 中写入 String 集合
*
* @param key 键
* @param values 值
*/
public void put(@NonNull final String key, @NonNull final Set<String> values) {
put(key, values, false);
}
/**
* SP 中写入 String 集合
*
* @param key 键
* @param values 值
* @param isCommit {@code true}: {@link SharedPreferences.Editor#commit()}<br>
* {@code false}: {@link SharedPreferences.Editor#apply()}
*/
public void put(@NonNull final String key, @NonNull final Set<String> values, final boolean isCommit) {
if (isCommit) {
sp.edit().putStringSet(key, values).commit();
} else {
sp.edit().putStringSet(key, values).apply();
}
}
/**
* SP 中读取 StringSet
*
* @param key 键
* @return 存在返回对应值,不存在返回默认值{@code Collections.<String>emptySet()}
*/
public Set<String> getStringSet(@NonNull final String key) {
return getStringSet(key, Collections.<String>emptySet());
}
/**
* SP 中读取 StringSet
*
* @param key 键
* @param defaultValue 默认值
* @return 存在返回对应值,不存在返回默认值{@code defaultValue}
*/
public Set<String> getStringSet(@NonNull final String key, @NonNull final Set<String> defaultValue) {
return sp.getStringSet(key, defaultValue);
}
/**
* SP 中获取所有键值对
*
* @return Map 对象
*/
public Map<String, ?> getAll() {
return sp.getAll();
}
/**
* SP 中是否存在该 key
*
* @param key 键
* @return {@code true}: 存在<br>{@code false}: 不存在
*/
public boolean contains(@NonNull final String key) {
return sp.contains(key);
}
/**
* SP 中移除该 key
*
* @param key 键
*/
public void remove(@NonNull final String key) {
remove(key, false);
}
/**
* SP 中移除该 key
*
* @param key 键
* @param isCommit {@code true}: {@link SharedPreferences.Editor#commit()}<br>
* {@code false}: {@link SharedPreferences.Editor#apply()}
*/
public void remove(@NonNull final String key, final boolean isCommit) {
if (isCommit) {
sp.edit().remove(key).commit();
} else {
sp.edit().remove(key).apply();
}
}
/**
* SP 中清除所有数据
*/
public void clear() {
clear(false);
}
/**
* SP 中清除所有数据
*
* @param isCommit {@code true}: {@link SharedPreferences.Editor#commit()}<br>
* {@code false}: {@link SharedPreferences.Editor#apply()}
*/
public void clear(final boolean isCommit) {
if (isCommit) {
sp.edit().clear().commit();
} else {
sp.edit().clear().apply();
}
}
private static boolean isSpace(final String s) {
if (s == null) return true;
for (int i = 0, len = s.length(); i < len; ++i) {
if (!Character.isWhitespace(s.charAt(i))) {
return false;
}
}
return true;
}
} | [
"zsz521@126.com"
] | zsz521@126.com |
43830a219ac242dc0415f14c408a418a3877baf2 | fd2f3be5a95f0179ada0985c104e0098a83981d0 | /src/satsolver/Solver.java | fed56289fa9c3ad0e1baf982b565708263a10d0d | [] | no_license | atipak/satsolver | a70ef3240e0c8e1b562c9ecf8864f686c27c512a | 6b2c607bf5d707cda9564ce11a72941bc7dd1193 | refs/heads/master | 2020-03-17T23:58:28.100428 | 2018-05-19T14:57:56 | 2018-05-19T14:57:56 | 134,071,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,233 | 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 satsolver;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
/**
*
* @author Vláďa
*/
public class Solver {
/**
* Solver properties from user.
*/
SolverProperties args = null;
/**
* Solver type chosen by user -> CDCL, DPPL, GSAT.
*/
SolverType solver = null;
/**
* Encoding type chosen by user.
*/
EncodingType encoding = null;
/**
* The data are stored in DIMACS style.
*/
DIMACSReader dimacsr = null;
/**
* The data are stored in interactive style.
*/
Iterator<String> it = null;
/**
* The formulas are in postfix order.
*/
PostfixToInfix infix = null;
/**
* Statistics of solving problem.
*/
Statistics stats;
/**
* Count of formulas in the data.
*/
long formulasCount = 0;
/**
* Count of solved problems.
*/
long solved = 0;
/**
* Count of formulas with no solution.
*/
long unsolved = 0;
/**
* Initialization and args processing.
* @param args Solver properties chosen by user.
*/
public Solver(SolverProperties args) {
this.args = args;
stats = new Statistics();
processArgs();
}
/**
* Main method for solving formulas. Returns solution if such solution exists.
* @return Solution if exists or null (nothing to solve)
* @throws SolverException if something bad in solver happens
*/
public HashMap<String, Boolean> solveNext() throws SolverException {
HashMap<String, Boolean> result = null;
if (hasNextFormula()) {
formulasCount++;
Statistics stats = solver.solve(nextFormula(), args);
if (stats.getAssignment() == null) {
if (stats.isSuccess()) {
unsolved++;
System.out.println("Error");
serveStatistics(stats);
throw new SolverException("Error");
} else {
unsolved++;
System.out.println("No result");
serveStatistics(stats);
return backTransformation(stats.getAssignment());
}
} else {
solved++;
serveStatistics(stats);
return backTransformation(stats.getAssignment());
}
} else {
return null;
}
}
/**
* Set up solver properties defined by user.
*/
private void processArgs() {
switch (args.getEncodingType()) {
//case NAIVE:
// encoding = new NaiveEncoding();
// break;
case TSETIN:
encoding = new TsetinEncoding();
break;
}
switch (args.getSolverType()) {
case CDCL:
solver = new CDCL();
break;
case DPLL:
solver = new CDCL();
break;
case GSAT:
solver = new Gsat();
break;
}
switch (args.getInputType()) {
case CLASSIC:
it = args.getFormulas().iterator();
break;
case DIMACS:
dimacsr = new DIMACSReader(args.getFilesPath(), args.isPrintFileNames());
break;
}
if (args.getFormuleNotation() == SolverProperties.FormuleNotation.PREFIX) {
infix = new PostfixToInfix();
}
}
/**
* Checks if there is next formula for solving.
* @return True if there exists another formula in qeueu.
*/
private boolean hasNextFormula() {
if (dimacsr != null) {
return dimacsr.hasNextFormula();
} else {
return it.hasNext();
}
}
/**
* Return next formula. Transforms from postfix if it is needed.
* @return Next formula.
*/
private LinkedList<Integer[]> nextFormula() {
if (dimacsr != null) {
return dimacsr.nextFormula();
} else {
String formula = it.next();
if (infix != null) {
formula = infix.transformToInfix(formula, args);
}
return encoding.encode(formula, args);
}
}
/**
* Mapping from integers back to names of variables.
* @param assignment Final assignment.
* @return Mapped assignment.
*/
private HashMap<String, Boolean> backTransformation(HashMap<Integer, Boolean> assignment) {
if (dimacsr != null) {
HashMap<String, Boolean> result = new HashMap<>();
if (assignment != null) {
for (Map.Entry<Integer, Boolean> entrySet : assignment.entrySet()) {
Integer key = entrySet.getKey();
Boolean value = entrySet.getValue();
result.put(String.valueOf(key), value);
}
}
return result;
} else {
return encoding.retroTransformation(assignment);
}
}
/**
* If should print stats.
* @param stats Solver statistics.
*/
private void shouldPrintStats(Statistics stats) {
if (args.isPrintAverageStatistics()) {
stats.printStatistics();
}
}
/**
* Print average satistics if it it so set up.
*/
public void printAverageStatistics() {
stats.printAverageStatistics(formulasCount);
System.out.println("Solved: " + solved);
System.out.println("Unsolved: " + unsolved);
}
/**
* Print average satistics in one row if it it so set up.
*/
public void printAverageStatisticsInRow() {
stats.printAverageStatisticsInRow(formulasCount);
System.out.print(";" + solved);
System.out.print(";" + unsolved);
}
/**
* Adds new statistics to average statistics.
* @param taskStats Statistics of actual task.
*/
private void addToAverage(Statistics taskStats) {
if (stats.getBeginTime() == 0) {
stats.setBeginTime(System.currentTimeMillis());
}
stats.setAddedClauses(stats.getAddedClauses() + taskStats.getAddedClauses());
stats.setCheckedClause(stats.getCheckedClause() + taskStats.getCheckedClause());
stats.setConflicts(stats.getConflicts() + taskStats.getConflicts());
stats.setDecisionCount(stats.getDecisionCount() + taskStats.getDecisionCount());
stats.setSteps(stats.getSteps() + taskStats.getSteps());
stats.setUnitPropagationCount(stats.getUnitPropagationCount() + taskStats.getUnitPropagationCount());
stats.setEndTime(System.currentTimeMillis());
}
/**
* Help method for printing statistics.
* @param taskStats Actual task statistics.
*/
private void serveStatistics(Statistics taskStats) {
addToAverage(taskStats);
shouldPrintStats(taskStats);
}
}
| [
"v.patik@seznam.cz"
] | v.patik@seznam.cz |
f51792eab092e6f0b54dce34d155fb3f6efe6cfd | 560e6a93c221c87389ed29b4fe8385635a744277 | /interview/src/main/java/SleepWaitInterview.java | f16827274db50fe5eb165f2b39f60f7f3cb4ff40 | [] | no_license | zero9102/interview2021 | 29ec820449e53acf7e295811ddbb00bb83f82d7a | 13a5c2ff71700348e1847f56bc0c00f7e07b34fd | refs/heads/master | 2023-06-05T00:10:12.835089 | 2021-06-29T13:04:36 | 2021-06-29T13:04:36 | 381,004,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,646 | java | package main.java;
public class SleepWaitInterview {
public static void main(String[] args) throws InterruptedException {
/*
1、这两个方法来自不同的类分别是Thread和Object
2、最主要是sleep方法没有释放锁,而wait方法释放了锁,使得其他线程可以使用同步控制块或者方法。
3、wait,notify和notifyAll只能在同步控制方法或者同步控制块里面使用,而sleep可以在任何地方使用(使用范围)
4、sleep, wait 必须捕获异常,而notify和notifyAll不需要捕获异常
5、sleep是Thread类的静态方法。sleep的作用是让线程休眠制定的时间,在时间到达时恢复,也就是说sleep将在接到时间到达事件事恢复线程执行。
wait是Object的方法,也就是说可以对任意一个对象调用wait方法,
调用wait方法将会将调用者的线程挂起,直到其他线程调用同一个对象的notify
方法才会重新激活调用者
*/
// The thread does not lose ownership of any monitors, 没有释放锁.
Thread.sleep(1);
}
public synchronized void testa() throws InterruptedException {
// the current thread must own this object's monitor. The thread
// * releases ownership of this monitor and waits until another thread
// * notifies threads waiting on this object's monitor to wake up
// * either through a call to the {@code notify} method or the
// * {@code notifyAll} method
wait();
notify();
notifyAll();
}
}
| [
"chloesnow2019@gmail.com"
] | chloesnow2019@gmail.com |
84a1537d11e3582906e0baeb81e8d29e9f6b6c89 | 7e888e1f5e2780e4fe648e87ac5c41c99c62a719 | /src/UserInterface/Government/FederalLicenseManager/ViewWorkQueueJPanel.java | 7643b17bd56a646ab219299d89d1522ce0e60858 | [] | no_license | mayankbothra/PharmaceuticalDistributionSC | 16661146f14711dfbd8a130dfc1e1fa1ac4a8685 | a82752c05382f515cb4c94053d97816596a066ca | refs/heads/master | 2020-03-30T22:17:23.117650 | 2014-09-26T01:26:06 | 2014-09-26T01:26:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,213 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package UserInterface.Government.FederalLicenseManager;
import Business.Enterprises.Enterprise;
import Business.Network.Network;
import Business.Organizations.Organization;
import Business.UserAccount;
import Business.WorkRequest.ApplyForLicenseWorkRequest;
import Business.WorkRequest.WorkRequest;
import java.awt.CardLayout;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Mayank
*/
public class ViewWorkQueueJPanel extends javax.swing.JPanel {
JPanel userProcessContainer;
Enterprise selectedEnterprise;
UserAccount userAccount;
Network selectedNetwork;
/**
* Creates new form OrderDrugsJPanel
*/
public ViewWorkQueueJPanel(JPanel userProcessContainer, Enterprise selectedEnterprise, UserAccount userAccount, Network selectedNetwork) {
initComponents();
this.userProcessContainer = userProcessContainer;
this.selectedEnterprise = selectedEnterprise;
this.userAccount = userAccount;
this.selectedNetwork = selectedNetwork;
enterpriseNameJLabel.setText(" -- " + selectedEnterprise.getEnterpriseName());
networkNameJLabel.setText(selectedNetwork.getNetworkName());
Organization organization = selectedEnterprise.getMyOrganization(userAccount);
organizationNameJLabel.setText(organization.getOrganizationName());
refreshWorkQueue();
}
public void refreshWorkQueue() {
int rowCount = workQueueJTable.getRowCount();
DefaultTableModel model = (DefaultTableModel) workQueueJTable.getModel();
for (int i = rowCount - 1; i >= 0; i--) {
model.removeRow(i);
}
Organization org = selectedEnterprise.getMyOrganization(userAccount);
for (WorkRequest request : org.getWorkQueue().getWorkRequestList()) {
Object row[] = new Object[6];
row[0] = request;
row[1] = request.getRequestDate();
row[2] = request.getSender();
row[3] = request.getReceiver();
row[4] = request.getStatus();
row[5] = request.getResolveDate();
model.addRow(row);
}
}
/**
* 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() {
businessNameJLabel = new javax.swing.JLabel();
enterpriseNameJLabel = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
organizationNameJLabel = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
titleJLabel = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
workQueueJTable = new javax.swing.JTable();
backJButton = new javax.swing.JButton();
viewDetailsJButton = new javax.swing.JButton();
refreshJButton = new javax.swing.JButton();
networkNameJLabel = new javax.swing.JLabel();
assignToMeJButton = new javax.swing.JButton();
businessNameJLabel.setFont(new java.awt.Font("Times New Roman", 1, 20)); // NOI18N
businessNameJLabel.setText("Drug Tracking System");
enterpriseNameJLabel.setFont(new java.awt.Font("Times New Roman", 1, 20)); // NOI18N
enterpriseNameJLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
enterpriseNameJLabel.setMinimumSize(new java.awt.Dimension(170, 24));
enterpriseNameJLabel.setPreferredSize(new java.awt.Dimension(170, 24));
organizationNameJLabel.setFont(new java.awt.Font("Times New Roman", 1, 20)); // NOI18N
organizationNameJLabel.setMinimumSize(new java.awt.Dimension(170, 24));
organizationNameJLabel.setPreferredSize(new java.awt.Dimension(190, 24));
titleJLabel.setFont(new java.awt.Font("Times New Roman", 1, 26)); // NOI18N
titleJLabel.setText("Work Queue");
workQueueJTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null}
},
new String [] {
"Type", "Assigned Date", "Sender", "Receiver", "Status", "Resolved Date"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(workQueueJTable);
workQueueJTable.getColumnModel().getColumn(0).setPreferredWidth(12);
workQueueJTable.getColumnModel().getColumn(1).setPreferredWidth(15);
workQueueJTable.getColumnModel().getColumn(2).setPreferredWidth(12);
workQueueJTable.getColumnModel().getColumn(3).setPreferredWidth(12);
workQueueJTable.getColumnModel().getColumn(4).setPreferredWidth(13);
workQueueJTable.getColumnModel().getColumn(5).setPreferredWidth(15);
backJButton.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
backJButton.setText("Back");
backJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backJButtonActionPerformed(evt);
}
});
viewDetailsJButton.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
viewDetailsJButton.setText("View Details");
viewDetailsJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewDetailsJButtonActionPerformed(evt);
}
});
refreshJButton.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
refreshJButton.setText("Refresh");
refreshJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
refreshJButtonActionPerformed(evt);
}
});
networkNameJLabel.setFont(new java.awt.Font("Times New Roman", 1, 20)); // NOI18N
networkNameJLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
networkNameJLabel.setMaximumSize(new java.awt.Dimension(195, 24));
networkNameJLabel.setMinimumSize(new java.awt.Dimension(195, 24));
networkNameJLabel.setPreferredSize(new java.awt.Dimension(195, 24));
assignToMeJButton.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
assignToMeJButton.setText("Assign To Me");
assignToMeJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
assignToMeJButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSeparator2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(organizationNameJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 322, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(businessNameJLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(enterpriseNameJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 430, Short.MAX_VALUE)
.addComponent(networkNameJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addGap(105, 105, 105)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(refreshJButton)
.addGroup(layout.createSequentialGroup()
.addComponent(backJButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(assignToMeJButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(viewDetailsJButton))
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 802, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(437, 437, 437)
.addComponent(titleJLabel)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(businessNameJLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(enterpriseNameJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(networkNameJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(organizationNameJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(titleJLabel)
.addGap(21, 21, 21)
.addComponent(refreshJButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(viewDetailsJButton)
.addComponent(backJButton)
.addComponent(assignToMeJButton))
.addContainerGap(183, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void backJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backJButtonActionPerformed
// TODO add your handling code here:
userProcessContainer.remove(this);
CardLayout cardLayout = (CardLayout) userProcessContainer.getLayout();
cardLayout.previous(userProcessContainer);
}//GEN-LAST:event_backJButtonActionPerformed
private void viewDetailsJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewDetailsJButtonActionPerformed
// TODO add your handling code here:
int selectedRow = workQueueJTable.getSelectedRow();
if (selectedRow < 0) {
JOptionPane.showMessageDialog(null, "Select Work Request");
return;
}
WorkRequest request = (WorkRequest) workQueueJTable.getValueAt(selectedRow, 0);
if (request.getReceiver() == null) {
JOptionPane.showMessageDialog(null, "This Work Request Has Not Been Assigned");
return;
}
ApplyForLicenseWorkRequest req = (ApplyForLicenseWorkRequest) request;
if (req.getStatus().equals(WorkRequest.Status.Processed)) {
JOptionPane.showMessageDialog(null, "This Work Request Has Already Been Processed");
return;
}
ViewEnterpriseDetailsJPanel viewEnterpriseDetailsJPanel = new ViewEnterpriseDetailsJPanel(userProcessContainer, selectedEnterprise, userAccount, selectedNetwork, req, this);
userProcessContainer.add("ViewEnterpriseDetails", viewEnterpriseDetailsJPanel);
CardLayout cardLayout = (CardLayout) userProcessContainer.getLayout();
cardLayout.next(userProcessContainer);
}//GEN-LAST:event_viewDetailsJButtonActionPerformed
private void refreshJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshJButtonActionPerformed
// TODO add your handling code here:
refreshWorkQueue();
}//GEN-LAST:event_refreshJButtonActionPerformed
private void assignToMeJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assignToMeJButtonActionPerformed
// TODO add your handling code here:
int selectedRow = workQueueJTable.getSelectedRow();
if (selectedRow < 0) {
JOptionPane.showMessageDialog(null, "Select Work Request");
return;
}
WorkRequest request = (WorkRequest) workQueueJTable.getValueAt(selectedRow, 0);
if (request.getReceiver() != null) {
JOptionPane.showMessageDialog(null, "This Work Request Has Already Been Assigned");
return;
}
request.setReceiver(userAccount);
refreshWorkQueue();
}//GEN-LAST:event_assignToMeJButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton assignToMeJButton;
private javax.swing.JButton backJButton;
private javax.swing.JLabel businessNameJLabel;
private javax.swing.JLabel enterpriseNameJLabel;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JLabel networkNameJLabel;
private javax.swing.JLabel organizationNameJLabel;
private javax.swing.JButton refreshJButton;
private javax.swing.JLabel titleJLabel;
private javax.swing.JButton viewDetailsJButton;
private javax.swing.JTable workQueueJTable;
// End of variables declaration//GEN-END:variables
}
| [
"mayank.tcet@gmail.com"
] | mayank.tcet@gmail.com |
d9b5a89d7badf083588a87a8f44a595c12bbfa71 | efdf664468ae15d2d0c16e68c5cd7293e3469b97 | /src/main/java/sample/controller/dto/ServiceTypeDTO.java | 1d4a54b981ae33b7a9c9c7f04369a3ed6eb1f0d9 | [] | no_license | AnaMius/taskmanchiefclient | 9e51bcf0af524db4f0c7dbe950319f1029b9b616 | e7504e871efaba47c29832ce7d6de4666b9f5b45 | refs/heads/master | 2021-08-31T20:19:00.268660 | 2017-06-11T16:40:23 | 2017-06-11T16:40:23 | 93,941,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | package sample.controller.dto;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ServiceTypeDTO {
private Integer id;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "ServiceType{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ServiceTypeDTO)) return false;
ServiceTypeDTO that = (ServiceTypeDTO) o;
if (!id.equals(that.id)) return false;
return name.equals(that.name);
}
@Override
public int hashCode() {
int result = id.hashCode();
result = 31 * result + name.hashCode();
return result;
}
}
| [
"maksim.simonenko@escalibre.net"
] | maksim.simonenko@escalibre.net |
148aabbf9a2489df7d1ed8c7369ff90390fc80d1 | 5db6eed041493c05e47dbe3167ff34ea1424d6c4 | /Compare.java | 0e8a7b504ff34e759f5dffa497e2dbfd6b127aa3 | [] | no_license | glydokid/JavaSt | 6bc8c8153e857cd7bf4a1f4afc4a56a29572e7c4 | 90d8ea2249c5057c2a330d4ced5aae75c19d9643 | refs/heads/main | 2023-07-12T01:53:14.302051 | 2021-08-16T14:33:01 | 2021-08-16T14:33:01 | 396,390,474 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 853 | java | package edu.dongseo.ksh;
public class Ex06_01 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n = 100; //기본타입
String s = "홍길동"; //참조타입
System.out.println(n);
System.out.println(s);
int n1 = 100; //n1에 실제 값이 들어감 (100)
int n2 = 100;
if(n1==n2)
System.out.println("두 값이 일치");
else
System.out.println("두 값이 불일치");
String s1 = new String ("홍길동"); //s1이라는 곳엔 홍길동의 주소값이 저장(주소값 비교)
String s2 = new String ("홍길동");
if(s1==s2)
System.out.println("두 값이 일치");
else
System.out.println("두 값이 불일치");
if(s1.equals(s2)) //내용비교
System.out.println("두 값이 일치");
else
System.out.println("두 값이 불일치");
}
}
| [
"70894372+glydokid@users.noreply.github.com"
] | 70894372+glydokid@users.noreply.github.com |
e8f631426646116903993cf7273a6f6b0f35d155 | c1f72c8116594331835f533327189651053a5747 | /test1/src/cn/rb/test1/demo15/Solution.java | 8987b5905f1da749740a6a421123ae25a6c78e2d | [] | no_license | S0mumu/basic-code | 9c93cae3789e87d8c628a297063e3fd6ae5d8d51 | f4e3ed72f262089a32308b07ba57e6ddfe7144d3 | refs/heads/master | 2023-07-08T18:59:30.468318 | 2021-08-22T02:40:29 | 2021-08-22T02:40:29 | 398,698,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package cn.rb.test1.demo15;
public class Solution {
public class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
}
}
public ListNode deleteNode(ListNode head, int val) {
if(head==null)
return null;
ListNode in =head;
if(head.val==val){
return head.next;
}
while(in.next!=null){
if(in.next.val==val){
in.next=in.next.next;
}else {
in = in.next;
}
}
return head;
}
}
| [
"49936182+S0mumu@users.noreply.github.com"
] | 49936182+S0mumu@users.noreply.github.com |
6478dee177fbfc6a95372cb06ddc2026cab8d35e | 067b295ba4b6632b1b69eaf4d41bf4c32c18bf4c | /src/main/java/cn/endacsd/yingbookshop/controller/GlobalExceptionHandler.java | 5b8cf09a8add5861647e0e210b72721f52fc43b9 | [] | no_license | endacsd/bookshop | c8bd50b64f18668fee5cbe0bd4489cef78023226 | d7435fd9f3a3a7c01e2403e9a314356b138673a8 | refs/heads/master | 2023-02-02T19:54:45.087554 | 2020-12-15T03:16:35 | 2020-12-15T03:16:35 | 317,875,832 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package cn.endacsd.yingbookshop.controller;
import cn.endacsd.yingbookshop.utils.R;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler({Exception.class})
@ResponseBody
public R globalException(HttpServletResponse response, Exception ex){
System.out.println(ex.getMessage());
System.out.println(response.getStatus());
return R.error(500,ex.getMessage());
}
} | [
"1770724257@qq.com"
] | 1770724257@qq.com |
f797207328c8f01f4e31172545d109e705dc1ff4 | 779199d9ddac60bc0cc8321f49a5fa632313ee6d | /src/main/java/com/zhkj/nettyserver/message/domain/ChatGroup.java | 1378421523789746c6f65433d8e2794e32016fde | [] | no_license | dengyu123456/messagecenter | 8cdeebc5409f9bed374057b7e9f5b7fcb19a5570 | f4ad1cf1de435aa74727e242150dff1c3f6018ee | refs/heads/master | 2022-06-24T21:27:11.543621 | 2020-12-03T14:44:03 | 2020-12-03T14:44:03 | 211,939,746 | 16 | 3 | null | 2022-06-17T02:32:50 | 2019-09-30T19:32:18 | Java | UTF-8 | Java | false | false | 5,039 | java | package com.zhkj.nettyserver.message.domain;
import javax.persistence.*;
import java.util.Date;
@Table(name = "chat_group")
public class ChatGroup {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 群Uuid
*/
@Column(name = "cgro_uuid")
private Long cgroUuid;
/**
* 群会话Uuid
*/
@Column(name = "cgro_chat_uuid")
private Long cgroChatUuid;
/**
* 群名字64
*/
@Column(name = "cgro_name")
private String cgroName;
/**
* 群创建者Uuid
*/
@Column(name = "cgro_csuse_uuid")
private Long cgroCsuseUuid;
/**
* 群是否公开 0:公开 1:不公开
*/
@Column(name = "cgro_public")
private Integer cgroPublic;
/**
* 群类型0:系统会话 1:一对一会话 2:多人会话
*/
@Column(name = "cgro_type")
private Integer cgroType;
/**
* 群成员数最多256
*/
@Column(name = "cgro_count")
private Integer cgroCount;
/**
* 数据是否正常0:正常1:删除
*/
@Column(name = "cgro_data_status")
private Integer cgroDataStatus;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取群Uuid
*
* @return cgro_uuid - 群Uuid
*/
public Long getCgroUuid() {
return cgroUuid;
}
/**
* 设置群Uuid
*
* @param cgroUuid 群Uuid
*/
public void setCgroUuid(Long cgroUuid) {
this.cgroUuid = cgroUuid;
}
/**
* 获取群会话Uuid
*
* @return cgro_chat_uuid - 群会话Uuid
*/
public Long getCgroChatUuid() {
return cgroChatUuid;
}
/**
* 设置群会话Uuid
*
* @param cgroChatUuid 群会话Uuid
*/
public void setCgroChatUuid(Long cgroChatUuid) {
this.cgroChatUuid = cgroChatUuid;
}
/**
* 获取群名字64
*
* @return cgro_name - 群名字64
*/
public String getCgroName() {
return cgroName;
}
/**
* 设置群名字64
*
* @param cgroName 群名字64
*/
public void setCgroName(String cgroName) {
this.cgroName = cgroName == null ? null : cgroName.trim();
}
/**
* 获取群创建者Uuid
*
* @return cgro_csuse_uuid - 群创建者Uuid
*/
public Long getCgroCsuseUuid() {
return cgroCsuseUuid;
}
/**
* 设置群创建者Uuid
*
* @param cgroCsuseUuid 群创建者Uuid
*/
public void setCgroCsuseUuid(Long cgroCsuseUuid) {
this.cgroCsuseUuid = cgroCsuseUuid;
}
/**
* 获取群是否公开 0:公开 1:不公开
*
* @return cgro_public - 群是否公开 0:公开 1:不公开
*/
public Integer getCgroPublic() {
return cgroPublic;
}
/**
* 设置群是否公开 0:公开 1:不公开
*
* @param cgroPublic 群是否公开 0:公开 1:不公开
*/
public void setCgroPublic(Integer cgroPublic) {
this.cgroPublic = cgroPublic;
}
/**
* 获取群类型0:系统会话 1:一对一会话 2:多人会话
*
* @return cgro_type - 群类型0:系统会话 1:一对一会话 2:多人会话
*/
public Integer getCgroType() {
return cgroType;
}
/**
* 设置群类型0:系统会话 1:一对一会话 2:多人会话
*
* @param cgroType 群类型0:系统会话 1:一对一会话 2:多人会话
*/
public void setCgroType(Integer cgroType) {
this.cgroType = cgroType;
}
/**
* 获取群成员数最多256
*
* @return cgro_count - 群成员数最多256
*/
public Integer getCgroCount() {
return cgroCount;
}
/**
* 设置群成员数最多256
*
* @param cgroCount 群成员数最多256
*/
public void setCgroCount(Integer cgroCount) {
this.cgroCount = cgroCount;
}
/**
* 获取数据是否正常0:正常1:删除
*
* @return cgro_data_status - 数据是否正常0:正常1:删除
*/
public Integer getCgroDataStatus() {
return cgroDataStatus;
}
/**
* 设置数据是否正常0:正常1:删除
*
* @param cgroDataStatus 数据是否正常0:正常1:删除
*/
public void setCgroDataStatus(Integer cgroDataStatus) {
this.cgroDataStatus = cgroDataStatus;
}
/**
* 获取创建时间
*
* @return create_time - 创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
} | [
"2540628013@qq.com"
] | 2540628013@qq.com |
82890eb16f5400638277c8c73844ca4a99403137 | 0441cb109fdf70da407fd277aecc8c2b21efae56 | /IIHT Project/SBA/MentorOnDemand/src/main/java/com/example/sba/service/MentorServiceImpl.java | a5c90efd6fc1e4a7d4ebb564eb149bba3ee3fc90 | [] | no_license | SatirthaSaha/FinalProject | f05e6a6bd31bc681033ba6b2291e613c9ce601ca | 853bf374f32573e19a6019fc06a13c85d7a548d0 | refs/heads/master | 2022-07-13T05:06:07.278831 | 2019-09-27T13:18:29 | 2019-09-27T13:18:29 | 211,323,244 | 0 | 0 | null | 2022-06-29T17:40:36 | 2019-09-27T13:16:28 | Java | UTF-8 | Java | false | false | 651 | java | package com.example.sba.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.sba.dao.MentorDao;
import com.example.sba.model.Mentor;
@Service
public class MentorServiceImpl implements MentorService {
@Autowired
MentorDao mentorDao;
@Override
public boolean registerMentor(Mentor mentor) {
// TODO Auto-generated method stub
Mentor mentor1=new Mentor();
System.out.println(mentor);
mentor1=mentorDao.save(mentor);
System.out.println(mentor1);
if(mentor1!=null) {
System.out.println(mentor1);
return true;
}
else
return false;
}
}
| [
"satirtha1996@gmail.com"
] | satirtha1996@gmail.com |
28456da8dd555fbbe8f2b6737c186b0c39ac6ae2 | f1d20d6c7e6ec5ed491274fcc11e74bb010c57d3 | /company-central-service/src/test/java/com/ihappy/stock/infrastructure/service/StockReadInsideRpcServiceTest.java | f1ea119fb528bd130788ddb41e697fd53f0e3989 | [] | no_license | P79N6A/company-central | 79273c8e90732cf73f2f8b08c006654809e08736 | f1a83f62a5cf41f8bfcf79c708a54d736fb1a46b | refs/heads/master | 2020-04-12T02:41:38.769868 | 2018-12-18T07:45:31 | 2018-12-18T07:45:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,141 | java | package com.ihappy.stock.infrastructure.service;
import com.alibaba.fastjson.JSON;
import com.ihappy.BaseTest;
import com.ihappy.stock.domain.dto.request.stock.StockMapByUserInfoQueryReqDTO;
import com.ihappy.stock.domain.dto.response.stock.StockListByStoreIdsQueryRespDTO;
import com.ihappy.unifiedLog.module.Result;
import org.junit.Test;
/**
* Created by sunjd on 2018/5/24.
*/
public class StockReadInsideRpcServiceTest extends BaseTest {
@Test
public void getStockMapByUserInfo() throws Exception {
StockReadInsideRpcService service = getBean("stockReadInsideRpcService");
StockMapByUserInfoQueryReqDTO reqDTO = new StockMapByUserInfoQueryReqDTO();
reqDTO.setCompId(1L);
reqDTO.setIsPublic(null);
reqDTO.setPersonId(219L);
Result<StockListByStoreIdsQueryRespDTO> res = service.getStockMapByUserInfo(reqDTO);
System.out.println(JSON.toJSONString(res.getModule()));
System.out.println(JSON.toJSONString(res.isSuccess()));
System.out.println(JSON.toJSONString(res.getErrCode()));
System.out.println(JSON.toJSONString(res.getErrMsg()));
}
} | [
"zhangmengdan@ihappy.net.cn"
] | zhangmengdan@ihappy.net.cn |
4626f37101695488865a11fb6395c7bb6d904500 | c5d8da1cad4d99d691dcbe61b3245688777e6fc2 | /algorithm/src/main/java/leetcode/src/Problem_0921_使括号有效的最少添加.java | e2f5408aa52b8c48523c8cd1b861d607e9415311 | [] | no_license | JaryZhen/JaryNote | ef77e148886307865007e335938c76133ad412d8 | ecca4018767dd2db4cb55028a062002a30c4c9f3 | refs/heads/master | 2022-11-19T15:33:48.121652 | 2022-08-24T07:41:14 | 2022-08-24T07:41:14 | 90,730,023 | 3 | 4 | null | 2022-11-16T06:22:50 | 2017-05-09T09:51:23 | Java | UTF-8 | Java | false | false | 715 | java | package leetcode.src;
import java.util.Stack;
/**
* @author cuilihuan
* @data 2021/5/27 16:20
*/
public class Problem_0921_使括号有效的最少添加 {
public int minAddToMakeValid(String s) {
Stack<Character> stack = new Stack<>();
int count = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if(c == '(')
stack.push(c);
else if(c == ')'){
if(stack.size() != 0)
stack.pop();
else
count++;
}
}
while (!stack.isEmpty()) {
count++;
stack.pop();
}
return count;
}
}
| [
"951194829@qq.com"
] | 951194829@qq.com |
b987312cc53def567a289abdd316c8c3ce010696 | 87d85ce1de08d47032c5761630018679e50481f2 | /src/main/java/cl/uchile/transubic/claseEjemplo/model/ClaseEjemplo.java | df2849e344905f45480282a301811f42faf9f565 | [] | no_license | mpilleux/Transubic | 910d26074255543365282c686c9d29b9af646727 | 8b91d56ca61d794a906fc7ccd329b85831df30db | refs/heads/master | 2021-01-25T08:48:21.225322 | 2016-01-15T14:30:36 | 2016-01-15T14:30:36 | 39,706,959 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,351 | java | package cl.uchile.transubic.claseEjemplo.model;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name = "tabla_ejemplo")
public class ClaseEjemplo {
private Integer id;
private String nombre;
private String apellido;
private Date fecha;
public ClaseEjemplo() {
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "T_EJ_ID", unique = true, nullable = false)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "T_EJE_NOMBRE", nullable = false, length = 128)
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
@Column(name = "T_EJE_APELLIDO", nullable = false, length = 128)
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "T_EJE_FECHA", nullable = false)
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
}
| [
"mpilleuxg@gmail.com"
] | mpilleuxg@gmail.com |
fd378011ded5d58617258712fb2d2c39be46cb56 | 37df4f2ef694b4459e49ddda8e8d478a24d1723f | /random-beans/src/test/java/io/github/benas/randombeans/beans/TestData.java | aeac25cc1867c90555c952856b59fc7f50a5d240 | [
"MIT"
] | permissive | weronika-redlarska/random-beans | 334b2001c9d67a2d04c5c284052ca7f74ffb5165 | e9a962d0dde06d29f7fae4c6df086c5a8dd32c72 | refs/heads/master | 2020-04-19T17:42:22.705527 | 2019-01-30T13:05:36 | 2019-01-30T13:05:36 | 168,342,693 | 0 | 0 | null | 2019-01-30T12:53:57 | 2019-01-30T12:53:57 | null | UTF-8 | Java | false | false | 2,214 | java | /**
* The MIT License
*
* Copyright (c) 2019, Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package io.github.benas.randombeans.beans;
import io.github.benas.randombeans.annotation.Randomizer;
import io.github.benas.randombeans.annotation.RandomizerArgument;
import io.github.benas.randombeans.randomizers.range.DateRangeRandomizer;
import io.github.benas.randombeans.randomizers.range.IntegerRangeRandomizer;
import java.util.Date;
public class TestData {
public TestData() {
}
@Randomizer(value = DateRangeRandomizer.class, args = {
@RandomizerArgument(value = "2016-01-10 00:00:00", type = Date.class),
@RandomizerArgument(value = "2016-01-30 23:59:59", type = Date.class)
})
private Date date;
@Randomizer(value = IntegerRangeRandomizer.class, args = {
@RandomizerArgument(value = "200", type = Integer.class),
@RandomizerArgument(value = "500", type = Integer.class)
})
private int price;
public Date getDate() {
return date;
}
public int getPrice() {
return price;
}
} | [
"mahmoud.benhassine@icloud.com"
] | mahmoud.benhassine@icloud.com |
666cf6183041f46d5979b116639332c706817971 | aefc7957e92e39de0566b712727c7df66709886c | /src/main/java/com/aliyun/openservices/shade/com/alibaba/rocketmq/common/protocol/header/QueryConsumerOffsetResponseHeader.java | e97c32c399880500a281a0c6375865e8556c5a13 | [
"MIT"
] | permissive | P79N6A/gw-boot-starter-aliyun-ons | 71ff20d12c33fa9aa061c262f892d8bde7a93459 | 10ae89ce3e4f44edd383e472c987b0671244f1be | refs/heads/master | 2020-05-19T10:05:00.665427 | 2019-05-05T01:42:57 | 2019-05-05T01:42:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,619 | 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.
*/
/**
* $Id: QueryConsumerOffsetResponseHeader.java 1835 2013-05-16 02:00:50Z vintagewang@apache.org $
*/
package com.aliyun.openservices.shade.com.alibaba.rocketmq.common.protocol.header;
import com.aliyun.openservices.shade.com.alibaba.rocketmq.remoting.CommandCustomHeader;
import com.aliyun.openservices.shade.com.alibaba.rocketmq.remoting.annotation.CFNotNull;
import com.aliyun.openservices.shade.com.alibaba.rocketmq.remoting.exception.RemotingCommandException;
public class QueryConsumerOffsetResponseHeader implements CommandCustomHeader {
@CFNotNull
private Long offset;
@Override
public void checkFields() throws RemotingCommandException {
}
public Long getOffset() {
return offset;
}
public void setOffset(Long offset) {
this.offset = offset;
}
}
| [
"fang.huang@guanaitong.com"
] | fang.huang@guanaitong.com |
81f3c22a3437586ac16b3c053b34cc45950d9cb8 | ea7916088dc979542a11ee91cde226b87a487696 | /src/main/java/net/javaguides/springboot/SpringbootThymeleafCrudApplication.java | f1828204ba487326040bc7c526bddb0840943bbc | [] | no_license | chyan117/Employee_System | d8e102f76bdd0310d7416f732b400525f63b6817 | 485b58b3938b2a4f8e66e30c3498b87eb696e79b | refs/heads/master | 2022-12-01T10:22:07.549243 | 2020-08-17T06:18:52 | 2020-08-17T06:18:52 | 288,063,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package net.javaguides.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootThymeleafCrudApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootThymeleafCrudApplication.class, args);
}
}
| [
"kingchang33@gmail.com"
] | kingchang33@gmail.com |
9c97230725aaf8470a3d609b9aafd43d64c4e157 | a41c7304b9d2ded1799e6fab93e3ee225ada0d22 | /src/test/java/br/example/cursoCucumber/runners/RunnerPassagensTest.java | 230a74d6b0ad713bc2466b94f01aaa5383042264 | [] | no_license | wendemendes/curso-cucumber | 02bc2eddee847ccb0547ec2d9307b2beedb6b473 | a02c57364b588810a99a03b2e2326769bc752b2f | refs/heads/master | 2022-12-23T07:51:39.510654 | 2020-09-26T22:52:56 | 2020-09-26T22:52:56 | 287,636,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package br.example.cursoCucumber.runners;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources/features/passagem",
tags = "@Passagens",
glue = "br.example.cursoCucumber.steps.passagem",
monochrome = true,
snippets = CucumberOptions.SnippetType.CAMELCASE)
public class RunnerPassagensTest {
}
| [
"wende.medes@bluesoft.com.br"
] | wende.medes@bluesoft.com.br |
9b281eedf9faaf1e86f4068d045c3875ff9e999e | 490632670c8379fe424b68a075e264ad902df56e | /project/ch_16_NoSTS/src/main/java/com/ch/ch16/HomeController.java | 67ba2da9d7eacb249be023ad0552af0a401dc303 | [] | no_license | chosh95/Java_Spring | 4dedcd894db142585f47a2a0464d8834f4cd3665 | 82b3ce0e3f740381e5237a8eb8fd84f19cf5a825 | refs/heads/master | 2023-04-05T05:28:49.068971 | 2023-04-02T08:54:46 | 2023-04-02T08:57:21 | 240,275,115 | 1 | 0 | null | 2023-04-02T08:57:22 | 2020-02-13T14:07:11 | Java | UTF-8 | Java | false | false | 567 | java | package com.ch.ch16;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping("/")
public String home(Model model) {
System.out.println("===home method===");
model.addAttribute("key", "home value");
return "home";
}
@RequestMapping("/login")
public String login(Model model) {
System.out.println("===login method===");
model.addAttribute("key", "login value");
return "login";
}
}
| [
"chosh-95@hanmail.net"
] | chosh-95@hanmail.net |
ac2dc71afdbb4b63520de6738cd484739e14e1c3 | c33344bc79bfbc936be61fb73791bb46606d1cf7 | /app/src/main/java/com/eos/numbers/to/appmovies/View/searchFragment.java | 5c533b67b40f4f2383f611c467273386a4679181 | [] | no_license | ErickOsorio/The_App_Movie-DB_Series-Movies | 6119849a9d0f90b17afcd9b91d35170b8f7546bf | 38845e8622b7623dddda8f2693e2c6eb11735867 | refs/heads/master | 2020-06-19T15:32:42.399136 | 2019-07-26T06:41:13 | 2019-07-26T06:41:13 | 196,764,752 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,818 | java | package com.eos.numbers.to.appmovies.View;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.eos.numbers.to.appmovies.Adapter.itemAdapter;
import com.eos.numbers.to.appmovies.Helper.sessionHelper;
import com.eos.numbers.to.appmovies.Interface.searchInterface;
import com.eos.numbers.to.appmovies.Item.itemMain;
import com.eos.numbers.to.appmovies.Presenter.searchPresenter;
import com.eos.numbers.to.appmovies.R;
import java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class searchFragment extends Fragment implements searchInterface.View, TextWatcher {
public searchFragment() {
// Required empty public constructor
}
public itemAdapter adapter;
public RecyclerView recyclerViewSearch;
public GridLayoutManager layoutManager;
public LinearLayout linearLayoutData;
public List<itemMain> list;
private sessionHelper session;
public EditText editTextBusqueda;
private searchInterface.Presenter presenter;
private boolean isLoadig = true;
private int visibleItemCount, totalItemCount, pasVisibleItems, previous_total = 0;
int page = 1;
String query = "";
public View root;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
root = inflater.inflate(R.layout.fragment_search, container, false);
presenter = new searchPresenter(this, getContext());
session = new sessionHelper(getActivity());
list = new ArrayList<>();
recyclerViewSearch = root.findViewById(R.id.recyclerViewSearch);
linearLayoutData = root.findViewById(R.id.linearLayoutMessageNoData);
adapter = new itemAdapter(list, new itemAdapter.OnItemClickListener() {
@Override
public void OnItemClickListener(int position, itemMain item) {
Bundle bundle = new Bundle();
bundle.putInt("id", item.getId());
bundle.putString("title", item.getTitle());
bundle.putString("poster", item.getPoster());
bundle.putString("votes", item.getVotes());
bundle.putString("language", item.getLanguage());
bundle.putString("date", item.getDate());
bundle.putString("overview", item.getOverview());
detailFragment dialog = new detailFragment();
dialog.setArguments(bundle);
FragmentTransaction ft = ((AppCompatActivity) getActivity()).getSupportFragmentManager().beginTransaction();
dialog.show(ft, "DIALOG");
}
});
layoutManager = new GridLayoutManager(getActivity(), 3);
recyclerViewSearch.setLayoutManager(layoutManager);
recyclerViewSearch.setHasFixedSize(true);
recyclerViewSearch.setAdapter(adapter);
recyclerViewSearch.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if(newState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL)
{
isLoadig = true;
}
}
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
visibleItemCount = layoutManager.getChildCount();
totalItemCount = layoutManager.getItemCount();
pasVisibleItems = layoutManager.findFirstVisibleItemPosition();
if(isLoadig && (visibleItemCount + pasVisibleItems == totalItemCount))
{
page++;
isLoadig = false;
presenter.getSearch(session.getApykey(), query, page, presenter);
}
}
});
editTextBusqueda = root.findViewById(R.id.editTextSearch);
editTextBusqueda.addTextChangedListener(this);
return root;
}
@Override
public void requestResult(List<itemMain> list) {
adapter.addAll(list);
}
@Override
public void messageNoData(boolean isVisible) {
linearLayoutData.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
/**
* This method is called to notify you that, within <code>s</code>,
* the <code>count</code> characters beginning at <code>start</code>
* have just replaced old text that had length <code>before</code>.
* It is an error to attempt to make changes to <code>s</code> from
* this callback.
*
* @param s
* @param start
* @param before
* @param count
*/
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (count > 3){
presenter.getSearch(session.getApykey(), s.toString(), page, presenter);
}
}
@Override
public void afterTextChanged(Editable s) {
}
}
| [
"eosorio@netwarmonitor.com"
] | eosorio@netwarmonitor.com |
7b502127ec5d69c399be8b7481a987ec2b903040 | 0c5a39977198524569a40c07f626c038c583418b | /android_game/BubblesModel.java | ab480a2e513e4185c8a06179695e5afcafd121da | [] | no_license | rahmanhafeezul/Android | 5e12ccbfeeb44dc63308dfc7808516ddc94b2665 | c4b577b889a7f2fed60e21abb525e8f49f2f47b6 | refs/heads/master | 2020-06-05T07:44:19.084882 | 2013-04-27T19:06:37 | 2013-04-27T19:06:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,251 | java | import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import android.content.Context;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
/**
* This data model tracks bubbles on the screen.
*
* @see BubblesActivity
*/
public class BubblesModel implements OnCompletionListener {
private static final float INITIAL_RADIUS = 20f;
private static final float MAX_RADIUS = 100f;
// higher numbers make the balls expand faster
private static final float RADIUS_CHANGE_PER_MS = .08f;
private final List<MediaPlayer> players = new LinkedList<MediaPlayer>();
private boolean running = false;
public static final class Bubble {
float x, y, radius;
public Bubble(float x, float y) {
this.x = x;
this.y = y;
radius = INITIAL_RADIUS;
}
}
private final List<Bubble> bubbles = new LinkedList<Bubble>();
private volatile long lastTimeMs = -1;
public final Object LOCK = new Object();
public BubblesModel() {
}
public void onResume(Context context) {
synchronized (LOCK) {
for (int i=0; i<4; i++) {
MediaPlayer mp = MediaPlayer.create(context, R.raw.pop);
mp.setVolume(1f, 1f);
players.add(mp);
try {
mp.setLooping(false);
mp.setOnCompletionListener(this);
// TODO: there is a serious bug here. After a few seconds of
// inactivity, we see this in LogCat:
// AudioHardwareMSM72xx Going to standby
// then the sounds don't play until you click several more
// times, then it starts working again
} catch (Exception e) {
e.printStackTrace();
players.remove(mp);
}
}
running = true;
}
}
public void onPause(Context context) {
synchronized (LOCK) {
running = false;
for (MediaPlayer p : players) {
p.release();
}
players.clear();
}
}
public List<Bubble> getBubbles() {
synchronized (LOCK) {
return new ArrayList<Bubble>(bubbles);
}
}
public void addBubble(float x, float y) {
synchronized (LOCK) {
bubbles.add(new Bubble(x,y));
}
}
public void setSize(int width, int height) {
// TODO ignore this for now...we could hide bubbles that
// are out of bounds, for example
}
public void updateBubbles() {
long curTime = System.currentTimeMillis();
if (lastTimeMs < 0) {
lastTimeMs = curTime;
// this is the first reading, so don't change anything
return;
}
long elapsedMs = curTime - lastTimeMs;
lastTimeMs = curTime;
final float radiusChange = elapsedMs * RADIUS_CHANGE_PER_MS;
MediaPlayer mp = null;
synchronized (LOCK) {
Set<Bubble> victims = new HashSet<Bubble>();
for (Bubble b : bubbles) {
b.radius += radiusChange;
if (b.radius > MAX_RADIUS) {
victims.add(b);
}
}
if (victims.size() > 0) {
bubbles.removeAll(victims);
// since a bubble popped, try to get a media player
if (!players.isEmpty()) {
mp = players.remove(0);
}
}
}
if (mp != null) {
//System.out.println("**pop**");
mp.start();
}
}
public void onCompletion(MediaPlayer mp) {
synchronized (LOCK) {
if (running) {
mp.seekTo(0);
//System.out.println("on completion!");
// return the player to the pool of available instances
players.add(mp);
}
}
}
}
| [
"rahman.hafeezul@gmail.com"
] | rahman.hafeezul@gmail.com |
c0c1936c1f35a8493ce96892418d54d62307725c | a66bdd5f9ffc9da8762732992e86d06c57fd927c | /src/main/java/br/com/mtools/mongodb/entidy/Student.java | 5cfa5b3caea774815a3382c0af980d5d9f9cc509 | [] | no_license | marceloccs/spring-security-teste | 5cb7f7fdc63c100bd6857c9f9cd09488ad7d020d | 01357cbd77acb3bf5913cea84e24e1a6752fd208 | refs/heads/master | 2020-05-05T01:36:09.155823 | 2019-04-05T02:31:45 | 2019-04-05T02:31:45 | 179,607,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package br.com.mtools.mongodb.entidy;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Document
@Setter
@Getter
@ToString
public class Student {
@Id
private String id;
private String name;
private int age;
}
| [
"marcelo.custodio95@gmail.com"
] | marcelo.custodio95@gmail.com |
4794b4670511e75297ca535b4c537bbc342b23f8 | e290f8d5e77623ddb7181b9f1bb6f2705db8c482 | /app/src/main/java/com/del/ministry/utils/StringUtil.java | cea61521464187484634edc873473ce0eb0ac405 | [] | no_license | johni5/ministry | b4f7788034b766dc33ae1ac41e4e6b60d735cbd5 | 2a0d454d0824f9789e9f56e94409d8ad749cd2c3 | refs/heads/master | 2022-07-06T11:47:09.055775 | 2021-04-20T21:29:48 | 2021-04-20T21:29:49 | 145,448,251 | 0 | 0 | null | 2022-06-29T18:31:54 | 2018-08-20T17:16:13 | Java | UTF-8 | Java | false | false | 3,501 | java | package com.del.ministry.utils;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtil {
private StringUtil() {
}
public static String safeToString(Object src, String def) {
return src == null ? def : src.toString();
}
public static boolean isTrimmedEmpty(Object s) {
return s == null || s.toString().trim().length() == 0;
}
public static String firstNotEmpty(Object... s) {
for (Object o : s) {
if (!isTrimmedEmpty(o)) {
return o.toString();
}
}
return null;
}
public static boolean isAllTrimmedEmpty(Object... s) {
if (s == null) {
return true;
}
for (Object o : s) {
if (!isTrimmedEmpty(o)) {
return false;
}
}
return true;
}
public static String normalizeLine(Object text) {
if (text != null) {
return text.toString().replace("\n", " ").replace("\r", " ").trim();
}
return "";
}
public static String wrapIfNotEmpty(Object value, String wrapper) {
if (!isTrimmedEmpty(value)) {
return wrapper + value + wrapper;
}
return null;
}
public static String wrapIfNotNull(Object value, String wrapper) {
if (value != null) {
return wrapper + value.toString() + wrapper;
}
return null;
}
public static String scrapMiddle(String str, int len) {
return scrapMiddle(str, len, "...");
}
public static String scrapMiddle(String str, int len, boolean repeat) {
return scrapMiddle(str, len, "...", repeat);
}
public static String scrapMiddle(String str, int len, String middleStr) {
return scrapMiddle(str, len, middleStr, true);
}
public static String scrapMiddle(String str, int len, String middleStr, boolean repeat) {
if (str == null || str.length() <= len) {
return str;
}
int substrLen = len - Math.round((float) (middleStr.length() / 2));
int substrLen2 = str.length() - substrLen;
if (!repeat && (substrLen2 < substrLen)) {
if (str.length() < substrLen * 2) {
return str;
}
substrLen2 = substrLen + 1;
}
substrLen2 = Math.max(substrLen2, substrLen);
String scrapText = str.substring(0, substrLen) + middleStr + str.substring(substrLen2);
return scrapText.length() > str.length() ? str : scrapText;
}
public static List<Integer> extractNumbers(String text) {
if (isTrimmedEmpty(text)) return null;
Pattern p = Pattern.compile("-?\\d+");
Matcher m = p.matcher(text);
List<Integer> i = Lists.newArrayList();
while (m.find()) {
try {
i.add(Integer.parseInt(m.group()));
} catch (NumberFormatException e) {
//
}
}
return i;
}
public static Integer findStreetNumber(String n) {
int r = -1;
if (!isTrimmedEmpty(n))
while (n.length() > 0) {
try {
r = Integer.parseInt(n);
break;
} catch (NumberFormatException e) {
n = n.substring(0, n.length() - 1);
}
}
return r;
}
} | [
"johni5@mosk.ru"
] | johni5@mosk.ru |
dce51ff76fe7725885e3629f2029269555ad67e1 | 4d1c8124b5a515bbfbf87ddf213fbb24f82580a1 | /src/main/java/TareaStrategyTiendaRopa/Primavera.java | 61e9af87580d4dd58f1e66ba6417cd540138cbcc | [] | no_license | Manu200162/TareasPatronesDiseno | 31d57355e115cffa83793387fcbf634d5b278ac0 | 57ca0e4f740401fcf7afd80410511b4ee6672122 | refs/heads/master | 2023-06-12T23:22:23.419454 | 2021-07-01T05:19:22 | 2021-07-01T05:19:22 | 368,734,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 567 | java | package TareaStrategyTiendaRopa;
import java.util.List;
public class Primavera implements IEstrategiaVentas {
@Override
public void cambiarPrecio(List<PrendaRopa> prendas) {
for(PrendaRopa ropa : prendas){
int antPrecio = ropa.getPrecio();
System.out.println("El precio se mantiene en primavera");
System.out.println("******************Datos Prenda Primavera****************");
ropa.showInfo();
System.out.println("****************************************************");
}
}
}
| [
"manli200134@gmail.com"
] | manli200134@gmail.com |
85a191ac029bc16d7d4e053b651c90d9cf60e79d | 208ba847cec642cdf7b77cff26bdc4f30a97e795 | /m/src/main/java/org.wp.m/datasets/ReaderDatabase.java | e93facf0ca634c1fce614add5c584f4999d8243b | [] | no_license | kageiit/perf-android-large | ec7c291de9cde2f813ed6573f706a8593be7ac88 | 2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8 | refs/heads/master | 2021-01-12T14:00:19.468063 | 2016-09-27T13:10:42 | 2016-09-27T13:10:42 | 69,685,305 | 0 | 0 | null | 2016-09-30T16:59:49 | 2016-09-30T16:59:48 | null | UTF-8 | Java | false | false | 9,339 | java | package org.wp.m.datasets;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import org.wp.m.WordPress;
import org.wp.m.util.AppLog;
import org.wp.m.util.AppLog.T;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* database for all reader information
*/
public class ReaderDatabase extends SQLiteOpenHelper {
protected static final String DB_NAME = "wpreader.db";
private static final int DB_VERSION = 121;
/*
* version history
* 67 - added tbl_blog_info to ReaderBlogTable
* 68 - added author_blog_id to ReaderCommentTable
* 69 - renamed tbl_blog_urls to tbl_followed_blogs in ReaderBlogTable
* 70 - added author_id to ReaderCommentTable and ReaderPostTable
* 71 - added blog_id to ReaderUserTable
* 72 - removed tbl_followed_blogs from ReaderBlogTable
* 73 - added tbl_recommended_blogs to ReaderBlogTable
* 74 - added primary_tag to ReaderPostTable
* 75 - added secondary_tag to ReaderPostTable
* 76 - added feed_id to ReaderBlogTable
* 77 - restructured tag tables (ReaderTagTable)
* 78 - added tag_type to ReaderPostTable.tbl_post_tags
* 79 - added is_likes_enabled and is_sharing_enabled to tbl_posts
* 80 - added tbl_comment_likes in ReaderLikeTable, added num_likes to tbl_comments
* 81 - added image_url to tbl_blog_info
* 82 - added idx_posts_timestamp to tbl_posts
* 83 - removed tag_list from tbl_posts
* 84 - added tbl_attachments
* 85 - removed tbl_attachments, added attachments_json to tbl_posts
* 90 - added default values for all INTEGER columns that were missing them (hotfix 3.1.1)
* 92 - added default values for all INTEGER columns that were missing them (3.2)
* 93 - tbl_posts text is now truncated to a max length (3.3)
* 94 - added is_jetpack to tbl_posts (3.4)
* 95 - added page_number to tbl_comments (3.4)
* 96 - removed tbl_tag_updates, added date_updated to tbl_tags (3.4)
* 97 - added short_url to tbl_posts
* 98 - added feed_id to tbl_posts
* 99 - added feed_url to tbl_blog_info
* 100 - changed primary key on tbl_blog_info
* 101 - dropped is_reblogged from ReaderPostTable
* 102 - changed primary key of tbl_blog_info from blog_id+feed_id to just blog_id
* 103 - added discover_json to ReaderPostTable
* 104 - added word_count to ReaderPostTable
* 105 - added date_updated to ReaderBlogTable
* 106 - dropped is_likes_enabled and is_sharing_enabled from tbl_posts
* 107 - "Blogs I Follow" renamed to "Followed Sites"
* 108 - added "has_gap_marker" to tbl_post_tags
* 109 - added "feed_item_id" to tbl_posts
* 110 - added xpost_post_id and xpost_blog_id to tbl_posts
* 111 - added author_first_name to tbl_posts
* 112 - no structural change, just reset db
* 113 - added tag_title to tag tables
* 114 - renamed tag_name to tag_slug in tag tables
* 115 - added ReaderSearchTable
* 116 - added tag_display_name to tag tables
* 117 - changed tbl_posts.timestamp from INTEGER to REAL
* 118 - renamed tbl_search_history to tbl_search_suggestions
* 119 - renamed tbl_posts.timestamp to sort_index
* 120 - added "format" to tbl_posts
* 121 - removed word_count from tbl_posts
*/
/*
* database singleton
*/
private static ReaderDatabase mReaderDb;
private final static Object mDbLock = new Object();
public static ReaderDatabase getDatabase() {
if (mReaderDb == null) {
synchronized(mDbLock) {
if (mReaderDb == null) {
mReaderDb = new ReaderDatabase(WordPress.getContext());
// this ensures that onOpen() is called with a writable database (open will fail if app calls getReadableDb() first)
mReaderDb.getWritableDatabase();
}
}
}
return mReaderDb;
}
public static SQLiteDatabase getReadableDb() {
return getDatabase().getReadableDatabase();
}
public static SQLiteDatabase getWritableDb() {
return getDatabase().getWritableDatabase();
}
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
//copyDatabase(db);
}
/*
* resets (clears) the reader database
*/
public static void reset() {
// note that we must call getWritableDb() before getDatabase() in case the database
// object hasn't been created yet
SQLiteDatabase db = getWritableDb();
getDatabase().reset(db);
}
public ReaderDatabase(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
createAllTables(db);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// for now just reset the db when upgrading, future versions may want to avoid this
// and modify table structures, etc., on upgrade while preserving data
AppLog.i(T.READER, "Upgrading database from version " + oldVersion + " to version " + newVersion);
reset(db);
}
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// IMPORTANT: do NOT call super() here - doing so throws a SQLiteException
AppLog.w(T.READER, "Downgrading database from version " + oldVersion + " to version " + newVersion);
reset(db);
}
private void createAllTables(SQLiteDatabase db) {
ReaderCommentTable.createTables(db);
ReaderLikeTable.createTables(db);
ReaderPostTable.createTables(db);
ReaderTagTable.createTables(db);
ReaderUserTable.createTables(db);
ReaderThumbnailTable.createTables(db);
ReaderBlogTable.createTables(db);
ReaderSearchTable.createTables(db);
}
private void dropAllTables(SQLiteDatabase db) {
ReaderCommentTable.dropTables(db);
ReaderLikeTable.dropTables(db);
ReaderPostTable.dropTables(db);
ReaderTagTable.dropTables(db);
ReaderUserTable.dropTables(db);
ReaderThumbnailTable.dropTables(db);
ReaderBlogTable.dropTables(db);
ReaderSearchTable.dropTables(db);
}
/*
* drop & recreate all tables (essentially clears the db of all data)
*/
private void reset(SQLiteDatabase db) {
db.beginTransaction();
try {
dropAllTables(db);
createAllTables(db);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
/*
* purge older/unattached data - use purgeAsync() to do this in the background
*/
private static void purge() {
SQLiteDatabase db = getWritableDb();
db.beginTransaction();
try {
int numPostsDeleted = ReaderPostTable.purge(db);
// don't bother purging other data unless posts were purged
if (numPostsDeleted > 0) {
AppLog.i(T.READER, String.format("%d total posts purged", numPostsDeleted));
// purge unattached comments
int numCommentsDeleted = ReaderCommentTable.purge(db);
if (numCommentsDeleted > 0) {
AppLog.i(T.READER, String.format("%d comments purged", numCommentsDeleted));
}
// purge unattached likes
int numLikesDeleted = ReaderLikeTable.purge(db);
if (numLikesDeleted > 0) {
AppLog.i(T.READER, String.format("%d likes purged", numLikesDeleted));
}
// purge unattached thumbnails
int numThumbsPurged = ReaderThumbnailTable.purge(db);
if (numThumbsPurged > 0) {
AppLog.i(T.READER, String.format("%d thumbnails purged", numThumbsPurged));
}
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
public static void purgeAsync() {
new Thread() {
@Override
public void run() {
purge();
}
}.start();
}
/*
* used during development to copy database to external storage so we can access it via DDMS
*/
private void copyDatabase(SQLiteDatabase db) {
String copyFrom = db.getPath();
String copyTo = WordPress.getContext().getExternalFilesDir(null).getAbsolutePath() + "/" + DB_NAME;
try {
InputStream input = new FileInputStream(copyFrom);
OutputStream output = new FileOutputStream(copyTo);
byte[] buffer = new byte[1024];
int length;
while ((length = input.read(buffer)) > 0) {
output.write(buffer, 0, length);
}
output.flush();
output.close();
input.close();
} catch (IOException e) {
AppLog.e(T.DB, "failed to copy reader database", e);
}
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
de36826967a65714d0d06c48eceef6f483dc5896 | ed9c07e35f260539c10fe85537f3bf8223a0bd38 | /BiblioJava/src/view/SaisieDocument.java | e9669982a18d37719deef5059828c364fe31ada5 | [] | no_license | kilianpoulin/Library-Management | 66c3ac5f702813cd618f6f5401ede46a35007f87 | 418b94122a2207565217799bedc10f3f1b9e4648 | refs/heads/master | 2021-04-15T18:01:31.435731 | 2018-04-28T19:29:53 | 2018-04-28T19:29:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,210 | java | package view;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import model.Bibliotheque;
import model.Livre;
import model.Manuel;
import model.Revue;
import model.Roman;
/**
* Cette classe (qui est une fenêtre) permet d'ajouter plusieurs types de documents au choix :
* - Livre
* - Roman
* - Manuel
* - Revue
*
* Si l'utilisateur ajoute un document alors le résultat sera affiché dans la fenêtre de classe AfficherDocuments.
* @author Kilian
*/
public class SaisieDocument extends JFrame {
private Fenetre main = null;
/// tous les composants
private final String[] typeList = {"Livre", "Roman", "Manuel", "Revue"};
private final String[] moisList = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
private final String[] anneeList = {"2018", "2017", "2016", "2015", "2014", "2013", "2012"};
private final JComboBox type = new JComboBox(typeList);
private final JLabel titre = new JLabel("Ajouter un document à la bibliothèque");
private final JLabel labelPrix = new JLabel("Prix litteraire : ");
private final JLabel labelPages = new JLabel("Nb pages : ");
private final JLabel labelAuteur = new JLabel("Auteur : ");
private final JLabel credits = new JLabel("Credits : Kilian Poulin & Edouard Ok - (2018)");
private final JLabel labelTitre = new JLabel("Titre : ");
private final JLabel labelNiveau = new JLabel("Niveau : ");
private final JLabel labelMois = new JLabel("Mois : ");
private final JLabel labelAnnee = new JLabel("Annee : ");
public final JButton valider = new JButton("Valider");
private final JButton gotomenu = new JButton("Retour au Menu");
private final JButton Btype = new JButton("Changer");
private final JRadioButton bMedicis = new JRadioButton("Medicis");
private final JRadioButton bRenaudot = new JRadioButton("Renaudot");
private final JRadioButton bGoncourt = new JRadioButton("Goncourt");
private final JTextField textTitre = new JTextField();
private final JTextField textAuteur = new JTextField();
private final JTextField textPages = new JTextField();
private final JTextField niveau = new JTextField();
private final JComboBox mois = new JComboBox(moisList);
private final JComboBox annee = new JComboBox(anneeList);
/**
* Constructeur permettant de lier la fenêtre à la fenêtre principale.
* @param frame
* La fenêtre principale (le menu).
*/
public SaisieDocument(Fenetre frame){
build();
this.main = frame;
}
/**
* Construit les éléments basiques de la fenêtre.
*/
public void build(){
setTitle("Saisie d'un document");
setMinimumSize(new Dimension(800, 600));
setPreferredSize(new Dimension(800, 600));
setContentPane(buildContentPane());
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
setVisible(false);
}
/**
* Construit la structure interne de la fenêtre (place tous les élements).
* @return
* le contenu de la fenêtre.
*/
Container buildContentPane()
{
getContentPane().setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
headerContentPane(gbc);
choiceContentPane(gbc);
footerContentPane(gbc);
return getContentPane();
}
/**
* Affiche le choix de type de document à ajouter et gère les différents champ à afficher en conséquence.
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void choiceContentPane(GridBagConstraints gbc){
/**
* Positionnement du choix du type de document à ajouter.
*/
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 1.;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(10, 50, 0, 0);
type.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(type, gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.insets = new Insets(10, 60, 0, 0);
Btype.setFont(new Font("TimesRoman", Font.PLAIN, 24));
getContentPane().add(Btype, gbc);
Btype.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
removeComponents();
if(type.getSelectedItem() == "Livre"){
documentContentPane(gbc);
livreContentPane(gbc);
valider.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
if(!textTitre.getText().equals("")
&& !textAuteur.getText().equals("")
&& !textPages.getText().equals("")) {
Livre livre = new Livre(textTitre.getText(), textAuteur.getText(),
Integer.parseInt(textPages.getText()));
main.biblio.addDocument(livre);
setVisible(false);
main.frame_afficher.setVisible(true);
}
}
}
);
}
else if(type.getSelectedItem() == "Roman"){
documentContentPane(gbc);
livreContentPane(gbc);
romanContentPane(gbc);
valider.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
if(!textTitre.getText().equals("")
&& !textAuteur.getText().equals("")
&& !textPages.getText().equals("")) {
Roman roman = null;
if(bGoncourt.isSelected()){
roman = new Roman(textTitre.getText(), textAuteur.getText(),
Integer.parseInt(textPages.getText()), Roman.GONCOURT);
}
else if(bMedicis.isSelected()){
roman = new Roman(textTitre.getText(), textAuteur.getText(),
Integer.parseInt(textPages.getText()), Roman.GONCOURT);
}
else if(bRenaudot.isSelected()){
roman = new Roman(textTitre.getText(), textAuteur.getText(),
Integer.parseInt(textPages.getText()), Roman.RENAUDOT);
}
else{
roman = new Roman(textTitre.getText(), textAuteur.getText(),
Integer.parseInt(textPages.getText()));
}
main.biblio.addDocument(roman);
ActionEvent event;
long when;
when = System.currentTimeMillis();
event = new ActionEvent(main.frame_afficher.refresh, ActionEvent.ACTION_PERFORMED, "Anything", when, 0);
for (ActionListener listener : main.frame_afficher.refresh.getActionListeners()) {
listener.actionPerformed(event);
}
setVisible(false);
main.frame_afficher.setVisible(true);
}
}
}
);
}
else if(type.getSelectedItem() == "Manuel"){
documentContentPane(gbc);
livreContentPane(gbc);
manuelContentPane(gbc);
valider.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
if(!textTitre.getText().equals("")
&& !textAuteur.getText().equals("")
&& !textPages.getText().equals("")
&& !niveau.getText().equals("")) {
Manuel manuel = new Manuel(textTitre.getText(), textAuteur.getText(),
Integer.parseInt(niveau.getText()),
Integer.parseInt(textPages.getText()));
main.biblio.addDocument(manuel);
setVisible(false);
main.frame_afficher.setVisible(true);
}
}
}
);
}
else if(type.getSelectedItem() == "Revue"){
documentContentPane(gbc);
revueContentPane(gbc);
valider.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
String month = (String) mois.getSelectedItem();
String year = (String) annee.getSelectedItem();
if(!textTitre.getText().equals("")
&& !mois.getSelectedItem().equals("")
&& !annee.getSelectedItem().equals("")) {
Revue revue = new Revue(textTitre.getText(),
Integer.parseInt(month),
Integer.parseInt(year));
main.biblio.addDocument(revue);
setVisible(false);
main.frame_afficher.setVisible(true);
}
}
}
);
}
setContentPane(getContentPane());
}
}
);
}
/**
* Affiche l'en-tête de la fenêtre (titre)
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void headerContentPane(GridBagConstraints gbc){
/**
* Positionnement du itre de la page "Saisie d'un document".
*/
gbc.gridx = 0;
gbc.gridy = 0; // on commence à la position (0,0)
gbc.anchor = GridBagConstraints.NORTH; // on commence au début de la ligne
gbc.gridheight = 1; // le titre ne s'étend que sur une ligne
gbc.weighty = 1;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = GridBagConstraints.REMAINDER; // le titre est le dernier élément de la ligne
gbc.insets = new Insets(30, 0, 0, 0);
titre.setHorizontalAlignment(JLabel.CENTER);
titre.setFont(new Font("TimesRoman", Font.PLAIN , 28));
getContentPane().add(titre, gbc);
}
/**
* Affiche les champs nécessaire pour l'ajout d'un document
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void documentContentPane(GridBagConstraints gbc){
/**
* Positionnement du label du champ de saisie "Titre du document".
*/
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 1.;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(10, 50, 0, 0);
labelTitre.setHorizontalAlignment(JLabel.CENTER);
labelTitre.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(labelTitre, gbc);
/**
* Positionnement du champ de saisie "Titre du document".
*/
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.insets = new Insets(0, 0, 0, 30);
textTitre.setFont(new Font("TimesRoman", Font.PLAIN, 24));
getContentPane().add(textTitre, gbc);
}
/**
* Affiche les champs nécessaire pour l'ajout d'un roman
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void romanContentPane(GridBagConstraints gbc){
/**
* Positionnement du label prix littéraires.
*/
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 0.;
gbc.insets = new Insets(0, 50, 10, 10);
labelPrix.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(labelPrix, gbc);
/**
* Positionnement du choix : "Prix GONCOURT".
*/
gbc.gridx = 1;
gbc.gridy = 5;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.gridheight = 1;
gbc.insets = new Insets(0, 50, 10, 10);
bGoncourt.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(bGoncourt, gbc);
/**
* Positionnement du choix : "Prix MEDICIS".
*/
gbc.gridx = 2;
gbc.gridy = 5;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.gridheight = 1;
gbc.insets = new Insets(0, 50, 10, 10);
bMedicis.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(bMedicis, gbc);
/**
* Positionnement du choix : "Prix RENAUDOT".
*/
gbc.gridx = 3;
gbc.gridy = 5;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
gbc.insets = new Insets(0, 50, 10, 10);
bRenaudot.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(bRenaudot, gbc);
bGoncourt.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
if(bGoncourt.isSelected()){
bMedicis.setSelected(false);
bRenaudot.setSelected(false);
}
}
}
);
bMedicis.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
if(bMedicis.isSelected()){
bGoncourt.setSelected(false);
bRenaudot.setSelected(false);
}
}
}
);
bRenaudot.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
if(bRenaudot.isSelected()){
bGoncourt.setSelected(false);
bMedicis.setSelected(false);
}
}
}
);
}
/**
* Affiche le bas de page dans la fenêtre
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void footerContentPane(GridBagConstraints gbc){
/**
* Positionnement du bouton "Valider".
*/
gbc.gridx = 0;
gbc.gridy = 6;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 1.;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(0, 15, 0, 0);
valider.setFont(new Font("TimesRoman", Font.BOLD , 24));
valider.setBackground(Color.BLACK);
valider.setForeground(Color.WHITE);
getContentPane().add(valider, gbc);
/**
* Positionnement du bouton "Retour au MENU".
*/
gbc.gridx = 1;
gbc.gridy = 6;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
//gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.insets = new Insets(0, 15, 0, 10);
gotomenu.setFont(new Font("TimesRoman", Font.ITALIC , 24));
gotomenu.setBackground(Color.RED);
gotomenu.setForeground(Color.WHITE);
getContentPane().add(gotomenu, gbc);
/**
* Positionnement des credits.
*/
gbc.gridx = 0;
gbc.gridy = 7;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.insets = new Insets(10, 0, 0, 20);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.BOTH;
credits.setHorizontalAlignment(JLabel.CENTER);
credits.setFont(new Font("TimesRoman", Font.PLAIN , 20));
getContentPane().add(credits, gbc);
gotomenu.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
setVisible(false);
main.setVisible(true);
}
});
}
}
);
}
/**
* Affiche les champs nécessaire pour l'ajout d'un livre
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void livreContentPane(GridBagConstraints gbc){
/**
* Positionnement du label du champ de saisie "Nom de l'auteur".
*/
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 1.;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(0, 50, 0, 0);
labelAuteur.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(labelAuteur, gbc);
/**
* Positionnement du champ de saisie "Nom de l'auteur".
*/
gbc.gridx = 1;
gbc.gridy = 3;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.insets = new Insets(0, 0, 0, 30);
textAuteur.setFont(new Font("TimesRoman", Font.PLAIN, 24));
getContentPane().add(textAuteur, gbc);
/**
* Positionnement du champ de saisie "Nombre de pages".
*/
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 1.;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(0, 40, 0, 0);
labelPages.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(labelPages, gbc);
/**
* Positionnement du champ de saisie "Nombre de pages".
*/
gbc.gridx = 1;
gbc.gridy = 4;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.insets = new Insets(0, 0, 0, 30);
textPages.setFont(new Font("TimesRoman", Font.PLAIN, 24));
getContentPane().add(textPages, gbc);
}
/**
* Affiche les champs nécessaire pour l'ajout d'un manuel
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void manuelContentPane(GridBagConstraints gbc){
/**
* Positionnement du champ de saisie "Niveau".
*/
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 1.;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(0, 40, 0, 0);
labelNiveau.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(labelNiveau, gbc);
/**
* Positionnement du champ de saisie "Niveau".
*/
gbc.gridx = 1;
gbc.gridy = 5;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.insets = new Insets(0, 0, 0, 30);
niveau.setFont(new Font("TimesRoman", Font.PLAIN, 24));
getContentPane().add(niveau, gbc);
}
/**
* Affiche les champs nécessaire pour l'ajout d'une revue
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void revueContentPane(GridBagConstraints gbc){
/**
* Positionnement du champ de saisie "Mois".
*/
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 1.;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(0, 40, 0, 0);
labelMois.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(labelMois, gbc);
/**
* Positionnement du champ de saisie "Mois".
*/
gbc.gridx = 1;
gbc.gridy = 3;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.insets = new Insets(0, 0, 0, 30);
mois.setFont(new Font("TimesRoman", Font.PLAIN, 24));
getContentPane().add(mois, gbc);
/**
* Positionnement du champ de saisie "Année".
*/
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.;
gbc.weighty = 1.;
gbc.fill = GridBagConstraints.NONE;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(0, 40, 0, 0);
labelAnnee.setFont(new Font("TimesRoman", Font.PLAIN , 24));
getContentPane().add(labelAnnee, gbc);
/**
* Positionnement du champ de saisie "Année".
*/
gbc.gridx = 1;
gbc.gridy = 4;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.insets = new Insets(0, 0, 0, 30);
annee.setFont(new Font("TimesRoman", Font.PLAIN, 24));
getContentPane().add(annee, gbc);
}
/**
* Supprime tous les composants en cas de changement de type de document à ajouter.
* @param gbc
* Contraintes de placement dans la fenêtre.
*/
void removeComponents(){
//getContentPane().remove(titre);
getContentPane().remove(labelPrix);
getContentPane().remove(labelPages);
getContentPane().remove(labelAuteur);
//getContentPane().remove(credits);
getContentPane().remove(labelTitre);
getContentPane().remove(labelAnnee);
getContentPane().remove(labelMois);
getContentPane().remove(labelNiveau);
//getContentPane().remove(valider);
//getContentPane().remove(gotomenu);
getContentPane().remove(bMedicis);
getContentPane().remove(bGoncourt);
getContentPane().remove(bRenaudot);
getContentPane().remove(textTitre);
getContentPane().remove(textAuteur);
getContentPane().remove(textPages);
getContentPane().remove(niveau);
getContentPane().remove(annee);
getContentPane().remove(mois);
}
}
| [
"kilian.poulin@efrei.net"
] | kilian.poulin@efrei.net |
7963c33dbb1c855a84e2fa31d830a767bf09a708 | 4611846f6e38bfedd70b2a9506a385b4ec933537 | /src/main/java/cn/itcast/travel/dao/UserDao.java | ba88d7b7f14bbdb99e5acb7be2cdbcc60b60fb05 | [] | no_license | cernykisss/TravellingWebsite | 7f56455e4768d9fe91233241004ec7e5f38c674e | 95701e508c11b1bb070a7b97029e2379c0b76c66 | refs/heads/master | 2023-01-23T23:14:43.046841 | 2020-11-25T16:37:50 | 2020-11-25T16:37:50 | 315,996,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package cn.itcast.travel.dao;
import cn.itcast.travel.domain.User;
public interface UserDao {
User findByUsername(String username);
void save(User user);
User findByCode(String code);
void updateStatus(User user);
User findByUsernameAndPassword(String username, String password);
}
| [
"1040291831@qq.com"
] | 1040291831@qq.com |
ee1f9c8e7f80bfe4d8b400b3702ffa177d141538 | a756de7a4c1aa0d2ad9b902025994aed948d2381 | /src/main/java/org/richfell/microrest/controllers/errors/ResourceNotFoundException.java | fc59ae9480be53e04c9bd2adafa67718932a42ca | [] | no_license | richfell-org/micro-rest | 88b21ac4229b5e7bc48c028c46621e63df7ff54e | 87c9345ed6972c910cfa1cac785906f65f2c67f6 | refs/heads/master | 2021-08-17T07:33:23.895398 | 2017-11-20T23:15:55 | 2017-11-20T23:15:55 | 110,618,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,488 | java |
package org.richfell.microrest.controllers.errors;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
* An exception for REST resources which are not found. Will cause and
* HTTP status of NOT FOUND when thrown during the processing of an HTTP
* request.
*
* @author Richard Fellinger rich@richfell.org
*/
@ResponseStatus(HttpStatus.NOT_FOUND)
public class ResourceNotFoundException
extends RuntimeException
{
/**
* Creates a <code>ResourceNotFoundException</code> without detail message.
*/
public ResourceNotFoundException()
{
super();
}
/**
* Creates a <code>ResourceNotFoundException</code> with a detail message and cause.
*
* @param message the message for the exception
* @param cause a root cause of this exception
*/
public ResourceNotFoundException(final String message, final Throwable cause)
{
super(message, cause);
}
/**
* Constructs a <code>ResourceNotFoundException</code> with the specified detail message.
*
* @param message the detail message
*/
public ResourceNotFoundException(final String message)
{
super(message);
}
/**
* Creates a <code>ResourceNotFoundException</code> with a cause.
*
* @param cause a root cause of this exception
*/
public ResourceNotFoundException(final Throwable cause)
{
super(cause);
}
}
| [
"richfell@richfell.org"
] | richfell@richfell.org |
cd988593794916f30a9533e1bab91a42cf84bd46 | 448efd5082b87df9bc8d6f85abbf2d431c675745 | /app/src/main/java/com/example/atom/Transport/widgets/viewpager/PageIndicator.java | 2b704d8bf9a9261b76c5ed6bc63ce7dd4d6922c4 | [] | no_license | cattlee/Transport | 8bc58354e8074257551a7476b8061ea1459d4b06 | 928a878cf1bda9060dffe46612442605bfd2500f | refs/heads/master | 2020-06-11T03:36:16.156677 | 2016-12-18T13:56:52 | 2016-12-18T13:56:52 | 76,013,651 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,834 | java | /*
* Copyright (C) 2011 Patrik Akerfeldt
* Copyright (C) 2011 Jake Wharton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.atom.Transport.widgets.viewpager;
import android.support.v4.view.ViewPager;
/**
* A PageIndicator is responsible to show an visual indicator on the total views
* number and the current visible view.
*
* 自定义viewPager的指示器(indicator)
*/
public interface PageIndicator extends ViewPager.OnPageChangeListener {
/**
* Bind the indicator to a ViewPager.
*
* @param view
*/
void setViewPager(ViewPager view);
/**
* Bind the indicator to a ViewPager.
*
* @param view
* @param initialPosition
*/
void setViewPager(ViewPager view, int initialPosition);
/**
* <p>
* Set the current page of both the ViewPager and indicator.
* </p>
*
* <p>
* This <strong>must</strong> be used if you need to set the page before the
* views are drawn on screen (e.g., default start page).
* </p>
*
* @param item
*/
void setCurrentItem(int item);
/**
* Set a page change listener which will receive forwarded events.
*
* @param listener
*/
void setOnPageChangeListener(ViewPager.OnPageChangeListener listener);
/**
* Notify the indicator that the fragment list has changed.
*/
void notifyDataSetChanged();
}
| [
"305851097@qq.com"
] | 305851097@qq.com |
169cb6d63b1e70301e4dbfee86cf911e6ab397ef | 5593669533a9933c03540388c028975619b75214 | /src/main/java/top/zywork/service/AccountDetailService.java | bc57d94b76d4bb5158330cced472264481e53d8f | [] | no_license | xiaopohou/zywork-app | a23d71e4727864579156e16b3cd7d44b1aae795a | 7ccdabaa2e6e08c9147e2913bd42ff0cdea2ae17 | refs/heads/master | 2020-06-02T23:00:57.539911 | 2019-06-10T09:35:40 | 2019-06-10T09:35:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java | package top.zywork.service;
/**
* AccountDetailService服务接口<br/>
*
* 创建于2018-12-25<br/>
*
* @author http://zywork.top 王振宇
* @version 1.0
*/
public interface AccountDetailService extends BaseService {
}
| [
"847315251@qq.com"
] | 847315251@qq.com |
16ddb536a667c2fe3914edc74d02b657688b1b46 | 945336e95ca96e752880ece499d5c9a2932a7d93 | /src/Codeforces/Codeforcesround524/BestPresent.java | cc01349ee0e16d8fbc03b44f29eb9f33af90f224 | [
"Apache-2.0"
] | permissive | manxist256/MovingBit | 8c5a0438b96421f10b1a90e51fafdd2bdbf609be | 793ac93b647a888dccbd86891244ff79f0f5451e | refs/heads/master | 2020-04-07T02:45:44.713862 | 2019-12-29T13:45:36 | 2019-12-29T13:45:36 | 157,988,805 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java |
import java.util.Scanner;
/*
* 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 Codeforces.Codeforcesround524;
/**
*
* @author mankank
*/
public class BestPresent {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while (T-- > 0) {
long n1 = sc.nextLong(), n2 = sc.nextLong();
long r = n2 - n1;
if (r % 2 != 0) { //even num elements present
if (n1 % 2 != 0) {
System.out.println((r+1)/2);
}
else {
System.out.println(-((r+1)/2));
}
} else { //odd num elements present
if (n1 % 2 != 0) {
System.out.println(((r)/2) - n2);
}
else {
System.out.println(-((r+1)/2) + n2);
}
}
}
}
}
| [
"mankank@amazon.com"
] | mankank@amazon.com |
7bc2a47ef87f9496689ba90ec7888b030d9aa4ed | 49c35e5a9b1d499009acb78c9a1bf4cf08739142 | /hellodb_2/src/main/java/pl/edu/agh/iisg/bd213lg/hellodb/dao/generic/DAO.java | 87cd9d2958a52c1af3138e534aacc551a1d8206a | [] | no_license | marcinlos/db2 | bd2bfc6b70af6ca0235cd35ed2302bafe22a3e41 | 6afa30180f6e5ec155350270f9783105f63eb2e8 | refs/heads/master | 2021-01-23T17:19:11.193670 | 2013-06-16T19:48:06 | 2013-06-16T19:48:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package pl.edu.agh.iisg.bd213lg.hellodb.dao.generic;
import java.io.Serializable;
import java.util.Collection;
import org.hibernate.criterion.Criterion;
public interface DAO<T, Id extends Serializable> {
T find(Id id);
Collection<T> findAll();
Collection<T> findByExample(T example, String... excludes);
Collection<T> findByCriteria(Criterion... criterion);
void save(T entity);
void delete (T entity);
}
| [
"losiu99@gazeta.pl"
] | losiu99@gazeta.pl |
c4ae92b421588540fba151deddb802282949fe1c | 8fee2a23f8982239982103ffdcab7899ee3db968 | /JavaBase/lambda/personBuilder.java | b68723559ba0cb8adf4d053e73adc33d692c826c | [
"MIT"
] | permissive | nanshuii/JavaLearning | 0eb2bff01c16c59a5d9e3b0a24a6875fe1d0d200 | 384c7eb935931b36b610b4c1841eb3fc6c11e4ad | refs/heads/master | 2022-06-22T07:46:11.990733 | 2020-09-14T15:40:23 | 2020-09-14T15:40:23 | 247,014,714 | 0 | 0 | null | 2022-06-21T04:04:10 | 2020-03-13T07:44:12 | HTML | UTF-8 | Java | false | false | 142 | java | package lambda;
@FunctionalInterface
public interface personBuilder {
// 根据name创建person
person builderPerson(String name);
}
| [
"ledonwxsp@163.com"
] | ledonwxsp@163.com |
5a9c2d0d97e44bc4d9898e9e0e4a1c23a16a0f6e | aaba5757aac5d1122e295d837cd3846748907c06 | /usg-server/src/main/java/com/accure/pension/service/PensionBankService.java | f5f98c7abc9696a0faf2d099ff34247bb952904d | [] | no_license | usgInfo/UsgServerProject | 3845ef95595d9cd24285ac25c9164fc435494ad5 | a81df8ec3ef2b298acd0627e414825ddc71fc43b | refs/heads/master | 2021-05-15T00:35:02.159785 | 2018-03-21T13:17:26 | 2018-03-21T13:17:26 | 103,244,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,333 | 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.accure.pension.service;
import com.accure.pension.dto.PensionBank;
import com.accure.pension.manager.PensionBankManager;
import com.accure.usg.common.manager.SessionManager;
import com.accure.usg.server.utils.ApplicationConstants;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Type;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
*
* @author user
*/
public class PensionBankService 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
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/json;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
HttpSession session = request.getSession(false);
if (SessionManager.checkUserSession(session)) {
String bankJson = request.getParameter("bankJson");
String userid = request.getParameter("userid");
Type type = new TypeToken<PensionBank>() {
}.getType();
PensionBank bank = new Gson().fromJson(bankJson, type);
String result = new PensionBankManager().save(bank, userid);
if (result != null && !result.isEmpty()) {
request.setAttribute("statuscode", ApplicationConstants.HTTP_STATUS_SUCCESS);
out.write(new Gson().toJson(result));
} else {
request.setAttribute("statuscode", ApplicationConstants.HTTP_STATUS_FAIL);
out.write(new Gson().toJson(ApplicationConstants.HTTP_STATUS_FAIL));
}
} else {
request.setAttribute("statuscode", ApplicationConstants.HTTP_STATUS_INVALID_SESSION);
out.write(new Gson().toJson(ApplicationConstants.HTTP_STATUS_INVALID_SESSION));
}
} catch (Exception ex) {
request.setAttribute("statuscode", ApplicationConstants.HTTP_STATUS_EXCEPTION);
StringWriter stack = new StringWriter();
ex.printStackTrace(new PrintWriter(stack));
out.write(new Gson().toJson(ApplicationConstants.HTTP_STATUS_EXCEPTION));
} finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @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 doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @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 {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"31878742+usgInfo@users.noreply.github.com"
] | 31878742+usgInfo@users.noreply.github.com |
19ba83849bc50755ba92b32de873c9907ec2b2e8 | 7a21ff93edba001bef328a1e927699104bc046e5 | /project-parent/module-parent/core-module-parent/water-core/src/main/java/com/dotop/smartwater/project/module/core/water/form/SmsConfigForm.java | a541a39fb8b6bdeeb6207037c685607e2d3b1918 | [] | no_license | 150719873/zhdt | 6ea1ca94b83e6db2012080f53060d4abaeaf12f5 | c755dacdd76b71fd14aba5e475a5862a8d92c1f6 | refs/heads/master | 2022-12-16T06:59:28.373153 | 2020-09-14T06:57:16 | 2020-09-14T06:57:16 | 299,157,259 | 1 | 0 | null | 2020-09-28T01:45:10 | 2020-09-28T01:45:10 | null | UTF-8 | Java | false | false | 699 | java | package com.dotop.smartwater.project.module.core.water.form;
import com.dotop.smartwater.dependence.core.common.BaseForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 短信绑定
*
* @date 2019年2月23日
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SmsConfigForm extends BaseForm {
/**
* 配置id
*/
private String id;
/**
* 名称
*/
private String name;
private String code;
/**
* 签名
*/
private String sign;
private String mkey;
private String mkeysecret;
/**
* 状态 0 启用 1 禁用
*/
private Integer status;
/**
* 备注
*/
private String remarks;
/**
* 0:正常,1:删除
*/
private String isDel;
}
| [
"2216502193@qq.com"
] | 2216502193@qq.com |
257d3a855e7e43b257a15b88a736fadec2429742 | dcb73906f052be3c66cf6683a6379ae6b85b9695 | /SeleniumFramework/src/com/testScripts/SpicejetSearch.java | 63f55c57b4e8acb5b51f02e63443913f7009c5b7 | [] | no_license | rakeshbees/AutomationJump | f8cc2ce4d13f94e26d582a7a688c38182d8e28d9 | 6001f0bbad9e038ac424c048ddc93b8d69d41f84 | refs/heads/master | 2020-03-30T17:00:36.569264 | 2018-10-03T15:43:37 | 2018-10-03T15:43:37 | 151,437,455 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,279 | java | package com.testScripts;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.components.Spicejet_search_BusinessFunction;
import com.utility.BaseClass;
public class SpicejetSearch extends BaseClass{
public Spicejet_search_BusinessFunction Spicejet=new Spicejet_search_BusinessFunction(readData);
public void initializeRepository() throws Exception {
reportDetails.put("Test Script Name", this.getClass().getSimpleName());
reportDetails.put("Test Script MyWorksshop Document ID", "Doc1234567");
reportDetails.put("Test Script Revision No", "1");
reportDetails.put("Test Author Name", "Nagesh");
reportDetails.put("Test Script Type", "User Acceptance Testing");
reportDetails.put("Requirement Document ID of System", "Doc1234567");
reportDetails.put("Requirement ID", "US2202");
}
@Parameters("TestcaseNo")
@Test(description = "Scenario:5 - Test the one way search in spicejet.com")
public void f(String no) throws Exception {
System.out.println("Entered in the test method..................");
readData.readTestDataFile(System.getProperty("user.dir") + "\\Resources\\TestData.xlsx", no);
initializeRepository();
Spicejet.launchApp();
Spicejet.find_flight();
}
}
| [
"9853273107@r"
] | 9853273107@r |
f06e8a9ad225ac8d7d2e669af8d0a0d93f6f92ae | 2105c965f97d51d236651672943869d55590f943 | /src/ch/epfl/javass/net/RemotePlayerServer.java | 53e64751ad0ac43a07540da4911eeac404eb6974 | [] | no_license | TugdualKerjan/Javass | 59d5e02357ceadf785378c24051cc99663d08544 | 789687139a4ae69330ba18cdd5ff9e65ac437f73 | refs/heads/master | 2021-07-26T00:33:26.443373 | 2020-08-18T18:23:26 | 2020-08-18T18:23:26 | 210,869,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,395 | java | package ch.epfl.javass.net;
import ch.epfl.javass.bonus.ChatSticker;
import ch.epfl.javass.bonus.Soundlines;
import ch.epfl.javass.bonus.StickerBean;
import ch.epfl.javass.jass.*;
import ch.epfl.javass.jass.Card.Color;
import javafx.collections.MapChangeListener;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import static java.nio.charset.StandardCharsets.US_ASCII;
public class RemotePlayerServer {
private Player player;
private String myName;
private ServerSocket s0Voice;
private Socket sVoice;
private InputStream inputVoice;
private OutputStream outputVoice;
private BufferedReader r;
private BufferedWriter w;
private Socket s;
private ServerSocket s0;
public RemotePlayerServer(Player p, String myName) {
StickerBean.setOnlineBoolean(true);
this.myName = myName;
player = p;
run();
}
public void run() {
//Sticker
Thread stickers = new Thread(() -> {
try (ServerSocket s0Chat = new ServerSocket(5109)) {
Socket sChat = s0Chat.accept();
BufferedReader rChat = new BufferedReader(new InputStreamReader(sChat.getInputStream(), US_ASCII));
BufferedWriter wChat = new BufferedWriter(new OutputStreamWriter(sChat.getOutputStream(), US_ASCII));
StickerBean.stickerProperty().addListener((MapChangeListener<PlayerId, ChatSticker>) l -> {
try {
String playerSticker = StringSerializer.serializeString(l.getMap().get(l.getKey()).name());
String playerOrdinal = StringSerializer.serializeInt(l.getKey().ordinal());
wChat.write(StringSerializer.combine(',', playerOrdinal, playerSticker) + "\n");
wChat.flush();
} catch (IOException e) {
e.printStackTrace();
}
});
while (!sChat.isClosed()) {
String result;
if ((result = rChat.readLine()) != null) {
// System.out.println(result);
try {
String[] bob = StringSerializer.split(result, ',');
String playerSticker = StringSerializer.deserializeString(bob[1]);
PlayerId player = PlayerId.ALL.get(StringSerializer.deserializeInt(bob[0]));
ChatSticker sticker = ChatSticker.valueOf(playerSticker);
StickerBean.setSticker(player, sticker);
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
stickers.setDaemon(true);
stickers.start();
try {
s0Voice = new ServerSocket(5020);
sVoice = s0Voice.accept();
inputVoice = new BufferedInputStream(sVoice.getInputStream());
outputVoice = new BufferedOutputStream(sVoice.getOutputStream());
startPlayback();
startListening();
} catch (IOException e1) {
e1.printStackTrace();
} catch (LineUnavailableException e) {
e.printStackTrace();
}
//Game
try {
s0 = new ServerSocket(5108);
s = s0.accept();
r = new BufferedReader(new InputStreamReader(s.getInputStream(), US_ASCII));
w = new BufferedWriter(new OutputStreamWriter(s.getOutputStream(), US_ASCII));
while (!s0.isClosed()) {
String result;
if ((result = r.readLine()) != null) {
whichMethod(result);
}
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
private void whichMethod(String result) {
//change name of variable to something more representative
String[] bob = StringSerializer.split(result, ' ');
switch (JassCommand.valueOf(bob[0])) {
case PLRS:
String[] playerNames = StringSerializer.split(bob[2], ',');
Map<PlayerId, String> map = new HashMap<>();
map.put(PlayerId.PLAYER_1, StringSerializer.deserializeString(playerNames[0]));
map.put(PlayerId.PLAYER_2, StringSerializer.deserializeString(playerNames[1]));
map.put(PlayerId.PLAYER_3, StringSerializer.deserializeString(playerNames[2]));
map.put(PlayerId.PLAYER_4, StringSerializer.deserializeString(playerNames[3]));
player.setPlayers(PlayerId.ALL.get(StringSerializer.deserializeInt(bob[1])), map);
break;
case TRMP:
player.setTrump(Color.ALL.get(StringSerializer.deserializeInt(bob[1])));
break;
case HAND:
player.updateHand(CardSet.ofPacked(StringSerializer.deserializeLong(bob[1])));
break;
case TRCK:
player.updateTrick(Trick.ofPacked(StringSerializer.deserializeInt(bob[1])));
break;
case CARD:
String[] components = StringSerializer.split(bob[1], ',');
Card toPlay = player.cardToPlay(
TurnState.ofPackedComponents(StringSerializer.deserializeLong(components[0]),
StringSerializer.deserializeLong(components[1]),
StringSerializer.deserializeInt(components[2])),
CardSet.ofPacked(StringSerializer.deserializeLong(bob[2])));
try {
w.write(StringSerializer.serializeInt(toPlay.packed()) + "\n");
w.flush();
} catch (IOException e) {
e.printStackTrace();
}
break;
case SCOR:
player.updateScore(Score.ofPacked(StringSerializer.deserializeLong(bob[1])));
break;
case NAME:
try {
System.out.println(myName);
w.write(StringSerializer.serializeString(myName) + "\n");
w.flush();
} catch (IOException e) {
e.printStackTrace();
}
break;
case WINR:
player.setWinningTeam(TeamId.ALL.get(StringSerializer.deserializeInt(bob[1])));
try {
r.close();
w.close();
s.close();
s0.close();
} catch (IOException e) {
e.printStackTrace();
}
break;
case RVNG:
try {
w.write(StringSerializer.serializeInt((player.doYouWantRevenge()) ? 1 : 0));
w.flush();
} catch (IOException e) {
e.printStackTrace();
}
default:
System.out.println("we missed a case");
}
}
private void startListening() throws LineUnavailableException {
TargetDataLine targetDataLine = Soundlines.getInput();
System.out.println("Getting info from client");
StickerBean.booleanProperty().addListener((o, oV, nV) -> {
if (nV != oV || nV.booleanValue() == true) {
Thread listen = new Thread() {
@Override
public void run() {
try {
byte tempBuffer[] = new byte[10000];
while (StickerBean.booleanProperty().get()) {
targetDataLine.read(tempBuffer, 0, tempBuffer.length);
outputVoice.write(tempBuffer);
outputVoice.flush();
}
join();
} catch (Exception e) {
e.printStackTrace();
}
}
};
listen.setDaemon(true);
listen.start();
}
});
}
private void startPlayback() throws LineUnavailableException {
SourceDataLine sourceDataLine = Soundlines.getOutput();
Thread playback = new Thread() {
@Override
public void run() {
try {
byte tempBuffer[] = new byte[10000];
while (inputVoice.read(tempBuffer) != -1) {
sourceDataLine.write(tempBuffer, 0, tempBuffer.length);
}
sourceDataLine.drain();
sourceDataLine.close();
} catch (IOException e) {
e.printStackTrace();
}
}
;
};
playback.setDaemon(true);
playback.start();
}
}
| [
"tugdual.kerjan@epfl.ch"
] | tugdual.kerjan@epfl.ch |
251ef774b2823f03f1c7153e5cccaf44338b651e | 81f384727a38fd3962e3b083282d2aed674164cb | /app/src/main/java/com/khanhtq/trackmee/model/Tracking.java | a9d893066e62606a10cba02abc8270a5450a09c2 | [] | no_license | trkhanh29/trackme | 1063495a902d380f0f1503b8493db0dfb19039a2 | cbfbd28593b978994c247ddfe609c8e8de8bedc6 | refs/heads/master | 2020-03-19T05:52:25.202760 | 2018-08-07T00:20:01 | 2018-08-07T00:20:01 | 135,969,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,128 | java | package com.khanhtq.trackmee.model;
import io.realm.RealmList;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
public class Tracking extends RealmObject {
@PrimaryKey
private long mSessionId;
private RealmList<Float> mLongitudeOfPath;
private RealmList<Float> mLatitudeOfPath;
private RealmList<Float> mSpeedValues;
public long getSessionId() {
return mSessionId;
}
public void setSessionId(long sessionId) {
mSessionId = sessionId;
}
public RealmList<Float> getLongitudeOfPath() {
return mLongitudeOfPath;
}
public void setLongitudeOfPath(RealmList<Float> longitudeOfPath) {
mLongitudeOfPath = longitudeOfPath;
}
public RealmList<Float> getLatitudeOfPath() {
return mLatitudeOfPath;
}
public void setLatitudeOfPath(RealmList<Float> latitudesOfPath) {
mLatitudeOfPath = latitudesOfPath;
}
public RealmList<Float> getSpeedValues() {
return mSpeedValues;
}
public void setSpeedValues(RealmList<Float> speedValues) {
mSpeedValues = speedValues;
}
}
| [
"tqkhanh.bkcse10@gmail.com"
] | tqkhanh.bkcse10@gmail.com |
3bc44eb44fbaf1d67c9622fc6f89760c4bb318cf | 2f10b47b903e63798acab6fa7a93f8fff997341d | /design-patterns/src/factorypattern/NYStyleClamPizza.java | 776ba76314b43cedb154ea4a94bafaff463892f9 | [] | no_license | rakshith67/rakshithWorkspace | 3d02c499f6305613fcdb1cb4081ef33ad0d63896 | 8e2f70b8ca84d98c9e77a94ac04265f75eb4b366 | refs/heads/master | 2021-06-25T10:18:20.441547 | 2021-02-01T17:37:21 | 2021-02-01T17:37:21 | 203,383,906 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package factorypattern;
public class NYStyleClamPizza extends Pizza {
public NYStyleClamPizza() {
name = "NY Style Clam Pizza";
dough = "Thin Crust Dough";
sauce = "Marinara Sauce";
toppings.add("Grated Reggiano Cheese");
toppings.add("Fresh Clams from Long Island Sound");
}
}
| [
"Rakshith.Mamidala@amdocs.com"
] | Rakshith.Mamidala@amdocs.com |
eb720e94cd1c5f3eafccd34ce6b7317d1ac03f28 | b4539740ad293761ece3410126a776c4c1145b10 | /src/main/java/model/GoogleAuthProperties.java | 6ea0b5adbe7b4b77b84f1ea8e39b278ed8c9f902 | [
"Apache-2.0"
] | permissive | IJUh/closet | f3dbd0749523ec0c85da69115c153595e341b793 | 9a79c6d3242b81a978b0319f10fb53e3d655fb23 | refs/heads/master | 2022-12-29T12:52:40.585398 | 2020-03-09T05:37:42 | 2020-03-09T05:37:42 | 230,735,858 | 4 | 0 | Apache-2.0 | 2022-12-16T04:37:57 | 2019-12-29T10:37:49 | Java | UTF-8 | Java | false | false | 1,195 | java | package model;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class GoogleAuthProperties {
private String clientId;
private String clientSecret;
private String redirectUri;
private String accountUrl;
private String authUrl;
private String applicationName;
GoogleAuthProperties(@Value("${clientId}") String clientId, @Value("${client_secret}") String clientSecret,
@Value("${redirect_uri}") String redirectUri, @Value("${account_url}") String accountUrl, @Value("${auth_url}") String authUrl, @Value("${applicationName}") String applicationName) {
this.clientId = clientId;
this.clientSecret = clientSecret;
this.redirectUri = redirectUri;
this.accountUrl= accountUrl;
this.authUrl = authUrl;
this.applicationName = applicationName;
}
public String getClientId() {
return clientId;
}
public String getClientSecret() {
return clientSecret;
}
public String getRedirectUri() {
return redirectUri;
}
public String getAccountUrl() {
return accountUrl;
}
public String getAuthUrl() {
return authUrl;
}
public String getApplicationName() {
return applicationName;
}
}
| [
"here_ij1130@naver.com"
] | here_ij1130@naver.com |
d1fd76e8c182e94cab2b750cfabdd2c75a632edc | e6eb02388a1d9be41416e5c1c11f54265ec79416 | /app/src/main/java/com/example/pc002/myapplication/MainActivity.java | 25ad16d72d0fc54b7f82b983963ab40527e3156c | [] | no_license | migz00/test_sqlite | 87e4a984799d5256006a2ed3eab804a4c4b05bf9 | 3f635c68c016e064d512454e142f708e06f39660 | refs/heads/master | 2020-03-27T04:47:09.038953 | 2018-08-24T09:00:01 | 2018-08-24T09:00:01 | 145,968,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,806 | java | package com.example.pc002.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private ListView lv;
private Button send, delete;
private ArrayList<String> names;
private NameAdapter adapter;
private DBHelper db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
db = new DBHelper(this);
lv = (ListView) findViewById(R.id.lv_names);
send = (Button) findViewById(R.id.btn_input);
delete = (Button) findViewById(R.id.btn_clear);
names = db.getNames();
adapter = new NameAdapter(this, R.layout.student_list, names);
delete.setOnClickListener(this);
send.setOnClickListener(this);
lv.setAdapter(adapter);
}
@Override
public void onClick(View view) {
switch(view.getId()) {
case R.id.btn_input:
EditText input = (EditText) findViewById(R.id.et_input);
if (db.insertStudent(input.getText().toString())) {
Toast.makeText(this, "Success", Toast.LENGTH_SHORT).show();
this.recreate();
} else {
Toast.makeText(this, "Failed", Toast.LENGTH_SHORT).show();
}
break;
case R.id.btn_clear:
db.clearData();
this.recreate();
break;
}
}
}
| [
"clyde.migue@gmail.com"
] | clyde.migue@gmail.com |
2b8f89dd6f33b3790b08d7c0390c9f73bb9b18c1 | 74a9a7336f7b6f1467c1681e2e76d8ecd5b7f808 | /src/ictk/boardgame/GameInfo.java | 08e71bebf361e7340de761e1e544464a73fdc386 | [] | no_license | diegoami/chessella-Java-RS | 385b5f82c02c0cb4b75aef9d0ca2d037b408f926 | 9a33d355a7bef399f2cbcbf366ca1a9a0c875159 | refs/heads/master | 2021-06-25T18:17:30.105203 | 2017-08-27T00:37:15 | 2017-08-27T00:37:15 | 99,689,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,301 | java | package ictk.boardgame;
import org.apache.log4j.Logger;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Properties;
public abstract class GameInfo {
private static Logger log = Logger.getLogger(GameInfo.class.getName());
public Properties props = new Properties();
protected Player[] players;
protected Calendar date;
protected String event;
protected String site;
protected String round;
protected String subround;
protected Result result;
protected int year;
protected int month;
protected int day;
public Player[] getPlayers() {
return this.players;
}
public String getEvent() {
return this.event;
}
public String getSite() {
return this.site;
}
public Calendar getDate() {
return this.date;
}
public String getRound() {
return this.round;
}
public String getSubRound() {
return this.subround;
}
public int getYear() {
return this.year;
}
public int getMonth() {
return this.month;
}
public int getDay() {
return this.day;
}
public Result getResult() {
return this.result;
}
public Properties getAuxilleryProperties() {
return this.props;
}
public String getDateString() {
StringBuffer sb = new StringBuffer(10);
if(this.year > 0) {
if(this.year < 10) {
sb.append(" ");
}
if(this.year < 100) {
sb.append(" ");
}
if(this.year < 1000) {
sb.append(" ");
}
sb.append(this.year);
} else {
sb.append("????");
}
sb.append(".");
if(this.month > 0) {
if(this.month < 10) {
sb.append("0");
}
sb.append(this.month);
} else {
sb.append("??");
}
sb.append(".");
if(this.day > 0) {
if(this.day < 10) {
sb.append("0");
}
sb.append(this.day);
} else {
sb.append("??");
}
return sb.toString();
}
public void setEvent(String event) {
this.event = event;
}
public void setSite(String site) {
this.site = site;
}
public void setDate(Calendar date) {
this.date = date;
}
public void setRound(String round) {
this.round = round;
}
public void setSubRound(String round) {
this.subround = round;
}
public void setYear(int i) {
this.year = i;
}
public void setMonth(int i) {
this.month = i;
}
public void setDay(int i) {
this.day = i;
}
public void setResult(Result res) {
this.result = res;
}
public void setAuxilleryProperties(Properties p) {
this.props = p;
}
public void add(String key, String value) {
this.props.setProperty(key, value);
}
public String get(String key) {
return this.props.getProperty(key);
}
public String toString() {
String tmp = null;
tmp = "[Event: " + this.event + "]\n" + "[Site: " + this.site + "]\n" + "[Date: " + this.getDateString() + "]\n" + "[Round: " + this.round + "]\n" + "[SubRound: " + this.subround + "]\n" + "[Result: " + this.result + "]\n";
return tmp;
}
public boolean equals(Object o) {
if(o == this) {
return true;
} else if(o != null && o.getClass() == this.getClass()) {
GameInfo gi = (GameInfo)o;
boolean t = true;
log.debug( "checking for equality");
if(t && this.players == gi.players) {
t = true;
} else if(t && this.players != null && gi.players != null && this.players.length == gi.players.length) {
for(int i = 0; t && i < this.players.length; ++i) {
t = t && this.isSame(this.players[i], gi.players[i]);
if(!t) {
log.debug( "players[" + i + "]: " + this.players[i] + " / " + gi.players[i]);
}
}
}
if(t) {
t = t && this.isSame(this.event, gi.event);
if(!t) {
log.debug( "event: " + this.event + " / " + gi.event);
}
}
if(t) {
t = t && this.equalDates(gi.date);
if(!t) {
log.debug( "date: " + this.date + " / " + gi.date);
}
}
if(t) {
t = t && this.isSame(this.round, gi.round);
if(!t) {
log.debug( "round: " + this.round + " / " + gi.round);
}
}
if(t) {
t = t && this.isSame(this.subround, gi.subround);
if(!t) {
log.debug( "subround: " + this.subround + " / " + gi.subround);
}
}
if(t) {
t = t && this.isSame(this.result, gi.result);
if(!t) {
log.debug( "result: " + this.result + " / " + gi.result);
}
}
if(t) {
t = t && this.isSame(this.props, gi.props);
if(!t) {
log.debug( "aux: " + this.props + " / " + gi.props);
}
}
if(t) {
log.debug( "equal");
}
return t;
} else {
return false;
}
}
protected boolean isSame(Object o, Object p) {
return o == p || o != null && o.equals(p);
}
protected boolean equalDates(Calendar cal) {
boolean t = true;
if(this.date == null && this.date == cal) {
return true;
} else {
t = t && cal != null;
t = t && this.date.isSet(1) == cal.isSet(1);
t = t && this.date.isSet(1) && this.date.get(1) == cal.get(1);
t = t && this.date.isSet(2) && this.date.get(2) == cal.get(2);
t = t && this.date.isSet(5) && this.date.get(5) == cal.get(5);
return t;
}
}
public int hashCode() {
int hash = 5;
if(this.players != null) {
for(int i = 0; i < this.players.length; ++i) {
hash = 31 * hash + (this.players[i] == null?0:this.players[i].hashCode());
}
}
hash = 31 * hash + this.getDateString().hashCode();
hash = 31 * hash + (this.event == null?0:this.event.hashCode());
hash = 31 * hash + (this.site == null?0:this.site.hashCode());
hash = 31 * hash + (this.round == null?0:this.round.hashCode());
hash = 31 * hash + (this.subround == null?0:this.subround.hashCode());
return hash;
}
public void dump() {
StringBuffer sb = new StringBuffer();
sb.append("##GameInfo Dump").append(this.toString()).append("Aux Data:");
if(this.props == null) {
sb.append("None");
} else {
Enumeration enumer = this.props.propertyNames();
String key = null;
while(enumer.hasMoreElements()) {
key = (String)enumer.nextElement();
sb.append(key).append(" = ").append(this.props.getProperty(key, (String)null));
}
}
}
}
| [
"diego.amicabile@gmail.com"
] | diego.amicabile@gmail.com |
c454b9322dbd2ec3ef89937718c4a989dcd25972 | dfe61acfd0e1674df609bf7abd3d15ff7622f124 | /app/src/main/java/com/example/chason/offer/Task_09.java | acb4244177813a03d1d12a5a2ccffd217c6b4f5b | [] | no_license | jiefly/leetcode | b3bc4853d822176b68032860cdfdab96733b7981 | 11aec90bc6eb799e96a1b5520204fc8b7d6c56b1 | refs/heads/master | 2021-06-20T02:55:39.286123 | 2017-08-02T13:23:33 | 2017-08-02T13:23:33 | 90,512,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,417 | java | package com.example.chason.offer;
/**
* Created by chgao on 17-7-3.
* 题目:写一个函数,输入n,求斐波那契数列的第n项。
*/
public class Task_09 {
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
long start = System.currentTimeMillis();
System.out.println("result_01->" + solution_01(i) + "->cost:" + (System.currentTimeMillis() - start));
start = System.currentTimeMillis();
System.out.println("result_02->" + solution_02(i) + "->cost:" + (System.currentTimeMillis() - start));
}
}
/*
* 题目:写一个函数,输入n,求斐波那契数列的第n项。
* */
public static int solution_01(int n) {
if (n == 0) {
return 0;
}
if (n == 1) {
return 1;
}
return solution_01(n - 1) + solution_01(n - 2);
}
/*
* 题目:写一个函数,输入n,求斐波那契数列的第n项。
* */
public static int solution_02(int n) {
int N = 2;
if (n == 0) {
return 0;
}
if (n == 1) {
return 1;
}
int b = 1;
int bb = 0;
int current = b + bb;
while (N < n) {
N++;
bb = b;
b = current;
current = b + bb;
}
return current;
}
/*
* 题目:一只青蛙一次可以跳上1级台阶,也可以跳上2级台阶。求该青蛙跳上一个n级台阶公共有多少种跳法。
* f(n) = f(n-1)+f(n-2)
* f(1) = 1
* f(2) = 2
* */
public static int solution_03(int n) {
int N = 2;
if (n == 0) {
return 1;
}
if (n == 1) {
return 2;
}
int b = 2;
int bb = 1;
int current = b + bb;
while (N < n) {
N++;
bb = b;
b = current;
current = b + bb;
}
return current;
}
/*
* 题目:在青蛙跳台阶问题中,如果把条件改成:一只青蛙一次可以跳上1级台阶,也可以跳上2级台阶。。。也可以跳上n级台阶,
* 此时青蛙跳上一个n级台阶总共有多少种跳法。
* f(n) = 1+f(1)+...+f(n-1) = 2f(n-1) = 2
* */
public static int solution_04(int n) {
return (int) Math.pow(2, n - 1);
}
}
| [
"jiefly1993@gmail.com"
] | jiefly1993@gmail.com |
05edace1a7384f4e48a41c6f9dd453b7e79c8a22 | bc40d322188c8dd8e3e21954500d071d95409fbb | /Week3/VictorMartinez/Actuator/aspects-actuator/src/main/java/com/bootcamp/aopactuator/aspectsactuator/aspect/newController/newController.java | 0f89d4ace4ae50aa06de9fdef311c1882f75ebbd | [
"Apache-2.0"
] | permissive | vmartinezsolarte/Final-Project-_-Bootcamp-2019-Globant | a4cdbb078847effbdd3c3017b3769c50835c9f88 | 447e60e292a920efb3af9aeddd970e2e6b84bd88 | refs/heads/master | 2020-06-15T23:25:09.928979 | 2019-07-27T18:37:01 | 2019-07-27T18:37:01 | 195,420,006 | 0 | 0 | Apache-2.0 | 2019-07-27T18:37:02 | 2019-07-05T14:08:22 | HTML | UTF-8 | Java | false | false | 671 | java | package com.bootcamp.aopactuator.aspectsactuator.aspect.newController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class newController {
private newControllerImpl newController;
@Autowired
public newController(newControllerImpl newControllerImpl){
this.newController = newControllerImpl;
}
@GetMapping("/newController")
public String newControllerMapping(){
this.newController.newGreeting();
return "new Controller Domain created succesfully";
}
}
| [
"vmartinezsolarte@gmail.com"
] | vmartinezsolarte@gmail.com |
00fb5ea93868535f490cacc758a4de614b8524be | ca1eabc3ea766cc7de78d923ff877c075cec14e3 | /src/main/java/s/m/sso/SSOEnabledApp/security/SecurityConfiguration.java | 88d52f2500f981e25c59edec9d88be77d736454e | [] | no_license | sujalmandal/okta-sso-spring-boot-app | e369d025d7156def221ffa036e49bf713254f2ae | 37aaace20e20a872b6f684fdbc90cf7713666e27 | refs/heads/master | 2023-07-14T05:38:19.598721 | 2021-08-28T18:40:11 | 2021-08-28T18:40:11 | 400,865,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,521 | java | package s.m.sso.SSOEnabledApp.security;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
/*
* extending WebSecurityConfigurerAdapter will force us to configure the security specifics
*/
@Component
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
Logger logger = LoggerFactory.getLogger(this.getClass());
@Value("${security.ignore.urls}")
private String[] publicUrls;
@Autowired
private PasswordEncoder encoder;
/* Configure AUTHENTICATION settings */
/* in case we also want a custom, in-house authentication to be present in the app,
* we can use authentication manager to configure a source of user information against which
* the user will be lookup up and the password will be matched
*/
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
/* for demo purposes we will use in-memory user info */
auth.inMemoryAuthentication()
.withUser("admin")
.password(encoder.encode("admin123"))
.roles("ADMIN");
}
/* configure AUTHORIZATION settings */
@Override
protected void configure(HttpSecurity http) throws Exception {
http
/* define a custom login page */
.formLogin()
.loginPage("/auth/login")
.failureUrl("/auth/error")
.loginProcessingUrl("/auth/process")
.usernameParameter("username")
.passwordParameter("password")
.permitAll()
.and()
.authorizeRequests().antMatchers(publicUrls).permitAll()
.and()
.authorizeRequests()
/* then set any other urls to be accessible only after authentication */
.anyRequest().authenticated();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
} | [
"ss6sujal@gmail.com"
] | ss6sujal@gmail.com |
1d1f0d4f04fba5f6a9e05984caaf9798534f1faf | 0432989f4b267b849f0ce1d57c3cee1d693a4f42 | /Flowers/src/test/java/com/online/flowers/AdminControllerTest.java | 5c8b5540b63b03aaa4b69578400e172609198d36 | [] | no_license | mohit1003/OnlineFlowers | 42593fe7b9f05f4822dfdbe6fcfae92abebebdf2 | 73dba9011b8d65554bf2577f5a66729469e5b0a8 | refs/heads/master | 2023-06-01T07:27:25.392175 | 2021-06-19T12:47:24 | 2021-06-19T12:47:24 | 369,733,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,944 | java | package com.online.flowers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import com.online.flowers.controller.AdminController;
@SpringBootTest
@RunWith(SpringRunner.class)
public class AdminControllerTest {
@MockBean
private AdminController _adminController;
@BeforeAll
public static void setUp() {
TestData.setUp();
}
@Test
public void saveFlowerImage() {
when(_adminController.saveFlowerImage(TestData.getFile(), "Symphy", "Sympathy flowers", "Whity", "300"))
.thenReturn(new ResponseEntity<String>("Image is uploaded", HttpStatus.CREATED));
assertEquals(new ResponseEntity<String>("Image is uploaded", HttpStatus.CREATED), _adminController.saveFlowerImage(TestData.getFile(), "Symphy", "Sympathy flowers", "Whity", "300"));
}
@Test
public void updateFlowerTest() {
when(_adminController.updateFlower("23", TestData.getFile(),"Symphy", "Sympathy flowers", "Whity", "300"))
.thenReturn(new ResponseEntity<String>("Image is uploaded", HttpStatus.CREATED));
assertEquals(new ResponseEntity<String>("Image is uploaded", HttpStatus.CREATED), _adminController.updateFlower("23", TestData.getFile(),"Symphy", "Sympathy flowers", "Whity", "300"));
}
@Test
public void updateFlowerWithoutImageTest() {
when(_adminController.updateFlowerWithoutImage(TestData.getFlowerModel()))
.thenReturn(new ResponseEntity<String>("Image is uploaded/modified", HttpStatus.OK));
assertEquals(new ResponseEntity<String>("Image is uploaded/modified", HttpStatus.OK), _adminController.updateFlowerWithoutImage(TestData.getFlowerModel()));
}
@Test
public void deleteTest() {
Map<String, String> id = new HashMap<>();
id.put("id", "22");
when(_adminController.delete(id)).thenReturn(new ResponseEntity<String>("Image deleted", HttpStatus.OK));
assertEquals(new ResponseEntity<String>("Image deleted", HttpStatus.OK), _adminController.delete(id));
}
@Test
public void addShopTest() {
when(_adminController.addShop(TestData.getFile(), "deligho", "India", "India", "123, east lane", "open", "9373774634"))
.thenReturn(new ResponseEntity<String>("Shop added successfully", HttpStatus.CREATED));
assertEquals(new ResponseEntity<String>("Shop added successfully", HttpStatus.CREATED), _adminController.addShop(TestData.getFile(), "deligho", "India", "India", "123, east lane", "open", "9373774634"));
}
@AfterAll
public static void cleanUp() {
TestData.cleanUp();
}
}
| [
"mpkulkarni02@gmail.com"
] | mpkulkarni02@gmail.com |
562e18976af6b7aa6258c59dd6b14ddc2ea79f8d | fe77cf89da2892b059d6b2f77f4464f3613a6317 | /src/simpledb/materialize/SortScan.java | 2ae3c7c6bf6daeec491dcfc480c0295b59d90110 | [] | no_license | atwalder/simpledb | 80a3f7794b522322b0e3d9e4a5181d5901dbfec6 | 2a7bbbb98a328d6983f9da0d6ca9c17d366b0a6a | refs/heads/master | 2020-03-11T05:57:47.499640 | 2018-04-26T03:41:16 | 2018-04-26T03:41:16 | 129,818,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,591 | java | package simpledb.materialize;
import simpledb.record.RID;
import simpledb.record.TableInfo;
import simpledb.server.SimpleDB;
import simpledb.tx.Transaction;
import simpledb.query.*;
import java.util.*;
/**
* The Scan class for the <i>sort</i> operator.
* @author Edward Sciore
*/
/**
* @author sciore
*
*/
//project 2: UPDATED
public class SortScan implements Scan {
private UpdateScan s1, s2=null, currentscan=null;
private RecordComparator comp;
private boolean hasmore1, hasmore2=false;
private List<RID> savedposition;
private Transaction tx;
private String tblname; //project 2: added to carry through for table info
/**
* Creates a sort scan, given a list of 1 or 2 runs.
* If there is only 1 run, then s2 will be null and
* hasmore2 will be false.
* @param runs the list of runs
* @param comp the record comparator
*/
public SortScan(String tblname, Transaction tx, List<TempTable> runs, RecordComparator comp) { //could pass in orignal record file
this.tblname = tblname;
this.tx = tx;
this.comp = comp;
runs.get(0).getTableInfo().setSorted(0); //project 2: when scanned by update scan, sorted flag reset to false
s1 = (UpdateScan) runs.get(0).open();
hasmore1 = s1.next();
if (runs.size() > 1) {
runs.get(1).getTableInfo().setSorted(0); //project 2: when scanned by update scan, sorted flag reset to false
s2 = (UpdateScan) runs.get(1).open();
hasmore2 = s2.next();
}
TableInfo orig = SimpleDB.mdMgr().getTableInfo(this.tblname, this.tx); //project 2: get TI of original table
TableScan ts = new TableScan(orig, this.tx); //project 2: open new table scan on original table
ts.beforeFirst(); //project 2: point before first record
runs.get(0).getTableInfo().setSorted(1); //project 2: runs is now sorted so set flag as true!
TableScan sorted = new TableScan(runs.get(0).getTableInfo(), this.tx); //project 2: hope creating tablescan from sorted temptable
sorted.beforeFirst(); //project 2: point before first record
//project 2: replace each record in original table with the temp table sorted records
while (sorted.next() && ts.next())
ts.setVal("dataval", sorted.getVal("dataval"));
ts.setVal("block", sorted.getVal("block"));
ts.setVal("id", sorted.getVal("id"));
orig.setSorted(1); //project 2: the original table is now sorted, set flag
}
/**
* Positions the scan before the first record in sorted order.
* Internally, it moves to the first record of each underlying scan.
* The variable currentscan is set to null, indicating that there is
* no current scan.
* @see simpledb.query.Scan#beforeFirst()
*/
public void beforeFirst() {
currentscan = null;
s1.beforeFirst();
hasmore1 = s1.next();
if (s2 != null) {
s2.beforeFirst();
hasmore2 = s2.next();
}
}
/**
* Moves to the next record in sorted order.
* First, the current scan is moved to the next record.
* Then the lowest record of the two scans is found, and that
* scan is chosen to be the new current scan.
* @see simpledb.query.Scan#next()
*/
public boolean next() { //where logic is?
if (currentscan != null) {
if (currentscan == s1) {
hasmore1 = s1.next();
}
else if (currentscan == s2)
hasmore2 = s2.next();
}
if (!hasmore1 && !hasmore2)
return false;
else if (hasmore1 && hasmore2) {
if (comp.compare(s1, s2) < 0) {
currentscan = s1;
}
else
currentscan = s2;
}
else if (hasmore1) {
currentscan = s1;
}
else if (hasmore2) {
currentscan = s2;
}
return true;
}
/**
* Closes the two underlying scans.
* @see simpledb.query.Scan#close()
*/
public void close() {
s1.close();
if (s2 != null)
s2.close();
}
/**
* Gets the Constant value of the specified field
* of the current scan.
* @see simpledb.query.Scan#getVal(java.lang.String)
*/
public Constant getVal(String fldname) {
return currentscan.getVal(fldname);
}
/**
* Gets the integer value of the specified field
* of the current scan.
* @see simpledb.query.Scan#getInt(java.lang.String)
*/
public int getInt(String fldname) {
return currentscan.getInt(fldname);
}
/**
* Gets the string value of the specified field
* of the current scan.
* @see simpledb.query.Scan#getString(java.lang.String)
*/
public String getString(String fldname) {
return currentscan.getString(fldname);
}
/**
* Returns true if the specified field is in the current scan.
* @see simpledb.query.Scan#hasField(java.lang.String)
*/
public boolean hasField(String fldname) {
return currentscan.hasField(fldname);
}
/**
* Saves the position of the current record,
* so that it can be restored at a later time.
*/
public void savePosition() {
RID rid1 = s1.getRid();
RID rid2 = (s2 == null) ? null : s2.getRid();
savedposition = Arrays.asList(rid1,rid2);
}
/**
* Moves the scan to its previously-saved position.
*/
public void restorePosition() {
RID rid1 = savedposition.get(0);
RID rid2 = savedposition.get(1);
s1.moveToRid(rid1);
if (rid2 != null)
s2.moveToRid(rid2);
}
}
| [
"atwalder@wpi.edu"
] | atwalder@wpi.edu |
37a0e27ea34d0636abaceaab15270f4c57de156f | 6414b1e7e8928ccd38c0c200ac660d04e25577c2 | /core/src/main/java/org/cloud/core/utils/old/BlurFastHelper.java | 0ce36d39fd66b83748a4e9380296322a08adac03 | [] | no_license | DongJeremy/PanzerClient | 6d60185446134fc0ba4c81a9e2473397a741b1d7 | 45b6b243798ddc2420ea3bdb695267b37082d35f | refs/heads/master | 2023-01-07T13:12:10.357515 | 2020-11-15T04:19:31 | 2020-11-15T04:19:31 | 308,320,217 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,676 | java | package org.cloud.core.utils.old;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
/**
* Helper used to apply Fast blur algorithm on bitmap.
*/
public class BlurFastHelper {
/**
* non instantiable helper
*/
private BlurFastHelper() {
}
/**
* blur a given bitmap
*
* @param sentBitmap bitmap to blur
* @param radius blur radius
* @param canReuseInBitmap true if bitmap must be reused without blur
* @return blurred bitmap
*/
@SuppressLint("NewApi")
public static Bitmap doBlur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) {
if (radius < 1) {
return (null);
}
Bitmap bitmap;
if (canReuseInBitmap || (sentBitmap.getConfig() == Bitmap.Config.RGB_565)) {
// if RenderScript is used and bitmap is in RGB_565, it will
// necessarily be copied when converting to ARGB_8888
bitmap = sentBitmap;
} else {
bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
}
int w = bitmap.getWidth();
int h = bitmap.getHeight();
int[] pix = new int[w * h];
bitmap.getPixels(pix, 0, w, 0, 0, w, h);
int wm = w - 1;
int hm = h - 1;
int div = radius + radius + 1;
int px = 0;
int rsum, gsum, bsum, x, y, i, p, yp, yi, yw;
int vmin[] = new int[Math.max(w, h)];
int divsum = (div + 1) >> 1;
divsum *= divsum;
int dv[] = new int[256 * divsum];
for (i = 0; i < 256 * divsum; i++) {
dv[i] = (i / divsum);
}
yw = yi = 0;
int[][] stack = new int[div][3];
int stackpointer;
int stackstart;
int[] sir;
int rbs;
int r1 = radius + 1;
int routsum, goutsum, boutsum;
int rinsum, ginsum, binsum;
for (y = 0; y < h; y++) {
rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
for (i = -radius; i <= radius; i++) {
p = pix[yi + Math.min(wm, Math.max(i, 0))];
sir = stack[i + radius];
sir[0] = (p & 0xff0000) >> 16;
sir[1] = (p & 0x00ff00) >> 8;
sir[2] = (p & 0x0000ff);
rbs = r1 - Math.abs(i);
rsum += sir[0] * rbs;
gsum += sir[1] * rbs;
bsum += sir[2] * rbs;
if (i > 0) {
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
} else {
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
}
}
stackpointer = radius;
for (x = 0; x < w; x++) {
pix[yi] = (0xff000000 & pix[yi]) | (dv[rsum] << 16) | (dv[gsum] << 8) | dv[bsum];
rsum -= routsum;
gsum -= goutsum;
bsum -= boutsum;
stackstart = stackpointer - radius + div;
sir = stack[stackstart % div];
routsum -= sir[0];
goutsum -= sir[1];
boutsum -= sir[2];
if (y == 0) {
vmin[x] = Math.min(x + radius + 1, wm);
}
p = pix[yw + vmin[x]];
sir[0] = (p & 0xff0000) >> 16;
sir[1] = (p & 0x00ff00) >> 8;
sir[2] = (p & 0x0000ff);
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
rsum += rinsum;
gsum += ginsum;
bsum += binsum;
stackpointer = (stackpointer + 1) % div;
sir = stack[(stackpointer) % div];
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
rinsum -= sir[0];
ginsum -= sir[1];
binsum -= sir[2];
yi++;
}
yw += w;
}
for (x = 0; x < w; x++) {
rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
yp = -radius * w;
for (i = -radius; i <= radius; i++) {
yi = Math.max(0, yp) + x;
sir = stack[i + radius];
px = pix[yi];
sir[0] = (px & 0xff0000) >> 16;
sir[1] = (px & 0x00ff00) >> 8;
sir[2] = (px & 0x0000ff);
rbs = r1 - Math.abs(i);
rsum += sir[0] * rbs;
gsum += sir[1] * rbs;
bsum += sir[2] * rbs;
if (i > 0) {
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
} else {
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
}
if (i < hm) {
yp += w;
}
}
yi = x;
stackpointer = radius;
for (y = 0; y < h; y++) {
// Preserve alpha channel: ( 0xff000000 & pix[yi] )
pix[yi] = (0xff000000 & pix[yi]) | (dv[rsum] << 16) | (dv[gsum] << 8) | dv[bsum];
rsum -= routsum;
gsum -= goutsum;
bsum -= boutsum;
stackstart = stackpointer - radius + div;
sir = stack[stackstart % div];
routsum -= sir[0];
goutsum -= sir[1];
boutsum -= sir[2];
if (x == 0) {
vmin[y] = Math.min(y + r1, hm) * w;
}
p = x + vmin[y];
px = pix[p];
sir[0] = (px & 0xff0000) >> 16;
sir[1] = (px & 0x00ff00) >> 8;
sir[2] = (px & 0x0000ff);
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
rsum += rinsum;
gsum += ginsum;
bsum += binsum;
stackpointer = (stackpointer + 1) % div;
sir = stack[stackpointer];
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
rinsum -= sir[0];
ginsum -= sir[1];
binsum -= sir[2];
yi += w;
}
}
bitmap.setPixels(pix, 0, w, 0, 0, w, h);
return (bitmap);
}
} | [
"dongjeremy2020@163.com"
] | dongjeremy2020@163.com |
a006464c60baac0e79390503baa377e70d8d09d6 | 54e93273944f1714d74b99bdac762e4d0bed77b3 | /MySportsBook/obj/Release/android/src/md5167cf0c1fa468a34aa4f067b9e4d8de4/BatchPlayer_ItemAdapter_ImageClickListener.java | 61c4ca62031ae7476d14aa7f920bfa939a442db2 | [] | no_license | Akkarthi/MySportsBook-WithAsyncTask | 8a3ffc0bb9ca68deb7aefce405cb0725d605432a | b6bc186acabb2593d17b32abb248004fa02c1ede | refs/heads/master | 2022-12-16T13:13:00.965503 | 2019-01-05T07:59:21 | 2019-01-05T07:59:21 | 163,371,076 | 0 | 0 | null | 2022-12-08T01:49:28 | 2018-12-28T05:47:34 | Java | UTF-8 | Java | false | false | 2,109 | java | package md5167cf0c1fa468a34aa4f067b9e4d8de4;
public class BatchPlayer_ItemAdapter_ImageClickListener
extends java.lang.Object
implements
mono.android.IGCUserPeer,
android.view.View.OnClickListener
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"n_onClick:(Landroid/view/View;)V:GetOnClick_Landroid_view_View_Handler:Android.Views.View/IOnClickListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" +
"";
mono.android.Runtime.register ("MySportsBook.BatchPlayer_ItemAdapter+ImageClickListener, MySportsBook, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", BatchPlayer_ItemAdapter_ImageClickListener.class, __md_methods);
}
public BatchPlayer_ItemAdapter_ImageClickListener () throws java.lang.Throwable
{
super ();
if (getClass () == BatchPlayer_ItemAdapter_ImageClickListener.class)
mono.android.TypeManager.Activate ("MySportsBook.BatchPlayer_ItemAdapter+ImageClickListener, MySportsBook, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { });
}
public BatchPlayer_ItemAdapter_ImageClickListener (int p0, android.app.Activity p1) throws java.lang.Throwable
{
super ();
if (getClass () == BatchPlayer_ItemAdapter_ImageClickListener.class)
mono.android.TypeManager.Activate ("MySportsBook.BatchPlayer_ItemAdapter+ImageClickListener, MySportsBook, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e:Android.App.Activity, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0, p1 });
}
public void onClick (android.view.View p0)
{
n_onClick (p0);
}
private native void n_onClick (android.view.View p0);
private java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
| [
"karthianbu1989@gmail.com"
] | karthianbu1989@gmail.com |
a79523e030393fbb6b66a8fb836f8daadb44247d | 6eb1c948b427a38876d0afbd1e2e1522bfac35ad | /src/main/java/org/microcks/domain/Service.java | 6b7700cc652b96fd14a7e94af01256ce48f5c0fe | [
"Apache-2.0"
] | permissive | damianlezcano/microcks | 58364a070e18fadf4c463afc7a765ed1de560bd7 | f980bbfedaf7450223227a7a4f184cc09f9d64c0 | refs/heads/master | 2020-06-03T13:10:12.633208 | 2019-11-06T18:59:31 | 2019-11-06T18:59:31 | 174,359,822 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,436 | java | /*
* Licensed to Laurent Broudoux (the "Author") under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Author 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.microcks.domain;
import org.springframework.data.annotation.Id;
import java.util.ArrayList;
import java.util.List;
/**
* Domain class representing a MicroService and the operations /
* actions it's holding.
* @author laurent
*/
public class Service {
@Id
private String id;
private String name;
private String version;
private String xmlNS;
private ServiceType type;
private Metadata metadata;
private List<Operation> operations = new ArrayList<>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getXmlNS() {
return xmlNS;
}
public void setXmlNS(String xmlNS) {
this.xmlNS = xmlNS;
}
public ServiceType getType() {
return type;
}
public void setType(ServiceType type) {
this.type = type;
}
public List<Operation> getOperations() {
return operations;
}
public void setOperations(List<Operation> operations) {
this.operations = operations;
}
public void addOperation(Operation operation) {
if (this.operations == null){
this.operations = new ArrayList<>();
}
operations.add(operation);
}
public Metadata getMetadata() {
return metadata;
}
public void setMetadata(Metadata metadata) {
this.metadata = metadata;
}
}
| [
"lezcano.da@gmail.com"
] | lezcano.da@gmail.com |
0d48cca47765ad5064f94f8dd1ead74ec54d2c6b | f30a7f05a0c5a387f62ce18c8a573ecdf93847f9 | /external-springcloud-hmily-tcc-demo/sc-tcc-demo-account-ms/src/main/java/cn/jaychang/scstudy/account/TccDemoAccountMsApplication.java | 919e6aa56a2274bd0e843acf1eb24343c85f5265 | [] | no_license | jaychang9/springcloud-tutorials | 2e543874b585544a447c51220b3007032cecf901 | c53a39624fd292be579f707ee1c98b1ac3690982 | refs/heads/master | 2020-03-29T05:45:40.234409 | 2018-11-12T06:34:59 | 2018-11-12T06:34:59 | 149,595,685 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package cn.jaychang.scstudy.account;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@MapperScan("cn.jaychang.scstudy.account.dao")
@EnableEurekaClient
@EnableTransactionManagement
@SpringBootApplication
public class TccDemoAccountMsApplication {
public static void main(String[] args) {
SpringApplication.run(TccDemoAccountMsApplication.class, args);
}
}
| [
"zhangjie@zcckj.com"
] | zhangjie@zcckj.com |
da6d255929ee8e7eed8dda750ef40b6babbbba23 | 503093777f79246aef454b5aaf8ff001bb69dcc6 | /app/src/main/java/com/appbook/book/updata/manager/fileload/RxBus.java | ac6fff47860917b30964990cd269ab026ae52f33 | [] | no_license | shuixi2013/BookReader-master1 | 61da8c5e7e04e15a051f8eb21e86c641c2628605 | c7c91ce7bad3da85434ae25c84031cee9c590d87 | refs/heads/master | 2021-01-01T16:23:12.799892 | 2017-02-16T08:53:52 | 2017-02-16T08:53:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package com.appbook.book.updata.manager.fileload;
import rx.Observable;
import rx.subjects.PublishSubject;
import rx.subjects.SerializedSubject;
import rx.subjects.Subject;
public class RxBus {
private static volatile RxBus mInstance;
private final Subject<Object, Object> bus;
private RxBus() {
bus = new SerializedSubject<>(PublishSubject.create());
}
/**
* 单例RxBus
*
* @return
*/
public static RxBus getDefault() {
RxBus rxBus = mInstance;
if (mInstance == null) {
synchronized (RxBus.class) {
rxBus = mInstance;
if (mInstance == null) {
rxBus = new RxBus();
mInstance = rxBus;
}
}
}
return rxBus;
}
/**
* 发送一个新事件
*
* @param o
*/
public void post(Object o) {
bus.onNext(o);
}
/**
* 返回特定类型的被观察者
*
* @param eventType
* @param <T>
* @return
*/
public <T> Observable<T> toObservable(Class<T> eventType) {
return bus.ofType(eventType);
}
}
| [
"android_dy@163.com"
] | android_dy@163.com |
b298d0037faef6cdb20bfd0e9179e9004043ea40 | b09fda538b22eab8c9c50adcf65da6024d94c266 | /src/main/java/com/questhelper/quests/thegreatbrainrobbery/TheGreatBrainRobbery.java | 008a2c8f1c59c0cb40c20e5b43a7928242449f45 | [
"BSD-2-Clause"
] | permissive | solo7-rs/quest-helper | a50c6c0dde90e0104f5a3fdb8e5a22a261e7f808 | 08317c0dfc78655e751e9b04913307b066bf4d1c | refs/heads/master | 2023-06-16T14:26:27.843025 | 2021-07-07T11:40:21 | 2021-07-07T11:40:21 | 384,152,956 | 0 | 0 | BSD-2-Clause | 2021-07-08T14:32:42 | 2021-07-08T14:32:42 | null | UTF-8 | Java | false | false | 32,617 | java | /*
* Copyright (c) 2021, Zoinkwiz <https://github.com/Zoinkwiz>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 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.questhelper.quests.thegreatbrainrobbery;
import com.questhelper.ItemCollections;
import com.questhelper.QuestDescriptor;
import com.questhelper.QuestHelperQuest;
import com.questhelper.QuestVarbits;
import com.questhelper.Zone;
import com.questhelper.banktab.BankSlotIcons;
import com.questhelper.panel.PanelDetails;
import com.questhelper.questhelpers.BasicQuestHelper;
import com.questhelper.requirements.ZoneRequirement;
import com.questhelper.requirements.conditional.Conditions;
import com.questhelper.requirements.item.ItemOnTileRequirement;
import com.questhelper.requirements.item.ItemRequirement;
import com.questhelper.requirements.item.ItemRequirements;
import com.questhelper.requirements.player.InInstanceRequirement;
import com.questhelper.requirements.player.SkillRequirement;
import com.questhelper.requirements.quest.QuestRequirement;
import com.questhelper.requirements.Requirement;
import com.questhelper.requirements.util.LogicType;
import com.questhelper.requirements.util.Operation;
import com.questhelper.requirements.var.VarbitRequirement;
import com.questhelper.steps.ConditionalStep;
import com.questhelper.steps.DetailedQuestStep;
import com.questhelper.steps.ItemStep;
import com.questhelper.steps.NpcStep;
import com.questhelper.steps.ObjectStep;
import com.questhelper.steps.QuestStep;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.runelite.api.ItemID;
import net.runelite.api.NpcID;
import net.runelite.api.NullObjectID;
import net.runelite.api.ObjectID;
import net.runelite.api.QuestState;
import net.runelite.api.Skill;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.GameTick;
import net.runelite.client.eventbus.Subscribe;
@QuestDescriptor(
quest = QuestHelperQuest.THE_GREAT_BRAIN_ROBBERY
)
public class TheGreatBrainRobbery extends BasicQuestHelper
{
// Required
ItemRequirement fishbowlHelmet, divingApparatus, woodenCats, oakPlank, saw, plank, fur, hammer, nails,
holySymbol, ringOfCharos, catsOrResources, tinderbox;
// Recommended
ItemRequirement ectophial, edgevilleTeleport, fenkenstrainTeleport, watermelonSeeds, combatGearForSafespotting,
food, prayerPotions;
// Quest items
ItemRequirement prayerBook, wolfWhistle, shippingOrder, cratePart, keg, fuse, cranialClamp, brainTongs, bellJars,
skullStaples, neededJars, neededStaples, anchor;
Zone harmony, waterEntrance, water, waterExit, peepRoom, fenkF2, fenkF1, harmonyBasement, boat;
Requirement inHarmony, inWaterEntrance, inWater, inWaterExit, inPeepRoom, inFenkF2, inFenkF1, inHarmonyBasement,
onBoat, repairedStairs, hasReadPrayerBook, talkedToFenk, talkedToRufus, madeCrateWalls, madeCrateBottom,
addedCats, addedCatsOrHas10, fenkInCrate, placedKeg, addedFuse, litFuse, churchDoorGone, hasKeg, hasFuse,
hasTinderbox, givenClamp, givenStaples, givenBells, givenTongs, hadClamp, hadStaples, hadBells, hadTongs,
givenHammer, barrelchestAppeared;
QuestStep talkToTranquility, talkToTranquilityOnIsland, pullStatue, enterWater, repairWaterStairs,
climbFromWater, climbFromWaterCaveToPeep, peerThroughHole, goFromHoleToWater, leaveWaterBack,
enterWaterReturn, leaveWaterEntranceReturn, talkToTranquilityAfterPeeping, talkToTranquilityMosAfterPeeping;
QuestStep searchBookcase, readBook, returnToTranquility, recitePrayer, returnToHarmonyAfterPrayer,
talkToTranquilityAfterPrayer;
QuestStep goToF1Fenk, goToF2Fenk, talkToFenk, talkToRufus, makeOrGetWoodenCats, goToF1FenkForCrate,
goToF2FenkForCrate, buildCrate, addBottomToCrate, fillCrate, blowWhistle, goF1WithOrder, goF2WithOrder,
putOrderOnCrate;
QuestStep goToHarmonyAfterFenk, goDownToFenk, talkToFenkOnHarmony, leaveWindmillBasement, goToHarmonyForBrainItems,
getFuse, climbShipLadder, getTinderbox, getKeg, climbDownFromShip, useKegOnDoor, useFuseOnDoor, lightFuse,
killSorebones, goBackDownToFenk, talkToFenkWithItems, goUpFromFenkAfterItems, talkToTranquilityAfterHelping;
QuestStep enterChurchForFight, confrontMigor, defeatBarrelchest, pickupAnchor, talkToTranquilityToFinish;
@Override
public Map<Integer, QuestStep> loadSteps()
{
setupItemRequirements();
setupZones();
setupConditions();
setupSteps();
Map<Integer, QuestStep> steps = new HashMap<>();
ConditionalStep goStart = new ConditionalStep(this, talkToTranquility);
goStart.addStep(inHarmony, talkToTranquilityOnIsland);
steps.put(0, goStart);
ConditionalStep goPeep = new ConditionalStep(this, talkToTranquility);
goPeep.addStep(inPeepRoom, peerThroughHole);
goPeep.addStep(inWaterExit, climbFromWaterCaveToPeep);
goPeep.addStep(new Conditions(inWater, repairedStairs), climbFromWater);
goPeep.addStep(inWater, repairWaterStairs);
goPeep.addStep(inWaterEntrance, enterWater);
goPeep.addStep(inHarmony, pullStatue);
steps.put(10, goPeep);
ConditionalStep returnAfterPeep = new ConditionalStep(this, talkToTranquilityMosAfterPeeping);
returnAfterPeep.addStep(inPeepRoom, goFromHoleToWater);
returnAfterPeep.addStep(inWaterExit, enterWaterReturn);
returnAfterPeep.addStep(inWater, leaveWaterEntranceReturn);
returnAfterPeep.addStep(inWaterEntrance, leaveWaterBack);
returnAfterPeep.addStep(inHarmony, talkToTranquilityAfterPeeping);
steps.put(20, returnAfterPeep);
ConditionalStep goGetBook = new ConditionalStep(this, searchBookcase);
goGetBook.addStep(new Conditions(prayerBook.alsoCheckBank(questBank), hasReadPrayerBook, inHarmony),
recitePrayer);
goGetBook.addStep(new Conditions(prayerBook.alsoCheckBank(questBank), hasReadPrayerBook), returnToTranquility);
goGetBook.addStep(prayerBook.alsoCheckBank(questBank), readBook);
steps.put(30, goGetBook);
steps.put(40, goGetBook);
ConditionalStep goAfterPrayer = new ConditionalStep(this, returnToHarmonyAfterPrayer);
goAfterPrayer.addStep(inHarmony, talkToTranquilityAfterPrayer);
steps.put(50, goAfterPrayer);
ConditionalStep goSortCrate = new ConditionalStep(this, makeOrGetWoodenCats);
goSortCrate.addStep(new Conditions(inFenkF2, addedCats), blowWhistle);
goSortCrate.addStep(new Conditions(addedCatsOrHas10, inFenkF2, madeCrateBottom), fillCrate);
goSortCrate.addStep(new Conditions(addedCatsOrHas10, inFenkF2, madeCrateWalls), addBottomToCrate);
goSortCrate.addStep(new Conditions(addedCatsOrHas10, inFenkF2), buildCrate);
goSortCrate.addStep(new Conditions(addedCatsOrHas10, inFenkF1), goToF2FenkForCrate);
goSortCrate.addStep(new Conditions(addedCatsOrHas10), goToF1FenkForCrate);
ConditionalStep goTalkFenk = new ConditionalStep(this, goToF1Fenk);
goTalkFenk.addStep(new Conditions(fenkInCrate, inFenkF2), putOrderOnCrate);
goTalkFenk.addStep(new Conditions(fenkInCrate, inFenkF1), goF2WithOrder);
goTalkFenk.addStep(fenkInCrate, goF1WithOrder);
goTalkFenk.addStep(talkedToRufus, goSortCrate);
goTalkFenk.addStep(talkedToFenk, talkToRufus);
goTalkFenk.addStep(inFenkF1, goToF2Fenk);
goTalkFenk.addStep(inFenkF2, talkToFenk);
steps.put(60, goTalkFenk);
ConditionalStep goTalkFenkHarmony = new ConditionalStep(this, goToHarmonyAfterFenk);
goTalkFenkHarmony.addStep(inHarmonyBasement, talkToFenkOnHarmony);
goTalkFenkHarmony.addStep(inHarmony, goDownToFenk);
steps.put(70, goTalkFenkHarmony);
ConditionalStep goBlowTheDoor = new ConditionalStep(this, goToHarmonyForBrainItems);
goBlowTheDoor.addStep(new Conditions(inHarmonyBasement, hadClamp, hadTongs, hadBells,
hadStaples), talkToFenkWithItems);
goBlowTheDoor.addStep(new Conditions(hadClamp, hadTongs, hadBells, hadStaples), goBackDownToFenk);
goBlowTheDoor.addStep(new Conditions(onBoat, hasFuse, hasTinderbox, hasKeg), climbDownFromShip);
goBlowTheDoor.addStep(new Conditions(inHarmony, churchDoorGone), killSorebones);
goBlowTheDoor.addStep(new Conditions(inHarmony, addedFuse, hasTinderbox), lightFuse);
goBlowTheDoor.addStep(new Conditions(inHarmony, hasFuse, hasTinderbox, placedKeg), useFuseOnDoor);
goBlowTheDoor.addStep(new Conditions(inHarmony, hasFuse, hasTinderbox, hasKeg), useKegOnDoor);
goBlowTheDoor.addStep(new Conditions(onBoat, hasFuse, hasTinderbox), getKeg);
goBlowTheDoor.addStep(new Conditions(onBoat, hasFuse), getTinderbox);
goBlowTheDoor.addStep(new Conditions(inHarmony, hasFuse), climbShipLadder);
goBlowTheDoor.addStep(onBoat, climbDownFromShip);
goBlowTheDoor.addStep(inHarmony, getFuse);
steps.put(80, goBlowTheDoor);
steps.put(90, goBlowTheDoor);
ConditionalStep goTalkToTranqAfterHelping = new ConditionalStep(this, talkToTranquilityAfterHelping);
goTalkToTranqAfterHelping.addStep(inHarmonyBasement, goUpFromFenkAfterItems);
steps.put(100, goTalkToTranqAfterHelping);
ConditionalStep goConfront = new ConditionalStep(this, enterChurchForFight);
goConfront.addStep(new Conditions(inHarmony, new InInstanceRequirement(), barrelchestAppeared), defeatBarrelchest);
goConfront.addStep(new Conditions(inHarmony, new InInstanceRequirement()), confrontMigor);
steps.put(110, goConfront);
ConditionalStep goFinish = new ConditionalStep(this, talkToTranquilityToFinish);
goFinish.addStep(new ItemOnTileRequirement(anchor), pickupAnchor);
steps.put(120, goFinish);
return steps;
}
public void setupItemRequirements()
{
// Item reqs
fishbowlHelmet = new ItemRequirement("Fishbowl helmet", ItemID.FISHBOWL_HELMET);
fishbowlHelmet.setTooltip("You can get another from Murphy in Port Khazard");
divingApparatus = new ItemRequirement("Diving apparatus", ItemID.DIVING_APPARATUS);
divingApparatus.setTooltip("You can get another from Murphy in Port Khazard");
woodenCats = new ItemRequirement("Wooden cat", ItemID.WOODEN_CAT);
oakPlank = new ItemRequirement("Oak plank", ItemID.OAK_PLANK);
saw = new ItemRequirement("Saw", ItemCollections.getSaw());
plank = new ItemRequirement("Plank", ItemID.PLANK);
fur = new ItemRequirement("Fur", ItemID.FUR);
fur.addAlternates(ItemID.BEAR_FUR, ItemID.GREY_WOLF_FUR);
hammer = new ItemRequirement("Hammer", ItemCollections.getHammer());
nails = new ItemRequirement("Nails", ItemCollections.getNails());
holySymbol = new ItemRequirement("Holy symbol", ItemID.HOLY_SYMBOL);
ringOfCharos = new ItemRequirement("Ring of Charos", ItemID.RING_OF_CHAROS);
ringOfCharos.addAlternates(ItemID.RING_OF_CHAROSA);
ringOfCharos.setDisplayMatchedItemName(true);
catsOrResources = new ItemRequirements(LogicType.OR, "10 Wooden cats, or 10 planks and 10 furs to make them",
woodenCats.quantity(10), new ItemRequirements(plank.quantity(10), fur.quantity(10)));
tinderbox = new ItemRequirement("Tinderbox", ItemID.TINDERBOX);
tinderbox.addAlternates(ItemID.TINDERBOX_7156);
// Item recommended
ectophial = new ItemRequirement("Ectophial", ItemID.ECTOPHIAL);
edgevilleTeleport = new ItemRequirement("Monastery teleport", ItemCollections.getCombatBracelets());
edgevilleTeleport.addAlternates(ItemCollections.getAmuletOfGlories());
fenkenstrainTeleport = new ItemRequirement("Fenkenstrain's Castle teleport", ItemID.FENKENSTRAINS_CASTLE_TELEPORT);
watermelonSeeds = new ItemRequirement("Watermelon seeds to plant on Harmony for Hard Morytania Diary",
ItemID.WATERMELON_SEED);
combatGearForSafespotting = new ItemRequirement("Combat gear for safespotting", -1, -1);
combatGearForSafespotting.setDisplayItemId(BankSlotIcons.getMagicCombatGear());
food = new ItemRequirement("Food", ItemCollections.getGoodEatingFood());
prayerPotions = new ItemRequirement("Prayer potion", ItemCollections.getPrayerPotions());
// Quest items
prayerBook = new ItemRequirement("Prayer book", ItemID.PRAYER_BOOK);
prayerBook.addAlternates(ItemID.PRAYER_BOOK_10890);
wolfWhistle = new ItemRequirement("Wolf whistle", ItemID.WOLF_WHISTLE);
wolfWhistle.setTooltip("You can get another from Rufus in Canifis");
shippingOrder = new ItemRequirement("Shipping order", ItemID.SHIPPING_ORDER);
shippingOrder.setTooltip("You can get another from Rufus in Canifis");
cratePart = new ItemRequirement("Crate part", ItemID.CRATE_PART);
cratePart.setTooltip("You can get more from Rufus in Canifis");
keg = new ItemRequirement("Keg", ItemID.KEG_10898);
keg.addAlternates(ItemID.KEG);
fuse = new ItemRequirement("Fuse", ItemID.FUSE_10884);
cranialClamp = new ItemRequirement("Cranial clamp", ItemID.CRANIAL_CLAMP);
brainTongs = new ItemRequirement("Brain tongs", ItemID.BRAIN_TONGS); // 10894
bellJars = new ItemRequirement("Bell jar", ItemID.BELL_JAR);
skullStaples = new ItemRequirement("Skull staple", ItemID.SKULL_STAPLE);
anchor = new ItemRequirement("Barrelchest anchor", ItemID.BARRELCHEST_ANCHOR_10888);
neededJars = bellJars.quantity(3 - client.getVarbitValue(3399));
neededStaples = skullStaples.quantity(30 - client.getVarbitValue(3400));
}
public void setupZones()
{
harmony = new Zone(new WorldPoint(3771, 2813, 0), new WorldPoint(3840, 2881, 3));
waterEntrance = new Zone(new WorldPoint(3782, 9250, 0), new WorldPoint(3795, 9259, 0));
water = new Zone(new WorldPoint(3777, 9242, 1), new WorldPoint(3835, 9267, 1));
waterExit = new Zone(new WorldPoint(3822, 9251, 0), new WorldPoint(3833, 9258, 0));
peepRoom = new Zone(new WorldPoint(3817, 2842, 0), new WorldPoint(3821, 2846, 0));
fenkF1 = new Zone(new WorldPoint(3526, 3574, 1), new WorldPoint(3566, 3531, 1));
fenkF2 = new Zone(new WorldPoint(3544, 3558, 2), new WorldPoint(3553, 3551, 2));
harmonyBasement = new Zone(new WorldPoint(3778, 9219, 0), new WorldPoint(3792, 9232, 0));
boat = new Zone(new WorldPoint(3790, 2870, 1), new WorldPoint(3810, 2876, 2));
}
public void setupConditions()
{
inHarmony = new ZoneRequirement(harmony);
inWater = new ZoneRequirement(water);
inWaterEntrance = new ZoneRequirement(waterEntrance);
inWaterExit = new ZoneRequirement(waterExit);
inPeepRoom = new ZoneRequirement(peepRoom);
inFenkF2 = new ZoneRequirement(fenkF2);
inFenkF1 = new ZoneRequirement(fenkF1);
inHarmonyBasement = new ZoneRequirement(harmonyBasement);
onBoat = new ZoneRequirement(boat);
// 3383 started talking to tranq =1, accepted =2
// Pulling statue, 3401 =1, statue pulled, 3401 = 2
// 3384, 0->1, entered statue
repairedStairs = new VarbitRequirement(3385, 1);
hasReadPrayerBook = new VarbitRequirement(3386, 1);
// 3387 = 1, talked a bit to Tranq in Mos Le after getting the Prayer book
// 3388 = 1, part way through Fenk convo
talkedToFenk = new VarbitRequirement(3388, 2, Operation.GREATER_EQUAL);
talkedToRufus = new VarbitRequirement(3388, 3, Operation.GREATER_EQUAL);
// 3390 = 1, talked to Rufus. Probably construction spot appears
madeCrateWalls = new VarbitRequirement(3390, 2, Operation.GREATER_EQUAL);
madeCrateBottom = new VarbitRequirement(3390, 3, Operation.GREATER_EQUAL);
addedCats = new VarbitRequirement(3390, 4, Operation.GREATER_EQUAL);
fenkInCrate = new VarbitRequirement(3390, 5, Operation.GREATER_EQUAL);
addedCatsOrHas10 = new Conditions(LogicType.OR, addedCats, woodenCats.quantity(10).alsoCheckBank(questBank));
// 3392 0->10, added wooden cats
placedKeg = new VarbitRequirement(3393, 2, Operation.GREATER_EQUAL);
addedFuse = new VarbitRequirement(3393, 3, Operation.GREATER_EQUAL);
litFuse = new VarbitRequirement(3393, 4, Operation.GREATER_EQUAL);
churchDoorGone = new VarbitRequirement(3393, 5, Operation.GREATER_EQUAL);
hasKeg = new Conditions(LogicType.OR, keg, placedKeg);
hasFuse = new Conditions(LogicType.OR, fuse, addedFuse);
hasTinderbox = new Conditions(LogicType.OR, tinderbox, litFuse);
givenClamp = new VarbitRequirement(3396, 1);
givenTongs = new VarbitRequirement(3397, 1);
givenHammer = new VarbitRequirement(3398, 1);
givenBells = new VarbitRequirement(3399, 3);
givenStaples = new VarbitRequirement(3400, 30);
hadClamp = new Conditions(LogicType.OR, givenClamp, cranialClamp);
hadStaples = new Conditions(LogicType.OR, givenStaples, neededStaples);
hadBells = new Conditions(LogicType.OR, givenBells, neededJars);
hadTongs = new Conditions(LogicType.OR, givenTongs, brainTongs);
barrelchestAppeared = new VarbitRequirement(3410, 1);
// received blessing, 3411 = 1
}
@Subscribe
public void onGameTick(GameTick event)
{
int staplesNeeded = 30;
int bellsNeeded = 3;
neededStaples.quantity(staplesNeeded - client.getVarbitValue(3400));
neededJars.quantity(bellsNeeded - client.getVarbitValue(3399));
}
public void setupSteps()
{
talkToTranquility = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3681, 2963, 0),
"Talk to Brother Tranquility on Mos Le'Harmless.");
talkToTranquility.addDialogStep("Undead pirates? Let me at 'em!");
talkToTranquilityOnIsland = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3787, 2825,
0), "Talk to Brother Tranquility on Harmony.");
talkToTranquility.addSubSteps(talkToTranquilityOnIsland);
ItemRequirement conditionalPlanks = plank.quantity(4).hideConditioned(repairedStairs);
ItemRequirement conditionalNails = nails.quantity(60).hideConditioned(repairedStairs);
ItemRequirement conditionalHammer = hammer.hideConditioned(repairedStairs);
pullStatue = new ObjectStep(this, NullObjectID.NULL_22355, new WorldPoint(3794, 2844, 0),
"Pull the saradomin statue on Harmony, then enter it.", fishbowlHelmet.equipped(),
divingApparatus.equipped(), conditionalHammer, conditionalPlanks, conditionalNails);
enterWater = new ObjectStep(this, ObjectID.STAIRS_22365, new WorldPoint(3788, 9254, 0),
"Enter the water.");
repairWaterStairs = new ObjectStep(this, NullObjectID.NULL_22370, new WorldPoint(3829, 9254, 1),
"Repair the stairs to the east.", hammer, plank.quantity(4), nails.quantity(100));
climbFromWater = new ObjectStep(this, NullObjectID.NULL_22370, new WorldPoint(3829, 9254, 1),
"Climb up the stairs to the east.");
climbFromWaterCaveToPeep = new ObjectStep(this, ObjectID.LADDER_22372, new WorldPoint(3831, 9254, 0),
"Climb up the ladder.");
peerThroughHole = new ObjectStep(this, ObjectID.PEEPHOLE, new WorldPoint(3817, 2844, 0),
"Peer through the nearby peephole.");
goFromHoleToWater = new ObjectStep(this, ObjectID.LADDER_22164, new WorldPoint(3819, 2843, 0),
"Return to Brother Tranquility on Harmony.");
enterWaterReturn = new ObjectStep(this, ObjectID.STAIRS_22366, new WorldPoint(3827, 9254, 0),
"Return to Brother Tranquility on Harmony.");
leaveWaterEntranceReturn = new ObjectStep(this, ObjectID.STAIRS_22367, new WorldPoint(3785, 9254, 1),
"Return to Brother Tranquility on Harmony.");
leaveWaterBack = new ObjectStep(this, ObjectID.LADDER_22371, new WorldPoint(3784, 9254, 0),
"Return to Brother Tranquility on Harmony.");
talkToTranquilityMosAfterPeeping = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3681, 2963, 0),
"Return to Brother Tranquility on Harmony.");
talkToTranquilityMosAfterPeeping.addDialogStep("Yes, please.");
talkToTranquilityAfterPeeping = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3787, 2825,
0), "Return to Brother Tranquility.");
talkToTranquilityAfterPeeping.addSubSteps(goFromHoleToWater, enterWaterReturn, leaveWaterEntranceReturn,
leaveWaterBack, talkToTranquilityMosAfterPeeping);
searchBookcase = new ObjectStep(this, ObjectID.BOOKCASE_380, new WorldPoint(3049, 3484, 0),
"Search the south west bookcase in the Edgeville Monastery.");
readBook = new DetailedQuestStep(this, "Read the prayer book.", prayerBook.highlighted());
returnToTranquility = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3681, 2963, 0),
"Return to Harmony.", prayerBook, holySymbol.equipped());
recitePrayer = new DetailedQuestStep(this, new WorldPoint(3787, 2825,
0), "Right-click recite the prayer book on Harmony.", prayerBook.highlighted(), holySymbol.equipped());
returnToHarmonyAfterPrayer = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3681, 2963, 0),
"Return to Brother Tranquility on Harmony.");
returnToHarmonyAfterPrayer.addDialogStep("Yes, please.");
talkToTranquilityAfterPrayer = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3787, 2825,
0), "Talk to Brother Tranquility again.");
talkToTranquilityAfterPrayer.addSubSteps(returnToHarmonyAfterPrayer);
goToF1Fenk = new ObjectStep(this, ObjectID.STAIRCASE_5206, new WorldPoint(3538, 3552, 0),
"Go up to the second floor of Fenkenstrain's Castle and talk to Dr. Fenkenstrain.");
goToF1Fenk.addDialogStep("Yes, please.");
goToF2Fenk = new ObjectStep(this, ObjectID.LADDER_16683, new WorldPoint(3548, 3554, 1),
"Go up to the second floor of Fenkenstrain's Castle and talk to Dr. Fenkenstrain.");
talkToFenk = new NpcStep(this, NpcID.DR_FENKENSTRAIN, new WorldPoint(3548, 3554, 2),
"Go up to the second floor of Fenkenstrain's Castle and talk to Dr. Fenkenstrain.");
talkToFenk.addSubSteps(goToF1Fenk, goToF2Fenk);
talkToRufus = new NpcStep(this, NpcID.RUFUS_6478, new WorldPoint(3507, 3494, 0),
"Talk to Rufus in Canifis' food store.", ringOfCharos.equipped());
talkToRufus.addDialogStep("Talk about the meat shipment");
makeOrGetWoodenCats = new DetailedQuestStep(this,
"Either buy 10 wooden cats from the G.E., or make them on a clockmaker's bench in your POH.",
catsOrResources);
makeOrGetWoodenCats.addDialogStep("Wooden cat");
goToF1FenkForCrate = new ObjectStep(this, ObjectID.STAIRCASE_5206, new WorldPoint(3538, 3552, 0),
"Return to Dr. Fenkenstrain.", ringOfCharos.equipped(),
plank.quantity(4).hideConditioned(madeCrateBottom), nails.quantity(100).hideConditioned(madeCrateBottom),
hammer.hideConditioned(madeCrateBottom), woodenCats.quantity(10).hideConditioned(addedCats),
cratePart.quantity(6).hideConditioned(madeCrateWalls), wolfWhistle);
goToF2FenkForCrate = new ObjectStep(this, ObjectID.LADDER_16683, new WorldPoint(3548, 3554, 1),
"Return to Dr. Fenkenstrain.", ringOfCharos.equipped(),
plank.quantity(4).hideConditioned(madeCrateBottom), nails.quantity(100).hideConditioned(madeCrateBottom),
hammer.hideConditioned(madeCrateBottom), woodenCats.quantity(10).hideConditioned(addedCats),
cratePart.quantity(6).hideConditioned(madeCrateWalls), wolfWhistle);
buildCrate = new ObjectStep(this, NullObjectID.NULL_22489, new WorldPoint(3550, 3554, 2),
"Return to Dr. Fenkenstrain and build the crate next to him.", ringOfCharos.equipped(), plank.quantity(4), nails.quantity(100),
hammer, woodenCats.quantity(10), cratePart.quantity(6), wolfWhistle);
buildCrate.addSubSteps(goToF1FenkForCrate, goToF2FenkForCrate);
addBottomToCrate = new ObjectStep(this, NullObjectID.NULL_22489, new WorldPoint(3550, 3554, 2),
"Add a bottom to the crate.", plank.quantity(4), nails.quantity(100), hammer);
fillCrate = new ObjectStep(this, NullObjectID.NULL_22489, new WorldPoint(3550, 3554, 2),
"Fill the crate next to Fenkenstrain with wooden cats.", woodenCats.quantity(10).highlighted());
fillCrate.addIcon(ItemID.WOODEN_CAT);
blowWhistle = new DetailedQuestStep(this, "Blow the wolf whistle.", wolfWhistle.highlighted(), ringOfCharos.equipped());
goF1WithOrder = new ObjectStep(this, ObjectID.STAIRCASE_5206, new WorldPoint(3538, 3552, 0),
"Return to Dr. Fenkenstrain and place the shipping order on the crate.", shippingOrder);
goF2WithOrder = new ObjectStep(this, ObjectID.LADDER_16683, new WorldPoint(3548, 3554, 1),
"Return to Dr. Fenkenstrain and place the shipping order on the crate.", shippingOrder);
putOrderOnCrate = new ObjectStep(this, NullObjectID.NULL_22489, new WorldPoint(3550, 3554, 2),
"Return to Dr. Fenkenstrain and place the shipping order on the crate..", shippingOrder.highlighted());
putOrderOnCrate.addIcon(ItemID.SHIPPING_ORDER);
putOrderOnCrate.addSubSteps(goF1WithOrder, goF2WithOrder);
goToHarmonyAfterFenk = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3681, 2963, 0),
"Return Harmony, and talk to Fenkenstrain in the windmill's basement.");
goDownToFenk = new ObjectStep(this, ObjectID.LADDER_22173, new WorldPoint(3789, 2826, 0),
"Talk to Dr. Fenkenstrain in the Harmony Windmill basement.");
talkToFenkOnHarmony = new NpcStep(this, NpcID.DR_FENKENSTRAIN, new WorldPoint(3785, 9225, 0),
"Talk to Dr. Fenkenstrain in the Harmony Windmill basement.");
talkToFenkOnHarmony.addSubSteps(goToHarmonyAfterFenk, goDownToFenk);
leaveWindmillBasement = new ObjectStep(this, ObjectID.LADDER_22172, new WorldPoint(3789, 9226, 0),
"Leave the basement.");
goToHarmonyForBrainItems = new NpcStep(this, NpcID.BROTHER_TRANQUILITY, new WorldPoint(3681, 2963, 0),
"Return to Harmony.");
getFuse = new ObjectStep(this, ObjectID.LOCKER_22298, new WorldPoint(3791, 2873, 0),
"Search the locker on the ship on the north of Harmony.", fishbowlHelmet.equipped(), divingApparatus.equipped());
((ObjectStep) getFuse).addAlternateObjects(ObjectID.LOCKER_22299);
getFuse.addSubSteps(goToHarmonyForBrainItems);
climbShipLadder = new ObjectStep(this, ObjectID.LADDER_22274, new WorldPoint(3802, 2873, 0),
"Climb the ship's ladder.");
getTinderbox = new ItemStep(this, "Take a tinderbox.", tinderbox);
getKeg = new ItemStep(this, "Take a keg.", keg);
climbDownFromShip = new ObjectStep(this, ObjectID.LADDER_22275, new WorldPoint(3802, 2873, 1),
"Climb down the ship's ladder.");
useKegOnDoor = new ObjectStep(this, NullObjectID.NULL_22119, new WorldPoint(3805, 2844, 0),
"Use the keg on the church's door.", keg.highlighted());
useKegOnDoor.addIcon(ItemID.KEG_10898);
useFuseOnDoor = new ObjectStep(this, NullObjectID.NULL_22119, new WorldPoint(3805, 2844, 0),
"Use the fuse on the keg.", fuse.highlighted());
useFuseOnDoor.addIcon(ItemID.FUSE_10884);
lightFuse = new ObjectStep(this, NullObjectID.NULL_22492, new WorldPoint(3803, 2844, 0),
"Light the fuse.", tinderbox.highlighted());
lightFuse.addIcon(ItemID.TINDERBOX);
killSorebones = new NpcStep(this, NpcID.SOREBONES, new WorldPoint(3815, 2843, 0),
"Kill sorebones in the church for items.", true,
cranialClamp.hideConditioned(givenClamp), brainTongs.hideConditioned(givenTongs),
neededJars.hideConditioned(givenBells), neededStaples.hideConditioned(givenStaples));
((NpcStep) killSorebones).addAlternateNpcs(NpcID.SOREBONES_562);
goBackDownToFenk = new ObjectStep(this, ObjectID.LADDER_22173, new WorldPoint(3789, 2826, 0),
"Return to Dr. Fenkenstrain in the Harmony Windmill basement.", hammer.hideConditioned(givenHammer),
cranialClamp.hideConditioned(givenClamp), brainTongs.hideConditioned(givenTongs),
neededJars.hideConditioned(givenBells), neededStaples.hideConditioned(givenStaples));
talkToFenkWithItems = new NpcStep(this, NpcID.DR_FENKENSTRAIN, new WorldPoint(3785, 9225, 0),
"Return to Dr. Fenkenstrain in the Harmony Windmill basement.", hammer.hideConditioned(givenHammer),
cranialClamp.hideConditioned(givenClamp), brainTongs.hideConditioned(givenTongs),
neededJars.hideConditioned(givenBells), neededStaples.hideConditioned(givenStaples));
talkToFenkWithItems.addSubSteps(goBackDownToFenk);
goUpFromFenkAfterItems = new ObjectStep(this, ObjectID.LADDER_22172, new WorldPoint(3789, 9226, 0),
"Talk to Brother Tranquility on Harmony.");
talkToTranquilityAfterHelping = new NpcStep(this, NpcID.BROTHER_TRANQUILITY_551, new WorldPoint(3787, 2825,
0), "Talk to Brother Tranquility on Harmony.");
talkToTranquilityAfterHelping.addSubSteps(goUpFromFenkAfterItems);
enterChurchForFight = new ObjectStep(this, NullObjectID.NULL_22119, new WorldPoint(3805, 2844, 0),
"Enter the church, ready to fight Barrelchest. If after initially entering you leave then re-enter, the " +
"Barrelchest will get stuck and you can safespot it from the door.", fishbowlHelmet.equipped(),
divingApparatus.equipped(), combatGearForSafespotting);
confrontMigor = new NpcStep(this, NpcID.MIGOR, new WorldPoint(3815, 2844, 0),
"Confront Migor.");
defeatBarrelchest = new NpcStep(this, NpcID.BARRELCHEST, new WorldPoint(3815, 2844, 0),
"Defeat the barrelchest. You can safespot it from the door if you leave and re-enter the instance.");
((NpcStep) defeatBarrelchest).addSafeSpots(new WorldPoint(3806, 2844, 0));
pickupAnchor = new ItemStep(this, "Pickup the anchor.", anchor);
talkToTranquilityToFinish = new NpcStep(this, NpcID.BROTHER_TRANQUILITY_551, new WorldPoint(3787, 2825,
0), "Talk to Brother Tranquility on Harmony to complete the quest.");
talkToTranquilityToFinish.addSubSteps(pickupAnchor);
}
@Override
public List<ItemRequirement> getItemRequirements()
{
return Arrays.asList(fishbowlHelmet, divingApparatus, catsOrResources, plank.quantity(8), hammer,
nails.quantity(100), holySymbol, ringOfCharos);
}
@Override
public List<ItemRequirement> getItemRecommended()
{
return Arrays.asList(ectophial, edgevilleTeleport, fenkenstrainTeleport, watermelonSeeds.quantity(3),
combatGearForSafespotting, food, prayerPotions);
}
@Override
public List<Requirement> getGeneralRequirements()
{
List<Requirement> reqs = new ArrayList<>();
reqs.add(new QuestRequirement(QuestHelperQuest.CREATURE_OF_FENKENSTRAIN, QuestState.FINISHED));
reqs.add(new VarbitRequirement(QuestVarbits.QUEST_RECIPE_FOR_DISASTER_PIRATE_PETE.getId(),
Operation.GREATER_EQUAL, 110, "Finished RFD - Pirate Pete"));
reqs.add(new QuestRequirement(QuestHelperQuest.RUM_DEAL, QuestState.FINISHED));
reqs.add(new QuestRequirement(QuestHelperQuest.CABIN_FEVER, QuestState.FINISHED));
reqs.add(new SkillRequirement(Skill.CRAFTING, 16));
reqs.add(new SkillRequirement(Skill.CONSTRUCTION, 30));
reqs.add(new SkillRequirement(Skill.PRAYER, 50));
return reqs;
}
@Override
public List<String> getCombatRequirements()
{
return Arrays.asList("Barrelchest (level 190, safespottable)", "4 Sorebones (level 57)");
}
@Override
public ArrayList<PanelDetails> getPanels()
{
ArrayList<PanelDetails> allSteps = new ArrayList<>();
allSteps.add(new PanelDetails("Starting off",
Arrays.asList(talkToTranquility, pullStatue, enterWater, repairWaterStairs, climbFromWater,
climbFromWaterCaveToPeep, peerThroughHole, talkToTranquilityAfterPeeping),
plank.quantity(4), nails.quantity(60), hammer, fishbowlHelmet, divingApparatus));
allSteps.add(new PanelDetails("Protecting the windmill",
Arrays.asList(searchBookcase, readBook, returnToTranquility, recitePrayer, talkToTranquilityAfterPrayer),
holySymbol));
allSteps.add(new PanelDetails("Finding a Doctor",
Arrays.asList(talkToFenk, talkToRufus, makeOrGetWoodenCats, buildCrate, addBottomToCrate, fillCrate,
blowWhistle, putOrderOnCrate),
ringOfCharos, catsOrResources, plank.quantity(4), nails.quantity(100), hammer));
allSteps.add(new PanelDetails("Saving the Monks",
Arrays.asList(talkToFenkOnHarmony, getFuse, climbShipLadder, getTinderbox, climbDownFromShip,
useKegOnDoor, useFuseOnDoor, lightFuse, killSorebones, talkToFenkWithItems, talkToTranquilityAfterHelping),
hammer, fishbowlHelmet, divingApparatus, combatGearForSafespotting));
allSteps.add(new PanelDetails("Defeating a Barrelchest",
Arrays.asList(enterChurchForFight, confrontMigor, defeatBarrelchest, talkToTranquilityToFinish),
fishbowlHelmet, divingApparatus, combatGearForSafespotting));
return allSteps;
}
}
| [
"zoinkwiz@hotmail.co.uk"
] | zoinkwiz@hotmail.co.uk |
281c88bce28f5eca63b81d0e9e7195511ba45738 | f6b09f184da98f325f76a40ba0e4dd6aec1b5c28 | /jpf-shadow/src/examples/jpf2019/wbs/launch/WBS_5c.java | cf4af440b33175e3511d57bcba47d7d02edfb5aa | [
"Apache-2.0"
] | permissive | hub-se/jpf-shadow-plus | df7242f76aaded3a418b4c816c106d351d7423de | 77a42540b756b03b2db81a42a3ed5f51d232b3a1 | refs/heads/master | 2020-07-23T08:43:52.834801 | 2019-11-06T14:10:10 | 2019-11-06T14:10:24 | 207,503,090 | 2 | 0 | null | 2019-09-11T08:10:36 | 2019-09-10T08:18:59 | Java | UTF-8 | Java | false | false | 8,655 | java | package jpf2019.wbs.launch;
public class WBS_5c {
public int change(int oldVal, int newVal){return oldVal;}
public float change(float oldVal, float newVal) {return oldVal;}
public double change(double oldVal, double newVal){return oldVal;}
public boolean change(boolean oldVal, boolean newVal){return oldVal;}
public long change(long oldVal, long newVal){return oldVal;}
public final boolean OLD = true;
public final boolean NEW = false;
public boolean execute(boolean executionMode){return executionMode;};
// Internal state
private int WBS_Node_WBS_BSCU_SystemModeSelCmd_rlt_PRE;
private int WBS_Node_WBS_BSCU_rlt_PRE1;
private int WBS_Node_WBS_rlt_PRE2;
// Outputs
private int Nor_Pressure;
private int Alt_Pressure;
private int Sys_Mode;
public WBS_5c() {
WBS_Node_WBS_BSCU_SystemModeSelCmd_rlt_PRE = 0;
WBS_Node_WBS_BSCU_rlt_PRE1 = 0;
WBS_Node_WBS_rlt_PRE2 = 100;
Nor_Pressure = 0;
Alt_Pressure = 0;
Sys_Mode = 0;
}
public void update(int PedalPos, boolean AutoBrake, boolean Skid) {
int WBS_Node_WBS_AS_MeterValve_Switch;
int WBS_Node_WBS_AccumulatorValve_Switch;
int WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch;
boolean WBS_Node_WBS_BSCU_Command_Is_Normal_Relational_Operator;
int WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1;
int WBS_Node_WBS_BSCU_Command_Switch;
boolean WBS_Node_WBS_BSCU_SystemModeSelCmd_Logical_Operator6;
int WBS_Node_WBS_BSCU_SystemModeSelCmd_Unit_Delay;
int WBS_Node_WBS_BSCU_Switch2;
int WBS_Node_WBS_BSCU_Switch3;
int WBS_Node_WBS_BSCU_Unit_Delay1;
int WBS_Node_WBS_Green_Pump_IsolationValve_Switch;
int WBS_Node_WBS_SelectorValve_Switch;
int WBS_Node_WBS_SelectorValve_Switch1;
int WBS_Node_WBS_Unit_Delay2;
WBS_Node_WBS_Unit_Delay2 = WBS_Node_WBS_rlt_PRE2;
WBS_Node_WBS_BSCU_Unit_Delay1 = WBS_Node_WBS_BSCU_rlt_PRE1;
WBS_Node_WBS_BSCU_SystemModeSelCmd_Unit_Delay = WBS_Node_WBS_BSCU_SystemModeSelCmd_rlt_PRE;
WBS_Node_WBS_BSCU_Command_Is_Normal_Relational_Operator = (WBS_Node_WBS_BSCU_SystemModeSelCmd_Unit_Delay == 0);
if (change(PedalPos == 0, PedalPos >= 0)) {
WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 = 0;
} else {
if ((PedalPos == 1)) {
WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 = 1;
} else {
if ((PedalPos == 2)) {
WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 = 2;
} else {
if ((PedalPos == 3)) {
WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 = 3;
} else {
if ((PedalPos == 4)) {
WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 = 4;
} else {
WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 = 0;
}
}
}
}
}
if ((AutoBrake && WBS_Node_WBS_BSCU_Command_Is_Normal_Relational_Operator)) {
WBS_Node_WBS_BSCU_Command_Switch = 1;
} else {
WBS_Node_WBS_BSCU_Command_Switch = 0;
}
WBS_Node_WBS_BSCU_SystemModeSelCmd_Logical_Operator6 = change((((!(WBS_Node_WBS_BSCU_Unit_Delay1 == 0))
&& (WBS_Node_WBS_Unit_Delay2 <= 0)) && WBS_Node_WBS_BSCU_Command_Is_Normal_Relational_Operator)
|| (!WBS_Node_WBS_BSCU_Command_Is_Normal_Relational_Operator), (((!(WBS_Node_WBS_BSCU_Unit_Delay1 <= 0))
&& (WBS_Node_WBS_Unit_Delay2 <= 0)) && WBS_Node_WBS_BSCU_Command_Is_Normal_Relational_Operator)
|| (!WBS_Node_WBS_BSCU_Command_Is_Normal_Relational_Operator));
if (WBS_Node_WBS_BSCU_SystemModeSelCmd_Logical_Operator6) {
if (Skid) {
WBS_Node_WBS_BSCU_Switch3 = 0;
} else {
WBS_Node_WBS_BSCU_Switch3 = 4;
}
} else {
WBS_Node_WBS_BSCU_Switch3 = 4;
}
if (WBS_Node_WBS_BSCU_SystemModeSelCmd_Logical_Operator6) {
WBS_Node_WBS_Green_Pump_IsolationValve_Switch = 0;
} else {
WBS_Node_WBS_Green_Pump_IsolationValve_Switch = 5;
}
if (change(WBS_Node_WBS_Green_Pump_IsolationValve_Switch >= 1, true)) {
WBS_Node_WBS_SelectorValve_Switch1 = 0;
} else {
WBS_Node_WBS_SelectorValve_Switch1 = 5;
}
if ((!WBS_Node_WBS_BSCU_SystemModeSelCmd_Logical_Operator6)) {
WBS_Node_WBS_AccumulatorValve_Switch = 0;
} else {
if ((WBS_Node_WBS_SelectorValve_Switch1 >= 1)) {
WBS_Node_WBS_AccumulatorValve_Switch = WBS_Node_WBS_SelectorValve_Switch1;
} else {
WBS_Node_WBS_AccumulatorValve_Switch = 5;
}
}
if ((WBS_Node_WBS_BSCU_Switch3 == 0)) {
WBS_Node_WBS_AS_MeterValve_Switch = 0;
} else {
if (change(WBS_Node_WBS_BSCU_Switch3 == 1, WBS_Node_WBS_BSCU_Switch3 >= 1)) {
WBS_Node_WBS_AS_MeterValve_Switch = (WBS_Node_WBS_AccumulatorValve_Switch / 4);
} else {
if ((WBS_Node_WBS_BSCU_Switch3 == 2)) {
WBS_Node_WBS_AS_MeterValve_Switch = (WBS_Node_WBS_AccumulatorValve_Switch / 2);
} else {
if ((WBS_Node_WBS_BSCU_Switch3 == 3)) {
WBS_Node_WBS_AS_MeterValve_Switch = ((WBS_Node_WBS_AccumulatorValve_Switch / 4) * 3);
} else {
if ((WBS_Node_WBS_BSCU_Switch3 == 4)) {
WBS_Node_WBS_AS_MeterValve_Switch = WBS_Node_WBS_AccumulatorValve_Switch;
} else {
WBS_Node_WBS_AS_MeterValve_Switch = 0;
}
}
}
}
}
if (Skid) {
WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch = 0;
} else {
WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch = change(WBS_Node_WBS_BSCU_Command_Switch
+ WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1, WBS_Node_WBS_BSCU_Command_Switch / WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1);
}
if (WBS_Node_WBS_BSCU_SystemModeSelCmd_Logical_Operator6) {
Sys_Mode = 1;
} else {
Sys_Mode = 0;
}
if (WBS_Node_WBS_BSCU_SystemModeSelCmd_Logical_Operator6) {
WBS_Node_WBS_BSCU_Switch2 = 0;
} else {
if (((WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch >= 0)
&& (WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch < 1))) {
WBS_Node_WBS_BSCU_Switch2 = 0;
} else {
if (change((WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch >= 1)
&& (WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch < 2), WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch > 1)) {
WBS_Node_WBS_BSCU_Switch2 = 1;
} else {
if (((WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch >= 2)
&& (WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch < 3))) {
WBS_Node_WBS_BSCU_Switch2 = 2;
} else {
if (((WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch >= 3)
&& (WBS_Node_WBS_BSCU_Command_AntiSkidCommand_Normal_Switch < 4))) {
WBS_Node_WBS_BSCU_Switch2 = 3;
} else {
WBS_Node_WBS_BSCU_Switch2 = 4;
}
}
}
}
}
if ((WBS_Node_WBS_Green_Pump_IsolationValve_Switch >= 1)) {
WBS_Node_WBS_SelectorValve_Switch = WBS_Node_WBS_Green_Pump_IsolationValve_Switch;
} else {
WBS_Node_WBS_SelectorValve_Switch = 0;
}
if (change(WBS_Node_WBS_BSCU_Switch2 == 0, WBS_Node_WBS_BSCU_Switch2 >= 0)) {
Nor_Pressure = 0;
} else {
if ((WBS_Node_WBS_BSCU_Switch2 == 1)) {
Nor_Pressure = (WBS_Node_WBS_SelectorValve_Switch / 4);
} else {
if ((WBS_Node_WBS_BSCU_Switch2 == 2)) {
Nor_Pressure = (WBS_Node_WBS_SelectorValve_Switch / 2);
} else {
if ((WBS_Node_WBS_BSCU_Switch2 == 3)) {
Nor_Pressure = ((WBS_Node_WBS_SelectorValve_Switch / 4) * 3);
} else {
if ((WBS_Node_WBS_BSCU_Switch2 == 4)) {
Nor_Pressure = WBS_Node_WBS_SelectorValve_Switch;
} else {
Nor_Pressure = 0;
}
}
}
}
}
if ((WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 == 0)) {
Alt_Pressure = 0;
} else {
if (change(WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 == 1, WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 <= 1)) {
Alt_Pressure = (WBS_Node_WBS_AS_MeterValve_Switch / 4);
} else {
if ((WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 == 2)) {
Alt_Pressure = (WBS_Node_WBS_AS_MeterValve_Switch / 2);
} else {
if ((WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 == 3)) {
Alt_Pressure = ((WBS_Node_WBS_AS_MeterValve_Switch / 4) * 3);
} else {
if ((WBS_Node_WBS_BSCU_Command_PedalCommand_Switch1 == 4)) {
Alt_Pressure = WBS_Node_WBS_AS_MeterValve_Switch;
} else {
Alt_Pressure = 0;
}
}
}
}
}
WBS_Node_WBS_rlt_PRE2 = Nor_Pressure;
WBS_Node_WBS_BSCU_rlt_PRE1 = WBS_Node_WBS_BSCU_Switch2;
WBS_Node_WBS_BSCU_SystemModeSelCmd_rlt_PRE = Sys_Mode;
}
public static void launch(int pedal1, boolean auto1, boolean skid1, int pedal2, boolean auto2, boolean skid2, int pedal3, boolean auto3, boolean skid3) {
WBS_5c wbs = new WBS_5c();
wbs.update(pedal1, auto1, skid1);
wbs.update(pedal2, auto2, skid2);
wbs.update(pedal3, auto3, skid3);
}
public static void main(String[] args) {
launch(0, true, true, 0, true, true, 0, true, true);
}
}
| [
"nolleryc@gmail.com"
] | nolleryc@gmail.com |
82bbfde0c42d57f5c61fa3cd59a88751dafc2445 | bbd224f7cb5ac823f51c1f88bdef0ae93fdf3f72 | /src/edu/wctc/hibernate/service/RaceServiceImpl.java | 1bce2cb978815be23aa1b40766390d3c3e7bc691 | [] | no_license | zdobrzynski/ZDobrzynskiWebsiteRedux | 04e0cb644980a29457bd31f4aa61d37f61f53da1 | eebc4bcca34e601c23a9084bd405df85f56e5b1a | refs/heads/master | 2020-09-25T05:26:12.539631 | 2019-12-04T18:05:04 | 2019-12-04T18:05:04 | 225,927,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 907 | java | package edu.wctc.hibernate.service;
import edu.wctc.hibernate.Entity.Race;
import edu.wctc.hibernate.dao.RaceDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class RaceServiceImpl implements RaceService{
@Autowired
private RaceDAO raceDAO;
@Override
@Transactional
public List<Race> getRaces() {
return raceDAO.getRaces();
}
@Override
@Transactional
public void saveRace(Race newRace) {
}
@Override
@Transactional
public RaceDAO getRace(int id) {
return null;
}
@Override
@Transactional
public List<RaceDAO> getRaceByName(String name) {
return null;
}
@Override
@Transactional
public void deleteRace(int id) {
}
}
| [
"zdobrzynski@my.wctc.edu"
] | zdobrzynski@my.wctc.edu |
a885d40c8e588f8cc41dd0c1f4e4805f95dc2503 | 6ee5452bdbb5b35b2e8d08ad0ffc7f14b6cae99f | /milton-cloud-server-api/src/main/java/io/milton/cloud/server/web/alt/HlsGeneratorListener.java | eeeb15fac4bca4ae97cad7a859ca0a8bf746b5a4 | [] | no_license | benjohnston/milton-cloud | df5dc05eaf6cd2df2ffc3e10fcefaea8195d5029 | 0cfa018f99d5f4fff7dbe6e6ccac77ae42e9fbd9 | refs/heads/master | 2021-01-18T07:22:38.740124 | 2013-09-11T05:16:23 | 2013-09-11T05:16:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,260 | java | /*
* Copyright 2013 McEvoy Software Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.milton.cloud.server.web.alt;
import java.io.InputStream;
/**
*
* @author brad
*/
public interface HlsGeneratorListener {
long onNewPrimary(int targetDuration, int version);
long onNewProgram(long primaryId, Dimension size, Integer likelyBandwidth);
/**
*
* @param programId
* @param sequence - zero indexed sequence number of this seg
* @param segmentData
* @param duration
*/
void onNewSegment(long programId, int sequence, InputStream segmentData, Double duration);
void onComplete(long primaryId);
}
| [
"brad@mcevoysoftware.co.nz"
] | brad@mcevoysoftware.co.nz |
5b48d561550be1521b35f6defdc6473b8427f6c6 | 450d83ef4bb16efba576811627e40fe8515e6686 | /src/sample/Suit.java | 2a76111755b14f469de69ee4e43ae5ee429af560 | [] | no_license | renekton97/snops | 9b5c52ee1b5488c25bce89d916446f8ae91f7417 | ee43cb6b67039eef20396ce870c246b2f425e686 | refs/heads/master | 2021-09-04T02:46:48.675257 | 2018-01-02T22:34:59 | 2018-01-02T22:34:59 | 115,845,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package sample;
public enum Suit {
ZELOD("Zelod"),
TIKEV("Tikev"),
SRCE("Srce"),
ZELJE("Zelje");
private final String suitText;
Suit(String suitText){
this.suitText=suitText;
}
public String getSuitText() {
return suitText;
}
}
| [
"rene.podnevar97@gmail.com"
] | rene.podnevar97@gmail.com |
6eaca997b90b315370200a9bb2545512ab4d959e | 2445f8b8f1acac7dfcc8fc51e0c3769958813aa2 | /array_packing/array_packing.java | 926e2c699859672c56daad1e994af0c0537e346d | [] | no_license | qinjker/codefights | 6ed992d7f7ddadd3bd0a6c55290efd86aec823c2 | 2516bd03e9f980c3561c8e9e5fa2375dce5e78ef | refs/heads/master | 2022-11-15T02:30:30.844734 | 2020-07-15T21:11:14 | 2020-07-15T21:11:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | // https://app.codesignal.com/challenge/7YX8Fcyhxo62wBXoM
int arrayPacking(int[] a) {
StringBuilder sb = new StringBuilder();
for(int j=a.length-1; j >= 0; j--) {
String b = String.format("%8s", Integer.toBinaryString(a[j])).replace(' ', '0');
sb.append(b);
}
return Integer.parseInt(sb.toString(), 2);
}
| [
"unabl4@gmail.com"
] | unabl4@gmail.com |
0801da8e40786ac36d09ae1277a3f12997264c75 | 20b6cae472498845ef514d373de2315924e2c83c | /out/production/method_program/by/bsu/collection/itercomp/_temp01/SortedById.jav | dd3e6ffa5105cc0faf44b55fc500778f1d0579c0 | [] | no_license | azuzugonzales/method_program | cea4a1ca4096d918de58db8118d8c79bd5464d4a | 7a18f79ab69a82d7b75d4f77bbc875c432aab5dd | refs/heads/master | 2021-06-12T03:46:48.537478 | 2021-02-22T22:50:17 | 2021-02-22T22:50:17 | 55,504,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | jav | package by.bsu.collection.enumcomp;
import java.util.Comparator;
import by.bsu.collection._itemorder.itemenum.ItemEnum;
class SortedById implements Comparator<ItemEnum>{
private ItemEnum sortingIndex;
public int compare(ItemEnum id1, ItemEnum id2){
switch(sortingIndex){
case ITEM_ID:
return id1 - id2;
case PRICE:
return compare(id2 - id1);
case NAME:
return id1.compareTo(id2);
default:
throw new EnumConstantNotPresentException(ItemEnum.class, sortingIndex.name());
}
}
}
| [
"slipknot_13@mail.ru"
] | slipknot_13@mail.ru |
812b9b9403270089ece5a287a5e6399b9937505e | 8e94005abdd35f998929b74c19a86b7203c3dbbc | /src/interval/Interval.java | 3dff3d2e0ef2e8e6a5baace5d5698f59baba6a6b | [] | no_license | tinapgaara/leetcode | d1ced120da9ca74bfc1712c4f0c5541ec12cf980 | 8a93346e7476183ecc96065062da8585018b5a5b | refs/heads/master | 2020-12-11T09:41:39.468895 | 2018-04-24T07:15:27 | 2018-04-24T07:15:27 | 43,688,533 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package interval;
/**
* Created by yingtan on 9/23/15.
*/
public class Interval {
public int start;
public int end;
public Interval() { start = 0; end = 0; }
public Interval(int s, int e) { start = s; end = e; }
}
| [
"yt2443@columbia.edu"
] | yt2443@columbia.edu |
0a526410fe60bf8ea4b24acc42238b3ea591b1eb | 68a0559a5421261a9ae10dbfdd94a12747e3c0a6 | /src/main/java/dp/leetcode42/Solution.java | 118bc248bc140c25e400525c0697065e374746b3 | [] | no_license | ccyyss66/Leetcode | e98679899a61148c50393da2af98667cb1778d42 | eff24daf39d56633d1128de18491f4319c104e39 | refs/heads/master | 2020-12-02T03:46:42.355917 | 2020-02-12T07:34:12 | 2020-02-12T07:34:12 | 230,877,451 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,588 | java | package main.java.dp.leetcode42;
/**
* 接雨水,一定要想到如何解题
*/
public class Solution {
public int trap1(int[] height) {
int sum = 0;
int max_left = 0;
int[] max_right = new int[height.length];
for (int i = height.length - 2; i >= 0; i--) {
max_right[i] = Math.max(max_right[i + 1], height[i + 1]);
}
for (int i = 1; i < height.length - 1; i++) {
max_left = Math.max(max_left, height[i - 1]);
int min = Math.min(max_left, max_right[i]);
if (min > height[i]) {
sum = sum + (min - height[i]);
}
}
return sum;
}
public int trap2(int[] height){
int sum = 0;
int max_left =0;
int max_right = 0;
int left = 1;
int right = height.length - 2;
for (int i=1;i<height.length - 1;i++){
if (height[left - 1]<height[right +1]){
max_left = Math.max(max_left, height[left - 1]);
if (height[left] < max_left){
sum +=max_left - height[left];
}
left++;
}else {
max_right = Math.max(max_right, height[right + 1]);
if (height[right] < max_right){
sum +=max_right - height[right];
}
right--;
}
}
return sum;
}
public static void main(String[] args) {
int[] s = {5,4,1,2};
Solution solution = new Solution();
solution.trap2(s);
}
}
| [
"21951032@zju.cst.cn"
] | 21951032@zju.cst.cn |
3104beaf97ad317874fd1d0b5abc5db52da2cdf9 | 498b24bdf7f4ceeb2333a76f9c1e205f6a5227c9 | /src/manager/DateManager.java | f0831acf53fb2a381bd5e1b7c452c0a1d4d00a62 | [] | no_license | valenkim/jjn | ecdea33981750b33ef75e6ee9d97b352e0fb04b1 | b8e3be07bb7557f4d6152f28e23076296687aa11 | refs/heads/master | 2021-01-13T01:30:18.352476 | 2013-12-18T13:58:29 | 2013-12-18T13:58:29 | null | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,917 | java | package manager;
import java.io.IOException;
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import entity.TravelInfo;
public class DateManager extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Calendar startCal = Calendar.getInstance();
Calendar endCal = Calendar.getInstance();
String startDate = request.getParameter("startDate");
String endDate = request.getParameter("endDate");
//나중에 프린트할때 month+1 해줘야함
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
try {
startCal.setTime(sdf.parse(startDate));
endCal.setTime(sdf.parse(endDate));
} catch (ParseException e) {
System.out.println("이상한 문자열");
e.printStackTrace();
}
TravelInfo travel = new TravelInfo();
java.sql.Date s = new java.sql.Date(startCal.getTimeInMillis());
java.sql.Date e = new java.sql.Date(endCal.getTimeInMillis());
if(travel.saveDate(s, e)) {
response.setCharacterEncoding("utf-8");
System.out.println("날짜를 선택하였습니다.");
}
ServletContext context = request.getSession().getServletContext();
RequestDispatcher rd = context.getRequestDispatcher("/SelectToDoView.jsp");
rd.forward(request, response);
}
private void showCalendar(Calendar cal) {
// TODO Auto-generated method stub
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
| [
"9-4-2-8@hanmail.net"
] | 9-4-2-8@hanmail.net |
a409e2bdc78e69e9d7caf38e605ff5b6d2376627 | 6b27f17daa8ba1477acd6fe687410827c902aaab | /Lab 05/05_CacheRedis/src/br/com/fiap/service/IProdutoService.java | 5f9378244fc79adee94ef3458eee7493fd17dcee | [] | no_license | rornellas/FIAP-2019-SCJ-JavaPersistence | 975805ba323caf1102386632f6cb28885e415944 | b3dffc5c4906059919313716824c41546063a4fe | refs/heads/master | 2020-09-19T21:32:40.692348 | 2019-11-27T01:38:32 | 2019-11-27T01:38:32 | 224,303,065 | 0 | 0 | null | 2019-11-26T23:14:31 | 2019-11-26T23:14:30 | null | UTF-8 | Java | false | false | 373 | java | package br.com.fiap.service;
import java.util.List;
import br.com.fiap.entity.Produto;
public interface IProdutoService {
List<Produto> getAllProdutos();
Produto getProdutoById(long id);
Produto addProduto(Produto produto);
Produto updateProduto(Produto produto);
void deleteProduto(long id);
List<Produto> getProdutosByTipo(Integer tipo);
}
| [
"logonaluno@local.com"
] | logonaluno@local.com |
089b446c1ae9acdcffa267353a323ab66ef749b7 | 07da64226ca425b436080ed7bb09a4450faad815 | /src/testes/NovoClass5.java | e07339c26482fa33263a014a86772da041f38fe2 | [] | no_license | TsplayerT/Projetos | 6f9271fcdd36ac75c890e429f2e69c89641fb9f2 | 07320b13af95dda4159e0005a7b5739c7a7c7f2b | refs/heads/master | 2021-01-20T18:15:48.690277 | 2018-02-22T18:33:43 | 2018-02-22T18:33:43 | 90,916,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,392 | java | package testes;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener;
import org.jnativehook.mouse.NativeMouseEvent;
import org.jnativehook.mouse.NativeMouseListener;
public class NovoClass5 implements NativeKeyListener, NativeMouseListener {
public static void main(String[] args) {
try {
GlobalScreen.registerNativeHook();
} catch (Exception e) {
e.printStackTrace();
}
GlobalScreen.addNativeKeyListener(new NovoClass5());
GlobalScreen.addNativeMouseListener(new NovoClass5());
}
boolean clicar;
boolean teclou;
Date data = new Date();
SimpleDateFormat fd = new SimpleDateFormat("dd-MM-yyyy");
String fdd = fd.format(data);
Date hora = new Date();
SimpleDateFormat fh = new SimpleDateFormat("HH:mm:ss");
String fhh = fh.format(hora);
public void nativeKeyPressed(NativeKeyEvent nke) {
String dados = NativeKeyEvent.getKeyText(nke.getKeyCode());
try (BufferedWriter arquivo = new BufferedWriter(new FileWriter(fdd + ".txt", true))) {
if (clicar == true||teclou==true) {
}
//TIRAR ISSO AQUI EM BAIXO DEPOIS//
if (nke.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
try {
//System.exit(1);
GlobalScreen.unregisterNativeHook();
//TIRAR ISSO AQUI EM CIMA DEPOIS//
} catch (NativeHookException ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
} else if (nke.getKeyCode() == NativeKeyEvent.VC_ENTER) {
arquivo.newLine();
} else if (nke.getKeyCode() == NativeKeyEvent.VC_CAPS_LOCK) {
} else if (nke.getKeyCode() == NativeKeyEvent.VC_SPACE) {
arquivo.write(" ");
} else if (true) {
arquivo.write(dados);
arquivo.flush();
teclou = false;
}
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
}
@Override
public void nativeKeyReleased(NativeKeyEvent nke) {
}
@Override
public void nativeKeyTyped(NativeKeyEvent nke) {
}
////////----------- MOUSE -----------////////
public void nativeMouseClicked(NativeMouseEvent nme) {
try{
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(fdd+".txt")));
writer.newLine();
writer.write(fhh);
writer.newLine();
writer.flush();
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
clicar = true;
}
@Override
public void nativeMousePressed(NativeMouseEvent nme) {
}
@Override
public void nativeMouseReleased(NativeMouseEvent nme) {
}
}
| [
"21048380s"
] | 21048380s |
6a372d849845cdb4d80538b4962cae66fb143247 | ef23d244414b2ba70ded3d0621881d0ec47c7cb1 | /src/main/java/com/example/secondmaildemo/MailConfig.java | 8373e86e5ac3f4be973335ef42fecceb9721ca67 | [] | no_license | MahdiDroid/emailwithpdfattachment | 11b3038130f14b651b09523847baebc37481ecf6 | bbc64a17fd4d5463c5b2150294390e5681c8e2b6 | refs/heads/master | 2021-05-18T19:53:13.527751 | 2020-04-06T07:07:41 | 2020-04-06T07:07:41 | 251,389,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.example.secondmaildemo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class MailConfig {
@Value("${Spring.mail.host}")
private String host;
@Value("${Spring.mail.port}")
private int port;
@Value("${Spring.mail.username}")
private String username;
@Value("${Spring.mail.password}")
private String password;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"mehdi.mhmvd@gmail.com"
] | mehdi.mhmvd@gmail.com |
e7a740a6b686a060f53efc4915ba81d2a259ef09 | e951240dae6e67ee10822de767216c5b51761bcb | /src/main/java/algorithms/leetcode/leetcode_20181226/linkedlist/LC_83_Remove_Duplicates_from_Sorted_List.java | 4f83617254cbf3244e0d2ad4738d311aa2137cc8 | [] | no_license | fengjiny/practice | b1315ca8800ba25b5d6fed64b0d68d870d84d1bb | 898e635967f3387dc870c1ee53a95ba8a37d5e37 | refs/heads/master | 2021-06-03T09:20:35.904702 | 2020-10-26T10:45:03 | 2020-10-26T10:45:03 | 131,289,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package algorithms.leetcode.leetcode_20181226.linkedlist;
public class LC_83_Remove_Duplicates_from_Sorted_List {
public ListNode deleteDuplicates(ListNode head) {
if (head == null || head.next == null) return head;
head.next = deleteDuplicates(head.next);
return head.val == head.next.val ? head.next : head;
}
public ListNode deleteDuplicates_(ListNode head) {
ListNode cur = head;
while (cur != null && cur.next != null) {
if (cur.val == cur.next.val) {
cur.next = cur.next.next;
} else {
cur = cur.next;
}
}
return head;
}
}
| [
"fengjinyu@mobike.com"
] | fengjinyu@mobike.com |
aaa879e2329c3a1674b02e92d4cbd9e53c1cecbb | af2bb973a85190cfa1a294510a3f066c2697437b | /Android/src/com/MAVLink/common/msg_sim_state.java | fb05c27715988987618d5e7255997bccd1cc3cbd | [] | no_license | bfYSKUY/Amobbs-Android-GCS | 5ca29dec24cb2dd7e725d0512cfcf9c595f8469f | 9355111b655a8059f1db3c515bd7d972a0a1d085 | refs/heads/master | 2022-10-13T16:02:57.879913 | 2020-06-12T05:51:21 | 2020-06-12T05:51:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,979 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* java mavlink generator tool. It should not be modified by hand.
*/
// MESSAGE SIM_STATE PACKING
package com.MAVLink.common;
import com.MAVLink.MAVLinkPacket;
import com.MAVLink.Messages.MAVLinkMessage;
import com.MAVLink.Messages.MAVLinkPayload;
/**
* Status of simulation environment, if used
*/
public class msg_sim_state extends MAVLinkMessage {
public static final int MAVLINK_MSG_ID_SIM_STATE = 108;
public static final int MAVLINK_MSG_LENGTH = 84;
private static final long serialVersionUID = MAVLINK_MSG_ID_SIM_STATE;
/**
* True attitude quaternion component 1, w (1 in null-rotation)
*/
public float q1;
/**
* True attitude quaternion component 2, x (0 in null-rotation)
*/
public float q2;
/**
* True attitude quaternion component 3, y (0 in null-rotation)
*/
public float q3;
/**
* True attitude quaternion component 4, z (0 in null-rotation)
*/
public float q4;
/**
* Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
*/
public float roll;
/**
* Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
*/
public float pitch;
/**
* Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
*/
public float yaw;
/**
* X acceleration m/s/s
*/
public float xacc;
/**
* Y acceleration m/s/s
*/
public float yacc;
/**
* Z acceleration m/s/s
*/
public float zacc;
/**
* Angular speed around X axis rad/s
*/
public float xgyro;
/**
* Angular speed around Y axis rad/s
*/
public float ygyro;
/**
* Angular speed around Z axis rad/s
*/
public float zgyro;
/**
* Latitude in degrees
*/
public float lat;
/**
* Longitude in degrees
*/
public float lon;
/**
* Altitude in meters
*/
public float alt;
/**
* Horizontal position standard deviation
*/
public float std_dev_horz;
/**
* Vertical position standard deviation
*/
public float std_dev_vert;
/**
* True velocity in m/s in NORTH direction in earth-fixed NED frame
*/
public float vn;
/**
* True velocity in m/s in EAST direction in earth-fixed NED frame
*/
public float ve;
/**
* True velocity in m/s in DOWN direction in earth-fixed NED frame
*/
public float vd;
/**
* Constructor for a new message, just initializes the msgid
*/
public msg_sim_state() {
msgid = MAVLINK_MSG_ID_SIM_STATE;
}
/**
* Constructor for a new message, initializes the message with the payload
* from a mavlink packet
*/
public msg_sim_state(MAVLinkPacket mavLinkPacket) {
this.sysid = mavLinkPacket.sysid;
this.compid = mavLinkPacket.compid;
this.msgid = MAVLINK_MSG_ID_SIM_STATE;
unpack(mavLinkPacket.payload);
}
/**
* Generates the payload for a mavlink message for a message of this type
*
* @return
*/
public MAVLinkPacket pack() {
MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH);
packet.sysid = 255;
packet.compid = 190;
packet.msgid = MAVLINK_MSG_ID_SIM_STATE;
packet.payload.putFloat(q1);
packet.payload.putFloat(q2);
packet.payload.putFloat(q3);
packet.payload.putFloat(q4);
packet.payload.putFloat(roll);
packet.payload.putFloat(pitch);
packet.payload.putFloat(yaw);
packet.payload.putFloat(xacc);
packet.payload.putFloat(yacc);
packet.payload.putFloat(zacc);
packet.payload.putFloat(xgyro);
packet.payload.putFloat(ygyro);
packet.payload.putFloat(zgyro);
packet.payload.putFloat(lat);
packet.payload.putFloat(lon);
packet.payload.putFloat(alt);
packet.payload.putFloat(std_dev_horz);
packet.payload.putFloat(std_dev_vert);
packet.payload.putFloat(vn);
packet.payload.putFloat(ve);
packet.payload.putFloat(vd);
return packet;
}
/**
* Decode a sim_state message into this class fields
*
* @param payload The message to decode
*/
public void unpack(MAVLinkPayload payload) {
payload.resetIndex();
this.q1 = payload.getFloat();
this.q2 = payload.getFloat();
this.q3 = payload.getFloat();
this.q4 = payload.getFloat();
this.roll = payload.getFloat();
this.pitch = payload.getFloat();
this.yaw = payload.getFloat();
this.xacc = payload.getFloat();
this.yacc = payload.getFloat();
this.zacc = payload.getFloat();
this.xgyro = payload.getFloat();
this.ygyro = payload.getFloat();
this.zgyro = payload.getFloat();
this.lat = payload.getFloat();
this.lon = payload.getFloat();
this.alt = payload.getFloat();
this.std_dev_horz = payload.getFloat();
this.std_dev_vert = payload.getFloat();
this.vn = payload.getFloat();
this.ve = payload.getFloat();
this.vd = payload.getFloat();
}
/**
* Returns a string with the MSG name and data
*/
public String toString() {
return "MAVLINK_MSG_ID_SIM_STATE -" + " q1:" + q1 + " q2:" + q2 + " q3:" + q3 + " q4:" + q4 + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " lat:" + lat + " lon:" + lon + " alt:" + alt + " std_dev_horz:" + std_dev_horz + " std_dev_vert:" + std_dev_vert + " vn:" + vn + " ve:" + ve + " vd:" + vd + "";
}
}
| [
"zhaoyanjie@163.com"
] | zhaoyanjie@163.com |
d32718f779ab6cbe92dd6f8d52e47d453cd6dd6d | db913c82275c97acf94c7179e9172a2ebaf0b435 | /LoginRegistrationNew/src/com/d/LoginServlet.java | 0cb50a55ced4abd00d6647a84892f3b6db638a5d | [] | no_license | krn010/Login-Registration | b0fac20edd2ea62f2e4fe2a9d33e46977adf76aa | 2fa998be2e9701a53fbd63451eaff9e300e1141c | refs/heads/master | 2021-07-15T21:28:00.851990 | 2017-10-24T13:44:55 | 2017-10-24T13:44:55 | 108,131,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,216 | java | package com.d;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
PreparedStatement pst = null;
Connection conection=null;
String uemail,pass;
String query="SELECT EmailId,Password FROM details where EmailId=? AND Password=?";
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter writer = response.getWriter();
///ResultSet rs = null;
//boolean flag;
uemail = request.getParameter("email");
pass = request.getParameter("pass");
try {
conection = Dbutil.getConnection();
System.out.println(conection);
pst = conection.prepareStatement(query);
pst.setString(1, uemail);
pst.setString(2, pass);
ResultSet rs = pst.executeQuery();
//System.out.println(rs);
if(rs.next()) {
HttpSession session = request.getSession();
session.setAttribute("semail", uemail);
System.out.println("Logged in Successfully!!");
/*RequestDispatcher rd = request.getRequestDispatcher("LoginJSP.jsp");
rd.include(request, response);*/
response.sendRedirect("/LoginRegistrationNew/Welcome");
}
else
{
response.setContentType("text/html");
writer.print("<script>alert('Login failed! try again');</script>");
RequestDispatcher rd = request.getRequestDispatcher("/index.html");
rd.include(request, response);
}
}
catch (SQLException e) {
System.out.println(e);
}
finally {
if(pst!=null) {
try {
pst.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if(conection!=null) {
try {
conection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
| [
"subbufrom@gmail.com"
] | subbufrom@gmail.com |
eb1a0efac63da206bc2497f37cdc486ccf37acc5 | 83f0a1c7eca7a3e69cacf936ea2290f58a0b1c1b | /delivery_microservices/delivery_microservices/src/main/java/com/nagarro/nagpAssignment/delivery_microservices/controller/DeliveryProcessor.java | fe01884c30c5b09d39eb6d6eaad7531cdf262434 | [] | no_license | ParushaSingla/ParushaSingla-NagpAssignmentForTesting- | 5ac3911505c89ffe1725057dc9146dd576ef41f8 | 9dc11a2b660a9c4f8c47c37a328cf322992f8a25 | refs/heads/master | 2021-01-04T02:06:58.140177 | 2020-02-14T14:49:05 | 2020-02-14T14:49:05 | 240,336,242 | 0 | 1 | null | 2020-02-15T09:31:32 | 2020-02-13T18:49:45 | Java | UTF-8 | Java | false | false | 692 | java | package com.nagarro.nagpAssignment.delivery_microservices.controller;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.stereotype.Component;
@Component
public interface DeliveryProcessor {
String PAYMENT_DONE = "paymentDone";
String DELIVERED_OUT = "delivered";
String UNDELIVERED_OUT = "undelivered";
@Input(PAYMENT_DONE)
SubscribableChannel sourceOfOrderItem();
@Output(DELIVERED_OUT)
MessageChannel delivered();
@Output(UNDELIVERED_OUT)
MessageChannel undelivered();
}
| [
"parusha.singla@nagarro.com"
] | parusha.singla@nagarro.com |
a18b59c6749b3ba82cf384ec9751103bec52a9cc | 048194e9acff2529feaf4024d3708ed947def20c | /src/main/java/com/beershop/domain/Authority.java | fb1375486b3ae645b3b585338d043aebec7ae7de | [] | no_license | rogozinds/alcofree-shop | 37810390a5eafbbb2f6f99ef231764da2b9e3353 | 2805b6bf7a5cd79d5d5691c8971686fe6e300226 | refs/heads/master | 2023-01-01T20:16:46.541931 | 2020-03-01T15:08:01 | 2020-03-01T15:08:01 | 246,051,484 | 0 | 0 | null | 2022-12-16T04:42:45 | 2020-03-09T14:03:25 | Java | UTF-8 | Java | false | false | 1,373 | java | package com.beershop.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Objects;
/**
* An authority (a security role) used by Spring Security.
*/
@Entity
@Table(name = "jhi_authority")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Authority implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@Size(max = 50)
@Id
@Column(length = 50)
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Authority)) {
return false;
}
return Objects.equals(name, ((Authority) o).name);
}
@Override
public int hashCode() {
return Objects.hashCode(name);
}
@Override
public String toString() {
return "Authority{" +
"name='" + name + '\'' +
"}";
}
}
| [
"rogozin@amazon.com"
] | rogozin@amazon.com |
079122376b38aaf97086f8fe6f21cda799ae0559 | 64e16d94b61037ef62903faef3626e0d3bd43dbc | /src/problemsolving/smallestDiff.java | a0ca6bb5fb8056a09fd6dba5e6b50e9117f2cd06 | [] | no_license | soniyadoshi/JavaPrep | 78335a37934c07c393a8442e442d4b56e3fc5ec3 | 22538cff0f38d4b123d685a270bbb0a8d37b003b | refs/heads/master | 2023-03-25T07:21:07.986338 | 2021-03-26T15:20:03 | 2021-03-26T15:20:03 | 278,877,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package problemsolving;
/*
* Find the two elements that have the smallest difference in a given array
* */
public class smallestDiff {
public static void main(String args[]) {
int arr[] = {2, 12, 4, 6, 8, 7};
int k = findSmallest(arr);
System.out.println(k);
}
public static int findSmallest(int arr[]) {
int res = Integer.MAX_VALUE;
int a = arr[0];
for (int i=1; i<arr.length; i++) {
int diff = Math.abs(a - arr[i]);
System.out.println("diff " + diff);
if (diff < res) {
res = diff;
}
a = arr[i];
}
return res;
}
}
| [
"nikamsoniya@gmail.com"
] | nikamsoniya@gmail.com |
4d7c06758adde904d40f51c62ca18bd93001caea | 8bc47976dc44baaffbbe3a730f1e8ef8485f41a3 | /threedollar-domain/src/main/java/com/depromeet/threedollar/domain/domain/storedelete/repository/StoreDeleteRequestRepositoryCustomImpl.java | 49c877eac73549a8584ad409d55fb02caae144b3 | [] | no_license | eunbeeLee/3dollars-in-my-pocket-backend | 2da367b983febc3fbb8862818edf2c72ee3604b7 | 1240f8d5d80e282f043793d110985281b526b12d | refs/heads/main | 2023-08-25T15:41:46.861818 | 2021-10-21T15:20:04 | 2021-10-21T15:20:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 912 | java | package com.depromeet.threedollar.domain.domain.storedelete.repository;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import javax.persistence.LockModeType;
import java.util.List;
import static com.depromeet.threedollar.domain.domain.storedelete.QStoreDeleteRequest.storeDeleteRequest;
@RequiredArgsConstructor
public class StoreDeleteRequestRepositoryCustomImpl implements StoreDeleteRequestRepositoryCustom {
private final JPAQueryFactory queryFactory;
@Override
public List<Long> findAllUserIdByStoreIdWithLock(Long storeId) {
return queryFactory.select(storeDeleteRequest.userId)
.setLockMode(LockModeType.PESSIMISTIC_WRITE)
.setHint("javax.persistence.lock.timeout", 2000)
.from(storeDeleteRequest)
.where(
storeDeleteRequest.storeId.eq(storeId)
).fetch();
}
}
| [
"will.seungho@gmail.com"
] | will.seungho@gmail.com |
8c16f4842ac578a45553e7282837e7d7ab100918 | 0e1f57dc524b751db1ec18769a1ad851028e6b70 | /ireading/src/main/java/org/iii/eeit9503/ireading/controller/member/PassordResetController.java | 4c5432b003f56228123def71caccc4ed89d036b8 | [] | no_license | EEIT95Team03/ireading | 693429255a307fb967cb3fad56bd5e78f73f381b | 4ee96859e8c9e22a0d9e2cf9e757189b8aa01631 | refs/heads/master | 2021-01-01T17:49:00.776557 | 2017-08-24T08:50:56 | 2017-08-24T08:50:56 | 98,163,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,207 | java | package org.iii.eeit9503.ireading.controller.member;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Base64;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.iii.eeit9503.ireading.member.bean.MemberBean;
import org.iii.eeit9503.ireading.member.model.MemberService;
import org.iii.eeit9503.ireading.misc.CookieUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.SystemPropertyUtils;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/resetPwd.controller")
public class PassordResetController {
@Autowired
private JavaMailSender mailSender;
@Autowired
private MemberService memberService;
@RequestMapping(method=RequestMethod.POST,produces = { "application/json;charset=utf8" })
@ResponseBody
public String process(@RequestParam(name="recipient") String address,
@RequestHeader(value = "referer", required = false) final String referer
, HttpServletRequest request){
JSONArray array = new JSONArray();
JSONObject obj = new JSONObject();
if(memberService.selectByAccount(address)==null){
obj.put("noaccount", "noaccount");
array.put(obj);
return array.toString();
}
String subject = "享。閱-密碼重設通知信";
String message=null;
try {
message = "親愛的享閱會員您好\n\n\t請按下列連結重設您的密碼\n\n\t" + new URL("http://" + request.getServerName() + ":8080" + request.getContextPath()
+ "/user/resetPwd.controller/urlReset?account=" + address)
+ "\n\n\t\t\t\t享。閱團隊 祝 日安";
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
// prints debug info
System.out.println("To: " + address);
System.out.println("Subject: " + subject);
System.out.println("Message: " + message);
SimpleMailMessage email = new SimpleMailMessage();
email.setTo(address);
email.setSubject(subject);
email.setText(message);
try {
obj.put("mailResult", "success");
mailSender.send(email);
} catch (MailException e) {
obj.put("mailResult", "failed");
e.printStackTrace();
}
array.put(obj);
return array.toString();
}
@RequestMapping(value="/urlReset",method=RequestMethod.GET)
public String processReset(Model model, @RequestParam(name="account") String account){
MemberBean bean = memberService.selectByAccount(account);
String page = null;
if(bean!=null){
model.addAttribute("account", account);
page = "pwdResetPage";
}
return page;
}
@RequestMapping(value="/pwdReset",method=RequestMethod.POST)
public String processResetPwd(@RequestParam(name="pwd") String pwd, @RequestParam(name="account") String account
, @RequestParam(name="confirmpwd", required=false) String confirmpwd
, HttpServletResponse response){
MemberBean bean = memberService.selectByAccount(account);
if(bean!=null){
bean.setPwd(pwd);
memberService.update(bean);
try {
CookieUtils.addCookie(response, "login_id", bean.getMemberID());
CookieUtils.addCookie(response, "login_account",account);
if(bean.getMName()!=null || bean.getMName().trim().length()>0){
CookieUtils.addCookie(response, "login_name", bean.getMName());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return "reset.Redirect";
}
}
| [
"veterhsu@gmail.com"
] | veterhsu@gmail.com |
38f5b19fca29ff639afcbead3cd5f22fb1c18268 | 409b946b66694541d32c60fdab888401f2bd4f3e | /MapHap/app/src/androidTest/java/com/example/olivi/maphap/utils/MilesBetweenPointsTest.java | 84fb830142a5522a95159a2756fad49f58469b1a | [] | no_license | deepakgarg0802/capstone-project | 398ef318b2f479481177ca4c097ebc2572140080 | 40209bf73199e9aba2f21631e1746d6d1f3e02a6 | refs/heads/master | 2021-01-19T09:14:52.373824 | 2016-02-02T03:56:14 | 2016-02-02T03:56:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,380 | java | package com.example.olivi.maphap.utils;
import com.google.android.gms.maps.model.LatLng;
import junit.framework.TestCase;
/**
* Created by olivi on 12/14/2015.
*/
public class MilesBetweenPointsTest extends TestCase{
protected LatLng vanKleef;
protected LatLng somar;
protected LatLng home;
protected LatLng cornerStore;
protected void setUp() {
vanKleef = new LatLng(37.806550, -122.270497);
somar = new LatLng(37.807343, -122.270330);
home = new LatLng(37.808237, -122.286235);
cornerStore = new LatLng(37.809695, -122.285881);
}
public void testMethod() {
double miles = LocationUtils.milesBetweenTwoPoints(vanKleef.latitude, vanKleef.longitude,
somar.latitude, somar.longitude);
assertTrue(miles <= 0.25);
double dist = LocationUtils.milesBetweenTwoPoints(home.latitude, home.longitude,
cornerStore.latitude, cornerStore.longitude);
assertTrue(dist <= 0.25);
double miles2 = LocationUtils.milesBetweenTwoPoints(vanKleef.latitude, vanKleef.longitude,
home.latitude, home.longitude);
assertFalse(miles2 <= 0.25);
double dist2 = LocationUtils.milesBetweenTwoPoints(somar.latitude, somar.longitude,
cornerStore.latitude, cornerStore.longitude);
assertFalse(dist2 <= 0.25);
}
} | [
"oliviadodge@gmail.com"
] | oliviadodge@gmail.com |
9b852680ddb70e5b9489664c876a4ee51f5480aa | 541298b7b5299c8d3c1186c77e7e5d1391951a4a | /bit/SpringTest/bitTest/src/com/bit/vo/BookVo.java | 819428e7cb48c2ec8c369f307e03402ccd26ad70 | [] | no_license | ldh85246/Rong | ec055f4522a1023343abaac47e6506348ddeac04 | f176327d20324f1ad01a2019305b60aca313e101 | refs/heads/master | 2022-10-04T11:28:20.854497 | 2020-09-15T10:56:12 | 2020-09-15T10:56:12 | 211,037,350 | 0 | 1 | null | 2022-09-01T23:31:54 | 2019-09-26T08:19:33 | Java | UTF-8 | Java | false | false | 287 | java | package com.bit.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BookVo {
private int bookid;
private String bookname;
private String publisher;
private int price;
}
| [
"go85246@hanmail.net"
] | go85246@hanmail.net |
5a6870748dd85b06c6a6d5a336ab56a7736e102a | 40a656f258db9bc01b836468536e26c021441c50 | /src/main/java/com/rmkj/microcap/modules/user/entity/User.java | bdfcf8364ad7768ab47541004d3ddcfcd128e28e | [] | no_license | 1447915253/jiangsu | 8d0bd99325ce36548567917c9e210a5894cec878 | aa94893bff333c4b077106ae5128b927df9032ed | refs/heads/master | 2021-05-14T10:49:51.239787 | 2018-01-05T09:56:08 | 2018-01-05T09:56:36 | 116,363,339 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,867 | java | package com.rmkj.microcap.modules.user.entity;
import com.rmkj.microcap.common.bean.DataEntity;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
/**
* Created by 123 on 2016/10/12.
*/
public class User extends DataEntity{
private BigInteger autoId;
private String openId;
private String wechatPublicId;
private String userHeader;
private String chnName;
private String mobile;
private String tradePassword;
private BigDecimal money;
private BigDecimal rechargeMoney;
private String tradeCount;
private BigDecimal couponMoney;
private BigDecimal outMoney;
private String agentInviteCode;
private Integer status;
private Date registerTime;
private Date lastLoginTime;
private String lastLoginIp;
private String parent1Id;
private String parent2Id;
private String parent3Id;
private BigDecimal returnMoney;
private BigDecimal returnMoneyTotal;
private String idCard;
private String corpsType;
private String ticketWechatPublicId;
private String ticket;
private Date ticketExpireTime;
private String token;
public BigInteger getAutoId() {
return autoId;
}
public void setAutoId(BigInteger autoId) {
this.autoId = autoId;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getWechatPublicId() {
return wechatPublicId;
}
public void setWechatPublicId(String wechatPublicId) {
this.wechatPublicId = wechatPublicId;
}
public String getUserHeader() {
return userHeader;
}
public void setUserHeader(String userHeader) {
this.userHeader = userHeader;
}
public String getChnName() {
return chnName;
}
public void setChnName(String chnName) {
this.chnName = chnName;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getTradePassword() {
return tradePassword;
}
public void setTradePassword(String tradePassword) {
this.tradePassword = tradePassword;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public BigDecimal getMoney() {
return money;
}
public void setMoney(BigDecimal money) {
this.money = money;
}
public BigDecimal getRechargeMoney() {
return rechargeMoney;
}
public void setRechargeMoney(BigDecimal rechargeMoney) {
this.rechargeMoney = rechargeMoney;
}
public String getTradeCount() {
return tradeCount;
}
public void setTradeCount(String tradeCount) {
this.tradeCount = tradeCount;
}
public BigDecimal getCouponMoney() {
return couponMoney;
}
public void setCouponMoney(BigDecimal couponMoney) {
this.couponMoney = couponMoney;
}
public BigDecimal getOutMoney() {
return outMoney;
}
public void setOutMoney(BigDecimal outMoney) {
this.outMoney = outMoney;
}
public String getAgentInviteCode() {
return agentInviteCode;
}
public void setAgentInviteCode(String agentInviteCode) {
this.agentInviteCode = agentInviteCode;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getRegisterTime() {
return registerTime;
}
public void setRegisterTime(Date registerTime) {
this.registerTime = registerTime;
}
public Date getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(Date lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public String getLastLoginIp() {
return lastLoginIp;
}
public void setLastLoginIp(String lastLoginIp) {
this.lastLoginIp = lastLoginIp;
}
public String getParent1Id() {
return parent1Id;
}
public void setParent1Id(String parent1Id) {
this.parent1Id = parent1Id;
}
public String getParent2Id() {
return parent2Id;
}
public void setParent2Id(String parent2Id) {
this.parent2Id = parent2Id;
}
public String getParent3Id() {
return parent3Id;
}
public void setParent3Id(String parent3Id) {
this.parent3Id = parent3Id;
}
public BigDecimal getReturnMoney() {
return returnMoney;
}
public void setReturnMoney(BigDecimal returnMoney) {
this.returnMoney = returnMoney;
}
public BigDecimal getReturnMoneyTotal() {
return returnMoneyTotal;
}
public void setReturnMoneyTotal(BigDecimal returnMoneyTotal) {
this.returnMoneyTotal = returnMoneyTotal;
}
public String getCorpsType() {
return corpsType;
}
public void setCorpsType(String corpsType) {
this.corpsType = corpsType;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public String getTicket() {
return ticket;
}
public void setTicket(String ticket) {
this.ticket = ticket;
}
public String getTicketWechatPublicId() {
return ticketWechatPublicId;
}
public void setTicketWechatPublicId(String ticketWechatPublicId) {
this.ticketWechatPublicId = ticketWechatPublicId;
}
public Date getTicketExpireTime() {
return ticketExpireTime;
}
public void setTicketExpireTime(Date ticketExpireTime) {
this.ticketExpireTime = ticketExpireTime;
}
}
| [
"1447915253@qq.com"
] | 1447915253@qq.com |
c8a523da02a848a89c55606425ffd251282f2a74 | aad16eebae3abbc0a36f42650d83173dc498253b | /TestMicroClientApp/src/main/java/testclient/MyRestClient.java | aae926589daeb89fc887d3338b195c93a419d0d0 | [] | no_license | kamlendu/maven-project | 5cd896a2a1b158099e3e5cabcb679f4cbee1bceb | d6c4c2b437af88b0e649b16be331c5b05798ac56 | refs/heads/master | 2022-12-25T19:19:40.255292 | 2020-10-04T13:57:54 | 2020-10-04T13:57:54 | 301,140,477 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,268 | 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 testclient;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import token.GenerateToken;
/**
*
* @author root
*/
@RegisterRestClient(configKey = "myclient1")
public interface MyRestClient {
@GET
@ClientHeaderParam(name="authorization", value="{generateJWTToken}")
@Produces(MediaType.TEXT_PLAIN)
public String get();
default String generateJWTToken()
{
Config config = ConfigProvider.getConfig();
// Testing with the jwtenizer. The token generated is copied in jwt-string key
//String token ="Bearer "+config.getValue("jwt-string", String.class) ;
// Token dynamically generated
String token ="Bearer "+ GenerateToken.generateJWT();
System.out.println("Token = "+token);
return token;
}
}
| [
"kamlendup@gmail.com"
] | kamlendup@gmail.com |
72434b3925dfdcd32da8adf6bf6ee6432451f3a3 | 026f0629204404c25bb6c54b02b2b4288c3caf60 | /MyWebApp/src/main/java/trng/java/Student/StudentLoginServlet.java | a73064a0b0a5b50a030e942cfd2600bea4b5f912 | [] | no_license | ramz88/jenkins_b | a96d0b55af057cf763a056081511086becb7083f | 0e9d47ff71d32285bfacf3a14668c61df894014f | refs/heads/master | 2020-05-23T07:58:51.313896 | 2017-01-31T22:50:52 | 2017-01-31T22:50:52 | 80,480,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,838 | java | package trng.java.Student;
import java.io.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class StudentLoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public void init() throws ServletException{
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
String username = request.getParameter("username");
String password = request.getParameter("password");
String role = request.getParameter("role");
try {
String sql=null;
if (role.equalsIgnoreCase("student"))
sql = "select * from studentLogin where username = ? and password = ?";
else if (role.equalsIgnoreCase("admin"))
sql = "select * from adminLogin where username = ? and password = ?";
else if (role.equalsIgnoreCase("clerk"))
sql = "select * from clerkLogin where username = ? and password = ?";
System.out.println(sql);
System.out.println("Role"+role);
PreparedStatement pst;
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/imcs", "root", "root");
pst = con.prepareStatement(sql);
pst.setString(1, username);
pst.setString(2, password);
ResultSet rs = pst.executeQuery();
if (rs.next()) {
session.setAttribute("sUserName", username);
session.setAttribute("role", role);
printResponse(request, response);
}
else{
response.sendRedirect("/MyWebApp/login.jsp");
// PrintWriter out = response.getWriter();
// out.println("<html>");
// out.println("<head>");
// out.println("<title>Login Servlet Result</title>");
// out.println("</head>");
// out.println("<body>");
// out.println("Invalid Login Please re-enter");
// out.println("<br>");
// out.println("<a href='imp/login.jsp'>Click here to Re-Login</a>");
// out.println("</body>");
// out.println("</html>");
// out.close();
}
} catch (SQLException | ClassNotFoundException e) {
e.printStackTrace();
}
}
private void printResponse(HttpServletRequest request, HttpServletResponse response) throws IOException {
String url=null;
if(request.getParameter("role").equalsIgnoreCase("admin"))
url="/MyWebApp/Admin.jsp";
else if(request.getParameter("role").equalsIgnoreCase("clerk"))
url="/MyWebApp/clerk.jsp";
else
url="/MyWebApp/student.jsp";
response.sendRedirect(url);
// PrintWriter out = response.getWriter();
// out.println("<html>");
// out.println("<head>");
// out.println("<title>Login Servlet Result</title>");
// out.println("</head>");
// out.println("<body>");
// out.println("Welcome");
// out.println(request.getParameter("username"));
// out.println("Login Successful ");
// out.println("<br><a href='"+url+"'>Homepage</a>");
// out.println("</body>");
// out.println("</html>");
// out.close();
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request,response);
}
}
| [
"ramz@Sais-MacBoy.local"
] | ramz@Sais-MacBoy.local |
adde1f5027490522d9f238ec0ed1c5a205afc3f7 | d5baece509644445debbcdc7e5036d851abd7c8b | /CouponsProjectWithJdbc/src/main/java/coupons/daily/job/MyTimer.java | 9bae974c43a8e17e099584fc803c99b7e4a96085 | [] | no_license | lichaytiram/JohnBryceProjects | 62c16674947184cf4475edb9c4a36ff4a4863f68 | b9a0bc08dc5e803f1e2dca62ce1fbc3c937acd50 | refs/heads/master | 2021-06-22T17:50:42.583938 | 2020-11-28T00:21:23 | 2020-11-28T00:21:23 | 153,278,052 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package coupons.daily.job;
import java.util.Timer;
import java.util.TimerTask;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import coupons.exception.ApplicationException;
/**
* This class create a timer
*
* @author Lichay
*
*/
@Component
public class MyTimer {
// Creating a task
@Autowired
private TimerTask task;
/**
* This function create timer with task
*
* @throws ApplicationException This function can throw an applicationException
*/
@PostConstruct
public void createTimer() throws ApplicationException {
// Creating a timer
Timer timer = new Timer("daily job");
timer.scheduleAtFixedRate(task, 0, 1000);
System.out.println("Timer task started");
}
} | [
"lichaytiram@gmail.com"
] | lichaytiram@gmail.com |
4a75c10acdecffbcb200f4aeb14550071ac4d22f | 8c10e3b8ac5419e6ac94cd7ae727c2dc7d9772ac | /app/src/main/java/demo/lww/test/usertime/file/ReadRecordFileUtils.java | 13ab607ae08997c11dd15a186d5bcb5305eda5d9 | [] | no_license | liuwenwen-123/UserTimr | d8732408b5d06c282e2cda4056086e6e4c7a607e | e5df0f808d983ac2974f6abdd3c40e17091b54c3 | refs/heads/master | 2020-05-04T20:31:53.941258 | 2019-04-04T07:28:30 | 2019-04-04T07:28:30 | 179,441,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,088 | java | package demo.lww.test.usertime.file;
import android.util.Log;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import demo.lww.test.usertime.utils.DateTransUtils;
import demo.lww.test.usertime.utils.StringUtils;
/**
* Created by Wingbu on 2017/7/18.
*/
public class ReadRecordFileUtils {
public static final String TAG = "EventUtils";
// =======================================
// Read Files
// =======================================
public static long getRecordStartTime(String baseFilePath,long timeStamp){
return StringUtils.getTimeStampFromString(getFirstStringLines(baseFilePath, timeStamp));
}
public static long getRecordEndTime(String baseFilePath,long timeStamp){
ArrayList<String> list = getAllStringLines(baseFilePath, timeStamp);
if(list == null || list.size() < 1){
return 0;
}
Log.i(TAG,"ReadRecordFileUtils--getRecordEndTime() 以行为单位读取文件内容,读最后一行:"+list.get(list.size()-1));
if(list.get(list.size()-1) == null){
Log.i(TAG,"ReadRecordFileUtils--getRecordEndTime() 以行为单位读取文件内容,读倒数第二行:"+list.get(list.size()-2));
return StringUtils.getTimeStampFromString(list.get(list.size()-2));
}
return StringUtils.getTimeStampFromString(list.get(list.size()-1));
}
public static ArrayList<String> getAllStringLines(String baseFilePath,long timeStamp){
long fileName = DateTransUtils.getZeroClockTimestamp(timeStamp);
File file = new File(baseFilePath + "/" + fileName + ".txt");
if(!file.exists()){
Log.i(TAG,"读取RecordFile文件内容时,文件不存在");
return null;
}
BufferedReader reader = null;
String line = null;
ArrayList<String> stringsArray = new ArrayList<>();
try {
reader = new BufferedReader(new FileReader(file));
// 一次读入一行,直到读入null为文件结束
while ( ( line = reader.readLine()) != null) {
Log.i("reader"," "+line);
stringsArray.add(line) ;
}
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
return stringsArray;
}
public static String getFirstStringLines(String baseFilePath,long timeStamp){
long fileName = DateTransUtils.getZeroClockTimestamp(timeStamp);
File file = new File(baseFilePath + "/" + fileName + ".txt");
if(!file.exists()){
Log.i(TAG,"读取RecordFile文件内容时,文件不存在");
return null;
}
BufferedReader reader = null;
String tempString = null;
try {
reader = new BufferedReader(new FileReader(file));
int line = 1;
// 一次读入一行,直到读入null为文件结束
while ((tempString = reader.readLine()) != null) {
// 显示行号
if(line == 1){
break;
}
}
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
Log.i(TAG,"ReadRecordFileUtils--getRecordStartTime() 以行为单位读取文件内容,读第一行:"+tempString);
return tempString;
}
public static String[] getAllFileNames(){
File file = new File(WriteRecordFileUtils.BASE_FILE_PATH);
return file.list();
}
}
| [
"154569805@qq.com"
] | 154569805@qq.com |
e1f5f6591afe95278fcd77a886eb792552509a4f | 26b7988ff249a5daf59e0d80abb4cbd0e280efc1 | /src/main/java/service/Impl/UserServiceImpl.java | c4e6c89c2b4872a4dbc5d8bd34ec46af260d2010 | [] | no_license | yato123/qf-learning-project | c22e5e73542a5cb5bd5b84a6048fba4826a95aa9 | ad9e48827d880bca93468dda23c9a112509032fe | refs/heads/master | 2022-12-26T07:13:19.960603 | 2019-07-15T12:09:17 | 2019-07-15T12:09:17 | 196,037,628 | 0 | 0 | null | 2022-12-16T09:43:53 | 2019-07-09T15:38:09 | Java | UTF-8 | Java | false | false | 1,123 | java | package service.Impl;
import org.springframework.stereotype.Service;
import userDao.IUserDao;
import userDao.userDaoImpl.UserDaoImpl;
import entity.User;
import service.IUserService;
@Service
public class UserServiceImpl implements IUserService {
IUserDao userDao = new UserDaoImpl();
@Override
public boolean userLogin(User user) {
if (userDao.login(user.getUsername(), user.getPassword())) {
return true;
} else {
return false;
}
}
@Override
public boolean checkUser(String username , String password) {
if (!userDao.CheckRegister(username) && !"".equals(password) && password != null){
return true;
}
return false;
}
@Override
public boolean checkUserName(String username) {
System.out.println("2"+username);
if (userDao.CheckRegister(username)){
return true;
}
return false;
}
@Override
public boolean register(User user) {
if (userDao.register(user) >0){
return true;
}
return false;
}
}
| [
"635317490@qq.com"
] | 635317490@qq.com |
4f1057ef5173f1981555aca480b80cd5fc1dd5c3 | ca57f416d55c2d232d19d09d9ab3071ed46cfde1 | /src/practice/Thread01.java | 8c3997fc0abf7b711b0058edd77301736dd7a4ca | [] | no_license | TheSaltyFish/Test | 81829ddbc44a756f961cd9191d5ec681f8b94398 | 42c08aa6246084d08af40bbc180a7731cce64180 | refs/heads/master | 2020-06-21T20:21:57.817526 | 2019-07-18T08:17:10 | 2019-07-18T08:17:10 | 197,544,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package practice;
public class Thread01 extends Thread{
String name;
Thread01(String name){
this.name = name;
}
public void run() {
for(int i = 0; i < 20; i++) {
System.out.println(name + ":" + i);
}
}
}
| [
"273789264@qq.com"
] | 273789264@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.