blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
0d212c08f3664b9a22033077bcb48de71b459c1e
483643ff8bb8f6cc684d0a0985e4e690bc45dc87
/완전탐색/카펫.java
887880e13457fa6eaa5b2064c174741224b77781
[ "MIT" ]
permissive
milanoderby/Programmars
fa0f292b99b64dfaf9821846252ebfabef610462
a6e0276f3831d948f432e11e31f8289e51e68dac
refs/heads/main
2023-08-19T06:29:40.805174
2021-10-10T10:47:15
2021-10-10T10:47:15
393,683,964
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
class Solution { public int[] solution(int brown, int yellow) { int[] answer = {}; int totalCountOfGrid = brown + yellow; for (int num = 1; num * num <= yellow; num++) { if (yellow % num != 0) { continue; } int length = num + 2; int width = yellow / num + 2; if (totalCountOfGrid == length * width) { answer = new int[] {width, length}; break; } } return answer; } }
[ "yonghwa9086@naver.com" ]
yonghwa9086@naver.com
0bb57cba1770db22d0091000b2a055f009a2e9c5
b94cbca891465e492687c29f01159fe7b4655f1d
/app/src/main/java/com/bluelife/test/filedesccrashtest/App.java
a527307528d20ec63e8dae0a0ea7d2f2086564cc
[]
no_license
bluelife/FileDescCrashTest
4f602ca43e597504168dfa13f6c44f2cfcec34f9
daaa564d7c42415bb3747e17de1422e190f6ddd3
refs/heads/master
2021-01-10T14:12:55.864583
2016-01-20T07:28:20
2016-01-20T07:28:20
50,012,591
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
package com.bluelife.test.filedesccrashtest; import android.app.Application; import com.tencent.bugly.crashreport.CrashReport; /** * Created by slomka.jin on 2016/1/20. */ public class App extends Application { @Override public void onCreate() { super.onCreate(); CrashReport.initCrashReport(getApplicationContext(), "900018372", true); } }
[ "28998638@qq.com" ]
28998638@qq.com
44fedeee9fc7608f3d5f7fcf3cfc374ffc013fc3
3f27067a555a603aacb0c6c4b58a04a243dccbe2
/app/src/main/java/br/usjt/desenvmob/aula03/MainActivity.java
b1d4abbf52382497ba9884ac6ee6373fe8d1f03f
[]
no_license
otaviocosta98/desenvmob_serviceDesk
31128485ad386fe02c6baaa130dbf618cbfddafa
036ef814445e399baa836f41561f95d30d7770c4
refs/heads/master
2020-04-10T23:53:37.358674
2018-03-07T23:53:00
2018-03-07T23:53:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
791
java
package br.usjt.desenvmob.aula03; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.EditText; public class MainActivity extends Activity { public static final String FILA = "br.usjt.desenvmob.aula03.fila"; private EditText txtFila; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txtFila = findViewById(R.id.buscar_fila); } public void buscarChamados(View view) { String fila = txtFila.getText().toString(); Intent intent = new Intent(this, ListarChamadosActivity.class); intent.putExtra(FILA, fila); startActivity(intent); } }
[ "arqdsis@mocli10229.animaedu.intranet" ]
arqdsis@mocli10229.animaedu.intranet
3f6c1b57a9236cf026b592ede4d0847769d81b8a
a37082baeba7697c963feb4f39d0eb1368caf0d1
/app/src/main/java/dragondreamstudio/beermap/json/Requestor.java
e8688c5797929d62f8ce1fd5814179665676df62
[]
no_license
Ishidad/TestingJson
51d494be520c7a0f36688915cc98ae2e611aa133
fa262f056c003a815658210142c3f060099d28ce
refs/heads/master
2021-01-09T20:14:04.346402
2016-07-19T15:11:45
2016-07-19T15:11:45
62,075,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,161
java
package dragondreamstudio.beermap.json; import android.util.Log; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.RequestFuture; import org.json.JSONObject; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; public class Requestor { public static JSONObject sendJsonRequest(RequestQueue requestQueue, String url) { JSONObject response = null; RequestFuture<JSONObject> requestFuture = RequestFuture.newFuture(); JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null, requestFuture, requestFuture); try { response = requestFuture.get(30000, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Log.e(e + "", ""); } catch (ExecutionException e) { Log.e(e + "", ""); } catch (TimeoutException e) { Log.e(e + "", ""); } requestQueue.add(request); return response; } }
[ "martin.villarruel@globant.com" ]
martin.villarruel@globant.com
cd38e963d301510b04cf6815bc3577712a36dd32
5f964a9de0177c753231ba2d23698b3970a68e94
/src/member/model/vo/Member.java
95ead88d99d89f8b51be9afcb409889692788c74
[]
no_license
kyj0101/HoneyPlate
5e3c2a49bf04e866d5e09732ddf0dbdd616eef6f
87d545127056f9b4149c8c2586f7a0d204b8a634
refs/heads/master
2023-04-21T18:15:05.244648
2021-04-24T11:58:32
2021-04-24T11:58:32
347,546,878
0
0
null
2021-04-24T11:58:32
2021-03-14T04:51:55
Java
UTF-8
Java
false
false
2,808
java
package member.model.vo; import java.sql.Date; public class Member { private String memberId; private String memberPassword; private String memberName; private String memberRole; private Date birthDay; private String email; private String phone; private Date enrollDate; private String quitYn; private int noshowFreq; private String corporateNo; public Member() { super(); } public Member(String memberId, String memberPassword, String memberName, String memberRole, Date birthDay, String email, String phone, Date enrollDate, String quitYn, int noshowFreq, String corporateNo) { super(); this.memberId = memberId; this.memberPassword = memberPassword; this.memberName = memberName; this.memberRole = memberRole; this.birthDay = birthDay; this.email = email; this.phone = phone; this.enrollDate = enrollDate; this.quitYn = quitYn; this.noshowFreq = noshowFreq; this.corporateNo = corporateNo; } public String getMemberId() { return memberId; } public void setMemberId(String memberId) { this.memberId = memberId; } public String getMemberPassword() { return memberPassword; } public void setMemberPassword(String memberPassword) { this.memberPassword = memberPassword; } public String getMemberName() { return memberName; } public void setMemberName(String memberName) { this.memberName = memberName; } public String getMemberRole() { return memberRole; } public void setMemberRole(String memberRole) { this.memberRole = memberRole; } public Date getBirthDay() { return birthDay; } public void setBirthDay(Date birthDay) { this.birthDay = birthDay; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public Date getEnrollDate() { return enrollDate; } public void setEnrollDate(Date enrollDate) { this.enrollDate = enrollDate; } public String getQuitYn() { return quitYn; } public void setQuitYn(String quitYn) { this.quitYn = quitYn; } public int getNoshowFreq() { return noshowFreq; } public void setNoshowFreq(int noshowFreq) { this.noshowFreq = noshowFreq; } public String getCorporateNo() { return corporateNo; } public void setCorporateNo(String corporateNo) { this.corporateNo = corporateNo; } @Override public String toString() { return "Member [memberId=" + memberId + ", memberPassword=" + memberPassword + ", memberName=" + memberName + ", memberRole=" + memberRole + ", birthDay=" + birthDay + ", email=" + email + ", phone=" + phone + ", enrollDate=" + enrollDate + ", quitYn=" + quitYn + ", noshowFreq=" + noshowFreq + ", corporateNo=" + corporateNo + "]"; } }
[ "fioonmp1001@gmail.com" ]
fioonmp1001@gmail.com
661d8327b8662917a6891c0314fe32b41b9fcc62
b0ae847d5b2dd4cfd096d16940e23136bfe74aab
/src/main/java/com/example/demo/controller/ShowItemDetailController.java
91c99b8eb1634e3a4a7e0f7261d01e1879b16d34
[]
no_license
wakako-otsuka/mercari
189742c80e6a6a6729694a51305490d8ded59d73
1a39f3bc2a23979fb688918cab3c562e590ed1f4
refs/heads/master
2020-08-04T03:29:20.009483
2019-10-11T01:46:06
2019-10-11T01:46:06
211,987,512
0
0
null
null
null
null
UTF-8
Java
false
false
824
java
package com.example.demo.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.example.demo.domain.Item; import com.example.demo.repository.ItemRepository; /** * 商品詳細を示すコントローラ. * * @author kyoul * */ @Controller @RequestMapping("/showItemDetail") public class ShowItemDetailController { @Autowired private ItemRepository itemRepository; /** * 商品詳細画面を表示する. * @return */ @RequestMapping("/detail") public String showItemDetail(int id,Model model) { Item itemDetail=itemRepository.showDetailItem(id); model.addAttribute("itemDetail",itemDetail); return "detail"; } }
[ "wakako.otsuka@rakus-partners.co.jp" ]
wakako.otsuka@rakus-partners.co.jp
31732451b3ab9853f59c68d816f7dec87d8f24b3
940d1f86c90eb57da23a9111482fcd1b79589711
/dac-decorator/src/com/fametro/dac/bebida/Bebida.java
db003a449584323f4b8267c9c9296269cc628511
[]
no_license
JonathanR-Jesus/dac-fametro
ae72df08475e7d2f235f4035a9270c45fcc68c3d
51af9e6b17c6b07d9e32e0a88fa77833aaa92df8
refs/heads/master
2021-01-22T19:30:41.760331
2017-05-17T12:59:27
2017-05-17T12:59:27
85,201,845
0
1
null
null
null
null
UTF-8
Java
false
false
219
java
package com.fametro.dac.bebida; public abstract class Bebida { String descricao = "bebida indefinida"; public String getDescricao(){ return descricao; } public abstract double custo(); }
[ "noreply@github.com" ]
JonathanR-Jesus.noreply@github.com
e7beb7f670d0216a2cb009279989d49927b5fbc2
78d1cc160181eee36e0fed53a1c27519e78f0747
/src/main/java/org/kavaproject/kavatouch/imageio/GraphicsImageOptions.java
32d6837f0b8caff02c21463cbf7fcf89dd7b46ec
[ "BSD-3-Clause", "MIT", "Apache-2.0", "BSD-2-Clause" ]
permissive
KavaProject/KavaTouch
ed3c30c1b3d8ce5d20d12e013c09d82302764c52
a5a815797c62694f0ad2e56334365548b7db1cc2
refs/heads/master
2021-01-25T08:36:59.365774
2014-03-29T11:20:20
2014-03-29T11:20:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,211
java
/* * Copyright 2013 The Kava Project Developers. See the COPYRIGHT file at the top-level directory of this distribution * and at http://kavaproject.org/COPYRIGHT. * * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the * MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. This file may not be copied, * modified, or distributed except according to those terms. */ package org.kavaproject.kavatouch.imageio; import org.kavaproject.kavatouch.internal.CData; import org.kavaproject.kavatouch.internal.Header; @Header("CGImageSource") public class GraphicsImageOptions { @CData("kCGImageSourceTypeIdentifierHint") public String bestGuessTypeIdentifier; @CData("kCGImageSourceShouldAllowFloat") public boolean shouldAllowFloat; @CData("kCGImageSourceShouldCache") public boolean shouldCache; public GraphicsImageOptions(GraphicsImageOptions options) { shouldAllowFloat = options.shouldAllowFloat; shouldCache = options.shouldCache; bestGuessTypeIdentifier = options.bestGuessTypeIdentifier; } public GraphicsImageOptions() { //empty } }
[ "m6s@kavaproject.org" ]
m6s@kavaproject.org
0b23428d71c0a5c2fcb929fca2a263aa89cf3f45
65562bbbe663b5bace0d94015b9091c6505c1c06
/chapter_001/src/main/java/ru/job4j/converter/Converter.java
080a4b70e06dc459288cb844f6b396d2f2959d8b
[]
no_license
Ox1D666/job4j
313aa0672837deec6b7d3e1bd55d9edc4556f45b
5ccd06386e7239d482ac69db6d04effc2b605118
refs/heads/master
2021-07-12T20:23:51.144741
2020-11-19T14:09:42
2020-11-19T14:09:42
219,309,576
0
0
null
null
null
null
UTF-8
Java
false
false
1,265
java
package ru.job4j.converter; public class Converter { public static int rubleToEuro(int value) { return value / 70; } public static int rubleToDollar(int value) { return value / 60; } public static int euroToRuble(int value) { return value * 70; } public static int dollarToRuble(int value) { return value * 60; } public static boolean test(int expected, int out) { boolean passed = expected == out; return passed; } public static void main(String[] args) { int in = 140; int expected = 2; int out = rubleToEuro(in); boolean passed = expected == out; System.out.println("140 rubles are 2. Test result : " + passed); int in2 = 120; int expected2 = 2; int out2 = rubleToDollar(in2); boolean passed2 = expected2 == out2; System.out.println("120 rubles are 2. Test result : " + passed2); int in3 = 50; boolean test = test(3500, euroToRuble(in3)); System.out.println("50 euro are 3500. Test result : " + test); int in4 = 50; boolean test1 = test(3000, dollarToRuble(in4)); System.out.println("50 dollar are 3000. Test result : " + test1); } }
[ "kirill.coldline@gmail.com" ]
kirill.coldline@gmail.com
df95d48e00b2375434395540146780c09c796301
7e06d07b3d9752b1a12874c9f647cfe809b926f8
/33-search-in-rotated-sorted-array/2-19-2019.java
95122a9c2c4d2e764a0267b75dc821c462acb32a
[]
no_license
wushangzhen/LeetCode-Practice
e44363f1e0ff72b80e060ac39984fe469dba04d8
afba5a3dc84e8615685f893b8394b5137e9a42b6
refs/heads/master
2020-03-09T18:07:32.825047
2019-09-17T00:14:40
2019-09-17T00:14:40
128,924,476
3
1
null
null
null
null
UTF-8
Java
false
false
1,058
java
class Solution { public int search(int[] nums, int target) { if (nums == null || nums.length == 0) { return -1; } // 4,5,6,7,0,1,2 int pivot = nums[0]; int n = nums.length; int left = 0; int right = n - 1; while (left + 1 < right) { int mid = (left + right) / 2; if (nums[mid] == target) { return mid; } if (nums[mid] < target) { if (target >= pivot && nums[mid] < pivot) { right = mid; } else { left = mid; } } if (nums[mid] > target) { if (target < pivot && nums[mid] >= pivot) { left = mid; } else { right = mid; } } } if (nums[left] == target) { return left; } if (nums[right] == target) { return right; } return -1; } }
[ "wushangzhen_bupt@163.com" ]
wushangzhen_bupt@163.com
fdfdce75713a60d879efccefb54327de3116b5ad
600e5a4fc13ac9b77b94368d8d2bb554208265db
/mavendemoB2003/src/main/java/controlflow/NestedIfElse.java
5e7bbaf4ea1e89315b566561bc05df6c62e1395d
[]
no_license
imran33bd/b2000
dba87735aec6d3ca48ff27aaa952b46eba31ec56
970607f0751f862a384caa0d83abf94efe08e839
refs/heads/master
2022-12-10T05:03:03.787372
2020-08-31T04:44:23
2020-08-31T04:44:23
275,636,896
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package controlflow; public class NestedIfElse { public void nestedIfElse(){ int x = 30; int y = 10; if( x == 30 ) { if( y == 10 ) { System.out.print("X = 30 and Y = 10"); } } } }
[ "imran_nsu2003@hotmail.com" ]
imran_nsu2003@hotmail.com
0e53d47f7db8473719506d86ed62ea95ed1c0df8
4bbcf23cac8d9ff7184500f3ae697daf0c660c22
/src/br/edu/ifro/control/RelatoriovendasController.java
160d84bbe5223596a202e87de8e3f22cb6533d7c
[]
no_license
withorcello/HotelDesktop
8c4e0900a2d71f19490d9450a611ce92a8bf565c
118a59ceceb6e320f719ed3728a2e30fb0bed79f
refs/heads/master
2023-06-06T01:55:34.635252
2021-06-26T00:14:19
2021-06-26T00:14:19
380,376,962
1
0
null
null
null
null
UTF-8
Java
false
false
618
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 br.edu.ifro.control; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.Initializable; /** * FXML Controller class * * @author 01453074252 */ public class RelatoriovendasController implements Initializable { /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO } }
[ "withorcello@gmail.com" ]
withorcello@gmail.com
778fe49e2a10712f2ba705364117b37ddf563d78
98740980272b8e8c87d731f672a2405c3859d9a1
/src/main/java/xjtu/model/SIPOCRecord.java
785910dd75efd583cf8d3effbfe65c4120607e49
[]
no_license
wanxu2019/practice2
b556cff109b6f05c0e9aec319996ee1c062042ae
d1408a88e5c795dde89c8a1ea60f8ce7cc19f091
refs/heads/master
2020-03-14T07:36:35.082096
2018-06-05T10:02:20
2018-06-05T10:02:20
131,508,090
1
0
null
null
null
null
UTF-8
Java
false
false
1,616
java
package xjtu.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; /** * Created by Json Wan on 2017/7/20. */ @Entity @Table(name="SIPOC_S_Data") public class SIPOCRecord { int id; String name; String userName; String sMessage; String iMessage; String pMessage; String oMessage; String cMessage; @Id @GeneratedValue public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getsMessage() { return sMessage; } public void setsMessage(String sMessage) { this.sMessage = sMessage; } public String getiMessage() { return iMessage; } public void setiMessage(String iMessage) { this.iMessage = iMessage; } public String getpMessage() { return pMessage; } public void setpMessage(String pMessage) { this.pMessage = pMessage; } public String getoMessage() { return oMessage; } public void setoMessage(String oMessage) { this.oMessage = oMessage; } public String getcMessage() { return cMessage; } public void setcMessage(String cMessage) { this.cMessage = cMessage; } }
[ "1334793794@qq.com" ]
1334793794@qq.com
ccee063acefa38ea94c6272d2650255f304b9215
5bf7043df5f9070e98d79a2be447610984c1fd2c
/tech_chat/Q-municate_core/src/main/java/com/quickblox/q_municate_core/service/QBServiceConsts.java
dadea94f0c9b43686fb065fbc6e9ba6c98442d55
[ "Apache-2.0" ]
permissive
Ankit1612/TechChat
588b127f5c28f8bca5a5e2c7a6c4c602a6d7dcb3
a7ae8e9e22e551171d125d95c7e43b3f25984922
refs/heads/master
2020-04-19T01:43:22.677592
2019-01-28T01:52:56
2019-01-28T01:52:56
167,880,235
0
0
null
null
null
null
UTF-8
Java
false
false
18,090
java
package com.quickblox.q_municate_core.service; public class QBServiceConsts { //main actions public static final String COMMAND_ACTION = "command_action"; public static final String COMMAND_DESCRIPTION_ACTION = "command_description_action"; public static final String COMMAND_IS_SUCCESS_ACTION = "command_is_success_action"; public static final String LOGIN_ACTION = "login_action"; public static final String LOGIN_SUCCESS_ACTION = "login_success_action"; public static final String LOGIN_FAIL_ACTION = "login_fail_action"; public static final String SOCIAL_LOGIN_ACTION = "social_login_action"; public static final String SOCIAL_LOGIN_SUCCESS_ACTION = "social_login_success_action"; public static final String SOCIAL_LOGIN_FAIL_ACTION = "social_login_fail_action"; public static final String ADD_FRIEND_ACTION = "add_friend_action"; public static final String ACCEPT_FRIEND_ACTION = "accept_friend_action"; public static final String REMOVE_FRIEND_ACTION = "remove_friend_action"; public static final String REJECT_FRIEND_ACTION = "reject_friend_action"; public static final String IMPORT_FRIENDS_ACTION = "import_friends_action"; public static final String CHANGE_PASSWORD_ACTION = "change_password_action"; public static final String GET_FILE_ACTION = "get_file_action"; public static final String LOGIN_REST_ACTION = "login_rest_command"; public static final String LOGIN_CHAT_COMPOSITE_ACTION = "login_chat_composite_action"; public static final String LOGIN_CHAT_ACTION = "login_chat_action"; public static final String LOGOUT_ACTION = "logout_action"; public static final String LOGOUT_REST_ACTION = "logout_rest_action"; public static final String LOGOUT_CHAT_ACTION = "logout_chat_action"; public static final String LOGOUT_AND_DESTROY_CHAT_ACTION = "logout_and_destroy_chat_action"; public static final String RESET_PASSWORD_ACTION = "reset_password_action"; public static final String SIGNUP_ACTION = "signup_action"; public static final String UPDATE_USER_ACTION = "update_user_action"; public static final String LOAD_FRIENDS_ACTION = "friends_load_action"; public static final String LOAD_USERS_ACTION = "users_search_action"; public static final String FIND_USERS_ACTION = "find_search_action"; public static final String LOAD_USER_ACTION = "user_search_action"; public static final String SEND_MESSAGE_ACTION = "send_message_action"; public static final String SEND_GROUP_MESSAGE_ACTION = "send_group_message_action"; public static final String LOAD_ATTACH_FILE_ACTION = "load_attach_file_action"; public static final String INIT_FRIEND_LIST_ACTION = "init friend list action"; public static final String INIT_CHATS_ACTION = "init_chats_action"; public static final String INIT_CHAT_SERVICE_ACTION = "init_chat_service_action"; public static final String INIT_CALL_CHAT_ACTION = "init_video_chat_action"; public static final String SIGNUP_REST_ACTION = "signup_rest_action"; public static final String CREATE_GROUP_CHAT_ACTION = "create_group_chat_action"; public static final String CREATE_PRIVATE_CHAT_ACTION = "create_private_chat_action"; public static final String LOAD_CHATS_DIALOGS_ACTION = "chats_dialogs_load_action"; public static final String UPDATE_CHAT_DIALOG_ACTION = "update_chat_dialog_action"; public static final String JOIN_GROUP_CHAT_ACTION = "join_group_chat_action"; public static final String LOAD_DIALOG_MESSAGES_ACTION = "load_dialog_messages_action"; public static final String LOAD_GROUP_DIALOG_ACTION = "load_group_dialog_action"; public static final String LEAVE_GROUP_DIALOG_ACTION = "leave_group_group_action"; public static final String ADD_FRIENDS_TO_GROUP_ACTION = "add_friends_to_group_action"; public static final String UPDATE_STATUS_MESSAGE_ACTION = "update_status_message_action"; public static final String SEND_PUSH_ACTION = "send_push_action"; public static final String GET_USER_BY_ID_ACTION = "get_user_by_id_action"; public static final String RE_LOGIN_IN_CHAT_ACTION = "relogin_in_chat"; public static final String DELETE_DIALOG_ACTION = "delete_dialog_action"; public static final String UPDATE_GROUP_DIALOG_ACTION = "update_group_dialog_name_action"; //success and fail actions public static final String ADD_FRIEND_SUCCESS_ACTION = "add_friend_success_action"; public static final String ADD_FRIEND_FAIL_ACTION = "add_friend_fail_action"; public static final String ACCEPT_FRIEND_SUCCESS_ACTION = "accept_friend_success_action"; public static final String ACCEPT_FRIEND_FAIL_ACTION = "accept_friend_fail_action"; public static final String REMOVE_FRIEND_SUCCESS_ACTION = "remove_friend_success_action"; public static final String REMOVE_FRIEND_FAIL_ACTION = "remove_friend_fail_action"; public static final String REJECT_FRIEND_SUCCESS_ACTION = "reject_friend_success_action"; public static final String REJECT_FRIEND_FAIL_ACTION = "reject_friend_fail_action"; public static final String IMPORT_FRIENDS_SUCCESS_ACTION = "import_friends_success_action"; public static final String IMPORT_FRIENDS_FAIL_ACTION = "import_friends_fail_action"; public static final String CHANGE_PASSWORD_SUCCESS_ACTION = "change_password_success_action"; public static final String CHANGE_PASSWORD_FAIL_ACTION = "change_password_fail_action"; public static final String GET_FILE_SUCCESS_ACTION = "get_file_success_action"; public static final String GET_FILE_FAIL_ACTION = "get_file_fail_action"; public static final String LOGOUT_SUCCESS_ACTION = "logout_success_action"; public static final String LOGOUT_FAIL_ACTION = "logout_fail_action"; public static final String RESET_PASSWORD_SUCCESS_ACTION = "reset_password_success_action"; public static final String RESET_PASSWORD_FAIL_ACTION = "reset_password_fail_action"; public static final String SIGNUP_SUCCESS_ACTION = "signup_success_action"; public static final String SIGNUP_FAIL_ACTION = "signup_fail_action"; public static final String UPDATE_USER_SUCCESS_ACTION = "update_user_success_action"; public static final String UPDATE_USER_FAIL_ACTION = "update_user_fail_action"; public static final String LOAD_FRIENDS_SUCCESS_ACTION = "friends_load_success_action"; public static final String LOAD_FRIENDS_FAIL_ACTION = "friends_load_fail_action"; public static final String LOAD_USERS_SUCCESS_ACTION = "users_search_success_action"; public static final String LOAD_USERS_FAIL_ACTION = "users_search_fail_action"; public static final String FIND_USERS_SUCCESS_ACTION = "find_users_success_action"; public static final String FIND_USERS_FAIL_ACTION = "find_users_fail_action"; public static final String LOAD_USER_SUCCESS_ACTION = "user_search_success_action"; public static final String LOAD_USER_FAIL_ACTION = "user_search_fail_action"; public static final String SEND_MESSAGE_SUCCESS_ACTION = "send_message_success_action"; public static final String SEND_MESSAGE_FAIL_ACTION = "send_message_fail_action"; public static final String LOAD_ATTACH_FILE_SUCCESS_ACTION = "load_attach_file_success_action"; public static final String LOAD_ATTACH_FILE_FAIL_ACTION = "load_attach_file_fail_action"; public static final String INIT_FRIEND_LIST_SUCCESS_ACTION = "init_friend_list_success_action"; public static final String INIT_FRIEND_LIST_FAIL_ACTION = "init_friend_list_fail_action"; public static final String LOGIN_REST_SUCCESS_ACTION = "login_rest_success_action"; public static final String LOGIN_REST_FAIL_ACTION = "login_rest_fail_action"; public static final String LOGIN_CHAT_SUCCESS_ACTION = "login_chat_success_action"; public static final String LOGIN_CHAT_FAIL_ACTION = "login_chat_fail_action"; public static final String LOGIN_CHAT_COMPOSITE_SUCCESS_ACTION = "login_chat_composite_success_action"; public static final String LOGIN_CHAT_COMPOSITE_FAIL_ACTION = "login_chat_composite_fail_action"; public static final String LOGOUT_CHAT_SUCCESS_ACTION = "logout_chat_success_action"; public static final String LOGOUT_CHAT_FAIL_ACTION = "logout_chat_fail_action"; public static final String INIT_CHATS_SUCCESS_ACTION = "init_chats_success_action"; public static final String INIT_CHATS_FAIL_ACTION = "init_chats_fail_action"; public static final String INIT_CHAT_SERVICE_SUCCESS_ACTION = "init_chat_service_success_action"; public static final String INIT_CHAT_SERVICE_FAIL_ACTION = "init_chat_service_fail_action"; public static final String INIT_VIDEO_CHAT_SUCCESS_ACTION = "init_video_chat_success_action"; public static final String INIT_VIDEO_CHAT_FAIL_ACTION = "init_video_chat_fail_action"; public static final String LOGOUT_AND_DESTROY_CHAT_SUCCESS_ACTION = "logout_and_destroy_chat_success_action"; public static final String LOGOUT_AND_DESTROY_CHAT_FAIL_ACTION = "logout_and_destroy_chat_fail_action"; public static final String LOGOUT_REST_SUCCESS_ACTION = "logout_rest_success_action"; public static final String LOGOUT_REST_FAIL_ACTION = "logout_rest_success_action"; public static final String SIGNUP_REST_SUCCESS_ACTION = "signup_rest_success_action"; public static final String SIGNUP_REST_FAIL_ACTION = "signup_rest_fail_action"; public static final String CREATE_GROUP_CHAT_SUCCESS_ACTION = "create_group_chat_success_action"; public static final String CREATE_GROUP_CHAT_FAIL_ACTION = "create_group_chat_fail_action"; public static final String CREATE_PRIVATE_CHAT_SUCCESS_ACTION = "create_private_chat_success_action"; public static final String CREATE_PRIVATE_CHAT_FAIL_ACTION = "create_private_chat_fail_action"; public static final String LOAD_CHATS_DIALOGS_SUCCESS_ACTION = "chats_dialogs_success_action"; public static final String LOAD_CHATS_DIALOGS_FAIL_ACTION = "chats_dialogs_fail_action"; public static final String JOIN_GROUP_CHAT_SUCCESS_ACTION = "join_group_chat_success_action"; public static final String JOIN_GROUP_CHAT_FAIL_ACTION = "join_group_chat_fail_action"; public static final String UPDATE_CHAT_DIALOG_SUCCESS_ACTION = "update_chat_dialog_success_action"; public static final String UPDATE_CHAT_DIALOG_FAIL_ACTION = "update_chat_dialog_fail_action"; public static final String LOAD_DIALOG_MESSAGES_SUCCESS_ACTION = "load_dialog_messages_load_success_action"; public static final String LOAD_DIALOG_MESSAGES_FAIL_ACTION = "load_dialog_messages_load_fail_action"; public static final String UPDATE_STATUS_MESSAGE_SUCCESS_ACTION = "update_status_message_success_action"; public static final String UPDATE_STATUS_MESSAGE_FAIL_ACTION = "update_status_message_fail_action"; public static final String SEND_PUSH_MESSAGES_SUCCESS_ACTION = "send_push_message_success_action"; public static final String SEND_PUSH_MESSAGES_FAIL_ACTION = "send_push_message_fail_action"; public static final String LOAD_GROUP_DIALOG_SUCCESS_ACTION = "load_group_dialog_success_action"; public static final String LOAD_GROUP_DIALOG_FAIL_ACTION = "load_group_dialog_fail_action"; public static final String LEAVE_GROUP_DIALOG_SUCCESS_ACTION = "leave_group_dialog_success_action"; public static final String LEAVE_GROUP_DIALOG_FAIL_ACTION = "leave_group_dialog_fail_action"; public static final String ADD_FRIENDS_TO_GROUP_SUCCESS_ACTION = "add_friends_to_group_success_action"; public static final String ADD_FRIENDS_TO_GROUP_FAIL_ACTION = "add_friends_to_group_fail_action"; public static final String LOGIN_AND_JOIN_CHATS_SUCCESS_ACTION = "login_and_join_chats_sucess_action"; public static final String LOGIN_AND_JOIN_CHATS_FAIL_ACTION = "login_and_join_chats_fail_action"; public static final String USER_CHANGED_ACTION = "friend_status_changed_action"; public static final String RE_LOGIN_IN_CHAT_SUCCESS_ACTION = "relogin_in_chat_success_action"; public static final String RE_LOGIN_IN_CHAT_FAIL_ACTION = "relogin_in_chat_fail_action"; public static final String UPDATE_GROUP_DIALOG_SUCCESS_ACTION = "update_group_dialog_success_action"; public static final String UPDATE_GROUP_DIALOG_FAIL_ACTION = "update_group_dialog_fail_action"; public static final String DELETE_DIALOG_SUCCESS_ACTION = "delete_dialog_success_action"; public static final String DELETE_DIALOG_FAIL_ACTION = "delete_dialog_fail_action"; public static final String EXTRA_ATTACH_FILE = "attach_file"; public static final String EXTRA_CHAT_MESSAGE = "chat_message"; public static final String EXTRA_ROOM_JID = "room_jid_id"; public static final String EXTRA_IS_PRIVATE_MESSAGE = "is_private_message"; public static final String EXTRA_IS_FOR_PRIVATE = "is_for_private"; public static final String EXTRA_USER = "user"; public static final String EXTRA_USERS = "users"; public static final String EXTRA_ERROR = "error"; public static final String EXTRA_ERROR_CODE = "error_code"; public static final String EXTRA_FRIEND = "friend"; public static final String EXTRA_FRIEND_ID = "friend_id"; public static final String EXTRA_FRIENDS = "friends"; public static final String EXTRA_FRIENDS_FACEBOOK = "friends_facebook"; public static final String EXTRA_FRIENDS_CONTACTS = "friends_contacts"; public static final String EXTRA_FILE = "file"; public static final String EXTRA_QBFILE = "qb_file"; public static final String EXTRA_SOCIAL_PROVIDER = "social_provider"; public static final String EXTRA_ACCESS_TOKEN = "access_token"; public static final String EXTRA_ACCESS_TOKEN_SECRET = "access_token_secret"; public static final String EXTRA_EMAIL = "email"; public static final String EXTRA_FILE_ID = "file_id"; public static final String EXTRA_CONSTRAINT = "constraint"; public static final String EXTRA_TOTAL_ENTRIES = "total_entries"; public static final String EXTRA_STATUS = "status"; public static final String EXTRA_CHATS_DIALOGS = "chats_dialogs"; public static final String EXTRA_ROOM_NAME = "room_name"; public static final String EXTRA_ROOM_PHOTO_URL = "photo_url"; public static final String EXTRA_ROOM_JID_LIST = "room_jid_list"; public static final String EXTRA_LAST_CHAT_MESSAGE = "last_chat_message"; public static final String EXTRA_OPPONENT_ID = "opponent_id"; public static final String EXTRA_COUNT_UNREAD_CHATS_DIALOGS = "count_unread_chats_dialogs"; public static final String EXTRA_DIALOG = "dialog"; public static final String EXTRA_DIALOG_ID = "dialog_id"; public static final String EXTRA_DIALOG_TYPE = "dialog_type"; public static final String EXTRA_IS_OWN_MESSAGE = "is_own_message"; public static final String EXTRA_GROUP_DIALOG = "group_dialog"; public static final String EXTRA_GROUP_DIALOGS = "group_dialogs"; public static final String EXTRA_GROUP_CHAT_ID = "group_chat_id"; public static final String EXTRA_OPPONENT = "opponent_friend"; public static final String EXTRA_DIALOG_MESSAGES = "dialog_messages"; public static final String EXTRA_DIALOG_COUNT_UNREAD_MESSAGE = "dialog_count_unread_message"; public static final String EXTRA_GROUP_NAME = "group_name"; public static final String EXTRA_DATE_LAST_UPDATE_HISTORY = "last_update_history"; public static final String EXTRA_LOAD_MORE = "load_more"; public static final String EXTRA_MESSAGE_ID = "message_id"; public static final String EXTRA_STATUS_MESSAGE = "status_message"; public static final String EXTRA_USER_ID = "user_id"; public static final String EXTRA_DATE_SENT = "date_sent"; public static final String EXTRA_EMOJIS = "emojis"; public static final String EXTRA_MESSAGE = "message"; public static final String EXTRA_FILE_PATH = "file_path"; public static final String EXTRA_FRIEND_ALERT_MESSAGE = "alert_message"; public static final String EXTRA_IS_TYPING = "is_typing"; public static final String EXTRA_CALL_ACTIVITY = "call_activity"; public static final String EXTRA_PAGE = "load_elements"; public static final String EXTRA_USER_STATUS = "user_status"; public static final String EXTRA_REGISTRATION_ID = "registration_id"; public static final String EXTRA_IS_PUSH_SUBSCRIBED_ON_SERVER = "is_push_subscribed_on_server"; public static final String EXTRA_OPPONENTS = "opponents"; public static final String EXTRA_WIFI_DISABLED = "wifi_disabled"; public static final String EXTRA_CONFERENCE_TYPE = "conference_type"; public static final String EXTRA_START_CONVERSATION_REASON_TYPE = "start_conversation_reason"; public static final String EXTRA_CALLER_NAME = "caller_name"; public static final String EXTRA_SESSION_ID = "session_id"; public static final String EXTRA_SESSION_DESCRIPTION = "session_description"; public static final String EXTRA_LAST_MESSAGE_DATE_SENT = "last_message_date_sent"; public static final String UPDATE_DIALOG = "update_dialog"; public static final String UPDATE_DIALOG_DETAILS = "update_dialog_details"; public static final String TYPING_MESSAGE = "typing_message"; public static final String GOT_CHAT_MESSAGE = "q_municate.got_chat_message"; public static final String GOT_CHAT_MESSAGE_LOCAL = "got_chat_message_local"; public static final String GOT_CONTACT_REQUEST = "got_contact_request"; public static final String LOGIN_AND_JOIN_CHAT_ACTION = "login_and_join_chats"; public static final String DESTROY_CHAT = "destroy_chat_after_logout"; public static final String FORCE_RELOGIN = "force_relogin"; public static final String REFRESH_SESSION = "refresh_session"; public static final String FRIEND_ALERT_SHOW = "friend_alert"; public static final String AUTH_ACTION_TYPE = "authorize_type"; public static final String USER_STATUS_CHANGED_ACTION = "user_status_changed"; public static final int AUTH_TYPE_REGISTRATION = 1; public static final int AUTH_TYPE_LOGIN = 2; }
[ "shahankit1612@gmail.com" ]
shahankit1612@gmail.com
4aef4779d6336eb5e55e2cb10afaba050a561f39
716dff14ab142aab260b161a6e21958782b46b60
/DNAMaxNucleotide.java
a7f8d11fd184e34a3682dc4403073a5aeac3a650
[]
no_license
mk374/APT-s
5cc5a3992d32f961e94f32d327c28760f6db737b
6c350b4c1209244cd0f1ad16bd7f7629143e484e
refs/heads/master
2020-03-27T21:31:39.549770
2018-09-15T21:04:41
2018-09-15T21:04:41
147,152,517
0
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class DNAMaxNucleotide { public String max(String[] strands, String nuc) { int[] arr = new int[strands.length]; for (int i = 0; i < strands.length; i++) { int nucCount = 0; for (int j = 0; j < strands[i].length(); j++) { if(strands[i].substring(j, j+ 1).equals(nuc)) { nucCount++; } } arr[i] = nucCount; } int x = getMaxValue(arr); if (x == 0) { return ""; } List<String> maxes = new ArrayList<>(); for (int k = 0; k < arr.length; k++) { if (arr[k] == x) { maxes.add(strands[k]); } } int longestStr = maxes.get(0).length(); String longest = maxes.get(0); for (String s: maxes) { if (s.length() > longestStr) { longestStr = s.length(); longest = s; } } return longest; } private int getMaxValue(int[] arr) { int max = arr[0]; for(int i = 1; i < arr.length; i++) { int y = arr[i]; if(y > max) { max = y; } } return max; } //testing //retesting }
[ "mk374@duke.edu" ]
mk374@duke.edu
35fa39f7693f6faafeec839b83fb9091e0bad46a
53ff8ffc2395aa321c201829604bc6010ed239c7
/src/main/java/br/com/alura/forum/dto/input/NewAnswerInputDto.java
5c2937109fdc743bf075484da4af76b8e09e201d
[]
no_license
EduAraujoDev/Curso_Spring
17d06f4ca3796b935dab350b7e3f81668362b681
5082f15e579668a6fa2c68480df427af8237fd65
refs/heads/master
2020-12-18T13:07:31.603618
2020-01-31T22:36:48
2020-01-31T22:36:48
235,393,659
0
0
null
null
null
null
UTF-8
Java
false
false
612
java
package br.com.alura.forum.dto.input; public class NewAnswerInputDto { private String shortDescription; private String content; private String courseName; public String getShortDescription() { return shortDescription; } public void setShortDescription(String shortDescription) { this.shortDescription = shortDescription; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } }
[ "eduardo.araujo0@outlook.com" ]
eduardo.araujo0@outlook.com
7070641a1de7afc806559b6e794becdb2e414d90
1ec25226b708f419318bbb3daa2bf37de353d453
/araqne-pcap-smb/src/main/java/org/araqne/pcap/smb/comparser/ReadBulkParser.java
1563e9de1e9b03834ce598c3d79a175e8fe2d076
[]
no_license
sjkbar/pcap
c3d5cb946ec9e4f4d852e5d9347935027a8fcf17
860773e6c9aa22d20a9945d5ceba8f9ee782b6fb
refs/heads/master
2021-01-17T13:09:17.949098
2014-07-10T06:22:05
2014-07-10T06:30:08
21,682,446
2
0
null
null
null
null
UTF-8
Java
false
false
722
java
package org.araqne.pcap.smb.comparser; import org.araqne.pcap.smb.SmbSession; import org.araqne.pcap.smb.request.ReadBulkRequest; import org.araqne.pcap.smb.response.ReadBulkResponse; import org.araqne.pcap.smb.structure.SmbData; import org.araqne.pcap.smb.structure.SmbHeader; import org.araqne.pcap.util.Buffer; //0xD8 public class ReadBulkParser implements SmbDataParser{ @Override public SmbData parseRequest(SmbHeader h , Buffer b , SmbSession session) { ReadBulkRequest data = new ReadBulkRequest(); return data; } @Override public SmbData parseResponse(SmbHeader h , Buffer b ,SmbSession session) { ReadBulkResponse data = new ReadBulkResponse(); return data; } //return STATUS_NOT_IMPLEMENTED; }
[ "xeraph@nchovy.com" ]
xeraph@nchovy.com
b05ee2d4cefdc2954a8e01be2e5990f91c89477e
033b78692b8754a7ccf922445b3beb70f971811a
/microservice-consumer-movie/src/main/java/com/liuxun/cloud/controller/MovieController.java
45325413fa76bdc505cdb96bcfaec9bf0bc4f96b
[]
no_license
LX1993728/microservice-spring-cloud1
37d18f722d22f2928f92da6a11026a13df928912
19b25a894e698c1983e156dc40d5689a24fac1ad
refs/heads/master
2020-03-20T09:19:54.388832
2018-06-15T09:42:54
2018-06-15T09:42:54
137,334,102
0
0
null
null
null
null
UTF-8
Java
false
false
643
java
package com.liuxun.cloud.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import com.liuxun.cloud.entity.User; @RestController public class MovieController { @Autowired private RestTemplate restTemplate; @GetMapping("/movie/{id}") public User findById(@PathVariable Long id) { return this.restTemplate.getForObject("http://localhost:7900/simple/" + id, User.class); } }
[ "2652790899@qq.com" ]
2652790899@qq.com
340decf02a9cff8f3c3a0e24c100e8029d6e6fe1
94a42d921bad9ec51ffbd028ca130060191e9dbe
/src/main/java/com/mercury/process/system/config/SystemConfigProcess.java
281f5cdb8750f6ba1cc65f72516c5a1b2d2a2061
[]
no_license
NaKyouTae/mercury-server
7360841364a48064842aeecbaa925c6c6462f3cf
20843c30826a37f300ffdf23078bb57acbd890f0
refs/heads/master
2023-03-29T16:04:01.881374
2021-04-16T03:33:43
2021-04-16T03:33:43
238,373,754
0
0
null
null
null
null
UTF-8
Java
false
false
1,596
java
package com.mercury.process.system.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import com.mercury.jpa.model.system.config.SystemConfig; import com.mercury.jpa.repository.system.config.SystemConfigRepository; @Component @Transactional @SuppressWarnings("unchecked") public class SystemConfigProcess { @Autowired private SystemConfigRepository systemConfigRepository; public <T extends Object> T seSystemConfigs() throws Exception { return (T) systemConfigRepository.findAll(); } public <T extends Object> T seSystemConfigByConfigName(String name) throws Exception { return (T) systemConfigRepository.findByConfigName(name); } public <T extends Object> T seSystemConfigByConfigType(String type) throws Exception { return (T) systemConfigRepository.findByConfigType(type); } public <T extends Object> T seSystemConfigByConfigValue(String value) throws Exception { return (T) systemConfigRepository.findByConfigValue(value); } public <T extends Object> T inSystemConfig(SystemConfig config) throws Exception { return (T) systemConfigRepository.save(config); } public <T extends Object> T upSystemConfig(SystemConfig config) throws Exception { return (T) systemConfigRepository.save(config); } public <T extends Object> T deSystemConfig(SystemConfig config) throws Exception { systemConfigRepository.delete(config); return (T) Boolean.TRUE; } }
[ "kyoutae@ybtour.co.kr" ]
kyoutae@ybtour.co.kr
251aefc45423e7c4eed84d4906987ac9c28d6f69
6e5f28903f7aae3c8326e8536449441306270133
/app/src/main/java/rbotha/bsse/asu/edu/rbothaapplication/Place.java
f32c0dcf181cd739ccecf87ba6f10826bf8606ca
[ "Apache-2.0" ]
permissive
rbotha/SER423_Part1
2063fe3328684c511e1cba3b0740b29b8b86b5b1
d82b473e6735df0b0b37e8b7a84f415a1f17db4d
refs/heads/master
2020-03-10T19:33:45.145966
2018-04-18T16:01:13
2018-04-18T16:01:13
129,550,326
0
0
null
null
null
null
UTF-8
Java
false
false
5,561
java
package rbotha.bsse.asu.edu.rbothaapplication; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.util.ArrayList; /* * Copyright 2018 Ruan Botha, * * 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. * * Purpose: Assignment for week 5 demonstrating multiple views, database * integration (SQLite), lists, and some maths. * * Ser423 Mobile Applications * see http://pooh.poly.asu.edu/Mobile * @author Ruan Botha rbotha@asu.edu * Software Engineering, CIDSE, IAFSE, ASU Poly * @version April 2018 */ public class Place extends AppCompatActivity { ArrayList<String> list; String name; String addressTitle; String addressStreet; double elevation; double latitude; double longitude; String description; String category; DatabaseHelper db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_place); EditText txtName = (EditText) findViewById(R.id.txtname); EditText txtAddressTitle = (EditText) findViewById(R.id.txtAddressTitle); EditText txtAddress = (EditText) findViewById(R.id.txtAddress); EditText txtDescription = (EditText) findViewById(R.id.txtDescription); EditText txtCategory = (EditText) findViewById(R.id.txtCategory); EditText txtLongitude = (EditText) findViewById(R.id.txtLongitute); EditText txtLatitude = (EditText) findViewById(R.id.txtLatitude); EditText txtElevation = (EditText) findViewById(R.id.txtElevation); name = getIntent().getStringExtra("name"); addressTitle = getIntent().getStringExtra("address-title"); addressStreet = getIntent().getStringExtra("address-street"); elevation = getIntent().getDoubleExtra("elevation", 0.00); latitude = getIntent().getDoubleExtra("latitude", 0.00); longitude = getIntent().getDoubleExtra("longitude",0.00); description = getIntent().getStringExtra("description"); category = getIntent().getStringExtra("category"); txtName.setText(name); txtAddressTitle.setText(addressTitle); txtAddress.setText(addressStreet); txtElevation.setText(String.valueOf(elevation)); txtLatitude.setText(String.valueOf(latitude)); txtLongitude.setText(String.valueOf(longitude)); txtDescription.setText(description); txtCategory.setText(category); final int position = getIntent().getIntExtra("position", -1); list = getIntent().getStringArrayListExtra("list"); Button button= (Button) findViewById(R.id.btnDelete); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Delete(name); } }); Button buttonChange= (Button) findViewById(R.id.btnChange); buttonChange.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Change(position, new PlaceDescription(name, description, category, addressTitle, addressStreet, elevation, latitude, longitude)); } }); } private void Delete(String oldName) { db = new DatabaseHelper(getApplicationContext()); Intent intent = new Intent(); int deleted = db.deleteData(oldName); Log.e("DELETE", "Delete: rows were Delete: " + deleted); setResult(RESULT_OK, intent); finish(); } private void Change(int position, PlaceDescription place){ db = new DatabaseHelper(getApplicationContext()); EditText txtName = (EditText) findViewById(R.id.txtname); EditText txtAddressTitle = (EditText) findViewById(R.id.txtAddressTitle); EditText txtAddress = (EditText) findViewById(R.id.txtAddress); EditText txtDescription = (EditText) findViewById(R.id.txtDescription); EditText txtCategory = (EditText) findViewById(R.id.txtCategory); EditText txtLongitude = (EditText) findViewById(R.id.txtLongitute); EditText txtLatitude = (EditText) findViewById(R.id.txtLatitude); EditText txtElevation = (EditText) findViewById(R.id.txtElevation); int added = db.updateData(place.name, txtName.getText().toString(), txtDescription.getText().toString(), txtCategory.getText().toString(), txtAddressTitle.getText().toString(), txtAddress.getText().toString(), Double.parseDouble(txtElevation.getText().toString()), Double.parseDouble(txtLatitude.getText().toString()), Double.parseDouble(txtLongitude.getText().toString())); } @Override public void onBackPressed() { Log.e("delarted", "On back: back button "); Intent intent = new Intent(); setResult(RESULT_OK, intent); finish(); } }
[ "rbotha@asu.edu" ]
rbotha@asu.edu
0f2140fb205fb74d2dfdae8aca515d770cec8e49
ca1fcb54dd1ee6b7e5c1f1d6943ba39dfa54ad2a
/src/main/java/pl/wilczynski/homeplanner/backend/dao/budget/BudgetEntryDao.java
10d411d575d4c4489fa7246171e3377a3e9103ca
[]
no_license
warolsky/homie
96b0a77c3701cc9031b4ce28eb2c6eb0a2ad2dee
e54ae1a22692a0c936aad20d72420af30874d5ca
refs/heads/master
2023-01-05T18:42:15.963476
2020-09-30T18:57:28
2020-09-30T18:57:28
274,617,641
0
0
null
null
null
null
UTF-8
Java
false
false
660
java
package pl.wilczynski.homeplanner.backend.dao.budget; import pl.wilczynski.homeplanner.backend.model.budget.BudgetEntry; import java.util.List; import java.util.Optional; import java.util.UUID; public interface BudgetEntryDao { int insertBudgetEntry(UUID id, BudgetEntry budgetEntry); default int insertBudgetEntry(BudgetEntry budgetEntry){ UUID id = UUID.randomUUID(); return insertBudgetEntry(id, budgetEntry); } List<BudgetEntry> getAllBudgetEntries(); Optional<BudgetEntry> getBudgetEntryById(UUID id); int deleteBudgetEntryById(UUID id); int updateBudgetEntryById(UUID id, BudgetEntry budgetEntry); }
[ "kirinasta@gmail.com" ]
kirinasta@gmail.com
bc1f4a5fb8a0956b67d4294404f2e9b86c54daf0
6378aaac5c260ad05639d4b52f64cdd49e8c8546
/app/src/main/java/mediaid/dt/medical/doctor/mediaiddoctor/beans/HospitalBean.java
eaf429d87f3e6fea93415cbb74bf609258cb2fee
[]
no_license
amanoshan759/MediAid
32951198608ac8d78ec097b492110f31c6502904
4fbfd94cdc90009bbcfedc8b47acff2dcabaf331
refs/heads/master
2021-01-01T19:54:58.052951
2017-07-30T03:08:09
2017-07-30T03:08:12
98,723,697
0
0
null
null
null
null
UTF-8
Java
false
false
1,143
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 mediaid.dt.medical.doctor.mediaiddoctor.beans; /** * @author user */ public class HospitalBean { private int hospital_id; private String hospital_name, hospital_contact, hospital_adress; public int getHospital_id() { return hospital_id; } public void setHospital_id(int hospital_id) { this.hospital_id = hospital_id; } public String getHospital_name() { return hospital_name; } public void setHospital_name(String hospital_name) { this.hospital_name = hospital_name; } public String getHospital_contact() { return hospital_contact; } public void setHospital_contact(String hospital_contact) { this.hospital_contact = hospital_contact; } public String getHospital_adress() { return hospital_adress; } public void setHospital_adress(String hospital_adress) { this.hospital_adress = hospital_adress; } }
[ "amanoshan759@gmail.com" ]
amanoshan759@gmail.com
2002ed74bdef4c852b9616389debc569dddcd006
fb2624b0a5c3b6ae3fb181de8b1bf3fdc38dd4dd
/app/build/generated/source/buildConfig/debug/com/example/dell/weeding/BuildConfig.java
a7d5a4925da8dd74d0d2220004c3bad4c4d52437
[]
no_license
Micevski/Wedding
133c1c824b1edcf57210f3cbd309bde0cc7c5263
820c32c75b07d4fe39ea2ced5f1611f8c1f1ea6a
refs/heads/master
2021-01-25T14:46:51.222998
2018-07-28T17:56:47
2018-07-28T17:56:47
123,728,624
0
0
null
null
null
null
UTF-8
Java
false
false
455
java
/** * Automatically generated file. DO NOT MODIFY */ package com.example.dell.weeding; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.example.dell.weeding"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
[ "davidkocani123@gmail.com" ]
davidkocani123@gmail.com
10146ad1352952fe22f7ca13ca60866daf0ff75c
570f9ab28c530a208a88f2361d1a71eca514667a
/app/src/main/java/com/qiangqiang/frescodemo/MainActivity.java
d52ce9252febae5a1a02fda31baf6b8f84d71d23
[]
no_license
coder7iang/FrescoDemo
8bd46808277996be6d4e9bdd6edea6866d1db22d
7746b6d7ade8c6a35aeb839bd92523e220c30b7e
refs/heads/master
2022-03-14T21:23:39.330742
2019-07-06T13:44:45
2019-07-06T13:44:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,248
java
package com.qiangqiang.frescodemo; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import com.facebook.drawee.view.SimpleDraweeView; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private FrescoUtil util; String imgUrl="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1543313023590&di=bb9e255302ef13884e5f6db603e5329a&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F8%2F5121d1be65259.jpg"; String gifUrl="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1559239992865&di=fde37602ff2d88e80006919163dde337&imgtype=0&src=http%3A%2F%2Fimg5q.duitang.com%2Fuploads%2Fitem%2F201502%2F08%2F20150208174544_t3ZZA.gif"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.image); findViewById(R.id.showStaticMap).setOnClickListener(this); findViewById(R.id.showGifMap).setOnClickListener(this); findViewById(R.id.setGaussianblur).setOnClickListener(this); findViewById(R.id.setRound).setOnClickListener(this); findViewById(R.id.setRounded).setOnClickListener(this); util = new FrescoUtil(this); } @Override public void onClick(View view) { Uri uri = Uri.parse(""); switch (view.getId()) { case R.id.showStaticMap: util.setView(R.id.image).setUri(imgUrl).showStaticMap(); break; case R.id.showGifMap: util.setView(R.id.image).setUri(gifUrl).showGifMap(true); break; case R.id.setGaussianblur: util.setView(R.id.image).setUri(imgUrl).showStaticMap().setGaussianblur(10,10); break; case R.id.setRound: util.setView(R.id.image).setUri(imgUrl).setRound().showStaticMap(); break; case R.id.setRounded: util.setView(R.id.image).setUri(imgUrl).setRounded(50).showStaticMap(); break; } } }
[ "91aqq@sina.com" ]
91aqq@sina.com
1d765b1c7484d63172752a1dfdd4ea2e3937d391
ea5efb9ebcfaee3987e41b7004cc4717601c4095
/Controller.java
038a9656f2b81a32d723569bafdcc38fc8982278
[]
no_license
Krasulenko/HomeworkModule5
3a6845c9d57bf42bdba5978637da272c402809da
c935facb0807f6e265742e5db70a44169cb678f8
refs/heads/master
2021-01-11T19:42:28.526526
2016-09-25T18:53:49
2016-09-25T18:53:49
69,183,601
0
0
null
null
null
null
UTF-8
Java
false
false
1,815
java
package module5; public class Controller { private API apis[] = new API[3]; public Controller() { BookingComAPI bookingComAPI = new BookingComAPI(); apis[0] = bookingComAPI; GoogleAPI googleAPI = new GoogleAPI(); apis[1] = googleAPI; TripAdvisorAPI tripAdvisorAPI = new TripAdvisorAPI(); apis[2] = tripAdvisorAPI; } public Controller(API[] apis) { this.apis = apis; } Room[] requestRooms(int price, int persons, String city, String hotel) { int roomscount = 0; for (int i = 0; i < apis.length; i++) { roomscount += apis[i].findRooms(price, persons, city, hotel).length; } Room[] requestedRoms = new Room[roomscount]; DAOImpl dao = new DAOImpl(); int requstcount = 0; for (API api : apis) { for (Room room : api.findRooms(price, persons, city, hotel)) { requestedRoms[requstcount] = room; dao.save(room); requstcount++; } } return requestedRoms; } Room[] check(API api1, API api2) { Room[] roomsFromApi1 = api1.getAll(); Room[] roomsFromApi2 = api2.getAll(); int sameRoomCount = 0; for (Room room1 : roomsFromApi1) { for (Room room2 : roomsFromApi2) { if (room1.equals(room2)) { sameRoomCount++; } } } Room[] sameroom = new Room[sameRoomCount]; int i = 0; for (Room room1 : roomsFromApi1) { for (Room room2 : roomsFromApi2) { if (room1.equals(room2)) { sameroom[i] = room1; i++; } } } return sameroom; } }
[ "krasul@ukr.net" ]
krasul@ukr.net
29a64ec561a3bc1546d5681102bb72c190bdc6a2
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/LANG-36b-1-1-Single_Objective_GGA-WeightedSum-BasicBlockCoverage/org/apache/commons/lang3/math/NumberUtils_ESTest_scaffolding.java
e31075bdf314a29f67b929ac2af784a53610d67e
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
1,981
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Thu May 14 20:54:21 UTC 2020 */ package org.apache.commons.lang3.math; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class NumberUtils_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.lang3.math.NumberUtils"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(NumberUtils_ESTest_scaffolding.class.getClassLoader() , "org.apache.commons.lang3.math.NumberUtils", "org.apache.commons.lang3.StringUtils" ); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
361cb25f9c1ae757447c7d260bdf59d3177633ee
c033a40dc73b9a86ee180cf0636a1119969b54fc
/src/main/java/org/seckill/entity/SuccessKilled.java
cf34e62aee0594253be84aefdb4a2bcaeee949d1
[]
no_license
QingSongChan/seckill
3d30981a6d40a5eb7525bfea7808d999341c1e57
c38d3a7bb1c14d6c80438745cb16312528fda770
refs/heads/master
2020-04-11T04:31:04.775642
2018-12-12T16:21:44
2018-12-12T16:21:44
161,514,435
0
0
null
null
null
null
UTF-8
Java
false
false
1,115
java
package org.seckill.entity; import java.util.Date; /* *@author:PONI_CHAN *@date:2018/11/12 21:07 */ public class SuccessKilled { private long seckillId; private long userPhone; private short state; private Date createTime; //变通,多对一的复合属性,需要拿到整个seckill的实体 private Seckill seckill; public long getSeckillId() { return seckillId; } public void setSeckillId(long seckillId) { this.seckillId = seckillId; } public long getUserPhone() { return userPhone; } public void setUserPhone(long userPhone) { this.userPhone = userPhone; } public short getState() { return state; } public void setState(short state) { this.state = state; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Seckill getSeckill() { return seckill; } public void setSeckill(Seckill seckill) { this.seckill = seckill; } }
[ "419850688@qq.com" ]
419850688@qq.com
53f0713fa208803239eecb8ddd630b8f6301fac8
87db6eb479c0c2f8e93ca49a8f3c1166d4c67d09
/src/main/java/com/javacodegeeks/ListObjectsApp.java
5f9c0ea5ff55cc358d92d8d8747b7b48e85e25bc
[]
no_license
rchumarin/AmazonS3
2bee44abb683bf8f4f618f2ea54f885d72d35ea9
a47b873f938b8cec00153754504609ea94cd7c9b
refs/heads/master
2020-03-25T10:52:36.966288
2018-08-06T10:00:33
2018-08-06T10:00:33
143,709,099
0
0
null
null
null
null
UTF-8
Java
false
false
1,302
java
package com.javacodegeeks; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.model.ListObjectsV2Request; import com.amazonaws.services.s3.model.ListObjectsV2Result; import com.amazonaws.services.s3.model.S3ObjectSummary; import java.io.IOException; import java.util.logging.Logger; public class ListObjectsApp { private static final Logger LOGGER = Logger.getLogger(ListObjectsApp.class.getName()); public static void main(String[] args) throws IOException { if (args.length < 3) { LOGGER.warning("Please provide the following parameters: <bucket-name> <delimiter> <prefix>"); return; } String bucketName = args[0]; String delimiter = args[1]; String prefix = args[2]; AmazonS3 amazonS3 = AwsClientFactory.createClient(); ListObjectsV2Request listObjectsRequest = new ListObjectsV2Request(); listObjectsRequest.setBucketName(bucketName); listObjectsRequest.setDelimiter(delimiter); listObjectsRequest.setPrefix(prefix); ListObjectsV2Result result = amazonS3.listObjectsV2(listObjectsRequest); for (S3ObjectSummary summary : result.getObjectSummaries()) { LOGGER.info(summary.getKey() + ":" + summary.getSize()); } } }
[ "rchumarin@gmail.com" ]
rchumarin@gmail.com
88a8c3736e6d09d96cb5af2831f96c50f48300e0
68c7969c4ae1cd9065d7587cb78756e5283591b7
/catmodules/catcore/src/main/java/com/core/distributed/transaction/CatTransactionEngine.java
f2e3deb0c388e9d53f5675ac3b0f61a22228ef22
[]
no_license
young-person/bobo
aed6f37766e595a0283ec102dbe35baf643ffcf7
693d0104780947dcb31f24425fa0a236f9136135
refs/heads/master
2022-12-11T04:48:02.305237
2019-12-16T14:06:41
2019-12-16T14:06:41
185,199,606
0
0
null
2022-12-06T00:42:45
2019-05-06T13:12:51
TSQL
UTF-8
Java
false
false
5,827
java
package com.core.distributed.transaction; import com.core.distributed.CatParticipant; import com.core.distributed.CatTransaction; import com.core.distributed.context.TransactionContextBean; import com.core.distributed.context.TransactionContextLocal; import com.core.distributed.service.mq.SendMessageService; import com.core.distributed.disruptor.CatTransactionEventPublisher; import com.bobo.enums.JTAEnum; import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.reflect.MethodSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Method; import java.util.Objects; import java.util.Optional; /** * 创建事物引擎 */ public abstract class CatTransactionEngine { private static final Logger logger = LoggerFactory.getLogger(CatTransactionEngine.class); /** * 使用本地线程进行保存 */ private static final ThreadLocal<CatTransaction> CURRENT = new ThreadLocal<CatTransaction>(); /** * 注入事物发布事件者 */ private CatTransactionEventPublisher publisher; /** * 注入事物发布服务 */ private SendMessageService messageService; public abstract CatTransactionEventPublisher getPublisher(); public abstract SendMessageService getTransactionMessageService(); /** * 开始项目分布式事物 * @param point */ public void begin(final ProceedingJoinPoint point) { logger.info("开始分布式事物"); CatTransaction transaction = buildTransaction(point, JTAEnum.START.getCode(),JTAEnum.BEGIN.getCode(), ""); publisher.publishEvent(transaction, JTAEnum.SAVE.getCode()); //将当前事务对象信息 存入当前线程上下文 CURRENT.set(transaction); TransactionContextBean contextBean = new TransactionContextBean(); contextBean.setTransId(transaction.getTransId()); //设置为发起者角色 contextBean.setRole(JTAEnum.START.getCode()); TransactionContextLocal.getInstance().set(contextBean);//将 事物上下文 保存到 } /** * 失败事物信息回改 * @param errorMsg */ public void failTransaction(final String errorMsg) { CatTransaction transaction = get(); if (Objects.nonNull(transaction)) { transaction.setStatus(JTAEnum.FAILURE.getCode()); transaction.setErrorMsg(errorMsg); publisher.publishEvent(transaction, JTAEnum.UPDATE_FAIR.getCode()); } } /** * 参与者 * @param point * @param transactionContext */ public void actorTransaction(final ProceedingJoinPoint point, final TransactionContextBean transactionContext) { CatTransaction transaction = buildTransaction(point,JTAEnum.PROVIDER.getCode(),JTAEnum.BEGIN.getCode(),transactionContext.getTransId()); //发布事务保存事件,异步保存 publisher.publishEvent(transaction, JTAEnum.SAVE.getCode()); //事务信息会写到本地线程 CURRENT.set(transaction); transactionContext.setRole(JTAEnum.PROVIDER.getCode()); TransactionContextLocal.getInstance().set(transactionContext); } /** * 更新事务状态 * @param status */ public void updateStatus(final int status) { CatTransaction transaction = get(); Optional.ofNullable(transaction) .map(t -> { t.setStatus(status); return t; }).ifPresent(t -> publisher.publishEvent(t, JTAEnum.UPDATE_STATUS.getCode())); transaction.setStatus(JTAEnum.COMMIT.getCode()); } /** * 创建一个连接事物对象 * @param point * @param role * @param status * @param transId * @return */ private CatTransaction buildTransaction(final ProceedingJoinPoint point, final int role,final int status, final String transId) { CatTransaction mythTransaction; if (StringUtils.isNoneBlank(transId)) { mythTransaction = new CatTransaction(transId); } else { mythTransaction = new CatTransaction(); } MethodSignature signature = (MethodSignature) point.getSignature(); Method method = signature.getMethod(); Class<?> clazz = point.getTarget().getClass(); mythTransaction.setStatus(status); mythTransaction.setRole(role); mythTransaction.setTargetClass(clazz.getName()); mythTransaction.setTargetMethod(method.getName()); return mythTransaction; } /** * 添加事物参与者 * @param participant */ public void registerParticipant(final CatParticipant participant) { init(); final CatTransaction transaction = get(); //添加事务参与者 transaction.registerParticipant(participant); publisher.publishEvent(transaction, JTAEnum.UPDATE_PARTICIPANT.getCode()); } /** * 具体发送消息 */ public void sendMessage() { Optional.ofNullable(get()).ifPresent(c -> messageService.sendMessage(c)); } /** * 程序初始化 */ private void init(){ publisher = getPublisher(); messageService = getTransactionMessageService(); } private CatTransaction get(){ return CURRENT.get(); } /** * 判断是否有事物进来 * @return */ public boolean isBegin() { return CURRENT.get() != null; } /** * 清除容器 */ public void cleanThreadLocal() { CURRENT.remove(); } }
[ "czb199345" ]
czb199345
9a14152d07d24853c86e7289f5a6116eed516adb
82ee8c2c7eacec9cd3f32daa6f946885eab79ed2
/services/Utilities.java
4e5818de07fd27ee988f23945aa897bec11363f0
[]
no_license
imthomas93/CZ3004_MDP-Grp18
161b18a23b1b21ff3f2d7451f051c9194825bf32
83af5e5c419ef945378fa6c7ef80b94f4fc15076
refs/heads/master
2021-01-20T10:51:23.910999
2017-09-20T16:10:10
2017-09-20T16:10:10
101,653,824
1
0
null
null
null
null
UTF-8
Java
false
false
5,064
java
package cz3004MDP.services; import java.io.File; import java.io.IOException; import java.math.BigInteger; import java.util.ArrayList; import java.util.Scanner; import cz3004MDP.models.ArenaRobot; import cz3004MDP.models.Grid; import java.io.PrintStream; public class Utilities implements ArenaRobot{ public Grid[][] importMap(String fileName, Grid[][] grid){ ArrayList<String> arena = new ArrayList<String>(); arena = getArenaFromFile(FILENAME1); String exploreBin = ""; String obstacleBin = ""; int expCounter = 0; int obsCounter = 0; exploreBin = hexToBinary(arena.get(0)); obstacleBin = hexToBinary(arena.get(1)); // remove the start and end "11" from explore string exploreBin = exploreBin.substring(2, exploreBin.length()-2); for(int i = ROW-1; i>=0;i--){ for(int j = 0; j<COLUMN; j++){ if(exploreBin.charAt(expCounter) == '1'){ // visited grid[i][j].setVisited(true); if(obstacleBin.charAt(obsCounter) == '1'){ // contain obstacle = not a clear grid grid[i][j].setObstacle(true); grid[i][j].setClearGrid(false); } else{ // does not contain obstacle = a clear grid grid[i][j].setObstacle(false); grid[i][j].setClearGrid(true); } } else{ grid[i][j].setVisited(false); grid[i][j].setObstacle(false); grid[i][j].setClearGrid(false); } expCounter++; obsCounter++; } } return grid; } public ArrayList<String> exportMap(Grid[][] grid){ String exploreBin = ""; String obstacleBin = ""; ArrayList<String> result = new ArrayList<String>(); for (int i = ROW-1; i >= 0; i--) { for (int j = 0; j < COLUMN; j++) { if(!grid[i][j].isVisited()) // grid is not yet visited exploreBin = concat(exploreBin, "0"); else{ exploreBin = concat(exploreBin, "1"); if(!grid[i][j].isObstacle()) // grid do not contain an obstacle obstacleBin = concat(obstacleBin, "0"); else obstacleBin = concat(obstacleBin, "1"); } } } // start and end string must contain "11" exploreBin = "11" + exploreBin + "11"; String exploreHexResult = binaryToHex(exploreBin); result.add(exploreHexResult); obstacleBin = padBitstreamToFullByte(obstacleBin); String obstacleHexResult = binaryToHex(obstacleBin); result.add(obstacleHexResult); return result; } public String binaryToHex(String binary){ int counter = 1; int sum = 0; String result = ""; for(int i = 0; i <binary.length(); i++){ if (counter == 1) sum = sum + Integer.parseInt(binary.charAt(i) + "")*8; else if (counter == 2) sum = sum + Integer.parseInt(binary.charAt(i) + "")*4; else if (counter == 3) sum = sum + Integer.parseInt(binary.charAt(i) + "")*2; else if(counter == 4 || i < binary.length()+1){ sum = sum + Integer.parseInt(binary.charAt(i) + "")*4; counter = 0; if (sum < 10) result = concat(result,String.valueOf(sum)); else if(sum == 10) result = concat(result,"A"); else if(sum == 11) result = concat(result,"B"); else if(sum == 12) result = concat(result,"C"); else if(sum == 13) result = concat(result,"D"); else if(sum == 14) result = concat(result,"E"); else if(sum == 15) result = concat(result,"F"); sum=0; } counter ++; } return result; } private String concat(String hex, String valueOf) { // TODO Auto-generated method stub hex = hex+valueOf; return hex; } public String hexToBinary(String hex){ int length = hex.length()*4; String result = new BigInteger(hex, 16).toString(2); if (result.length() < length){ int diff = length = result.length(); String pad = ""; for (int i = 0; i < diff; ++i){ pad = pad.concat("0"); } result = pad.concat(result); } return result; } private String padBitstreamToFullByte(String bitstream) { if (bitstream.length() % 8 == 0) return bitstream; else { String fullByteBitStream = bitstream; int remainder = bitstream.length()%8; for(int i = 0; i<remainder; i++) { fullByteBitStream = concat(fullByteBitStream, "0"); } return fullByteBitStream; } } public void saveArenaToFile(String fn, ArrayList<String> arenaDetails){ File file = new File(fn); try{ if (file.exists()){ file.delete(); file.createNewFile(); } PrintStream fileStream = new PrintStream(file); for (int i = 0; i < arenaDetails.size();i++){ fileStream.println(arenaDetails.get(i)); } fileStream.close(); }catch(IOException ioe){ ioe.printStackTrace(); } } public ArrayList<String> getArenaFromFile(String fn){ ArrayList<String> result = new ArrayList<String>(); File file = new File(fn); try{ Scanner sc = new Scanner(file); while(sc.hasNext()){ result.add(sc.next()); } sc.close(); } catch(IOException ioe){ ioe.printStackTrace(); } return result; } }
[ "thomaslim93@gmail.com" ]
thomaslim93@gmail.com
1d0980a8534d869a5e79578ef2787eff438b4041
7f7c0ee0efc37528e7a9a6c96b240515b751eee1
/src/main/java/leetcode/Problem1237.java
894e94df91182a059aa4d607af78a6e73282e970
[ "MIT" ]
permissive
fredyw/leetcode
ac7d95361cf9ada40eedd8925dc29fdf69bbb7c5
3dae006f4a38c25834f545e390acebf6794dc28f
refs/heads/master
2023-09-01T21:29:23.960806
2023-08-30T05:45:58
2023-08-30T05:45:58
28,460,187
7
1
null
null
null
null
UTF-8
Java
false
false
911
java
package leetcode; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * https://leetcode.com/problems/find-positive-integer-solution-for-a-given-equation/ */ public class Problem1237 { interface CustomFunction { // Returns f(x, y) for any given positive integers x and y. // Note that f(x, y) is increasing with respect to both x and y. // i.e. f(x, y) < f(x + 1, y), f(x, y) < f(x, y + 1) int f(int x, int y); } public List<List<Integer>> findSolution(CustomFunction customfunction, int z) { List<List<Integer>> answer = new ArrayList<>(); for (int x = 1; x <= 1000 && x <= z; x++) { for (int y = 1; y <= 1000 && y <= z; y++) { if (customfunction.f(x, y) == z) { answer.add(Arrays.asList(x, y)); } } } return answer; } }
[ "fredy.wijaya@gmail.com" ]
fredy.wijaya@gmail.com
30676d398fe409c8037b618c8919ed7ccd6a82ef
725966f04fee8650191b26af37447e821739e3a6
/app/src/main/java/nz/co/jonker/dagger2trial/data/ApiInterface.java
97dc9b8683dc05c77947b08353ca0380684a344f
[]
no_license
danieljonker/dagger2trial
64defa8d396349bddf9e2f8bd464441b4d7e8bd5
3e0649a3c023cdffd977281b988ae8d62d602a59
refs/heads/master
2021-01-12T22:38:13.803115
2015-05-18T07:53:10
2015-05-18T07:53:10
35,652,625
2
0
null
null
null
null
UTF-8
Java
false
false
314
java
package nz.co.jonker.dagger2trial.data; import nz.co.jonker.dagger2trial.data.models.CourseResponse; import retrofit.Callback; import retrofit.http.GET; /** * Created by datacom_mobile01 on 15/05/15. */ public interface ApiInterface { @GET("/courses") void listCourses(Callback<CourseResponse> cb); }
[ "daniel.l.jonker@gmail.com" ]
daniel.l.jonker@gmail.com
c47042123585b51376d06e746819fe61c2da8517
c2d8181a8e634979da48dc934b773788f09ffafb
/storyteller/output/mazdasalestool/SetExhibitionReportVisitmotivationnewspaperadAction.java
8e653266ae3fe5a6ec7e9318c0f0fb2487f2adf1
[]
no_license
toukubo/storyteller
ccb8281cdc17b87758e2607252d2d3c877ffe40c
6128b8d275efbf18fd26d617c8503a6e922c602d
refs/heads/master
2021-05-03T16:30:14.533638
2016-04-20T12:52:46
2016-04-20T12:52:46
9,352,300
0
0
null
null
null
null
UTF-8
Java
false
false
1,767
java
package net.mazdasalestool.web; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.mazdasalestool.model.*; import net.mazdasalestool.model.crud.*; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.hibernate.Criteria; import org.hibernate.Transaction; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.SessionFactory; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.BeanFactory; import org.springframework.web.context.support.WebApplicationContextUtils; import net.enclosing.util.HibernateSession; import net.enclosing.util.HTTPGetRedirection; public class SetExhibitionReportVisitmotivationnewspaperadAction extends Action{ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception{ Session session = new HibernateSession().currentSession(this .getServlet().getServletContext()); Transaction transaction = session.beginTransaction(); Criteria criteria = session.createCriteria(ExhibitionReport.class); criteria.add(Restrictions.idEq(Integer.valueOf(req.getParameter("id")))); ExhibitionReport exhibitionReport = (ExhibitionReport) criteria.uniqueResult(); exhibitionReport.setVisitmotivationnewspaperad(true); session.saveOrUpdate(exhibitionReport); transaction.commit(); session.flush(); new HTTPGetRedirection(req, res, "ExhibitionReports.do", exhibitionReport.getId().toString()); return null; } }
[ "toukubo@gmail.com" ]
toukubo@gmail.com
a02b65b7fdec59551b9283eeeb8952084b4c3dc3
786b695f613a90c565018cde4ef4cc1cf83bfc5b
/src/main/java/com/fms/farm/service/FetchJobStatusDataFromDB.java
a660518997d05f35fd2a056687a66a4250db1f35
[]
no_license
sajalsinghal7/farm
af0d294bbf799c16456312e5ea0ccb6b55517ac6
39204854b0129c5408f5218cde520b581570241a
refs/heads/main
2023-04-02T23:32:53.370712
2021-04-11T09:21:10
2021-04-11T09:21:10
345,909,005
0
0
null
null
null
null
UTF-8
Java
false
false
2,488
java
package com.fms.farm.service; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBQueryExpression; import com.amazonaws.services.dynamodbv2.document.DynamoDB; import com.amazonaws.services.dynamodbv2.document.Item; import com.amazonaws.services.dynamodbv2.document.ItemCollection; import com.amazonaws.services.dynamodbv2.document.QueryOutcome; import com.amazonaws.services.dynamodbv2.document.Table; import com.amazonaws.services.dynamodbv2.document.spec.QuerySpec; import com.amazonaws.services.dynamodbv2.document.utils.ValueMap; import com.amazonaws.services.dynamodbv2.model.AttributeValue; import com.amazonaws.services.dynamodbv2.model.QueryRequest; import com.fms.farm.dao.UploadJobStatusDynamoDb; @Service public class FetchJobStatusDataFromDB { @Autowired public AmazonDynamoDB amazonDynamoDB; public List<UploadJobStatusDynamoDb> getAll() { // QueryRequest queryRequest = new QueryRequest().withTableName("upload_job_status"); // UploadJobStatusDynamoDb hashEntity = new UploadJobStatusDynamoDb(); // hashEntity.setId("1"); // // DynamoDBQueryExpression<UploadJobStatusDynamoDb> queryExpression = new DynamoDBQueryExpression<UploadJobStatusDynamoDb>(); // queryExpression.withIndexName("id"); // return dynamoDBMapper.query(UploadJobStatusDynamoDb.class, queryExpression); DynamoDB db = new DynamoDB(amazonDynamoDB); Table table = db.getTable("upload_job_status"); QuerySpec querySpec = new QuerySpec(); querySpec.withKeyConditionExpression("id = :v_id"); querySpec.withValueMap(new ValueMap().withString(":v_id", "job1")); ItemCollection<QueryOutcome> uploadedJobStatus = table.query(querySpec); Iterator<Item> iterator = uploadedJobStatus.iterator(); List<UploadJobStatusDynamoDb> result = new ArrayList<UploadJobStatusDynamoDb>(); while (iterator.hasNext()) { Map<String, Object> tmp = iterator.next().asMap(); result.add(new UploadJobStatusDynamoDb(tmp.get("id").toString(), tmp.get("status").toString(), tmp.get("createDate").toString(), tmp.get("endDate").toString())); } return result; } }
[ "sajalsinghal7@gmail.com" ]
sajalsinghal7@gmail.com
9983b0e6276b4db10ccc678165dd05b6af73f289
18bc676cc3eba13ac949663ba599e45d11774bb6
/Cinema_menu.java
2383c3cf243fc8cd03fc0402eff6e37c10a17fb0
[]
no_license
MarcusGriffiths/Cinema_Ticket_System2
1733367d37046d89da4b88e8001d45616604ef2f
6681b5e42bbf17316cb3a25795ace6db7d3b4e2b
refs/heads/master
2020-12-03T04:15:40.523831
2017-06-30T02:34:32
2017-06-30T02:34:32
95,839,963
0
0
null
null
null
null
UTF-8
Java
false
false
1,992
java
package cinema; import java.util.Scanner; public class Cinema_menu { //Scanner is how the user inputs text onto the screen. //object is called scan, what ever gets typed on screen gets stored in variable. //what ever gets put in can be accessed by using the scan method. static Scanner scan = new Scanner(System.in); //variables static String name; static String[] movielist = {"1. Fifty Shades Darker","2. Transformers 5","3. WonderWoman","4. Baywatch","5. The Mummy" }; static int QuantityAndTicket; static int number; public static void getName() { System.out.println("Enter First Name"); name = scan.nextLine(); System.out.println("Hello " +name+"\nPlease choose your required film"); getMovie(); } private static void getMovie() { for (int i=0;i<movielist.length;i++) { System.out.println(movielist[i]); } number = scan.nextInt(); System.out.println("You have selected "+movielist[number-1].substring(3, movielist[number-1].length())); getQuantityAndTicket(); } public static void getFilm() { System.out.println("Select A Film"); String name = scan.nextLine(); System.out.println(name); } public static void getPrice() { sum s = new sum(); System.out.println("Select A Film"); String name = scan.nextLine(); System.out.println(name); System.out.println("Total cost = " + s); } public static void getQuantityAndTicket() { System.out.println("Select how many tickets you require, and choose the type of ticket you wish to purchase"); QuantityAndTicket = Integer.parseInt(scan.next()); System.out.println("ThankYou\nYou have selected " +QuantityAndTicket+ " ticket(s) for "+movielist[number-1].substring(3, movielist[number-1].length())); sum sum = new sum(); sum.sumMethod(); } //Main method - heart of the programme when run system looks for main method. public static void main(String [] args){ getName(); } // TODO Auto-generated method stub }
[ "noreply@github.com" ]
MarcusGriffiths.noreply@github.com
e09749de9a1d732a63bd3829a1b45c1b2b01a86a
b1d9c5617e24e7ade724d7bfbf0e6aaf5a5ed2d9
/DevonApp3/DevonApp3/DevonApp3.Android/obj/Debug/android/src/md5b60ffeb829f638581ab2bb9b1a7f4f3f/SwitchRenderer.java
e18fe0f9bcd70dd0880c4aa27beba4a15662fab8
[ "MIT" ]
permissive
DevonEnergyHackathon2017/Enaxis
e0107a5f45e1cd9459c979a746246a2b44df3556
99b2d76e0537a7121027fb83bdf4a8e62d6de94e
refs/heads/master
2021-08-22T22:54:21.287613
2017-12-01T14:45:50
2017-12-01T14:45:50
111,435,887
0
4
MIT
2017-12-01T14:45:51
2017-11-20T16:35:01
null
UTF-8
Java
false
false
2,983
java
package md5b60ffeb829f638581ab2bb9b1a7f4f3f; public class SwitchRenderer extends md5b60ffeb829f638581ab2bb9b1a7f4f3f.ViewRenderer_2 implements mono.android.IGCUserPeer, android.widget.CompoundButton.OnCheckedChangeListener { /** @hide */ public static final String __md_methods; static { __md_methods = "n_onCheckedChanged:(Landroid/widget/CompoundButton;Z)V:GetOnCheckedChanged_Landroid_widget_CompoundButton_ZHandler:Android.Widget.CompoundButton/IOnCheckedChangeListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + ""; mono.android.Runtime.register ("Xamarin.Forms.Platform.Android.SwitchRenderer, Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", SwitchRenderer.class, __md_methods); } public SwitchRenderer (android.content.Context p0, android.util.AttributeSet p1, int p2) { super (p0, p1, p2); if (getClass () == SwitchRenderer.class) mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.SwitchRenderer, Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", this, new java.lang.Object[] { p0, p1, p2 }); } public SwitchRenderer (android.content.Context p0, android.util.AttributeSet p1) { super (p0, p1); if (getClass () == SwitchRenderer.class) mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.SwitchRenderer, Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0, p1 }); } public SwitchRenderer (android.content.Context p0) { super (p0); if (getClass () == SwitchRenderer.class) mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.SwitchRenderer, Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0 }); } public void onCheckedChanged (android.widget.CompoundButton p0, boolean p1) { n_onCheckedChanged (p0, p1); } private native void n_onCheckedChanged (android.widget.CompoundButton p0, boolean p1); 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 (); } }
[ "rthai@enaxisconsulting.com" ]
rthai@enaxisconsulting.com
209a04de4d759e9f57878ea8b02f0fe878728e3d
8e3ff0fc9e9f3c275d52bddd7a760e6eff02628c
/src/KeyChecker.java
e53d30fabc4a4753e3b5b6e0fcf65e864841050b
[]
no_license
ackolandjian/StackOverflowSolutions
02cfd50961a6daf65074720392d177d259b4d0cf
549f5ca9f4852f8cb5448b0934a0fa608fe961c3
refs/heads/main
2023-01-04T10:17:49.924405
2020-10-26T12:33:49
2020-10-26T12:33:49
302,587,823
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class KeyChecker extends KeyAdapter implements KeyListener{ GamePanel panel; public KeyChecker(GamePanel panel) { this.panel = panel; } public void keyPressed(KeyEvent e) { System.out.println("pressed"); panel.KeyPressed(e); } public void keyReleased(KeyEvent e) { panel.KeyReleased (e); } }
[ "noreply@github.com" ]
ackolandjian.noreply@github.com
99748f773f241b13067dde1f899b7c7dab755523
971931038a9a18bf962a787a4962020e10b36e9e
/src/com/ccj/event/service/IsRepeat.java
a6b38c38527fbca27110ae180e9531ca8deb1afc
[]
no_license
HTD1653451124/cat
3bfcd5c0699cce32a1053b1cd2233bffe10b38c2
b3f88a0a44ae8404e8143f70686249b34239f652
refs/heads/master
2023-04-09T13:47:37.586239
2021-04-22T13:47:06
2021-04-22T13:47:06
360,482,067
0
0
null
null
null
null
UTF-8
Java
false
false
1,106
java
package com.ccj.event.service; import com.ccj.event.dao.IIsRepeat; import com.ccj.event.util.JDBCUtil; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class IsRepeat implements IIsRepeat<Boolean> { /* * 注册时检测账号是否存在 * */ @Override public Boolean isRepeat(String account){ if (account == null){ return false; } Connection conn = null; PreparedStatement pstmt= null; ResultSet rs = null; try{ conn = JDBCUtil.getConnection(); String sql = "select * from user "; pstmt = conn.prepareStatement(sql); rs = pstmt.executeQuery(); while (rs.next()){ if (account.equals(rs.getString("account"))){ return false; } } } catch (SQLException throwables) { throwables.printStackTrace(); }finally { JDBCUtil.close(rs,pstmt,conn); } return true; } }
[ "1653451124@qq.com" ]
1653451124@qq.com
c07d121e109aff64b5c347ebbb46a592cc867a18
a405c5208ca3cde409d57b8f96d2fe1708402ef1
/app/src/main/java/com/wang/administrator/itemdecorationdemo/IndexView.java
a1603fbebfc520f11e78d03948da7fb486107a25
[]
no_license
CondingBoy/ItemDecorationDemo
e1aa2ce53dfca94e57774ca70b2e907420c1c36d
c779269ed540bff66b82d867f215bcf7b12da0e0
refs/heads/master
2020-06-12T16:39:14.883023
2016-12-13T16:49:19
2016-12-13T16:49:19
75,714,877
0
0
null
null
null
null
UTF-8
Java
false
false
6,490
java
package com.wang.administrator.itemdecorationdemo; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.nfc.Tag; import android.util.AttributeSet; import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; import java.util.Arrays; import java.util.List; /** * Created by Administrator on 2016/12/7. */ public class IndexView extends View { private int textSize; private int bgColor; public static String[] INDEX_STRING = {"A", "B", "C", "D", "E", "F", "G", "H", "I","J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V","W", "X", "Y", "Z", "#"};//#在最后面(默认的数据源) private List<String> mIndexDatas;//索引数据源 private int mGapHeight;//每个index区域的高度 private Paint mPaint; private int mHeight; private int mWidth; private onIndexBarPressListener listener; public IndexView(Context context) { super(context); } public IndexView(Context context, AttributeSet attrs) { super(context, attrs); init(context,attrs); } private void init(Context context, AttributeSet attrs) { mIndexDatas = Arrays.asList(INDEX_STRING);//数据源 TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.IndexBar); //默认字体16sp textSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,16,context.getResources().getDisplayMetrics()); //默认背景颜色为黑色 bgColor = Color.BLACK; for (int i=0;i<typedArray.getIndexCount();i++){ int attr = typedArray.getIndex(i); switch (attr){ case R.styleable.IndexBar_textSize: textSize = typedArray.getDimensionPixelSize(R.styleable.IndexBar_textSize, textSize); break; case R.styleable.IndexBar_pressBackground: bgColor = typedArray.getColor(R.styleable.IndexBar_pressBackground, bgColor); break; } } mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setTextSize(textSize); typedArray.recycle(); } public IndexView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int wSize = MeasureSpec.getSize(widthMeasureSpec); int wMode = MeasureSpec.getMode(widthMeasureSpec); int hSize = MeasureSpec.getSize(heightMeasureSpec); int hMode = MeasureSpec.getMode(heightMeasureSpec); int mesureWidth = 0,mesureHeight = 0;//最终测量的宽高 //得到合适的宽度 Rect indexBounds = new Rect();//存放每个Index的Rect区域 for (int i=0;i<mIndexDatas.size();i++){ String s = mIndexDatas.get(i); mPaint.getTextBounds(s,0,s.length(),indexBounds);//测量文字所在矩形,可以得到宽高 mesureWidth=Math.max(mesureWidth,mesureWidth = indexBounds.width()); mesureHeight=Math.max(mesureHeight,indexBounds.height());//循环后得到index的最大高度和宽度 } mesureHeight *= mIndexDatas.size(); switch (wMode){ case MeasureSpec.EXACTLY: mesureWidth=wSize; break; case MeasureSpec.AT_MOST: mesureWidth = Math.min(mesureWidth,wSize);//此时wSize是父控件能给出的最大宽度 break; case MeasureSpec.UNSPECIFIED: break; } switch (hMode){ case MeasureSpec.EXACTLY: mesureHeight=hSize; break; case MeasureSpec.AT_MOST: mesureHeight = Math.min(mesureHeight,hSize);//此时wSize是父控件能给出的最大高度 break; case MeasureSpec.UNSPECIFIED: break; } setMeasuredDimension(mesureWidth,mesureHeight); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mHeight = getMeasuredHeight(); mWidth = getMeasuredWidth(); mGapHeight= (mHeight-getPaddingTop()-getPaddingBottom())/mIndexDatas.size(); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); mPaint.setColor(Color.BLACK); int panddingTop = getPaddingTop();//绘制index的基准点 Rect indexBounds = new Rect(); for(int i=0;i<mIndexDatas.size();i++){ String s = mIndexDatas.get(i); mPaint.getTextBounds(s,0,s.length(),indexBounds); Paint.FontMetrics fontMetrics = mPaint.getFontMetrics(); int baseLine = (int) ((mGapHeight-fontMetrics.bottom-fontMetrics.top)/2); canvas.drawText(s,mWidth/2-indexBounds.width()/2,panddingTop+mGapHeight*i+baseLine,mPaint); } } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()){ case MotionEvent.ACTION_DOWN: setBackgroundColor(bgColor); case MotionEvent.ACTION_MOVE: float y = event.getY(); //通过计算判断落点在那个区域 int posY= (int) ((y-getPaddingTop())/mGapHeight); if(posY<0){ posY=0; } if(posY>=mIndexDatas.size()){ posY=mIndexDatas.size()-1; } //回调监听器 if(listener!=null){ listener.onIndexPress(posY,mIndexDatas.get(posY)); } break; case MotionEvent.ACTION_UP: default: setBackgroundColor(Color.TRANSPARENT); if(listener!=null){ listener.onIndexUp(); } } return true; } public interface onIndexBarPressListener{ void onIndexPress(int position,String tag); void onIndexUp(); } public void setOnIndexBarPressListener(onIndexBarPressListener listener){ this.listener=listener; } }
[ "2313361086@qq.com" ]
2313361086@qq.com
c9c0ceabc62e0c69608a421fe58d1d0d58728859
e7b357db4b48110f5121db84a9d94772f8a9490f
/service-sleuth-client-frontEnd/src/main/java/com/cloud/sleuth/SleuthApplication.java
6b2c772cff9b737cb15422a84a3d2843ac0ddcfe
[]
no_license
feiyeguohai/SpringCloudTest
92044495fa7568d2b4b5faf09f67f31c6f8cafc8
01eb2b467dc22df7dda495ac132eac10abd2694c
refs/heads/master
2021-01-17T15:56:49.780313
2017-12-22T07:26:14
2017-12-22T07:26:14
95,429,651
0
0
null
null
null
null
UTF-8
Java
false
false
1,556
java
package com.cloud.sleuth; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.annotation.Bean; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; @SpringBootApplication @EnableDiscoveryClient @RestController public class SleuthApplication { private static Logger log = LoggerFactory.getLogger(SleuthApplication.class); @RequestMapping("/hello") public String home(String name) { log.info("Handling home"); return "i am frontEnd.Hello World " + name; } @Autowired private RestTemplate restTemplate; /* * @LoadBalanced is needed, or it will not recognize service name in restTemplate url. */ @Bean @LoadBalanced public RestTemplate getRestTemplate(){ return new RestTemplate(); } @RequestMapping("/call") public String callBackEnd(String name) { log.info("call trace back end!"); return restTemplate.getForObject("http://SERVICE-SLEUTH-CLIENT-BACKEND/answer?name="+name, String.class); } public static void main(String[] args) { SpringApplication.run(SleuthApplication.class, args); } }
[ "york1@huawei.com" ]
york1@huawei.com
669107644f64d3e2da6f0b457684ad2402113674
f6548fff1d5e366567ee45acddfec7ad8b080511
/servletJSPExample/src/tutoial/myExample.java
9ee5111662b5b7510e05510aa7a1ca1e4959b2f8
[]
no_license
Bing-Cheng/servlet
a6b6ddbd642e8d301fc185111fcdef82ceedfd6d
6fa739fe6256175389b1711da3a06a5cb454a820
refs/heads/master
2021-01-22T11:59:17.073211
2013-04-22T05:05:59
2013-04-22T05:05:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,823
java
package tutoial; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class myExample */ @WebServlet("/myExample") public class myExample extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public myExample() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response) */ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); if(request.getParameter("user")==null) { getServletContext().getRequestDispatcher("/index.jsp").forward(request,response); //return; } String userName = request.getParameter("user"); out.println("hello world" + userName); //request.setAttribute("user",userName); //getServletContext().getRequestDispatcher("/output.jsp").forward(request,response); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
[ "Aimee@172.31.17.33" ]
Aimee@172.31.17.33
07fd80809b22e577ec158d38500c5515615beb7e
091d0b54be580d4dbfedc9386567fa6decc440cd
/visiteo/app/src/main/java/com/appsolute/cel/DAO/CEL_Actions_DAO.java
6502ba6d3a63363ed30b3ae99888ef40554a7bf4
[]
no_license
AbderrahmenBriki/visiteo
b454c8831ec9de611023506e762ea076db7c1ea9
633c2352fb3717f7571d226d4becd0f266240892
refs/heads/master
2021-07-22T12:34:21.827807
2017-10-26T01:37:38
2017-10-26T01:37:38
108,344,911
0
0
null
null
null
null
UTF-8
Java
false
false
6,523
java
package com.appsolute.cel.DAO; import java.util.ArrayList; import java.util.List; import com.appsolute.cel.models.CEL_Actions; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; public class CEL_Actions_DAO extends CEL_Database_DAO { public CEL_Actions_DAO(Context pContext) { super(pContext); // TODO Auto-generated constructor stub } public static final String ACTIONS_TABLE = "CEL_Actions"; public static final String KEY = "idActions"; public static final String ACTION_ACTIONS = "actionActions"; public static final String QUANTITE_ACTIONS = "quantiteActions"; public static final String UNITE_ACTIONS = "uniteActions"; public static final String NOTE_ACTIONS = "noteActions"; public static final String ID_ELEMENT = "idElement"; public static final String TABLE_CREATE = "CREATE TABLE " + ACTIONS_TABLE + " (" + KEY + " INTEGER PRIMARY KEY, " + ACTION_ACTIONS + " TEXT, " + QUANTITE_ACTIONS + " REAL, " + UNITE_ACTIONS + " TEXT, " + NOTE_ACTIONS + " TEXT, " + ID_ELEMENT + " INTEGER, " + " FOREIGN KEY ("+ID_ELEMENT+") REFERENCES "+CEL_Elements_DAO.ELEMENTS_TABLE+" ("+CEL_Elements_DAO.KEY+"));" ; public static final String TABLE_DROP = "DROP TABLE IF EXISTS " + ACTIONS_TABLE + ";"; /** * Insert new value on CEL_Actions * * @param action */ public void addValue(CEL_Actions action) { open(); ContentValues value = new ContentValues(); value.put(ACTION_ACTIONS, action.getActionActions()); value.put(QUANTITE_ACTIONS, action.getQuantiteActions()); value.put(UNITE_ACTIONS, action.getUniteActions()); value.put(NOTE_ACTIONS, action.getNoteActions()); value.put(ID_ELEMENT, action.getIdElement()); operaDataBase.insert(ACTIONS_TABLE, null, value); close(); } /** * Delete an CEL_Actions value from an Id * @param idAction */ public void deleteValue(int idAction) { open(); operaDataBase.delete(ACTIONS_TABLE, KEY + " = ?", new String[]{String.valueOf(idAction)}); close(); } public void deleteValueFromIdElement(int idElement) { open(); operaDataBase.delete(ACTIONS_TABLE, ID_ELEMENT + " = ?", new String[]{String.valueOf(idElement)}); close(); } /** * Update/Modify a CEL_Actions * @param action */ public void updateValue(CEL_Actions action) { open(); ContentValues value = new ContentValues(); value.put(ACTION_ACTIONS, action.getActionActions()); value.put(QUANTITE_ACTIONS, action.getQuantiteActions()); value.put(UNITE_ACTIONS, action.getUniteActions()); value.put(NOTE_ACTIONS, action.getNoteActions()); value.put(ID_ELEMENT, action.getIdElement()); //operaDataBase.insert(ACTIONS_TABLE, null, value); operaDataBase.update(ACTIONS_TABLE, value, KEY + " = ?", new String[]{String.valueOf(action.getIdActions())}); close(); } /** * Select a specific CEL_Actions * @param idAction */ public CEL_Actions select(int idAction) { open(); Cursor cursor = operaDataBase.rawQuery("SELECT * FROM " + ACTIONS_TABLE + " WHERE " + KEY + "= ?", new String[] {String.valueOf(idAction)}); //If we got results get the first one if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { if (!cursor.isNull(cursor.getColumnIndex(KEY))) { //Build action object CEL_Actions action = new CEL_Actions(); action.setIdActions(Integer.parseInt(cursor.getString(0))); action.setActionActions(cursor.getString(1)); action.setQuantiteActions(Float.parseFloat(cursor.getString(2))); action.setUniteActions(cursor.getString(3)); action.setNoteActions(cursor.getString(4)); action.setIdElement(Integer.parseInt(cursor.getString(5))); return action; } } } if(cursor!=null) cursor.close(); close(); CEL_Actions action = new CEL_Actions(); return action; } public CEL_Actions selectActions(int idElement) { Cursor cursor = operaDataBase.rawQuery("SELECT * FROM " + ACTIONS_TABLE + " WHERE " + ID_ELEMENT + "= ?", new String[] {String.valueOf(idElement)}); //If we got results get the first one if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { if (!cursor.isNull(cursor.getColumnIndex(KEY))) { //Build action object CEL_Actions action = new CEL_Actions(); action.setIdActions(Integer.parseInt(cursor.getString(0))); action.setActionActions(cursor.getString(1)); action.setQuantiteActions(Float.parseFloat(cursor.getString(2))); action.setUniteActions(cursor.getString(3)); action.setNoteActions(cursor.getString(4)); action.setIdElement(Integer.parseInt(cursor.getString(5))); return action; } } } if(cursor!=null) cursor.close(); return null; } /** * Select all CEL_Actions with same ideEement * * @param idElement */ public List<CEL_Actions> selectAllActionFromElement(int idElement) { open(); Cursor cursor = operaDataBase.rawQuery("SELECT * FROM " + ACTIONS_TABLE + " WHERE " + ID_ELEMENT + "= ?", new String[] {String.valueOf(idElement)}); List<CEL_Actions> cel_Actions_List = new ArrayList<CEL_Actions>(); //If we got results get the first one if (cursor != null) { if (cursor.moveToFirst()) { while (cursor.isAfterLast() == false) { //Build CEL_Actions object CEL_Actions action = new CEL_Actions(); action.setIdActions(Integer.parseInt(cursor.getString(0))); action.setActionActions(cursor.getString(1)); action.setQuantiteActions(Float.parseFloat(cursor.getString(2))); action.setUniteActions(cursor.getString(3)); action.setNoteActions(cursor.getString(4)); action.setIdElement(Integer.parseInt(cursor.getString(5))); cel_Actions_List.add(action); } } } if(cursor!=null) cursor.close(); close(); if(cel_Actions_List.size() > 0) return cel_Actions_List; else return null; } /** * Return actions of a CEL_Elements on a String * * @param idElements */ public String stringCel_Actions(int idElements) { open(); Cursor cursor = operaDataBase.rawQuery("SELECT * FROM " + ACTIONS_TABLE + " WHERE " + ID_ELEMENT + "= ?", new String[] {String.valueOf(idElements)}); String actionsString = ""; //If we got results get the first one if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { if (!cursor.isNull(cursor.getColumnIndex(KEY))) { actionsString = cursor.getString(1); } } } if(cursor!=null) cursor.close(); close(); return actionsString; } }
[ "33107025+AbderrahmenBriki@users.noreply.github.com" ]
33107025+AbderrahmenBriki@users.noreply.github.com
76df35efc9889a7f177ca809b0df2155fe708e06
8fa7a3df777c64fb4d46cc2fb5388dcbf723b827
/MyMusicPlayer/app/src/main/java/com/example/mymusicplayer/SongInfo.java
2f27d8c82fe35b82fc23e9ab4db9607faf660f57
[]
no_license
Bal98/Android-Projects
6a418662e320878f3e0612b7eb1eba84947442aa
db529bc833fee4949d7c77acb249611981b95768
refs/heads/master
2022-11-30T21:30:09.774005
2020-08-16T16:33:51
2020-08-16T16:33:51
287,725,810
0
0
null
null
null
null
UTF-8
Java
false
false
616
java
package com.example.mymusicplayer; import java.io.Serializable; public class SongInfo implements Serializable { String data; String name; String singer; // String image; public SongInfo(String data,String name,String singer) { this.data = data; this.name = name; this.singer = singer; // this.image = image; } public String getData() { return data; } public String getName() { return name; } public String getSinger() { return singer; } // public String getImage() { // return image; // } }
[ "balmukund.com.com@gmail.com" ]
balmukund.com.com@gmail.com
3cfa09c163c7a8f04f9728336875f7e0f4540388
3a84cb3739ac573d8cebb3acb1e03b8e6f899a11
/dm-service/src/main/java/ro/manoli/persistence/model/company/Company.java
be802de0e73f0b78614b7cbb8ea8ed9f0cbb8aed
[]
no_license
mihailmanoli/DocumentManagement
19e888895b95cb38c023bb782ff2c2b43b435bf3
46bd990d9aae84c90ba4865192fa38cb99f65df6
refs/heads/master
2021-05-31T04:53:24.272645
2016-04-03T19:59:21
2016-04-03T19:59:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,389
java
package ro.manoli.persistence.model.company; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Lob; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import ro.manoli.persistence.model.PersistableEntity; import ro.manoli.persistence.model.identity.Address; /** * * @author Mihail * */ @Entity @Table(name = "COMPANY") public class Company extends PersistableEntity { private static final long serialVersionUID = 1L; private String name; private String description; private Address address; private List<Department> departments; @Column(name = "NAME") public String getName() { return name; } public void setName(String name) { this.name = name; } @Column(name = "DESCRIPTION") @Lob public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @OneToOne(cascade = CascadeType.ALL) public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } @OneToMany(mappedBy = "company") public List<Department> getDepartments() { return departments; } public void setDepartments(List<Department> departments) { this.departments = departments; } }
[ "manolimihai@gmail.com" ]
manolimihai@gmail.com
5197f806cc7f1234bc485597c5e220040fe6f634
81079efc3115bf0cfcc1aeb3052a77b560e5e3c8
/Aurian/POO/TP/TP5/TP5/src/tp5/Voiture.java
1ff83de9451ce0123ebebfc5e9bb8558ee0b32ec
[]
no_license
SCSIQ/SCSTest
879e3fa35bfdeb66d102aa7ae082e1a666876642
84bdbb096eddd8a07323c37b4df459d8834a847e
refs/heads/master
2018-09-19T15:05:23.461040
2018-06-06T08:44:16
2018-06-06T08:44:16
117,687,120
0
0
null
null
null
null
UTF-8
Java
false
false
3,603
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 tp5; import java.util.ArrayList; /** * * @author durand aurian * */ public class Voiture { private Moteur moteur; private String modele; private Conducteur pilote = null; private Remorque remorque = null; private ArrayList<Roue> roues; /** * * @param cv nombre de chevaux du moteur * @param type type de voiture (ex : formule1,twingo,etc) * @param tailleRoue taille res roues de la voiture s */ public Voiture(int cv, String type, int tailleRoue ){ modele=type; moteur=new Moteur(cv,this); roues = new ArrayList(); for(int i=0;i<4;i++){ roues.add(new Roue(tailleRoue)); } } /** * * @param aThis constructeur privé permetant de cloner la voiture */ private Voiture(Voiture aThis) { this.modele=aThis.modele; this.moteur=aThis.moteur; this.pilote=aThis.pilote; this.remorque=aThis.remorque; this.roues=aThis.roues; } /** * * @return un clone de la voiture */ public Voiture clone(){ return new Voiture(this); } public boolean equals(Voiture v){ boolean resultat = false; if((this.modele==v.modele)&&(this.moteur==v.moteur)&&(this.pilote==v.pilote)&&(this.remorque==v.remorque)&&(this.roues==v.roues)){ resultat = true; } return resultat; } /** * modifie l'état de la voiture à en panne */ public void enPanne(){ moteur.enPanne(); } /** * démare le moteur */ public void demarre(){ if (moteur.estDemarre()==false){ moteur.demarre(); } } /** * * @param conducteur donne le nouveau conducteur à la fonction */ public void changeConducteur(Conducteur conducteur){ pilote = conducteur; } /** * * @param remorque donne la remorque à attacher */ public void attacheRemorque(Remorque remorque){ this.remorque = remorque; } /** * détache la remorque */ public void detacheRemorque(){ this.remorque = null; } /** * * @return une chaine de caractère décraivant la voiture */ public String toString(){ String type = "[Voiture] "+modele; String enMarche; String res =""; if(moteur.estDemarre()==true){ //affiche si le moteur est démaré ou non, et si il est en panne ou non enMarche=" est démarré,"; }else if(moteur.getEnPanne()==true){ enMarche=" à l'arrêt, en panne."; }else{ enMarche=" à l'arrêt,"; } String mot = "->"+moteur.toString()+enMarche; res = type+"\n"+mot; if(pilote!=null){ //affiche les détails d conducteur si il y en a un String conduct = "->"+pilote.toString(); res += "\n"+conduct; } if(remorque!=null){ //affiche les détails de la remorque si il y en a une String rem = "->"+remorque.toString(); res += "\n"+rem; } String roue=""; for(int i=0;i<4;i++){ Roue r =roues.get(i); roue += "-> "+r.toString()+", "; } res += "\n"+roue; return res; } }
[ "34919475+AurianDurand@users.noreply.github.com" ]
34919475+AurianDurand@users.noreply.github.com
0691fc2d5bdf86d7937b193cadd421f020bf6db2
ac3df599a89d586915393412d8360ff6f2863d63
/src/java/Block.java
e073b46eaafddc61e506f120134f09d8782d53ec
[]
no_license
kharekartik08/Final_Year_Project
dd74603286573cde53776e37373ca74d64f8c58c
8eb67429fb278205d1bf7f643d26af8b2ed46593
refs/heads/main
2023-03-23T23:43:50.552443
2021-03-03T09:40:16
2021-03-03T09:40:16
344,074,844
0
0
null
null
null
null
UTF-8
Java
false
false
3,339
java
import Analayse.com.datumbox.opensource.examples.NaiveBayesExample; import static DB.Connect.getDomainName; import DB.NavieBayesClassifier; import JSON.JSONArray; import JSON.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.net.URL; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Scanner; import javax.swing.JOptionPane; import org.htmlparser.Jsoup; import org.htmlparser.nodes.Document; public class Block { Block(String url, String emailid) { int dialogButton = JOptionPane.YES_NO_OPTION; try { int dialogResult = JOptionPane.showConfirmDialog(null, "Want to Block site " + url, "Warning", dialogButton); if (dialogResult == JOptionPane.YES_OPTION) { int i = DB.Connect.blockUrl(url, emailid); if (i > 0) { JOptionPane.showMessageDialog(null, "Blocked Successfully!!"); } else { JOptionPane.showMessageDialog(null, "Already Blocked"); } } else { } } catch (Exception f) { f.printStackTrace(); } } Block() { } Boolean checkBlock(String temp, String username) { Boolean flag = false; try { // Connection conn= DB.Connect.openConnection(); // String sql = "select * from tblblocked where emailid='" + username + "' and url ='" + temp + "'"; // System.out.print(sql); // PreparedStatement stat=conn.prepareStatement(sql); // ResultSet rs = stat.executeQuery(); // if (rs.next()) { // flag = true; //} System.out.println("checked in db and found"+flag+" "+temp); String output = DB.NavieBayesClassifier.analayseData(temp); if (output.equals("positive")) { flag = false; } else { flag = true; } // to web scrap uncomment below. ///if (!flag) { // try { // // Document doc = Jsoup.connect(temp).timeout(10000).get(); // // // String check = doc.getAllElements().outerHtml(); // String output = DB.NavieBayesClassifier.analayseData(check); // if (output.equals("positive")) { // flag = true; // } else { // flag = false; // } // // if(flag){ // System.out.println("good wesite no need to block"); // flag=false; // }else{ // // System.out.println("block it"); // // DB.Connect.blockUrl(temp, username); // flag=true; // } // } catch (Exception e) { // //flag = true; // } // } return flag; } catch (Exception g) { return flag; } } }
[ "kharekartik098@gmail.com" ]
kharekartik098@gmail.com
56977d2c8bd0d0eb6384de48ae1091d615ed71e8
0cf378b7320592a952d5343a81b8a67275ab5fab
/webprotege-server/src/main/java/edu/stanford/bmir/protege/web/server/session/WebProtegeSessionImpl.java
02a7fd43e202c99520f02d55f740d6a2f7a7654f
[ "BSD-2-Clause" ]
permissive
curtys/webprotege-attestation
945de9f6c96ca84b7022a60f4bec4886c81ab4f3
3aa909b4a8733966e81f236c47d6b2e25220d638
refs/heads/master
2023-04-11T04:41:16.601854
2023-03-20T12:18:44
2023-03-20T12:18:44
297,962,627
0
0
MIT
2021-08-24T08:43:21
2020-09-23T12:28:24
Java
UTF-8
Java
false
false
1,995
java
package edu.stanford.bmir.protege.web.server.session; import com.google.common.base.MoreObjects; import edu.stanford.bmir.protege.web.shared.user.UserId; import javax.inject.Inject; import javax.servlet.http.HttpSession; import java.util.Optional; import static com.google.common.base.Preconditions.checkNotNull; /** * Matthew Horridge * Stanford Center for Biomedical Informatics Research * 12/02/15 */ public class WebProtegeSessionImpl implements WebProtegeSession { private final HttpSession httpSession; @Inject public WebProtegeSessionImpl(HttpSession httpSession) { this.httpSession = checkNotNull(httpSession); } @Override public void removeAttribute(WebProtegeSessionAttribute<?> attribute) { httpSession.removeAttribute(checkNotNull(attribute.getAttributeName())); } @Override public <T> void setAttribute(WebProtegeSessionAttribute<T> attribute, T value) { httpSession.setAttribute(checkNotNull(attribute.getAttributeName()), checkNotNull(value)); } @Override @SuppressWarnings("unchecked") public <T> Optional<T> getAttribute(WebProtegeSessionAttribute<T> attribute) { T value = (T) httpSession.getAttribute(attribute.getAttributeName()); return Optional.ofNullable(value); } @Override public String toString() { return MoreObjects.toStringHelper("WebProtegeSession") .addValue(httpSession) .toString(); } @Override public UserId getUserInSession() { return getAttribute(WebProtegeSessionAttribute.LOGGED_IN_USER).orElse(UserId.getGuest()); } @Override public void setUserInSession(UserId userId) { if (!userId.isGuest()) { setAttribute(WebProtegeSessionAttribute.LOGGED_IN_USER, checkNotNull(userId)); } } @Override public void clearUserInSession() { removeAttribute(WebProtegeSessionAttribute.LOGGED_IN_USER); } }
[ "matthew.horridge@stanford.edu" ]
matthew.horridge@stanford.edu
65067befe8cb97f18bbe3601ef8b7251d88ff19b
a55b85b6dd6a4ebf856b3fd80c9a424da2cd12bd
/core/src/main/java/org/marketcetera/module/ModuleConfigurationProvider.java
17bfc455a5c9cf75de6786bf0c6091bd5dd2ff3c
[]
no_license
jeffreymu/marketcetera-2.2.0-16652
a384a42b2e404bcc6140119dd2c6d297d466596c
81cdd34979492f839233552432f80b3606d0349f
refs/heads/master
2021-12-02T11:18:01.399940
2013-08-09T14:36:21
2013-08-09T14:36:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,796
java
package org.marketcetera.module; import org.marketcetera.util.misc.ClassVersion; /* $License$ */ /** * Instances of this classes provide means to provide default * property values for configuration attributes of module * factories and module instances. * <p> * Whenever a new instance of a module factory or a module * instance is created, if the factory or the module exports * an MXBean interface, the module framework, will figure out * all the writable attributes (of java primitive and string types) * on that interface and query the module configuration provider for * any default configuration values for each one of them. * <p> * If the module configuration provider provides a non-null value * for an attribute, the module framework converts that value from * string to the actual attribute type, if it supports conversion * for that particular type, and sets the converted value on the MX bean * for the factory or the module instance by invoking the appropriate * property setter. * <p> * The default configurations are applied on the factories right * after they are created but before they are invoked to create * any instances. * <p> * The default configurations are applied on module instances, * right after they are created but before they are started. * * @author anshul@marketcetera.com * @version $Id: ModuleConfigurationProvider.java 16154 2012-07-14 16:34:05Z colin $ * @since 1.0.0 */ @ClassVersion("$Id: ModuleConfigurationProvider.java 16154 2012-07-14 16:34:05Z colin $") //$NON-NLS-1$ public interface ModuleConfigurationProvider { /** * Returns the default value, if available, for the specified * attribute of the supplied module provider or module instance URN. * This method returns null, if no default value is available. * * @param inURN the module provider or instance URN. * @param inAttribute the writable attribute name as reported * by the MBeanInfo. * * @return the default value of the attribute, if available, * null otherwise. * * @throws ModuleException if there was a failure fetching * the default value. */ public String getDefaultFor(ModuleURN inURN, String inAttribute) throws ModuleException; /** * Refreshes the module configuration provider. When invoked, the * configuration provider should re-read all of its configuration * from persistent store discarding any cached state if it has any. * * This method is invoked by the module framework when its asked * to refresh itself. * * @throws ModuleException if the configuration ran into errors * refreshing its state. * * @see ModuleManager#refresh() */ public void refresh() throws ModuleException; }
[ "vladimir_petrovich@yahoo.com" ]
vladimir_petrovich@yahoo.com
74807ab5a643875d74460841e3c7ff5a6e6cf097
62a54f21e1f12ffdded58db84dc4b2fe2f397ebc
/blue_whale/src/main/java/com/BDD/blue_whale/entities/Import_export.java
0776c4c73fd9765cc368c20788a6c6b15cf1aa35
[]
no_license
KISSARLI-Nourhen/App_blue_whale
14b48cfe9f76d890257fd2b62259abd89de61976
c1076fba6a07d5c1c0bdd4badc3bfd7f73fb7856
refs/heads/master
2023-08-18T13:56:27.870026
2021-10-07T14:27:13
2021-10-07T14:27:13
386,946,152
0
0
null
null
null
null
UTF-8
Java
false
false
1,743
java
package com.BDD.blue_whale.entities; import java.io.Serializable; import java.security.Timestamp; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; @Entity @Data @NoArgsConstructor @AllArgsConstructor @ToString @Table(name="import_export") public class Import_export implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy= GenerationType.IDENTITY) private Long id; private String trade_flow; private Integer years; private String months; private Float value; private String unit_value; private Float netweight; private String unit_netweight; private Timestamp date_modif; @ManyToOne //@JsonProperty(access=Access.WRITE_ONLY) @JoinColumn(name="country_exporter_id") private Country country_expo; @ManyToOne //@JsonProperty(access=Access.WRITE_ONLY) @JoinColumn(name="country_importer_id") private Country country_impo; @ManyToOne //@JsonProperty(access=Access.WRITE_ONLY) @JoinColumn(name="product_id") private Product product; @ManyToOne @JsonProperty(access=Access.WRITE_ONLY) @JoinColumn(name="variety_id") private Variety variety; @ManyToOne //@JsonProperty(access=Access.WRITE_ONLY) @JoinColumn(name="source_id") private Source source; }
[ "kissarlinourhen2@gmail.com" ]
kissarlinourhen2@gmail.com
a58fa95e54eaa469957f785a80ea7e7f3fea8306
5b7d0052a22e801a2260e115df13ba7e7919d551
/src/test/com/scs/web/blog/dao/ArticleDaoTest.java
248a91051d758c2a343feb05efc33fdf63eea65c
[]
no_license
zhao-rgb/blog
859415335b773b55e7bf608b5825d38b6207c238
84e7460877d20907b877fffa49e23c8b47cc7b8a
refs/heads/master
2022-09-17T03:28:37.594711
2019-12-23T12:53:56
2019-12-23T12:53:56
220,620,424
1
0
null
2022-09-01T23:15:25
2019-11-09T09:34:08
Java
UTF-8
Java
false
false
2,413
java
package com.scs.web.blog.dao; import com.scs.web.blog.domain.vo.ArticleVo; import com.scs.web.blog.entity.Article; import com.scs.web.blog.factory.DaoFactory; import com.scs.web.blog.util.JSoupSpider; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.SQLException; import java.util.List; public class ArticleDaoTest { private static Logger logger = LoggerFactory.getLogger(ArticleDaoTest.class); private ArticleDao articleDao = DaoFactory.getArticleDaoInstance(); @Test public void batchInsert() { try { int[] result = articleDao.batchInsert(JSoupSpider.getArticle()); if(result.length !=0){ logger.info("成功新增"+result.length+"个用户"); } } catch (SQLException e) { logger.error("异常"); } } @Test public void selectByKeywords() throws SQLException{ List<ArticleVo> articleList = articleDao.selectByKeywords("问"); System.out.println(articleList.size()); } @Test public void insert() throws SQLException{ Article article = new Article(); article.setUserId((long) 1); article.setTopicId((long) 2); article.setTitle("lll"); article.setContent("oooo"); article.setCover("ioioio"); article.setDiamond(3); article.setComments(4); article.setLikes(3); article.setText("kskks"); int result = articleDao.insert(article); if(result == 1){ logger.info("成功"); } } @Test public void getArticlesByUserId()throws SQLException { List<ArticleVo> articleVoList = articleDao.selectByUserId(1L); System.out.println(articleVoList.size()); } @Test public void getArticle()throws SQLException { Article article = articleDao.getArticle(1); if (article != null) { System.out.println(article); } } @Test public void selectAll()throws SQLException { List<Article> articleList = articleDao.selectAll(); if (articleList.size()>0) { System.out.println(articleList.size()); } } @Test public void update() throws SQLException { Article article = articleDao.getArticle(1); article.setLikes(article.getLikes()-1); articleDao.update(article); } }
[ "1019919091@qq.com" ]
1019919091@qq.com
648c6aa9e3fd4c9cd636056c715ad7ae4ae1794b
c8fcad06858c474948ad328ec5aba284b257d468
/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_802_CalculatingGridExample.java
098c2108253a579eade39e1d208615ed750f0152
[]
no_license
binhthanhnguyen/nebula.widgets.nattable
5af3ec8d5089f68de4227e7e5ced87936f26a77d
b05cb2eeff9bce170e344c1194131eda666e74d5
refs/heads/master
2020-06-14T17:18:49.583450
2016-11-24T22:46:03
2016-11-24T22:46:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,099
java
/******************************************************************************* * Copyright (c) 2012, 2013 Dirk Fauth and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Dirk Fauth - initial API and implementation *******************************************************************************/ package org.eclipse.nebula.widgets.nattable.examples._800_Integration; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.nebula.widgets.nattable.NatTable; import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration; import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; import org.eclipse.nebula.widgets.nattable.config.IEditableRule; import org.eclipse.nebula.widgets.nattable.copy.command.CopyDataCommandHandler; import org.eclipse.nebula.widgets.nattable.data.IColumnAccessor; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter; import org.eclipse.nebula.widgets.nattable.data.convert.PercentageDisplayConverter; import org.eclipse.nebula.widgets.nattable.dataset.NumberValues; import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample; import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner; import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer; import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider; import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider; import org.eclipse.nebula.widgets.nattable.grid.data.DefaultSummaryRowHeaderDataProvider; import org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer; import org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer; import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer; import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer; import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer; import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer; import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform; import org.eclipse.nebula.widgets.nattable.layer.DataLayer; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator; import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer; import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; import org.eclipse.nebula.widgets.nattable.style.DisplayMode; import org.eclipse.nebula.widgets.nattable.summaryrow.DefaultSummaryRowConfiguration; import org.eclipse.nebula.widgets.nattable.summaryrow.ISummaryProvider; import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryDisplayConverter; import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowConfigAttributes; import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer; import org.eclipse.nebula.widgets.nattable.summaryrow.SummationSummaryProvider; import org.eclipse.nebula.widgets.nattable.util.GUIHelper; import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.GlazedLists; /** * Example that demonstrates how to implement a NatTable instance that shows * calculated values. Also demonstrates the usage of the SummaryRow on updating * the NatTable. */ public class _802_CalculatingGridExample extends AbstractNatExample { public static String COLUMN_ONE_LABEL = "ColumnOneLabel"; public static String COLUMN_TWO_LABEL = "ColumnTwoLabel"; public static String COLUMN_THREE_LABEL = "ColumnThreeLabel"; public static String COLUMN_FOUR_LABEL = "ColumnFourLabel"; public static String COLUMN_FIVE_LABEL = "ColumnFiveLabel"; private EventList<NumberValues> valuesToShow = GlazedLists.eventList(new ArrayList<NumberValues>()); public static void main(String[] args) throws Exception { StandaloneNatExampleRunner.run(new _802_CalculatingGridExample()); } @Override public String getDescription() { return "This example demonstrates how to create a NatTable that contains calculated values.\n" + "The first three columns are editable, while the last two columns contain the calculated values.\n" + "The values in column four and five will automatically update when committing the edited values.\n" + "This example also contains a summary row to show that it is even possible to update the summary " + "row in a editable grid."; } @Override public Control createExampleControl(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); panel.setLayout(new GridLayout()); GridDataFactory.fillDefaults().grab(true, true).applyTo(panel); Composite gridPanel = new Composite(panel, SWT.NONE); gridPanel.setLayout(new GridLayout()); GridDataFactory.fillDefaults().grab(true, true).applyTo(gridPanel); Composite buttonPanel = new Composite(panel, SWT.NONE); buttonPanel.setLayout(new GridLayout()); GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonPanel); // property names of the NumberValues class String[] propertyNames = { "columnOneNumber", "columnTwoNumber", "columnThreeNumber", "columnFourNumber", "columnFiveNumber" }; // mapping from property to label, needed for column header labels Map<String, String> propertyToLabelMap = new HashMap<String, String>(); propertyToLabelMap.put("columnOneNumber", "100%"); propertyToLabelMap.put("columnTwoNumber", "Value One"); propertyToLabelMap.put("columnThreeNumber", "Value Two"); propertyToLabelMap.put("columnFourNumber", "Sum"); propertyToLabelMap.put("columnFiveNumber", "Percentage"); this.valuesToShow.add(createNumberValues()); this.valuesToShow.add(createNumberValues()); ConfigRegistry configRegistry = new ConfigRegistry(); CalculatingGridLayer gridLayer = new CalculatingGridLayer(this.valuesToShow, configRegistry, propertyNames, propertyToLabelMap); DataLayer bodyDataLayer = gridLayer.getBodyDataLayer(); final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer); bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator); registerColumnLabels(columnLabelAccumulator); final NatTable natTable = new NatTable(gridPanel, gridLayer, false); natTable.setConfigRegistry(configRegistry); natTable.addConfiguration(new DefaultNatTableStyleConfiguration()); natTable.addConfiguration(new CalculatingEditConfiguration()); natTable.configure(); GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable); Button addRowButton = new Button(buttonPanel, SWT.PUSH); addRowButton.setText("add row"); addRowButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _802_CalculatingGridExample.this.valuesToShow.add(createNumberValues()); } }); Button resetButton = new Button(buttonPanel, SWT.PUSH); resetButton.setText("reset"); resetButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _802_CalculatingGridExample.this.valuesToShow.clear(); _802_CalculatingGridExample.this.valuesToShow.add(createNumberValues()); _802_CalculatingGridExample.this.valuesToShow.add(createNumberValues()); } }); return panel; } private void registerColumnLabels(ColumnOverrideLabelAccumulator columnLabelAccumulator) { columnLabelAccumulator.registerColumnOverrides(0, COLUMN_ONE_LABEL); columnLabelAccumulator.registerColumnOverrides(1, COLUMN_TWO_LABEL); columnLabelAccumulator.registerColumnOverrides(2, COLUMN_THREE_LABEL); columnLabelAccumulator.registerColumnOverrides(3, COLUMN_FOUR_LABEL); columnLabelAccumulator.registerColumnOverrides(4, COLUMN_FIVE_LABEL); } private NumberValues createNumberValues() { NumberValues nv = new NumberValues(); nv.setColumnOneNumber(100); // the value which should be used as 100% nv.setColumnTwoNumber(20); // the value 1 for calculation nv.setColumnThreeNumber(30); // the value 2 for calculation // as column 4 and 5 should be calculated values, we don't set them to // the NumberValues object return nv; } /** * The column accessor which is used for retrieving the data out of the * model. While the values for the first three columns are returned * directly, the values for column four and five are calculated. */ class CalculatingDataProvider implements IColumnAccessor<NumberValues> { @Override public Object getDataValue(NumberValues rowObject, int columnIndex) { switch (columnIndex) { case 0: return rowObject.getColumnOneNumber(); case 1: return rowObject.getColumnTwoNumber(); case 2: return rowObject.getColumnThreeNumber(); case 3: // calculate the sum return rowObject.getColumnTwoNumber() + rowObject.getColumnThreeNumber(); case 4: // calculate the percentage return new Double(rowObject.getColumnTwoNumber() + rowObject.getColumnThreeNumber()) / rowObject.getColumnOneNumber(); } return null; } @Override public void setDataValue(NumberValues rowObject, int columnIndex, Object newValue) { // because of the registered conversion, the new value has to be an // Integer switch (columnIndex) { case 0: rowObject.setColumnOneNumber((Integer) newValue); break; case 1: rowObject.setColumnTwoNumber((Integer) newValue); break; case 2: rowObject.setColumnThreeNumber((Integer) newValue); break; } } @Override public int getColumnCount() { // this example will show exactly 5 columns return 5; } } /** * The body layer stack for the {@link _802_CalculatingGridExample}. * Consists of * <ol> * <li>ViewportLayer</li> * <li>SelectionLayer</li> * <li>ColumnHideShowLayer</li> * <li>ColumnReorderLayer</li> * <li>SummaryRowLayer</li> * <li>GlazedListsEventLayer</li> * <li>DataLayer</li> * </ol> */ class CalculatingBodyLayerStack extends AbstractLayerTransform { private final DataLayer bodyDataLayer; private final GlazedListsEventLayer<NumberValues> glazedListsEventLayer; private final SummaryRowLayer summaryRowLayer; private final ColumnReorderLayer columnReorderLayer; private final ColumnHideShowLayer columnHideShowLayer; private final SelectionLayer selectionLayer; private final ViewportLayer viewportLayer; public CalculatingBodyLayerStack(EventList<NumberValues> valuesToShow, ConfigRegistry configRegistry) { IDataProvider dataProvider = new ListDataProvider<NumberValues>(valuesToShow, new CalculatingDataProvider()); this.bodyDataLayer = new DataLayer(dataProvider); this.glazedListsEventLayer = new GlazedListsEventLayer<NumberValues>(this.bodyDataLayer, valuesToShow); this.summaryRowLayer = new SummaryRowLayer(this.glazedListsEventLayer, configRegistry, false); this.summaryRowLayer.addConfiguration(new CalculatingSummaryRowConfiguration(this.bodyDataLayer.getDataProvider())); this.columnReorderLayer = new ColumnReorderLayer(this.summaryRowLayer); this.columnHideShowLayer = new ColumnHideShowLayer(this.columnReorderLayer); this.selectionLayer = new SelectionLayer(this.columnHideShowLayer); this.viewportLayer = new ViewportLayer(this.selectionLayer); setUnderlyingLayer(this.viewportLayer); registerCommandHandler(new CopyDataCommandHandler(this.selectionLayer)); } public DataLayer getDataLayer() { return this.bodyDataLayer; } public SelectionLayer getSelectionLayer() { return this.selectionLayer; } } /** * The {@link GridLayer} used by the {@link _802_CalculatingGridExample}. */ class CalculatingGridLayer extends GridLayer { public CalculatingGridLayer( EventList<NumberValues> valuesToShow, ConfigRegistry configRegistry, final String[] propertyNames, Map<String, String> propertyToLabelMap) { super(true); init(valuesToShow, configRegistry, propertyNames, propertyToLabelMap); } private void init( EventList<NumberValues> valuesToShow, ConfigRegistry configRegistry, final String[] propertyNames, Map<String, String> propertyToLabelMap) { // Body CalculatingBodyLayerStack bodyLayer = new CalculatingBodyLayerStack(valuesToShow, configRegistry); SelectionLayer selectionLayer = bodyLayer.getSelectionLayer(); // Column header IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap); ILayer columnHeaderLayer = new ColumnHeaderLayer( new DefaultColumnHeaderDataLayer(columnHeaderDataProvider), bodyLayer, selectionLayer); // Row header IDataProvider rowHeaderDataProvider = new DefaultSummaryRowHeaderDataProvider(bodyLayer.getDataLayer().getDataProvider(), "\u2211"); ILayer rowHeaderLayer = new RowHeaderLayer( new DefaultRowHeaderDataLayer(rowHeaderDataProvider), bodyLayer, selectionLayer); // Corner ILayer cornerLayer = new CornerLayer( new DataLayer( new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider)), rowHeaderLayer, columnHeaderLayer); setBodyLayer(bodyLayer); setColumnHeaderLayer(columnHeaderLayer); setRowHeaderLayer(rowHeaderLayer); setCornerLayer(cornerLayer); } public DataLayer getBodyDataLayer() { return ((CalculatingBodyLayerStack) getBodyLayer()).getDataLayer(); } } /** * Configuration for enabling and configuring edit behaviour. */ class CalculatingEditConfiguration extends AbstractRegistryConfiguration { @Override public void configureRegistry(IConfigRegistry configRegistry) { configRegistry.registerConfigAttribute( EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE); configRegistry.registerConfigAttribute( EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE, DisplayMode.EDIT, _802_CalculatingGridExample.COLUMN_FOUR_LABEL); configRegistry.registerConfigAttribute( EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE, DisplayMode.EDIT, _802_CalculatingGridExample.COLUMN_FIVE_LABEL); // configure the summary row to be not editable configRegistry.registerConfigAttribute( EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE, DisplayMode.EDIT, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL); configRegistry.registerConfigAttribute( CellConfigAttributes.DISPLAY_CONVERTER, new DefaultIntegerDisplayConverter(), DisplayMode.NORMAL); configRegistry.registerConfigAttribute( CellConfigAttributes.DISPLAY_CONVERTER, new DefaultIntegerDisplayConverter(), DisplayMode.EDIT); configRegistry.registerConfigAttribute( CellConfigAttributes.DISPLAY_CONVERTER, new PercentageDisplayConverter(), DisplayMode.NORMAL, _802_CalculatingGridExample.COLUMN_FIVE_LABEL); configRegistry.registerConfigAttribute( CellConfigAttributes.DISPLAY_CONVERTER, new SummaryDisplayConverter(new DefaultIntegerDisplayConverter()), DisplayMode.NORMAL, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL); configRegistry.registerConfigAttribute( CellConfigAttributes.DISPLAY_CONVERTER, new SummaryDisplayConverter(new PercentageDisplayConverter()), DisplayMode.NORMAL, SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + 4); } } class CalculatingSummaryRowConfiguration extends DefaultSummaryRowConfiguration { private final IDataProvider dataProvider; public CalculatingSummaryRowConfiguration(IDataProvider dataProvider) { this.dataProvider = dataProvider; this.summaryRowBgColor = GUIHelper.COLOR_BLUE; this.summaryRowFgColor = GUIHelper.COLOR_WHITE; } @Override public void addSummaryProviderConfig(IConfigRegistry configRegistry) { // Labels are applied to the summary row and cells by default to // make configuration easier. // See the Javadoc for the SummaryRowLayer // Default summary provider configRegistry.registerConfigAttribute( SummaryRowConfigAttributes.SUMMARY_PROVIDER, new SummationSummaryProvider(this.dataProvider), DisplayMode.NORMAL, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL); // Average summary provider for column index 2 configRegistry.registerConfigAttribute( SummaryRowConfigAttributes.SUMMARY_PROVIDER, new AverageSummaryProvider(), DisplayMode.NORMAL, SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + 4); } /** * Custom summary provider which averages out the contents of the column */ class AverageSummaryProvider implements ISummaryProvider { @Override public Object summarize(int columnIndex) { double total = 0; int rowCount = CalculatingSummaryRowConfiguration.this.dataProvider.getRowCount(); for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { Object dataValue = CalculatingSummaryRowConfiguration.this.dataProvider.getDataValue(columnIndex, rowIndex); total = total + Double.parseDouble(dataValue.toString()); } return total / rowCount; } } } }
[ "dirk.fauth@googlemail.com" ]
dirk.fauth@googlemail.com
15f2282813b7dfa998d145b7b2894cfdcf972e98
5ea5977c4c6401087550e791d0ff05979e827ff0
/JavaVersion/TextAdventures!/src/Parser.java
f1fcea6aa31e7ba25496914b1aaea9162e0eefe3
[]
no_license
msikess/Squirrel-Noire
f5e77c95350bd423c5a890452dfd58c6e7015e2f
f8f352cf7d4c62095796a3e210329ec211c273a1
refs/heads/master
2021-07-03T22:29:26.373930
2017-09-26T14:57:09
2017-09-26T14:57:09
104,677,148
0
0
null
null
null
null
UTF-8
Java
false
false
6,207
java
import java.util.List; import java.util.Map; import java.util.Scanner; public class Parser { Scanner line; private int COUNT = 1; public Parser(Scanner line) { this.line = new Scanner(System.in); }; public void commandParser(Scanner line, Room room, Map<String, List<Room>> map, Inventory inv) { System.out.printf("\n > "); String command = line.nextLine().toLowerCase(); if (command.equalsIgnoreCase("quit")){ int nuts = 0; for (int i = 0; i < inv.inventory.size(); i++) { if (inv.inventory.get(i).getName().equalsIgnoreCase("nut")) { nuts++; } } System.out.println("You've stored " + nuts + " out of 20 nuts in your mouth! Ready for winter!"); return; } if (command.equalsIgnoreCase("help")){ System.out.println("go <direction: north, south, east, west>;\n" + "climb <up tree/down tree>;\n" + "pick up <item>;\n" + "look at <item>;\n" + "use <item>;\n" + "talk to <item>;\n" + "fight <item>;\n" + "wait;\n"); } if (command.contains(" the ")) { command = command.replace(" the ", " "); } if (command.contains(" a ")) { command = command.replace(" a ", " "); } if (command.contains(" an ")) { command = command.replace(" an ", " "); } if (command.startsWith("look at")) { String item = command.substring(8); room.lookAt(item); System.out.println(); commandParser(line, room, map, inv); } else if (command.startsWith("pick up")) { String item = command.substring(8); room.pickUp(item, inv); System.out.println(); commandParser(line, room, map, inv); } else if (command.startsWith("use")) { String item = command.substring(4); room.use(item, inv); System.out.println(); commandParser(line, room, map, inv); } else if (command.startsWith("talk to")) { String item = command.substring(8); room.talkTo(item); System.out.println(); commandParser(line, room, map, inv); } else if (command.startsWith("fight")) { String item = command.substring(6); room.fight(item); System.out.println(); commandParser(line, room, map, inv); } else if (command.startsWith("wait")) { room.wait(COUNT++); System.out.println(); commandParser(line, room, map, inv); } else if (command.startsWith("climb")) { String direction = command.substring(6); if (room instanceof Outdoors) { String roomie = ((Outdoors) room).climb(direction, inv); if (room.name == roomie) { System.out.println(); commandParser(line, room, map, inv); } else if (map.get(room.name).get(0).name == roomie) { System.out.println(map.get(room.name).get(0).description); System.out.println(); commandParser(line, map.get(room.name).get(0), map, inv); } else { System.out.println(map.get(room.name).get(1).description); System.out.println(); commandParser(line, map.get(room.name).get(1), map, inv); } } if (room instanceof Tree) { String roomie = ((Tree) room).climb(direction); if (room.name == roomie) { System.out.println(); commandParser(line, room, map, inv); } else { if (map.get(room.name).get(0).name == roomie) { System.out.println(map.get(room.name).get(0).description); System.out.println(); commandParser(line, map.get(room.name).get(0), map, inv); } else { System.out.println(map.get(room.name).get(1).description); System.out.println(); commandParser(line, map.get(room.name).get(1), map, inv); } } } else { System.out.println("I can't climb here."); commandParser(line, room, map, inv); } } else if (command.startsWith("go")) { String direction = command.substring(3); String roomie = null; if (room instanceof Outdoors) { roomie = ((Outdoors) room).go(direction, inv); if (roomie == room.name) { System.out.println(); commandParser(line, room, map, inv); } } if (room instanceof Bathroom) { roomie = ((Bathroom) room).go(direction, inv); if (roomie == room.name) { System.out.println(); commandParser(line, room, map, inv); } else if (map.get(room.name).get(0).name == roomie) { System.out.println(map.get(room.name).get(0).description); System.out.println(); commandParser(line, map.get(room.name).get(0), map, inv); } else if (map.get(room.name).get(1).name == roomie) { System.out.println(map.get(room.name).get(1).description); System.out.println(); commandParser(line, map.get(room.name).get(1), map, inv); } }if (room instanceof Tree) { roomie = ((Tree) room).go(direction, inv); if (roomie == room.name) { System.out.println(); commandParser(line, room, map, inv); } } if (room instanceof Hallway) { roomie = ((Hallway) room).go(direction, inv); if (roomie.equalsIgnoreCase("quit")) { int nuts = 0; for (int i = 0; i < inv.inventory.size(); i++) { if (inv.inventory.get(i).getName().equalsIgnoreCase("nut")) { nuts++; } } System.out.println("You've stored " + nuts + " out of 20 nuts in your mouth! Ready for winter!"); return; } if (roomie == room.name) { System.out.println(); commandParser(line, room, map, inv); } else if (map.get(room.name).get(0).name == roomie) { System.out.println(map.get(room.name).get(0).description); System.out.println(); commandParser(line, map.get(room.name).get(0), map, inv); } else if (map.get(room.name).get(1).name == roomie) { System.out.println(map.get(room.name).get(1).description); System.out.println(); commandParser(line, map.get(room.name).get(1), map, inv); } } else if (room instanceof Dorm){ roomie = ((Dorm) room).go(direction, inv); if (roomie == room.name) { System.out.println(); commandParser(line, room, map, inv); } else if (map.get(room.name).get(0).name == roomie) { System.out.println(map.get(room.name).get(0).description); System.out.println(); commandParser(line, map.get(room.name).get(0), map, inv); } } } else { System.out.println("I can't do that..."); System.out.println(); commandParser(line, room, map, inv); } } }
[ "nadiradz@grinnell.edu" ]
nadiradz@grinnell.edu
d0eb51d18368ec2ad8ea72ae5c73fcf6f5976e31
509f1b401e774ddfb3adc2f7c99305edb1a37df4
/binary-tree-paths/Solution.java
9c37482578303b9cf59af672bde4535f186aa1d0
[]
no_license
potenn/LeetCodeForJava
83bdb9de6d9b1f3163450b6456db0357f195525c
d8c24a4db50e8a3edc4bcb6864d668993dd9d4f1
refs/heads/master
2021-01-19T13:39:52.245364
2017-10-31T11:18:12
2017-10-31T11:18:12
82,441,229
1
1
null
null
null
null
UTF-8
Java
false
false
1,609
java
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ /* StringBuilder char 삭제 deleteCharAt */ public class Solution { public List<String> binaryTreePaths(TreeNode root) { List <String> list = new ArrayList<String>(); if(root == null){ return list; } // StringBuilder builder = new StringBuilder(); List<String> subList = new ArrayList<String>(); dfs(root, list, subList); return list; } public void dfs(TreeNode root, List<String>list, List<String> subList){ if(root == null){ return; } if(root.left == null && root.right == null){ // builder.append(root.val); String value = String.valueOf(root.val); subList.add(value); StringBuilder builder = new StringBuilder(); for(int i = 0 ; i < subList.size() ; i++){ builder.append(subList.get(i)); if(i != subList.size() -1){ builder.append("->"); } } list.add(builder.toString()); // String answer = generateDirectionMark(builder); // list.add(answer); subList.remove(subList.size()-1); return; } // builder.append(root.val); String value = String.valueOf(root.val); subList.add(value); dfs(root.left,list,subList); dfs(root.right,list,subList); subList.remove(subList.size()-1); // builder.deleteCharAt(builder.toString().length() - 1); } }
[ "poten1129@gmail.com" ]
poten1129@gmail.com
a10856f34b9ea47e378691479be127e21795f57e
a90b4259c9f1713bd009e66a55b2c445fc21ac50
/xc-service-manage-course/src/main/java/com/xuecheng/manage_course/dao/CourseMapper.java
129919c9db41d60aba1be10099df871c07335e8d
[]
no_license
ChenYilei2016/StudyOnLine
fabb5dd2aa9bf3319003226828fb4fafe43bcf83
41e84e2eb3a6345feaf95bb55c9f8ce4acafe97a
refs/heads/master
2020-04-22T20:07:26.650271
2019-03-19T10:35:04
2019-03-19T10:35:04
170,631,008
1
0
null
null
null
null
UTF-8
Java
false
false
666
java
package com.xuecheng.manage_course.dao; import com.xuecheng.framework.domain.course.CourseBase; import com.xuecheng.framework.domain.course.ext.CategoryNode; import com.xuecheng.framework.domain.course.ext.CourseInfo; import com.xuecheng.framework.domain.course.request.CourseListRequest; import org.apache.ibatis.annotations.Mapper; import java.util.List; /** * Created by Administrator. */ @Mapper public interface CourseMapper { CourseBase findCourseBaseById(String id); List<CourseInfo> findCourseInfoList(CourseListRequest courseListRequest); CategoryNode findCategoryNode(); List<CourseInfo> findCourseInfoByCompanyId(String companyId); }
[ "705029004@qq.com" ]
705029004@qq.com
3f55c6878bc26baea63f75468fa21a163fffe0c9
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/33/33_0351bb3da185a68f761e72ad1ce8ae8a7427e6bb/SessionManager/33_0351bb3da185a68f761e72ad1ce8ae8a7427e6bb_SessionManager_t.java
4bbdfafc873ff5df0d2edfbb5121361a5320aed7
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
67,429
java
/* * * JMoney - A Personal Finance Manager * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net> * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, 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, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package net.sf.jmoney.jdbcdatastore; import java.lang.ref.WeakReference; import java.lang.reflect.InvocationTargetException; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import java.util.Vector; import net.sf.jmoney.JMoneyPlugin; import net.sf.jmoney.model2.Account; import net.sf.jmoney.model2.CapitalAccount; import net.sf.jmoney.model2.Commodity; import net.sf.jmoney.model2.CurrencyAccount; import net.sf.jmoney.model2.DatastoreManager; import net.sf.jmoney.model2.Entry; import net.sf.jmoney.model2.ExtendableObject; import net.sf.jmoney.model2.ExtendablePropertySet; import net.sf.jmoney.model2.ExtensionPropertySet; import net.sf.jmoney.model2.IEntryQueries; import net.sf.jmoney.model2.IListManager; import net.sf.jmoney.model2.IObjectKey; import net.sf.jmoney.model2.IValues; import net.sf.jmoney.model2.ListKey; import net.sf.jmoney.model2.ListPropertyAccessor; import net.sf.jmoney.model2.PropertyAccessor; import net.sf.jmoney.model2.PropertySet; import net.sf.jmoney.model2.ReferencePropertyAccessor; import net.sf.jmoney.model2.ScalarPropertyAccessor; import net.sf.jmoney.model2.Session; import net.sf.jmoney.model2.SessionInfo; import net.sf.jmoney.model2.Transaction; import org.eclipse.ui.IMemento; import org.eclipse.ui.IPersistableElement; import org.eclipse.ui.IWorkbenchWindow; /** * Manages a session that is held in a JDBC database. * * @author Nigel Westbury */ public class SessionManager extends DatastoreManager implements IEntryQueries { /** * Date format used for embedding dates in SQL statements: * yyyy-MM-dd */ private static SimpleDateFormat dateFormat = (SimpleDateFormat) DateFormat.getDateInstance(); static { dateFormat.applyPattern("yyyy-MM-dd"); } private boolean isHsqldb = false; private Connection connection; private Statement reusableStatement; private IDatabaseRowKey sessionKey; /** * For each <code>PropertySet</code> for which objects are required * to be cached, map the <code>PropertySet</code> to a <Map>. * Each map is itself a map of integer ids to extendable objects. * <P> * If a PropertySet is cached then so are all property sets * derived from that property set. However, derived property * sets do not have their own map. Instead objects of the * derived property set are put in the map for the base property * set. */ private Map<ExtendablePropertySet<?>, Map<Integer, WeakReference<ExtendableObject>>> objectMaps = new HashMap<ExtendablePropertySet<?>, Map<Integer, WeakReference<ExtendableObject>>>(); private class ParentList { ExtendablePropertySet<?> parentPropertySet; ListPropertyAccessor listProperty; ParentList(ExtendablePropertySet<?> parentPropertySet, ListPropertyAccessor listProperty) { this.parentPropertySet = parentPropertySet; this.listProperty = listProperty; } public String getColumnName() { return listProperty.getName().replace('.', '_'); } } /** * A map of PropertySet objects to non-null Vector objects. * Each Vector object is a list of ParentList objects. * An entry exists in this map for all property sets that are * not extension property sets. For each property set, the * vector contains a list of the list properties in all property * sets that contain a list of objects of the property set. */ private Map<ExtendablePropertySet<?>, Vector<ParentList>> tablesMap = null; public SessionManager(Connection connection) throws SQLException { this.connection = connection; /* * Set on the flag that indicates if we are operating with a database that * has non-standard features that affect us. */ String databaseProductName = connection.getMetaData().getDatabaseProductName(); if (databaseProductName.equals("HSQL Database Engine")) { isHsqldb = true; } // Create a weak reference map for every base property set. for (ExtendablePropertySet<?> propertySet: PropertySet.getAllExtendablePropertySets()) { if (propertySet.getBasePropertySet() == null) { objectMaps.put(propertySet, new HashMap<Integer, WeakReference<ExtendableObject>>()); } } try { this.reusableStatement = connection.createStatement(); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException("SQL Exception: " + e.getMessage()); } // Create a statement for our use. Statement stmt = connection.createStatement(); /* * Find all properties in any property set that are a list of objects * with the type as this property set. A column must exist in this table * for each such property that exists in another property set. * * The exception is that no such column exists if the list property is * in the session object (not including extentions of the session * object). This is an optimization that saves columns. The optimization * works because we know there is only ever a single session object. * * The reason why extensions are not included is because we do not know * what lists may be added in extensions. A list may be added that * contains the same object type as one of the session lists. For * example, an extension to the session object may contain a list of * currencies. A parent column must exist in the currency table to * indicate if a currency is in such a list. Otherwise we would know the * currency is in a list property of the session object but we would not * know which list. */ tablesMap = new Hashtable<ExtendablePropertySet<?>, Vector<ParentList>>(); for (ExtendablePropertySet<?> propertySet: PropertySet.getAllExtendablePropertySets()) { Vector<ParentList> list = new Vector<ParentList>(); // List of PropertyAccessors for (ExtendablePropertySet<?> propertySet2: PropertySet.getAllExtendablePropertySets()) { for (ListPropertyAccessor<?> listAccessor: propertySet2.getListProperties2()) { if (listAccessor.getPropertySet() != SessionInfo.getPropertySet()) { if (propertySet.getImplementationClass() == listAccessor.getElementPropertySet().getImplementationClass()) { // Add to the list of possible parents. list.add(new ParentList(propertySet2, listAccessor)); } } } } tablesMap.put(propertySet, list); } // Check that all the required tables and columns exist. // Any missing tables or columns are created at this time. checkDatabase(connection, stmt); /* * Create the single row in the session table, if it does not * already exist. Create this row with default values for * the session properties. */ String sql3 = "SELECT * FROM " + SessionInfo.getPropertySet().getId().replace('.', '_'); System.out.println(sql3); ResultSet rs3 = stmt.executeQuery(sql3); if (!rs3.next()) { String sql = "INSERT INTO " + SessionInfo.getPropertySet().getId().replace('.', '_') + " ("; String columnNames = ""; String columnValues = ""; String separator = ""; for (ScalarPropertyAccessor<?> propertyAccessor: SessionInfo.getPropertySet().getScalarProperties2()) { String columnName = getColumnName(propertyAccessor); Object value = propertyAccessor.getDefaultValue(); columnNames += separator + "\"" + columnName + "\""; columnValues += separator + valueToSQLText(value); separator = ", "; } sql += columnNames + ") VALUES(" + columnValues + ")"; try { System.out.println(sql); stmt.execute(sql); } catch (SQLException e) { // TODO Handle this properly e.printStackTrace(); throw new RuntimeException("internal error"); } // Now try again to get the session row. rs3 = stmt.executeQuery(sql3); rs3.next(); } // Now create the session object from the session database row this.sessionKey = new ObjectKey(rs3, SessionInfo.getPropertySet(), null, this); rs3.close(); stmt.close(); } @Override public Session getSession() { return (Session)sessionKey.getObject(); } /** * @return */ public IDatabaseRowKey getSessionKey() { return sessionKey; } /** * @return */ public Connection getConnection() { return connection; } /** * This method provides a statement object to consumers * which need a statement object and can guarantee that * they will have finished with the statement before * another call to this method is made. Realistically * that means this method should only be called when the * caller has closed the result set before the calling * method returns and, furthermore, no calls are made to * methods that may make SQL queries. */ public Statement getReusableStatement() { return reusableStatement; } @Override public boolean canClose(IWorkbenchWindow window) { // A JDBC database can always be closed without further // input from the user. return true; } @Override public void close() { try { reusableStatement.close(); connection.close(); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException("SQL Exception: " + e.getMessage()); } } @Override public String getBriefDescription() { // TODO: improve this implementation to give more // details of the database. return "JDBC database"; } private IPersistableElement persistableElement = new IPersistableElement() { public String getFactoryId() { return "net.sf.jmoney.jdbcdatastore.SessionFactory"; } public void saveState(IMemento memento) { /* * The open session must be using the database as * specified in the preference pages. Therefore there * is no need to save anything further here. * * If we were to give the user the option at 'open' time * to open a database other than the database specified in * the prefence page then we would have to save that information * here. */ } }; public Object getAdapter(Class adapter) { if (adapter == IPersistableElement.class) { return persistableElement; } if (adapter == IEntryQueries.class) { return this; } return null; } public <E extends ExtendableObject> E getObjectIfMaterialized(ExtendablePropertySet<E> basemostPropertySet, int id) { Map<Integer, WeakReference<ExtendableObject>> result = objectMaps.get(basemostPropertySet); WeakReference<ExtendableObject> object = result.get(id); if (object == null) { // Indicate that the object is not cached. return null; } else { return basemostPropertySet.getImplementationClass().cast(object.get()); } } public <E extends ExtendableObject> void setMaterializedObject(ExtendablePropertySet<E> basemostPropertySet, int id, E extendableObject) { Map<Integer, WeakReference<ExtendableObject>> result = objectMaps.get(basemostPropertySet); result.put(id, new WeakReference<ExtendableObject>(extendableObject)); } /** * This method builds a select statement that joins the table for a given * property set with all the ancestor tables. This results in a result set * that contains all the columns necessary to construct the objects. * * The caller would normally append a WHERE clause to the returned statement * before executing it. * * @param propertySet * @return * @throws SQLException */ String buildJoins(ExtendablePropertySet<?> finalPropertySet) { /* * Some databases (e.g. HDBSQL) execute queries faster if JOIN ON is * used rather than a WHERE clause, and will also execute faster if the * smallest table is put first. The smallest table in this case is the * table represented by typedPropertySet and the larger tables are the * base tables. */ String tableName = finalPropertySet.getId().replace('.', '_'); String sql = "SELECT * FROM " + tableName; for (ExtendablePropertySet<?> propertySet2 = finalPropertySet.getBasePropertySet(); propertySet2 != null; propertySet2 = propertySet2.getBasePropertySet()) { String tableName2 = propertySet2.getId().replace('.', '_'); sql += " JOIN " + tableName2 + " ON " + tableName + "._ID = " + tableName2 + "._ID"; } return sql; } /** * This method creates a new statement on each call. This allows callers * to have multiple result sets active at the same time. * * listProperty may be a list of a derivable property set. We thus will not * know the exact property set of each element in advance. The caller must * pass an the actual property set (a final property set) and this method will * return a result set containing only elements of that property set and containing * columns for all properties of that result set. * * @param parentKey * @param listProperty * @param finalPropertySet * @return * @throws SQLException */ ResultSet executeListQuery(DatabaseListKey<?> listKey, ExtendablePropertySet<?> finalPropertySet) throws SQLException { String sql = buildJoins(finalPropertySet); /* * Add the WHERE clause. There is a parent column with the same name as * the name of the list property. Only if the number in this column is * the same as the id of the owner of this list is the object in this * list. * * Note that there is an optimization. If the parent object is the * session object then no such column will exist. We instead check that * all the other parent columns (if any) are null. */ if (listKey.listPropertyAccessor.getPropertySet() == SessionInfo.getPropertySet()) { String whereClause = ""; String separator = ""; for (ExtendablePropertySet<?> propertySet = finalPropertySet; propertySet != null; propertySet = propertySet.getBasePropertySet()) { Vector<ParentList> possibleContainingLists = tablesMap.get(propertySet); for (ParentList parentList: possibleContainingLists) { whereClause += separator + "\"" + parentList.getColumnName() + "\" IS NULL"; separator = " AND"; } } if (whereClause.length() != 0) { sql += " WHERE " + whereClause; } Statement stmt = connection.createStatement(); System.out.println(sql); return stmt.executeQuery(sql); } else { /* * Add a WHERE clause that limits the result set to those rows * that are in the appropriate list in the appropriate parent object. */ sql += " WHERE \"" + listKey.listPropertyAccessor.getName().replace('.', '_') + "\" = ?"; System.out.println(sql + " : " + listKey.parentKey.getRowId()); PreparedStatement stmt = connection.prepareStatement(sql); stmt.setInt(1, listKey.parentKey.getRowId()); return stmt.executeQuery(); } } /** * @param propertySet * @param values * @param listProperty * @param parent * @param sessionManager * * @return The id of the inserted row */ public int insertIntoDatabase(ExtendablePropertySet<?> propertySet, ExtendableObject newObject, DatabaseListKey<?> listKey) { int rowId = -1; // We must insert into the base table first, then the table for the objects // derived from the base and so on. The reason is that each derived table // has a primary key field that is a foreign key into its base table. // We can get the chain of property sets only by starting at the given // property set and repeatedly getting the base property set. We must // therefore store these so that we can loop through the property sets in // the reverse order. Vector<ExtendablePropertySet<?>> propertySets = new Vector<ExtendablePropertySet<?>>(); for (ExtendablePropertySet<?> propertySet2 = propertySet; propertySet2 != null; propertySet2 = propertySet2.getBasePropertySet()) { propertySets.add(propertySet2); } for (int index = propertySets.size()-1; index >= 0; index--) { ExtendablePropertySet<?> propertySet2 = propertySets.get(index); String sql = "INSERT INTO " + propertySet2.getId().replace('.', '_') + " ("; String columnNames = ""; String columnValues = ""; String separator = ""; /* * If this is a basemost property set then the _ID column will be * auto-generated by the database. If this is a derived property * set then we must insert the id that had been assigned when the * row in the basemost table was inserted. */ if (index != propertySets.size()-1) { columnNames += separator + "_ID"; columnValues += separator + Integer.toString(rowId); separator = ", "; } for (ScalarPropertyAccessor<?> propertyAccessor: propertySet2.getScalarProperties2()) { String columnName = getColumnName(propertyAccessor); // Get the value from the passed property value array. Object value = newObject.getPropertyValue(propertyAccessor); columnNames += separator + "\"" + columnName + "\""; columnValues += separator + valueToSQLText(value); separator = ", "; } /* Set the parent id in the appropriate column. * * If the containing list property is a property in one of the three * lists in the session object * then, as an optimization, there is no parent column. */ if (listKey.listPropertyAccessor.getElementPropertySet() == propertySet2 && listKey.listPropertyAccessor.getPropertySet() != SessionInfo.getPropertySet()) { String valueString = Integer.toString(listKey.parentKey.getRowId()); String parentColumnName = listKey.listPropertyAccessor.getName().replace('.', '_'); columnNames += separator + "\"" + parentColumnName + "\""; columnValues += separator + valueString; separator = ", "; } /* * If the base-most property set and it is derivable, the * _PROPERTY_SET column must be set. */ if (propertySet2.getBasePropertySet() == null && propertySet2.isDerivable()) { columnNames += separator + "_PROPERTY_SET"; // Set to the id of the final // (non-derivable) property set for this object. ExtendablePropertySet<?> finalPropertySet = propertySets.get(0); columnValues += separator + "\'" + finalPropertySet.getId() + "\'"; separator = ", "; } sql += columnNames + ") VALUES(" + columnValues + ")"; try { System.out.println(sql); /* * Insert the row and, if this is a basemost table, get the * value of the auto-generated key. */ if (index == propertySets.size()-1) { ResultSet rs; if (isHsqldb) { /* * HSQLDB does not, as of 1.8.0.7, support the JDBC * standard way of getting the generated key. We must do * things slightly differently. */ reusableStatement.execute(sql); rs = reusableStatement.executeQuery("CALL IDENTITY()"); } else { reusableStatement.execute(sql, Statement.RETURN_GENERATED_KEYS); rs = reusableStatement.getGeneratedKeys(); } rs.next(); rowId = rs.getInt(1); rs.close(); } else { reusableStatement.execute(sql); } } catch (SQLException e) { // TODO Handle this properly e.printStackTrace(); throw new RuntimeException("internal error"); } } return rowId; } public <E extends ExtendableObject> void reparentInDatabase(E extendableObject, DatabaseListKey<E> newListKey) { IDatabaseRowKey objectKey = (IDatabaseRowKey)extendableObject.getObjectKey(); ListKey originalListKey = extendableObject.getParentListKey(); IDatabaseRowKey originalParentKey = (IDatabaseRowKey)originalListKey.getParentKey(); try { boolean priorAutocommitState = connection.getAutoCommit(); connection.setAutoCommit(false); /* * We may need one or two updates, depending on whether the column containing * the original parent and the column containing the new parent are in the same * table. */ try { /* * If the containing list property is a property in one of the three * lists in the session object then, as an optimization, there is no * parent column. * * Clear out the original parent id (unless the containing list is one * of the three lists in the extendable session object). */ if (originalListKey.getListPropertyAccessor().getPropertySet() != SessionInfo.getPropertySet()) { String parentColumnName = originalListKey.getListPropertyAccessor().getName().replace('.', '_'); String sql = "UPDATE " + originalListKey.getListPropertyAccessor().getElementPropertySet().getId().replace('.', '_') + " SET " + parentColumnName + "=NULL" + " WHERE _ID=" + objectKey.getRowId() + " AND " + parentColumnName + "=" + originalParentKey.getRowId(); System.out.println(sql); int numberUpdated = reusableStatement.executeUpdate(sql); if (numberUpdated != 1) { throw new RuntimeException("internal error"); } connection.commit(); } /* * Set the new parent id (unless the containing list is one of the three * lists in the extendable session object). */ if (newListKey.listPropertyAccessor.getPropertySet() != SessionInfo.getPropertySet()) { String parentColumnName = newListKey.listPropertyAccessor.getName().replace('.', '_'); String sql = "UPDATE " + newListKey.listPropertyAccessor.getElementPropertySet().getId().replace('.', '_') + " SET " + parentColumnName + "=" + newListKey.parentKey.getRowId() + " WHERE _ID=" + objectKey.getRowId() + " AND " + parentColumnName + " IS NULL"; System.out.println(sql); int numberUpdated = reusableStatement.executeUpdate(sql); if (numberUpdated != 1) { throw new RuntimeException("internal error"); } } } finally { connection.setAutoCommit(priorAutocommitState); } } catch (SQLException e) { // TODO Handle this properly e.printStackTrace(); throw new RuntimeException("internal error"); } } /** * Execute SQL UPDATE statements to update the database with * the new values of the properties of an object. * <P> * The SQL statements will verify the old values of the properties * in the WHERE clause. If the database does not contain an object * with the expected old property values that an exception is raised, * causing the transaction to be rolled back. * * @param rowId * @param oldValues * @param newValues * @param sessionManager */ public void updateProperties(ExtendablePropertySet<?> propertySet, int rowId, Object[] oldValues, Object[] newValues) { Statement stmt = getReusableStatement(); // The array of property values contains the properties from the // base table first, then the table derived from that and so on. // We therefore process the tables starting with the base table // first. This requires first copying the property sets into // an array so that we can iterate them in reverse order. Vector<ExtendablePropertySet<?>> propertySets = new Vector<ExtendablePropertySet<?>>(); for (ExtendablePropertySet<?> propertySet2 = propertySet; propertySet2 != null; propertySet2 = propertySet2.getBasePropertySet()) { propertySets.add(propertySet2); } int propertyIndex = 0; for (int index = propertySets.size()-1; index >= 0; index--) { ExtendablePropertySet<?> propertySet2 = propertySets.get(index); String sql = "UPDATE " + propertySet2.getId().replace('.', '_') + " SET "; String updateClauses = ""; String whereTerms = ""; String separator = ""; for (ScalarPropertyAccessor<?> propertyAccessor: propertySet2.getScalarProperties2()) { if (propertyAccessor.getIndexIntoScalarProperties() != propertyIndex) { throw new RuntimeException("index mismatch"); } // See if the value of the property has changed. Object oldValue = oldValues[propertyIndex]; Object newValue = newValues[propertyIndex]; propertyIndex++; if (!JMoneyPlugin.areEqual(oldValue, newValue)) { String columnName = getColumnName(propertyAccessor); updateClauses += separator + "\"" + columnName + "\"=" + valueToSQLText(newValue); if (oldValue != null) { whereTerms += " AND \"" + columnName + "\"=" + valueToSQLText(oldValue); } else { whereTerms += " AND \"" + columnName + "\" IS NULL"; } separator = ", "; } } // If no properties have been updated in a table then no update // statement should be executed. if (!separator.equals("")) { sql += updateClauses + " WHERE _ID=" + rowId + whereTerms; try { System.out.println(sql); int numberUpdated = stmt.executeUpdate(sql); if (numberUpdated != 1) { // This could happen if a column in the table contains a string // serialization of a custom object, and the column contained a string // that failed to construct a value. In that case, the prior property value will // be null be the value in the database will be non-null. throw new RuntimeException("Update failed. Row with expected data was not found."); } } catch (SQLException e) { // TODO Handle this properly e.printStackTrace(); throw new RuntimeException("internal error"); } } } } /** * Given a value of a property as an Object, return the text that * represents the value in an SQL statement. * * @param newValue * @return */ // TODO: If we always used prepared statements with parameters // then we may not need this method at all. private static String valueToSQLText(Object value) { String valueString; if (value != null) { Class<?> valueClass = value.getClass(); if (valueClass == String.class || valueClass == char.class || valueClass == Character.class) { valueString = '\'' + value.toString().replaceAll("'", "''") + '\''; } else if (value instanceof Date) { Date date = (Date)value; valueString = '\'' + dateFormat.format(date) + '\''; } else if (value instanceof Boolean) { // MS SQL does not allow true and false, // even though HSQL does. So we cannot use toString. Boolean bValue = (Boolean)value; valueString = bValue.booleanValue() ? "1" : "0"; } else if (ExtendableObject.class.isAssignableFrom(valueClass)) { ExtendableObject extendableObject = (ExtendableObject)value; IDatabaseRowKey key = (IDatabaseRowKey)extendableObject.getObjectKey(); valueString = Integer.toString(key.getRowId()); } else if (Number.class.isAssignableFrom(valueClass)) { valueString = value.toString(); } else { /* * All other objects are serialized to a string. */ valueString = '\'' + value.toString().replaceAll("'", "''") + '\''; } } else { valueString = "NULL"; } return valueString; } /** * Execute SQL DELETE statements to remove the given object * from the database. * * @param objectKey * @return true if the object was deleted, false if the object * was not not deleted because there are references to it * in the database * @throws RuntimeException if either an SQLException occurs or if * the object did not exist in the database or if some * other integrity violation was found in the database */ public boolean deleteFromDatabase(IDatabaseRowKey objectKey) { ExtendablePropertySet<?> propertySet = PropertySet.getPropertySet(objectKey.getObject().getClass()); Statement stmt = getReusableStatement(); /* * Because we cannot always use CASCADE, we must first delete objects * in list properties contained in this object. This is a recursive * process. */ deleteListElements(objectKey); /* * Because each table for a derived class contains a foreign key * constraint to the table for the base class, we must delete the rows * starting with the most derived table and ending with the base-most * table. * * Alternatively, we could have set the 'CASCADE' option for delete in * the database and just delete the row in the base-most table. However, * it is perhaps safer not to use 'CASCADE'. */ for (ExtendablePropertySet<?> propertySet2 = propertySet; propertySet2 != null; propertySet2 = propertySet2.getBasePropertySet()) { String sql = "DELETE FROM " + propertySet2.getId().replace('.', '_') + " WHERE _ID=" + objectKey.getRowId(); try { System.out.println(sql); int rowCount = stmt.executeUpdate(sql); if (rowCount != 1) { if (rowCount == 0 && propertySet2 == propertySet) { /* * The object does not exist in the database. It is * possible that another process deleted it so we ignore * this condition. */ } else { throw new RuntimeException("database is inconsistent"); } } } catch (SQLException e) { if (e.getSQLState().equals("23000")) { /* * An attempt has been made to delete an object that has * references to it. This particular error, unlike all other * SQL errors, is treated as a valid result, not an error. * This is because the caller may legitimately attempt to * delete such rows because this saves the caller from * having to check for references itself (not a trivial * task, so why not let the database do the check). */ return false; } // TODO Handle this properly e.printStackTrace(); throw new RuntimeException("internal error"); } } return true; } /** * This method deletes the child elements of a given object (objects * contained in list properties of the given object). This method is * recursive, so all descendant objects are deleted. * * We could have used ON DELETE CASCADE to delete these objects. However, * not all databases fully support this. For example, Microsoft SQL Server * does not support ON DELETE CASCADE when a column in a table is * referencing another row in the same table. This makes it unusable for us * because columns can reference other rows in the same table (for example, * an account can have sub-accounts which are rows in the same table). * * @param rowId * @param extendableObject * @param propertySet */ private void deleteListElements(IDatabaseRowKey objectKey) { ExtendableObject extendableObject = objectKey.getObject(); ExtendablePropertySet<?> propertySet = PropertySet.getPropertySet(extendableObject.getClass()); for (ListPropertyAccessor<?> listProperty: propertySet.getListProperties3()) { /* * Find all elements in the list. The child elements will almost * certainly already be cached in memory so this is unlikely to * result in any queries being sent to the database. */ for (ExtendableObject child: extendableObject.getListPropertyValue(listProperty)) { deleteFromDatabase((IDatabaseRowKey)child.getObjectKey()); } } } /** * Construct an object with default property values. * * @param propertySet * @param objectKey The key to this object. This is required by this * method because it must be passed to the constructor. * This method does not call the setObject or setRowId * methods on this key. It is the caller's responsibility * to call these methods. * @param parent * @return */ public <E extends ExtendableObject> E constructExtendableObject(ExtendablePropertySet<E> propertySet, IDatabaseRowKey objectKey, ListKey<? super E> listKey) { E extendableObject = propertySet.constructDefaultImplementationObject(objectKey, listKey); setMaterializedObject(getBasemostPropertySet(propertySet), objectKey.getRowId(), extendableObject); return extendableObject; } private <E2 extends ExtendableObject> IListManager<E2> createListManager(DatabaseListKey<E2> listKey) { return new ListManagerCached<E2>(this, listKey, true); } /** * Construct an object with the given property values. * * @param propertySet * @param objectKey The key to this object. This is required by this * method because it must be passed to the constructor. * This method does not call the setObject or setRowId * methods on this key. It is the caller's responsibility * to call these methods. * @param parent * @param values the values of the scalar properties to be set into this object, * with ExtendableObject properties having the object key in this array * @return */ public <E extends ExtendableObject> E constructExtendableObject(ExtendablePropertySet<E> propertySet, IDatabaseRowKey objectKey, DatabaseListKey<? super E> listKey, IValues values) { E extendableObject = propertySet.constructImplementationObject(objectKey, constructListKey(listKey), values); setMaterializedObject(getBasemostPropertySet(propertySet), objectKey.getRowId(), extendableObject); return extendableObject; } /** * Materialize an object from a row of data. * <P> * This version of this method should be called when * the caller knows the parent of the object to * be materialized (or at least, the key to the parent). * The parent key is passed to this method by the caller * and that saves this method from needing to build a * new parent key from the object's data in the database. * * @param rs * @param propertySet * @param objectKey * @param parentKey * @return * @throws SQLException */ <E extends ExtendableObject> E materializeObject(final ResultSet rs, final ExtendablePropertySet<E> propertySet, final IDatabaseRowKey objectKey, ListKey<? super E> listKey) throws SQLException { /** * The list of parameters to be passed to the constructor * of this object. */ IValues values = new IValues() { public <V> V getScalarValue(ScalarPropertyAccessor<V> propertyAccessor) { String columnName = getColumnName(propertyAccessor); try { Class<V> valueClass = propertyAccessor.getClassOfValueObject(); if (valueClass == Character.class) { return valueClass.cast(rs.getString(columnName).charAt(0)); } else if (valueClass == Long.class) { return valueClass.cast(rs.getLong(columnName)); } else if (valueClass == Integer.class) { return valueClass.cast(rs.getInt(columnName)); } else if (valueClass == String.class) { return valueClass.cast(rs.getString(columnName)); } else if (valueClass == Boolean.class) { return valueClass.cast(rs.getBoolean(columnName)); } else if (valueClass == Date.class) { return valueClass.cast(rs.getDate(columnName)); } else { /* * Must be a user defined object. Construct it using * the string constructor. */ String text = rs.getString(columnName); if (rs.wasNull() || text.length() == 0) { return null; } else { /* * The property value is an class that is in none of the * above categories. We therefore use the string * constructor to construct the object. */ try { return valueClass .getConstructor( new Class [] { String.class } ) .newInstance(new Object [] { text }); } catch (InvocationTargetException e) { /* * An exception was thrown in the constructor. Log * the original exception. We then set the value to * null and continue on the basis that it is better * for the user to lose the value (which was * probably corrupted anyway) than to have the * entire accounting datastore unreadable. */ // TODO: There is a problem with this. Optimistic locking // fails. Any attempt to update this row in the database // will generate an update that tests for the value being // null. However, the value was in actual fact not null. e.getCause().printStackTrace(); return null; } catch (Exception e) { /* * The classes used in the data model should be * checked when the PropertySet and PropertyAccessor * static fields are initialized. Therefore other * plug-ins should not be able to cause an error * here. */ // TODO: put the above mentioned check into // the initialization code. e.printStackTrace(); throw new RuntimeException("internal error"); } } } } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException("database error"); } } public IObjectKey getReferencedObjectKey(ReferencePropertyAccessor<?> propertyAccessor) { String columnName = getColumnName(propertyAccessor); try { int rowIdOfProperty = rs.getInt(columnName); if (rs.wasNull()) { return null; } else { ExtendablePropertySet<? extends ExtendableObject> propertySetOfProperty = PropertySet.getPropertySet(propertyAccessor.getClassOfValueObject()); /* * We must obtain an object key. However, we do not have to create * the object or obtain a reference to the object itself at this time. * Nor do we want to for performance reasons. */ return new ObjectKey(rowIdOfProperty, propertySetOfProperty, SessionManager.this); } } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException("database error"); } } public <E2 extends ExtendableObject> IListManager<E2> getListManager(IObjectKey listOwnerKey, ListPropertyAccessor<E2> listAccessor) { return objectKey.constructListManager(listAccessor); } public Collection<ExtensionPropertySet<?>> getNonDefaultExtensions() { /* * In order to find out which extensions have non-default values, we have to read the property * values from the rowset and compare against the default values given by the accessor. * Note that the values may be null so we use the utility method to do the comparison. */ Collection<ExtensionPropertySet<?>> nonDefaultExtensions = new Vector<ExtensionPropertySet<?>>(); outerLoop: for (ExtensionPropertySet<?> extensionPropertySet: propertySet.getExtensionPropertySets()) { boolean nonDefaultValueFound = false; for (ScalarPropertyAccessor accessor: extensionPropertySet.getScalarProperties1()) { // TODO: Complete this implementation, if it is worth it. On the other hand, perhaps it // is not unacceptable to always create extensions. if (true) { // if (!JMoneyPlugin.areEqual(getValue(rs, accessor), accessor.getDefaultValue())) { nonDefaultExtensions.add(extensionPropertySet); continue outerLoop; } } for (ListPropertyAccessor accessor: extensionPropertySet.getListProperties1()) { // For time being, always create an extension if there is a list property in it. nonDefaultExtensions.add(extensionPropertySet); continue outerLoop; } } return nonDefaultExtensions; } }; E extendableObject = propertySet.constructImplementationObject(objectKey, listKey, values); setMaterializedObject(getBasemostPropertySet(propertySet), objectKey.getRowId(), extendableObject); return extendableObject; } /** * Given a property, return the name of the database column that holds the * values of the property. * * Unless the property is an extension property, we simply use the * unqualified name. That must be unique within the property set and so the * column name will be unique within the table. If the property is an * extension property, however, then the name must be fully qualified * because two plug-ins may use the same name for an extension property and * these two properties cannot have the same column name as they are in the * same table. The the dots are replaced by underscores to keep the names * SQL compliant. * * @param propertyAccessor * @return an SQL compliant column name, guaranteed to be unique within the * table */ String getColumnName(ScalarPropertyAccessor<?> propertyAccessor) { if (propertyAccessor.getPropertySet().isExtension()) { return propertyAccessor.getName().replace('.', '_'); } else { return propertyAccessor.getLocalName(); } } /** * Materialize an object from a row of data. * <P> * This version of this method should be called when the caller does not * know the parent of the object to be materialized. This is the situation * if one object has a reference to another object (ie. the referenced * object is not in a list property) and we need to materialize the * referenced object. * <P> * The parent key is built from data in the row. * * @param rs * @param propertySet * @param key * @return * @throws SQLException */ <E extends ExtendableObject> E materializeObject(ResultSet rs, ExtendablePropertySet<E> propertySet, IDatabaseRowKey key) throws SQLException { /* * We need to obtain the key for the containing list. We do this by * creating one from the data in the result set. */ DatabaseListKey<? super E> parentListKey = buildParentKey(rs, propertySet); ListKey<? super E> listKey = constructListKey(parentListKey); E extendableObject = materializeObject(rs, propertySet, key, listKey); return extendableObject; } /** * Helper method. */ <E extends ExtendableObject> ListKey<E> constructListKey(DatabaseListKey<E> parentListKey) { return new ListKey<E>(parentListKey.parentKey, parentListKey.listPropertyAccessor); } /** * Used for returning result from following method, as Java does not allow methods to * return more than a single value. */ static class DatabaseListKey<E extends ExtendableObject> { IDatabaseRowKey parentKey; ListPropertyAccessor<E> listPropertyAccessor; public static <E extends ExtendableObject> DatabaseListKey<E> construct(IDatabaseRowKey parentKey, ListPropertyAccessor<E> listProperty) { return new DatabaseListKey<E>(parentKey, listProperty); } public DatabaseListKey(IDatabaseRowKey parentKey, ListPropertyAccessor<E> listPropertyAccessor) { this.parentKey = parentKey; this.listPropertyAccessor = listPropertyAccessor; } } /* * We need to obtain the key for the parent object. We do this by * creating one from the data in the result set. * * The property set of the parent object may not be known without * looking at the row data. For example, the parent of an account may be * another account (if the account is a sub-account) or may be the * session. */ <E extends ExtendableObject> DatabaseListKey<? super E> buildParentKey(ResultSet rs, ExtendablePropertySet<E> propertySet) throws SQLException { /* * A column exists in this table for each list which can contain objects * of this type. Only one of these columns can be non-null so we must * find that column. The value of that column will be the integer id of * the parent. * * An optimization allows the column to be absent when the parent * object is the session object (as only one session object may exist). * * For each list that may contain this object, see if the appropriate * column is non-null. */ ParentList matchingParentList = null; int parentId = -1; boolean nonNullValueFound = false; ExtendablePropertySet<? super E> propertySet2 = propertySet; do { Vector<ParentList> list = tablesMap.get(propertySet2); /* * Find all properties in any property set that are a list of objects * with the type as this property set. A column must exist in this table * for each such property that exists in another property set. */ for (ParentList parentList: list) { parentId = rs.getInt(parentList.getColumnName()); if (!rs.wasNull()) { matchingParentList = parentList; nonNullValueFound = true; break; } } propertySet2 = propertySet2.getBasePropertySet(); } while (propertySet2 != null); DatabaseListKey<? super E> listKey; if (!nonNullValueFound) { /* * A database optimization causes no parent column to exist for the * case where the parent object is the session. */ ListPropertyAccessor<? super E> listProperty; if (Commodity.class.isAssignableFrom(propertySet.getImplementationClass())) { listProperty = (ListPropertyAccessor<? super E>)SessionInfo.getCommoditiesAccessor(); } else if (Account.class.isAssignableFrom(propertySet.getImplementationClass())) { listProperty = (ListPropertyAccessor<? super E>)SessionInfo.getAccountsAccessor(); } else if (Transaction.class.isAssignableFrom(propertySet.getImplementationClass())) { listProperty = (ListPropertyAccessor<? super E>)SessionInfo.getTransactionsAccessor(); } else { throw new RuntimeException("bad case"); } listKey = DatabaseListKey.construct(sessionKey, listProperty); } else { IDatabaseRowKey parentKey = new ObjectKey(parentId, matchingParentList.parentPropertySet, this); ListPropertyAccessor<? super E> listProperty = matchingParentList.listProperty; listKey = DatabaseListKey.construct(parentKey, listProperty); } return listKey; } class ColumnInfo { String columnName; String columnDefinition; ExtendablePropertySet<?> foreignKeyPropertySet = null; ColumnNature nature; } private enum ColumnNature { PARENT, SCALAR_PROPERTY } /** * Build a list of columns that we must have in the table that * holds the data for a particular property set. * <P> * The list will depend on the set of installed plug-ins. * <P> * The "_ID" column is required in all tables as a primary * key and is not returned by this method. * * @return A Vector containing objects of class * <code>ColumnInfo</code>. */ private Vector<ColumnInfo> buildColumnList(ExtendablePropertySet<?> propertySet) { Vector<ColumnInfo> result = new Vector<ColumnInfo>(); /* * The parent column requirements depend on which other property sets * have lists. A parent column exists in the table for property set A * for each list property (in any property set) that contains elements * of type A. * * If there is a single place where the property set is listed and that * place is in the session object (or an extension thereof) then no * parent column is necessary because there is only one session object. * * If there is a single place where the property set is listed and that * place is not in the session object (or an extension thereof) then a * parent column is created with the name being the same as the fully * qualified name of the property that lists these objects. The column * will not allow null values. * * If there are multiple places where a property set is listed then a * column is created for each place (but if one of the places is the * session object that no column is created for that place). The columns * will allow null values. At most one of the columns may be non-null. * If all the columns are null then the parent is the session object. * The names of the columns are the fully qualified names of the * properties that list these objects. */ Vector<ParentList> list = tablesMap.get(propertySet); /* * Find all properties in any property set that are a list of objects * with the element type as this property set. A column must exist in * this table for each such property that exists in another property * set. * * These columns default to NULL so that, when objects are inserted, * we need only to set the parent id into the appropriate column and * not worry about the other parent columns. * * If there is only one list property of a type in which an object could * be placed, then we could make the column NOT NULL. However, we would * need more code to adjust the database schema (altering columns to be * NULL or NOT NULL) if plug-ins are added to create other lists in which * the object could be placed. */ for (ParentList parentList: list) { ColumnInfo info = new ColumnInfo(); info.nature = ColumnNature.PARENT; info.columnName = parentList.getColumnName(); info.columnDefinition = "INT DEFAULT NULL NULL"; info.foreignKeyPropertySet = parentList.parentPropertySet; result.add(info); } // The columns for each property in this property set // (including the extension property sets). for (ScalarPropertyAccessor<?> propertyAccessor: propertySet.getScalarProperties2()) { ColumnInfo info = new ColumnInfo(); info.nature = ColumnNature.SCALAR_PROPERTY; info.columnName = getColumnName(propertyAccessor); Class<?> valueClass = propertyAccessor.getClassOfValueObject(); if (valueClass == Integer.class) { info.columnDefinition = "INT"; } else if (valueClass == Long.class) { info.columnDefinition = "BIGINT"; } else if (valueClass == Character.class) { info.columnDefinition = "CHAR"; } else if (valueClass == Boolean.class) { info.columnDefinition = "BIT"; } else if (valueClass == String.class) { /* * HSQLDB is fine with just VARCHAR, but MS SQL will default the * maximum length to 1 which is obviously no good. We therefore * specify the maximum length as 255. */ info.columnDefinition = "VARCHAR(255)"; } else if (valueClass == Date.class) { /* * Although some databases support date types that may be * better suited for dates without times (MS SQL has SMALLDATETIME * and HSQLDB has DATE), only DATETIME is standard and should * be supported by all JDBC implementations. */ info.columnDefinition = "DATETIME"; } else if (ExtendableObject.class.isAssignableFrom(valueClass)) { info.columnDefinition = "INT"; // This call does not work. The method works only when the class // is a class of an actual object and only non-derivable property // sets are returned. // info.foreignKeyPropertySet = PropertySet.getPropertySet(valueClass); // This works. // The return type from a getter for a property that is a reference // to an extendable object must be the getter interface. info.foreignKeyPropertySet = null; for (ExtendablePropertySet<?> propertySet2: PropertySet.getAllExtendablePropertySets()) { if (propertySet2.getImplementationClass() == valueClass) { info.foreignKeyPropertySet = propertySet2; break; } } } else { // All other types are stored as a string by // using the String constructor and // the toString method for conversion. // HSQL is fine with just VARCHAR, but MS SQL will default // the maximum length to 1 which is obviously no good. info.columnDefinition = "VARCHAR(255)"; } // If the property is an extension property then we set // a default value. This saves us from having to set default // value in every insert statement and is a better solution // if other applications (outside JMoney) access the database. if (propertyAccessor.getPropertySet().isExtension()) { Object defaultValue = propertyAccessor.getDefaultValue(); info.columnDefinition += " DEFAULT " + valueToSQLText(defaultValue); } if (propertyAccessor.isNullAllowed()) { info.columnDefinition += " NULL"; } else { info.columnDefinition += " NOT NULL"; } result.add(info); } /* * If the property set is a derivable property set and is the base-most * property set then we must have a column called _PROPERTY_SET. This * column contains the id of the actual (non-derivable) property set of * this object. This column is required because otherwise we would not * know which further tables need to be joined to get the complete set * of properties with which we can construct the object. */ if (propertySet.getBasePropertySet() == null && propertySet.isDerivable()) { ColumnInfo info = new ColumnInfo(); info.columnName = "_PROPERTY_SET"; // 200 should be enough for property set ids. info.columnDefinition = "VARCHAR(200) NOT NULL"; result.add(info); } return result; } private static String[] tableOnlyType = new String[] { "TABLE" }; private void traceResultSet(ResultSet rs) { if (JDBCDatastorePlugin.DEBUG) { try { String x = ""; ResultSetMetaData rsmd = rs.getMetaData(); int cols = rsmd.getColumnCount(); for (int i = 1; i <= cols; i++) { x += rsmd.getColumnLabel(i) + ", "; } System.out.println(x); while (rs.next()) { x = ""; for (int i = 1; i <= cols; i++) { x += rs.getString(i) + ", "; } System.out.println(x); } } catch (Exception SQLException) { throw new RuntimeException("database error"); } System.out.println(""); } } /** * Check the tables and columns in the database. * If a required table does not exist it will be created. * If a table exists but it does not contain all the required * columns, then the required columns will be added to the table. * <P> * There may be additional tables and there may be * additional columns in the required tables. These are * ignored and the data in them are left alone. */ private void checkDatabase(Connection con, Statement stmt) throws SQLException { DatabaseMetaData dmd = con.getMetaData(); for (ExtendablePropertySet<?> propertySet: PropertySet.getAllExtendablePropertySets()) { String tableName = propertySet.getId().replace('.', '_'); // Check that the table exists. ResultSet tableResultSet = dmd.getTables(null, null, tableName.toUpperCase(), tableOnlyType); if (tableResultSet.next()) { Vector<ColumnInfo> columnInfos = buildColumnList(propertySet); for (ColumnInfo columnInfo: columnInfos) { ResultSet columnResultSet = dmd.getColumns(null, null, tableName.toUpperCase(), columnInfo.columnName); if (columnResultSet.next()) { // int dataType = columnResultSet.getInt("DATA_TYPE"); // String typeName = columnResultSet.getString("TYPE_NAME"); // TODO: Check that the column information is // correct. Display a fatal error if it is not. } else { // The column does not exist so we add it. String sql = "ALTER TABLE " + tableName + " ADD \"" + columnInfo.columnName + "\" " + columnInfo.columnDefinition; System.out.println(sql); stmt.execute(sql); } columnResultSet.close(); } } else { // Table does not exist, so create it. createTable(propertySet, stmt); } tableResultSet.close(); } /* * Having ensured that all the tables exist, now create the foreign key * constraints. This must be done in a second pass because otherwise we * might try to create a foreign key constraint before the foreign key * has been created. */ for (ExtendablePropertySet<?> propertySet: PropertySet.getAllExtendablePropertySets()) { String tableName = propertySet.getId().replace('.', '_'); /* * Check the foreign keys in derived tables that point to the base * table row. */ if (propertySet.getBasePropertySet() != null) { String primaryTableName = propertySet.getBasePropertySet().getId().replace('.', '_'); checkForeignKey(dmd, stmt, tableName, "_ID", primaryTableName, true); } /* * Check the foreign keys for columns that reference other objects. * * These may be: * - objects that contain references (as scalar properties) to * other objects. * - the columns that contain the id of the parent object */ Vector<ColumnInfo> columnInfos = buildColumnList(propertySet); for (ColumnInfo columnInfo: columnInfos) { if (columnInfo.foreignKeyPropertySet != null) { String primaryTableName = columnInfo.foreignKeyPropertySet.getId().replace('.', '_'); // TODO: check if HSQL allows ON CASCADE DELETE with a self-referencing table checkForeignKey(dmd, stmt, tableName, columnInfo.columnName, primaryTableName, false/*columnInfo.nature == ColumnNature.PARENT*/); } } } } /** * Checks that the given foreign key exists. If it does not, it is * added. * <P> * There may be other foreign keys between the two tables. That is * ok. * * @param stmt * @param dmd * @param tableName * @param columnName * @param primaryTableName */ private void checkForeignKey(DatabaseMetaData dmd, Statement stmt, String tableName, String columnName, String primaryTableName, boolean onDeleteCascade) throws SQLException { ResultSet columnResultSet2 = dmd.getCrossReference(null, null, primaryTableName.toUpperCase(), null, null, tableName.toUpperCase()); traceResultSet(columnResultSet2); columnResultSet2.close(); ResultSet columnResultSet = dmd.getCrossReference(null, null, primaryTableName.toUpperCase(), null, null, tableName.toUpperCase()); try { while (columnResultSet.next()) { if (columnResultSet.getString("FKCOLUMN_NAME").equalsIgnoreCase(columnName)) { // TODO: There seems to be a mixture of _id and _ID. SQL is not case sensitive // so do a case insensitive comparison. if (columnResultSet.getString("PKCOLUMN_NAME").equalsIgnoreCase("_ID")) { // Foreign key found, so we are done. return; } else { throw new RuntimeException("The database schema is invalid. " + "Table " + tableName.toUpperCase() + " contains a foreign key column called " + columnName + " but it is not constrained to primary key _ID in table " + primaryTableName.toUpperCase() + " as it should be."); } } } // The foreign key constraint does not exist so we add it. String sql = "ALTER TABLE " + tableName + " ADD FOREIGN KEY (\"" + columnName + "\") REFERENCES " + primaryTableName + "(_ID)"; if (onDeleteCascade) { sql += " ON DELETE CASCADE"; } System.out.println(sql); stmt.execute(sql); } finally { columnResultSet.close(); } } /** * Create a table. This method should be called when * a new database is being initialized or when a new * table is needed because a new extendable property * set has been added. * * This method does not create any foreign keys. This is because * the referenced table may be yet exist. The caller must create * the foreign keys in a second pass. * * @param propertySet The property set whose table is to * be created. This property set must not be an * extension property set. (No tables exist for extension * property sets. Extension property sets are supported * by adding columns to the tables for the property sets * which they extend). * @param stmt A <code>Statement</code> object * that is to be used by this method * to submit the 'CREATE TABLE' command. * @throws SQLException */ void createTable(ExtendablePropertySet<?> propertySet, Statement stmt) throws SQLException { /* * The _ID column is always a primary key. However, it has automatically * generated values only for the base tables. Derived tables contain ids * that match the base table. * * HSQLDB requires only IDENTITY be specified for the _ID column and it * is by default a primary key. MS SQL requires that PRIMARY KEY be * specifically specified. HSQLDB allows PRIMARY KEY provided it appears * after IDENTITY. We can keep both databases happy by specifically * including PRIMARY KEY after IDENTITY. */ String sql = "CREATE TABLE " + propertySet.getId().replace('.', '_') + " (_id INT"; if (propertySet.getBasePropertySet() == null) { sql += " IDENTITY"; } sql += " PRIMARY KEY"; Vector<ColumnInfo> columnInfos = buildColumnList(propertySet); for (ColumnInfo columnInfo: columnInfos) { sql += ", \"" + columnInfo.columnName + "\" " + columnInfo.columnDefinition; } sql += ")"; System.out.println(sql); stmt.execute(sql); } /* (non-Javadoc) * @see net.sf.jmoney.model2.ISessionManager#hasEntries(net.sf.jmoney.model2.Account) */ @Override public boolean hasEntries(Account account) { // TODO: improve efficiency of this?????? // or should hasEntries be removed altogether and make caller // call getEntries().isEmpty() ?????? // As long as collections are not being copied unneccessarily, // this is probably better. return !(new AccountEntriesList(this, (IDatabaseRowKey)account.getObjectKey()).isEmpty()); } @Override public Collection<Entry> getEntries(Account account) { return new AccountEntriesList(this, (IDatabaseRowKey)account.getObjectKey()); } /** * @see net.sf.jmoney.model2.IEntryQueries#sumOfAmounts(net.sf.jmoney.model2.CurrencyAccount, java.util.Date, java.util.Date) */ public long sumOfAmounts(CurrencyAccount account, Date fromDate, Date toDate) { IDatabaseRowKey proxy = (IDatabaseRowKey)account.getObjectKey(); try { String sql = "SELECT SUM(amount) FROM net_sf_jmoney_entry, net_sf_jmoney_transaction" + " WHERE account = " + proxy.getRowId() + " AND date >= " + fromDate + " AND date <= " + toDate; System.out.println(sql); ResultSet rs = getReusableStatement().executeQuery(sql); rs.next(); return rs.getLong(0); } catch (SQLException e) { throw new RuntimeException("SQL statement failed"); } } /* (non-Javadoc) * @see net.sf.jmoney.model2.IEntryQueries#getSortedReadOnlyCollection(net.sf.jmoney.model2.CapitalAccount, net.sf.jmoney.model2.PropertyAccessor, boolean) */ public Collection<Entry> getSortedEntries(CapitalAccount account, PropertyAccessor sortProperty, boolean descending) { // TODO implement this. throw new RuntimeException("must implement"); } /* (non-Javadoc) * @see net.sf.jmoney.model2.IEntryQueries#getEntryTotalsByMonth(int, int, int, boolean) */ public long[] getEntryTotalsByMonth(CapitalAccount account, int startYear, int startMonth, int numberOfMonths, boolean includeSubAccounts) { IDatabaseRowKey proxy = (IDatabaseRowKey)account.getObjectKey(); String startDateString = '\'' + new Integer(startYear).toString() + "-" + new Integer(startMonth).toString() + "-" + new Integer(1).toString() + '\''; int endMonth = startMonth + numberOfMonths; int years = (endMonth - 1) / 12; endMonth -= years * 12; int endYear = startYear + years; String endDateString = '\'' + new Integer(endYear).toString() + "-" + new Integer(endMonth).toString() + "-" + new Integer(1).toString() + '\''; String accountList = "(" + proxy.getRowId(); if (includeSubAccounts) { ArrayList<Integer> accountIds = new ArrayList<Integer>(); addEntriesFromSubAccounts(account, accountIds); for (Integer accountId: accountIds) { accountList += "," + accountId; } } accountList += ")"; try { String sql = "SELECT SUM(amount), DateSerial(Year(date),Month(date),1) FROM net_sf_jmoney_entry, net_sf_jmoney_transaction" + " GROUP BY DateSerial(Year(date),Month(date),1)" + " WHERE account IN " + accountList + " AND date >= " + startDateString + " AND date < " + endDateString + " ORDER BY DateSerial(Year(date),Month(date),1)"; System.out.println(sql); ResultSet rs = getReusableStatement().executeQuery(sql); long [] totals = new long[numberOfMonths]; for (int i = 0; i < numberOfMonths; i++) { rs.next(); totals[i] = rs.getLong(0); } return totals; } catch (SQLException e) { throw new RuntimeException("SQL statement failed"); } } private void addEntriesFromSubAccounts(CapitalAccount account, ArrayList<Integer> accountIds) { for (CapitalAccount subAccount: account.getSubAccountCollection()) { IDatabaseRowKey proxy = (IDatabaseRowKey)subAccount.getObjectKey(); accountIds.add(proxy.getRowId()); addEntriesFromSubAccounts(subAccount, accountIds); } } @Override public void startTransaction() { try { connection.setAutoCommit(false); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void commitTransaction() { try { connection.commit(); } catch (SQLException e) { // TODO We need a mechanism to log and report errors e.printStackTrace(); } /* * Note that we want to turn on auto-commit even if * the above commit failed. */ try { connection.setAutoCommit(true); } catch (SQLException e) { // TODO We need a mechanism to log and report errors e.printStackTrace(); } } /** * This is a helper method to get the base-most property set for * a given property set. * * @param propertySet * @return */ public static <E extends ExtendableObject> ExtendablePropertySet<? super E> getBasemostPropertySet(ExtendablePropertySet<E> propertySet) { ExtendablePropertySet<? super E> basePropertySet = propertySet; while (basePropertySet.getBasePropertySet() != null) { basePropertySet = basePropertySet.getBasePropertySet(); } return basePropertySet; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
01220839aa95ad1170ec47e8b4b1921b0fc96844
1c3ef7ab0feea44477a899fcf607ea2607739943
/src/main/java/com/eriz/common/filter/WebConfig.java
90002e94b2b87cf0a70e1916e41458fec1840499
[]
no_license
GitHubzcc/eriz
f7d85f7e194e9a0d9d374b5be4b4dc0f9879aa14
a859f4da036cffd5a5edf1e3d835a0c76dd65440
refs/heads/master
2022-12-07T10:32:16.067886
2019-10-21T13:08:59
2019-10-21T13:08:59
160,458,012
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package com.eriz.common.filter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * 系统web请求配置 * * @author eriz * @date 2019年1月24日 */ @Configuration public class WebConfig extends WebMvcConfigurerAdapter { /** * 配置系统过滤器 */ @SuppressWarnings({"rawtypes", "unchecked"}) @Bean public FilterRegistrationBean filterRegister() { FilterRegistrationBean frBean = new FilterRegistrationBean(); frBean.setFilter(new BaseFilter()); // 过滤拦截器 frBean.addUrlPatterns("/sys/user/*"); return frBean; } /** * 配置系统过滤器 */ @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new BaseInterceptor()).addPathPatterns("/sys/user/*"); } }
[ "471295986@qq.com" ]
471295986@qq.com
262866b4529e064c38310d5cbdf8e9a90c059b8a
0b618b9a6887617bcba80849b7eb1e46aa36d308
/Server/src/RequestClasses/GetProfilePicture.java
b95c80a029d69bfbfc111013410d64bc52bf4002
[]
no_license
ManasUniyal/InterCode
f0b470a58c910bf1f7bfb4b0aa579c384b87c3b9
d5ef473a6548b1dc492abd30932664439035cdc9
refs/heads/master
2020-07-26T09:14:08.793920
2019-10-07T11:41:37
2019-10-07T11:41:37
208,600,276
0
1
null
2019-10-05T16:59:57
2019-09-15T13:44:19
Java
UTF-8
Java
false
false
919
java
package RequestClasses; import java.io.Serializable; public class GetProfilePicture implements Serializable { private String userID; private byte[] content; private String extension; public GetProfilePicture(String userID) { this.userID = userID; } public GetProfilePicture(String userID, byte[] content, String extension) { this.userID = userID; this.content = content; this.extension = extension; } public String getUserID() { return userID; } public void setUserID(String userID) { this.userID = userID; } public byte[] getContent() { return content; } public void setContent(byte[] content) { this.content = content; } public String getExtension() { return extension; } public void setExtension(String extension) { this.extension = extension; } }
[ "manasuniyal100@gmail.com" ]
manasuniyal100@gmail.com
a395ecc43707ec576342106974fc3627e3b8d843
7de6dce1c4d368c6e19d440823c11d59b60db446
/src/main/java/br/ce/ip/suite/TestSuite.java
973a4f6ef662765e4f9bf0afe45db0293f13d116
[]
no_license
ivanildepestana/Authentication1
2cc4e48242e95c2d02423c7c02f0b6fa2906012d
e29263bf27d236a4a58040d78f8f6c492be1b26b
refs/heads/master
2022-11-06T07:17:54.186094
2020-06-27T23:04:12
2020-06-27T23:04:12
275,465,909
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package br.ce.ip.suite; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import br.ce.ip.test.TestUserChangePassword; import br.ce.ip.test.TestUserSessions; @RunWith(Suite.class) @SuiteClasses({ TestUserSessions.class, TestUserChangePassword.class }) public class TestSuite { }
[ "ivanilde@gmamil.com" ]
ivanilde@gmamil.com
ac60e0e52699057aaa847e1c03faa115142a3f69
d06e0ae816fe39f536f249e5d0a9c2ffac2973e2
/app/src/test/java/com/example/pz/hupuexercise/ExampleUnitTest.java
e02d5f05d23fa610894189b3279b41437342d60b
[]
no_license
xpzzgh/HupuExercise
1278b45a00030ca37cae0884ce7fea95f3bab812
2fea22bfbf28fe6faeb1e0b5665a98f43cb95213
refs/heads/master
2020-12-05T22:36:44.274218
2016-08-29T15:58:43
2016-08-29T15:58:43
66,282,798
3
0
null
null
null
null
UTF-8
Java
false
false
334
java
package com.example.pz.hupuexercise; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "xpzzwy@163.com" ]
xpzzwy@163.com
5e3af0c74682509f3f2aff494b6169597176f565
b5dc11e4b681150c6569feac40d0cb763256a862
/src/main/java/com/zenika/Main.java
651d52feb480691f336b825b40192d68643f1842
[]
no_license
MaBeuLux88/minesweeper
19e9e0eaabb9510f6dbebc63c3aa308f92d5ed65
c684d90aaa5e4583de2231eb16a29686173e0195
refs/heads/master
2021-01-10T17:04:00.757500
2016-08-16T12:59:03
2016-08-16T12:59:03
44,944,584
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
package com.zenika; import java.util.Scanner; public class Main { public static void main(String[] args) { ConsoleGame game = new ConsoleGame(new Scanner(System.in), System.out); game.startGame(); } }
[ "maxime.beugnet@gmail.com" ]
maxime.beugnet@gmail.com
741bc44a72f58f79382e70e3b173a2fac0e2f670
7eab6eda177b5a9024b54726d4e72009ae7eea0d
/src/main/java/com/web/practica11/repositories/UserRepository.java
2a0d5844cfbdcf47babbe341e0d8e1b1946456b5
[]
no_license
EdwPimentel/Practica11WAr-e
11ba901fedc4da02e7494b2f43c087c0ad6e404d
186c22c91b1b337219fa4ce053174f9090a36f6a
refs/heads/master
2020-07-13T06:57:47.275259
2019-08-28T22:58:33
2019-08-28T22:58:33
205,025,008
0
0
null
null
null
null
UTF-8
Java
false
false
567
java
package com.web.practica11.repositories; import com.web.practica11.entity.Role; import com.web.practica11.entity.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Set; @Repository public interface UserRepository extends JpaRepository<User, Integer> { User findByRolSet(Set<Role> rol); User findByUsername(String name); User findByPassword(String password); User findByUserId(int id); List<User> findAllByEnabled(Boolean enabled); }
[ "edssowpg13@hotmail.com" ]
edssowpg13@hotmail.com
7d5461c8ed3d6d1c6d39e1a3aa717c6b369a5b45
39de221543f1ff3897159bac16405daab7e4a278
/src/main/java/com/waes/comparator/service/Base64DiffService.java
240d26eb1b82959aa7c68c6ff2b2febf9564a468
[]
no_license
volkangumus/comparator
495dc6ba837cf01d15a41a8de96b6311690dd4fe
46c4e53a45fa62bafecaf8e5b06d8768a26c7f57
refs/heads/master
2022-11-19T08:50:33.835479
2019-07-14T20:55:33
2019-07-14T20:55:33
196,880,733
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package com.waes.comparator.service; import com.waes.comparator.controller.request.AspectEnum; /** * Created by volkangumus on 14.07.2019 */ public interface Base64DiffService { void save(Long id, String data, AspectEnum aspect); String getDiff(Long id); }
[ "noreply@github.com" ]
volkangumus.noreply@github.com
9a5f51b1ee79fca40451514ce9526f6a4682a458
4aad396b15ee0cf28d6d152672637dbfff173f61
/android/app/src/main/java/com/collaction/MainActivity.java
ff4c8fdc70c4f9546a0235ec6c93b4660267b87c
[]
no_license
leonardo409188/ContactsList
20b400ef805c66c3874a2894f31c48c1eb836283
e0b0b66c10cd9ba7aee4c97e356702568dd15535
refs/heads/master
2023-02-22T13:21:08.001216
2021-01-28T03:24:36
2021-01-28T03:24:36
333,630,784
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.collaction; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "collaction"; } }
[ "leonardo_94_@hotmail.com" ]
leonardo_94_@hotmail.com
af6638c2dd4bbc4a5a167313ff42eab45170ad9c
6b23d8ae464de075ad006c204bd7e946971b0570
/WEB-INF/plugin/webmail/src/jp/groupsession/v2/wml/wml120/Wml120Action.java
7724a0b6b50a3f33c0bc7dda000423692e2948b1
[]
no_license
kosuke8/gsession
a259c71857ed36811bd8eeac19c456aa8f96c61e
edd22517a22d1fb2c9339fc7f2a52e4122fc1992
refs/heads/master
2021-08-20T05:43:09.431268
2017-11-28T07:10:08
2017-11-28T07:10:08
112,293,459
0
0
null
null
null
null
UTF-8
Java
false
false
3,874
java
package jp.groupsession.v2.wml.wml120; import java.sql.Connection; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import jp.co.sjts.util.NullDefault; import jp.groupsession.v2.wml.AbstractWebmailAction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; /** * <br>[機 能] WEBメール ラベル登録画面のアクションクラス * <br>[解 説] * <br>[備 考] * * @author JTS */ public class Wml120Action extends AbstractWebmailAction { /** Logging インスタンス */ private static Log log__ = LogFactory.getLog(Wml120Action.class); /** * <br>[機 能] アクション実行 * <br>[解 説] コントローラの役割を担います * <br>[備 考] * @param map アクションマッピング * @param form アクションフォーム * @param req リクエスト * @param res レスポンス * @param con コネクション * @throws Exception 実行例外 * @return アクションフォーム */ public ActionForward executeAction(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse res, Connection con) throws Exception { log__.debug("START"); ActionForward forward = null; Wml120Form thisForm = (Wml120Form) form; String cmd = NullDefault.getString(req.getParameter("CMD"), ""); if (cmd.equals("confirm")) { //OKボタンクリック forward = __doOK(map, thisForm, req, res, con); } else if (cmd.equals("labelList")) { //戻るボタンクリック forward = map.findForward("labelList"); } else { //初期表示 forward = __doInit(map, thisForm, req, res, con); } return forward; } /** * <br>[機 能] 初期表示 * <br>[解 説] * <br>[備 考] * @param map ActionMapping * @param form フォーム * @param req HttpServletRequest * @param res HttpServletResponse * @param con DB Connection * @return ActionForward * @throws Exception 実行時例外 */ public ActionForward __doInit(ActionMapping map, Wml120Form form, HttpServletRequest req, HttpServletResponse res, Connection con) throws Exception { con.setAutoCommit(true); Wml120ParamModel paramMdl = new Wml120ParamModel(); paramMdl.setParam(form); Wml120Biz biz = new Wml120Biz(); biz.setInitData(con, paramMdl); paramMdl.setFormData(form); return map.getInputForward(); } /** * <br>[機 能] OKボタンクリック時処理 * <br>[解 説] * <br>[備 考] * @param map ActionMapping * @param form フォーム * @param req HttpServletRequest * @param res HttpServletResponse * @param con DB Connection * @return ActionForward * @throws Exception 実行時例外 */ public ActionForward __doOK(ActionMapping map, Wml120Form form, HttpServletRequest req, HttpServletResponse res, Connection con) throws Exception { // トランザクショントークン設定 this.saveToken(req); //入力チェック ActionErrors errors = form.validateCheck(req); if (!errors.isEmpty()) { addErrors(req, errors); return __doInit(map, form, req, res, con); } return map.findForward("confirm"); } }
[ "PK140601-29@PK140601-29" ]
PK140601-29@PK140601-29
470eef4b8641c5c7b96c1d063607509fe2f37597
bd738f5f4dd2d4e52a2c1358ba50cbef3220d432
/src/main/java/com/example/trello/controllers/CardController.java
b5c4a9413f47376d25164d0e38e071d43100e59d
[]
no_license
dailydismay/trello-clone-api
3bf2a3d3447d6a836957831edfc4fa5753bfbcad
4dbf2c6d44742f8dbfbb2f7cd3c0919abdb20e39
refs/heads/master
2022-07-02T00:30:10.574564
2020-05-13T23:03:00
2020-05-13T23:03:00
262,864,149
0
0
null
null
null
null
UTF-8
Java
false
false
2,360
java
package com.example.trello.controllers; import com.example.trello.dtos.CreateCardDto; import com.example.trello.dtos.responses.AuthResponse; import com.example.trello.models.CardEntity; import com.example.trello.security.jwt.JwtUser; import com.example.trello.services.CardService; import io.swagger.annotations.ApiResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @RestController @RequestMapping("/api/cards") public class CardController { private CardService cardService; @Autowired public CardController(CardService cardService) { this.cardService = cardService; } @ApiResponse(code = 200, message = "card created success", response = CardEntity.class) @PostMapping public ResponseEntity create( @Valid @RequestBody CreateCardDto createCardDto, @AuthenticationPrincipal JwtUser jwtUser, @RequestParam Long listId ) { return ResponseEntity.status(201).body( cardService.create(listId, createCardDto, jwtUser.getId()) ); } @ApiResponse(code = 200, message = "card archived success", response = CardEntity.class) @PutMapping("/{id}/archive") public ResponseEntity archive( @PathVariable Long id, @AuthenticationPrincipal JwtUser jwtUser ) { CardEntity card = cardService.archive(id, jwtUser.getId()); return ResponseEntity.ok(card); } @ApiResponse(code = 200, message = "card moved success", response = CardEntity.class) @PutMapping("/{id}/move") public ResponseEntity move( @PathVariable Long id, @AuthenticationPrincipal JwtUser jwtUser, @RequestParam Long listId ) { return ResponseEntity.ok(cardService.move(id, listId, jwtUser.getId())); } @ApiResponse(code = 204, message = "card removed success") @DeleteMapping("/{id}") public ResponseEntity delete( @AuthenticationPrincipal JwtUser jwtUser, @PathVariable Long id ) { cardService.deleteOne(id, jwtUser.getId()); return ResponseEntity.status(204).build(); } }
[ "zabozlaeviv@sovcombank.ru" ]
zabozlaeviv@sovcombank.ru
a70e963b616197e9a215c347bb37cffd68b1329c
54c8c167565f5b6c0a989f8abe8265674eaac3a9
/src/fr/adrienbrault/idea/symfony2plugin/intentions/yaml/dict/YamlUpdateArgumentServicesCallback.java
832e78c7e9e3c35a4e157b30a322ca9207af3b91
[ "MIT" ]
permissive
Codechanic/idea-php-symfony2-plugin
4cf904edb4dde56ecaba2445437ea578c6af3907
55239d8595e41cf10c2deee0ea95d1b8432bdf19
refs/heads/master
2020-12-27T09:35:08.896485
2016-03-23T12:55:27
2016-03-23T12:55:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,549
java
package fr.adrienbrault.idea.symfony2plugin.intentions.yaml.dict; import com.intellij.openapi.editor.Document; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import fr.adrienbrault.idea.symfony2plugin.action.ServiceActionUtil; import fr.adrienbrault.idea.symfony2plugin.translation.util.TranslationInsertUtil; import fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper; import org.apache.commons.lang.StringUtils; import org.jetbrains.yaml.psi.YAMLArray; import org.jetbrains.yaml.psi.YAMLCompoundValue; import org.jetbrains.yaml.psi.YAMLKeyValue; import org.jetbrains.yaml.psi.YAMLSequence; import java.util.ArrayList; import java.util.List; /** * @author Daniel Espendiller <daniel@espendiller.net> */ public class YamlUpdateArgumentServicesCallback implements ServiceActionUtil.InsertServicesCallback { private final Project project; private final YAMLKeyValue argumentsKeyValue; private final YAMLKeyValue yamlKeyValue; public YamlUpdateArgumentServicesCallback(Project project, YAMLKeyValue argumentsKeyValue, YAMLKeyValue serviceKeyValue) { this.project = project; this.argumentsKeyValue = argumentsKeyValue; this.yamlKeyValue = serviceKeyValue; } @Override public void insert(List<String> items) { PsiElement yamlCompoundValue = argumentsKeyValue.getValue(); if(!(yamlCompoundValue instanceof YAMLCompoundValue)) { return; } int appendEndOffset = -1; String insertString = null; PsiElement firstChild1 = yamlCompoundValue.getFirstChild(); if(firstChild1 instanceof YAMLSequence) { // - @foo // search indent and EOL value String indent = argumentsKeyValue.getValueIndent(); String eol = TranslationInsertUtil.findEol(yamlKeyValue); List<String> yamlSequences = new ArrayList<String>(); for (String item : items) { // should be faster then YamlPsiElementFactory.createFromText yamlSequences.add(indent + String.format("- @%s", StringUtils.isNotBlank(item) ? item : "?")); } appendEndOffset = yamlCompoundValue.getTextRange().getEndOffset(); insertString = eol + StringUtils.join(yamlSequences, eol); } else if(firstChild1 instanceof YAMLArray) { // we wound array List<PsiElement> yamlArguments = YamlHelper.getYamlArrayOnSequenceOrArrayElements((YAMLCompoundValue) yamlCompoundValue); if(yamlArguments != null && yamlArguments.size() > 0) { appendEndOffset = yamlArguments.get(yamlArguments.size() - 1).getTextRange().getEndOffset(); List<String> arrayList = new ArrayList<String>(); for (String item : items) { arrayList.add("@" + (StringUtils.isNotBlank(item) ? item : "?")); } insertString = ", " + StringUtils.join(arrayList, ", "); } } if(appendEndOffset == -1) { return; } PsiDocumentManager manager = PsiDocumentManager.getInstance(project); Document document = manager.getDocument(yamlKeyValue.getContainingFile()); if (document == null) { return; } document.insertString(appendEndOffset, insertString); manager.doPostponedOperationsAndUnblockDocument(document); manager.commitDocument(document); } }
[ "espendiller@gmx.de" ]
espendiller@gmx.de
90f39e404ce77fe7276a9c3311835e908ea4c784
aad08a1fc1a6fc7c1cc28210a8e2dd40cb8d3bbd
/src/main/java/uiProgram/SqlDatabasInterfaceController.java
e4824b68b64b5bcc90cd16fe0256bfb4ce3aa3c1
[]
no_license
flaime/ResultatTavalaKanot
759dade38d4a62d4e537184b64dbef74d548ac6c
82c4c58a824be42902ad2845848d516b66df308f
refs/heads/master
2023-05-10T22:00:02.290005
2023-05-02T20:22:37
2023-05-02T20:22:37
68,795,317
0
0
null
null
null
null
UTF-8
Java
false
false
1,539
java
package uiProgram; import javafx.fxml.FXML; import javafx.scene.control.*; import javafx.scene.text.Text; import javafx.stage.FileChooser; import loadDatabasParts.DatabasClass; import loadDatabasParts.LoadDatabasInformation; import java.io.File; import java.sql.SQLException; public class SqlDatabasInterfaceController implements LoadDatabasInformation { @FXML Button send; @FXML Button selectdatabas; @FXML TextField databasURL; @FXML TextField sql; @FXML TextArea sqlOutput; @FXML Text databasInfo; DatabasClass databasClass = null; private File databaseFile = null; @FXML private void initialize() { send.setDisable(true); } /** * Handle datafilieShoser button */ final FileChooser fileChooser = new FileChooser(); @FXML private void handleShoseDatabas(){ System.out.println("selecting file"); databaseFile = fileChooser.showOpenDialog(null); if(databaseFile !=null){ databasURL.setText(databaseFile.getAbsolutePath()); try { databasClass = new DatabasClass(databasURL.getText()); send.setDisable(false); } catch (Exception e) { e.printStackTrace(); databasInfo.setText("could not connect to DB is the correct file? Logging error to terminal"); databasURL.setText(""); send.setDisable(true); } }else{ databasURL.setText(""); send.setDisable(true); } } @FXML private void runQuery(){ // try { } @Override public void addDatabasLoadInfo(String info) { databasInfo.setText(info); } }
[ "ah.linus@gmail.com" ]
ah.linus@gmail.com
55cc1f4c2d84ffe7e915d2f9bf5e102c6886b516
d71d92c155e832ec28f0f41f74ddc213bbfc434f
/app/src/main/java/com/example/myapplication/Club/ClubTotalPost.java
0608aba7bce30576730eeaffda09bc30d9ffcf77
[ "MIT" ]
permissive
SusungHong/APP_WIA_ONANDON
970dd142151ad7b048371bec6c9b9f4745802d00
93c3918e1f9b82d817878385169b4d851cdf46d1
refs/heads/master
2023-03-19T00:41:41.770565
2020-11-08T14:59:50
2020-11-08T14:59:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,151
java
package com.example.myapplication.Club; import android.content.Intent; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.databinding.DataBindingUtil; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.myapplication.R; import com.example.myapplication.databinding.ClubPostListItemBinding; import com.example.myapplication.model.ClubDTO; import com.example.myapplication.model.PostDTO; import com.example.myapplication.model.UserDTO; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.firestore.DocumentSnapshot; import com.google.firebase.firestore.EventListener; import com.google.firebase.firestore.FirebaseFirestore; import com.google.firebase.firestore.FirebaseFirestoreException; import com.google.firebase.firestore.Query; import com.google.firebase.firestore.QueryDocumentSnapshot; import com.google.firebase.firestore.QuerySnapshot; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; public class ClubTotalPost extends Fragment { private FirebaseUser user; private FirebaseFirestore firestore; String budae; TextView noPost; public ClubTotalPost(){ user = FirebaseAuth.getInstance().getCurrentUser(); firestore = FirebaseFirestore.getInstance(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_club_total_post, container, false); noPost = view.findViewById(R.id.no_post); budae = getArguments().getString("budae"); RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.club_total_post_recyclerview); recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext())); recyclerView.setAdapter(new DetailRecyclerViewAdapter()); return view; } private class DetailRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{ private ArrayList<PostDTO> contentDTOs; private ArrayList<String> contentUidList; DetailRecyclerViewAdapter() { contentDTOs = new ArrayList<>(); contentUidList = new ArrayList<>(); firestore.collection(budae+"동아리게시판").orderBy("timestamp", Query.Direction.DESCENDING) .addSnapshotListener(new EventListener<QuerySnapshot>() { @Override public void onEvent(@Nullable QuerySnapshot value, @Nullable FirebaseFirestoreException error) { contentDTOs.clear(); contentUidList.clear(); if (value == null) return; for (QueryDocumentSnapshot doc : value) { PostDTO item = doc.toObject(PostDTO.class); contentDTOs.add(item); contentUidList.add(doc.getId()); } if(contentDTOs.size() == 0){ noPost.setVisibility(View.VISIBLE); } else{ noPost.setVisibility(View.GONE); } notifyDataSetChanged(); } }); } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.club_post_list_item, parent, false); return new CustomViewHolder(view); } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) { final ClubPostListItemBinding binding = ((CustomViewHolder) holder).getBinding(); binding.explain.setText(contentDTOs.get(position).explain); binding.title.setText(contentDTOs.get(position).title); binding.kindFirst.setVisibility(View.GONE); binding.kindSecond.setVisibility(View.GONE); binding.kindThird.setVisibility(View.GONE); binding.isPhoto.setVisibility(View.GONE); binding.more.setVisibility(View.GONE); int cnt = 0; if(contentDTOs.get(position).kind.containsKey("first")){ binding.kindFirst.setText(contentDTOs.get(position).kind.get("first")); binding.kindFirst.setVisibility(View.VISIBLE); if(contentDTOs.get(position).kind.get("first").length() >= 4){ cnt++; } } if(contentDTOs.get(position).kind.containsKey("second")){ binding.kindSecond.setText(contentDTOs.get(position).kind.get("second")); binding.kindSecond.setVisibility(View.VISIBLE); if(contentDTOs.get(position).kind.get("second").length() >= 4){ cnt++; } } if(contentDTOs.get(position).kind.containsKey("third")){ binding.kindThird.setText(contentDTOs.get(position).kind.get("third")); binding.kindThird.setVisibility(View.VISIBLE); if(contentDTOs.get(position).kind.get("third").length() >= 4){ cnt++; } } if(cnt == 3 && contentDTOs.get(position).isPhoto == 1){ binding.more.setVisibility(View.VISIBLE); binding.kindThird.setVisibility(View.GONE); } binding.commentCountShow.setText(contentDTOs.get(position).commentCount+""); binding.favoriteCountShow.setText(contentDTOs.get(position).favoriteCount+""); if(contentDTOs.get(position).scrap.containsKey(user.getUid())){ binding.scrap.setImageResource(R.drawable.scrap); }else{ binding.scrap.setImageResource(R.drawable.empty_star); } long postDate = contentDTOs.get(position).timestamp; Date date = new Date(postDate); String dateFormat = new SimpleDateFormat("MM/dd").format(date); binding.postDate.setText(dateFormat); if(contentDTOs.get(position).favorites.containsKey(user.getUid())){ binding.favoriteShow.setImageResource(R.drawable.heart); } else{ binding.favoriteShow.setImageResource(R.drawable.empty_heart); } if(contentDTOs.get(position).isPhoto == 1){ binding.isPhoto.setVisibility(View.VISIBLE); } firestore.collection(budae+"동아리").document(contentDTOs.get(position).uid).get() .addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() { @Override public void onSuccess(DocumentSnapshot documentSnapshot) { final ClubDTO clubDTO = documentSnapshot.toObject(ClubDTO.class); binding.clubName.setText(clubDTO.name); binding.itemPost.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getActivity(), ClubPostItemMore.class); intent.putExtra("name", clubDTO.name); intent.putExtra("manager", clubDTO.manager); intent.putExtra("postUid", contentUidList.get(position)); intent.putExtra("budae", budae); startActivity(intent); } }); } }); } @Override public int getItemCount() { return contentDTOs.size(); } } private class CustomViewHolder extends RecyclerView.ViewHolder{ private ClubPostListItemBinding binding; public CustomViewHolder(@NonNull View itemView) { super(itemView); binding = DataBindingUtil.bind(itemView); } ClubPostListItemBinding getBinding(){ return binding; } } }
[ "noreply@github.com" ]
SusungHong.noreply@github.com
6fbf14f632809eca2ef0f98d7b1de76983a3edf7
2597eaf2c898d82b2e907538dc806ed3ca60c049
/src/company/LinkedIn/easy/ShortestWordDistance2.java
edd82c20e464a4d5a1c2ff42f63e8548dfc37f20
[]
no_license
LeeGerry/LeetCodeJava
595983ce1a102483f4abda462594f166c267d661
350c376563ee87f167f58acee5b438d9602e0cac
refs/heads/master
2021-09-11T09:56:24.634935
2018-04-06T16:41:24
2018-04-06T16:41:24
125,871,146
0
0
null
null
null
null
UTF-8
Java
false
false
2,351
java
package company.LinkedIn.easy; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * LeetCode 244 * This is a follow up of Shortest Word Distance. * The only difference is now you are given the list of words * and your method will be called repeatedly many times with different parameters. * How would you optimize it? Design a class which receives a list of words in the constructor, and implements a method that takes two words word1 and word2 and return the shortest distance between these two words in the list. For example, Assume that words = ["practice", "makes", "perfect", "coding", "makes"]. Given word1 = “coding”, word2 = “practice”, return 3. Given word1 = "makes", word2 = "coding", return 1. Note: You may assume that word1 does not equal to word2, and word1 and word2 are both in the list. */ public class ShortestWordDistance2 { Map<String, ArrayList<Integer>> map; public ShortestWordDistance2(String[] words){ map = new HashMap<>(); for (int i = 0; i < words.length; i++) { if (map.containsKey(words[i])) { map.get(words[i]).add(i); } else { ArrayList<Integer> list = new ArrayList<>(); list.add(i); map.put(words[i], list); } } } public int shortest(String word1, String word2) { ArrayList<Integer> word1IndexList = map.get(word1); ArrayList<Integer> word2IndexList = map.get(word2); int res = Integer.MAX_VALUE; int i = 0, j = 0; while (i < word1IndexList.size() && j < word2IndexList.size()) { res = Math.min(res, Math.abs(word1IndexList.get(i) - word2IndexList.get(j))); if (word1IndexList.get(i) < word2IndexList.get(j)) // word1的index小的话,移动i,距离变小 i++; else // Word2的index小的话,移动j,距离变小 j++; } return res; } public static void main(String[] args) { String[] words = {"practice", "makes", "perfect", "coding", "makes"}; // String w1 = "coding", w2 = "practice"; String w1 = "makes", w2 = "coding"; ShortestWordDistance2 swd2 = new ShortestWordDistance2(words); System.out.println(swd2.shortest(w1, w2)); } }
[ "proheart123@gmail.com" ]
proheart123@gmail.com
b1253b4453f04c03c92861e3d01b0172c84a39ca
c4b5fc7cec85be25fa3b036e78c8a803a6ef493c
/src/main/java/com/example/blog/model/User.java
bf2c51249af85f2e3d8cb2245bfa440a0aea4620
[]
no_license
acgq/blog
e31fd5dde12115d881fddeb7f62fd4f667743c16
671cebc3a3298c0da036d203003e662a66c8c9e9
refs/heads/master
2022-07-17T05:19:15.445976
2020-07-03T10:05:07
2020-07-03T10:05:07
220,776,159
0
0
null
2022-06-21T02:12:24
2019-11-10T10:48:59
Java
UTF-8
Java
false
false
1,448
java
package com.example.blog.model; import com.fasterxml.jackson.annotation.JsonIgnore; import java.time.Instant; public class User { private int id; private String username; @JsonIgnore private String encryptedPassword; private String avatar; private Instant createAt; private Instant updateAt; public User() { } public User(String username, String encryptedPassword, String avatar) { this.username = username; this.encryptedPassword = encryptedPassword; this.avatar = "https://blog-server.hunger-valley.com/avatar/69.jpg"; this.createAt = Instant.now(); this.updateAt = Instant.now(); } public User(String username, String encryptedPassword) { this(username, encryptedPassword, null); } public String getEncryptedPassword() { return encryptedPassword; } public void setUsername(String username) { this.username = username; } public void setAvatar(String avatar) { this.avatar = avatar; } public void setUpdateAt(Instant updateAt) { this.updateAt = updateAt; } public int getId() { return id; } public String getUsername() { return username; } public String getAvatar() { return avatar; } public Instant getCreateAt() { return createAt; } public Instant getUpdateAt() { return updateAt; } }
[ "chen330021@live.com" ]
chen330021@live.com
8fd3d2ff9c5ded0e1f60a34da2f1701cc44e9ea0
d9eb47ae0899dd09c4df41beb71431b1a9d3dd45
/buzmgt/src/main/java/com/wangge/buzmgt/sys/base/BaseController.java
069820b070dc9878fbbbde7ccaa5ee64b78dc6f1
[]
no_license
shy1990/buzmgt
cc021cb475eeeb60e4a31c48e9e01239bb57c963
ca7a2ba7b85a13232b82f8d81aa7b20192c6b5be
refs/heads/master
2020-06-14T16:27:53.560258
2016-09-30T03:11:43
2016-09-30T03:11:43
75,163,898
0
0
null
null
null
null
UTF-8
Java
false
false
999
java
package com.wangge.buzmgt.sys.base; import javax.servlet.http.HttpServletRequest; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.servlet.ModelAndView; import com.wangge.buzmgt.sys.util.Page; import com.wangge.buzmgt.sys.util.PageData; public class BaseController { private static final long serialVersionUID = 6357869213649815390L; /** * 得到ModelAndView */ public ModelAndView getModelAndView(){ return new ModelAndView(); } /** * 得到request对象 */ public HttpServletRequest getRequest() { HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); return request; } /** * 得到PageData */ public PageData getPageData(){ return new PageData(this.getRequest()); } /** * 得到分页列表的信息 */ public Page getPage(){ return new Page(); } }
[ "954691592@qq.com" ]
954691592@qq.com
910fa5b397b5236484d14232b29727a2dee0f8d4
622053c570d178ea9f9a68784822cfa829e4ac63
/jetrix/tags/0.1.3/src/admin/WEB-INF/classes/net/jetrix/servlets/ChannelAction.java
c9c467123f00e6e6145bf22d494fff9a31a73b45
[]
no_license
ebourg/jetrix-full
41acb3f2aa19155dd39071fea038625a4ba022f4
10fb59ee2d8b46f3553978f46726fd4ee6c90058
refs/heads/master
2023-07-31T21:36:12.712631
2014-03-17T21:40:47
2014-03-17T21:40:47
179,978,734
0
0
null
null
null
null
UTF-8
Java
false
false
2,283
java
/** * Jetrix TetriNET Server * Copyright (C) 2001-2003 Emmanuel Bourg * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package net.jetrix.servlets; import java.io.IOException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException; import net.jetrix.Channel; import net.jetrix.ChannelManager; import net.jetrix.config.ChannelConfig; /** * Action Servlet handling actions on channels. * * @author Emmanuel Bourg * @version $Revision$, $Date$ */ public class ChannelAction extends HttpServlet { protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); Channel channel = ChannelManager.getInstance().getChannel(name); ChannelConfig config = channel.getConfig(); String password = request.getParameter("password"); password = password == null ? null : password.trim(); password = "".equals(password) ? null : password; config.setAccessLevel(Integer.parseInt(request.getParameter("accessLevel"))); config.setPassword(password); config.setMaxPlayers(Integer.parseInt(request.getParameter("maxPlayers"))); config.setMaxSpectators(Integer.parseInt(request.getParameter("maxSpectators"))); config.setPersistent("true".equals(request.getParameter("persistent"))); config.setTopic(request.getParameter("topic")); response.sendRedirect("/channel.jsp?name=" + name); } }
[ "ebourg@apache.org" ]
ebourg@apache.org
8ab7ee3cf305105b3f6b1906fb3cbf5c1c3b149e
6629cef4b676b40de6d9d82d000325f215e50834
/com/ekalife/elions/web/rekruitment/support/RekrutRegionalvalidator.java
16cd52e3e019b8a3834e3a3a11d43ed00df92561
[]
no_license
fidesetratio/insurance
a9bf169b9d1b568a2ae570b233a234a2500a4e31
6ba971ae6dc6d4858949f333b48b9113ef7ae8c4
refs/heads/master
2023-01-01T17:38:50.269848
2020-10-27T03:39:52
2020-10-27T03:39:52
307,576,991
0
0
null
null
null
null
UTF-8
Java
false
false
20,748
java
package com.ekalife.elions.web.rekruitment.support; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.springframework.validation.Errors; import org.springframework.validation.Validator; import com.ekalife.elions.model.Kuesioner; import com.ekalife.elions.service.ElionsManager; import com.ekalife.utils.FormatString; import com.ekalife.utils.f_validasi; /** * @author HEMILDA * validator untuk rekruitment regional. */ public class RekrutRegionalvalidator implements Validator{ private ElionsManager elionsManager; public void setElionsManager(ElionsManager elionsManager) { this.elionsManager = elionsManager; } public boolean supports(Class data) { return Kuesioner.class.isAssignableFrom(data); } public void validate(Object cmd, Errors err) { Kuesioner data = (Kuesioner) cmd; String jenis_rekrut = data.getMku_jenis_rekrut(); String hasil_jenis_rekrut = ""; if(data.getSubmit1()!=null){//save dan tidak upload dokumen if(!jenis_rekrut.equalsIgnoreCase("1")){ if(data.getMsrk_id().equalsIgnoreCase("00000")){ hasil_jenis_rekrut = "Kode agent 000000 hanya boleh untuk Recruitment Dept (BOP)"; err.rejectValue("msrk_id","", hasil_jenis_rekrut); } } if(data.getMku_tgl_berkas()!=null){ if(data.getMku_tgl_berkas().before(elionsManager.selectSysdate(-30)) || data.getMku_tgl_berkas().after(elionsManager.selectSysdate(0))){ // err.rejectValue("mku_tgl_berkas", "", "Tgl Terima Berkas Tdk blh lbh kecil dr "+ FormatDate.toIndonesian(elionsManager.selectSysdate(-30)) + " dan tdk blh lbh besar dr "+FormatDate.toIndonesian(elionsManager.selectSysdate(0))); } } if(data.getMku_tgl_berkas()==null){ // err.rejectValue("mku_tgl_berkas", "", "Tgl Terima Berkas belum diisi, Silahkan isi tanggal terima berkas"); } if(data.getMku_jenis_rekrut().equalsIgnoreCase("0")){ err.rejectValue("mku_jenis_rekrut", "", "Jenis Rekrut masih none, Silahkan pilih terlebih dahulu jenis rekrut"); } if(data.getMsrk_id()==null){ data.setMsrk_id(""); } if(data.getMsrk_id().equalsIgnoreCase("")){ err.rejectValue("msrk_id", "", "Kode rekrut masih kosong, Silahkan isi kode rekrut terlebih dahulu."); } if(data.getMku_rekruiter()==null){ data.setMku_rekruiter(""); } if(data.getMku_rekruiter().equalsIgnoreCase("") && data.getMsrk_id().equalsIgnoreCase("000000")){ err.rejectValue("mku_rekruiter", "", "Nama rekrut masih kosong, Silahkan isi nama rekrut terlebih dahulu."); }else{ data.setMku_rekruiter(f_validasi.convert_karakter(data.getMku_rekruiter())); data.setMku_rekruiter(data.getMku_rekruiter().toUpperCase()); } if(data.getMku_first()==null){ data.setMku_first(""); } if(data.getMku_first().equalsIgnoreCase("")){ err.rejectValue("mku_first", "", "Nama masih kosong, Silahkan isi nama terlebih dahulu."); }else{ data.setMku_first(f_validasi.convert_karakter(data.getMku_first())); data.setMku_first(data.getMku_first().toUpperCase()); } if(data.getMku_agama()==null){ data.setMku_agama(""); } if(data.getMku_agama().equalsIgnoreCase("")){ err.rejectValue("mku_agama", "", "agama masih kosong, Silahkan isi Agama terlebih dahulu."); }else{ data.setMku_agama(f_validasi.convert_karakter(data.getMku_agama())); data.setMku_agama(data.getMku_agama().toUpperCase()); } if(data.getMku_email()==null){ data.setMku_email(""); } if(data.getMku_email().equalsIgnoreCase("")){ // err.rejectValue("mku_email", "", "email masih kosong, Silahkan isi Email terlebih dahulu."); }else{ data.setMku_email(f_validasi.convert_karakter(data.getMku_email())); data.setMku_email(data.getMku_email().toUpperCase()); } if(data.getMku_bpap()==null){ data.setMku_bpap(0); } if(data.getMku_flag_bp()==null){ data.setMku_flag_bp(1); } if(data.getMku_flag_bp()==0 && data.getMku_flag_bp_ket()==""){ err.rejectValue("mku_flag_bp_ket", "", "Kolom keterangan pengalaman menjadi BP/AP masih kosong. Silahkan isi keterangan tersebut terlebih dahulu."); } if(data.getMku_6bln()==null){ data.setMku_6bln(0); } if(data.getMku_nama_perusahaan()==""){ data.setMku_nama_perusahaan(""); } if(data.getMku_jenis_perusahaan()==""){ data.setMku_jenis_perusahaan(""); } if(data.getMku_alamat_perusahaan()==""){ data.setMku_alamat_perusahaan(""); } if(data.getMku_jabatan_perusahaan()==""){ data.setMku_jabatan_perusahaan(""); } if(data.getMku_telepon_perusahaan()==""){ data.setMku_telepon_perusahaan(""); } if(data.getMku_kodepos_perusahaan()==""){ data.setMku_kodepos_perusahaan(""); } if(data.getMku_str_lv_um()==""){ data.setMku_str_lv_um(""); } if(data.getMku_str_lv_bm()==""){ data.setMku_str_lv_bm(""); } if(data.getMku_str_lv_sbm()==""){ data.setMku_str_lv_sbm(""); } if(data.getMku_str_lv_rm()==""){ data.setMku_str_lv_rm(""); } Integer bank_id = data.getMku_bank_id(); if(bank_id==null){ bank_id=0; } if(data.getMku_bank_id()==null){ // err.rejectValue("mku_bank_id", "", "Bank masih kosong, Silahkan isi Bank terlebih dahulu."); }else{ String nama_bank =""; Map data1 = (HashMap) this.elionsManager.select_bank2(Integer.toString(data.getMku_bank_id()) ); if (data1!=null) { nama_bank = (String)data1.get("BANK_NAMA"); data.setMku_lbn_nama(nama_bank.toUpperCase()); } } if(data.getMku_acc_rekruiter()==null){ data.setMku_acc_rekruiter(""); } if(data.getMku_acc_rekruiter().equalsIgnoreCase("")){ // err.rejectValue("mku_acc_rekruiter", "", "No Account masih kosong, Silahkan isi no account terlebih dahulu."); } if(data.getMku_acc_cust()==null){ data.setMku_acc_cust(""); } if(data.getMku_acc_cust().equalsIgnoreCase("")){ err.rejectValue("mku_acc_cust", "", "No Account Nasabah masih kosong, Silahkan isi no account nasabah terlebih dahulu."); } if(data.getMku_bank_id2()==null){ err.rejectValue("mku_bank_id2", "", "Bank Untuk Nasabah masih kosong, Silahkan isi Pilihan Bank Untuk Nasabah terlebih dahulu."); } if(data.getMku_regional()==null){ err.rejectValue("mku_regional", "", "Regional masih belum dipilih, Silahkan pilih regional terlebih dahulu."); } if(data.getMku_tglkues()==null){ err.rejectValue("mku_tglkues", "", "Tanggal Kuesioner masih kosong, Silahkan isi tanggal kuesioner terlebih dahulu."); } if(data.getMku_diundang()==null){ data.setMku_diundang(""); } if(data.getMku_diundang().equalsIgnoreCase("")){ // err.rejectValue("mku_diundang", "", "Diundang oleh masih kosong, Silahkan isi diundang oleh terlebih dahulu."); }else{ data.setMku_diundang(f_validasi.convert_karakter(data.getMku_rekruiter())); data.setMku_diundang(data.getMku_rekruiter().toUpperCase()); } if(data.getMku_no_identity()==null){ data.setMku_no_identity(""); } if(data.getMku_no_identity().equalsIgnoreCase("")){ err.rejectValue("mku_no_identity", "", "No Identitas masih kosong, Silahkan isi no identitas terlebih dahulu."); }else{ data.setMku_no_identity(f_validasi.convert_karakter(data.getMku_no_identity())); data.setMku_no_identity(data.getMku_no_identity().toUpperCase()); } if(data.getMku_place_birth()==null){ data.setMku_place_birth(""); } if(data.getMku_place_birth().equalsIgnoreCase("")){ err.rejectValue("mku_place_birth", "", "Tempat Lahir masih kosong, Silahkan isi tempat lahir terlebih dahulu."); }else{ data.setMku_place_birth(f_validasi.convert_karakter(data.getMku_place_birth())); data.setMku_place_birth(data.getMku_place_birth().toUpperCase()); } if(data.getMku_date_birth()==null){ err.rejectValue("mku_date_birth", "", "Tanggal Lahir masih kosong, Silahkan isi tanggal lahir terlebih dahulu."); } if(data.getMku_alamat()==null){ data.setMku_alamat(""); } if(data.getMku_alamat().equalsIgnoreCase("")){ err.rejectValue("mku_alamat", "", "Alamat masih kosong, Silahkan isi alamat terlebih dahulu."); }else{ if (data.getMku_alamat().trim().length()>120){ err.rejectValue("mku_alamat", "", "Alamat terlalu panjang."); }else{ data.setMku_alamat(f_validasi.convert_karakter(data.getMku_alamat())); data.setMku_alamat(data.getMku_alamat().toUpperCase()); } } if(data.getMku_kota()==null){ data.setMku_kota(""); } if (data.getMku_kota().equalsIgnoreCase("")){ err.rejectValue("mku_kota", "", "Kota masih kosong, Silahkan isi kota terlebih dahulu."); }else{ data.setMku_kota(data.getMku_kota().toUpperCase()); } if(data.getMku_kd_pos()==null){ data.setMku_kd_pos(""); } if(data.getMku_kd_pos().equalsIgnoreCase("")){ err.rejectValue("mku_kd_pos", "", "Kode Pos masih kosong, Silahkan isi kode pos terlebih dahulu."); }else{ boolean cekk; String hsl=""; String kode_pos = data.getMku_kd_pos(); if(kode_pos.trim().length()!=0){ f_validasi d = new f_validasi(); cekk= f_validasi.f_validasi_numerik(kode_pos); if(cekk==false){ hsl="Silahkan masukkan kode pos dalam bentuk numerik"; err.rejectValue("mku_kd_pos", "", hsl); } } } if(data.getMku_area_rumah()==null){ data.setMku_area_rumah(""); } if(data.getMku_area_rumah().equalsIgnoreCase("")){ err.rejectValue("mku_area_rumah", "", "Area Rumah masih kosong, Silahkan isi Area Rumah terlebih dahulu."); }else{ boolean cekk; String hsl=""; String area = data.getMku_area_rumah(); if(area.trim().length()!=0){ f_validasi d = new f_validasi(); cekk = f_validasi.f_validasi_numerik(area); if(cekk==false){ hsl="Silahkan masukkan kode area rumah dalam bentuk numerik"; err.rejectValue("mku_area_rumah", "", hsl); } } } if(data.getMku_tlprumah()==null){ data.setMku_tlprumah(""); } if(data.getMku_tlprumah().equalsIgnoreCase("")){ err.rejectValue("mku_tlprumah", "", "Telpon Rumah masih kosong, Silahkan isi Telpon Rumah terlebih dahulu."); }else{ boolean cekk; String hsl=""; String telp = data.getMku_tlprumah(); if(telp.trim().length()!=0){ f_validasi d = new f_validasi(); cekk = f_validasi.f_validasi_numerik(telp); if(cekk==false){ hsl="Silahkan masukkan telp rumah dalam bentuk numerik"; err.rejectValue("mku_tlprumah", "", hsl); }else if(telp.trim().length()<6){//IGA - DCR/2020/10/265 Enhancement pengisian No. Telp, No. HP & email di menu Rekrutmen Agent hsl="No. Telp harus diiisi dengan minimal 6 digit angka"; err.rejectValue("mku_tlprumah", "", hsl); } } } if(data.getMku_area_kantor()==null){ data.setMku_area_kantor(""); } if(data.getJenisHalaman()==0){ if(data.getMku_area_kantor().equalsIgnoreCase("")){ err.rejectValue("mku_area_kantor", "", "Area Kantor masih kosong, Silahkan isi Area Kantor terlebih dahulu."); }else{ boolean cekk; String hsl = ""; String area = data.getMku_area_kantor(); if(area.trim().length()!=0){ f_validasi d = new f_validasi(); cekk = f_validasi.f_validasi_numerik(area); if(cekk==false){ hsl="Silahkan masukkan kode area kantor dalam bentuk numerik"; err.rejectValue("mku_area_kantor", "", hsl); } } } } if(data.getMku_tlpkantor()==null){ data.setMku_tlpkantor(""); } if(data.getJenisHalaman()==0){ if(data.getMku_tlpkantor().equalsIgnoreCase("")){ err.rejectValue("mku_tlpkantor", "", "Telpon Kantor masih kosong, Silahkan isi Telpon Kantor terlebih dahulu."); }else{ boolean cekk; String hsl = ""; String telp = data.getMku_tlpkantor(); if(telp.trim().length()!=0){ f_validasi d = new f_validasi(); cekk = f_validasi.f_validasi_numerik(telp); if(cekk==false){ hsl="Silahkan masukkan telpon kantor dalam bentuk numerik"; err.rejectValue("mku_tlpkantor", "", hsl); } } } } if(data.getMku_area_hp()==null){ data.setMku_area_hp(""); } // Iga 23092020 || Update pengisian No. Telp, No. HP & email di menu Rekrutmen Agent (Wasisti) // if (data.getMku_area_hp().equalsIgnoreCase("")){ // err.rejectValue("mku_area_hp", "", "Area HP masih kosong, Silahkan isi Area HP terlebih dahulu."); // }else{ // boolean cekk; // String hsl=""; // String area = data.getMku_area_hp(); // if(area.trim().length()!=0){ // f_validasi d = new f_validasi(); // cekk = f_validasi.f_validasi_numerik(area); // if(cekk==false){ // hsl="Silahkan masukkan kode area hp dalam bentuk numerik"; // err.rejectValue("mku_area_hp", "", hsl); // } // } // } if(data.getMku_hp()==null){ data.setMku_hp(""); } if(data.getMku_hp().equalsIgnoreCase("")){ err.rejectValue("mku_hp", "", "HP masih kosong, Silahkan isi No HP terlebih dahulu.");//IGA - DCR/2020/10/265 Enhancement pengisian No. Telp, No. HP & email di menu Rekrutmen Agent }else{ boolean cekk; String hsl=""; String nohp = data.getMku_hp();//IGA - DCR/2020/10/265 Enhancement pengisian No. Telp, No. HP & email di menu Rekrutmen Agent if(nohp.trim().length()!=0){ f_validasi d = new f_validasi(); cekk =f_validasi.f_validasi_numerik(nohp);//IGA - DCR/2020/10/265 Enhancement pengisian No. Telp, No. HP & email di menu Rekrutmen Agent if(cekk==false){ hsl="Silahkan masukkan no hp dalam bentuk numerik";//IGA - DCR/2020/10/265 Enhancement pengisian No. Telp, No. HP & email di menu Rekrutmen Agent err.rejectValue("mku_hp", "", hsl); }else if(nohp.trim().length()<11){ hsl="No. HP harus diiisi dengan minimal 11 digit angka"; err.rejectValue("mku_hp", "", hsl); } } // Iga 23092020 || Update pengisian No. Telp, No. HP & email di menu Rekrutmen Agent (Wasisti) // String area = data.getMku_area_hp(); // if(area.trim().length()!=0){ // f_validasi d = new f_validasi(); // cekk = f_validasi.f_validasi_numerik(area); // if(cekk==false){ // hsl="Silahkan masukkan kode area hp dalam bentuk numerik"; // err.rejectValue("mku_area_hp", "", hsl); // } // } } if(data.getMku_ket_pekerjaan()==null){ data.setMku_ket_pekerjaan(""); }else{ data.setMku_ket_pekerjaan(f_validasi.convert_karakter(data.getMku_ket_pekerjaan())); data.setMku_ket_pekerjaan(data.getMku_ket_pekerjaan().toUpperCase()); } if(data.getMku_ket_organisasi()==null){ data.setMku_ket_organisasi(""); }else{ data.setMku_ket_organisasi(f_validasi.convert_karakter(data.getMku_ket_organisasi())); data.setMku_ket_organisasi(data.getMku_ket_organisasi().toUpperCase()); } if(data.getMku_ket_tinggal()==null){ data.setMku_ket_tinggal(""); }else{ data.setMku_ket_tinggal(f_validasi.convert_karakter(data.getMku_ket_tinggal())); data.setMku_ket_tinggal(data.getMku_ket_tinggal().toUpperCase()); } if(data.getMku_nama_1()==null){ data.setMku_nama_1(""); }else{ data.setMku_nama_1(f_validasi.convert_karakter(data.getMku_nama_1())); data.setMku_nama_1(data.getMku_nama_1().toUpperCase()); } if(data.getMku_nama_2()==null){ data.setMku_nama_2(""); }else{ data.setMku_nama_2(f_validasi.convert_karakter(data.getMku_nama_2())); data.setMku_nama_2(data.getMku_nama_2().toUpperCase()); } if(data.getMku_tlp_1()==null){ data.setMku_tlp_1(""); }else{ data.setMku_tlp_1(f_validasi.convert_karakter(data.getMku_tlp_1())); } if(data.getMku_tlp_2()==null){ data.setMku_tlp_2(""); }else{ data.setMku_tlp_2(f_validasi.convert_karakter(data.getMku_tlp_2())); } if (data.getMku_rekomendasi_nama() == null) { data.setMku_rekomendasi_nama(""); } if (data.getMku_rekomendasi_nama().equalsIgnoreCase("")) { // err.rejectValue("mku_rekomendasi_nama", "", "Nama Rekomendasi masih kosong, Silahkan isi Nama Rekomendasi terlebih dahulu."); }else{ data.setMku_rekomendasi_nama(f_validasi.convert_karakter(data.getMku_rekomendasi_nama())); data.setMku_rekomendasi_nama(data.getMku_rekomendasi_nama().toUpperCase()); } data.setMku_transfer(new Integer(0)); if((!data.getMku_first().equalsIgnoreCase("")) && (data.getMku_date_birth()!=null)){ String nama = data.getMku_first().toUpperCase(); Date tanggal_lahir = data.getMku_date_birth(); Integer tgl1 = tanggal_lahir.getDate(); Integer bln1 = tanggal_lahir.getMonth()+1; Integer thn1 = tanggal_lahir.getYear()+1900; String tgllhr = thn1 +FormatString.rpad("0",Integer.toString(bln1.intValue()),2)+FormatString.rpad("0",Integer.toString(tgl1.intValue()),2); Integer jumlah = (Integer) this.elionsManager.cek_kuesioner(nama, tgllhr); if(jumlah==null){ jumlah= new Integer(0); } if(jumlah.intValue()!=0){ err.rejectValue("mku_first", "", "Tidak boleh merekrut orang yang sudah pernah direkrut."); } } //MANTA if(data.getMku_tempatkues()==null){ data.setMku_tempatkues(""); } if(data.getMku_tempatkues().equalsIgnoreCase("")){ err.rejectValue("mku_tempatkues", "", "Tempat Pengisian masih kosong, Silahkan isi tempat pengisian terlebih dahulu."); } if(data.getMku_pendidikan().equals("0")){ if(data.getMku_pendidikan_lain().equals("")){ err.rejectValue("mku_pendidikan_lain", "", "Kolom Pendidikan Lain masih kosong, Silahkan isi pendidikan lainnya terlebih dahulu."); } } if(data.getMku_nama_pasangan()==null){ data.setMku_nama_pasangan(""); } if(data.getMku_pekerjaan_pasangan()==null){ data.setMku_pekerjaan_pasangan(""); } if(data.getMku_tanggungan()==null){ data.setMku_tanggungan("0"); } if(data.getMku_status().equals("2")){ if(data.getMku_nama_pasangan().equals("")){ err.rejectValue("mku_nama_pasangan", "", "Nama Suami/Istri masih kosong, Silahkan isi nama Suami/Istri terlebih dahulu."); } if(data.getMku_pekerjaan_pasangan().equals("")){ err.rejectValue("mku_pekerjaan_pasangan", "", "Pekerjaan Suami/Istri masih kosong, Silahkan isi pekerjaan Suami/Istri terlebih dahulu."); } } if(data.getMku_cabang_bank()==null){ data.setMku_cabang_bank(""); } if(data.getMku_cabang_bank().equals("")){ err.rejectValue("mku_cabang_bank", "", "Cabang Bank Rekening masih kosong, Silahkan isi cabang bank rekening terlebih dahulu."); } if(data.getMku_nama_atasan()==null){ data.setMku_nama_atasan(""); } if(data.getMku_nama_atasan().equals("")){ err.rejectValue("mku_nama_atasan", "", "Nama Atasan Langsung masih kosong, Silahkan isi nama atasan langsung terlebih dahulu."); } if(data.getMst_leader()==null){ data.setMst_leader(""); } if(data.getMst_leader().equals("")){ err.rejectValue("mst_leader", "", "Kode Agen Atasan Langsung masih kosong, Silahkan isi kode agen atasan langsung terlebih dahulu."); } if(data.getMku_bangkrut()==null){ err.rejectValue("mku_bangkrut", "", "Silahkan pilih salah satu jawaban dari pertanyaan Kuesioner bagian No. 4"); }else{ if(data.getMku_bangkrut()==1 && (data.getMku_ket_bangkrut()==null)) err.rejectValue("mku_ket_bangkrut", "", "Kolom Keterangan Bangkrut masih kosong, Silahkan isi keterangan bangkrut terlebih dahulu."); } if(data.getMku_kriminal()==null){ err.rejectValue("mku_kriminal", "", "Silahkan pilih salah satu jawaban dari pertanyaan Kuesioner bagian No. 5"); }else{ if(data.getMku_kriminal()==1 && (data.getMku_ket_kriminal()==null)) err.rejectValue("mku_ket_kriminal", "", "Kolom Keterangan Kriminal masih kosong, Silahkan isi keterangan kriminal terlebih dahulu."); } }else if(data.getSubmit2()!=null){ if(data.getMku_noreg()==null){ data.setMku_noreg(null); } if(data.getMku_noreg().equals("")){ err.rejectValue("mku_noreg", "", "No Register masih kosong, Silahkan isi no register yang dicari terlebih dahulu."); } } /*if(data.isChbox()==false){ }else{//upload dokumen dan tidak save data if(data.getMku_no_reg_upload().equalsIgnoreCase("")){ err.rejectValue("mku_no_reg_upload", "", "Kode rekrut untuk upload masih kosong, Silahkan isi kode rekrut terlebih dahulu."); } if(data.getFile1().isEmpty() || data.getFile1()==null){ err.rejectValue("file1", "", "File upload masih kosong, Silahkan isi file upload terlebih dahulu."); } }*/ } }
[ "Patar.Tambunan@SINARMASMSIGLIFE.CO.ID" ]
Patar.Tambunan@SINARMASMSIGLIFE.CO.ID
f15d51ccff1827cf6f0372e686d3b491e1b28b0d
3115a5f0b9048e0ffb64dc2fb85809e6b1123519
/src/java/Controller/DeleteMainClassificationController.java
bd4007200b8eca7ec59530fad1b207cab5810bf2
[]
no_license
mathan1995/LMS.SGIC
dc1631e3ba09682075f202269ad51e8b2ddbf8f7
38c1e19906a48c2a2097b1b3bd59a7e358a8b5fc
refs/heads/master
2020-04-24T16:55:55.275654
2019-02-22T20:07:34
2019-02-22T20:07:34
172,127,375
2
0
null
null
null
null
UTF-8
Java
false
false
4,272
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Controller; import Data.MainClassifactionDataAccessObject; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Mathan */ @WebServlet(name = "DeleteMainClassificationController", urlPatterns = {"/DeleteMainClassificationController"}) public class DeleteMainClassificationController 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/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet DeleteMainClassificationController</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet DeleteMainClassificationController at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } } // <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); //java script = deleteMainClassificationId dont forget String MCID = request.getParameter("deleteMainClassificationId"); MainClassifactionDataAccessObject mainClassificationDao = null; try { mainClassificationDao = new MainClassifactionDataAccessObject(); } catch (ClassNotFoundException ex) { Logger.getLogger(DeleteMainClassificationController.class.getName()).log(Level.SEVERE, null, ex); } try { mainClassificationDao.deleteMainclassification(MCID); RequestDispatcher dispatcher = request.getRequestDispatcher("./ViewMainClassificationController"); dispatcher.forward(request, response); } catch (SQLException ex) { Logger.getLogger(DeleteMainClassificationController.class.getName()).log(Level.SEVERE, null, ex); } } /** * 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> }
[ "Mathan@DESKTOP-A4JBV22" ]
Mathan@DESKTOP-A4JBV22
0eaa0926bf410ab8fa466da85a5cacf87f7cfa0c
08425f05d2c6faa722b805b6b996fa06f6a826aa
/src/main/java/com/fhx/springboot/single/rabbitmq/fanout/FanoutReceiver.java
f97fe59149b4523f499f246e1a95447045ee01e6
[]
no_license
fhx0628/com.fhx.springboot.single
6f519d8531e4c438c7be688e5959a4c2d425acda
93395089b05e447ded0747c4b504718e7f67c13a
refs/heads/master
2020-03-19T08:19:42.355492
2018-06-07T15:25:46
2018-06-07T15:25:46
136,195,745
1
0
null
null
null
null
UTF-8
Java
false
false
435
java
package com.fhx.springboot.single.rabbitmq.fanout; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; @Component @RabbitListener(queues = "fanout.msg") public class FanoutReceiver { @RabbitHandler public void process (String msg) { System.out.println("fanout message is " + msg); } }
[ "564246125@qq.com" ]
564246125@qq.com
39f8b674ad758597789981bbd41b61467274411c
3d5dae691817118010d755e6d511d0f99d6d6804
/IlyaCSDN/app/src/main/java/ilya/pengnix/com/ilyacsdn/constant/AppConstants.java
125475d9a3ac030ad6b3d2ab950e6b669deb1564
[]
no_license
pengnix/IlyaCSDN
83f431cb9bc57361506a8b11cfcbd4bd4ab2d824
7a748efcc3cff3041732d0862c83e820041deb68
refs/heads/master
2021-01-10T05:33:19.034350
2015-11-09T14:16:58
2015-11-09T14:16:58
44,742,132
0
0
null
null
null
null
UTF-8
Java
false
false
192
java
package ilya.pengnix.com.ilyacsdn.constant; /** * Created by Avazu on 2015/10/26. */ public class AppConstants { public final static String CSDN_BASE_URL = "http://blog.csdn.net/"; }
[ "superpengnix@gmail.com" ]
superpengnix@gmail.com
35d95ed7ea1cb6248209fa3f04c818bb36b7a67c
f5423af15e1006f5669d264d3a354d127c375d3a
/src/main/java/io/testservice/controllers/AppControler.java
758515e28064e90cf9274e03c606d8942902ed12
[]
no_license
asuthshilpa/userservice
82f0265e555a5c966501c735f21e76277107db43
f65a651eb0c59ac235dd9cbaf81ff743fb41fcd2
refs/heads/master
2020-04-26T02:44:32.696538
2019-03-01T12:30:30
2019-03-01T12:30:30
173,243,834
0
0
null
null
null
null
UTF-8
Java
false
false
4,411
java
package io.testservice.controllers; import java.net.URI; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import io.testservice.model.User; import io.testservice.model.UserRequest; import io.testservice.service.UserService; @RestController @RequestMapping(value = "/userservice") public class AppControler { @Autowired UserService service; @Autowired public JavaMailSender emailSender; @RequestMapping(value = "/users", method = RequestMethod.GET, produces = "application/json") @ResponseBody public ResponseEntity<List<User>> getAllUsers() throws Exception { return new ResponseEntity<List<User>>(service.getAllUsers(), HttpStatus.OK); } @RequestMapping(value = "/users/{id}", method = RequestMethod.GET, produces = "application/json") @ResponseBody public ResponseEntity<User> getUser(@PathVariable("id") int id) throws Exception { HttpHeaders responseHeaders = new HttpHeaders(); User user = service.getUserAtId(id); if (user != null && !user.getStatus().equals("D")) { URI location = new URI("/users/" + id); responseHeaders.setLocation(location); return new ResponseEntity<User>(service.getUserAtId(id), responseHeaders, HttpStatus.OK); } else { throw new Exception("data not found for user " + id); } } @RequestMapping(value = "/users/{id}", method = RequestMethod.PUT, produces = "application/json", consumes = "application/json") @ResponseBody public ResponseEntity<User> updateUser(@PathVariable("id") int id, @RequestBody UserRequest userReq) throws Exception { HttpHeaders responseHeaders = new HttpHeaders(); User user = service.updateUserAtId(id, userReq); if (user != null) { URI location = new URI("/users/" + id); responseHeaders.setLocation(location); return new ResponseEntity<User>(user, responseHeaders, HttpStatus.OK); } else { throw new Exception("data not found for user " + id); } } @RequestMapping(value = "/users/{id}", method = RequestMethod.DELETE, produces = "application/json", consumes = "application/json") @ResponseBody public Map<String, Boolean> deleteUser(@PathVariable("id") int id) throws Exception { User user = service.deleteUserAtId(id); Map<String, Boolean> response = new HashMap<>(); if (user == null) { throw new Exception("data not found for user " + id); } else { response.put("deleted", Boolean.TRUE); } return response; } @RequestMapping(value = "/users", method = RequestMethod.DELETE, produces = "application/json", consumes = "application/json") @ResponseBody public Map<String, Boolean> deleteAllUsers() throws Exception { Map<String, Boolean> response = new HashMap<>(); service.deleteAllUsers(); response.put("deleted", Boolean.TRUE); return response; } @RequestMapping(value = "/users/register", method = RequestMethod.POST, consumes = "application/json", produces = "application/json") @ResponseBody public ResponseEntity<User> createUser(@RequestBody UserRequest userReq) throws Exception { // validate if the user already exists HttpHeaders responseHeaders = new HttpHeaders(); boolean exists = service.validateUser(userReq); if (exists) { throw new Exception("user with same email Id already exists"); } int id = service.addUser(userReq); // adds a new entry to DB and returns ID URI location = new URI("/users/" + id); responseHeaders.setLocation(location); //send email to the registered user SimpleMailMessage message = new SimpleMailMessage(); message.setTo(userReq.getEmailId()); message.setSubject("test email"); message.setText("user registered"); emailSender.send(message); return new ResponseEntity<User>(service.getUserAtId(id), responseHeaders, HttpStatus.CREATED); } }
[ "shilpa.asuthkar@gmail.com" ]
shilpa.asuthkar@gmail.com
83eb1e76f7c2c075b532067486129a8dcf5dc8c6
761be9ca290181dc7603b0d5b26b5df45ad2ec9f
/Shop_First/src/main/java/com/shop_first/entities/UserRegistration.java
2f8dc404c751fbadbfe05849ab9558d161534522
[]
no_license
gsm3012/Projects
606231faae707b71761ca8b89d77547aba8a37e4
8c0c984821d5f4cafa1853fcdcebe68584f37eb7
refs/heads/main
2023-02-15T22:58:13.728739
2021-01-11T09:34:24
2021-01-11T09:34:24
328,608,615
0
0
null
null
null
null
UTF-8
Java
false
false
2,802
java
package com.shop_first.entities; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; @Entity @Table(uniqueConstraints =@UniqueConstraint(name="user_email_password", columnNames = {"user_email", "user_mobile"})) public class UserRegistration { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int user_id; private String user_name; private String user_email; private String user_password; private String user_mobile; private String user_gender; private String user_type; public UserRegistration() { super(); // TODO Auto-generated constructor stub } public UserRegistration(String user_name, String user_email, String user_password, String user_mobile, String user_gender, String user_type) { super(); this.user_name = user_name; this.user_email = user_email; this.user_password = user_password; this.user_mobile = user_mobile; this.user_gender = user_gender; this.user_type = user_type; } public UserRegistration(int user_id, String user_name, String user_email, String user_password, String user_mobile, String user_gender, String user_type) { super(); this.user_id = user_id; this.user_name = user_name; this.user_email = user_email; this.user_password = user_password; this.user_mobile = user_mobile; this.user_gender = user_gender; this.user_type = user_type; } public int getUser_id() { return user_id; } public void setUser_id(int user_id) { this.user_id = user_id; } public String getUser_name() { return user_name; } public void setUser_name(String user_name) { this.user_name = user_name; } public String getUser_email() { return user_email; } public void setUser_email(String user_email) { this.user_email = user_email; } public String getUser_password() { return user_password; } public void setUser_password(String user_password) { this.user_password = user_password; } public String getUser_mobile() { return user_mobile; } public void setUser_mobile(String user_mobile) { this.user_mobile = user_mobile; } public String getUser_gender() { return user_gender; } public void setUser_gender(String user_gender) { this.user_gender = user_gender; } public String getUser_type() { return user_type; } public void setUser_type(String user_type) { this.user_type = user_type; } @Override public String toString() { return "UserRegistration [user_id=" + user_id + ", user_name=" + user_name + ", user_email=" + user_email + ", user_password=" + user_password + ", user_mobile=" + user_mobile + ", user_gender=" + user_gender + ", user_type=" + user_type + "]"; } }
[ "gsm.3012@hotmail.com" ]
gsm.3012@hotmail.com
bd1f233b5cde54e720d43f60ed8cea50440569fc
9b32926df2e61d54bd5939d624ec7708044cb97f
/src/main/java/com/rocket/summer/framework/beans/propertyeditors/InputSourceEditor.java
eeae48a3d5a8c1ccfca3be7baa32f41ebdf05d15
[]
no_license
goder037/summer
d521c0b15c55692f9fd8ba2c0079bfb2331ef722
6b51014e9a3e3d85fb48899aa3898812826378d5
refs/heads/master
2022-10-08T12:23:58.088119
2019-11-19T07:58:13
2019-11-19T07:58:13
89,110,409
1
0
null
null
null
null
UTF-8
Java
false
false
2,186
java
package com.rocket.summer.framework.beans.propertyeditors; import com.rocket.summer.framework.core.io.Resource; import com.rocket.summer.framework.core.io.ResourceEditor; import com.rocket.summer.framework.util.Assert; import org.xml.sax.InputSource; import java.beans.PropertyEditorSupport; import java.io.IOException; /** * Editor for {@code org.xml.sax.InputSource}, converting from a * Spring resource location String to a SAX InputSource object. * * <p>Supports Spring-style URL notation: any fully qualified standard URL * ("file:", "http:", etc) and Spring's special "classpath:" pseudo-URL. * * @author Juergen Hoeller * @since 3.0.3 * @see org.xml.sax.InputSource * @see com.rocket.summer.framework.core.io.ResourceEditor * @see com.rocket.summer.framework.core.io.ResourceLoader * @see URLEditor * @see FileEditor */ public class InputSourceEditor extends PropertyEditorSupport { private final ResourceEditor resourceEditor; /** * Create a new InputSourceEditor, * using the default ResourceEditor underneath. */ public InputSourceEditor() { this.resourceEditor = new ResourceEditor(); } /** * Create a new InputSourceEditor, * using the given ResourceEditor underneath. * @param resourceEditor the ResourceEditor to use */ public InputSourceEditor(ResourceEditor resourceEditor) { Assert.notNull(resourceEditor, "ResourceEditor must not be null"); this.resourceEditor = resourceEditor; } @Override public void setAsText(String text) throws IllegalArgumentException { this.resourceEditor.setAsText(text); Resource resource = (Resource) this.resourceEditor.getValue(); try { setValue(resource != null ? new InputSource(resource.getURL().toString()) : null); } catch (IOException ex) { throw new IllegalArgumentException( "Could not retrieve URL for " + resource + ": " + ex.getMessage()); } } @Override public String getAsText() { InputSource value = (InputSource) getValue(); return (value != null ? value.getSystemId() : ""); } }
[ "liujie152@hotmail.com" ]
liujie152@hotmail.com
a6f9c8264faccaaf34860937bec9747707952302
6cd9af63a24c3549afcd7ba35f205994fddde497
/src/HighLow.java
f2b2c50f812abe65dc82bdf737081fdbed802aad
[]
no_license
elviravaladez/codeup-java-exercises
c967b7e986bd266fad3a751d1cae5bf5275d1676
2178583e7ca462b07eade5fd0f4af8987aa46ffb
refs/heads/main
2023-02-06T05:13:24.977617
2020-12-28T16:31:02
2020-12-28T16:31:02
317,649,217
0
0
null
2020-12-18T20:56:16
2020-12-01T19:41:22
Java
UTF-8
Java
false
false
2,938
java
import java.util.Scanner; public class HighLow { //TODO: EXERCISE 5: Game Development 101 // -You are going to build a high-low guessing game. Create a class named HighLow inside of src. // -The specs for the game are: // -Game picks a random number between 1 and 100. // -Prompts user to guess the number. // -All user inputs are validated. // -If user's guess is less than the number, it outputs "HIGHER". // -If user's guess is more than the number, it outputs "LOWER". // -If a user guesses the number, the game should declare "GOOD GUESS!" // -HINTS: Use the random method of the java.lang.Math class to generate a random number. // -BONUS: Keep track of how many guesses a user makes. Set an upper limit on the number of guesses. public static void highLow() { Scanner userInput = new Scanner(System.in); int specialNumber = (int) (Math.random() * 100) + 1; int guessLimit = 5; System.out.printf("WELCOME!%n========%nI'm thinking of a number between 1 and 100. Guess the number in 5 attempts to win!%n"); for (int i = 0; i < 5; i++) { System.out.print("Enter your guess here: "); int userGuess = userInput.nextInt(); if (userGuess >= 1 && userGuess <= 100) { if (userGuess == specialNumber) { System.out.println("GOOD GUESS!"); System.out.print("Play again? (Y/N): "); String userYNResponse = userInput.next(); if (!userYNResponse.equalsIgnoreCase("Y")) { System.out.print("Got it. Goodbye!"); break; } else { highLow(); } } else if (userGuess < specialNumber && i != guessLimit - 1) { System.out.println("HIGHER"); } else if (userGuess > specialNumber && i != guessLimit - 1) { System.out.println("LOWER"); } if (i == guessLimit - 1) { System.out.printf("SORRY! You have reached your limit of guesses %nThe number was %d%n", specialNumber); System.out.print("Play again? (Y/N): "); String userYNResponse = userInput.next(); if (!userYNResponse.equalsIgnoreCase("Y")) { System.out.print("Got it. Goodbye!"); break; } else { highLow(); } } } else { System.out.printf("INVALID ENTRY! TRY AGAIN.%nEnter your guess here: "); userGuess = userInput.nextInt(); } } } public static void main (String[]args) { highLow(); } }
[ "elvira.marie.valadez@gmail.com" ]
elvira.marie.valadez@gmail.com
3759bd9d8e1d74a8b0e1f3b2e7e5adc740f612ae
2239fda89fd442fb0147e8298f98978b9a28092e
/app/src/main/java/com/example/tapan/dllogin/activity/login/ForgotPasswordActivity.java
1241c8d6989da42281acec90eaf8e15da1eb53c9
[]
no_license
amintapan/DigitalLibraryUser
867c246036b56bf49ebbc1089cfd26750f9971e8
69d9ce902cc17d133075b273236e85566c7fe758
refs/heads/master
2021-01-19T07:28:39.063557
2017-08-17T19:59:19
2017-08-17T19:59:19
100,640,399
0
0
null
null
null
null
UTF-8
Java
false
false
2,778
java
package com.example.tapan.dllogin.activity.login; import android.app.ProgressDialog; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.example.tapan.dllogin.R; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; public class ForgotPasswordActivity extends AppCompatActivity { private EditText edtEmailForgot; private String emailForgot; private Button btnReset; private ProgressDialog progressDialog; private FirebaseAuth auth; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_forgot_password); initView(); btnReset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { emailForgot = edtEmailForgot.getText().toString().trim(); if (TextUtils.isEmpty(emailForgot)) { Toast.makeText(getApplication(), "Enter your registered email id", Toast.LENGTH_SHORT).show(); return; } progressDialog = new ProgressDialog(ForgotPasswordActivity.this); progressDialog.setMessage("Sending Email"); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setCancelable(false); progressDialog.show(); auth.sendPasswordResetEmail(emailForgot) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Toast.makeText(ForgotPasswordActivity.this, "We have sent you instructions to reset your password on your email!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(ForgotPasswordActivity.this, "Failed to send reset email!", Toast.LENGTH_SHORT).show(); } progressDialog.cancel(); } }); } }); } private void initView(){ edtEmailForgot = (EditText) findViewById(R.id.edt_email_forgot); btnReset = (Button) findViewById(R.id.btn_reset); auth = FirebaseAuth.getInstance(); } }
[ "amintapan@gmail.com" ]
amintapan@gmail.com
4d223587c5e850704d4776de69e8d363c1368587
f078d5abccc97bce9090a9250521e9bc537ee09e
/xml-to-java/src/main/java/org/smooks/examples/xml2java/model/OrderItem.java
65aed74a4b5b0bbeb0b7c8328679c094ed57eb6b
[]
no_license
agnissh/smooks-examples
433edf1908067f596b131e296dffd3f8d931271c
a8749ba49e7a681edb974d410a85158a4e21b142
refs/heads/master
2022-08-06T21:36:03.881861
2020-05-03T07:25:59
2020-05-03T07:25:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,209
java
/* Milyn - Copyright (C) 2006 - 2010 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1) as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details: http://www.gnu.org/licenses/lgpl.txt */ package org.smooks.examples.xml2java.model; /** * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> */ public class OrderItem { private long productId; private Integer quantity; private double price; public long getProductId() { return productId; } public void setProductId(long productId) { this.productId = productId; } public Integer getQuantity() { return quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } }
[ "noreply@github.com" ]
agnissh.noreply@github.com
4ef704d6fc80fc9d8c2c0858f9aff5140fafb66e
78e345bb7b9dc7348c5300bce91f35daf7a18cac
/app/src/main/java/com/example/salesreport/RoomDatabaase/RoomDataBaseModel/FilterModelClass.java
d43d9c7c1981ea37bd7726c9298ba3c71ff166d6
[]
no_license
paliwalmayankad/SalesReport
99ca1bf79030f217e5390db43d5b3832ff4a6f6a
e43e30a3b122d936b620eef4e1c8ba9bb42d17ac
refs/heads/master
2022-06-15T02:02:04.993796
2020-05-10T06:35:45
2020-05-10T06:35:45
262,629,788
0
0
null
null
null
null
UTF-8
Java
false
false
1,055
java
package com.example.salesreport.RoomDatabaase.RoomDataBaseModel; import androidx.room.ColumnInfo; import androidx.room.Entity; import androidx.room.PrimaryKey; import androidx.room.TypeConverters; import java.util.List; @Entity(tableName = "FilterTable") public class FilterModelClass { public int getId() { return id; } public void setId(int id) { this.id = id; } public List<DelerList> getDealer_list() { return dealer_list; } public void setDealer_list(List<DelerList> dealer_list) { this.dealer_list = dealer_list; } @PrimaryKey(autoGenerate = true) private int id; public String getDealer_name() { return dealer_name; } public void setDealer_name(String dealer_name) { this.dealer_name = dealer_name; } @TypeConverters(Converters.class) private List<DelerList> dealer_list; @ColumnInfo(name="dealer_name") private String dealer_name; @Override public String toString() { return dealer_name; } }
[ "paliwalmayankad@gmail.com" ]
paliwalmayankad@gmail.com
973853c88fa7975e2c80243f4dfad597e10f2ac7
d8931d2f25b36993d1c6e4f97f84d054634f74c6
/src/main/java/net/codelizard/hoc/content/ContentObject.java
a9d167e2170accd59de8dd337014668a8183b17f
[ "MIT" ]
permissive
Codelizard/HeroesOfCordan
9dd213a24d2279be35dd1f5999799bb169c88dd1
6310fd00aa5feccf9080b4c14e3b76444745b6cd
refs/heads/master
2020-11-29T20:56:25.518221
2018-05-07T22:25:44
2018-05-07T22:25:44
96,591,233
0
0
MIT
2018-05-06T14:58:48
2017-07-08T02:40:07
Java
UTF-8
Java
false
false
3,566
java
package net.codelizard.hoc.content; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import java.util.List; import java.util.Map; /** * A parent class of other content objects that contains fields common to all of them. * * @author Codelizard */ @JsonInclude(JsonInclude.Include.NON_DEFAULT) @JsonIgnoreProperties(ignoreUnknown=true) public abstract class ContentObject { /** The internal ID of the object. */ protected String id; /** The name of the object. */ protected String name; /** The tier of the dungeon the object belongs to. (Inferred after loading; not stored in the content file) */ @JsonIgnore protected int tier; /** The resource resources or bonuses related to the object. */ protected Map<ResourceType, ResourceValue> resources; /** The description(s) about the object. */ protected List<String> descriptions; /** Flavor text quote(s) about the object from the various characters. */ protected List<String> flavor; /** * @return The internally-used ID. */ public String getId() { return id; } /** * @return The user-visible name. */ public String getName() { return name; } /** * @return The object's tier. */ public int getTier() { return tier; } /** * @return The resources related to this object. */ public Map<ResourceType, ResourceValue> getResources() { return resources; } /** * @return All long descriptions of this object. */ public List<String> getDescriptions() { return descriptions; } /** * @return All flavor text quotes about this object. */ public List<String> getFlavor() { return flavor; } /** * @param id The new ID to use. */ public void setId(final String id) { this.id = id; } /** * @param name The new name to use. */ public void setName(final String name) { this.name = name; } /** * @param tier The new tier value. */ public void setTier(final int tier) { this.tier = tier; } /** * @param resources The new resources map to use. */ public void setResources(final Map<ResourceType, ResourceValue> resources) { this.resources = resources; } /** * @param descriptions A new list of descriptions to use. */ public void setDescriptions(final List<String> descriptions) { this.descriptions = descriptions; } /** * @param flavor The new flavor text quotes to use */ public void setFlavor(final List<String> flavor) { this.flavor = flavor; } /** * @return A randomly-selected description from the list of descriptions of this ContentObject. */ public String randomDescription() { return descriptions.get( (int) (Math.random() * descriptions.size()) ); } /** * @return A randomly-selected flavor text from the list of flavor texts for this ContentObject. */ public String randomFlavor() { return flavor.get( (int) (Math.random() * flavor.size()) ); } /** * @return A full, complete description of this ContentObject. */ public String fullLengthDescription() { return "--" + name + "--\n\n" + randomDescription() + "\n\n" + randomFlavor(); } }
[ "thecodelizard@hotmail.com" ]
thecodelizard@hotmail.com
031c2024f714791f6d987febad8ddd8982221baa
d4d09472eb26d4f7d6581bf85e7d32152373bf54
/kkk_library/src/main/java/com/kkk/utils/util/SingletonUtils.java
8df9c9042e966f2d5b22e69ede623542bdd2ed8b
[]
no_license
vshpkill/KKK
d2aa6e282d79a8dd0d49f2fd26c978466d30828b
5d2f2e5457caa3415ccbc224ea2ebb688dcf5b8e
refs/heads/master
2021-01-20T09:06:30.720958
2018-03-08T08:51:05
2018-03-08T08:51:05
90,218,478
0
0
null
null
null
null
UTF-8
Java
false
false
579
java
package com.kkk.utils.util; /** * Singleton helper class for lazily initialization. * * @author <a href="http://www.trinea.cn/" target="_blank">Trinea</a> * * @param <T> 泛型 */ public abstract class SingletonUtils<T> { private T instance; protected abstract T newInstance(); public final T getInstance() { if (instance == null) { synchronized (SingletonUtils.class) { if (instance == null) { instance = newInstance(); } } } return instance; } }
[ "sde_heshufeng@163.com" ]
sde_heshufeng@163.com
0cfb06ff7ee6c65a9f0fa8914f9fbba7264cf201
91f64037960a753c321b5cbb4eacbb924273e99d
/day15_Filter&Listener/src/com/bubu/web/servlet/ServletDemo2.java
bcd88bdd8047ad5ae3bb1d78eba90fffaa7d203c
[]
no_license
bubu4me/JavaWeb
25996ea6e9e14cbfddfa617a32b61ef94f1b6d9a
81ea86fbcfb9d8cbd0fb091ddef465d0d3cb79f8
refs/heads/master
2021-07-08T04:55:43.726491
2019-07-25T09:37:45
2019-07-25T09:37:45
197,355,053
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package com.bubu.web.servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet("/user/updateServlet") public class ServletDemo2 extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("/user/updateServlet..."); request.getRequestDispatcher("/index.jsp").forward(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost(request, response); } }
[ "danzigpong@gmail.com" ]
danzigpong@gmail.com
a5878486736b8e6e179538bf6cb6853175b3e12a
89947fa0f01a65d5594510572b852ef9f6c39462
/src/main/java/training/immutables/exercise/MembersService.java
8e8173890d7321c2bef4a9878fa80a92c67f5e3f
[]
no_license
jrierapeiro/training.java
4866fb9987df59895ab921de60af034640b79afe
e37bb940bd82ba0473cf91ce0b7a0be14633ba34
refs/heads/master
2021-04-03T07:22:19.782238
2018-03-16T10:19:26
2018-03-16T10:20:37
125,025,037
0
0
null
null
null
null
UTF-8
Java
false
false
4,619
java
package training.immutables.exercise; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; public class MembersService{ public List<Member> GetStaticMembers(){ return Arrays.asList( BuildMember("Amazon", "UK", Arrays.asList( LocalDate.of(2018,1,1), LocalDate.of(2018,1,2), LocalDate.of(2018,1,3) )), BuildMember("HubSpot", "IE", Arrays.asList( LocalDate.of(2018,1,1), LocalDate.of(2018,1,2), LocalDate.of(2018,1,3) )), BuildMember("Ancestry", "US", Arrays.asList( LocalDate.of(2018,1,1), LocalDate.of(2018,1,2), LocalDate.of(2018,1,3) )), BuildMember("Gilt", "IE", Arrays.asList( LocalDate.of(2018,1,2), LocalDate.of(2018,1,3) )), BuildMember("Workday", "US", Arrays.asList( LocalDate.of(2018,1,2), LocalDate.of(2018,1,3) )), BuildMember("Google", "US", Arrays.asList( LocalDate.of(2018,1,1), LocalDate.of(2018,1,3) )) ); } public void ComputeMembers(List<Member> members){ // Group members by country Map<String, List<Member>> membersByCountry = getMembersByCountry(members); assert membersByCountry.keySet().size() == 3; // Only 3 countries // Generate Events List<Event> events = new ArrayList(); membersByCountry.forEach( (country, countryMembers) -> { Event twoDayEvent = getTwoDayEvent(countryMembers); if(twoDayEvent != null){ twoDayEvent.setCountry(country); events.add(twoDayEvent); } } ); assert events.size() == 3; } private Map<String, List<Member>> getMembersByCountry(List<Member> members) { return members .stream() .collect( Collectors.groupingBy( Member::country ) ); } private Event getTwoDayEvent(List<Member> members){ // Generate map of members with two consecutive days available Map<LocalDate, List<String>> datesWithAttendants = new HashMap<>(); members.forEach( m -> { // At least two dates if(m.availableDates().size() >= 2){ m.availableDates().forEach( d -> { if(m.availableDates().contains(d.plusDays(1))){ datesWithAttendants .computeIfAbsent( d, l -> new ArrayList<>() ); datesWithAttendants.get(d).add(m.name()); } } ); } } ); // Not possible if(datesWithAttendants.size() == 0){ return null; } LocalDate bestDate = datesWithAttendants.entrySet() .stream() .max((e1, e2) -> e1.getValue().size() > e2.getValue().size() ? 1 : -1) .get() .getKey(); Event event = new Event(); event.setAttendees(datesWithAttendants.get(bestDate)); event.setStartDate(bestDate); return event; } private Member BuildMember(String name, String country, List<LocalDate> dates){ return ImmutableMember .builder() .name(name) .addAllAvailableDates(dates) .country(country) .build(); } }
[ "jariepei@gmail.com" ]
jariepei@gmail.com
ceae9ec1cbe4376fe6a03a584c5613b97e973758
0cf2ae9cc39f9da19779dae7fc1d6e3b763c58f5
/limits-services/src/main/java/com/example/microservices/limitsservices/LimitsConfigurationController.java
cf9d20d0f7f7990211882594d99c3022857c1827
[]
no_license
Swicchi/microservices
77eedfeea87eec606f67a1129357c27ded794513
49dedcd7f02d987e610bb6ae35f531f73c98899d
refs/heads/master
2020-04-22T12:59:08.956432
2019-02-12T21:19:54
2019-02-12T21:19:54
170,393,052
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
package com.example.microservices.limitsservices; import com.example.microservices.limitsservices.bean.LimitConfiguration; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class LimitsConfigurationController { private final Configuration configuration; @Autowired public LimitsConfigurationController(Configuration configuration) { this.configuration = configuration; } @GetMapping("/limits") public LimitConfiguration retrieveLimitsFromConfigurations(){ return new LimitConfiguration(configuration.getMaximum(),configuration.getMinimum()); } @GetMapping("/limits-2") @HystrixCommand(fallbackMethod = "fallbackRetrieveConfiguration") public LimitConfiguration retrieveLimitsFromConfigurations2(){ throw new RuntimeException("Not available"); } public LimitConfiguration fallbackRetrieveConfiguration(){ return new LimitConfiguration(999,9); } }
[ "rfernandez@nisum.com" ]
rfernandez@nisum.com
77e39e6858309389b127c0b8f200fc0fd0e48774
1c5613875b4b108699f4decd9a36e9ea15d8f8c6
/app/src/main/java/com/dmos5/agenda_dmos5/view/ContactDetailsActivity.java
a073bd75fe0429c2a96f83a3274605457d18709b
[]
no_license
marisoldourado/Agenda_DMOS5
5adf77514d95bb37b887c37d2f8183cdb635b539
f27818f0ade4b4fea5b95d579498d4f946b7be3a
refs/heads/main
2022-12-26T21:17:39.576220
2020-10-04T22:50:14
2020-10-04T22:50:14
301,223,384
0
0
null
2020-10-04T22:50:15
2020-10-04T20:41:52
Java
UTF-8
Java
false
false
1,775
java
package com.dmos5.agenda_dmos5.view; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; import com.dmos5.agenda_dmos5.R; import com.dmos5.agenda_dmos5.model.Contact; public class ContactDetailsActivity extends AppCompatActivity { private TextView txtvFirstName; private TextView txtvLastName; private TextView txtvPhoneNumber; private TextView txtvMobileNumber; private Contact contact; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contact_details); txtvFirstName = findViewById(R.id.txtv_firstname); txtvLastName = findViewById(R.id.txtv_lastname); txtvPhoneNumber = findViewById(R.id.txtv_phoneNumber); txtvMobileNumber = findViewById(R.id.txtv_mobileNumber); getSupportActionBar().hide(); // recuperar dados da MainActivity Intent intent = getIntent(); Bundle b = intent.getExtras(); if(b != null) { String firstName = b.getString(MainActivity.KEY_FIRST_NAME); String lastName = b.getString(MainActivity.KEY_LAST_NAME); String phoneNumber = b.getString(MainActivity.KEY_PHONE_NUMBER); String mobileNumber = b.getString(MainActivity.KEY_MOBILE_NUMBER); contact = new Contact(firstName, lastName, phoneNumber, mobileNumber); } // exibe os detalhes txtvFirstName.setText(contact.getFirstName()); txtvLastName.setText(contact.getLastName()); txtvPhoneNumber.setText(contact.getPhoneNumber()); txtvMobileNumber.setText(contact.getMobileNumber()); } }
[ "marisol@Marisol.local" ]
marisol@Marisol.local
41e581e80f9406826c13d65eabcf67b5c2e5ad23
bdc647654eeca31dc340ce8b7f79f354895ad555
/RPG/src/BouledeFeu.java
a6a0d44b6b280e9c16cf964f5d3800f002809496
[]
no_license
lau4225/RPG-partie1-
d8c3e81332f1cf3c170b28515e89926a9e84a88c
b362f9e86341e4ae986059cfb8bf0a4a829c51a0
refs/heads/master
2021-05-02T10:31:10.651908
2018-02-08T18:18:15
2018-02-08T18:18:15
120,798,745
0
0
null
null
null
null
UTF-8
Java
false
false
1,278
java
/** * Created by BonLa1731834 on 2018-01-29. */ public class BouledeFeu extends Sort{ public BouledeFeu(){ setCout(5); } public void lanceSort(Personnage persoAttaque, Magicien magicien) { if (magicien.getMagie()>=5) { System.out.println("Le Magicien " + magicien.type + " attaque!"); System.out.println("Le Magicien " + magicien.type + " utilise le sort Boule de Feu, ce qui lui coûte " + getCout() + "pts de magie."); persoAttaque.setVie(persoAttaque.getVie()-5); if (persoAttaque.getVie()<0) { persoAttaque.setVie(0); } magicien.setMagie(magicien.getMagie()-5); //enlever cout du sort System.out.println("Il lui reste " + magicien.getMagie() + "pts de magie."); System.out.println("Le " + persoAttaque.getNom() + " perd 5pts de vie. Il lui en reste " + persoAttaque.getVie() + "."); if (persoAttaque.getVie()==0){ System.out.println("Le " + persoAttaque.getNom() + " est mort, le Magicien " + magicien.type + " a gagné!"); } } else { System.out.println("Le Magicien " + magicien.type + " n'a pas assez de points magie pour lancer le sort Boule de Feu"); } } }
[ "lauriebonnel@hotmail.com" ]
lauriebonnel@hotmail.com
d509a3dacc4f54f8bf7448503f17e6d7a2483144
806ef31b707f79d1af64aa9a7dc6615211fc0368
/JollydaysBuchhaltung-2_12_RP/src/at/jollydays/booking/db/NukeMrcommerceArrangementCityJpaController.java
535b412e15a111f798099095cff692e3e7800765
[]
no_license
rprasnikar/ForThomas
ca7aa595b3538b4b6d79214d32dfc712d4340af0
a4a31c941265b4bfc3c18dcdc5cc5ba3d92a1e65
refs/heads/master
2016-09-05T20:43:31.389347
2015-04-09T15:39:01
2015-04-09T15:39:01
33,678,202
0
0
null
null
null
null
UTF-8
Java
false
false
7,614
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package at.jollydays.booking.db; import at.jollydays.booking.bo.NukeMrcommerceArrangementCity; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; /** * * @author Gunter Reinitzer */ public class NukeMrcommerceArrangementCityJpaController { public NukeMrcommerceArrangementCityJpaController() { emf = Persistence.createEntityManagerFactory("JollydaysBuchhaltungPUJollydays"); } private EntityManagerFactory emf = null; public EntityManager getEntityManager() { return emf.createEntityManager(); } // public void create(NukeMrcommerceArrangementCity nukeMrcommerceArrangementCity) { // EntityManager em = null; // try { // em = getEntityManager(); // em.getTransaction().begin(); // NukeMrcommerceArrangement nukeMrcommerceArrangement = nukeMrcommerceArrangementCity.getNukeMrcommerceArrangement(); // if (nukeMrcommerceArrangement != null) { // nukeMrcommerceArrangement = em.getReference(nukeMrcommerceArrangement.getClass(), nukeMrcommerceArrangement.getId()); // nukeMrcommerceArrangementCity.setNukeMrcommerceArrangement(nukeMrcommerceArrangement); // } // em.persist(nukeMrcommerceArrangementCity); // if (nukeMrcommerceArrangement != null) { // nukeMrcommerceArrangement.getNukeMrcommerceArrangementCityCollection().add(nukeMrcommerceArrangementCity); // nukeMrcommerceArrangement = em.merge(nukeMrcommerceArrangement); // } // em.getTransaction().commit(); // } finally { // if (em != null) { // em.close(); // } // } // } // public void edit(NukeMrcommerceArrangementCity nukeMrcommerceArrangementCity) throws NonexistentEntityException, Exception { // EntityManager em = null; // try { // em = getEntityManager(); // em.getTransaction().begin(); // NukeMrcommerceArrangementCity persistentNukeMrcommerceArrangementCity = em.find(NukeMrcommerceArrangementCity.class, nukeMrcommerceArrangementCity.getId()); // NukeMrcommerceArrangement nukeMrcommerceArrangementOld = persistentNukeMrcommerceArrangementCity.getNukeMrcommerceArrangement(); // NukeMrcommerceArrangement nukeMrcommerceArrangementNew = nukeMrcommerceArrangementCity.getNukeMrcommerceArrangement(); // if (nukeMrcommerceArrangementNew != null) { // nukeMrcommerceArrangementNew = em.getReference(nukeMrcommerceArrangementNew.getClass(), nukeMrcommerceArrangementNew.getId()); // nukeMrcommerceArrangementCity.setNukeMrcommerceArrangement(nukeMrcommerceArrangementNew); // } // nukeMrcommerceArrangementCity = em.merge(nukeMrcommerceArrangementCity); // if (nukeMrcommerceArrangementOld != null && !nukeMrcommerceArrangementOld.equals(nukeMrcommerceArrangementNew)) { // nukeMrcommerceArrangementOld.getNukeMrcommerceArrangementCityCollection().remove(nukeMrcommerceArrangementCity); // nukeMrcommerceArrangementOld = em.merge(nukeMrcommerceArrangementOld); // } // if (nukeMrcommerceArrangementNew != null && !nukeMrcommerceArrangementNew.equals(nukeMrcommerceArrangementOld)) { // nukeMrcommerceArrangementNew.getNukeMrcommerceArrangementCityCollection().add(nukeMrcommerceArrangementCity); // nukeMrcommerceArrangementNew = em.merge(nukeMrcommerceArrangementNew); // } // em.getTransaction().commit(); // } catch (Exception ex) { // String msg = ex.getLocalizedMessage(); // if (msg == null || msg.length() == 0) { // Integer id = nukeMrcommerceArrangementCity.getId(); // if (findNukeMrcommerceArrangementCity(id) == null) { // throw new NonexistentEntityException("The nukeMrcommerceArrangementCity with id " + id + " no longer exists."); // } // } // throw ex; // } finally { // if (em != null) { // em.close(); // } // } // } // public void destroy(Integer id) throws NonexistentEntityException { // EntityManager em = null; // try { // em = getEntityManager(); // em.getTransaction().begin(); // NukeMrcommerceArrangementCity nukeMrcommerceArrangementCity; // try { // nukeMrcommerceArrangementCity = em.getReference(NukeMrcommerceArrangementCity.class, id); // nukeMrcommerceArrangementCity.getId(); // } catch (EntityNotFoundException enfe) { // throw new NonexistentEntityException("The nukeMrcommerceArrangementCity with id " + id + " no longer exists.", enfe); // } // NukeMrcommerceArrangement nukeMrcommerceArrangement = nukeMrcommerceArrangementCity.getNukeMrcommerceArrangement(); // if (nukeMrcommerceArrangement != null) { // nukeMrcommerceArrangement.getNukeMrcommerceArrangementCityCollection().remove(nukeMrcommerceArrangementCity); // nukeMrcommerceArrangement = em.merge(nukeMrcommerceArrangement); // } // em.remove(nukeMrcommerceArrangementCity); // em.getTransaction().commit(); // } finally { // if (em != null) { // em.close(); // } // } // } public List<NukeMrcommerceArrangementCity> findNukeMrcommerceArrangementCityEntities() { return findNukeMrcommerceArrangementCityEntities(true, -1, -1); } public List<NukeMrcommerceArrangementCity> findNukeMrcommerceArrangementCityEntities(int maxResults, int firstResult) { return findNukeMrcommerceArrangementCityEntities(false, maxResults, firstResult); } private List<NukeMrcommerceArrangementCity> findNukeMrcommerceArrangementCityEntities(boolean all, int maxResults, int firstResult) { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); cq.select(cq.from(NukeMrcommerceArrangementCity.class)); Query q = em.createQuery(cq); if (!all) { q.setMaxResults(maxResults); q.setFirstResult(firstResult); } return q.getResultList(); } finally { em.close(); } } public NukeMrcommerceArrangementCity findNukeMrcommerceArrangementCity(Integer id) { EntityManager em = getEntityManager(); try { return em.find(NukeMrcommerceArrangementCity.class, id); } finally { em.close(); } } public int getNukeMrcommerceArrangementCityCount() { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); Root<NukeMrcommerceArrangementCity> rt = cq.from(NukeMrcommerceArrangementCity.class); cq.select(em.getCriteriaBuilder().count(rt)); Query q = em.createQuery(cq); return ((Long) q.getSingleResult()).intValue(); } finally { em.close(); } } }
[ "Robert@192.168.88.23" ]
Robert@192.168.88.23
dfa8c61ff3f2ba6136c7668695815262b764e986
a7a1186f2d2ba45d8bf1b2bca8ca226e11f224ce
/Soccer/src/pojos/Game.java
78a72a9c4234e9c3c0d101139e427175710217e8
[]
no_license
russellruss/OracleSoccer
d2538e46298e1da09274fb0acc2e22a032a3847f
0f720e71ea415f267a1ba2cb6573b7bdc9b4f9e0
refs/heads/master
2021-01-17T20:48:36.024471
2016-06-18T18:56:24
2016-06-18T18:56:24
60,922,417
0
0
null
null
null
null
UTF-8
Java
false
false
129
java
package pojos; public class Game { public Team homeTeam; public Team awayTeam; public Goal[] goals; }
[ "Mozcalti@192.168.1.67" ]
Mozcalti@192.168.1.67
90592dbd0fcc4f82062b0f16544a853c6133b2c3
172c3f23264b346c8e03e5eac3f5712dfc7b08be
/Poritish_Bardhan/WeatherApp/app/src/main/java/com/example/weatherapp/Main.java
12f099ae471c445bf7ac9e1352433c690c90184b
[]
no_license
CodeChefVIT/Mini-Tasks-20
a54884af31a503f3b9f0a7238d10bd397c3ce630
cfe7a7f39565b91f07a0e8027ca1ab3af3b96896
refs/heads/master
2021-05-24T13:03:57.083509
2020-12-16T10:50:12
2020-12-16T10:50:12
253,573,593
2
15
null
2020-12-16T10:50:13
2020-04-06T17:48:10
Jupyter Notebook
UTF-8
Java
false
false
1,496
java
package com.example.weatherapp; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Main { @SerializedName("temp") @Expose private Double temp; @SerializedName("feels_like") @Expose private Double feelsLike; @SerializedName("temp_min") @Expose private Double tempMin; @SerializedName("temp_max") @Expose private Double tempMax; @SerializedName("pressure") @Expose private Integer pressure; @SerializedName("humidity") @Expose private Integer humidity; public Double getTemp() { return temp-273; } public void setTemp(Double temp) { this.temp = temp; } public Double getFeelsLike() { return feelsLike; } public void setFeelsLike(Double feelsLike) { this.feelsLike = feelsLike; } public Double getTempMin() { return tempMin-273; } public void setTempMin(Double tempMin) { this.tempMin = tempMin; } public Double getTempMax() { return tempMax-273; } public void setTempMax(Double tempMax) { this.tempMax = tempMax; } public Integer getPressure() { return pressure; } public void setPressure(Integer pressure) { this.pressure = pressure; } public Integer getHumidity() { return humidity; } public void setHumidity(Integer humidity) { this.humidity = humidity; } }
[ "poritoshbardhan07@gmail.com" ]
poritoshbardhan07@gmail.com
77081602dfe3983090255179056e190a62117354
c58ca615765936163df4b273a922c34ae8cb409d
/src/main/java/com/ytsssss/collaborationblog/service/Impl/TeamServiceImpl.java
46b32acccd6a7ddcd723eff901ebf4a8fba280af
[]
no_license
Ytsssss/CollaborationBlog
5f69dbb6dc72711b8f5fe8d1f31d12d836ef1d4d
41e40379c29d440b8d6dddee54b1e6a79127d263
refs/heads/master
2022-06-22T14:55:07.733019
2019-08-06T03:56:27
2019-08-06T03:56:27
117,924,978
1
0
null
2022-06-20T23:37:45
2018-01-18T03:09:57
Java
UTF-8
Java
false
false
2,753
java
package com.ytsssss.collaborationblog.service.Impl; import com.ytsssss.collaborationblog.domain.Team; import com.ytsssss.collaborationblog.domain.TeamUserRelation; import com.ytsssss.collaborationblog.mapper.TeamMapper; import com.ytsssss.collaborationblog.mapper.TeamUserRelationMapper; import com.ytsssss.collaborationblog.service.TeamService; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; /** * Create by Ytsssss on 2018/1/31 16:45 */ @Service public class TeamServiceImpl implements TeamService{ private static Logger logger = LoggerFactory.getLogger(TeamServiceImpl.class); @Resource private TeamMapper teamMapper; @Resource private TeamUserRelationMapper teamUserRelationMapper; @Override public int addTeam(String name, String describe, Long userId, int isPublic, int status) { Team team = new Team(); team.setDescription(describe); team.setName(name); team.setIsPublic(isPublic); team.setStatus(status); team.setUserId(userId); team.setCreateTime(new Date()); team.setUpdateTime(new Date()); logger.info(team.toString()); return teamMapper.insertSelective(team); } @Override public int deleteTeam(Long id) { return teamMapper.deleteByPrimaryKey(id); } @Override public List<Long> getChargeTeamList(Long userId) { logger.info(teamMapper.getChargeTeamList(userId).toString()); return teamMapper.getChargeTeamList(userId); } @Override public List<Long> getPartTeamList(Long userId) { logger.info(teamUserRelationMapper.getPartTeamList(userId).toString()); return teamUserRelationMapper.getPartTeamList(userId); } @Override public int addUserTeam(Long userId, Long teamId) { TeamUserRelation teamUserRelation = new TeamUserRelation(); teamUserRelation.setUserId(userId); teamUserRelation.setTeamId(teamId); teamUserRelation.setStatus(0); return teamUserRelationMapper.insertSelective(teamUserRelation); } @Override public int deleteUserTeam(Long userId, Long teamId) { return teamUserRelationMapper.deleteUserTeam(userId, teamId); } @Override public Team getTeamInfo(Long teamId) { logger.info(teamMapper.selectByPrimaryKey(teamId).toString()); return teamMapper.selectByPrimaryKey(teamId); } @Override public List<Long> getTeamPartList(Long teamId) { logger.info(teamUserRelationMapper.getTeamPartList(teamId).toString()); return teamUserRelationMapper.getTeamPartList(teamId); } }
[ "995170811@qq.com" ]
995170811@qq.com
66ec7a76b125d2e8c8ba43ecf8002cd7c0d13033
5074b0ab213819756e5ff8d2d043d951b258ff8b
/JiuJie/src/main/java/com/jiujie8/choice/setting/entity/ClientModel.java
1c3311d18a53169b31297e9dbe1234f680ab486b
[]
no_license
285336243/trunk
1ea5102cf5f12e8b34704028a6cafc0f4d1de891
96c5e68ccef71e6ed3ac9a161595936456cf2360
refs/heads/master
2021-01-13T00:37:16.942406
2016-03-27T09:31:17
2016-03-27T09:31:17
53,727,287
3
2
null
null
null
null
UTF-8
Java
false
false
324
java
package com.jiujie8.choice.setting.entity; /** * */ public class ClientModel { public ClientVersion getClientVersion() { return clientVersion; } public void setClientVersion(ClientVersion clientVersion) { this.clientVersion = clientVersion; } private ClientVersion clientVersion; }
[ "285336243@qq.com" ]
285336243@qq.com
f522fb42cc5ce431cb82c897818dbff87d58ccb5
cfe621e8c36e6ac5053a2c4f7129a13ea9f9f66b
/AndroidApplications/com.zeptolab.ctr.ads-912244/src/com/google/gson/stream/JsonWriter.java
5adba299f4355eef41926637f60b0c5c642e43e7
[]
no_license
linux86/AndoirdSecurity
3165de73b37f53070cd6b435e180a2cb58d6f672
1e72a3c1f7a72ea9cd12048d9874a8651e0aede7
refs/heads/master
2021-01-11T01:20:58.986651
2016-04-05T17:14:26
2016-04-05T17:14:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,930
java
package com.google.gson.stream; import com.admarvel.android.ads.Constants; import com.inmobi.commons.internal.ApiStatCollector.ApiEventType; import com.zeptolab.ctr.billing.google.utils.IabHelper; import com.zeptolab.ctr.scorer.GoogleScorer; import java.io.Closeable; import java.io.Flushable; import java.io.IOException; import java.io.Writer; public class JsonWriter implements Closeable, Flushable { private static final String[] HTML_SAFE_REPLACEMENT_CHARS; private static final String[] REPLACEMENT_CHARS; private String deferredName; private boolean htmlSafe; private String indent; private boolean lenient; private final Writer out; private String separator; private boolean serializeNulls; private int[] stack; private int stackSize; static { REPLACEMENT_CHARS = new String[128]; int i = 0; while (i <= 31) { REPLACEMENT_CHARS[i] = String.format("\\u%04x", new Object[]{Integer.valueOf(i)}); i++; } REPLACEMENT_CHARS[34] = "\\\""; REPLACEMENT_CHARS[92] = "\\\\"; REPLACEMENT_CHARS[9] = "\\t"; REPLACEMENT_CHARS[8] = "\\b"; REPLACEMENT_CHARS[10] = "\\n"; REPLACEMENT_CHARS[13] = "\\r"; REPLACEMENT_CHARS[12] = "\\f"; HTML_SAFE_REPLACEMENT_CHARS = (String[]) REPLACEMENT_CHARS.clone(); HTML_SAFE_REPLACEMENT_CHARS[60] = "\\u003c"; HTML_SAFE_REPLACEMENT_CHARS[62] = "\\u003e"; HTML_SAFE_REPLACEMENT_CHARS[38] = "\\u0026"; HTML_SAFE_REPLACEMENT_CHARS[61] = "\\u003d"; HTML_SAFE_REPLACEMENT_CHARS[39] = "\\u0027"; } public JsonWriter(Writer writer) { this.stack = new int[32]; this.stackSize = 0; push(IabHelper.BILLING_RESPONSE_RESULT_ERROR); this.separator = ":"; this.serializeNulls = true; if (writer == null) { throw new NullPointerException("out == null"); } this.out = writer; } private void beforeName() { int peek = peek(); if (peek == 5) { this.out.write(ApiEventType.API_MRAID_SET_VIDEO_VOLUME); } else if (peek != 3) { throw new IllegalStateException("Nesting problem."); } newline(); replaceTop(GoogleScorer.CLIENT_APPSTATE); } private void beforeValue(boolean z) { switch (peek()) { case GoogleScorer.CLIENT_GAMES: replaceTop(GoogleScorer.CLIENT_PLUS); newline(); case GoogleScorer.CLIENT_PLUS: this.out.append(','); newline(); case GoogleScorer.CLIENT_APPSTATE: this.out.append(this.separator); replaceTop(IabHelper.BILLING_RESPONSE_RESULT_DEVELOPER_ERROR); case IabHelper.BILLING_RESPONSE_RESULT_ERROR: if (this.lenient || z) { replaceTop(GoogleScorer.CLIENT_ALL); } else { throw new IllegalStateException("JSON must start with an array or an object."); } case GoogleScorer.CLIENT_ALL: if (!this.lenient) { throw new IllegalStateException("JSON must have only one top-level value."); } replaceTop(GoogleScorer.CLIENT_ALL); default: throw new IllegalStateException("Nesting problem."); } } private JsonWriter close(int i, int i2, String str) { int peek = peek(); if (peek != i2 && peek != i) { throw new IllegalStateException("Nesting problem."); } else if (this.deferredName != null) { throw new IllegalStateException("Dangling name: " + this.deferredName); } else { this.stackSize--; if (peek == i2) { newline(); } this.out.write(str); return this; } } private void newline() { if (this.indent != null) { this.out.write(Constants.FORMATTER); int i = 1; int i2 = this.stackSize; while (i < i2) { this.out.write(this.indent); i++; } } } private JsonWriter open(int i, String str) { beforeValue(true); push(i); this.out.write(str); return this; } private int peek() { if (this.stackSize != 0) { return this.stack[this.stackSize - 1]; } throw new IllegalStateException("JsonWriter is closed."); } private void push(int i) { if (this.stackSize == this.stack.length) { Object obj = new Object[(this.stackSize * 2)]; System.arraycopy(this.stack, 0, obj, 0, this.stackSize); this.stack = obj; } int[] iArr = this.stack; int i2 = this.stackSize; this.stackSize = i2 + 1; iArr[i2] = i; } private void replaceTop(int i) { this.stack[this.stackSize - 1] = i; } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ private void string(java.lang.String r8) { throw new UnsupportedOperationException("Method not decompiled: com.google.gson.stream.JsonWriter.string(java.lang.String):void"); /* r7 = this; r1 = 0; r0 = r7.htmlSafe; if (r0 == 0) goto L_0x0025; L_0x0005: r0 = HTML_SAFE_REPLACEMENT_CHARS; L_0x0007: r2 = r7.out; r3 = "\""; r2.write(r3); r4 = r8.length(); r3 = r1; L_0x0013: if (r3 >= r4) goto L_0x0046; L_0x0015: r2 = r8.charAt(r3); r5 = 128; // 0x80 float:1.794E-43 double:6.32E-322; if (r2 >= r5) goto L_0x0028; L_0x001d: r2 = r0[r2]; if (r2 != 0) goto L_0x002e; L_0x0021: r2 = r3 + 1; r3 = r2; goto L_0x0013; L_0x0025: r0 = REPLACEMENT_CHARS; goto L_0x0007; L_0x0028: r5 = 8232; // 0x2028 float:1.1535E-41 double:4.067E-320; if (r2 != r5) goto L_0x003f; L_0x002c: r2 = "\\u2028"; L_0x002e: if (r1 >= r3) goto L_0x0037; L_0x0030: r5 = r7.out; r6 = r3 - r1; r5.write(r8, r1, r6); L_0x0037: r1 = r7.out; r1.write(r2); r1 = r3 + 1; goto L_0x0021; L_0x003f: r5 = 8233; // 0x2029 float:1.1537E-41 double:4.0676E-320; if (r2 != r5) goto L_0x0021; L_0x0043: r2 = "\\u2029"; goto L_0x002e; L_0x0046: if (r1 >= r4) goto L_0x004f; L_0x0048: r0 = r7.out; r2 = r4 - r1; r0.write(r8, r1, r2); L_0x004f: r0 = r7.out; r1 = "\""; r0.write(r1); return; */ } private void writeDeferredName() { if (this.deferredName != null) { beforeName(); string(this.deferredName); this.deferredName = null; } } public JsonWriter beginArray() { writeDeferredName(); return open(1, "["); } public JsonWriter beginObject() { writeDeferredName(); return open(IabHelper.BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE, "{"); } public void close() { this.out.close(); int i = this.stackSize; if (i > 1 || (i == 1 && this.stack[i - 1] != 7)) { throw new IOException("Incomplete document"); } this.stackSize = 0; } public JsonWriter endArray() { return close(1, GoogleScorer.CLIENT_PLUS, "]"); } public JsonWriter endObject() { return close(IabHelper.BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE, IabHelper.BILLING_RESPONSE_RESULT_DEVELOPER_ERROR, "}"); } public void flush() { if (this.stackSize == 0) { throw new IllegalStateException("JsonWriter is closed."); } this.out.flush(); } public final boolean getSerializeNulls() { return this.serializeNulls; } public final boolean isHtmlSafe() { return this.htmlSafe; } public boolean isLenient() { return this.lenient; } public JsonWriter name(String str) { if (str == null) { throw new NullPointerException("name == null"); } else if (this.deferredName != null) { throw new IllegalStateException(); } else if (this.stackSize == 0) { throw new IllegalStateException("JsonWriter is closed."); } else { this.deferredName = str; return this; } } public JsonWriter nullValue() { if (this.deferredName == null || !this.serializeNulls) { this.deferredName = null; } else { writeDeferredName(); beforeValue(false); this.out.write("null"); } return this; } public final void setHtmlSafe(boolean z) { this.htmlSafe = z; } public final void setIndent(String str) { if (str.length() == 0) { this.indent = null; this.separator = ":"; } else { this.indent = str; this.separator = ": "; } } public final void setLenient(boolean z) { this.lenient = z; } public final void setSerializeNulls(boolean z) { this.serializeNulls = z; } public JsonWriter value(double d) { if (Double.isNaN(d) || Double.isInfinite(d)) { throw new IllegalArgumentException("Numeric values must be finite, but was " + d); } writeDeferredName(); beforeValue(false); this.out.append(Double.toString(d)); return this; } public JsonWriter value(long j) { writeDeferredName(); beforeValue(false); this.out.write(Long.toString(j)); return this; } public JsonWriter value(Number number) { if (number == null) { return nullValue(); } writeDeferredName(); CharSequence toString = number.toString(); if (this.lenient || !(toString.equals("-Infinity") || toString.equals("Infinity") || toString.equals("NaN"))) { beforeValue(false); this.out.append(toString); return this; } else { throw new IllegalArgumentException("Numeric values must be finite, but was " + number); } } public JsonWriter value(String str) { if (str == null) { return nullValue(); } writeDeferredName(); beforeValue(false); string(str); return this; } public JsonWriter value(boolean z) { writeDeferredName(); beforeValue(false); this.out.write(z ? "true" : "false"); return this; } }
[ "jack.luo@mail.utoronto.ca" ]
jack.luo@mail.utoronto.ca
d62521ca7f67bbcc584888f062ab86db5c680c3e
884c3ea383193856b7fa851ceb7f9adb0f8ae545
/src/main/java/com/uu/Usercontroller.java
ef384e06c566542b34e6f704e9170665d5dd5d6d
[]
no_license
mean-to/firstIdea
96caf715a51788e4be6f0a44cda60676010c4887
ad9d33831cafc52bfdd5ae0e860ae03421f21617
refs/heads/master
2020-12-12T19:09:46.321454
2020-01-16T01:27:36
2020-01-16T01:27:36
234,208,060
0
0
null
2020-10-13T18:52:46
2020-01-16T01:27:26
Java
UTF-8
Java
false
false
50
java
package com.uu; public class Usercontroller { }
[ "2572482562@qq.com" ]
2572482562@qq.com
5a9d9a6dca7c0b4ffd609d3b4d20347437340a3a
715459cc976f14a0c89f3596e637c14bf38ef93b
/src/main/java/Communication/ICommunication.java
5d5be699ec436845b9cc09b52bbaa2329d3a687c
[]
no_license
lukkascost/PPD_Combat_Game
3fa0846890fce0fa7f772345847c30374a05c663
77e460e2282ca157849b4ea32b21866d00517882
refs/heads/master
2021-03-30T16:08:45.930464
2018-03-05T11:57:21
2018-03-05T11:57:21
122,337,998
1
0
null
null
null
null
UTF-8
Java
false
false
203
java
package Communication; import java.io.IOException; public interface ICommunication { public void send(String msg); public String receivedMsg(); public void connect() throws IOException; }
[ "lucas.costa@lit.ifce.edu.br" ]
lucas.costa@lit.ifce.edu.br
2f4cad4cbad8e1079aafc3646dffedb56c01375f
4aced0a174ee460b3ecb291095b3d7cc829af7ce
/app/src/main/java/afpcsoft/com/br/bestplaces/model/PlaceApiEdited.java
b1b5524757a6a153bb3474434bc2da2b5b8a3282
[]
no_license
andrefpc/BestPlaces
d106155669d68dc135620bbce107796966692487
410204ffbabeec1e27e3dbc350c304581451b00d
refs/heads/master
2020-05-18T15:25:38.373484
2015-06-30T04:49:45
2015-06-30T04:49:45
33,789,053
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,042
java
package afpcsoft.com.br.bestplaces.model; import com.google.gson.annotations.SerializedName; import java.io.Serializable; /** * Created by AndréFelipe on 25/06/2015. */ public class PlaceApiEdited implements Serializable { private int id; @SerializedName("place_api_id") private String placeApiId; private String phone; private String site; @SerializedName("facebook_page") private String facebookPage; private String photo; @SerializedName("price_added") private int priceAdded; public PlaceApiEdited() { } public PlaceApiEdited(int id, String placeApiId, String phone, String site, String facebookPage, String photo, int priceAdded) { this.id = id; this.placeApiId = placeApiId; this.phone = phone; this.site = site; this.facebookPage = facebookPage; this.photo = photo; this.priceAdded = priceAdded; } public PlaceApiEdited(String placeApiId) { this.placeApiId = placeApiId; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getPlaceApiId() { return placeApiId; } public void setPlaceApiId(String placeApiId) { this.placeApiId = placeApiId; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getSite() { return site; } public void setSite(String site) { this.site = site; } public String getFacebookPage() { return facebookPage; } public void setFacebookPage(String facebookPage) { this.facebookPage = facebookPage; } public String getPhoto() { return photo; } public void setPhoto(String photo) { this.photo = photo; } public int getPriceAdded() { return priceAdded; } public void setPriceAdded(int priceAdded) { this.priceAdded = priceAdded; } }
[ "andrefpc92@gmail.com" ]
andrefpc92@gmail.com
9caf40bfb16c26c684ce47c66c995761dbc1ef50
c0e14856702a3974aebfcd2476e84f997b082b9f
/Experimentos/Codigo_Experimentos/Sucesores/IASuccesorAS1S2.java
b934661083b1dccb91e1faaa897e15742f499ce2
[]
no_license
mbdavid2/Practica-IA
d6a1a2e44e2eac82ef3a9d1f535737de73b89e9c
4c16e113534312906a1c631039b8a41e26dd83c5
refs/heads/master
2021-09-07T06:05:53.007341
2018-02-18T12:15:36
2018-02-18T12:15:36
106,182,073
0
0
null
null
null
null
UTF-8
Java
false
false
2,637
java
package Prac1; import aima.search.framework.Successor; import aima.search.framework.SuccessorFunction; import java.util.ArrayList; import java.util.List; public class IASuccesorAS1S2 implements SuccessorFunction{ public List getSuccessors(Object state) { ArrayList retval = new ArrayList(); IAMap board = (IAMap) state; IAMap tmp = null; /****ADD****/ for(int cd1 = 0; cd1 < board.mapLength();++cd1){ for(int p = 0; p < board.petLength(); ++p) { tmp = board.copyState(); //if (tmp.AddViaje(cd1, p)) retval.add(new Successor("Added " + p + " to " + cd1 + ", total km: " + tmp.km() + ", Ben: " + tmp.benf(), tmp)); if (tmp.AddViaje(cd1, p)) retval.add(new Successor("" + tmp.benf(), tmp)); //System.out.println("Try: Added " + p + " to " + cd1 + ", km: " + tmp.km() + ", Ben: " + tmp.benf()); //tmp.printViajes(); } } /****SWAP****/ for(int i1 = 0; i1 < board.mapLength(); ++i1){ for(int j1 = 0; j1 < board.sizeViajes(i1); ++j1){ for(int i2 = i1; i2 < board.mapLength(); ++i2){ for(int j2 = 0; j2 < board.sizeViajes(i2); ++j2){ if(i1 == i2 && (j2 <= j1 || (j1%2 == 0 && j2 == j1+1))); else { tmp = board.copyState(); if(tmp.SwapViaje(i1,j1,i2,j2)) retval.add(new Successor("" + tmp.benf(), tmp)); //if(tmp.SwapViaje(i1,j1,i2,j2)) retval.add(new Successor("Swapped (" + i1 + ","+j1+ ") with (" +i2 + "," +j2+ ")" + ", total km: " + tmp.km() + ", Ben: " + tmp.benf(), tmp)); //System.out.println("Try: Swapped (" + i1 + ","+j1+ ") with (" +i2 + "," +j2+ ")"); } } } } } /****SWAP****/ for(int i1 = 0; i1 < board.mapLength(); ++i1){ for(int j1 = 0; j1 < board.sizeViajes(i1); ++j1){ for(int p = 0; p < board.petLength(); ++p){ tmp = board.copyState(); //if(tmp.SwapPets(i1,j1,p)) retval.add(new Successor("Swapped (" + i1 + ","+j1+ ") with petition (" +p+ ")" + ", total km: " + tmp.km() + ", Ben: " + tmp.benf(), tmp)); if(tmp.SwapPets(i1,j1,p)) retval.add(new Successor("" + tmp.benf(), tmp)); //System.out.println("Try: Swapped (" + i1 + ","+j1+ ") with (" +i2 + "," +j2+ ")"); } } } return (retval); } }
[ "mbdavid297@gmail.com" ]
mbdavid297@gmail.com