blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
8ed835cf254722fe661eb6397ed1cc775218520e
0aa8955757fa0f633e9d8ac4b78545279281e55d
/app/src/main/java/shihoo/wang/coursedir/coursefile/FunctionItemClickListener.java
53f27ed8cb8ddb6d61304b8406c4f94bce09a3f6
[]
no_license
ShihooWang/CourseDir
a075efdbf26ab285585612cb56b70e0855249911
eded15832b6ad013c178a0fec7e1d1e6f8695a69
refs/heads/master
2020-04-08T11:38:09.659368
2018-11-28T03:12:12
2018-11-28T03:12:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
package shihoo.wang.coursedir.coursefile; /** * Created by shihoo.wang on 2018/11/17. * Email shihu.wang@bodyplus.cc */ public interface FunctionItemClickListener { void onCreateNewFolder(); void onCreateNewFile(); }
[ "shihu.wang@bodyplus.cc" ]
shihu.wang@bodyplus.cc
20a4fc2f7de7d8932a0f705e74039fda99a44aff
7cab112a472df702c9b616c760b8940d50324550
/aionxemu-master/GameServer/data/scripts/system/handlers/quest/morheim/_2307IrresistibleSoup.java
e4290d947a56c2730cbc16a9baad381c81fcda56
[]
no_license
luckychenheng/server_demo
86d31c939fd895c7576156b643ce89354e102209
97bdcb1f6cd614fd360cfed800c479fbdb695cd3
refs/heads/master
2020-05-15T02:59:07.396818
2019-05-09T10:30:47
2019-05-09T10:30:47
182,059,222
2
0
null
null
null
null
UTF-8
Java
false
false
6,207
java
/* * This file is part of Aion X EMU <aionxemu.com>. * * This is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This software 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 software. If not, see <http://www.gnu.org/licenses/>. */ package quest.morheim; import gameserver.model.EmotionType; import gameserver.model.gameobjects.Npc; import gameserver.model.gameobjects.player.Player; import gameserver.network.aion.serverpackets.SM_DIALOG_WINDOW; import gameserver.network.aion.serverpackets.SM_EMOTION; import gameserver.network.aion.serverpackets.SM_USE_OBJECT; import gameserver.questEngine.handlers.QuestHandler; import gameserver.questEngine.model.QuestCookie; import gameserver.questEngine.model.QuestState; import gameserver.questEngine.model.QuestStatus; import gameserver.utils.PacketSendUtility; import gameserver.utils.ThreadPoolManager; /** * @author MrPoke remod By Nephis */ public class _2307IrresistibleSoup extends QuestHandler { private final static int questId = 2307; //INGREDIENT CHECK NEED TO SCRIPT public _2307IrresistibleSoup() { super(questId); } @Override public void register() { qe.setNpcQuestData(204378).addOnQuestStart(questId); //Favyr qe.setNpcQuestData(204378).addOnTalkEvent(questId); qe.setNpcQuestData(204336).addOnTalkEvent(questId); //Spedor qe.setNpcQuestData(700247).addOnTalkEvent(questId); //Aromatic Soup } @Override public boolean onDialogEvent(final QuestCookie env) { final Player player = env.getPlayer(); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (targetId == 204378) //Favyr { if (qs == null || qs.getStatus() == QuestStatus.NONE) { if (env.getDialogId() == 25) return sendQuestDialog(env, 4762); else return defaultQuestStartDialog(env); } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) { return defaultQuestEndDialog(env); } } else if (targetId == 204336) //Spedor { if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) { if (env.getDialogId() == 25) return sendQuestDialog(env, 1011); else if (env.getDialogId() == 10000) { qs.setQuestVar(2); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); player.getInventory().removeFromBagByItemId(182204106, 1); PacketSendUtility .sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else if (env.getDialogId() == 1182) { qs.setQuestVar(1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); player.getInventory().removeFromBagByItemId(182204107, 1); PacketSendUtility .sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else if (env.getDialogId() == 1267) { qs.setQuestVar(1); qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); player.getInventory().removeFromBagByItemId(182204108, 1); PacketSendUtility .sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } else return defaultQuestStartDialog(env); } } else if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) { switch (targetId) { case 700247: //Aromatic Soup { if (qs.getQuestVarById(0) == 0 && env.getDialogId() == -1) { final int targetObjectId = env.getVisibleObject().getObjectId(); PacketSendUtility.sendPacket(player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1)); PacketSendUtility.broadcastPacket(player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true); ThreadPoolManager.getInstance().schedule(new Runnable() { final QuestState qs = player.getQuestStateList().getQuestState(questId); @Override public void run() { if (player.getTarget() == null || player.getTarget().getObjectId() != targetObjectId) return; PacketSendUtility.sendPacket(player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0)); PacketSendUtility.broadcastPacket(player, new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId), true); qs.setQuestVar(1); updateQuestStatus(env); } }, 3000); } } } } return false; } }
[ "seemac@seedeMacBook-Pro.local" ]
seemac@seedeMacBook-Pro.local
db61e7992967bd4408b2ec307b5aa5a7c628a618
127c461bf479e925b6d328a2db437af37378cfff
/app/src/main/java/in/gotongroyong/gotongroyong/ConfirmationActivity.java
a489457585ac263b848cc3ce9784e6927b413c8b
[ "MIT" ]
permissive
BismitRevolution/GotongRoyong
ec669e382c1d7627f95cf409160cee22be6cd80e
116c698760339ac2596656a3f83902e8d26fe606
refs/heads/master
2020-03-28T07:51:10.183294
2019-07-25T07:00:00
2019-07-25T07:00:00
147,927,472
0
0
null
null
null
null
UTF-8
Java
false
false
3,196
java
package in.gotongroyong.gotongroyong; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.squareup.picasso.Picasso; import in.gotongroyong.gotongroyong.api.GotongRoyongAPI; import in.gotongroyong.gotongroyong.common.Router; import in.gotongroyong.gotongroyong.data.body.CampaignDetailBody; import in.gotongroyong.gotongroyong.data.gotongroyong.CampaignDetailResponse; import in.gotongroyong.gotongroyong.entity.API; public class ConfirmationActivity extends AppCompatActivity implements ResponseActivity { public static final String CONFIRMATION_CAMPAIGN_ID = "confirmation_campaign_id"; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_confirmation); Intent intent = getIntent(); int campaign_id = intent.getIntExtra(CONFIRMATION_CAMPAIGN_ID, -1); GotongRoyongAPI.getCampaign(this, new CampaignDetailBody(campaign_id)); } private void fetchData(final CampaignDetailResponse response) { ImageView bg = findViewById(R.id.campaign_bg); Picasso.get().load(response.getImageList().get(0).getImageUrl()).into(bg); ((TextView) findViewById(R.id.tv_campaign_data)).setText(getResources().getString(R.string.confirmation_description_value, response.getTitle(), response.getCampaignerFullname())); findViewById(R.id.btn_next_donate).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Router.gotoStory(getApplicationContext(), response.getCampaignId()); finish(); } }); findViewById(R.id.btn_skip).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } private void errorConnection() { Toast.makeText(getApplicationContext(), getResources().getString(R.string.error_connection), Toast.LENGTH_SHORT).show(); } private void errorUnknown() { Toast.makeText(getApplicationContext(), getResources().getString(R.string.field_warning_unknown_error), Toast.LENGTH_SHORT).show(); } @Override public void onActivityResponse(int responseCode, int resultCode, Object response) { switch (responseCode) { case API.CAMPAIGN_DETAIL: if (resultCode == API.IS_SUCCESS) { try { CampaignDetailResponse detailResponse = (CampaignDetailResponse) response; fetchData(detailResponse); } catch (Exception e) { e.printStackTrace(); } } else if (resultCode == API.ERROR_NO_CONNECTION) { errorConnection(); } else { errorUnknown(); } break; } } }
[ "cybermonster82@yahoo.com" ]
cybermonster82@yahoo.com
7608b55ccfe2d2213f3b1355f3ca429e9de793dd
78dd282a327afae96b8388eef8068591322e438a
/CrashCourse/src/top_k_frequent_elements/Solution.java
a37b4ed6a962a7bc53b67922f83ff064aad5b970
[]
no_license
ew0s/LeetCode
64cf09a945c9592e0500e602cebff9219823dd8f
d8b2d9792dc2823c718f09262b41c966d4b005b7
refs/heads/master
2023-08-31T13:14:25.419793
2023-08-20T16:26:55
2023-08-20T16:27:11
256,701,389
0
1
null
null
null
null
UTF-8
Java
false
false
1,066
java
package top_k_frequent_elements; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Solution { public int[] topKFrequent(int[] nums, int k) { Map<Integer, Integer> frequency = new HashMap<>(); for (int num : nums) { frequency.merge(num, 1, Integer::sum); } List<Integer>[] bucket = new ArrayList[nums.length + 1]; for (int key : frequency.keySet()) { int freq = frequency.get(key); if (bucket[freq] == null) { bucket[freq] = new ArrayList<>(); } bucket[freq].add(key); } int idx = 0; int[] result = new int[k]; for (int i = nums.length - 1; i >= 0; i--) { if (bucket[i] != null) { for (int val : bucket[i]) { result[idx++] = val; if (idx == k) { return result; } } } } return result; } }
[ "savkovskiy@tutu.tech" ]
savkovskiy@tutu.tech
4ee4ff1f0724d7434dd54fb82fa1005d35e151e0
7a4d0f4f9a0daf028965ab48369acba074ab6fdd
/module_base/src/main/java/com/example/bean/UserInfoBean.java
6105d112a44e3eee52fec7e6997de84c3e878e73
[]
no_license
majiaxue/yunchu
d1186c8e5d61ebc831f0e59355a298458e156c3f
31ae1fd330926b4c3fc0d08b0823035f6020c637
refs/heads/master
2022-09-02T21:02:49.016339
2020-05-21T05:12:24
2020-05-21T05:12:24
257,544,515
0
1
null
null
null
null
UTF-8
Java
false
false
19,994
java
package com.example.bean; import java.io.Serializable; public class UserInfoBean implements Serializable { /** * id : 224 * userCode : 337448873746235392 * username : 18639488962 * password : $2a$10$Nyv.vGk89VdzTVXlOJSPIe2Ptwpda3sf0kSKY9WAjrMmp9kyNffxi * realName : null * nickname : 18639488962 * phone : 18639488962 * status : 1 * createTime : 2019-09-27 14:28:11 * icon : http://39.100.59.67:8083/member/head_img.png * gender : null * birthday : null * province : 河南 * city : 周口 * job : null * personalizedSignature : null * sourceType : null * integration : 0 * growth : null * luckeyCount : null * historyIntegration : null * weixinOpenid : null * inviteCode : mw7jes * blance : 0 * backMoney : 0 * notBackMoney : 0 * checkCode : null * oldPassword : null * newPassword : null * oldPhone : null * token : null * level : 0 * tenantId : 1 * totalBackMoney : 0 * firstFansNum : 0 * selfOrderNum : 0 * recommendNum : 0 * relationId : null * aliAccount : null * cashOutIntegration : null * integrationCashOutNote : null * fansLevel : null * buyRatio : null * integral : null * contDays : null * lastSigninTime : null * firstClassCode : null * secondClassCode : null * firstClassPic : null * secondClassPic : null * estimatedIncome : 0 * todayPayNum : null * todayPredictEarnings : null * todayCloseEarnings : null * yesterdayPayNum : null * yesterdayPredictEarnings : null * yesterdayCloseEarnings : null * currentMonthPayNum : null * currentMonthPredictEarnings : null * currentMonthCloseEarnings : null * lastMonthPayNum : null * lastMonthPredictEarnings : null * lastMonthCloseEarnings : null * zgfr : 20 * spscNum : 1 * lljlNum : 1 */ private int id; private String userCode; private String username; private String password; private String realName; private String nickname; private String phone; private int status; private String createTime; private String icon; private String gender; private String birthday; private String province; private String city; private String job; private String personalizedSignature; private String sourceType; private int integration; private String growth; private String luckeyCount; private String historyIntegration; private String weixinOpenid; private String inviteCode; private double blance; private int backMoney; private int notBackMoney; private String checkCode; private String oldPassword; private String newPassword; private String oldPhone; private String token; private String level; private int tenantId; private double totalBackMoney; private int firstFansNum; private int selfOrderNum; private int recommendNum; private String relationId; private String aliAccount; private String cashOutIntegration; private String integrationCashOutNote; private String fansLevel; private String buyRatio; private String integral; private String contDays; private String lastSigninTime; private String firstClassCode; private String secondClassCode; private String firstClassPic; private String secondClassPic; private double estimatedIncome; private String todayPayNum; private double todayPredictEarnings; private double todayCloseEarnings; private String yesterdayPayNum; private String yesterdayPredictEarnings; private String yesterdayCloseEarnings; private String currentMonthPayNum; private String currentMonthPredictEarnings; private String currentMonthCloseEarnings; private String lastMonthPayNum; private String lastMonthPredictEarnings; private String lastMonthCloseEarnings; private String zgfr; private int spscNum; private int lljlNum; private String levelId; private String totalFans; private String star; public String getStar() { return star; } public void setStar(String star) { this.star = star; } public String getTotalFans() { return totalFans; } public void setTotalFans(String totalFans) { this.totalFans = totalFans; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUserCode() { return userCode; } public void setUserCode(String userCode) { this.userCode = userCode; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getRealName() { return realName; } public void setRealName(String realName) { this.realName = realName; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getJob() { return job; } public void setJob(String job) { this.job = job; } public String getPersonalizedSignature() { return personalizedSignature; } public void setPersonalizedSignature(String personalizedSignature) { this.personalizedSignature = personalizedSignature; } public String getSourceType() { return sourceType; } public void setSourceType(String sourceType) { this.sourceType = sourceType; } public int getIntegration() { return integration; } public void setIntegration(int integration) { this.integration = integration; } public String getGrowth() { return growth; } public void setGrowth(String growth) { this.growth = growth; } public String getLuckeyCount() { return luckeyCount; } public void setLuckeyCount(String luckeyCount) { this.luckeyCount = luckeyCount; } public String getHistoryIntegration() { return historyIntegration; } public void setHistoryIntegration(String historyIntegration) { this.historyIntegration = historyIntegration; } public String getWeixinOpenid() { return weixinOpenid; } public void setWeixinOpenid(String weixinOpenid) { this.weixinOpenid = weixinOpenid; } public String getInviteCode() { return inviteCode; } public void setInviteCode(String inviteCode) { this.inviteCode = inviteCode; } public double getBlance() { return blance; } public void setBlance(double blance) { this.blance = blance; } public int getBackMoney() { return backMoney; } public void setBackMoney(int backMoney) { this.backMoney = backMoney; } public int getNotBackMoney() { return notBackMoney; } public void setNotBackMoney(int notBackMoney) { this.notBackMoney = notBackMoney; } public String getCheckCode() { return checkCode; } public void setCheckCode(String checkCode) { this.checkCode = checkCode; } public String getOldPassword() { return oldPassword; } public void setOldPassword(String oldPassword) { this.oldPassword = oldPassword; } public String getNewPassword() { return newPassword; } public void setNewPassword(String newPassword) { this.newPassword = newPassword; } public String getOldPhone() { return oldPhone; } public void setOldPhone(String oldPhone) { this.oldPhone = oldPhone; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } public String getLevel() { return level; } public void setLevel(String level) { this.level = level; } public int getTenantId() { return tenantId; } public void setTenantId(int tenantId) { this.tenantId = tenantId; } public double getTotalBackMoney() { return totalBackMoney; } public void setTotalBackMoney(double totalBackMoney) { this.totalBackMoney = totalBackMoney; } public int getFirstFansNum() { return firstFansNum; } public void setFirstFansNum(int firstFansNum) { this.firstFansNum = firstFansNum; } public int getSelfOrderNum() { return selfOrderNum; } public void setSelfOrderNum(int selfOrderNum) { this.selfOrderNum = selfOrderNum; } public int getRecommendNum() { return recommendNum; } public void setRecommendNum(int recommendNum) { this.recommendNum = recommendNum; } public String getRelationId() { return relationId; } public void setRelationId(String relationId) { this.relationId = relationId; } public String getAliAccount() { return aliAccount; } public void setAliAccount(String aliAccount) { this.aliAccount = aliAccount; } public String getCashOutIntegration() { return cashOutIntegration; } public void setCashOutIntegration(String cashOutIntegration) { this.cashOutIntegration = cashOutIntegration; } public String getIntegrationCashOutNote() { return integrationCashOutNote; } public void setIntegrationCashOutNote(String integrationCashOutNote) { this.integrationCashOutNote = integrationCashOutNote; } public String getFansLevel() { return fansLevel; } public void setFansLevel(String fansLevel) { this.fansLevel = fansLevel; } public String getBuyRatio() { return buyRatio; } public void setBuyRatio(String buyRatio) { this.buyRatio = buyRatio; } public String getIntegral() { return integral; } public void setIntegral(String integral) { this.integral = integral; } public String getContDays() { return contDays; } public void setContDays(String contDays) { this.contDays = contDays; } public String getLastSigninTime() { return lastSigninTime; } public void setLastSigninTime(String lastSigninTime) { this.lastSigninTime = lastSigninTime; } public String getFirstClassCode() { return firstClassCode; } public void setFirstClassCode(String firstClassCode) { this.firstClassCode = firstClassCode; } public String getSecondClassCode() { return secondClassCode; } public void setSecondClassCode(String secondClassCode) { this.secondClassCode = secondClassCode; } public String getFirstClassPic() { return firstClassPic; } public void setFirstClassPic(String firstClassPic) { this.firstClassPic = firstClassPic; } public String getSecondClassPic() { return secondClassPic; } public void setSecondClassPic(String secondClassPic) { this.secondClassPic = secondClassPic; } public double getEstimatedIncome() { return estimatedIncome; } public void setEstimatedIncome(double estimatedIncome) { this.estimatedIncome = estimatedIncome; } public String getTodayPayNum() { return todayPayNum; } public void setTodayPayNum(String todayPayNum) { this.todayPayNum = todayPayNum; } public double getTodayPredictEarnings() { return todayPredictEarnings; } public void setTodayPredictEarnings(double todayPredictEarnings) { this.todayPredictEarnings = todayPredictEarnings; } public double getTodayCloseEarnings() { return todayCloseEarnings; } public void setTodayCloseEarnings(double todayCloseEarnings) { this.todayCloseEarnings = todayCloseEarnings; } public String getYesterdayPayNum() { return yesterdayPayNum; } public void setYesterdayPayNum(String yesterdayPayNum) { this.yesterdayPayNum = yesterdayPayNum; } public String getYesterdayPredictEarnings() { return yesterdayPredictEarnings; } public void setYesterdayPredictEarnings(String yesterdayPredictEarnings) { this.yesterdayPredictEarnings = yesterdayPredictEarnings; } public String getYesterdayCloseEarnings() { return yesterdayCloseEarnings; } public void setYesterdayCloseEarnings(String yesterdayCloseEarnings) { this.yesterdayCloseEarnings = yesterdayCloseEarnings; } public String getCurrentMonthPayNum() { return currentMonthPayNum; } public void setCurrentMonthPayNum(String currentMonthPayNum) { this.currentMonthPayNum = currentMonthPayNum; } public String getCurrentMonthPredictEarnings() { return currentMonthPredictEarnings; } public void setCurrentMonthPredictEarnings(String currentMonthPredictEarnings) { this.currentMonthPredictEarnings = currentMonthPredictEarnings; } public String getCurrentMonthCloseEarnings() { return currentMonthCloseEarnings; } public void setCurrentMonthCloseEarnings(String currentMonthCloseEarnings) { this.currentMonthCloseEarnings = currentMonthCloseEarnings; } public String getLastMonthPayNum() { return lastMonthPayNum; } public void setLastMonthPayNum(String lastMonthPayNum) { this.lastMonthPayNum = lastMonthPayNum; } public String getLastMonthPredictEarnings() { return lastMonthPredictEarnings; } public void setLastMonthPredictEarnings(String lastMonthPredictEarnings) { this.lastMonthPredictEarnings = lastMonthPredictEarnings; } public String getLastMonthCloseEarnings() { return lastMonthCloseEarnings; } public void setLastMonthCloseEarnings(String lastMonthCloseEarnings) { this.lastMonthCloseEarnings = lastMonthCloseEarnings; } public String getZgfr() { return zgfr; } public void setZgfr(String zgfr) { this.zgfr = zgfr; } public int getSpscNum() { return spscNum; } public void setSpscNum(int spscNum) { this.spscNum = spscNum; } public int getLljlNum() { return lljlNum; } public void setLljlNum(int lljlNum) { this.lljlNum = lljlNum; } @Override public String toString() { return "UserInfoBean{" + "id=" + id + ", userCode='" + userCode + '\'' + ", username='" + username + '\'' + ", password='" + password + '\'' + ", realName='" + realName + '\'' + ", nickname='" + nickname + '\'' + ", phone='" + phone + '\'' + ", status=" + status + ", createTime='" + createTime + '\'' + ", icon='" + icon + '\'' + ", gender='" + gender + '\'' + ", birthday='" + birthday + '\'' + ", province='" + province + '\'' + ", city='" + city + '\'' + ", job='" + job + '\'' + ", personalizedSignature='" + personalizedSignature + '\'' + ", sourceType='" + sourceType + '\'' + ", integration=" + integration + ", growth='" + growth + '\'' + ", luckeyCount='" + luckeyCount + '\'' + ", historyIntegration='" + historyIntegration + '\'' + ", weixinOpenid='" + weixinOpenid + '\'' + ", inviteCode='" + inviteCode + '\'' + ", blance=" + blance + ", backMoney=" + backMoney + ", notBackMoney=" + notBackMoney + ", checkCode='" + checkCode + '\'' + ", oldPassword='" + oldPassword + '\'' + ", newPassword='" + newPassword + '\'' + ", oldPhone='" + oldPhone + '\'' + ", token='" + token + '\'' + ", level='" + level + '\'' + ", tenantId=" + tenantId + ", totalBackMoney=" + totalBackMoney + ", firstFansNum=" + firstFansNum + ", selfOrderNum=" + selfOrderNum + ", recommendNum=" + recommendNum + ", relationId='" + relationId + '\'' + ", aliAccount='" + aliAccount + '\'' + ", cashOutIntegration='" + cashOutIntegration + '\'' + ", integrationCashOutNote='" + integrationCashOutNote + '\'' + ", fansLevel='" + fansLevel + '\'' + ", buyRatio='" + buyRatio + '\'' + ", integral='" + integral + '\'' + ", contDays='" + contDays + '\'' + ", lastSigninTime='" + lastSigninTime + '\'' + ", firstClassCode='" + firstClassCode + '\'' + ", secondClassCode='" + secondClassCode + '\'' + ", firstClassPic='" + firstClassPic + '\'' + ", secondClassPic='" + secondClassPic + '\'' + ", estimatedIncome=" + estimatedIncome + ", todayPayNum='" + todayPayNum + '\'' + ", todayPredictEarnings='" + todayPredictEarnings + '\'' + ", todayCloseEarnings='" + todayCloseEarnings + '\'' + ", yesterdayPayNum='" + yesterdayPayNum + '\'' + ", yesterdayPredictEarnings='" + yesterdayPredictEarnings + '\'' + ", yesterdayCloseEarnings='" + yesterdayCloseEarnings + '\'' + ", currentMonthPayNum='" + currentMonthPayNum + '\'' + ", currentMonthPredictEarnings='" + currentMonthPredictEarnings + '\'' + ", currentMonthCloseEarnings='" + currentMonthCloseEarnings + '\'' + ", lastMonthPayNum='" + lastMonthPayNum + '\'' + ", lastMonthPredictEarnings='" + lastMonthPredictEarnings + '\'' + ", lastMonthCloseEarnings='" + lastMonthCloseEarnings + '\'' + ", zgfr='" + zgfr + '\'' + ", spscNum=" + spscNum + ", lljlNum=" + lljlNum + '}'; } public String getLevelId() { return levelId; } public void setLevelId(String levelId) { this.levelId = levelId; } }
[ "ellliot_zhang_z@163.com" ]
ellliot_zhang_z@163.com
7e2435da72a2fa28ccfdfc811b1709b3319a7a47
5113953a8fe1ef2ad6fc4c8dc9918137eab3bf57
/src/com/wechat/mp/util/json/WxMpMassPreviewMessageGsonAdapter.java
199f2e343f4b5d1542f4ecd479ee198bb4563c20
[]
no_license
masterleesinsys/-
49772872aca74895e12c9528d02e3d0d128e6fb0
e58b240dec248e94d5bdeb68386bfdc7741297f0
refs/heads/master
2020-03-07T00:00:59.573246
2018-03-29T14:45:41
2018-03-29T14:47:50
127,147,657
0
0
null
null
null
null
UTF-8
Java
false
false
2,169
java
package com.wechat.mp.util.json; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.wechat.common.api.WxConsts; import com.wechat.mp.bean.WxMpMassPreviewMessage; import java.lang.reflect.Type; public class WxMpMassPreviewMessageGsonAdapter implements JsonSerializer<WxMpMassPreviewMessage> { @Override public JsonElement serialize(WxMpMassPreviewMessage wxMpMassPreviewMessage, Type type, JsonSerializationContext jsonSerializationContext) { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("towxname", wxMpMassPreviewMessage.getToWxUserName()); jsonObject.addProperty("touser", wxMpMassPreviewMessage.getToWxUserOpenid()); if (WxConsts.MassMsgType.MPNEWS.equals(wxMpMassPreviewMessage.getMsgType())) { JsonObject news = new JsonObject(); news.addProperty("media_id", wxMpMassPreviewMessage.getMediaId()); jsonObject.add(WxConsts.MassMsgType.MPNEWS, news); } if (WxConsts.MassMsgType.TEXT.equals(wxMpMassPreviewMessage.getMsgType())) { JsonObject sub = new JsonObject(); sub.addProperty("content", wxMpMassPreviewMessage.getContent()); jsonObject.add(WxConsts.MassMsgType.TEXT, sub); } if (WxConsts.MassMsgType.VOICE.equals(wxMpMassPreviewMessage.getMsgType())) { JsonObject sub = new JsonObject(); sub.addProperty("media_id", wxMpMassPreviewMessage.getMediaId()); jsonObject.add(WxConsts.MassMsgType.VOICE, sub); } if (WxConsts.MassMsgType.IMAGE.equals(wxMpMassPreviewMessage.getMsgType())) { JsonObject sub = new JsonObject(); sub.addProperty("media_id", wxMpMassPreviewMessage.getMediaId()); jsonObject.add(WxConsts.MassMsgType.IMAGE, sub); } if (WxConsts.MassMsgType.MPVIDEO.equals(wxMpMassPreviewMessage.getMsgType())) { JsonObject sub = new JsonObject(); sub.addProperty("media_id", wxMpMassPreviewMessage.getMediaId()); jsonObject.add(WxConsts.MassMsgType.MPVIDEO, sub); } jsonObject.addProperty("msgtype", wxMpMassPreviewMessage.getMsgType()); return jsonObject; } }
[ "oschina_java@126.com" ]
oschina_java@126.com
f76393dd2d3fbc94ae9b80807d26d16995c82587
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_9e7dbf6354b1a93a001cb0076722005d3408a01c/PowerShellStorageDomainResource/2_9e7dbf6354b1a93a001cb0076722005d3408a01c_PowerShellStorageDomainResource_s.java
5a62c34c96ce5484bdd6f41dd6212ea0db8be03e
[]
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
11,091
java
/* * Copyright © 2010 Red Hat, Inc. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software 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. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package com.redhat.rhevm.api.powershell.resource; import java.util.ArrayList; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; import com.redhat.rhevm.api.common.resource.AbstractActionableResource; import com.redhat.rhevm.api.common.resource.StorageDomainActionValidator; import com.redhat.rhevm.api.common.util.JAXBHelper; import com.redhat.rhevm.api.model.Action; import com.redhat.rhevm.api.model.ActionsBuilder; import com.redhat.rhevm.api.model.ActionValidator; import com.redhat.rhevm.api.model.Link; import com.redhat.rhevm.api.model.Storage; import com.redhat.rhevm.api.model.StorageDomain; import com.redhat.rhevm.api.resource.AttachmentsResource; import com.redhat.rhevm.api.resource.StorageDomainResource; import com.redhat.rhevm.api.powershell.model.PowerShellStorageDomain; import com.redhat.rhevm.api.powershell.util.PowerShellCmd; public class PowerShellStorageDomainResource extends AbstractActionableResource<StorageDomain> implements StorageDomainResource { private PowerShellStorageDomainsResource parent; private StorageDomain staged; public PowerShellStorageDomainResource(String id, PowerShellStorageDomainsResource parent, StorageDomain staged) { super(id, parent.getExecutor()); this.parent = parent; this.staged = staged; } public PowerShellStorageDomainResource(String id, PowerShellStorageDomainsResource parent) { this(id, parent, null); } public StorageDomain getStaged() { return staged; } /** * Run a powershell command and parse the output as a list of storage * domains. * <p> * If the resulting storage domains are being viewed in the context * of a specific data center, then the caller wants the value of the * 'status' property. In this case, @sharedStatus should be #false. * <p> * If the storage domain is being viewed outside of the context of any * data center, then the 'sharedStatus' property contains the required * status and the caller should supply #true for @sharedStatus. * * @param command the powershell command to execute * @param sharedStatus whether the 'sharedStatus' property is needed * @return a list of storage domains */ public static ArrayList<StorageDomain> runAndParse(String command, boolean sharedStatus) { ArrayList<PowerShellStorageDomain> storageDomains = PowerShellStorageDomain.parse(PowerShellCmd.runCommand(command)); ArrayList<StorageDomain> ret = new ArrayList<StorageDomain>(); for (PowerShellStorageDomain storageDomain : storageDomains) { if (!sharedStatus) { storageDomain.setStatus(storageDomain.getSharedStatus()); } ret.add(storageDomain); } return ret; } /** * Run a powershell command and parse the output as a list of storage * domains. The 'sharedStatus' property in the output from the command * is ignored. * * @param command the powershell command to execute * @return a list of storage domains */ public static ArrayList<StorageDomain> runAndParse(String command) { return runAndParse(command, false); } /** * Run a powershell command and parse the output as a single storage * domain. * * @param command the powershell command to execute * @param whether the 'sharedStatus' property is needed * @return a single storage domain, or null */ public static StorageDomain runAndParseSingle(String command, boolean sharedStatus) { ArrayList<StorageDomain> storageDomains = runAndParse(command, sharedStatus); return !storageDomains.isEmpty() ? storageDomains.get(0) : null; } /** * Run a powershell command and parse the output as a single storage * domain. The 'sharedStatus' property in the output from the command * is ignored. * * @param command the powershell command to execute * @return a single storage domain, or null */ public static StorageDomain runAndParseSingle(String command) { return runAndParseSingle(command, false); } public StorageDomain addLinks(StorageDomain storageDomain, UriBuilder uriBuilder) { storageDomain.setHref(uriBuilder.build().toString()); ActionValidator actionValidator = new StorageDomainActionValidator(storageDomain); ActionsBuilder actionsBuilder = new ActionsBuilder(uriBuilder, StorageDomainResource.class, actionValidator); storageDomain.setActions(actionsBuilder.build()); Link link = new Link(); link.setRel("attachments"); link.setHref(uriBuilder.clone().path("attachments").build().toString()); storageDomain.getLinks().clear(); storageDomain.getLinks().add(link); return storageDomain; } @Override public StorageDomain get(UriInfo uriInfo) { StorageDomain storageDomain; if (staged != null) { storageDomain = staged; } else { storageDomain = parent.mapFromRhevmId(runAndParseSingle("get-storagedomain " + getId(), true)); } storageDomain = JAXBHelper.clone(OBJECT_FACTORY.createStorageDomain(storageDomain)); return addLinks(storageDomain, uriInfo.getRequestUriBuilder()); } @Override public StorageDomain update(HttpHeaders headers, final UriInfo uriInfo, StorageDomain storageDomain) { validateUpdate(storageDomain, headers); StringBuilder buf = new StringBuilder(); if (staged != null) { // update writable fields only staged.setName(storageDomain.getName()); storageDomain = staged; } else { buf.append("$h = get-storagedomain " + getId() + "\n"); if (storageDomain.getName() != null) { buf.append("$h.name = '" + storageDomain.getName() + "'"); } buf.append("\n"); buf.append("update-storagedomain -storagedomainobject $v"); storageDomain = parent.mapFromRhevmId(runAndParseSingle(buf.toString(), true)); } storageDomain = JAXBHelper.clone(OBJECT_FACTORY.createStorageDomain(storageDomain)); return addLinks(storageDomain, uriInfo.getRequestUriBuilder()); } @Override public Response initialize(UriInfo uriInfo, Action action) { return doAction(uriInfo, new StorageDomainInitializer(action)); } @Override public Response teardown(UriInfo uriInfo, Action action) { return doAction(uriInfo, new StorageDomainTeardowner(action)); } @Override public AttachmentsResource getAttachmentsResource() { return new PowerShellAttachmentsResource(getId()); } private abstract class StorageDomainActionTask extends AbstractActionTask { protected String id; protected StorageDomain staged; protected PowerShellStorageDomainsResource parent; public StorageDomainActionTask(Action action) { super(action); this.id = PowerShellStorageDomainResource.this.getId(); this.staged = PowerShellStorageDomainResource.this.staged; this.parent = PowerShellStorageDomainResource.this.parent; } } private class StorageDomainInitializer extends StorageDomainActionTask { public StorageDomainInitializer(Action action) { super(action); } public void run() { StringBuilder buf = new StringBuilder(); buf.append("add-storagedomain"); if (staged.getName() != null) { buf.append(" -name '" + staged.getName() + "'"); } buf.append(" -hostid " + action.getHost().getId()); buf.append(" -domaintype "); switch (staged.getType()) { case DATA: buf.append("Data"); break; case ISO: buf.append("ISO"); break; case EXPORT: buf.append("Export"); break; default: assert false : staged.getType(); break; } Storage storage = staged.getStorage(); buf.append(" -storagetype " + storage.getType().toString()); buf.append(" -storage "); switch (storage.getType()) { case NFS: buf.append("'" + storage.getAddress() + ":" + storage.getPath() + "'"); break; case ISCSI: case FCP: default: assert false : storage.getType(); break; } StorageDomain storageDomain = PowerShellStorageDomainResource.runAndParseSingle(buf.toString(), true); parent.unstageDomain(id, storageDomain.getId()); } } private class StorageDomainTeardowner extends StorageDomainActionTask { public StorageDomainTeardowner(Action action) { super(action); } public void run() { StorageDomain storageDomain = new StorageDomain(); storageDomain.setId(id); parent.mapToRhevmId(storageDomain); storageDomain = runAndParseSingle("get-storagedomain " + storageDomain.getId(), true); StringBuilder buf = new StringBuilder(); buf.append("remove-storagedomain -force"); buf.append(" -storagedomainid " + storageDomain.getId()); buf.append(" -hostid " + action.getHost().getId()); PowerShellCmd.runCommand(buf.toString()); staged = parent.mapFromRhevmId(storageDomain); parent.stageDomain(id, PowerShellStorageDomainResource.this); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
bdb4af4ec82474a777ccd4275e86a3fe24458393
dd6da26afbc257d8aa2a3e615d472ceba6da0da0
/P05-Dependencias2/P05-mocks/reserva/src/main/java/ppss/Reserva.java
0cfe62262befa10e734aa93d9a1b942dc0fd6c04
[]
no_license
Baidal/PPSS
918d53b23462dc6d0b03a0f23fcadaa52b902478
13255b146837a6cf3321df4063959f914068433f
refs/heads/main
2023-06-03T12:42:33.324100
2021-06-17T15:23:42
2021-06-17T15:23:42
377,871,496
1
0
null
null
null
null
UTF-8
Java
false
false
1,685
java
package ppss; import excepciones.IsbnInvalidoException; import excepciones.JDBCException; import excepciones.ReservaException; import excepciones.SocioInvalidoException; import java.util.ArrayList; public class Reserva { public boolean compruebaPermisos(String login, String password, Usuario tipoUsu) { throw new UnsupportedOperationException("Not yet implemented"); } public FactoriaBOs getFactoriaBOs(){ return new FactoriaBOs(); } public void realizaReserva(String login, String password, String socio, String [] isbns) throws ReservaException { ArrayList<String> errores = new ArrayList<String>(); if(!compruebaPermisos(login, password, Usuario.BIBLIOTECARIO)) { errores.add("ERROR de permisos"); } else { FactoriaBOs fd = getFactoriaBOs(); IOperacionBO io = fd.getOperacionBO(); try { for(String isbn: isbns) { try { io.operacionReserva(socio, isbn); } catch (IsbnInvalidoException iie) { errores.add("ISBN invalido" + ":" + isbn); } } } catch (SocioInvalidoException sie) { errores.add("SOCIO invalido"); } catch (JDBCException je) { errores.add("CONEXION invalida"); } } if (errores.size() > 0) { String mensajeError = ""; for(String error: errores) { mensajeError += error + "; "; } throw new ReservaException(mensajeError); } } }
[ "lvr31@alu.ua.es" ]
lvr31@alu.ua.es
f4b4a359ffb724a72f3118a9bdab673b7e7f1884
e1fb57b1dfd1e60bd511f11fd1313138c99df9e7
/web/src/main/java/com/itshidu/websocket/handshake/ServerHandshake.java
dcb99217c872d27f6dbe172c0be4aadce4c2248a
[]
no_license
two-personteam/zuoye
a01bcffedde88aa984f247bda12c6613cc1df25b
fa6bca4211fc6e821888ac42734ae75b53b75e90
refs/heads/master
2022-12-24T05:26:04.523137
2020-05-24T08:02:58
2020-05-24T08:02:58
253,666,133
0
1
null
2022-12-16T04:24:01
2020-04-07T02:24:41
JavaScript
UTF-8
Java
false
false
171
java
package com.itshidu.websocket.handshake; public interface ServerHandshake extends Handshakedata { public short getHttpStatus(); public String getHttpStatusMessage(); }
[ "zyx14151628@163.com" ]
zyx14151628@163.com
1ad80be7fcd1067658c1739ee5df9cd4ff3dbe7b
4ca918c318c9026cddb0ed4fca286bdd083019fa
/src/main/java/message/request/RequestMessageFields.java
1701f2ef88df9ff8c21355b0f71d8b30334de53b
[]
no_license
senzsze/APEX-java-sdk
36971228504bab46431606ea7f03b0e6989c8e58
28ed2be35ba51119cbcb4eaac6a9fd5b5ae175af
refs/heads/master
2020-07-07T08:32:49.372900
2019-08-19T22:14:39
2019-08-19T22:14:39
203,304,820
0
0
null
2019-08-20T05:19:16
2019-08-20T05:19:16
null
UTF-8
Java
false
false
1,731
java
/* * The MIT License (MIT) * * Copyright (c) 2017 - 2019 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package message.request; /** * This class defines valid message field keys for {@link ARequestMessage} * @author Artem Eger * @since 16.08.2019 */ public final class RequestMessageFields { public static final String HEIGHT = "height"; public static final String HASH = "hash"; public static final String ID = "id"; public static final String ADDRESS = "address"; public static final String LIST_TYPE = "listType"; public static final String COUNT = "count"; public static final String RAW_TX = "rawTx"; public static final String MULTIPLE_TX = "txs"; }
[ "ae@hazana.de" ]
ae@hazana.de
c673c3523f094ce0b4cb7dd3c4ec05fde6b0293f
093f14e90f7e8d4e0c933e945c6bd87da71692a1
/src/dao/ICartDao.java
9866a254ab52f64c300e2e4d966e90d06a208a95
[]
no_license
AchillesChen13/ShoppingMall
2fd55fed0b689d6cc9e7beaae608d054fca6d613
9703031b8d974429bb87c0065418cc9674a3b598
refs/heads/master
2022-09-12T18:18:27.996726
2020-06-05T07:53:11
2020-06-05T07:53:11
269,553,090
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package dao; import java.util.List; import entity.CartDetail; public interface ICartDao { public boolean deleteCommodityFromCart(CartDetail detail); public boolean insertCommodityInCart(CartDetail detail); public List<CartDetail> selectCartByUid(int uId); }
[ "406005964@qq.com" ]
406005964@qq.com
78965ba894fd20cb6f7a7aee087b434a944d04ad
8d8fb4dfd7be299076651e02d26eba6cd879428c
/instrumentation/netty-4.0.8/src/main/java/com/agent/instrumentation/netty40/NettyUtil.java
4eeed8c282319df83c2aa8a45b5a0441c8f7ab5a
[ "Apache-2.0" ]
permissive
newrelic/newrelic-java-agent
db6dd20f6ba3f43909b004ce4a058f589dd4b017
eb298ecd8d31f93622388aa12d3ba1e68a58f912
refs/heads/main
2023-08-31T05:14:44.428903
2023-08-29T10:37:35
2023-08-30T18:08:38
275,016,355
177
150
Apache-2.0
2023-09-11T14:50:06
2020-06-25T21:13:42
Java
UTF-8
Java
false
false
1,895
java
/* * * * Copyright 2020 New Relic Corporation. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * */ package com.agent.instrumentation.netty40; import com.newrelic.agent.bridge.AgentBridge; import com.newrelic.agent.bridge.Token; import com.newrelic.api.agent.NewRelic; import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.HttpResponse; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.util.logging.Level; public class NettyUtil { public static String getNettyVersion() { return "4"; } public static void setAppServerPort(SocketAddress localAddress) { if (localAddress instanceof InetSocketAddress) { int port = ((InetSocketAddress) localAddress).getPort(); NewRelic.setAppServerPort(port); } else { AgentBridge.getAgent().getLogger().log(Level.FINE, "Unable to get Netty port number"); } } public static void setServerInfo() { AgentBridge.publicApi.setServerInfo("Netty", getNettyVersion()); } public static boolean processResponse(Object msg, Token token) { if (token != null) { if (msg instanceof HttpResponse) { com.newrelic.api.agent.Transaction tx = token.getTransaction(); if (tx != null) { try { tx.setWebResponse(new ResponseWrapper((HttpResponse) msg)); tx.addOutboundResponseHeaders(); tx.markResponseSent(); } catch (Exception e) { AgentBridge.getAgent().getLogger().log(Level.FINER, e, "Unable to set web request on transaction: {0}", tx); } } token.expire(); return true; } } return false; } }
[ "49817386+jeffalder@users.noreply.github.com" ]
49817386+jeffalder@users.noreply.github.com
5d45790cf8309ab550d3119287162bbae3c266ca
c6e4c765862b98d11f12f800789e0982a980e5d9
/apm-sniffer/apm-sdk-plugin/elasticsearch-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticsearch/v6/interceptor/IndicesClientCreateMethodsInterceptor.java
e6f1db567068e3dbfc22b5d4f73718536a4dad94
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
Fxdemon/incubator-skywalking
ba70e8a481c2613aa966e941a187f6eb140a67f2
89183fbc3830313566b58dbbab0a45cd94023141
refs/heads/master
2020-04-19T03:23:51.307175
2019-12-09T03:33:10
2019-12-09T03:33:10
152,511,085
2
0
Apache-2.0
2019-01-28T01:10:09
2018-10-11T01:14:13
Java
UTF-8
Java
false
false
3,905
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor; import static org.apache.skywalking.apm.agent.core.conf.Config.Plugin.Elasticsearch.TRACE_DSL; import static org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor.Constants.DB_TYPE; import java.lang.reflect.Method; import org.apache.skywalking.apm.agent.core.context.ContextManager; import org.apache.skywalking.apm.agent.core.context.tag.Tags; import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo; import org.elasticsearch.client.indices.CreateIndexRequest; /** * @author aderm */ public class IndicesClientCreateMethodsInterceptor implements InstanceMethodsAroundInterceptor { @Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable { CreateIndexRequest createIndexRequest = (CreateIndexRequest)(allArguments[0]); RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst .getSkyWalkingDynamicField()); if (restClientEnhanceInfo != null) { AbstractSpan span = ContextManager .createExitSpan(Constants.CREATE_OPERATOR_NAME, restClientEnhanceInfo.getPeers()); span.setComponent(ComponentsDefine.REST_HIGH_LEVEL_CLIENT); Tags.DB_TYPE.set(span, DB_TYPE); Tags.DB_INSTANCE.set(span, createIndexRequest.index()); if (TRACE_DSL) { //Store es mapping parameters Tags.DB_STATEMENT .set(span, createIndexRequest.mappings().utf8ToString()); } SpanLayer.asDB(span); } } @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst .getSkyWalkingDynamicField()); if (restClientEnhanceInfo != null) { ContextManager.stopSpan(); } return ret; } @Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst .getSkyWalkingDynamicField()); if (restClientEnhanceInfo != null) { ContextManager.activeSpan().errorOccurred().log(t); } } }
[ "wu.sheng@foxmail.com" ]
wu.sheng@foxmail.com
3612f74cc20aff5527c9f5dd4f5c623b016bc03b
d159e62893a46fcac4c5bea52dd13c6061576e47
/app/src/main/java/com/wallpaperswitcher/tasks/ListPhotoFlickrTaskOld.java
b5d08359ee079260ae5994983eb3884d554ae3d3
[]
no_license
florian2412/WallpaperSwitcher
c6767062896a35bb0b387972d4b4a3a288056840
02ca9d1b14a4ef2b6ca8712f782c201bddfd7398
refs/heads/master
2020-05-30T14:43:23.713795
2015-07-18T18:13:26
2015-07-18T18:13:26
38,956,656
0
0
null
null
null
null
UTF-8
Java
false
false
1,873
java
package com.wallpaperswitcher.tasks; import android.os.AsyncTask; import com.wallpaperswitcher.flickrService.FlickrService; import com.wallpaperswitcher.flickrService.model.FlickSearch; import com.wallpaperswitcher.flickrService.model.Photo; import retrofit.RestAdapter; import retrofit.android.AndroidLog; public class ListPhotoFlickrTaskOld extends AsyncTask<String,Void,FlickSearch> { private FlickSearch flickSearch; @Override protected FlickSearch doInBackground(String...params) { FlickrService flickService = new RestAdapter.Builder() .setEndpoint(FlickrService.ENDPOINT) .setLog(new AndroidLog("retrofit")) .setLogLevel(RestAdapter.LogLevel.FULL) .build() .create(FlickrService.class); String method = params[0]; String api_key = params[1]; String tags = params[2]; String text = params[3]; String format = params[4]; String nojsoncallback = params[5]; flickSearch = flickService.getPhotos(method, api_key, tags, text, format, nojsoncallback); return flickSearch; } @Override protected void onPostExecute(FlickSearch flickSearch) { super.onPostExecute(flickSearch); // Exemple URL pour récupérer une photo // https://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg if(flickSearch.getPhotos() != null) { Photo photo = null; String urlPhoto = null; for(int i = 0; i < 10; i++) { photo = flickSearch.getPhotos().getPhoto().get(i); urlPhoto = "https://farm" + photo.getFarm() + ".staticflickr.com/" + photo.getServer() + "/" + photo.getId() + "_" + photo.getSecret() + ".jpg"; //MainFragment.addImageToCard(urlPhoto); } } } }
[ "florian2412@gmail.com" ]
florian2412@gmail.com
47fbfd90f57201b165211782872c693ba6410669
42eade156d7dd158e10d30f34686afd1ddda7f80
/app/src/main/java/com/example/eggtimer/MainActivity.java
15f1b45ad0e4609c17080f468377b410dfaba306
[]
no_license
prakharxyz/egg-timer
44a2c85df92727306f45f27130d194f4d9120881
28264b6147fb3b3392dec63a418ea94aa4b393e6
refs/heads/main
2023-06-15T11:09:54.817103
2021-06-29T20:20:46
2021-06-29T20:20:46
381,487,463
0
0
null
null
null
null
UTF-8
Java
false
false
5,376
java
package com.example.eggtimer; import androidx.appcompat.app.AppCompatActivity; import android.media.MediaPlayer; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.widget.Button; import android.widget.SeekBar; import android.widget.TextView; public class MainActivity extends AppCompatActivity { //create objects of the required elements to use them in mainActivity TextView timerTextView; //textView to show time left for timer to user in format M:ss SeekBar timerSeekBar; //seekBar to set required timer Boolean counterIsActive = false; //initially timer is not active but when user presses 'go' it becomes active Button goButton; //button to either launch the timer or stop it CountDownTimer countDownTimer; //timer //reset timer function which is called to reset the timer whenever timer is over or user presses 'stop' public void resetTimer() { timerTextView.setText("0:30"); //set the timer timerSeekBar.setProgress(30); //set the progress of seekBar to 30 timerSeekBar.setEnabled(true); //enable seekbar which was previously disabled when counter was active countDownTimer.cancel(); //cancel or terminate countDownTimer try { goButton.setText("GO!"); //set text in button as GO } catch(Exception e){ e.printStackTrace();} counterIsActive=false; //counter is set to not active as the timer is reset } //func to update timerTextView which takes second left as argument which it can get from countDown timer easily public void updateTimer(int secondsLeft) { int minutes = secondsLeft/60; //create minutes var to extract minutes from secondsLeft int seconds = secondsLeft-(minutes*60); //create seconds var to extract seconds (00-59) from secondsLeft //when seconds goes below 9 (Ex:- 0:5 -> 0:05) we want to insert an extra o before seconds so it looks good String secondString = Integer.toString(seconds); if(seconds<=9){ secondString="0"+secondString; } timerTextView.setText(Integer.toString(minutes) + ":" + secondString); //set minutes to left of colon and seconds to right of colon in timer textView } //when "GO!" or "STOP!" is clicked public void buttonClicked(View view) { if (counterIsActive) { //reset the timer if counter was active ,ie , when 'stop' is clicked resetTimer(); //this sets counter not active } else { //when counter is not active , we want to activate the timer counterIsActive = true; //set counter condition to be active timerSeekBar.setEnabled(false); //disable seekbar so user cannot alter it try { goButton.setText("STOP!"); //set its text to 'stop' } catch (Exception e){ e.printStackTrace();} //define countDown timer which has interval of 1 sec and starts from value of seekbar countDownTimer = new CountDownTimer(timerSeekBar.getProgress() * 1000 + 100 , 1000) { @Override public void onTick(long millisUntilFinished) { updateTimer((int) millisUntilFinished / 1000); //we can get secondsLeft from its long argument by converting it to int & calling updateTimer func so taht it updates the textview with every sec } @Override public void onFinish() { try { MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.tone); mediaPlayer.start(); } catch (IllegalStateException e) { e.printStackTrace(); } resetTimer(); //when timer gets finished play buzzing sound from mediaPlayer and call func to reset timer } }.start(); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); timerSeekBar = findViewById(R.id.timerSeekBar); timerTextView = findViewById(R.id.timerTextView); goButton = findViewById(R.id.goButton); timerSeekBar.setMax(600); //set max value of seekBar to 10 min timerSeekBar.setProgress(30); //set default value of seekBar to 30 sec //set seekbar change listener call func to update timer tv with progress set in seekBar timerSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { updateTimer(progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); } } //ERROR SOLVED : NullPointerExeption solved on goButton by finding it on oncreate which was previously not //ERROR : audio not playing when timer gets over neither it is showing any exception in logcat
[ "prkhrgrwl@gmail.com" ]
prkhrgrwl@gmail.com
b3bdd0410863f5604dfb44f68ad627ed7220fce8
8b7f0b7d06d0e9cffbbd67df220c4d82e72f7fab
/src/main/java/com/aws/codestar/projecttemplates/entity/UserEntity.java
fbb35631dad18b56b3529672b7f48153f2afb85f
[]
no_license
nasimsarwar/Ashok-IT-WS
d85839c1d4bba03a25b8dd427fbb2d95c387c8f7
0290dff9414a02ba297c3d68472f221de581cdaa
refs/heads/master
2023-04-08T16:49:19.015961
2021-03-14T16:46:23
2021-03-14T16:46:23
347,394,785
0
0
null
null
null
null
UTF-8
Java
false
false
2,959
java
package com.aws.codestar.projecttemplates.entity; import java.io.Serializable; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name = "users") public class UserEntity implements Serializable { private static final long serialVersionUID = -8670086959410697805L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(nullable = false) private String userId; @Column(nullable = false) private String firstName; @Column(nullable = false) private String lastName; @Column(nullable = false) private String email; @Column(nullable = false) private String encryptedPassword; @Column(nullable = false) private String mobileNumber; private String emailVerificationToken; @Column(nullable = false) private Boolean emailVerificationStatus = false; @OneToMany(mappedBy = "userDetails", cascade = CascadeType.ALL) private List<AddressEntity> addresses; public List<AddressEntity> getAddresses() { return addresses; } public void setAddresses(List<AddressEntity> addresses) { this.addresses = addresses; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getEncryptedPassword() { return encryptedPassword; } public void setEncryptedPassword(String encryptedPassword) { this.encryptedPassword = encryptedPassword; } public String getMobileNumber() { return mobileNumber; } public void setMobileNumber(String mobileNumber) { this.mobileNumber = mobileNumber; } @Override public String toString() { return "UserEntity [id=" + id + ", userId=" + userId + ", firstName=" + firstName + ", lastName=" + lastName + ", email=" + email + ", encryptedPassword=" + encryptedPassword + ", mobileNumber=" + mobileNumber + "]"; } public String getEmailVerificationToken() { return emailVerificationToken; } public void setEmailVerificationToken(String emailVerificationToken) { this.emailVerificationToken = emailVerificationToken; } public Boolean getEmailVerificationStatus() { return emailVerificationStatus; } public void setEmailVerificationStatus(Boolean emailVerificationStatus) { this.emailVerificationStatus = emailVerificationStatus; } }
[ "wdigilabs@gmail.com" ]
wdigilabs@gmail.com
451736f2e7ffd9995f765d9fc2eb04604a4de9b8
4abd5ccd05208046a0b92442c1ef9077ab6336d7
/48-rotate-image/48-rotate-image.java
42d038d331146b8b00c456ab94041fe0585c26d5
[]
no_license
marysolei/Leetcode
c0f2139c4516069e1368509f9870c27c306c43ce
a2fc17feed7cb92bd343326341258b0fb830ca1c
refs/heads/main
2023-05-13T21:25:52.780485
2023-05-11T00:56:18
2023-05-11T00:56:18
190,481,692
1
0
null
null
null
null
UTF-8
Java
false
false
705
java
class Solution { public void rotate(int[][] matrix) { //check for null input if(matrix == null || matrix.length ==0)return; int n = matrix.length; for(int row =0; row< (n+1)/2; row++) { for(int col=0; col< n/2 ; col++) { int temp = matrix[n - 1 - col][row]; matrix[n - 1 - col][row] = matrix[n - 1 - row][n - col - 1]; matrix[n - 1 - row][n - col - 1] = matrix[col][n - 1 -row]; matrix[col][n - 1 - row] = matrix[row][col]; matrix[row][col] = temp; } } } } //Time complexity: O(n*n) as we need to read each cell once //Space complexity: O(1)
[ "48185634+marysolei@users.noreply.github.com" ]
48185634+marysolei@users.noreply.github.com
cb2837c743da663ab6d5dccca7a0e46b8bbe6692
529ae3eac645f2e30c9d1d1482294f010c517056
/Java/Account.java
7751ccb00a5ca6ee0ee3b562ab9ad670481221c7
[]
no_license
AlexisLoya/CursoPooUber
42fe8689e6a10bc44411e26afc62fa9c5d7d7223
6ec08ed22f8e850a34d0f74394d4a0ad74dc7bdc
refs/heads/master
2023-02-03T01:30:43.292683
2020-12-21T04:32:49
2020-12-21T04:32:49
322,899,575
0
0
null
null
null
null
UTF-8
Java
false
false
242
java
class Account{ Integer id; String name; String document; String email; String password; public Account(String name, String document){ this.name = name; this.document = document; } }
[ "alexloy117@gmail.com" ]
alexloy117@gmail.com
bff2bb2548025b41b1d6796a9bebfe87a3b4a778
24068ce6c3498bac04068039104990b4c30c7a91
/src/server_side/Solver.java
a8e1cc9e7786097b0e014bb6964df634844a62a6
[ "MIT" ]
permissive
yonatangross/GenericAlgoSolver
52871c297dfdcb00242cbe15a3d222e69659a58c
c75a16de5d209398a780bad0aa8d5b6dff57ac2b
refs/heads/master
2020-07-01T13:00:49.897530
2019-08-08T15:33:15
2019-08-08T15:33:15
201,183,542
1
0
null
null
null
null
UTF-8
Java
false
false
113
java
package server_side; public interface Solver<Problem, Solution> { public Solution solve(Problem problem); }
[ "yonatan2gross@gmail.com" ]
yonatan2gross@gmail.com
fc987e84ed3c5430052974801f73f979abd963b0
d9723e14f076b4a4db635b64cfcaa232a7934097
/src/rules/Capital.java
c701b698c0078f68882a9e013614049b31f1f130
[ "MIT" ]
permissive
m33x/PasswordStrengthMeter
9a3329939cfd10ff7c3266141c7b88c84c7e5838
2af0a4daf085e6b97e769367fb2879eb450c56b3
refs/heads/master
2020-04-10T14:25:46.549844
2018-10-08T11:12:30
2018-10-08T11:12:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
package rules; /** * @title: Capital * @description: Class for Capital, e.g.: C3 -> ABC * @author: Felix **/ public class Capital extends ProductionRule { private int terminalSymbolCount; // e.g.: C2 -> QQ, thus count is 2 public Capital() { } public Capital(String lhs, String rhs) { this.lhs = lhs; this.rhs = rhs; this.terminalSymbolCount = rhs.length(); } public int getTerminalSymbolCount() { return terminalSymbolCount; } public void setTerminalSymbolCount(int terminalSymbolCount) { this.terminalSymbolCount = terminalSymbolCount; } @Override public String toString() { return "Capital{" + "terminalSymbolCount=" + terminalSymbolCount + ", lhs='" + lhs + '\'' + ", rhs='" + rhs + '\'' + '}'; } }
[ "infinitesamsarax@outlook.com" ]
infinitesamsarax@outlook.com
677dcdb984bd385acd82ff3d931e9dc27a4e059b
940288b7b66150db3c4651ebbe950a4fa9b507b2
/app/Fruits.java
755e9d6b1756e81aa355847b729ecb9b00143cda
[]
no_license
ParagKadam101/RecyclerViewDemo
9e2e3df43683fc03e954bf71d76833f5e3e4469c
1cce478b48433386d45055a407a4f51efc9455a7
refs/heads/master
2021-01-23T06:14:42.004385
2017-09-05T15:09:52
2017-09-05T15:09:52
102,495,225
0
0
null
null
null
null
UTF-8
Java
false
false
222
java
public class Fruits { private FruitsFruits[] fruits; public FruitsFruits[] getFruits() { return this.fruits; } public void setFruits(FruitsFruits[] fruits) { this.fruits = fruits; } }
[ "parag.kadam@indiacom.com" ]
parag.kadam@indiacom.com
9cdc03c12fb131f03c2785b3c6f928b746044971
1bd7dabd9fea041f1a50fb9714963fcbbe964eb4
/test/src/test/java/rewards/RewardNetworkTests.java
478ad02ae045f5f27b78370f2dbb8b47ff201a15
[]
no_license
timrijckaert/Spring-Course-Oak3
78eb64c20d2e8a108d894ed7d51e28c9bef0a194
8dff06efded23e656024180020543771a8e860b6
refs/heads/master
2021-01-12T10:05:42.453720
2016-12-18T14:44:31
2016-12-18T14:44:31
76,357,837
0
2
null
null
null
null
UTF-8
Java
false
false
5,890
java
package rewards; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import common.money.MonetaryAmount; import config.RewardsConfig; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; /** * A system test that verifies the components of the RewardNetwork application * work together to reward for dining successfully. Uses Spring to bootstrap the * application for use in a test environment. */ /* TODO 01: Remove setUp() and tearDown() methods and use annotations instead * such as @ContextConfiguration and @RunWith * - Remove the attribute 'context' which is not needed anymore. * - Use @Autowire to populate the rewardNetwork instance. * - Re-run the current test, it should pass. */ /* TODO 02: In the package rewards/internal, annotate all 'Stub*Repository' classes * with the @Repository annotation (WITHOUT specifying any profile yet). * - Rerun the current test, it should fail. Why? */ //We now have an ambiguity with two classes implementing the interface. Spring is unable to //decide which concrete class to AutoWire into the test /* TODO 03: Using the @Profile annotation, assign the 'jdbc' profile to all Jdbc*Repository classes * (such as JdbcAccountRepository). (Be sure to annotate the actual repository classes in * src/main/java, not the test classes in src/main/test!) * - In the same way, assign the 'stub' profile to all Stub*Repository classes * (such as StubAccountRepository) * - Add @ActiveProfiles to this test class (below) and specify the "stub" profile. * - Run the current test, it should pass. * Examine the logs, they should indicate "stub" repositories were used. */ /* TODO 04: Change active-profile to "jdbc". Rerun the test, it should pass. * Which repository implementations are being used now? */ // The concrete classes used in the main package /* TODO 05: Go to corresponding step in TestInfrastructureDevConfig. */ /* TODO 06: Now that the bean 'dataSource' is specific to the jdbc-dev profile, should we expect * this test to be successful? //no because our current active profile is different from where our datasource is defined * Make the appropriate changes so the current test uses 2 profiles ('jdbc' and 'jdbc-dev'). * Rerun the test, it should pass. */ /* TODO 07: Open TestInfrastructureProductionConfig and note the different datasource that will be * used if the profile = 'jdbc-production'. * Now update the current test so it uses profiles 'jdbc' and 'jdbc-production'. * Rerun the test, it should pass. */ /* TODO 08: Bonus question: see the 'Optional Step' inside the Detailed Instructions. */ @RunWith(SpringJUnit4ClassRunner.class) @ActiveProfiles({"jdbc", "jdbc-dev"}) public class RewardNetworkTests { /** * The object being tested. */ @Autowired private RewardNetwork rewardNetwork; /** * Need this to enable clean shutdown at the end of the application */ private ConfigurableApplicationContext context; // @Before // public void setUp() { // // Create the test configuration for the application from one file // context = SpringApplication.run(TestInfrastructureConfig.class); // // Get the bean to use to invoke the application // rewardNetwork = context.getBean(RewardNetwork.class); // } // @After // public void tearDown() throws Exception { // // simulate the Spring bean destruction lifecycle: // if (context != null) // context.close(); // } @Test public void testRewardForDining() { // create a new dining of 100.00 charged to credit card // '1234123412341234' by merchant '123457890' as test input Dining dining = Dining.createDining("100.00", "1234123412341234", "1234567890"); // call the 'rewardNetwork' to test its rewardAccountFor(Dining) method RewardConfirmation confirmation = rewardNetwork .rewardAccountFor(dining); // assert the expected reward confirmation results assertNotNull(confirmation); assertNotNull(confirmation.getConfirmationNumber()); // assert an account contribution was made AccountContribution contribution = confirmation .getAccountContribution(); assertNotNull(contribution); // the contribution account number should be '123456789' assertEquals("123456789", contribution.getAccountNumber()); // the total contribution amount should be 8.00 (8% of 100.00) assertEquals(MonetaryAmount.valueOf("8.00"), contribution.getAmount()); // the total contribution amount should have been split into 2 // distributions assertEquals(2, contribution.getDistributions().size()); // each distribution should be 4.00 (as both have a 50% allocation) assertEquals(MonetaryAmount.valueOf("4.00"), contribution .getDistribution("Annabelle").getAmount()); assertEquals(MonetaryAmount.valueOf("4.00"), contribution .getDistribution("Corgan").getAmount()); } @Configuration @Import({ TestInfrastructureDevConfig.class, TestInfrastructureProductionConfig.class, RewardsConfig.class }) static class TestInfrastructureConfig { public LoggingBeanPostProcessor loggingBean() { return new LoggingBeanPostProcessor(); } } }
[ "tim.rijckaert@vrt.be" ]
tim.rijckaert@vrt.be
81f66aa9672619786cd4233b57858a40b961c5bb
c3a56dcdc4b7c49eb62a54170d28d53c8ffa21ab
/web/src/main/java/com/zpy/controller/MainHandler.java
26ceec490a75aaefc949fefd487791d51b5e70d3
[]
no_license
zpy007/practise
3611ea14c58964f70b9f37377d167aca9b705a0b
5db91cd6e230898f1f8d231f593475839e4660a1
refs/heads/master
2022-06-10T00:22:11.473685
2018-09-02T14:19:50
2018-09-02T14:19:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package com.zpy.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @Controller public class MainHandler { @GetMapping("/hi/hello") public String Direct(){ return "hello"; } }
[ "zpy2358@gmail.com" ]
zpy2358@gmail.com
940bd5887b65b35be867671b00871dffb0cd8133
e047870136e1958ce80dad88fa931304ada49a1b
/eu.cessar.ct.testutils/src/eu/cessar/ct/testutils/EDimension.java
1085ac51a700cd38768b4404640cdf89ea1d7591
[]
no_license
ONagaty/SEA-ModellAR
f4994a628459a20b9be7af95d41d5e0ff8a21f77
a0f6bdbb072503ea584d72f872f29a20ea98ade5
refs/heads/main
2023-06-04T07:07:02.900503
2021-06-19T20:54:47
2021-06-19T20:54:47
376,735,297
0
0
null
null
null
null
UTF-8
Java
false
false
972
java
package eu.cessar.ct.testutils; public enum EDimension { SystemTime (2), UsedJavaHeap (3), WorkingSet (4), Committed (7), WorkingSetPeak (8), ElapsedProcess (9), UserTime (10), KernelTime (11), PageFaults (19), CPUTime (20), CommitLimit (22), CommitPeak (23), PhysicalMemory (24), PhysicalAvailable (25), SystemCache (26), KernelTotal (27), KernelPaged (28), KernelNonpaged (29), PageSize (30), HandleCount (31), ProcessCount (32), ThreadCount (33), GDIObjects (34), USERObjects (35), OpenHandles (36), CommitTotal (37), ReadCount (38), WriteCount (39), BytesRead (40), BytesWritten (41), HardPageFaults (42), SoftPageFaults (43), TextSize (44), DataSize (45), LibrarySize (46), UsedMemory (48), FreeMemory (49), BuffersMemory (50), FreeJavaMemory (51), InvocationCount (52), ; private int dimension; EDimension(int dim) { dimension = dim; } public int getCode() { return(dimension); } }
[ "onagaty@a5sol.com" ]
onagaty@a5sol.com
2e7cd3be9a01174e5a7163178f45424744547570
1e8c9bf25784783f6f08a27e45604c991c7aa04f
/nonnull-interned-demo/checkers/src/checkers/types/InternalAnnotation.java
b7ba8eecd276b509e5f2ba4e060314ad431bc2fb
[]
no_license
smillst/checker-framework.demos
33eb60ff1830308090cbb5e7eeec635e90d5efe7
0b5c8ec67d4e26c8f4c86bc94acbbb2f4fe447ab
refs/heads/master
2020-05-14T19:00:13.255267
2019-02-22T18:00:40
2019-02-22T18:00:40
61,395,576
0
0
null
2016-06-17T18:51:48
2016-06-17T18:51:48
null
UTF-8
Java
false
false
8,541
java
package checkers.types; import java.lang.annotation.Annotation; import java.util.*; import javax.annotation.processing.*; import javax.lang.model.element.*; import javax.lang.model.type.*; import javax.lang.model.util.*; import com.sun.source.tree.Tree; import com.sun.tools.javac.code.Attribute; import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.comp.*; /** * Represents an annotation along with its annotation target (its * {@link AnnotationTarget}), which cannot (publicly) be obtained from an * {@link AnnotationMirror}. Some methods in this class depend on non-public * APIs. * * @see AnnotationTarget */ @DefaultQualifier(NonNull.class) public final class InternalAnnotation implements AnnotationData { /** The annotation's Target. */ private final @Nullable AnnotationTarget target; /** The annotation's location. */ private final AnnotationLocation location; /** The {@link AnnotationMirror} for the annotation. */ private final AnnotationMirror mirror; /** The annotation's class. */ private final Class<? extends Annotation> annotation; /** Elements utilities, for getting annotation arguments with defaults. */ private final Elements elements; /** Types utilities, for comparing types. */ private final Types types; /** * Creates an annotation from the given {@link AnnotationMirror}[ * * @param mirror the annotation, as represented by the compiler * @param env the processing environment */ InternalAnnotation(AnnotationMirror mirror, ProcessingEnvironment env) { this.mirror = mirror; // Get the class from the mirror. try { this.annotation = (Class<@NonNull Annotation>) Class.forName( mirror.getAnnotationType().toString()); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("invalid annotation class: " + e.getMessage()); } // Get the target from the mirror. if (mirror instanceof Attribute.Compound) { Attribute.Compound attr = (Attribute.Compound)mirror; this.target = null; } else this.target = null; // Get the location from the target. if (target != null && target.type.hasLocation() && target.location != null) { /*nninvariant*/ assert target != null; // FIXME: flow workaround this.location = AnnotationLocation.fromArray(target.location); } else this.location = AnnotationLocation.RAW; this.elements = env.getElementUtils(); this.types = env.getTypeUtils(); } /** * Determines whether or not the annotation is an extended annotation. * * @return true if the represented annotation is an extended annotation, * false otherwise */ public boolean isExtended() { return this.target != null && this.target.type != TargetType.UNKNOWN; } /** * @return the target for this extended annotation */ public @Nullable AnnotationTarget getTarget() { return this.target; } /** * Determines whether or not the annotation is on a raw type. * * @return true if the annotation is on a raw type, false if it's on a * type argument (generic or array) */ public boolean isRaw() { assert this.location == AnnotationLocation.RAW; if (this.target == null) /*nnbug*/ return true; return !this.target.type.hasLocation(); } /** * @return the location of the annotation */ public AnnotationLocation getLocation() { return this.location; } /** * @return the extended annotation's class */ public Class<? extends Annotation> getAnnotationClass() { return this.annotation; } /** * @return the annotation's type */ public TypeMirror getType() { return this.mirror.getAnnotationType(); } /** * @see AnnotationMirror#getElementValues() * @return the values of the annotation's arguments (with defaults) */ public Map<? extends ExecutableElement, ? extends @Nullable AnnotationValue> getValues() { return elements.getElementValuesWithDefaults(mirror); // FIXME: checker bug (wildcards) } /** * Creates a list of the annotations from the given element; annotations * that were manually added are not included. * * @param element * the {@link Element} to get annotations from * @param env the current processing environment * * @return the element's annotations as {@link InternalAnnotation}s */ static List<InternalAnnotation> fromElement(Element element, ProcessingEnvironment env) { List<InternalAnnotation> annotations = new LinkedList<InternalAnnotation>(); if (element == null) return annotations; if (!(element instanceof Symbol)) throw new RuntimeException("element not a symbol"); Symbol s = (Symbol) element; for (AnnotationMirror a : s.getAnnotationMirrors()) { InternalAnnotation ia = new InternalAnnotation(a, env); @Nullable AnnotationTarget target = ia.getTarget(); // TODO: verify for other target types if (target != null && target.type == TargetType.FIELD_GENERIC_OR_ARRAY && element.getKind() == ElementKind.CLASS) continue; annotations.add(ia); } return annotations; } /** * Creates a list of the annotations in the * given {@link Element} that reference the given {@link Tree}. Useful for * annotations that are located in the body of the enclosing method. * * @param e * the source of the annotations * @param tree * the {@link Tree} that the annotations in {@code e} belong to * @param env the current processing environment * * @return the annotations on {@code e} that refer to {@code tree} */ static List<InternalAnnotation> fromElement(Element e, Tree tree, ProcessingEnvironment env) { List<InternalAnnotation> methodAnnos = fromElement(e, env); List<InternalAnnotation> thisAnnos = new LinkedList<InternalAnnotation>(); for (InternalAnnotation a : methodAnnos) { @Nullable AnnotationTarget target = a.getTarget(); if (target == null || (target != null && target.ref == null)) // FIXME: flow workaround continue; assert target != null; // FIXME: flow workaround if (InternalUtils.refersTo(target.ref, tree)) thisAnnos.add(a); } return thisAnnos; } /** * For each method parameter in the given element, gathers the annotations * on that parameter into a list and returns these lists. * * @param element * the (symbol of the) method from which parameter annotations * will be extracted * @param env the current processing environment * @return a list of the lists of the {@InternalAnnotation}s for each * parameter in the method given by {@code element} */ public static List<List<InternalAnnotation>> forMethodParameters( Element element, ProcessingEnvironment env) { List<List<InternalAnnotation>> annotations = new LinkedList<List<InternalAnnotation>>(); if (element instanceof MethodSymbol) for (VarSymbol vs : ((MethodSymbol) element).params()) annotations.add(fromElement(vs, env)); return annotations; } @Override public boolean equals(@Nullable Object o) { if (o instanceof AnnotationData) { AnnotationData s = (AnnotationData)o; return types.isSameType(getType(), s.getType()) && getLocation().equals(s.getLocation()) && getValues().equals(s.getValues()); } return false; } @Override public int hashCode() { return 17 * getType().toString().hashCode() + 19 * getLocation().hashCode() + 31 * getValues().hashCode(); } @Override public String toString() { return String.format("[%s@%s %s]", this.getType(), this.getLocation(), this.getValues()); } }
[ "mernst@cs.washington.edu" ]
mernst@cs.washington.edu
c2f4f5b504e111a798f6a6a8a57f7044c200600e
36ae4f75d9ca0870883d93442adcd996df66eca8
/gmall-mbg/src/main/java/com/atguigu/gmall/cms/mapper/PrefrenceAreaProductRelationMapper.java
55216014b755f043dbe4b4a6aa63142aa1c12053
[]
no_license
halolzh/gmall
1e4db51e6ccbbcbdc5f94ad103ab09514fb8f5f3
f3df84c83bc1137905e083db6830bef182faf3b3
refs/heads/master
2022-07-14T18:27:08.780743
2020-04-04T16:19:26
2020-04-04T16:19:26
252,811,854
0
0
null
2022-06-21T03:08:20
2020-04-03T18:39:26
Java
UTF-8
Java
false
false
378
java
package com.atguigu.gmall.cms.mapper; import com.atguigu.gmall.cms.entity.PrefrenceAreaProductRelation; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> * 优选专区和产品关系表 Mapper 接口 * </p> * * @author Lzh * @since 2020-04-04 */ public interface PrefrenceAreaProductRelationMapper extends BaseMapper<PrefrenceAreaProductRelation> { }
[ "koyy821@qq.com" ]
koyy821@qq.com
a7f14780a3bf745c3d30361b07cb82e15bc651c8
3688dd0efe93fc37e5b9ced422f76b6c2c9b3fa1
/src/main/java/jds/ArrayDeque.java
e81def0815137d8c12c49271f7df1cf7dfbe2e1c
[ "MIT" ]
permissive
evrenkaya/data-structures-java
7a0de0147189e88f63a0ae8a5e79115f9a60e1be
d83746d99bb8611f86c31416c3fad30e419b84e1
refs/heads/master
2021-01-10T12:09:18.470078
2015-12-27T23:23:29
2015-12-27T23:23:29
48,589,377
0
0
null
null
null
null
UTF-8
Java
false
false
2,815
java
package jds; import java.util.AbstractList; public class ArrayDeque<T> extends AbstractList<T> { // Instance of helper class for creating new generic arrays protected Factory<T> factory; // Backing array protected T[] backingArray; // Head index of the Deque in the backing array protected int headIndex; // Size of the Deque (i.e. # of elements) protected int n; public ArrayDeque(Class<T> t) { factory = new Factory<T>(t); backingArray = factory.newArray(16); headIndex = n = 0; } public T get(int i) { if (i < 0 || i >= n) { throw new IndexOutOfBoundsException(); } return backingArray[circularIndex(i)]; } public T set(int i, T x) { T removed = get(i); backingArray[circularIndex(i)] = x; return removed; } public void add(int i, T x) { if (i < 0 || i > n) { throw new IndexOutOfBoundsException(); } if (n + 1 > backingArray.length) { resize(); } if (i < n/2) { // Shift first half of elements left one position // We need to change headIndex here headIndex = (headIndex == 0) ? backingArray.length - 1 : headIndex - 1; for (int k = 0; k <= i-1; k++) { backingArray[circularIndex(k)] = backingArray[circularIndex(k + 1)]; } } else { // Shift second half of elements right one position // We don't need to change headIndex here for (int k = n; k > i; k--) { backingArray[circularIndex(k)] = backingArray[circularIndex(k - 1)]; } } backingArray[circularIndex(i)] = x; n++; } public T remove(int i) { if (i < 0 || i >= n) { throw new IndexOutOfBoundsException(); } T x = get(i); if (i < n/2) { // Shift first half of elements right one position for (int k = i; k > 0; k--) { backingArray[circularIndex(k)] = backingArray[circularIndex(k - 1)]; } // We need to increase headIndex by one here headIndex = circularIndex(1); } else { // Shift second half of elements left one position // We don't need to change headIndex here for (int k = i; k < n-1; k++) { backingArray[circularIndex(k)] = backingArray[circularIndex(k + 1)]; } } n--; if (3 * n < backingArray.length) { resize(); } return x; } public void clear() { n = 0; resize(); } public int size() { return n; } // Returns headIndex + i wrapped around the backing array // So that we don't ever go out of the array's bounds protected int circularIndex(int i) { return (headIndex + i) % backingArray.length; } protected void resize() { // Create new array and copy everything over T[] newArray = factory.newArray(Math.max(2 * n, 1)); for (int k = 0; k < n; k++) { newArray[k] = backingArray[circularIndex(k)]; } // Now set this to point to the new resized array backingArray = newArray; headIndex = 0; } }
[ "evrenk29@gmail.com" ]
evrenk29@gmail.com
26f13024c219ff98de50bed8a93a649ccc803df1
bf9aa2a5e86eb247d2b25a640dae53ff193cb1ad
/app/src/main/java/com/example/bloodbankapp/data/model/donationRequestNotifications/DataNotifications.java
6e45f92942ecee869fc2705917367d744ddb2a15
[]
no_license
MohamedEldahma/BloodBankApp
df40d77ae6671fe75d87b955d18189a531f3e268
686d853aa8c00c05a4512a4094c054abb19b769b
refs/heads/master
2020-08-13T04:51:08.233548
2019-10-19T19:46:59
2019-10-19T19:46:59
214,909,680
0
0
null
null
null
null
UTF-8
Java
false
false
4,832
java
package com.example.bloodbankapp.data.model.donationRequestNotifications; import com.example.bloodbankapp.data.model.ClientModel; import com.example.bloodbankapp.data.model.donationRequests.BloodType; import com.example.bloodbankapp.data.model.donationRequests.CityModel; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class DataNotifications { @SerializedName("id") @Expose private Integer id; @SerializedName("created_at") @Expose private String createdAt; @SerializedName("updated_at") @Expose private String updatedAt; @SerializedName("client_id") @Expose private String clientId; @SerializedName("patient_name") @Expose private String patientName; @SerializedName("patient_age") @Expose private String patientAge; @SerializedName("blood_type_id") @Expose private String bloodTypeId; @SerializedName("bags_num") @Expose private String bagsNum; @SerializedName("hospital_name") @Expose private String hospitalName; @SerializedName("hospital_address") @Expose private String hospitalAddress; @SerializedName("city_id") @Expose private String cityId; @SerializedName("phone") @Expose private String phone; @SerializedName("notes") @Expose private String notes; @SerializedName("latitude") @Expose private String latitude; @SerializedName("longitude") @Expose private String longitude; @SerializedName("city") @Expose private CityModel city; @SerializedName("client") @Expose private ClientModel client; @SerializedName("blood_type") @Expose private BloodType bloodType; @SerializedName("notification") @Expose private Notification notification; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getCreatedAt() { return createdAt; } public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } public String getUpdatedAt() { return updatedAt; } public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } public String getPatientName() { return patientName; } public void setPatientName(String patientName) { this.patientName = patientName; } public String getPatientAge() { return patientAge; } public void setPatientAge(String patientAge) { this.patientAge = patientAge; } public String getBloodTypeId() { return bloodTypeId; } public void setBloodTypeId(String bloodTypeId) { this.bloodTypeId = bloodTypeId; } public String getBagsNum() { return bagsNum; } public void setBagsNum(String bagsNum) { this.bagsNum = bagsNum; } public String getHospitalName() { return hospitalName; } public void setHospitalName(String hospitalName) { this.hospitalName = hospitalName; } public String getHospitalAddress() { return hospitalAddress; } public void setHospitalAddress(String hospitalAddress) { this.hospitalAddress = hospitalAddress; } public String getCityId() { return cityId; } public void setCityId(String cityId) { this.cityId = cityId; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getNotes() { return notes; } public void setNotes(String notes) { this.notes = notes; } public String getLatitude() { return latitude; } public void setLatitude(String latitude) { this.latitude = latitude; } public String getLongitude() { return longitude; } public void setLongitude(String longitude) { this.longitude = longitude; } public CityModel getCity() { return city; } public void setCity(CityModel city) { this.city = city; } public ClientModel getClient() { return client; } public void setClient(ClientModel client) { this.client = client; } public BloodType getBloodType() { return bloodType; } public void setBloodType(BloodType bloodType) { this.bloodType = bloodType; } public Notification getNotification() { return notification; } public void setNotification(Notification notification) { this.notification = notification; } }
[ "43705348+MohamedEldahma@users.noreply.github.com" ]
43705348+MohamedEldahma@users.noreply.github.com
0e09f9e057445e344769bac1f1e9b244973d406b
622e8401cd7dab77ac75f72715aec11466f123a1
/src/com/hk/upload/UploadServlet2.java
f770ab7dd0970d6345f94e10a41487d6d4c6e00a
[]
no_license
byytcat/progress
3a4ec5f1def984f26ab71c086e3bd45238435ba4
de8999cd2b18a94ef1a0f8e211f8a9ae0ac224ea
refs/heads/master
2021-01-19T17:03:14.077582
2017-08-22T08:37:19
2017-08-22T08:37:19
101,040,734
0
0
null
null
null
null
UTF-8
Java
false
false
1,729
java
package com.hk.upload; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; public class UploadServlet2 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload( diskFileItemFactory); List<FileItem> items = upload.parseRequest(request); for (FileItem fileItem : items) { if (fileItem.isFormField()) { String inputName = fileItem.getFieldName(); String inputValue = fileItem.getString(); System.out.println(inputName + "=" + inputValue); } else { String filename = fileItem.getName().substring( fileItem.getName().lastIndexOf("\\") + 1); InputStream in = fileItem.getInputStream(); int len = 0; byte buffer[] = new byte[1024]; FileOutputStream out = new FileOutputStream("f:\\" + filename); while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } in.close(); out.close(); } } } catch (Exception e) { e.printStackTrace(); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
[ "byytcat@163.com" ]
byytcat@163.com
ff734d03bd2b6d36771a8753d7f7a790696e9eb7
e06a1542945ebe2a04be85fcd0e830062852af73
/internal/temp/com/e9/framework/dao/util/Statements.java
2e905675e169b765263391cab69a0d7dc8bf097f
[]
no_license
jason167/test
e92a09ebfcac6cf0aac9f4aff5dbe944293adcd0
07ce801268af087e02539acb516c1785c4ebb709
refs/heads/master
2016-09-06T20:09:09.271238
2013-12-22T12:28:39
2013-12-22T12:28:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
253
java
package com.e9.framework.dao.util; /** * 用于存放sql statement 常量 * @project OSP * @date 2013-2-21 * @version 1.0 * @author Jason * * @review_history * [2013-2-21] create by Jason */ public interface Statements { }
[ "jason5186@qq.com" ]
jason5186@qq.com
8fa34cf3b34942672767aa858cc55a163d19c574
8990ba0b8192c7c83dac295b28f113b98d034cff
/sh-radiance-seata/sh-radiance-seata-a/src/main/java/com/radiance/seata/a/bean/vo/SingleTransactionalVO.java
ecb7a8a8d9d4cfb1a9b1a7b9400e7fd934ba1798
[]
no_license
sunhao1224/study
f66274dfb610eaeaa0d2a90d1af44a862a57be46
fa622e2d726ed69e6b8fd7d53c900047dbc56937
refs/heads/main
2023-03-12T09:31:57.474800
2021-03-03T14:45:09
2021-03-03T14:45:09
321,211,385
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.radiance.seata.a.bean.vo; import com.radiance.seata.a.bean.dao.StaffDAO; import lombok.Data; import java.util.List; /** * @author sunhao * @date 2021/1/19 17:02 * @Description: */ @Data public class SingleTransactionalVO { private List<StaffDAO> insert; private List<StaffDAO> update; private List<StaffDAO> delete; }
[ "707085383@qq.com" ]
707085383@qq.com
a1aef8e330106f541200676443fd994b9adaf990
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithLambdasApi21/applicationModule/src/main/java/applicationModulepackageJava3/Foo246.java
2592c0e904085425c84b28ad8b1911e543c49f97
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package applicationModulepackageJava3; public class Foo246 { public void foo0() { final Runnable anything0 = () -> System.out.println("anything"); new applicationModulepackageJava3.Foo245().foo9(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } public void foo6() { foo5(); } public void foo7() { foo6(); } public void foo8() { foo7(); } public void foo9() { foo8(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
b85f54e6f516537a3f4036caf9792cc18b784b0e
6d60a8adbfdc498a28f3e3fef70366581aa0c5fd
/codebase/dataset/t1/1933_frag1.java
586e82c9a1d0d57cf33b7b3eb5eaa28dc23fb9c8
[]
no_license
rayhan-ferdous/code2vec
14268adaf9022d140a47a88129634398cd23cf8f
c8ca68a7a1053d0d09087b14d4c79a189ac0cf00
refs/heads/master
2022-03-09T08:40:18.035781
2022-02-27T23:57:44
2022-02-27T23:57:44
140,347,552
0
1
null
null
null
null
UTF-8
Java
false
false
372
java
username = ""; password = ""; JOptionPane.showMessageDialog(NeembuuUploader.getInstance(), "<html><b>" + HOSTNAME + "</b> " + TranslationProvider.get("neembuuuploader.accounts.loginerror") + "</html>", HOSTNAME, JOptionPane.WARNING_MESSAGE); AccountsManager.getInstance().setVisible(true); }
[ "aaponcseku@gmail.com" ]
aaponcseku@gmail.com
749468950482f101b2dd370088e5aac24bb62294
f129abc9063d9bb83d50d41bfdc42dd0d056c374
/document-store/src/main/java/org/hypertrace/core/documentstore/Document.java
944913aaca2422c5324b33a7d92e50525ad66587
[ "Apache-2.0" ]
permissive
aaron-steinfeld/document-store
10939072f09a559ba271853a93bed4741fb941a5
081cf1b5f9433e22d1a8736d01e1cc85dd663109
refs/heads/main
2023-04-15T16:21:38.128988
2021-04-05T05:08:21
2021-04-05T05:08:21
355,240,186
0
0
Apache-2.0
2021-04-29T19:56:30
2021-04-06T15:31:17
null
UTF-8
Java
false
false
94
java
package org.hypertrace.core.documentstore; public interface Document { String toJson(); }
[ "tim@traceable.ai" ]
tim@traceable.ai
95d7b5842d317b2ad70844a56557382df985ab87
757e2db4a6c944a8a00e4dbe52b3291ddeed3edf
/MES-Server/src/main/java/com/mes/control/jobs/.svn/text-base/ServiceInvocationMonthlyStatJob.java.svn-base
11e46360427a91c3af30d3d4d02789d0f34c5696
[]
no_license
guodingming/IOV-MES
b1fae2bccbfc50760ca411388990602655c04f01
d40da7d323a4335df51c7a011fe5c0fe3c116ed1
refs/heads/master
2021-07-13T14:44:01.540957
2017-10-18T15:32:16
2017-10-18T15:32:16
107,984,144
1
4
null
2017-10-23T13:13:20
2017-10-23T13:13:20
null
UTF-8
Java
false
false
7,157
package com.mes.control.jobs; import com.google.common.collect.Maps; import com.mes.common.framework.Exception.DubboProviderException; import com.mes.common.framework.spring.ServiceBeanContext; import com.mes.control.utils.LogUtil; import com.mes.dubbo.interprovider.control.IDpServiceMonitorProvider; import com.mes.dubbo.interprovider.control.IDpServiceProvider; import com.mes.entity.control.DpService; import com.mes.entity.control.DpServiceMonitor; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; /** * 统计当月服务调用情况 * <p> * Created by xiuyou.xu on 2017/8/21. */ public class ServiceInvocationMonthlyStatJob implements Job { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { // 获取当月开始时刻 Calendar start = Calendar.getInstance(); start.set(Calendar.DATE, 1); start.set(Calendar.HOUR_OF_DAY, 0); start.set(Calendar.MINUTE, 0); start.set(Calendar.SECOND, 0); start.set(Calendar.MILLISECOND, 0); Calendar end = Calendar.getInstance(); try { IDpServiceProvider dpServiceProvider = (IDpServiceProvider) ServiceBeanContext.getInstance().getBean("dpServiceProvider"); List<DpService> services = dpServiceProvider.findAll(); if (services != null && !services.isEmpty()) { IDpServiceMonitorProvider dpServiceMonitorProvider = (IDpServiceMonitorProvider) ServiceBeanContext.getInstance().getBean("dpServiceMonitorProvider"); services.forEach(service -> { Map<String, Object> params = Maps.newHashMap(); params.put("serviceId", service.getId()); params.put("periodStart", start.getTime()); params.put("periodType", "m"); try { List<DpServiceMonitor> monitors = dpServiceMonitorProvider.findByMap(params); if (monitors == null || monitors.isEmpty()) { // 更新前一月的 start.add(Calendar.MONTH, -1); Date lastStart = start.getTime(); start.add(Calendar.MONTH, 1); Date lastEnd = start.getTime(); long lastSuccess = LogUtil.queryServiceInvocationStat(service.getCode(), lastStart, lastEnd, "success"); Map<String, Object> map = Maps.newHashMap(); map.put("serviceId", service.getId()); map.put("periodStart", lastStart); map.put("periodType", "m"); map.put("status", 1); List<DpServiceMonitor> lastSuccesses = dpServiceMonitorProvider.findByMap(map); if (lastSuccesses != null && !lastSuccesses.isEmpty()) { DpServiceMonitor lastSuccessMonitor = lastSuccesses.get(0); lastSuccessMonitor.setCount(lastSuccess); dpServiceMonitorProvider.update(lastSuccessMonitor); } long lastFail = LogUtil.queryServiceInvocationStat(service.getCode(), lastStart, lastEnd, "fail"); map.put("status", 0); List<DpServiceMonitor> lastFails = dpServiceMonitorProvider.findByMap(map); if (lastFails != null && !lastFails.isEmpty()) { DpServiceMonitor lastFailMonitor = lastFails.get(0); lastFailMonitor.setCount(lastFail); dpServiceMonitorProvider.update(lastFailMonitor); } // 保存当月的 long success = LogUtil.queryServiceInvocationStat(service.getCode(), start.getTime(), end.getTime(), "success"); DpServiceMonitor successMonitor = new DpServiceMonitor(); successMonitor.setCount(success); successMonitor.setServiceId(service.getId()); successMonitor.setPeriodStart(start.getTime()); successMonitor.setPeriodType("m"); successMonitor.setStatus(1); dpServiceMonitorProvider.save(successMonitor); long fail = LogUtil.queryServiceInvocationStat(service.getCode(), start.getTime(), end.getTime(), "fail"); DpServiceMonitor failMonitor = new DpServiceMonitor(); failMonitor.setCount(fail); failMonitor.setServiceId(service.getId()); failMonitor.setPeriodStart(start.getTime()); failMonitor.setPeriodType("m"); failMonitor.setStatus(0); dpServiceMonitorProvider.save(failMonitor); } else { // 更新当月的 long success = LogUtil.queryServiceInvocationStat(service.getCode(), start.getTime(), end.getTime(), "success"); Map<String, Object> map = Maps.newHashMap(); map.put("serviceId", service.getId()); map.put("periodStart", start.getTime()); map.put("periodType", "m"); map.put("status", 1); List<DpServiceMonitor> successes = dpServiceMonitorProvider.findByMap(map); if (successes != null && !successes.isEmpty()) { DpServiceMonitor successMonitor = successes.get(0); successMonitor.setCount(success); dpServiceMonitorProvider.update(successMonitor); } long fail = LogUtil.queryServiceInvocationStat(service.getCode(), start.getTime(), end.getTime(), "fail"); map.put("status", 0); List<DpServiceMonitor> fails = dpServiceMonitorProvider.findByMap(map); if (fails != null && !fails.isEmpty()) { DpServiceMonitor failMonitor = fails.get(0); failMonitor.setCount(fail); dpServiceMonitorProvider.update(failMonitor); } } } catch (DubboProviderException e) { e.printStackTrace(); } }); } } catch (DubboProviderException e) { e.printStackTrace(); } } }
[ "ledengyun@github.com" ]
ledengyun@github.com
ccc4f0993fb8c1bb7115b6ed2dc4ccf2d1633273
a0a74844ced88872974a52fbced64f3c88206795
/APComputer/src/com/xiongfamily/emily/apcomp/HeapPriorityQueue.java
1fa84a9910f355b29c35861322c8735b1d369895
[]
no_license
EmilyXiong/APComputer
f7bf4057c1058b4166ae1ed4cf1d69f3a2bab087
4cdb5f5ba46ba8fb106e8c007dbb90fc8e358e0d
refs/heads/master
2021-04-30T10:26:02.096294
2018-02-13T03:28:14
2018-02-13T03:28:14
121,333,168
0
0
null
null
null
null
UTF-8
Java
false
false
3,005
java
package com.xiongfamily.emily.apcomp; //Name:Emily Xiong Date:5/5/17 //implement the API for java.util.PriorityQueue //test this class by using it in McRonaldPQ_working.java. //add(E) and remove() must work in O(log n) time import java.util.*; public class HeapPriorityQueue<E extends Comparable<E>> { private ArrayList<E> myHeap; private int heapSize; public static void main(String[] args) { //Part 1: Given a heap, sort it. Do this part first. HeapPriorityQueue<Integer> q = new HeapPriorityQueue<Integer>(); for ( int i = 0; i<=12; i++){ int temp = (int)(Math.random()*100) + 1; q.add(temp); System.out.println("" + temp + "*** " + q.toString()); } System.out.println("\n\n starting removing items"); for ( int i = 0; i<=12; i++){ System.out.println(q.remove().toString() + "*** " + q.toString()); } } public HeapPriorityQueue() { myHeap = new ArrayList<E>(); myHeap.add(null); heapSize = 0; } public void add(E obj) { myHeap.add(obj); heapSize++; heapUp(heapSize, heapSize); } public E remove() { E removed = null; if(heapSize > 0){ if(heapSize == 1){ removed = myHeap.remove(heapSize); } else{ removed = myHeap.get(1); myHeap.set(1, myHeap.remove(heapSize)); } heapSize--; reheap(); } return removed; } public void heapUp(int k, int size) { int parentindex = k/2; if(parentindex == 0) { return; } if(myHeap.get(k).compareTo(myHeap.get(parentindex)) < 0) { swap(k, parentindex); heapUp(parentindex, size); } } public void heapDown(int k, int size) { int maxChild = 2*k; if(2*k > size) { return; } else if((2*k + 1) <= size) { if(myHeap.get(2*k).compareTo(myHeap.get(2*k + 1)) < 0) { maxChild = 2*k; } else { maxChild = 2*k+1; } } if(myHeap.get(k).compareTo(myHeap.get(maxChild)) > 0) { swap(k, maxChild); heapDown(maxChild, size); } } public void reheap(){ for(int i=heapSize/2; i>0; i--){ heapDown(i, heapSize); } } public void swap(int a, int b) { E temp = myHeap.get(a); myHeap.set(a, myHeap.get(b)); myHeap.set(b, temp); } public ArrayList<E> getMyHeap() { return myHeap; } public void setMyHeap(ArrayList<E> myHeap) { this.myHeap = myHeap; } public String toString() { String retString = ""; for (int k = 1; k <= heapSize; k++) retString = retString + " " + myHeap.get(k).toString(); return retString; } public boolean isEmpty() { return heapSize == 0; } public E peek() { if (heapSize > 0) { return myHeap.get(1); } return null; } }
[ "xiongh@folioinvesting.com" ]
xiongh@folioinvesting.com
fea5192ea9ec23e402cd592ff8a29cd01d38254a
62805194d57f87735c5fb46b4bbad439113a8303
/src/main/java/me/titan/customcommands/cmd/CmdReload.java
a917280c0078273a1dfab64da45539ce245933db
[]
no_license
TitanDevX/CustomCommands
8567fa76906dc3c9b548e1fd269eb3045e2d9851
7caf70f4178d11b74f220d386d92cbb2d75bd8e5
refs/heads/master
2022-11-24T23:56:08.706946
2022-11-07T21:18:13
2022-11-07T21:18:13
275,794,694
6
1
null
null
null
null
UTF-8
Java
false
false
2,043
java
package me.titan.customcommands.cmd; import de.leonhard.storage.Yaml; import me.titan.customcommands.Permissions; import me.titan.customcommands.cmd.lib.CommandContext; import me.titan.customcommands.cmd.lib.TitanSubCommand; import me.titan.customcommands.core.CustomCommandsPlugin; import me.titan.customcommands.core.PluginUpdateManager; import me.titan.customcommands.log.Logger; public class CmdReload extends TitanSubCommand { CustomCommandsPlugin plugin; public Yaml defaults; public CmdReload(CustomCommandsPlugin plugin) { super("reload"); addAlias("rl"); setPermission(Permissions.CustomCommands_reload.perm); this.plugin = plugin; } @Override protected void onCommand(CommandContext con) { if (!plugin.getCommandsConfig().getFile().exists()) { plugin.saveResource(plugin.getCommandsConfig().getFile().getName(), false); } try { plugin.getCommandsConfig().forceReload(); } catch (Exception ex) { con.tell("&cYaml formatting issues in commands.yml. check console for more details."); return; } plugin.getCommandsConfig().init(); try { plugin.getMessagesConfig().forceReload(); } catch (Exception ex) { con.tell("&cYaml formatting issues in messages.yml. check console for more details."); return; } try { plugin.getConditionsConfig().forceReload(); } catch (Exception ex) { con.tell("&cYaml formatting issues in conditions.yml. check console for more details."); return; } plugin.getConditionsConfig().init(); plugin.getMessagesConfig().init(); PluginUpdateManager.init(CustomCommandsPlugin.getPlugin()); plugin.getUpdateManager().getVersion((vr) -> { if(!plugin.getUpdateManager().isUpToDate(vr)){ Logger.getInstance().logEmpty("----------------------------------", "You are running an outdated version of CustomCommands!", "Please update to " + vr + "!","----------------------------------" ); } }); con.tell("&6Successfully reloaded the plugin. and loaded " + plugin.getCommandsBoard().size() + " commands."); } }
[ "sdt199999@gmail.com" ]
sdt199999@gmail.com
a38ee77c04aa05495fcc99478a2db0c8530d5d57
9bce6a7311a34cbc7ad2df38fe2624f0e3281e78
/app/src/main/java/com/example/admin/akshatha/MainActivity.java
1fdf2a3100269ace565747bad5c98f04177b3be0
[]
no_license
AshRK1997/Basic-Math-Trainer
444f6f42a57e617529db97cca8a5078828f768e3
d033bf9ffc057bdeabdf0c856bb372b21be11557
refs/heads/master
2020-03-06T22:52:04.319523
2018-06-12T22:10:14
2018-06-12T22:10:56
127,116,211
0
0
null
null
null
null
UTF-8
Java
false
false
3,694
java
package com.example.admin.akshatha; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.nav_add) { Intent intent = new Intent(MainActivity.this,add.class); startActivity(intent); } else if (id == R.id.nav_multiply) { Intent intent = new Intent(MainActivity.this,multiply.class); startActivity(intent); } else if (id == R.id.nav_divide) { Intent intent = new Intent(MainActivity.this,divide.class); startActivity(intent); } else if (id == R.id.nav_sub) { Intent intent = new Intent(MainActivity.this,sub.class); startActivity(intent); } else if (id == R.id.nav_sqroot) { Intent intent = new Intent(MainActivity.this,sqroot.class); startActivity(intent); } else if (id == R.id.nav_cuberoot) { Intent intent = new Intent(MainActivity.this,cuberoot.class); startActivity(intent); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
[ "reachashrk@gmail.com" ]
reachashrk@gmail.com
43ac733867eb777a8eaa279ca262f545038dd34c
412a97c74ca8ff52330b137ecdcd4753ffb45d37
/src/domain/Goods.java
feb5aa69f40e051da9dd32541d26e967bda00d36
[]
no_license
believeacoustic/SpringMVC_Demo
bd5c348f5ec82c114f64ad3a647efa819492c65e
6e26dd6ca93550f8c5b90db975b8cb2016c12eef
refs/heads/master
2020-03-16T19:04:02.442740
2018-05-10T12:46:16
2018-05-10T12:46:16
132,899,256
0
0
null
null
null
null
UTF-8
Java
false
false
1,165
java
package domain; public class Goods { private String gid; private String gname; private double price; private String img; private String catory; public Goods() { } public String getGid() { return gid; } public void setGid(String gid) { this.gid = gid; } public String getGname() { return gname; } public void setGname(String gname) { this.gname = gname; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public String getImg() { return img; } public void setImg(String img) { this.img = img; } public String getCatory() { return catory; } public void setCatory(String catory) { this.catory = catory; } @Override public String toString() { return "Goods{" + "gid='" + gid + '\'' + ", gname='" + gname + '\'' + ", price=" + price + ", img='" + img + '\'' + ", catory='" + catory + '\'' + '}'; } }
[ "1594231948@qq.com" ]
1594231948@qq.com
a58827fca4cc02455f56af259aa33199ca563004
4a6d5997d0972847f2ad09228f92ee7ca92d4508
/src/java/cu/cenpis/gps/wic/data/dao/impl/EspecialidadDAOImpl.java
2525761db03d775bfff1e1bc65e489aadef08c1f
[]
no_license
farias85/web-image-control
982f25823ae98a9f082f21f787ea441778051c11
10ed56542a6645abfad0d35bdffb2fa0d682b581
refs/heads/master
2021-01-21T22:19:45.345929
2017-09-02T16:30:42
2017-09-02T16:30:42
102,150,106
0
0
null
null
null
null
UTF-8
Java
false
false
1,110
java
package cu.cenpis.gps.wic.data.dao.impl; import cu.cenpis.gps.wic.data.dao.EspecialidadDAO; import cu.cenpis.gps.wic.data.entity.Especialidad; import java.util.List; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.type.IntegerType; import org.hibernate.type.StringType; import org.springframework.stereotype.Repository; @Repository public class EspecialidadDAOImpl extends AbstractHibernateDAO<Especialidad, java.lang.Long> implements EspecialidadDAO { private static final long serialVersionUID = 1L; public EspecialidadDAOImpl() { super(Especialidad.class); System.out.println("EspecialidadDAOImpl"); } @Override public List<Object[]> findNames() { Session session = hibernateUtil.getSession(); String queryString = "SELECT e.nombre " + "FROM espacialidad e " + "ORDER BY e.nombre"; SQLQuery query = session.createSQLQuery(queryString). addScalar("e.nombre", new StringType()); List<Object[]> rows = query.list(); return rows; } }
[ "farias@uo.edu.cu" ]
farias@uo.edu.cu
8eadf17f8763c251a08a44a7777e05e803add56c
7885aa64d30fe5845d907d319e01f66a00215c45
/src/com/jcg/examples/delegate/DelegateSendMessage.java
9914ce2feb908139a9443b051037be0e9abc696c
[]
no_license
starkjarvis/OHD
036812588221f32cd819e90bc893785158b9aaab
097da6538b52b4624da07772c2f597a5f96dbfb7
refs/heads/master
2020-12-02T06:33:01.722098
2017-07-11T04:40:22
2017-07-11T04:40:22
96,851,177
0
0
null
null
null
null
UTF-8
Java
false
false
510
java
package com.jcg.examples.delegate; import java.sql.SQLException; import com.jcg.examples.service.SendMessage; public class DelegateSendMessage { private SendMessage sendMessage; public SendMessage getSendMessage() { return sendMessage; } public void setSendMessage(SendMessage sendMessage) { this.sendMessage = sendMessage; } public String sendMessage(String toEmail, String message, String fromEmail) throws SQLException { return sendMessage.sendMessage(toEmail, message, fromEmail); } }
[ "rajat.sharma830@gmail.com" ]
rajat.sharma830@gmail.com
5ffa1462b83aa8c82c32b888f90d68b5207299ef
016c056c705064d515c0f234abbadaf94b644a5f
/src/cropimage/ClipMover.java
2cda2303ae00a176c9c5d643449bdfdfef724d3f
[]
no_license
Janio-Rosa/importacaoimagens
c9dbf922e055af79147f4506328e5ec5033549de
51f46a789cb0fa1ee909fdd304fae69bc3553270
refs/heads/master
2020-09-15T09:41:42.408141
2019-11-22T15:39:28
2019-11-22T15:39:28
223,413,332
1
0
null
null
null
null
UTF-8
Java
false
false
3,140
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 cropimage; import carrega_imagem.TratarImagem; import cropimage.Cropping; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import javax.swing.event.MouseInputAdapter; /** * * @author katia */ class ClipMover extends MouseInputAdapter{ Cropping cropping; Point offset; boolean dragging; /* FormTesteImagem formTestarImagemCB1 =new FormTesteImagem(); FormTesteImagem formTestarImagemCB2 =new FormTesteImagem(); FormTesteImagem formTestarClippedImage =new FormTesteImagem(); BufferedImage imagemOriginal = null; Rectangle retangulo = null; Rectangle retanguloCB1 = null; Rectangle retanguloCB2 = null; */ public ClipMover(Cropping c) { cropping = c; offset = new Point(); dragging = false; } public void mousePressed(MouseEvent e) { Point p = e.getPoint(); //if(cropping.clip.contains(p)) if(cropping.getRetanguloAtual().contains(p)) { offset.x = p.x - cropping.getRetanguloAtual().x; offset.y = p.y - cropping.getRetanguloAtual().y; dragging = true; } } public void mouseReleased(MouseEvent e) { dragging = false; //formTestarClippedImage.desenharImagem(TratarImagem.cropSubimageWithRectangle(this.imagemOriginal, this.retangulo), "Imagem Correção"); //formTestarImagemCB1.desenharImagem(TratarImagem.cropSubimageWithRectangle(this.imagemOriginal,this.retanguloCB1),"Imagem CB1"); //formTestarImagemCB2.desenharImagem(TratarImagem.cropSubimageWithRectangle(this.imagemOriginal, this.retanguloCB2), "Imagem CB2"); this.cropping.atualizaImagens(); } public void mouseDragged(MouseEvent e) { if(dragging) { int x = e.getX() - offset.x; int y = e.getY() - offset.y; //cropping.setClip(x, y); cropping.setClip(cropping.getRetanguloAtual(),x, y); } } /* public void setRetangulo(Rectangle retangulo) { this.retangulo = retangulo; } public void setImagemOriginal(BufferedImage imagemOriginal) { this.imagemOriginal = imagemOriginal; } public void setRetanguloCB1(Rectangle retanguloCB1) { this.retanguloCB1 = retanguloCB1; } public void setRetanguloCB2(Rectangle retanguloCB2) { this.retanguloCB2 = retanguloCB2; } public void setFormTestarClippedImage(FormTesteImagem formTestarClippedImage) { this.formTestarClippedImage = formTestarClippedImage; } public void setFormTestarImagemCB1(FormTesteImagem formTestarImagemCB1) { this.formTestarImagemCB1 = formTestarImagemCB1; } public void setFormTestarImagemCB2(FormTesteImagem formTestarImagemCB2) { this.formTestarImagemCB2 = formTestarImagemCB2; } */ }
[ "janio@ufu.br" ]
janio@ufu.br
ed5a52882aed62ceafcedf5c9e07513c27a89a6c
88c73a4aa38f66e1dc7fea7229a07a8aea73141b
/app/src/main/java/com/degree/abbylaura/rumma_server/Database/Repo/FixtureRepo.java
fd74512634a24d681af1b4b96af2188fe38e0560
[]
no_license
AbbyLauraWiggins/RUMMA_Server
2c64b3c95b6b1a0d3ff5d1f9f3000866ae1eebc6
32c17d7c0e1bc2df36a72c5731e3dbdfa0e59c09
refs/heads/master
2021-09-09T08:17:59.444545
2018-03-14T10:27:26
2018-03-14T10:27:26
125,131,546
0
0
null
null
null
null
UTF-8
Java
false
false
2,919
java
package com.degree.abbylaura.rumma_server.Database.Repo; import android.content.ContentValues; import android.database.Cursor; import android.database.DatabaseUtils; import android.database.sqlite.SQLiteDatabase; import android.util.Log; import com.degree.abbylaura.rumma_server.Database.Data.DatabaseManager; import com.degree.abbylaura.rumma_server.Database.Schema.Fixture; /** * Created by abbylaura on 02/03/2018. */ public class FixtureRepo { private Fixture fixture; private String whereClause = ""; public FixtureRepo(){ fixture = new Fixture(); } public static String createTable(){ return "CREATE TABLE " + Fixture.TABLE + "(" + Fixture.KEY_FixturePrimary + " INTEGER PRIMARY KEY AUTOINCREMENT," + Fixture.KEY_TeamId + " TEXT," //MAY NEED TO DECLARE P/F KEYS HERE? + Fixture.KEY_FixtureId + " TEXT," + Fixture.KEY_FixturePoints + " TEXT)"; } public void insert(Fixture fixture) { SQLiteDatabase db = DatabaseManager.getInstance().openDatabase(); ContentValues values = new ContentValues(); values.put(Fixture.KEY_TeamId, fixture.getTeamId()); values.put(Fixture.KEY_FixtureId, fixture.getFixtureId()); values.put(Fixture.KEY_FixturePoints, fixture.getFixturePoints()); //TODO auto insert into fixture repo when teamfixtures updated // Inserting Row db.insert(Fixture.TABLE, null, values); DatabaseManager.getInstance().closeDatabase(); } public void delete( ) { SQLiteDatabase db = DatabaseManager.getInstance().openDatabase(); db.delete(Fixture.TABLE,null,null); DatabaseManager.getInstance().closeDatabase(); } public String[][] getTableData() { SQLiteDatabase db = DatabaseManager.getInstance().openDatabase(); int count = (int) DatabaseUtils.queryNumEntries(db, Fixture.TABLE); String[][] fixArray = new String[3][count]; String selectQuery = " SELECT * FROM " + Fixture.TABLE + " " + whereClause; Log.d(Fixture.TAG, selectQuery); Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list int iterator = 0; if (cursor.moveToFirst()) { do { fixArray[0][iterator] = cursor.getString(cursor.getColumnIndex(Fixture.KEY_FixtureId)); fixArray[1][iterator] = cursor.getString(cursor.getColumnIndex(Fixture.KEY_TeamId)); fixArray[2][iterator] = cursor.getString(cursor.getColumnIndex(Fixture.KEY_FixturePoints)); iterator++; } while (cursor.moveToNext()); } cursor.close(); DatabaseManager.getInstance().closeDatabase(); return fixArray; } public void setWhereClause(String where) { this.whereClause = where; } }
[ "axw520@student.bham.ac.uk" ]
axw520@student.bham.ac.uk
3060038cf1fe1f5d49966decd91afdab1bc53cea
cdfbf188185b93119b55f2cbd0fa4d52cbd13bf5
/platform/com/platform/mvc/module/ModuleController.java
534d69caa6f145626d78a9643e1087142201a8b5
[]
no_license
lixhongwu/managerwork
935935692c4a2a566a08f8fd066bede2bba7893a
151bb63ef08ee19c6e2d987345bc2daafc46c4c2
refs/heads/master
2020-04-29T03:48:29.699776
2019-03-15T13:21:23
2019-03-15T13:21:23
175,824,441
0
0
null
null
null
null
UTF-8
Java
false
false
1,442
java
package com.platform.mvc.module; import java.util.List; import com.jfinal.aop.Before; import com.jfinal.log.Log; import com.platform.annotation.Controller; import com.platform.dto.ZtreeNode; import com.platform.mvc.base.BaseController; /** * 模块管理 * @author 董华健 */ @Controller("/platform/module") public class ModuleController extends BaseController { @SuppressWarnings("unused") private static final Log log = Log.getLog(ModuleController.class); private ModuleService moduleService; private String systemsIds; // 哪个系统下的模块 private String pIds; // 上级模块ids private String names; // 模块名称 private long orderIds; // 模块排序号 /** * 模块tree首页 */ public void index() { render("/platform/module/tree.html"); } /** * 模块tree数据 */ public void treeData() { List<ZtreeNode> nodeList = moduleService.childNodeData(getCxt(), systemsIds, ids); renderJson(nodeList); } /** * 保存模块 */ @Before(ModuleValidator.class) public void save() { ids = moduleService.save(pIds, names, orderIds); renderText(ids); } /** * 更新模块 */ @Before(ModuleValidator.class) public void update() { moduleService.update(ids, pIds, names); renderText(ids); } /** * 删除模块 */ public void delete() { moduleService.delete(ids); renderText(ids); } }
[ "zhanghaishu@126.com" ]
zhanghaishu@126.com
ef34d2c1dc04132bcb75990365ebd9c7adc99b22
fd43b30739bf08bdb8bfae9f81d8538606274f75
/app/src/androidTest/java/com/example/omerrom/moodj/ApplicationTest.java
5cdd396b04f740be67ad10a5ad2a60614196928e
[]
no_license
omerom88/Mist
718630e02ef9757fc5072f90037edede939e3008
4d8e90f3c703b89073646db1f06ddaf869c9c13a
refs/heads/master
2021-08-26T08:33:22.259967
2017-11-22T14:06:49
2017-11-22T14:06:49
111,538,511
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.example.omerrom.moodj; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "omerom88@gmail.com" ]
omerom88@gmail.com
a8396f0c7fc4c7a9452d288c03585f66c15a631d
d1f72102199f5aebbd3e3dc471ec1c78f5db8639
/src/codes/myQuickSort.java
d696ccdac107fef8ad96be03f93d9d40744b7225
[]
no_license
chizhang0814/CodeTest
27be2e0c3c325c660ebbfd058c29e6b31df73cda
0842f50e8a5bda734de4492a083f11aba1d4e37e
refs/heads/master
2021-01-10T19:51:16.802010
2015-11-13T21:28:55
2015-11-13T21:28:55
42,343,867
0
0
null
null
null
null
UTF-8
Java
false
false
2,320
java
import java.util.ArrayList; public class myquickSort { private int array[]; private int length; public void sort(int[] inputArr) { if (inputArr == null || inputArr.length == 0) { return; } this.array = inputArr; length = inputArr.length; quickSort(0, length - 1); } private void quickSort(int lowerIndex, int higherIndex) { int i = lowerIndex; int j = higherIndex; // calculate pivot number, I am taking pivot as middle index number int pivot = array[lowerIndex+(higherIndex-lowerIndex)/2]; // Divide into two arrays while (i <= j) { /** * In each iteration, we will identify a number from left side which * is greater then the pivot value, and also we will identify a number * from right side which is less then the pivot value. Once the search * is done, then we exchange both numbers. */ while (array[i] < pivot) { i++; } while (array[j] > pivot) { j--; } if (i <= j) { exchangeNumbers(i, j); //move index to next position on both sides i++; j--; } } // call quickSort() method recursively if (lowerIndex < j) quickSort(lowerIndex, j); if (i < higherIndex) quickSort(i, higherIndex); } private void exchangeNumbers(int i, int j) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } void increment (int [] i){ i[i.length-1]++; } public static void main(String a[]){ int [] aa= {1}; myquickSort sorter = new myquickSort(); sorter.increment(aa); System.out.println(aa[aa.length-1]); int[] input = {24,2,45,20,56,75,2,56,99,53,12}; sorter.sort(input); for(int i:input){ System.out.print(i); System.out.print(" "); } ArrayList<Integer> arr = new ArrayList<Integer>(5); arr.add(5); int i =0; i++; int [] arrr =new int[5]; } }
[ "chizhang0814@gmail.com" ]
chizhang0814@gmail.com
c9e7a36daa8cfaab1c4940b17e698a3e352ab9ab
024d3b80a0678923b33da780e6cad17eb80d405e
/jbehave-core/src/main/java/org/jbehave/core/reporters/ViewGenerator.java
b397fb9927d442844fbe5d5f410d499e64014009
[ "BSD-3-Clause" ]
permissive
xavierbourguignon/jbehave-core
4b0754add64c7f961bc9cedf10eeef6173200621
e07a6ed67d111446da1d5e3cbc1a3a9f65e6bd62
refs/heads/master
2021-01-15T23:02:58.303000
2010-11-13T22:07:46
2010-11-13T22:07:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package org.jbehave.core.reporters; import java.io.File; import java.util.List; import java.util.Properties; import org.jbehave.core.model.StoryMaps; /** * A view generator is responsible for creating a collective views of stories, * either story maps or file-based reports of stories run. */ public interface ViewGenerator { void generateMapsView(File outputDirectory, StoryMaps storyMaps, Properties viewResources); void generateReportsView(File outputDirectory, List<String> formats, Properties viewResources); ReportsCount getReportsCount(); }
[ "mauro.talevi@aquilonia.org" ]
mauro.talevi@aquilonia.org
bf8180701e08e3f2d03d5c5a319b7ac3023bffbf
e013ec787e57af5c8c798f5714d9f930b76dfd32
/Library/Dynamic Programming/Sparse Table/Range GCD Query.java
2653eae866b15d9aeeef84e115f4744711eb6722
[]
no_license
omaryasser/Competitive-Programming
da66cb75bf6ed5495454d2f57333b02fe30a5b68
ba71b23ae3d0c4ef8bbdeff0cd12c3daca19d809
refs/heads/master
2021-04-29T00:39:29.663196
2019-02-19T04:20:56
2019-02-19T04:20:56
121,832,844
17
8
null
null
null
null
UTF-8
Java
false
false
1,093
java
public class Range_GCD_Query { static int Arr [] , table [][]; public static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); } Range_GCD_Query(int [] in) { Arr = in.clone(); int N = Arr.length; int k = (int) Math.floor(Math.log(N) / Math.log(2)) + 1; table = new int[N][k]; for (int i = 0; i < N; i++) table[i][0] = Arr[i]; for (int j = 1; j <= k; j++) for (int i = 0; i <= N - (1 << j); i++) table[i][j] = gcd(table[i][j - 1] , table[i + (1 << (j - 1))][j - 1]); } int query (int i , int j) { int k = (int)Math.floor(Math.log(j-i+1) / Math.log(2)); // 2^k <= (j-i+1) int GCD = 0; for (int pow = k; pow >= 0; pow--) { if(pow == k) GCD = table[i][pow]; if (i + (1 << pow) - 1 <= j) { GCD = gcd(GCD,table[i][pow]); i += 1 << pow; // instead of having L', we increment L directly } } return GCD; } }
[ "oyaraouf@gmail.com" ]
oyaraouf@gmail.com
ac70a7048facde512ba825677faf6a641f483c63
5aa586fb3c6d1c5350af10e857f31a3daed9b970
/AC-Game/data/scripts/system/handlers/quest/morheim/_2036ACaptiveFlame.java
59442b196157bd2b13926217d68dd63992b44e8f
[]
no_license
JohannesPfau/aion48
c1b77a46b6f98759e3704507fd48a47c5da48021
ebed1fc243fa85ee56a2af49d84a6d6dcca6c027
refs/heads/master
2020-03-18T01:15:05.566820
2018-05-16T20:40:16
2018-05-16T20:40:16
134,134,369
0
1
null
null
null
null
UTF-8
Java
false
false
7,087
java
/** * This file is part of Aion-Lightning <aion-lightning.org>. * * Aion-Lightning is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Aion-Lightning 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 Aion-Lightning. * If not, see <http://www.gnu.org/licenses/>. * * * Credits goes to all Open Source Core Developer Groups listed below * Please do not change here something, ragarding the developer credits, except the "developed by XXXX". * Even if you edit a lot of files in this source, you still have no rights to call it as "your Core". * Everybody knows that this Emulator Core was developed by Aion Lightning * @-Aion-Unique- * @-Aion-Lightning * @Aion-Engine * @Aion-Extreme * @Aion-NextGen * @Aion-Core Dev. */ package quest.morheim; import com.aionemu.gameserver.model.DialogAction; import com.aionemu.gameserver.model.gameobjects.Npc; import com.aionemu.gameserver.model.gameobjects.player.Player; import com.aionemu.gameserver.network.aion.serverpackets.SM_DIALOG_WINDOW; import com.aionemu.gameserver.questEngine.handlers.QuestHandler; import com.aionemu.gameserver.questEngine.model.QuestEnv; import com.aionemu.gameserver.questEngine.model.QuestState; import com.aionemu.gameserver.questEngine.model.QuestStatus; import com.aionemu.gameserver.services.QuestService; import com.aionemu.gameserver.utils.PacketSendUtility; /** * @author Hellboy aion4Free */ public class _2036ACaptiveFlame extends QuestHandler { private final static int questId = 2036; private final static int[] npc_ids = { 204407, 204408, 700236, 204317 }; public _2036ACaptiveFlame() { super(questId); } @Override public void register() { qe.registerOnEnterZoneMissionEnd(questId); qe.registerOnLevelUp(questId); qe.registerQuestNpc(212878).addOnKillEvent(questId); for (int npc_id : npc_ids) { qe.registerQuestNpc(npc_id).addOnTalkEvent(questId); } } @Override public boolean onZoneMissionEndEvent(QuestEnv env) { return defaultOnZoneMissionEndEvent(env, 2035); } @Override public boolean onLvlUpEvent(QuestEnv env) { return defaultOnLvlUpEvent(env, 2300, true); } @Override public boolean onDialogEvent(final QuestEnv env) { final Player player = env.getPlayer(); final QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) { return false; } int var = qs.getQuestVarById(0); int targetId = 0; if (env.getVisibleObject() instanceof Npc) { targetId = ((Npc) env.getVisibleObject()).getNpcId(); } if (qs.getStatus() == QuestStatus.START) { switch (targetId) { case 204407: { switch (env.getDialog()) { case QUEST_SELECT: if (var == 0) { return sendQuestDialog(env, 1011); } else if (var == 4) { return sendQuestDialog(env, 2375); } case SETPRO1: if (var == 0) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } case CHECK_USER_HAS_QUEST_ITEM: if (var == 4) { if (QuestService.collectItemCheck(env, true)) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 10000); } else { return sendQuestDialog(env, 10001); } } } } break; case 204408: { switch (env.getDialog()) { case QUEST_SELECT: if (var == 1) { return sendQuestDialog(env, 1352); } case SELECT_ACTION_1353: playQuestMovie(env, 79); break; case SETPRO2: if (var == 1) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } break; case 700236: switch (env.getDialog()) { case USE_OBJECT: if (player.getInventory().getItemCountByItemId(182204014) == 0) { giveQuestItem(env, 182204014, 1); return false; } } break; } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 204317) { if (env.getDialog() == DialogAction.USE_OBJECT) { return sendQuestDialog(env, 10002); } else { return sendQuestEndDialog(env); } } } return false; } @Override public boolean onKillEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) { return false; } int var = qs.getQuestVarById(0); int targetId = 0; if (env.getVisibleObject() instanceof Npc) { targetId = ((Npc) env.getVisibleObject()).getNpcId(); } if (qs.getStatus() != QuestStatus.START) { return false; } switch (targetId) { case 212878: if (var == 2) { qs.setQuestVarById(0, var + 2); updateQuestStatus(env); return true; } } return false; } }
[ "aion@gmx-topmail.de" ]
aion@gmx-topmail.de
6389eead936255c1ef7a5257c783473a5d7a5a17
73267be654cd1fd76cf2cb9ea3a75630d9f58a41
/services/servicestage/src/main/java/com/huaweicloud/sdk/servicestage/v2/model/LifecycleEntrypoint.java
d91aeb49e5fab4e0a658ed9e14a8928e47b1f883
[ "Apache-2.0" ]
permissive
huaweicloud/huaweicloud-sdk-java-v3
51b32a451fac321a0affe2176663fed8a9cd8042
2f8543d0d037b35c2664298ba39a89cc9d8ed9a3
refs/heads/master
2023-08-29T06:50:15.642693
2023-08-24T08:34:48
2023-08-24T08:34:48
262,207,545
91
57
NOASSERTION
2023-09-08T12:24:55
2020-05-08T02:27:00
Java
UTF-8
Java
false
false
3,312
java
package com.huaweicloud.sdk.servicestage.v2.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.function.Consumer; /** * 生命周期 */ public class LifecycleEntrypoint { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "command") private List<String> command = null; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "args") private List<String> args = null; public LifecycleEntrypoint withCommand(List<String> command) { this.command = command; return this; } public LifecycleEntrypoint addCommandItem(String commandItem) { if (this.command == null) { this.command = new ArrayList<>(); } this.command.add(commandItem); return this; } public LifecycleEntrypoint withCommand(Consumer<List<String>> commandSetter) { if (this.command == null) { this.command = new ArrayList<>(); } commandSetter.accept(this.command); return this; } /** * 执行命令行 * @return command */ public List<String> getCommand() { return command; } public void setCommand(List<String> command) { this.command = command; } public LifecycleEntrypoint withArgs(List<String> args) { this.args = args; return this; } public LifecycleEntrypoint addArgsItem(String argsItem) { if (this.args == null) { this.args = new ArrayList<>(); } this.args.add(argsItem); return this; } public LifecycleEntrypoint withArgs(Consumer<List<String>> argsSetter) { if (this.args == null) { this.args = new ArrayList<>(); } argsSetter.accept(this.args); return this; } /** * 运行参数 * @return args */ public List<String> getArgs() { return args; } public void setArgs(List<String> args) { this.args = args; } @Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } LifecycleEntrypoint that = (LifecycleEntrypoint) obj; return Objects.equals(this.command, that.command) && Objects.equals(this.args, that.args); } @Override public int hashCode() { return Objects.hash(command, args); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class LifecycleEntrypoint {\n"); sb.append(" command: ").append(toIndentedString(command)).append("\n"); sb.append(" args: ").append(toIndentedString(args)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
251514abae97357ff8be48bdb19dd033da939663
6194bd9346c5cea924cef26ce7e98cfbfcd51d83
/src/main/java/ru/anovikov/learning/otusbooklib/domain/Book.java
18d23d6b50e59a93070e57811f74ab7760bb043e
[]
no_license
andnovikov/otus-book-lib
c8bd7f2665a8b57416943fda775e53beed212fda
387b0c5860a161f7f3df64e9e3e11d28bf945003
refs/heads/master
2020-08-24T19:04:50.329848
2020-01-09T20:47:50
2020-01-09T20:47:50
216,887,654
0
0
null
2020-01-09T20:38:10
2019-10-22T18:54:32
Java
UTF-8
Java
false
false
1,752
java
package ru.anovikov.learning.otusbooklib.domain; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "books") public class Book { @Id @JsonProperty("id") @ApiModelProperty(notes = "Book id, generated value", position = 0) private String id; @DBRef @JsonProperty("author") @ApiModelProperty(notes = "Book author", position = 1) private Author author; @DBRef @JsonProperty("genre") @ApiModelProperty(notes = "Book genre", position = 2) private Genre genre; @JsonProperty("title") @ApiModelProperty(notes = "Book title", position = 3) private String title; public Book() {}; public Book(Author author, Genre genre, String title){ this.genre = genre; this.title = title; this.author = author; } public Book(String id, Author author, Genre genre, String title){ this.id = id; this.genre = genre; this.title = title; this.author = author; } public String getId() { return id; } public void setId(String id) { this.id = id; } public Author getAuthor() { return author; } public void setAuthor(Author author) { this.author = author; } public Genre getGenre() { return genre; } public void setGenre(Genre genre) { this.genre = genre; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } }
[ "andnovikov@outlook.com" ]
andnovikov@outlook.com
e129d8862176188338dd58def8e569a3632768cf
38ca0dc35f23f9352275818e5fdf858d2246bf89
/Exercicio 9/src/map/comport/template/Loan.java
b3087a4450519bb0a5ac14cb7fdfaa3aaa4ca195
[]
no_license
ayrtonkenn/MAP-2017-2
5653021186d2618b86d7a1c66cc5f118f49469d7
5c4b8b3e6ae0fc51b65ec989e349d19ce61deb39
refs/heads/master
2021-01-15T22:01:35.974510
2017-11-15T00:47:31
2017-11-15T00:47:31
99,880,287
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package map.comport.template; public class Loan { public double getCommitment() { // TODO Auto-generated method stub return 0; } public double getUnusedPackge() { // TODO Auto-generated method stub return 0; } public double unusedRiskAmount() { // TODO Auto-generated method stub return 0; } public double outstandingRiskAmount() { // TODO Auto-generated method stub return 0; } }
[ "wizzardayrton@gmail.com" ]
wizzardayrton@gmail.com
2712e713bf359bf16fd00726613e717754ae0509
a69ed15e24e686c1c23dc863df46f4481ba66fc8
/corejavaexamples/swing/FillTest.java
675b34e3e6320f8451f8eef0ab541236ea8c5872
[]
no_license
namratajavactp/corejavademos
2d4b1198081ce4abbd92c785f118f2e34ac960bd
52de32f5915f0da350380c38f217a5e75c380f51
refs/heads/master
2021-01-13T02:02:37.922813
2015-08-20T11:33:47
2015-08-20T11:33:47
41,092,268
0
0
null
null
null
null
UTF-8
Java
false
false
2,982
java
/* To establish a common baseline, the AWT defines five logical font names: SansSerif Serif Monospaced Dialog DialogInput These names are always mapped to fonts that actually exist on the client machine. For example, on a Windows system, SansSerif is mapped to Arial. To draw characters in a font, you must first create an object of the class Font. You specify the font face name, the font style, and the point size. Here is an example of how you construct a Font object: Font helvb14 = new Font("Helvetica", Font.BOLD, 14); The third argument is the point size. Points are commonly used in typography to indicate the size of a font. There are 72 points per inch. You can use a logical font name in the place of a font face name in the Font constructor. You specify the style (plain, bold, italic, or bold italic) by setting the second Font constructor argument to one of the following values: Font.PLAIN Font.BOLD Font.ITALIC Font.BOLD + Font.ITALIC */ import java.awt.*; import java.awt.geom.*; import javax.swing.*; import javax.swing.border.BevelBorder; public class FillTest { public static void main(String[] args) { FillFrame frame = new FillFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } /** A frame that contains a panel with drawings */ class FillFrame extends JFrame { public FillFrame() { setTitle("FillTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // add panel to frame FillPanel panel = new FillPanel(); add(panel); } public static final int DEFAULT_WIDTH = 400; public static final int DEFAULT_HEIGHT = 400; } /** A panel that displays filled rectangles and ellipses */ class FillPanel extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); Cursor c=new Cursor(Cursor.CROSSHAIR_CURSOR); setCursor(c); Graphics2D g2 = (Graphics2D) g; Color cc=new Color(255,0,0); cc.brighter().brighter().brighter(); // setForeground(Color.PINK); setBackground(Color.PINK); setForeground(cc); // draw a rectangle double leftX = 100; double topY = 100; double width = 200; double height = 150; Font sansbold14 = new Font("SansSerif", Font.BOLD, 14); g2.setFont(sansbold14); String message = "Hello, World!"; g2.drawString(message, 75, 80); // setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED,Color.GREEN,Color.BLUE)); setBorder(BorderFactory.createEtchedBorder()); setEnabled(false); Rectangle2D rect = new Rectangle2D.Double(leftX, topY, width, height); g2.setPaint(Color.RED); g2.fill(rect); // draw the enclosed ellipse Ellipse2D ellipse = new Ellipse2D.Double(); ellipse.setFrame(rect); g2.setPaint(new Color(0, 128, 128)); // a dull blue-green g2.fill(ellipse); } }
[ "namrata.marathe@citiustech.com" ]
namrata.marathe@citiustech.com
4ced2a8a8952c146942199f519d3b1f23624cdce
76820925db4d541b65a14f39ce1e9777ad78229e
/src/FormulariosParaProveedor/Registrar/RegistrarProveedor.java
8bcd72ef6eb2c86d6cf1c049f442215341311806
[]
no_license
KevinPC98/Minimarket
1200b6664b7ef94241d966704ea3e35491c96102
5b66e46d85598a8bfc7adb2b4452b22a1a5be73f
refs/heads/master
2023-04-07T03:26:00.853002
2021-04-07T16:02:19
2021-04-07T16:02:19
355,603,037
0
0
null
null
null
null
UTF-8
Java
false
false
7,490
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 FormulariosParaProveedor.Registrar; import BaseInternalFrame.BaseInterenalFrame; import presentacion.validacion; /** * * @author DIEGO */ public class RegistrarProveedor extends BaseInterenalFrame<Presentador> implements Interface.vista{ public RegistrarProveedor() { initComponents(); } @Override protected Presentador crearPresentador(){ return new Presentador(this); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); txt_direccion = new javax.swing.JTextField(); txt_nombre = new javax.swing.JTextField(); txt_telefono = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); setClosable(true); setIconifiable(true); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel1.setText("REGISTRAR PROVEEDOR"); jLabel3.setText("NOMBRE:"); jLabel4.setText("DIRECCION: "); jLabel5.setText("TELEFONO: "); txt_direccion.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { txt_direccionKeyTyped(evt); } }); txt_nombre.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txt_nombreActionPerformed(evt); } }); txt_nombre.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { txt_nombreKeyTyped(evt); } }); txt_telefono.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { txt_telefonoKeyTyped(evt); } }); jButton1.setText("REGISTRAR"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(15, 15, 15) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jLabel5) .addComponent(jLabel3)) .addGap(36, 36, 36) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txt_nombre) .addComponent(txt_direccion) .addComponent(txt_telefono, javax.swing.GroupLayout.PREFERRED_SIZE, 360, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(31, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1) .addGap(195, 195, 195)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(37, 37, 37) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txt_nombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txt_direccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(txt_telefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jButton1) .addGap(49, 49, 49)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txt_nombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_nombreActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txt_nombreActionPerformed @Override public void limpiar(){ txt_nombre.setText(""); txt_direccion.setText(""); txt_telefono.setText(""); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed presentador.registrarProveedor(txt_nombre.getText(), txt_telefono.getText(), txt_direccion.getText()); }//GEN-LAST:event_jButton1ActionPerformed private void txt_nombreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_nombreKeyTyped validacion.validarCaracteresYPuntos(evt, txt_nombre.getText(), 30); }//GEN-LAST:event_txt_nombreKeyTyped private void txt_direccionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_direccionKeyTyped validacion.tamaño(evt, txt_direccion.getText(), 80); }//GEN-LAST:event_txt_direccionKeyTyped private void txt_telefonoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_telefonoKeyTyped validacion.validarNumeros(evt, txt_telefono.getText(), 10); }//GEN-LAST:event_txt_telefonoKeyTyped // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JTextField txt_direccion; private javax.swing.JTextField txt_nombre; private javax.swing.JTextField txt_telefono; // End of variables declaration//GEN-END:variables }
[ "kevin.paredescaman20@gmail.com" ]
kevin.paredescaman20@gmail.com
08acea4cb694ee4b45f0c1ab9364989315cd75ea
d103a2348d14bf6e4d9d1aac93d7bcbf8f7e433f
/day18/src/com/hxzy/守护线程/Guardian.java
27a18ecb9edf0559374505c2ce58fa397b0210ae
[]
no_license
veigara/java24
29e04cc2e075c14c9511fb640edd065e25abb181
20f1c085b0b45215a84531f0b3159d9d592aa683
refs/heads/master
2020-03-06T21:46:59.302199
2018-05-28T01:36:37
2018-05-28T01:36:37
127,086,412
2
0
null
null
null
null
GB18030
Java
false
false
1,540
java
package com.hxzy.守护线程; /** * 守护线程 * @author Administrator * */ public class Guardian { /** * 守护线程:需要在主线程中声明线程并通过setDaemon(true) * 说明该线程为主线程的守护线程(特殊的子线程) * 特点:随着主线的结束,守护线程随之结束。即使守护线程中的任务没有执行完毕,也需要结束 * 使用场景:日志,审计 * @param args */ public static void main(String[] args) { System.out.println("主线程"); //thread为main主线程的子线程 Thread thread1 = new Thread(()-> { while (true) {//此处为了示例,守护线程一直执行下去 System.out.println("子线程1正在处理任务"); try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } } }); Thread thread2 = new Thread(()-> { while (true) {//此处为了示例,守护线程一直执行下去 System.out.println("子线程2正在处理任务"); try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } } }); thread1.setDaemon(true);//设置为main主线程的守护线程 thread2.setDaemon(true);//设置为main主线程的守护线程 thread1.start(); thread2.start(); try { Thread.sleep(5000);//主线程休眠5秒钟 } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("main主线程执行完毕"); } }
[ "Administrator@LS--20171225UTQ" ]
Administrator@LS--20171225UTQ
7921229d9b1815631c26e8a1cafc164207988254
90ae78337be1ba50e28050a8acee84922537da0e
/webstore/src/main/java/com/packt/webstore/interceptor/ProcessingTimeLogInterceptor.java
0043d359c0dad46f07be10c25cc7e8ecc70a3d24
[]
no_license
SterlingAr/spring-mvc
1acffcd1edb44110e45ac2ee3193ab2bcb43b5da
efc5aec3b7564b2721292ec75ded2e57fa4e9617
refs/heads/master
2020-12-30T15:54:49.873864
2018-02-15T08:07:41
2018-02-15T08:07:41
91,185,696
0
0
null
2017-06-28T10:48:47
2017-05-13T15:58:52
Java
UTF-8
Java
false
false
1,427
java
package com.packt.webstore.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; public class ProcessingTimeLogInterceptor implements HandlerInterceptor { private static final Logger LOGGER = Logger.getLogger(ProcessingTimeLogInterceptor.class); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { long startTime = System.currentTimeMillis(); request.setAttribute("startTime", startTime); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { String queryString = request.getQueryString() == null ? "" : "?" + request.getQueryString(); String path = request.getRequestURL() + queryString; long startTime = (Long) request.getAttribute("startTime"); long endTime = System.currentTimeMillis(); LOGGER.info(String.format("%s millisecond taken to process the request %s",(endTime - startTime), path)); } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { // TODO Auto-generated method stub } }
[ "marboravrns@gmail.com" ]
marboravrns@gmail.com
11aa6c2378d83757cba20462aa237e81c95fcea9
a6c3635154143b4fb42a7f6288d79411862e91a6
/src/gensekiel/wurmunlimited/mods/treefarm/PlanterAgeAction.java
b1f97bd4cda4798b921748a7af79ab65ca72b528
[]
no_license
duejensen/modtreefarm
44c6e9a2f896fda5d3d8ef8e4a1be58d68274345
78b26f1272d55f9d9161406d626f2db040982ca5
refs/heads/master
2020-03-13T00:33:53.657235
2018-04-24T17:19:06
2018-04-24T17:19:06
130,889,221
0
0
null
null
null
null
UTF-8
Java
false
false
1,217
java
package gensekiel.wurmunlimited.mods.treefarm; import com.wurmonline.server.creatures.Creature; import com.wurmonline.server.items.Item; import com.wurmonline.server.items.ItemList; public class PlanterAgeAction extends PlanterAction { //====================================================================== public PlanterAgeAction(){ this("Water"); } //====================================================================== protected PlanterAgeAction(String s) { super(s, AbstractAction.ActionFlavor.WATER_ACTION); cost = 5000; time = 30; item = ItemList.water; skill = 10048; } //====================================================================== protected boolean checkItemConditions(Creature performer, Item item) { if(!PlanterAgeTask.canGrow(item)){ performer.getCommunicator().sendNormalServerMessage("This " + item.getName() + " is too old.", (byte)1); return true; } return false; } //====================================================================== @Override protected void performItemAction(Item item, double multiplier) { TaskPoller.addTask(new PlanterAgeTask(item, multiplier)); } //====================================================================== }
[ "gensekiel@users.noreply.github.com" ]
gensekiel@users.noreply.github.com
3b7171bcd8407cf8ce34e70dc03111905f2fc359
b0f21d5395a6a1102eefca45190233c4a35c42a8
/src/main/java/org/segrada/servlet/SegradaSimplePageCachingFilter.java
f7c109cdf20a3d87065553b93ad1ba78092c918f
[ "Apache-2.0" ]
permissive
rm3l/segrada
55d5a1a1c9efa155188f561016a187e644f2a374
cfed9476b73d933116d4f1d539e3f3c0fb020461
refs/heads/master
2021-01-22T09:17:15.700317
2015-11-29T09:55:00
2015-11-29T09:55:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,200
java
package org.segrada.servlet; import com.google.inject.Injector; import com.google.inject.Singleton; import net.sf.ehcache.constructs.web.PageInfo; import net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter; import org.apache.commons.codec.binary.Hex; import org.segrada.session.Identity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.FilterChain; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.net.URLEncoder; import java.security.MessageDigest; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Copyright 2015 Maximilian Kalus [segrada@auxnet.de] * * 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. * * Customized cache filter that filters out certain pages which should not be cached */ @Singleton public class SegradaSimplePageCachingFilter extends SimplePageCachingFilter { private final static Logger logger = LoggerFactory.getLogger(SegradaSimplePageCachingFilter.class.getName()); /** * excluded patterns */ private static final Pattern excludePatterns = Pattern.compile("/(clear_cache|reindex|locale/)"); /** * url parts that add a session key to the cache key in order to function properly */ private static final Pattern addSessionToCacheKey = Pattern.compile("^/((node|source|file|relation)(/by_tag/[0-9\\-]+)?|relation_type|pictogram|tag|color)$"); /** * pattern to filter out jsessionid-urls */ private static final Pattern jSessionFilter = Pattern.compile(";jsessionid=[a-zA-Z0-9]+$"); /** * reference to injector */ private static Injector injector; /** * set the injector - called by Bootstrap */ public static void setInjector(Injector injector) { SegradaSimplePageCachingFilter.injector = injector; } @Override protected void doFilter(HttpServletRequest servletRequest, HttpServletResponse servletResponse, FilterChain filterChain) throws Exception { // exclude? String url = servletRequest.getRequestURL().toString(); // session set? Identity identity = injector.getInstance(Identity.class); boolean loggedIn = identity.getName()!=null; // only get request and matched urls when logged in and not on POST methods if (!loggedIn || servletRequest.getMethod().equals("POST") || excludePatterns.matcher(url).find()) { if (logger.isDebugEnabled()) logger.debug("Not caching url " + url); // build page info and return gzipped if needed PageInfo pageInfo = this.buildPage(servletRequest, servletResponse, filterChain); if(pageInfo.isOk()) { if(!servletResponse.isCommitted()) { //throw new AlreadyCommittedException("Response already committed after doing buildPage but before writing response from PageInfo."); this.writeResponse(servletRequest, servletResponse, pageInfo); } } } else { // included cached filter chain loaded super.doFilter(servletRequest, servletResponse, filterChain); } } /** * calculate key for page from httpRequest * @param httpRequest the request * @return cache key */ protected String calculateKey(HttpServletRequest httpRequest) { HttpSession session = httpRequest.getSession(); // get language from session Object lObject = session.getAttribute("language"); String language = lObject==null?null:(String) lObject; if (language == null) language = httpRequest.getLocale().getLanguage(); // get url, context path stripped String urlPart = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length()); // filter out jsessionid URL addition, just in case - should not happen, because it is not clean, but nevertheless urlPart = jSessionFilter.matcher(urlPart).replaceFirst(""); //TODO: might be faster to use lastIndexOf and substr to replace this instead of regex // query data map - later to be sorted into a key SortedMap<String, String> queryData = new TreeMap<>(); // match with urls that require session key addition to cache in order to function properly? MatchResult matchResult = addSessionToCacheKey.matcher(urlPart).toMatchResult(); if (((Matcher) matchResult).find()) { // this is the same as the session key String controller = matchResult.group().substring(1, 2).toUpperCase() + matchResult.group().substring(2) + "Service"; // get session data Object controllerData = session.getAttribute(controller); // create sorted map if (controllerData != null && controllerData instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> d = (Map<String, Object>)controllerData; for (String parameter : d.keySet()) { Object o = d.get(parameter); String value; // concatenate string array in order to make caching work if (o instanceof String[]) value = String.join(",", (String[]) o); else // all other cases: convert to string value = d.get(parameter).toString(); queryData.put(parameter, value); } } } // get query data and add it to list (overwrite session, if needed) for (Map.Entry<String, String[]> parameter : httpRequest.getParameterMap().entrySet()) { queryData.put(parameter.getKey(), String.join(",", parameter.getValue())); } // create query string as key StringBuilder queryString = new StringBuilder(); for (Map.Entry<String, String> entry: queryData.entrySet()) { try { String encodedName = URLEncoder.encode(entry.getKey(), "UTF-8"); Object value = entry.getValue(); String encodedValue = value!=null?URLEncoder.encode(String.valueOf(value), "UTF-8"):""; // do not include page=1 if (encodedName.equals("page") && encodedValue.equals("1")) continue; if (queryString.length() > 0) queryString.append('&'); queryString.append(encodedName).append("=").append(encodedValue); } catch (Exception e) { logger.warn("Could not encode field " + entry.getKey() + " with value " + entry.getValue(), e); } } // convert query string to md5 String qs = queryString.toString(); // do we actually need to convert to md5? qs are not so long in general if (!qs.isEmpty()) try { MessageDigest md = MessageDigest.getInstance("MD5"); qs = Hex.encodeHexString(md.digest(qs.getBytes("UTF-8"))); } catch (Exception e) { // do nothing - just use query string as it is } // get session id //Identity identity = injector.getInstance(Identity.class); //identity.getId() //TODO: add this later after we have added ACLs - not all users see the same stuff // create key return httpRequest.getMethod() + language + urlPart + qs; } }
[ "info@auxnet.de" ]
info@auxnet.de
a7a410987b0218ae322f5b8bbf1bc106ae6b11ad
97a7a1700c757b840365fe01aac6622215903459
/lib/common/src/main/java/com/android/open9527/common/net/data/json/StringTypeAdapter.java
9da5da934786bebb1918582e75ac6eed88009d94
[ "Apache-2.0" ]
permissive
open9527/OpenProject
7fd4cd24ee034c65c1e4377d37a735e207797f38
111218f407aa460f8eca62fc45d8b4a6ceb4f4dd
refs/heads/main
2023-07-26T00:59:31.281146
2021-06-24T07:22:28
2021-06-24T07:22:28
329,212,942
5
0
null
null
null
null
UTF-8
Java
false
false
1,155
java
package com.android.open9527.common.net.data.json; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; /** * author : Android 轮子哥 * github : https://github.com/getActivity/EasyHttp * time : 2020/05/05 * desc : String 类型解析适配器,参考:{@link com.google.gson.internal.bind.TypeAdapters#STRING} */ public class StringTypeAdapter extends TypeAdapter<String> { @Override public String read(JsonReader in) throws IOException { switch (in.peek()) { case STRING: case NUMBER: return in.nextString(); case BOOLEAN: // 对于布尔类型比较特殊,需要做针对性处理 return Boolean.toString(in.nextBoolean()); case NULL: in.nextNull(); return null; default: in.skipValue(); return null; } } @Override public void write(JsonWriter out, String value) throws IOException { out.value(value); } }
[ "open_9527@163.com" ]
open_9527@163.com
21cee9be6b2e76450dad784164f9372be4efc0e6
5871919dd1e36b41f3fe7fb258ff03b98f382769
/POI/src/sam/Sample3.java
fe3181c9168e09e59471a194764c5c8cccee3010
[]
no_license
sigekyon/phase1
aaeef854409f314291129ac54e5844cc44962655
e34d87bb82ee4c1bfccb35379d3d4d7aed0c19c2
refs/heads/master
2021-01-10T03:20:22.243124
2015-09-28T03:53:04
2015-09-28T03:53:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
package sam; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; public class Sample3 { public static void main(String[] args) { Workbook wb = new HSSFWorkbook(); Sheet sheet1 = wb.createSheet(); Sheet sheet2 = wb.createSheet(); Sheet sheet3 = wb.createSheet("new sheet"); Sheet sheet4 = wb.createSheet("あいうえお"); FileOutputStream out = null; try { out = new FileOutputStream("sample3_1.xls"); wb.write(out); } catch (IOException e) { System.out.println(e.toString()); } finally { try { out.close(); } catch (IOException e) { System.out.println(e.toString()); } } } }
[ "tt@ntc.co.jp" ]
tt@ntc.co.jp
5ffeb73697559a610bc50c3d48eb7d6663f21d75
8b0ea80665b3dfe1d13fec362334550811e8facc
/decoration-dal/src/main/java/me/nithans/decoration/dal/domain/decoration/MaterialCriteria.java
6526fce1e50e39433ed1515fcb4e7e75731219db
[]
no_license
WOWHans/decoration
867d3113900feebbb57fada834ec985527574668
f6896ba67ebd79347d96a8e52177ec21bd632055
refs/heads/master
2020-04-16T09:44:16.825990
2019-04-29T09:01:22
2019-04-29T09:01:22
165,475,175
0
0
null
null
null
null
UTF-8
Java
false
false
25,697
java
package me.nithans.decoration.dal.domain.decoration; import java.util.ArrayList; import java.util.Date; import java.util.List; public class MaterialCriteria { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ protected String orderByClause; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ protected boolean distinct; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ protected List<Criteria> oredCriteria; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public MaterialCriteria() { oredCriteria = new ArrayList<Criteria>(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public String getOrderByClause() { return orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public boolean isDistinct() { return distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andUserIdIsNull() { addCriterion("user_id is null"); return (Criteria) this; } public Criteria andUserIdIsNotNull() { addCriterion("user_id is not null"); return (Criteria) this; } public Criteria andUserIdEqualTo(Integer value) { addCriterion("user_id =", value, "userId"); return (Criteria) this; } public Criteria andUserIdNotEqualTo(Integer value) { addCriterion("user_id <>", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThan(Integer value) { addCriterion("user_id >", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { addCriterion("user_id >=", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThan(Integer value) { addCriterion("user_id <", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThanOrEqualTo(Integer value) { addCriterion("user_id <=", value, "userId"); return (Criteria) this; } public Criteria andUserIdIn(List<Integer> values) { addCriterion("user_id in", values, "userId"); return (Criteria) this; } public Criteria andUserIdNotIn(List<Integer> values) { addCriterion("user_id not in", values, "userId"); return (Criteria) this; } public Criteria andUserIdBetween(Integer value1, Integer value2) { addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } public Criteria andUserIdNotBetween(Integer value1, Integer value2) { addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } public Criteria andTypeIdIsNull() { addCriterion("type_id is null"); return (Criteria) this; } public Criteria andTypeIdIsNotNull() { addCriterion("type_id is not null"); return (Criteria) this; } public Criteria andTypeIdEqualTo(Integer value) { addCriterion("type_id =", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdNotEqualTo(Integer value) { addCriterion("type_id <>", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdGreaterThan(Integer value) { addCriterion("type_id >", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdGreaterThanOrEqualTo(Integer value) { addCriterion("type_id >=", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdLessThan(Integer value) { addCriterion("type_id <", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdLessThanOrEqualTo(Integer value) { addCriterion("type_id <=", value, "typeId"); return (Criteria) this; } public Criteria andTypeIdIn(List<Integer> values) { addCriterion("type_id in", values, "typeId"); return (Criteria) this; } public Criteria andTypeIdNotIn(List<Integer> values) { addCriterion("type_id not in", values, "typeId"); return (Criteria) this; } public Criteria andTypeIdBetween(Integer value1, Integer value2) { addCriterion("type_id between", value1, value2, "typeId"); return (Criteria) this; } public Criteria andTypeIdNotBetween(Integer value1, Integer value2) { addCriterion("type_id not between", value1, value2, "typeId"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andModelIsNull() { addCriterion("model is null"); return (Criteria) this; } public Criteria andModelIsNotNull() { addCriterion("model is not null"); return (Criteria) this; } public Criteria andModelEqualTo(String value) { addCriterion("model =", value, "model"); return (Criteria) this; } public Criteria andModelNotEqualTo(String value) { addCriterion("model <>", value, "model"); return (Criteria) this; } public Criteria andModelGreaterThan(String value) { addCriterion("model >", value, "model"); return (Criteria) this; } public Criteria andModelGreaterThanOrEqualTo(String value) { addCriterion("model >=", value, "model"); return (Criteria) this; } public Criteria andModelLessThan(String value) { addCriterion("model <", value, "model"); return (Criteria) this; } public Criteria andModelLessThanOrEqualTo(String value) { addCriterion("model <=", value, "model"); return (Criteria) this; } public Criteria andModelLike(String value) { addCriterion("model like", value, "model"); return (Criteria) this; } public Criteria andModelNotLike(String value) { addCriterion("model not like", value, "model"); return (Criteria) this; } public Criteria andModelIn(List<String> values) { addCriterion("model in", values, "model"); return (Criteria) this; } public Criteria andModelNotIn(List<String> values) { addCriterion("model not in", values, "model"); return (Criteria) this; } public Criteria andModelBetween(String value1, String value2) { addCriterion("model between", value1, value2, "model"); return (Criteria) this; } public Criteria andModelNotBetween(String value1, String value2) { addCriterion("model not between", value1, value2, "model"); return (Criteria) this; } public Criteria andDescriptionIsNull() { addCriterion("description is null"); return (Criteria) this; } public Criteria andDescriptionIsNotNull() { addCriterion("description is not null"); return (Criteria) this; } public Criteria andDescriptionEqualTo(String value) { addCriterion("description =", value, "description"); return (Criteria) this; } public Criteria andDescriptionNotEqualTo(String value) { addCriterion("description <>", value, "description"); return (Criteria) this; } public Criteria andDescriptionGreaterThan(String value) { addCriterion("description >", value, "description"); return (Criteria) this; } public Criteria andDescriptionGreaterThanOrEqualTo(String value) { addCriterion("description >=", value, "description"); return (Criteria) this; } public Criteria andDescriptionLessThan(String value) { addCriterion("description <", value, "description"); return (Criteria) this; } public Criteria andDescriptionLessThanOrEqualTo(String value) { addCriterion("description <=", value, "description"); return (Criteria) this; } public Criteria andDescriptionLike(String value) { addCriterion("description like", value, "description"); return (Criteria) this; } public Criteria andDescriptionNotLike(String value) { addCriterion("description not like", value, "description"); return (Criteria) this; } public Criteria andDescriptionIn(List<String> values) { addCriterion("description in", values, "description"); return (Criteria) this; } public Criteria andDescriptionNotIn(List<String> values) { addCriterion("description not in", values, "description"); return (Criteria) this; } public Criteria andDescriptionBetween(String value1, String value2) { addCriterion("description between", value1, value2, "description"); return (Criteria) this; } public Criteria andDescriptionNotBetween(String value1, String value2) { addCriterion("description not between", value1, value2, "description"); return (Criteria) this; } public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; } public Criteria andCreateTimeIsNotNull() { addCriterion("create_time is not null"); return (Criteria) this; } public Criteria andCreateTimeEqualTo(Date value) { addCriterion("create_time =", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotEqualTo(Date value) { addCriterion("create_time <>", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeGreaterThan(Date value) { addCriterion("create_time >", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { addCriterion("create_time >=", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeLessThan(Date value) { addCriterion("create_time <", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeLessThanOrEqualTo(Date value) { addCriterion("create_time <=", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeIn(List<Date> values) { addCriterion("create_time in", values, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotIn(List<Date> values) { addCriterion("create_time not in", values, "createTime"); return (Criteria) this; } public Criteria andCreateTimeBetween(Date value1, Date value2) { addCriterion("create_time between", value1, value2, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotBetween(Date value1, Date value2) { addCriterion("create_time not between", value1, value2, "createTime"); return (Criteria) this; } public Criteria andUpdateTimeIsNull() { addCriterion("update_time is null"); return (Criteria) this; } public Criteria andUpdateTimeIsNotNull() { addCriterion("update_time is not null"); return (Criteria) this; } public Criteria andUpdateTimeEqualTo(Date value) { addCriterion("update_time =", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotEqualTo(Date value) { addCriterion("update_time <>", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeGreaterThan(Date value) { addCriterion("update_time >", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { addCriterion("update_time >=", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeLessThan(Date value) { addCriterion("update_time <", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { addCriterion("update_time <=", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeIn(List<Date> values) { addCriterion("update_time in", values, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotIn(List<Date> values) { addCriterion("update_time not in", values, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeBetween(Date value1, Date value2) { addCriterion("update_time between", value1, value2, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { addCriterion("update_time not between", value1, value2, "updateTime"); return (Criteria) this; } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table decoration_material * * @mbg.generated do_not_delete_during_merge Wed Feb 06 23:50:03 CST 2019 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table decoration_material * * @mbg.generated Wed Feb 06 23:50:03 CST 2019 */ public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "hw.pers@hotmail.com" ]
hw.pers@hotmail.com
c139ef7ea8efe25baf0d6c3d1e8cd9767e175c4f
082e26b011e30dc62a62fae95f375e4f87d9e99c
/docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/tencent/p177mm/plugin/sns/p516g/C43543g.java
3a8613b9416a33d85247e8e4cd768ef6b0827658
[]
no_license
xsren/AndroidReverseNotes
9631a5aabc031006e795a112b7ac756a8edd4385
9202c276fe9f04a978e4e08b08e42645d97ca94b
refs/heads/master
2021-04-07T22:50:51.072197
2019-07-16T02:24:43
2019-07-16T02:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
963
java
package com.tencent.p177mm.plugin.sns.p516g; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.p177mm.p183ai.C1202f; import com.tencent.p177mm.p183ai.C1207m; /* renamed from: com.tencent.mm.plugin.sns.g.g */ public final class C43543g implements C1202f { C39736h qQa; public final boolean coA() { AppMethodBeat.m2504i(36810); if (this.qQa == null || this.qQa.qPP.size() == 0) { AppMethodBeat.m2505o(36810); return false; } AppMethodBeat.m2505o(36810); return true; } public final C39736h coB() { AppMethodBeat.m2504i(36811); if (this.qQa == null || this.qQa.qPP.size() == 0) { AppMethodBeat.m2505o(36811); return null; } C39736h c39736h = this.qQa; AppMethodBeat.m2505o(36811); return c39736h; } public final void onSceneEnd(int i, int i2, String str, C1207m c1207m) { } }
[ "alwangsisi@163.com" ]
alwangsisi@163.com
6f19c7657d182e0c3579169ddf0dd0c1cce821a2
e575a8fbdc945d70fef2593a209bb09f1066a333
/LeetCode/src/com/zil/li/Tree/FlattenBinaryTreeToLinkedList.java
022ea92b955b0f0ae40fcf256dcf9133f21ecfdc
[]
no_license
chongzizil/Practices
ba440591dbb5418d13995b7e0553c1a1b51e814b
96070b0aef8abcf96f907a0336edbe6df229ff55
refs/heads/master
2021-01-25T12:13:29.518589
2015-04-17T06:00:59
2015-04-17T06:00:59
28,645,322
0
0
null
null
null
null
UTF-8
Java
false
false
962
java
package com.zil.li.Tree; import com.zil.li.datastructure.TreeNode; /** * Created by youlongli on 2/11/15. * * https://oj.leetcode.com/problems/flatten-binary-tree-to-linked-list/ */ public class FlattenBinaryTreeToLinkedList { /** * Time complexity: O(n) * Space complexity: O(1) */ public void flatten(TreeNode root) { helper(root); } private TreeNode helper(TreeNode root) { if (root == null) { return null; } TreeNode left = root.left; TreeNode right = root.right; TreeNode tail = root; // Note: first cleat the child node root.left = null; root.right = null; // Note: remember to check if the child node is null if (left != null) { tail.right = left; // append the subtree tail = helper(left); // update the tail } if (right != null) { tail.right = right; // append the subtree tail = helper(right); // update the tail } return tail; } }
[ "chongzizil@gmail.com" ]
chongzizil@gmail.com
76c58cd3b49205e5f497aed2e824f3dcec2ed59b
a5ee48072f4f411165150ab893ab531a8edeb49c
/src/dados/generico/DAOFactory.java
bfd969155dbc88eb87927b1ee867a9e32a13852e
[]
no_license
fellypeavelino/projetoJSF
e8df008ebcd7687922e1072868b590493e237022
69ff8ce93b70fedad3a45a37812a6f0c5db9cd5d
refs/heads/master
2021-01-20T09:55:06.539957
2014-11-30T12:38:42
2014-11-30T12:38:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,786
java
package dados.generico; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import dados.basic.AnimalBase; import dados.basic.ClienteBase; import dados.basic.CompraBase; import dados.basic.CotacaoBase; import dados.basic.EnderecoBase; import dados.basic.EstoqueBase; import dados.basic.FornecedorBase; import dados.basic.IAnimalBase; import dados.basic.IClienteBase; import dados.basic.ICompraBase; import dados.basic.ICotacaoBase; import dados.basic.IEnderecoBase; import dados.basic.IEstoqueNegocio; import dados.basic.IEstoqueBase; import dados.basic.IFornecedorBase; import dados.basic.IPessoaBase; import dados.basic.IPessoaFisicaBase; import dados.basic.IPessoaJuridicaBase; import dados.basic.IProdutoBase; import dados.basic.ITipoBase; import dados.basic.PessoaFisicaBase; import dados.basic.PessoaJuridicaBase; import dados.basic.ProdutoBase; import dados.basic.TipoBase; public abstract class DAOFactory { private static EntityManagerFactory factory; private static EntityManager entityManager; private static IPessoaBase pessoaBase; private static IPessoaFisicaBase pessoaFisicaBase; private static IPessoaJuridicaBase pessoaJuridica; private static IFornecedorBase fornecedorBase; private static IClienteBase clienteBase; private static IEnderecoBase enderecoBase; private static IEstoqueBase estoqueBase; private static ITipoBase tipo; private static IAnimalBase animalBase; private static IProdutoBase produtoBase; private static ICotacaoBase cotacaoBase; private static ICompraBase compraBase; public static EntityManagerFactory getFactory() { return factory; } public static void setFactory(EntityManagerFactory factory) { DAOFactory.factory = factory; } public static EntityManager getEntityManager() { return entityManager; } public static void setEntityManager(EntityManager entityManager) { DAOFactory.entityManager = entityManager; } public static IPessoaBase getPessoaBase() { return pessoaBase; } public static ICompraBase getCompraBase(){ compraBase = new CompraBase(factory.createEntityManager()); return compraBase; } public static ICotacaoBase getCotacaoBase(){ cotacaoBase = new CotacaoBase(factory.createEntityManager()); return cotacaoBase ; } public static IPessoaFisicaBase getPessoaFisicaBase() { pessoaFisicaBase = new PessoaFisicaBase(factory.createEntityManager()); return pessoaFisicaBase; } public static IPessoaJuridicaBase getPessoaJuridica() { pessoaJuridica = new PessoaJuridicaBase(factory.createEntityManager()); return pessoaJuridica; } public static IFornecedorBase getFornecedorBase() { fornecedorBase = new FornecedorBase(factory.createEntityManager()); return fornecedorBase; } public static IClienteBase getClienteBase() { clienteBase = new ClienteBase(factory.createEntityManager()); return clienteBase; } public static IEnderecoBase getEnderecoBase() { enderecoBase = new EnderecoBase(factory.createEntityManager()); return enderecoBase; } public static IEstoqueBase getEstoqueBase() { return estoqueBase; } public static ITipoBase getTipo() { tipo = new TipoBase(factory.createEntityManager()); return tipo; } public static IEstoqueBase getEstoque() { estoqueBase = new EstoqueBase(factory.createEntityManager()); return estoqueBase; } public static IProdutoBase getProduto(){ produtoBase = new ProdutoBase(factory.createEntityManager()); return produtoBase; } public static IAnimalBase getAnimalBase() { animalBase = new AnimalBase(factory.createEntityManager()); return animalBase; } // metodos de gerenciamento static { factory = Persistence.createEntityManagerFactory("unitPSC"); } public static void close() { if (factory != null && factory.isOpen()) { factory.close(); } } public static EntityManager createEntityManager() { if (entityManager == null || !entityManager.isOpen()) { entityManager = factory.createEntityManager(); } return entityManager; } // public static void setEntityManager(EntityManager em){ // entityManager = em; // } public static void beginTransaction() { if (entityManager != null && entityManager.isOpen()) { entityManager.getTransaction().begin(); } } public static void commitTransaction() { if (entityManager != null && entityManager.isOpen()) { entityManager.getTransaction().commit(); } } public static void rollback() { if (entityManager != null && entityManager.isOpen()) { entityManager.getTransaction().rollback(); } } public static void closeEntityManager() { if (entityManager != null && entityManager.isOpen()) { try { entityManager.close(); } catch (Exception e) { e.printStackTrace(); } } } }
[ "fellypeavelino@hotmail.com" ]
fellypeavelino@hotmail.com
c76b9b9a6cf73d2d7b551b2995d0a63bfac7ecf9
f4893ae47c676f109d0077725ccc284b0ef2274e
/Lesson8/ClassWork/Frame15GuiForShop/TechShop/Service/Interface/Mag.java
ced59f073b9b394e8d713a5e098d01a7653bf4fb
[]
no_license
QuickScoper/Java-Developer
92c1b360ed3d2a95422b9789a8d87ad946973ba6
a343ff306ff05f73a4c878d1c0801ed1590310ca
refs/heads/master
2021-01-10T16:11:12.819489
2016-03-28T17:26:58
2016-03-28T17:26:58
54,908,742
0
0
null
null
null
null
UTF-8
Java
false
false
101
java
package Lesson8.ClassWork.Frame15GuiForShop.TechShop.Service.Interface; public interface Mag { }
[ "only.sololine.player@gmail.com" ]
only.sololine.player@gmail.com
1defc97cd663e2d631626485e6d7f07673aba2de
8ecff29f447f7971f113feefc35f5b63fcece9e8
/src/main/java/org/hlbc/dms/dmswebsocket/data/User.java
2b3f0070623236536b941dfd0711d04e503c7788
[]
no_license
Hackerspace-Lab-Break-Create/dms-websocket
feda9bc5d2d0fd2cacad5580b609ae2aa4145c3f
dfb8e51d7a638fc3708ab13a95594aa1e55b902e
refs/heads/main
2023-05-09T09:35:29.480090
2021-05-31T17:44:16
2021-05-31T17:44:16
371,814,590
0
0
null
null
null
null
UTF-8
Java
false
false
2,587
java
/* * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.hlbc.dms.dmswebsocket.data; import org.springframework.security.crypto.password.PasswordEncoder; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotEmpty; import java.io.Serializable; /** * Represents a user in our system. * * <p>In a real system use {@link PasswordEncoder} to ensure the password is secured properly. This * demonstration does not address this due to time restrictions. * * @author Rob Winch */ @Entity public class User implements Serializable { private static final long serialVersionUID = 2738859149330833739L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @NotEmpty(message = "First name is required.") private String firstName; @NotEmpty(message = "Last name is required.") private String lastName; @Email(message = "Please provide a valid email address.") @NotEmpty(message = "Email is required.") @Column(unique = true, nullable = false) private String email; @NotEmpty(message = "Password is required.") private String password; public User() {} public User(User user) { this.id = user.id; this.firstName = user.firstName; this.lastName = user.lastName; this.email = user.email; this.password = user.password; } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return this.firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return this.lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } }
[ "kevinsilveiradias@gmail.com" ]
kevinsilveiradias@gmail.com
08cafae01b035c9f62bd396572111974b1e2e172
f2767c19d8daf7e7ec73b892ecb2834e1016248d
/LataFillingStation/src/main/java/org/gl/com/controller/UserController.java
1c3818d2e81404f1766f47a3b840cbc033a5a117
[]
no_license
golmalyusuf/LataFillingStatitionSpringBootAngularApp
b679b0b06569f86bd2b7bf74e23eb9bfa7ae39e1
f4f824620bd20a4f7553284dc41cde57cbcce2b4
refs/heads/master
2020-08-29T18:50:49.592257
2019-11-07T18:19:53
2019-11-07T18:19:53
218,137,114
0
0
null
null
null
null
UTF-8
Java
false
false
3,003
java
package org.gl.com.controller; import java.net.URI; import java.util.Date; import java.util.List; import java.util.Optional; import javax.transaction.Transactional; import javax.validation.Valid; import org.gl.com.entity.Role; import org.gl.com.entity.User; import org.gl.com.entity.exception.ResourceNotFoundException; import org.gl.com.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; @CrossOrigin(origins = "http://localhost:4200") @RestController @RequestMapping("/lata") public class UserController { @Autowired public UserRepository userRepository; @GetMapping("/users") public List<User> getAllUsers(){ return (List<User>) userRepository.findAll(); } @GetMapping("/user/{id}") public Optional<User> getUser(@PathVariable Integer id){ return userRepository.findById(id); } @PostMapping("/save-user") @Transactional public ResponseEntity<Void> createUser(@Valid @RequestBody User user){ user.setCreatedAt(new Date()); user.setUpdatedAt(new Date()); User userCreated = userRepository.save(user); URI uri=ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(userCreated.getId()).toUri(); return ResponseEntity.created(uri).build(); } @PutMapping("/edit-user/{id}") public User editUser(@PathVariable Integer id, @Valid @RequestBody User user){ return userRepository.findById(id).map(userLocal -> { userLocal.setFirstName(user.getFirstName()); userLocal.setLastName(user.getLastName()); userLocal.setEmailId(user.getEmailId()); userLocal.setAddress(user.getAddress()); userLocal.setMobileNumber(user.getMobileNumber()); userLocal.setRole(user.getRole()); userLocal.setUpdatedBy(user.getUpdatedBy()); //NEED TO SET CURRENT TIME USER userLocal.setUpdatedAt(user.getUpdatedAt()); //NEED TO SET CURRENT TIME return userRepository.save(userLocal); }).orElseThrow(() -> new ResourceNotFoundException("PostId " + id + " not found")); } @DeleteMapping("/delete-user/{id}") public ResponseEntity<?> deleteUser(@PathVariable Integer id) { return userRepository.findById(id).map(user -> { userRepository.delete(user); return ResponseEntity.ok().build(); }).orElseThrow(() -> new ResourceNotFoundException("UserId " + id + " not found")); } }
[ "common.dsdl@gmail.com" ]
common.dsdl@gmail.com
16e63f75fc3b2f8c82e7cf048927289cc97509a7
bc459f07cdca2d3f8b15c688e1588ab284a9b4cc
/Junyoung/프로그래머스/당근마켓_3번.java
055d9385ac94c0ee8fa272752ce9898080e98cfd
[]
no_license
NevErdiEkilLeR/Competitive-Programming
ed6c2fec6ac8103d2a690fcab9e5e6162d582bd4
8aa2912f77a96e22af5554f7388472ab4de9038c
refs/heads/master
2022-12-14T10:44:44.784287
2020-09-09T09:08:24
2020-09-09T09:08:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,675
java
import java.io.*; import java.util.*; import static java.util.Arrays.*; import static java.util.stream.IntStream.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new FileReader("input.txt")); StringTokenizer st; String input; final int MAXN = (int)1e6+2; int[][] arr = new int[MAXN][2]; int idx = 0, totalSp = Integer.parseInt(br.readLine()); while((input = br.readLine()) != null){ st = new StringTokenizer(input); arr[idx][0] = Integer.parseInt(st.nextToken()); arr[idx++][1] = Integer.parseInt(st.nextToken()); } new Solution(totalSp, copyOfRange(arr, 0, idx)); } } class Solution { int root = 1, sum = 0; int[] score; List<List<Integer>> child = new ArrayList<>(); public int dfs(int node){ score[node] = child.get(node).isEmpty() ? 1 : child.get(node).stream().mapToInt(this::dfs).sum(); sum += score[node]; return score[node]; } public Solution(int totalSp, int[][] skills){ int N = skills.length+2; score = new int[N]; for(int i = 0; i < N; i++){ child.add(new ArrayList<>()); } // make tree int[] p = new int[N]; for(int[] skill : skills){ p[skill[1]] = skill[0]; child.get(skill[0]).add(skill[1]); } while(p[root] != 0) root = p[root]; // traverse score[root] = dfs(root); range(1, N).mapToObj(i -> score[i]*totalSp/sum+" ") .forEach(System.out::print); } }
[ "cupjoo@naver.com" ]
cupjoo@naver.com
434e3aeb8330204cf0c14e5d2982c660b7954600
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_3b08a4c1435dd46c764fe11e81bbe7879c407444/Application/5_3b08a4c1435dd46c764fe11e81bbe7879c407444_Application_t.java
ec699c2d0e3eca14a54a11408f3b916c81f5f89c
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
4,515
java
/** * */ package org.minnal.core; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.minnal.core.config.ApplicationConfiguration; import org.minnal.core.config.ConfigurationProvider; import org.minnal.core.config.ResourceConfiguration; import org.minnal.core.resource.ResourceClass; import org.minnal.core.route.RouteBuilder; import org.minnal.core.route.Routes; import org.minnal.core.server.exception.ApplicationException; import org.minnal.core.server.exception.ExceptionHandler; import org.minnal.core.util.Generics; import com.fasterxml.jackson.annotation.JsonValue; /** * @author ganeshs * */ public abstract class Application<T extends ApplicationConfiguration> implements Lifecycle { private List<Filter> filters = new ArrayList<Filter>(); private Routes routes = new Routes(); private Map<Class<?>, ResourceClass> resources = new HashMap<Class<?>, ResourceClass>(); private String path; private T configuration; private List<Plugin> plugins = new ArrayList<Plugin>(); private ConfigurationProvider configurationProvider = ConfigurationProvider.getDefault(); private ExceptionHandler exceptionHandler = new ExceptionHandler(); @SuppressWarnings({ "unchecked", "rawtypes" }) public Application() { this.configuration = (T) configurationProvider.provide((Class)Generics.getTypeParameter(getClass(), ApplicationConfiguration.class)); } public Application(T configuration) { this.configuration = configuration; } public ExceptionHandler getExceptionHandler() { return exceptionHandler; } public void addFilter(Filter filter) { filters.add(filter); } public void init() { registerPlugins(); addFilters(); defineResources(); defineRoutes(); for (Plugin plugin : plugins) { plugin.init(this); } } public void start() { for (ResourceClass resource : getResources()) { for (RouteBuilder builder : resource.getRouteBuilders()) { routes.addRoute(builder); } } } public void stop() { for (Plugin plugin : plugins) { plugin.destroy(); } } protected abstract void registerPlugins(); protected abstract void addFilters(); protected abstract void defineRoutes(); protected abstract void defineResources(); protected void addExceptionMapping(Class<? extends Exception> from, Class<? extends ApplicationException> to) { exceptionHandler.mapException(from, to); } protected void mapExceptions() { } protected void addResource(Class<?> resourceClass) { addResource(resourceClass, new ResourceConfiguration(resourceClass.getSimpleName(), configuration)); } protected void addResource(Class<?> resourceClass, ResourceConfiguration resourceConfiguration) { resourceConfiguration.setParent(configuration); ResourceClass resource = new ResourceClass(resourceConfiguration, resourceClass); addResource(resource); } public void addResource(ResourceClass resourceClass) { resources.put(resourceClass.getResourceClass(), resourceClass); } /** * @return the routes */ public Routes getRoutes() { return routes; } /** * Will be used by the container to set the absolute path for this application * * @return the path */ String getPath() { return path; } /** * Will be used by the container to set the absolute path for this application * * @param path the path to set */ void setPath(String path) { this.path = path; } protected ResourceClass resource(Class<?> clazz) { if (! resources.containsKey(clazz)) { throw new MinnalException("Resource - " + clazz.getName() + " not found"); } return resources.get(clazz); } /** * Returns all the resources managed by this application * * @return */ public Collection<ResourceClass> getResources() { return resources.values(); } /** * @return the configuration */ public T getConfiguration() { return configuration; } public void registerPlugin(Plugin plugin) { plugins.add(plugin); } /** * @return the filters */ public List<Filter> getFilters() { return Collections.unmodifiableList(filters); } public boolean shouldInstrument() { return false; } @JsonValue @Override public String toString() { return configuration.getName(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
ca0804fcd1d51bebcc4cc48e47f3d1c14a755f11
f847d6be99b4bd427cbbc8417f42668ca08a13eb
/app/src/main/java/com/example/thewitsapp/ActiveDiscussions.java
5db6dc3983f32897f12f9eb769d1afd0c163f478
[]
no_license
Google-s-Garage/Wits-App
086373f9a8555ccc2a942ab0c228f9f6f0c24ab4
30db84b089ee8c7f6b641489cbd1deb8f975e0b9
refs/heads/master
2021-02-07T05:17:07.936734
2020-10-12T11:59:00
2020-10-12T11:59:00
243,987,465
1
2
null
2020-09-14T22:56:40
2020-02-29T14:54:02
Java
UTF-8
Java
false
false
3,950
java
package com.example.thewitsapp; import android.annotation.SuppressLint; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class ActiveDiscussions extends Fragment { //private LinearLayout linearLayout; public static int msgID; public static String safeUsername; public static String Msg; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_active_discussions, container, false); init(view); return view; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); init(view); } @SuppressLint("StaticFieldLeak") private void init(View view) { final LinearLayout linearLayout = view.findViewById(R.id.activeDiscLayout); ContentValues contentValues = new ContentValues(); contentValues.put("USER_ID", MainActivity.userID); //firstly need to change and create a php to give u all your messages new ServerCommunicator("https://lamp.ms.wits.ac.za/~s1872817/allSafeMsgs.php", contentValues) { @Override protected void onPostExecute(String output) { try { linearLayout.removeAllViews(); JSONArray jsonArray = new JSONArray(output); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); final Context context = getActivity().getApplicationContext(); @SuppressLint("StaticFieldLeak") final View view = View.inflate(context, R.layout.messages, null); final TextView name = view.findViewById(R.id.name); final TextView message = view.findViewById(R.id.message); TextView date = view.findViewById(R.id.date); final TextView id = view.findViewById(R.id.MSG_ID); name.setText(jsonObject.getString("SAFE_NAME")); message.setText(jsonObject.getString("SAFE_MSG")); date.setText(jsonObject.getString("SAFE_DATE")); id.setText(jsonObject.getString("SAFE_MSG_ID")); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { msgID = Integer.parseInt(id.getText().toString().trim()); safeUsername = name.getText().toString().trim(); Msg = message.getText().toString().trim(); startActivity(new Intent(context, ActiveDiscussionsB.class)); } }); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(10,10,10,10); linearLayout.addView(view,params); } } catch (JSONException e) { e.printStackTrace(); } } }.execute(); } }
[ "mzilasizwe@gmail.com" ]
mzilasizwe@gmail.com
93a90ae7a0cdda334b6f592d568eaa6011ac9259
eee87ddb944c08073f8db2d41aa47a0970ae6e50
/src/com/company/builderMode/Meal.java
06b88e3cad2600c2c9fa2d05cdad9ba6e3fda67c
[]
no_license
MAGRY-GIT/DesignPatternsDemo
009c8def8e61797dc28fdce2341df3942d2a818a
74d9307bf0cb616c0978711207282ec492329069
refs/heads/master
2023-07-13T17:06:39.350135
2021-08-18T05:19:02
2021-08-18T05:19:02
227,073,864
0
0
null
null
null
null
UTF-8
Java
false
false
723
java
package com.company.builderMode; import com.company.builderMode.core.item.Item; import java.util.ArrayList; import java.util.List; /** * @author MGARY * @date 2019-11-26 下午5:19 */ class Meal { private List<Item> items = new ArrayList<>(); void addItem(Item item){ items.add(item); } float getCost(){ float cost = 0.0f; for (Item item : items) { cost += item.price(); } return cost; } void showItems(){ for (Item item : items) { System.out.print("Item : "+item.name()); System.out.print(", Packing : "+item.packing().pack()); System.out.println(", Price : "+item.price()); } } }
[ "1637552108@qq.com" ]
1637552108@qq.com
f62b05a823d92f0f22da6a5b34eb582b8669327a
382fba9fc0398117efecea655588589f7d378fc3
/src/Sprite.java
ff0f5a939e4969689abbefcb91ae05008b6eed0b
[]
no_license
verbal-noun/shadow-defend-java
4f02ef163832f4eb9a37f1e388b99831041c7e06
cd446a3aed26fdaf069fe0e639d3b1502840f518
refs/heads/master
2022-10-09T00:04:27.277261
2020-06-15T09:52:54
2020-06-15T09:52:54
272,391,652
1
0
null
null
null
null
UTF-8
Java
false
false
1,728
java
import bagel.DrawOptions; import bagel.Image; import bagel.util.Point; import bagel.util.Rectangle; import bagel.util.Vector2; /** * Sprite Abstract Class implementation taken from Project-1 Solution * I acknowledge the implementation of this class is not mine. */ public abstract class Sprite { protected Image image; protected Rectangle rect; protected double angle; /** * Creates a new Sprite (game entity) * * @param point The starting point for the entity * @param imageSrc The image which will be rendered at the entity's point */ public Sprite(Point point, String imageSrc) { this.image = new Image(imageSrc); this.rect = image.getBoundingBoxAt(point); this.angle = 0; } /** * Gets bounding box of the entity. * * @return the rect of class Rectangle. */ public Rectangle getRect() { return new Rectangle(rect); } /** * Move the game entity by dx amount * * @param dx - the amount by which the entity needs to be moves */ public void move(Vector2 dx) { rect.moveTo(rect.topLeft().asVector().add(dx).asPoint()); } /** * Gets center of the game entity * * @return the center as a Point object */ public Point getCenter() {return getRect().centre(); } /** * Sets angle of the entity * * @param angle - the angle which will be set */ public void setAngle(double angle) { this.angle = angle; } /** * Updates the Sprite. Default behaviour is to render the Sprite at its current position. */ public void render() { image.draw(getCenter().x, getCenter().y, new DrawOptions().setRotation(angle)); } }
[ "kahsan@student.unimelb.edu.au" ]
kahsan@student.unimelb.edu.au
863969cf101433a7aefe92c454964cd11547936e
740c53df1130a7bc85043e44f1a09f59d9c756f6
/src/main/java/com/domain/WsRoom.java
e0030e87ad6390f96c12b13800ee14bfa1f0658f
[]
no_license
pijunqi/TestWork
d72cc4b56edd60dcb958e032855e2da4b63f7f1b
c9251ff207c0886465fe4acb02baf8f58b3147a8
refs/heads/master
2020-09-29T13:12:46.923046
2020-01-04T03:34:29
2020-01-04T03:34:29
227,044,287
0
0
null
null
null
null
UTF-8
Java
false
false
306
java
package com.domain; import lombok.Getter; import lombok.Setter; import lombok.ToString; @Getter @Setter @ToString public class WsRoom { private String id; /** * 房间名称 */ private String name; /** * 类型: 1-胃镜;2-肠镜;3-胃肠镜 */ private Short type; }
[ "464553387@qq.com" ]
464553387@qq.com
96b3c84708d33c153252b2f84b7205f2263c9197
89aab1fcd4274b3951dbd8290b204f045f4da624
/components/ml/org.wso2.carbon.ml.core/src/main/java/org/wso2/carbon/ml/core/utils/BlockingExecutor.java
d6a5a7f300a23cdaf4c3166198ef0768f56bdcf2
[ "Apache-2.0" ]
permissive
wso2/carbon-ml
2bd340476aec881447e97a4912be7878bb629c18
4191abc83852ca511e30b25dc5934768c16060da
refs/heads/master
2023-09-03T20:12:27.574287
2018-03-14T15:00:32
2018-03-14T15:00:32
35,467,512
36
61
Apache-2.0
2018-03-14T14:51:41
2015-05-12T04:50:29
Java
UTF-8
Java
false
false
3,091
java
/* * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.carbon.ml.core.utils; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.Semaphore; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * An executor which blocks and prevents further tasks from being submitted to the pool when the queue is full. * <p> * Based on the BoundedExecutor example in: Brian Goetz, 2006. Java Concurrency in Practice. (Listing 8.4) */ public class BlockingExecutor extends ThreadPoolExecutor { private static final Log log = LogFactory.getLog(BlockingExecutor.class); private final Semaphore semaphore; /** * Creates a BlockingExecutor which will block and prevent further submission to the pool when the specified queue * size has been reached. * * @param poolSize the number of the threads in the pool * @param queueSize the size of the queue */ public BlockingExecutor(final int poolSize, final int queueSize) { super(poolSize, poolSize, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); // the semaphore is bounding both the number of tasks currently executing // and those queued up semaphore = new Semaphore(poolSize + queueSize); } /** * Executes the given task. This method will block when the semaphore has no permits i.e. when the queue has reached * its capacity. */ @Override public void execute(final Runnable task) { boolean acquired = false; do { try { semaphore.acquire(); acquired = true; } catch (final InterruptedException e) { log.warn("InterruptedException while acquiring the semaphore", e); } } while (!acquired); try { super.execute(task); } catch (final RejectedExecutionException e) { semaphore.release(); throw e; } } /** * Method invoked upon completion of execution of the given Runnable, by the thread that executed the task. Releases * a semaphore permit. */ @Override public void afterExecute(final Runnable r, final Throwable t) { super.afterExecute(r, t); semaphore.release(); } }
[ "nirmal070125@gmail.com" ]
nirmal070125@gmail.com
ab4e3c1d7a7b49fc5858c50f62c20272d8a8018d
1ca86d5d065372093c5f2eae3b1a146dc0ba4725
/apache-libraries/src/test/java/com/surya/apache/opennlp/ChunkerUnitTest.java
cd2ec39c91cde260bd1e31e9329804feabe96e8c
[]
no_license
Suryakanta97/DemoExample
1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e
5c6b831948e612bdc2d9d578a581df964ef89bfb
refs/heads/main
2023-08-10T17:30:32.397265
2021-09-22T16:18:42
2021-09-22T16:18:42
391,087,435
0
1
null
null
null
null
UTF-8
Java
false
false
1,411
java
package com.surya.apache.opennlp; import java.io.FileInputStream; import java.io.InputStream; import opennlp.tools.chunker.ChunkerME; import opennlp.tools.chunker.ChunkerModel; import opennlp.tools.postag.POSModel; import opennlp.tools.postag.POSTaggerME; import opennlp.tools.tokenize.SimpleTokenizer; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; public class ChunkerUnitTest { @Test public void givenChunkerModel_whenChunk_thenChunksAreDetected() throws Exception { SimpleTokenizer tokenizer = SimpleTokenizer.INSTANCE; String[] tokens = tokenizer.tokenize("He reckons the current account deficit will narrow to only 8 billion."); InputStream inputStreamPOSTagger = getClass().getResourceAsStream("/models/en-pos-maxent.bin"); POSModel posModel = new POSModel(inputStreamPOSTagger); POSTaggerME posTagger = new POSTaggerME(posModel); String tags[] = posTagger.tag(tokens); InputStream inputStreamChunker = new FileInputStream("src/main/resources/models/en-chunker.bin"); ChunkerModel chunkerModel = new ChunkerModel(inputStreamChunker); ChunkerME chunker = new ChunkerME(chunkerModel); String[] chunks = chunker.chunk(tokens, tags); assertThat(chunks).contains("B-NP", "B-VP", "B-NP", "I-NP", "I-NP", "I-NP", "B-VP", "I-VP", "B-PP", "B-NP", "I-NP", "I-NP", "O"); } }
[ "suryakanta97@github.com" ]
suryakanta97@github.com
549ab7e79524e883f74f21fc7844f1e245cafdb8
07aca827dff5955cbf0bcaf5d77387f500d346f3
/K19-JPA2-Hibernate/src/br/com/k19/modelo/Autor.java
03a1167c4b70874b4fa683febd805f089607ab4d
[]
no_license
KleitonRufino/projetos-persistencia
6b3d03b66134268d9899e6bb8b38707993fbf299
ff8c8858dff067c295d8899a606c96c6f7dbef2e
refs/heads/master
2021-01-19T20:18:19.122131
2016-11-21T03:46:19
2016-11-21T03:46:19
22,653,034
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package br.com.k19.modelo; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Autor { @Id @GeneratedValue private long id; private String nome; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
[ "kleitonhd@hotmail.com" ]
kleitonhd@hotmail.com
9e65cd4eff764093ad0ec59615689ffc218c58da
0bcd608d1a63be5af9d6c9c8f1b895b53c64cbb4
/app/src/main/java/com/foodorder/tatsuya/foodorder/activity/LoginActivity.java
3c93dcb875867424f1a117368795f52e532020de
[]
no_license
TrieuHiep/FoodOrderWebService
338793856c8e6b70585cc17603c75272eddb08bb
62260227ab85ce713cc6c222530975ea75a58a16
refs/heads/master
2020-03-14T12:04:20.758415
2018-05-08T17:35:59
2018-05-08T17:35:59
131,603,683
0
0
null
null
null
null
UTF-8
Java
false
false
6,093
java
package com.foodorder.tatsuya.foodorder.activity; 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 android.widget.TextView; import android.widget.Toast; import com.facebook.AccessToken; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.GraphRequest; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.foodorder.tatsuya.foodorder.R; import com.foodorder.tatsuya.foodorder.utils.UserSession; import com.foodorder.tatsuya.foodorder.model.personpkg.Account; import com.foodorder.tatsuya.foodorder.model.personpkg.Person; import com.foodorder.tatsuya.foodorder.task.FacebookRegistration; import com.foodorder.tatsuya.foodorder.task.LoginTask; import com.foodorder.tatsuya.foodorder.task.OnTaskCompleted; import com.foodorder.tatsuya.foodorder.utils.EndPoint; import org.json.JSONException; import org.json.JSONObject; import java.util.Arrays; public class LoginActivity extends AppCompatActivity implements OnTaskCompleted<Boolean> { private Button btnLogin; private TextView tvRegister, tvFacebook; private EditText edtUsername, edtPassword; CallbackManager callbackManager = CallbackManager.Factory.create(); private LoginButton btnLoginFacebook; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); init(); if (AccessToken.getCurrentAccessToken() != null) { System.out.println("access token not null!"); } else{ System.out.println("access token is null!"); } } private void init() { tvRegister = findViewById(R.id.tvRegister); btnLogin = findViewById(R.id.btnLogin); edtUsername = findViewById(R.id.edtUsername); edtPassword = findViewById(R.id.edtPassword); // tvFacebook = findViewById(R.id.tv_facebook); tvRegister.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(LoginActivity.this, RegisterActivity.class)); } }); btnLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String username = edtUsername.getText().toString(); String password = edtPassword.getText().toString(); Account account = new Account(); account.setPassword(password); account.setUsername(username); new LoginTask(LoginActivity.this, LoginActivity.this).execute(account); } }); this.btnLoginFacebook = findViewById(R.id.fb_login_btn); this.btnLoginFacebook.setReadPermissions(Arrays.asList("email", "user_birthday", "public_profile")); this.btnLoginFacebook.registerCallback( callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { GraphRequest request = GraphRequest.newMeRequest( loginResult.getAccessToken(), (object, response) -> { Log.d("response", object.toString()); parseDataFromFB(object); } ); Bundle bundle = new Bundle(); bundle.putString("fields", "id, email, birthday, name"); request.setParameters(bundle); request.executeAsync(); } @Override public void onCancel() { System.out.println("Login canceled."); } @Override public void onError(FacebookException e) { System.out.println("Login failed."); } }); } private void parseDataFromFB(JSONObject object) { String email = null; try { email = object.getString("email"); } catch (JSONException e) { email = "test@gmail.com"; } String name = null; try { name = object.getString("name"); String userID = object.getString("id"); Account account = new Account(userID, "NULL"); Person person = new Person(account, 23, name); UserSession.getInstance().putAccount(this, account); new FacebookRegistration(this, new EndPoint<>(), person, email).execute(); Intent intent = new Intent(LoginActivity.this, MainActivity.class); super.startActivity(intent); } catch (JSONException e) { e.printStackTrace(); } } @Override public void handle(Boolean value) { if (value) { Toast.makeText(LoginActivity.this, "Login successfully!", Toast.LENGTH_SHORT).show(); String username = edtUsername.getText().toString(); String password = edtPassword.getText().toString(); Account account = new Account(username, password); UserSession.getInstance().putAccount(this, account); Intent intent = new Intent(LoginActivity.this, MainActivity.class); super.startActivity(intent); } else { Toast.makeText(LoginActivity.this, "Login failed!", Toast.LENGTH_SHORT).show(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { this.callbackManager.onActivityResult(requestCode, resultCode, data); } }
[ "trieuhiepptit@gmail.com" ]
trieuhiepptit@gmail.com
21eb3a8a58714be41e8977996434d4f72e9a8efb
df5aea3247ef5b37b83b7bf472f91026c5742295
/TheMotivator/src/com/example/themotivator/applist/app/AppData.java
75910d97aec481f6a666b4d9a80a940fbb84d03d
[]
no_license
expected/ubi
793876ca7ca35f16abc45336848b152ad5bba47e
7e5818da39415f7c6729167ab3a87ab71e9bc33c
refs/heads/master
2016-09-06T04:44:01.669544
2014-06-27T15:56:26
2014-06-27T15:56:26
21,079,267
0
1
null
null
null
null
UTF-8
Java
false
false
379
java
package com.example.themotivator.applist.app; import android.app.Application; import android.content.pm.PackageInfo; public class AppData extends Application { PackageInfo packageInfo; public PackageInfo getPackageInfo() { return packageInfo; } public void setPackageInfo(PackageInfo packageInfo) { this.packageInfo = packageInfo; } }
[ "toni@informatik.uni-bremen.de" ]
toni@informatik.uni-bremen.de
a7c4106b03fecd3c99c2baf035efb79e7b19953b
e06998a351e40f611a0470ef95d7b2c2d4cebd82
/src/test/java/com/krooj/practice/ch1/Testch1Q1.java
b2387e63725808a309e6c445728b589ff3ac858f
[]
no_license
krooj/practice
8f0a65acebe4a7241afbaf23ece1364c47e8ffda
c27f0e938cbe643a1069688824b4deb38bdb56f7
refs/heads/master
2021-01-21T22:26:51.896118
2014-03-22T22:50:13
2014-03-22T22:50:13
17,889,267
0
0
null
null
null
null
UTF-8
Java
false
false
1,130
java
package com.krooj.practice.ch1; import org.junit.Assert; import org.junit.Before; import org.junit.Test; /** * Created by admin on 2014-03-18. */ public class Testch1Q1 { private Ch1Q1 ch1Q1; @Before public void setUp(){ ch1Q1 = new Ch1Q1(); } @Test public void testLenZero(){ Assert.assertTrue(ch1Q1.allUnique("")); } @Test public void testLenOne(){ Assert.assertTrue(ch1Q1.allUnique("a")); } @Test public void testLenGtOneAllUnique(){ Assert.assertTrue(ch1Q1.allUnique("abc123")); } @Test public void testLenGtOneNonUnique(){ Assert.assertFalse(ch1Q1.allUnique("abcc123")); } @Test public void testLenZeroV2(){ Assert.assertTrue(ch1Q1.allUniqueV2("")); } @Test public void testLenOneV2(){ Assert.assertTrue(ch1Q1.allUniqueV2("a")); } @Test public void testLenGtOneAllUniqueV2(){ Assert.assertTrue(ch1Q1.allUniqueV2("abc123")); } @Test public void testLenGtOneNonUniqueV2(){ Assert.assertFalse(ch1Q1.allUniqueV2("abcc123")); } }
[ "michael.kuredjian@gmail.com" ]
michael.kuredjian@gmail.com
d200242c2c64ea6989d4ec2fd7bd88cfe2c6d8fb
0a12bd827c3c48add9f5f400763a87ea69631faf
/aop/src/main/java/bboss/org/jgroups/protocols/FILE_PING.java
4dd8e43f72b86894b69d0ca5672b22fba6ced5b2
[]
no_license
sqidea/bboss
76c64dea2e0ecd2c8d4b7269021e37f58a5b4071
d889e252d2bbf57681072fcd250a9e4da42f5938
refs/heads/master
2021-01-18T18:50:21.077011
2013-10-15T15:31:53
2013-10-15T15:31:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,855
java
package bboss.org.jgroups.protocols; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import bboss.org.jgroups.Address; import bboss.org.jgroups.Event; import bboss.org.jgroups.Message; import bboss.org.jgroups.PhysicalAddress; import bboss.org.jgroups.View; import bboss.org.jgroups.annotations.Experimental; import bboss.org.jgroups.annotations.Property; import bboss.org.jgroups.util.Promise; import bboss.org.jgroups.util.UUID; import bboss.org.jgroups.util.Util; /** * Simple discovery protocol which uses a file on shared storage such as an SMB share, NFS mount or S3. The local * address information, e.g. UUID and physical addresses mappings are written to the file and the content is read and * added to our transport's UUID-PhysicalAddress cache.<p/> * The design is at doc/design/FILE_PING.txt * @author Bela Ban * @version $Id: FILE_PING.java,v 1.19 2010/06/17 14:57:15 belaban Exp $ */ @Experimental public class FILE_PING extends Discovery { protected static final String SUFFIX=".node"; /* ----------------------------------------- Properties -------------------------------------------------- */ @Property(description="The absolute path of the shared file") protected String location=File.separator + "tmp" + File.separator + "jgroups"; @Property(description="Interval (in milliseconds) at which the own address is written to the file system. 0 disables it.") protected long interval=60000; /* --------------------------------------------- Fields ------------------------------------------------------ */ protected File root_dir=null; protected FilenameFilter filter; private ScheduledFuture<?> writer_future; public void init() throws Exception { super.init(); createRootDir(); } public void start() throws Exception { super.start(); if(interval > 0) writer_future=timer.scheduleWithFixedDelay(new WriterTask(), interval, interval, TimeUnit.MILLISECONDS); } public void stop() { if(writer_future != null) { writer_future.cancel(false); writer_future=null; } super.stop(); } public void sendGetMembersRequest(String cluster_name, Promise promise, boolean return_views_only) throws Exception{ List<PingData> existing_mbrs=readAll(cluster_name); PhysicalAddress physical_addr=(PhysicalAddress)down(new Event(Event.GET_PHYSICAL_ADDRESS, local_addr)); List<PhysicalAddress> physical_addrs=Arrays.asList(physical_addr); PingData data=new PingData(local_addr, null, false, UUID.get(local_addr), physical_addrs); // If we don't find any files, return immediately if(existing_mbrs.isEmpty()) { if(promise != null) { promise.setResult(null); } } else { // 1. Send GET_MBRS_REQ message to members listed in the file for(PingData tmp: existing_mbrs) { Collection<PhysicalAddress> dests=tmp != null? tmp.getPhysicalAddrs() : null; if(dests == null) continue; for(final PhysicalAddress dest: dests) { if(dest == null || dest.equals(physical_addr)) continue; PingHeader hdr=new PingHeader(PingHeader.GET_MBRS_REQ, data, cluster_name); hdr.return_view_only=return_views_only; final Message msg=new Message(dest); msg.setFlag(Message.OOB); msg.putHeader(this.id, hdr); // needs to be getName(), so we might get "MPING" ! // down_prot.down(new Event(Event.MSG, msg)); if(log.isTraceEnabled()) log.trace("[FIND_INITIAL_MBRS] sending PING request to " + msg.getDest()); timer.execute(new Runnable() { public void run() { try { down_prot.down(new Event(Event.MSG, msg)); } catch(Exception ex){ if(log.isErrorEnabled()) log.error("failed sending discovery request to " + dest, ex); } } }); } } } // Write my own data to file writeToFile(data, cluster_name); } public Object down(Event evt) { Object retval=super.down(evt); if(evt.getType() == Event.VIEW_CHANGE) handleView((View)evt.getArg()); return retval; } protected void createRootDir() { root_dir=new File(location); if(root_dir.exists()) { if(!root_dir.isDirectory()) throw new IllegalArgumentException("location " + root_dir.getPath() + " is not a directory"); } else { root_dir.mkdirs(); } if(!root_dir.exists()) throw new IllegalArgumentException("location " + root_dir.getPath() + " could not be accessed"); filter=new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(SUFFIX); } }; } // remove all files which are not from the current members protected void handleView(View view) { Collection<Address> mbrs=view.getMembers(); boolean is_coordinator=!mbrs.isEmpty() && mbrs.iterator().next().equals(local_addr); if(is_coordinator) { List<PingData> data=readAll(group_addr); for(PingData entry: data) { Address addr=entry.getAddress(); if(addr != null && !mbrs.contains(addr)) { remove(group_addr, addr); } } } } protected void remove(String clustername, Address addr) { if(clustername == null || addr == null) return; File dir=new File(root_dir, clustername); if(!dir.exists()) return; try { String filename=addr instanceof UUID? ((UUID)addr).toStringLong() : addr.toString(); File file=new File(dir, filename + SUFFIX); if(log.isTraceEnabled()) log.trace("removing " + file); file.delete(); } catch(Throwable e) { log.error("failure removing data", e); } } /** * Reads all information from the given directory under clustername * @return */ protected List<PingData> readAll(String clustername) { List<PingData> retval=new ArrayList<PingData>(); File dir=new File(root_dir, clustername); if(!dir.exists()) dir.mkdir(); File[] files=dir.listFiles(filter); if(files != null) { for(File file: files) retval.add(readFile(file)); } return retval; } protected static PingData readFile(File file) { PingData retval=null; DataInputStream in=null; try { in=new DataInputStream(new FileInputStream(file)); PingData tmp=new PingData(); tmp.readFrom(in); return tmp; } catch(Exception e) { } finally { Util.close(in); } return retval; } protected void writeToFile(PingData data, String clustername) { DataOutputStream out=null; File dir=new File(root_dir, clustername); if(!dir.exists()) dir.mkdir(); String filename=local_addr instanceof UUID? ((UUID)local_addr).toStringLong() : local_addr.toString(); File file=new File(dir, filename + SUFFIX); file.deleteOnExit(); try { out=new DataOutputStream(new FileOutputStream(file)); data.writeTo(out); } catch(Exception e) { } finally { Util.close(out); } } protected class WriterTask implements Runnable { public void run() { PhysicalAddress physical_addr=(PhysicalAddress)down(new Event(Event.GET_PHYSICAL_ADDRESS, local_addr)); List<PhysicalAddress> physical_addrs=Arrays.asList(physical_addr); PingData data=new PingData(local_addr, null, false, UUID.get(local_addr), physical_addrs); writeToFile(data, group_addr); } } }
[ "gao.tang@oceanwing.com" ]
gao.tang@oceanwing.com
76c80790cd0d603cb09943fb27440386e8ba79c8
99a2c35ae486e64f4a20d376a9698ee6a15f5b80
/I2C.SPI/src/main/java/i2c/sensor/utils/PWMPin.java
f1d818e92018006cb0b294ade02d53213b509cf6
[]
no_license
chYatima03/raspberry-coffee
c50278e00eba4c5a9ec30269b552d2091d703ccf
6394b0388746ee17fceb2cac04564a8fa8561ea7
refs/heads/master
2020-12-23T01:43:23.988498
2020-01-21T21:20:56
2020-01-21T21:20:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,590
java
package i2c.sensor.utils; import com.pi4j.io.gpio.Pin; import com.pi4j.io.gpio.PinState; /** * "pure" PWM implementation. * Suitable for an LED, not for a servo (cycle width...) */ public class PWMPin extends GPIOPinAdapter { // 30 seems to be the maximum value. // You can really see the led blinking beyond that. private final static int CYCLE_WIDTH = 30; // ms private final Thread mainThread; private final boolean debug = "true".equals(System.getProperty("debug", "false")); public PWMPin(Pin p, String name, PinState originalState) { super(p, name, originalState); mainThread = Thread.currentThread(); } private boolean emittingPWM = false; private int pwmVolume = 0; // [0..CYCLE_WIDTH], percent / (100 / CYCLE_WIDTH); public void emitPWM(final int percent) { if (percent < 0 || percent > 100) { throw new IllegalArgumentException("Percent MUST be in [0, 100], not [" + percent + "]"); } if (debug) { System.out.println("Volume:" + percentToVolume(percent) + "/" + CYCLE_WIDTH); } Thread pwmThread = new Thread(() -> { emittingPWM = true; pwmVolume = percentToVolume(percent); while (emittingPWM) { if (pwmVolume > 0) { pin.pulse(pwmVolume, true); // set second argument to 'true' makes a blocking call } pin.low(); waitFor(CYCLE_WIDTH - pwmVolume); // Wait for the rest of the cycle } System.out.println("Stopping PWM"); // Notify the ones waiting for this thread to end synchronized (mainThread) { mainThread.notify(); } }); pwmThread.start(); } /** * return a number in [0..CYCLE_WIDTH] * * @param percent in [0..100] * @return a number in [0..CYCLE_WIDTH] */ private int percentToVolume(int percent) { if (percent < 0 || percent > 100) { throw new IllegalArgumentException("Percent MUST be in [0, 100], not [" + percent + "]"); } return percent / (100 / CYCLE_WIDTH); } public void adjustPWMVolume(int percent) { if (percent < 0 || percent > 100) { throw new IllegalArgumentException("Percent MUST be in [0, 100], not [" + percent + "]"); } pwmVolume = percentToVolume(percent); } public boolean isPWMing() { return emittingPWM; } public void stopPWM() { emittingPWM = false; synchronized (mainThread) { try { mainThread.wait(); } catch (InterruptedException ie) { System.out.println(ie.toString()); } } pin.low(); } private void waitFor(long ms) { // TODO Manage nano secs? Or use delay? if (ms > 0) { try { Thread.sleep(ms); } catch (InterruptedException ie) { ie.printStackTrace(); } } } }
[ "olivier.lediouris@oracle.com" ]
olivier.lediouris@oracle.com
c0a45af4966fc191c82fa276370c91c416a4fbdc
faebc0badfefc738b34e27da105444926feffe12
/sistemabancario-dao/src/main/java/net/tecgurus/sistemabancario/entities/Login.java
c2f168744214950c78b9821951629650cf482cd0
[]
no_license
di3gokanon/sistemabancario
519d978ea977e6f41218d411d425307e1c27c6e3
6c5307468200261171de48ddb473cd2d003a583e
refs/heads/master
2020-04-14T13:50:29.868382
2019-01-02T22:04:33
2019-01-02T22:04:33
163,880,137
0
0
null
null
null
null
UTF-8
Java
false
false
2,854
java
package net.tecgurus.sistemabancario.entities; // Generated 23-dic-2017 11:01:38 by Hibernate Tools 5.2.6.Final import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.hibernate.annotations.NamedQueries; import org.hibernate.annotations.NamedQuery; /** * Login generated by hbm2java */ @NamedQueries({ @NamedQuery(name="consultarUsuario", query="from Login where usuario = :user and password = :pass ") }) @Entity @Table(name = "login", catalog = "sistemabancario") public class Login implements java.io.Serializable { private Integer idUsuario; private Perfil perfil; private String nombre; private String apaterno; private String amaterno; private String usuario; private String password; public Login() { } public Login(Perfil perfil, String nombre, String usuario, String password) { this.perfil = perfil; this.nombre = nombre; this.usuario = usuario; this.password = password; } public Login(Perfil perfil, String nombre, String apaterno, String amaterno, String usuario, String password) { this.perfil = perfil; this.nombre = nombre; this.apaterno = apaterno; this.amaterno = amaterno; this.usuario = usuario; this.password = password; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "idUsuario", unique = true, nullable = false) public Integer getIdUsuario() { return this.idUsuario; } public void setIdUsuario(Integer idUsuario) { this.idUsuario = idUsuario; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "idPerfil", nullable = false) public Perfil getPerfil() { return this.perfil; } public void setPerfil(Perfil perfil) { this.perfil = perfil; } @Column(name = "nombre", nullable = false, length = 30) public String getNombre() { return this.nombre; } public void setNombre(String nombre) { this.nombre = nombre; } @Column(name = "apaterno", length = 30) public String getApaterno() { return this.apaterno; } public void setApaterno(String apaterno) { this.apaterno = apaterno; } @Column(name = "amaterno", length = 30) public String getAmaterno() { return this.amaterno; } public void setAmaterno(String amaterno) { this.amaterno = amaterno; } @Column(name = "usuario", nullable = false, length = 10) public String getUsuario() { return this.usuario; } public void setUsuario(String usuario) { this.usuario = usuario; } @Column(name = "password", nullable = false, length = 10) public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } }
[ "diego.paniagua.kanon89@gmail.com" ]
diego.paniagua.kanon89@gmail.com
d6090706240fe3e11cdf9e55c2d151e59e990008
15dde31f967295820c05250f5b1de029864c8f31
/Beginner-Course/ConstrainMyLayout/app/src/androidTest/java/com/takealot/constrainmylayout/ExampleInstrumentedTest.java
d2ddd15755389cbbf30af2041150c529b0b23114
[]
no_license
Kaylen-Pillay/android-training
ae44874b5b96097410f83a2755953b66cf2a894f
eb867d20c199414dcd50594b0329a2d45a0a98b1
refs/heads/master
2020-04-28T08:55:00.584716
2019-03-15T07:22:33
2019-03-15T07:22:33
175,147,320
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package com.takealot.constrainmylayout; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.takealot.constrainmylayout", appContext.getPackageName()); } }
[ "kaylen.pillay@takealot.com" ]
kaylen.pillay@takealot.com
1173a4a98841c651bb1c210e6187c76d1d11d207
0d99f22858afa00110201dccd2f177a04812bd94
/src/main/java/jp/plusplus/fbs/world/biome/WorldGenDirtyBirch.java
adff181b5f6711da332480597e05098abf6deaf5
[]
no_license
faroreJP/Insanity-Assorted-Magics
8123f70ac8c98dd85925fa1880a8591fdfffbc4d
fc2dddf445cbd2539d498f0dee172b05b28c58c4
refs/heads/master
2021-01-09T20:26:27.050434
2016-06-01T15:03:59
2016-06-01T15:03:59
60,179,531
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package jp.plusplus.fbs.world.biome; /** * Created by plusplus_F on 2015/08/20. * 紅葉した白樺 */ public class WorldGenDirtyBirch extends WorldGenDirtyOak { public WorldGenDirtyBirch(boolean notify) { super(notify, false); woodMeta=2; leaveMeta=1; } }
[ "creator.farore@gmail.com" ]
creator.farore@gmail.com
9e9d0fcb55ab0ab4bfa00283bc17b9d98fa2696f
31047edd17aa66a9036a7bdd6c56f8bc9295d5aa
/src/main/java/ua/com/bzabza/ehcs/role/privilege/Privilege.java
e52a09ea3c88e647d25d49a903ae38eba7fc18c8
[]
no_license
vradhi/electronic-health-card-system
89f6a4e57e3f21432061cbd749e5f1cf1345db49
31744d4ef9876026b8d216f5e906828c58535e92
refs/heads/master
2020-05-20T23:56:19.363213
2017-05-17T11:38:56
2017-05-17T11:38:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
package ua.com.bzabza.ehcs.role.privilege; import lombok.*; import ua.com.bzabza.ehcs.role.Role; import javax.persistence.*; import java.util.Collection; @RequiredArgsConstructor @NoArgsConstructor @Entity @Table(name = "privileges") public class Privilege { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @NonNull private String name; @ManyToMany(mappedBy = "privileges") private Collection<Role> roles; }
[ "aelmod@mail.ru" ]
aelmod@mail.ru
6fa8a4d8f9e093456e0db7b9c60ac030f08d5ded
bbe9bc33fc66c51959874a6d04ff6aaa60ffa1b6
/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/params/ParamFlowRuleNacosPublisher.java
63ef942f486a2f3ce4e4c297871705199437af9c
[]
no_license
ZhuBobi/sentinel-1.6.3
d4a5b4f0fedbb4d619d2cfb295fe0583a97d8ab2
0c2e022e62966bd569eb3ae23893dede91c7ea0f
refs/heads/main
2023-07-01T06:15:42.893176
2021-08-05T02:54:17
2021-08-05T02:54:17
392,698,660
2
1
null
null
null
null
UTF-8
Java
false
false
1,359
java
package com.alibaba.csp.sentinel.dashboard.rule.nacos.params; import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.ParamFlowRuleEntity; import com.alibaba.csp.sentinel.dashboard.rule.DynamicRulePublisher; import com.alibaba.csp.sentinel.dashboard.rule.nacos.NacosConfig; import com.alibaba.csp.sentinel.dashboard.rule.nacos.NacosConsantTxt; import com.alibaba.csp.sentinel.dashboard.rule.nacos.RuleTypeEnum; import com.alibaba.csp.sentinel.util.AssertUtil; import com.alibaba.nacos.api.config.ConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @Component("paramFlowRuleNacosPublisher") public class ParamFlowRuleNacosPublisher implements DynamicRulePublisher<List<ParamFlowRuleEntity>>{ @Autowired private ConfigService configService; @Autowired private NacosConfig<ParamFlowRuleEntity> nacosConfig; @Override public void publish (String app, List<ParamFlowRuleEntity> rules) throws Exception{ AssertUtil.notEmpty(app, NacosConsantTxt.APP_NAME_NULL_ERROR); if (rules == null){ return; } configService.publishConfig(app + NacosConsantTxt.SENTINEL_POSTFIX + RuleTypeEnum.PARAMS.getPostfix(), NacosConsantTxt.GROUP_ID, nacosConfig.ruleEntityEncoder().convert(rules)); } }
[ "zhubo@chinaexpressair.com" ]
zhubo@chinaexpressair.com
c5231fc94ce221e532b2dd70d4493b78a1a0795b
faee4c1cb28e15b702fe3e6599477d5435d0de92
/roteiro-1/src/main/java/psoft/roteiro1/models/Disciplina.java
2ffdcf947e99a96e6e5e91c85c9531f6a787b635
[]
no_license
matheusjustino/Disciplina-Psoft
54be32961a4ee0ca72aab915f1563600e26b9fcb
dc994cbb97e70877db001205a29290bea2fd2552
refs/heads/master
2020-07-08T13:43:32.915896
2019-08-22T15:02:55
2019-08-22T15:02:55
203,692,293
0
0
null
null
null
null
UTF-8
Java
false
false
1,855
java
package psoft.roteiro1.models; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Disciplina implements Comparable<Disciplina> { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String nome; private double nota; public Disciplina() { } public Disciplina(String nome, double nota) { this.nome = nome; this.nota = nota; } @Override public int compareTo(Disciplina disciplina) { if (this.nota > disciplina.getNota()) { return -1; } else if (this.nota < disciplina.getNota()) { return 1; } else { return 0; } } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public double getNota() { return nota; } public void setNota(double nota) { this.nota = nota; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + id; result = prime * result + ((nome == null) ? 0 : nome.hashCode()); long temp; temp = Double.doubleToLongBits(nota); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Disciplina other = (Disciplina) obj; if (id != other.id) return false; if (nome == null) { if (other.nome != null) return false; } else if (!nome.equals(other.nome)) return false; if (Double.doubleToLongBits(nota) != Double.doubleToLongBits(other.nota)) return false; return true; } }
[ "matheus.justino@ccc.ufcg.edu.br" ]
matheus.justino@ccc.ufcg.edu.br
2f504928f6052dfa5616702bd942c92b9e5a2101
76eade981b17039e3e8580db19b9a1426490c0c7
/src/test/java/com/springcodelab/didemo/controllers/ConstructorInjectedControllerTest.java
0fd3c11968ab930f88cddbab4ed0a6dd2509e69b
[]
no_license
kashifkhan79/spring5di
b92d20beeffed393fc3415460c04822f65864f26
6a84ef01a5646699668a6f33bdd1fde52d9c371b
refs/heads/master
2021-04-30T10:10:28.914557
2018-02-13T02:09:16
2018-02-13T02:09:16
121,327,523
0
0
null
null
null
null
UTF-8
Java
false
false
637
java
package com.springcodelab.didemo.controllers; import com.springcodelab.didemo.services.GreetingServiceImpl; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; public class ConstructorInjectedControllerTest { private ConstructorInjectedController constructorInjectedController; @Before public void setUp() { this.constructorInjectedController = new ConstructorInjectedController(new GreetingServiceImpl()); } @Test public void testSayGreeting() { assertEquals(GreetingServiceImpl.HELLO_GREETING, constructorInjectedController.sayGreeting()); } }
[ "kashifkhan79@gmail.com" ]
kashifkhan79@gmail.com
44398ea925729b2e329b371bada1fad496002c6d
1e9f669b441535bccac1e44e1eea1804ea54abac
/src/main/java/com/netassist/service/impl/SworkServiceImpl.java
b00beb19d0f8ac7253be85b82aa7fedb243bdcf6
[]
no_license
androidheng/netassist
2cc6534aa51891c81257d9c6e7ad6c7d0c191ec0
7e40951f5bb661aff43756694234b9d95065d74a
refs/heads/master
2020-05-13T04:19:21.821919
2019-05-13T23:29:32
2019-05-13T23:29:32
181,600,463
0
0
null
null
null
null
UTF-8
Java
false
false
2,127
java
package com.netassist.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.netassist.mapper.TbSworkMapper; import com.netassist.pojo.TbSwork; import com.netassist.pojo.TbSworkExample; import com.netassist.pojo.TbSworkExample.Criteria; import com.netassist.service.SworkService; import entity.PageResult; /** * 服务实现层 * @author Administrator * */ @Service public class SworkServiceImpl implements SworkService { @Autowired private TbSworkMapper sworkMapper; /** * 查询全部 */ @Override public List<TbSwork> findAll() { return sworkMapper.selectByExample(null); } /** * 按分页查询 */ @Override public PageResult findPage(int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); Page<TbSwork> page= (Page<TbSwork>) sworkMapper.selectByExample(null); return new PageResult(page.getTotal(), page.getResult()); } /** * 增加 */ @Override public void add(TbSwork swork) { sworkMapper.insert(swork); } /** * 修改 */ @Override public void update(TbSwork swork){ sworkMapper.updateByPrimaryKeySelective(swork); } /** * 根据ID获取实体 * @param id * @return */ @Override public TbSwork findOne(Integer id){ return sworkMapper.selectByPrimaryKey(id); } /** * 批量删除 */ @Override public void delete(Integer id) { sworkMapper.deleteByPrimaryKey(id); } @Override public PageResult findPage(TbSwork swork, int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); TbSworkExample example=new TbSworkExample(); Criteria criteria = example.createCriteria(); if(swork!=null){ if(swork.getTtid()!=null) { criteria.andTtidEqualTo(swork.getTtid()); } if(swork.getSid()!=null) { criteria.andSidEqualTo(swork.getSid()); } } Page<TbSwork> page= (Page<TbSwork>)sworkMapper.selectByExample(example); return new PageResult(0,"",page.getTotal(), page.getResult()); } }
[ "zhangheng425@sina.com" ]
zhangheng425@sina.com
560346b0845408c312b8eb9e0f63b22b2b4f9d86
5d56f88158f864b3c40a1709847108967530f054
/src/main/java/com/ma/pedidos/dto/PedidoDTO.java
35ec7986a63e4ac86ebfbda2dd7cae688357bf22
[]
no_license
Elmekia/MercantilChallenge
cf7db808966fb0424be5c719ffa46463239a7c12
27c29ca2184128a19db2699bf3e7582f744fb833
refs/heads/master
2023-02-16T23:10:51.799537
2021-01-18T13:51:56
2021-01-18T13:51:56
330,027,831
0
0
null
null
null
null
UTF-8
Java
false
false
1,096
java
package com.ma.pedidos.dto; import java.util.List; public class PedidoDTO { private String direccion; private String email; private String telefono; private String horario; private List<PedidoDetalleDTO>detalle; public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getTelefono() { return telefono; } public void setTelefono(String telefono) { this.telefono = telefono; } public String getHorario() { return horario; } public void setHorario(String horario) { this.horario = horario; } public List<PedidoDetalleDTO> getDetalle() { return detalle; } public void setDetalle(List<PedidoDetalleDTO> detalle) { this.detalle = detalle; } @Override public String toString() { return "{direccion= " + this.direccion + ", email= " + this.email + ", telefono= " + this.telefono + ", horario= " + this.horario + ", detalle= { " + detalle.toString() + " }" ; } }
[ "mati.dela@gmail.com" ]
mati.dela@gmail.com
f8a718d8e73b409709d230311968f247b9f19272
1d8682a968e620b9846660e7a8b276193f88c9e6
/src/main/java/com/demo/controller/KaptchaController.java
ecfbdf85712c797582fba7f73cd1f13bfc218a87
[]
no_license
dayinyin/SpringSecurity-demo
5a0d74c05916c677a924a951909bbd8cb5bb57be
aad721b890ba9f8e516c6a7c6d28f8f4f873f5cc
refs/heads/master
2023-05-30T18:38:12.518886
2021-06-16T14:54:26
2021-06-16T14:54:26
377,535,524
0
0
null
null
null
null
UTF-8
Java
false
false
2,425
java
package com.demo.controller; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.google.code.kaptcha.impl.DefaultKaptcha; @Controller public class KaptchaController { /** * 验证码工具 */ @Autowired DefaultKaptcha defaultKaptcha; /* * 生成验证码方法 * session域放入相同参数会覆盖,打到更新验证码效果 */ @RequestMapping("/defaultKaptcha") public void defaultKaptcha(HttpServletRequest request, HttpServletResponse response) throws Exception { byte[] captcha = null; ByteArrayOutputStream out = new ByteArrayOutputStream(); try { // 调用实现类创建验证码,然后把验证码放入session String createText = defaultKaptcha.createText(); request.getSession().setAttribute("rightCode", createText); //调用实现类创建图片 BufferedImage bi = defaultKaptcha.createImage(createText); //write​(RenderedImage im, String formatName, OutputStream output) //使用支持给定格式的任意 ImageWriter将图像写入 OutputStream 。 ImageIO.write(bi, "jpg", out); } catch (Exception e) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } //创建一个新分配的字节数组。 它的大小是此输出流的当前大小,缓冲区的有效内容已复制到其中。 captcha = out.toByteArray(); response.setHeader("Cache-Control", "no-store"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0); response.setContentType("image/jpeg"); //间接转换到ServletOutputStream,输出图片 ServletOutputStream sout = response.getOutputStream(); sout.write(captcha); sout.flush(); sout.close(); } }
[ "1415653519@qq.com" ]
1415653519@qq.com
72e4aa35642a41ae5645c1fe1c2f0843a5e0f8cb
28943088f40a13dd4ecdfeeee0ca5fec8435d0cd
/Login/loginController.java
991f37919740068736df287d906f7f019f4d6875
[]
no_license
sandeepchandel/Banking-Application-JAVAFX
7720b278eaa3e16789376304cb823fd60d849312
13d3880d42796cf85bbdeb4116da4dc76219d2ef
refs/heads/master
2022-12-26T02:40:21.970510
2020-10-09T06:57:23
2020-10-09T06:57:23
302,557,076
0
0
null
null
null
null
UTF-8
Java
false
false
3,785
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 Login; import java.io.IOException; import java.net.URL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ResourceBundle; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javafx.stage.StageStyle; public class loginController implements Initializable { public static Stage stage=null; public static String acc; @FXML private Pane main_area; @FXML private TextField accountno; @FXML private PasswordField pin; @FXML public void logintoaccount(MouseEvent event) throws IOException { Connection con=null; PreparedStatement ps=null; ResultSet rs=null; try{ Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://sql12.freemysqlhosting.net:3306/sql12344367", "sql12344367","8gqaKXNXDN"); String sql="SELECT * FROM userdata WHERE AccountNo=? and PIN=?"; ps=con.prepareStatement(sql); ps.setString(1,accountno.getText()); ps.setString(2,pin.getText()); acc=accountno.getText(); rs=ps.executeQuery(); if(rs.next()) { try{ ((Node)event.getSource()).getScene().getWindow().hide(); Parent root=FXMLLoader.load(getClass().getResource("/DashBoard/dashboard.fxml")); Scene scene=new Scene(root); scene.getStylesheets().add(getClass().getResource("/Design/design.css").toExternalForm()); Stage stage=new Stage(); stage.initStyle(StageStyle.UNDECORATED); stage.setScene(scene); stage.show(); this.stage=stage; }catch(Exception e) { System.out.println(e.getMessage()); } } else{ Alert a=new Alert(Alert.AlertType.ERROR); a.setTitle("Error"); a.setHeaderText("Account Number or Password incorrect"); a.setContentText("Please Try Again!!!"); a.showAndWait(); } }catch(ClassNotFoundException | SQLException e){ Alert a=new Alert(Alert.AlertType.ERROR); a.setTitle("Error"); a.setHeaderText("Error in Loging in"); a.setContentText("Cannot log in due to some technical issue"); a.showAndWait(); } } @FXML private void closeApp(MouseEvent event) { Platform.exit(); System.exit(0); } @FXML private void createAccount(MouseEvent event) throws IOException{ Parent fxml=FXMLLoader.load(getClass().getResource("/CreateAccount/createaccount.fxml")); main_area.getChildren().removeAll(); main_area.getChildren().addAll(fxml); } @FXML private void forgotpass(MouseEvent event) throws IOException{ Parent fxml=FXMLLoader.load(getClass().getResource("/ForgotPassword/forgotpassword.fxml")); main_area.getChildren().clear(); main_area.getChildren().addAll(fxml); } @Override public void initialize(URL url, ResourceBundle rb) { } }
[ "sandeep" ]
sandeep
b53f8eda0efeacbf713b4b3e8fc148b5fbf97ea6
449fb8b7451c290aefcb707324f4de02054fc433
/springboot-porduce/src/main/java/com/zhliang/springboot/produce/entity/Order.java
78a519d3ca4510fb2592a3a9c11475eb556b3230
[]
no_license
zhangliang1024/springboot
87d1f78ce6993aeb3c8b15d5d4a0dda54f77b6d4
d3fd484822720a4d95d6e290c6dc9191e7a8631b
refs/heads/master
2023-05-01T02:41:41.019119
2022-11-21T08:36:37
2022-11-21T08:36:37
215,956,372
9
2
null
2023-04-14T17:35:07
2019-10-18T06:31:49
Java
UTF-8
Java
false
false
561
java
package com.zhliang.springboot.produce.entity; import lombok.Data; import java.io.Serializable; /** * @Author: colin * @Date: 2019/9/23 16:18 * @Description: * @Version: V1.0 */ @Data public class Order implements Serializable { private String id; private String name; /*存储消息的唯一Id*/ private String messageId; public Order(){ super(); } public Order(String id,String name,String messageId){ super(); this.id = id; this.name = name; this.messageId = messageId; } }
[ "colin@colin.com" ]
colin@colin.com
58b00b55eb4a8919a0aad27b24f798ebe8e30734
1e92fd94c248a23d7c52497ea98035adb79575dc
/src/com/net/first/user/IUser.java
ab0bec15ee912e96d03c77c15f9dde60e2c4c174
[]
no_license
daidaijie/AbstractFactoryMode
1b06593382f9e227d54f0804fa8be421f959ecb3
1f34b4032fd96e9d6839c1d69a0786647053cb06
refs/heads/master
2021-01-10T12:42:32.887877
2016-01-29T08:52:17
2016-01-29T08:52:17
50,650,584
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package com.net.first.user; /** * Created by daidaijie on 2016/1/29. */ public interface IUser { void insert(User user); User getUser(int id); }
[ "317095153@qq.com" ]
317095153@qq.com
cbbe36b02388af4a777676293d992c2050a69242
3f99350286f8b34fa1aabf245b0c863acd70ef3b
/src/main/java/com/example/coffeehouse/repositories/OrderRepository.java
6110b5713fb198136e9895117311f9a7015bc6cb
[]
no_license
DKagan495/coffeehouse
dbde5276e9a3e58f14b73d3fe26ced2fdaa964bf
7c29838a33272cb67d4d552e84df6e6703bb79e0
refs/heads/Development
2023-07-03T12:22:41.492033
2021-08-02T09:48:09
2021-08-02T09:48:09
387,513,802
1
0
null
2021-08-02T09:50:45
2021-07-19T15:37:24
Java
UTF-8
Java
false
false
1,035
java
package com.example.coffeehouse.repositories; import com.example.coffeehouse.models.Employee; import com.example.coffeehouse.models.Order; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import java.math.BigDecimal; public interface OrderRepository extends CrudRepository<Order, String> { Order findById(int id); void deleteByClientId(long id); @Modifying @Query("update Order o set o.name = :coffee, o.arabica = :arabica, o.cupSize = :cup, o.employee = :employee where o.id = :id") void updOrder(@Param("id") int id, @Param("coffee") String coffee, @Param("arabica") String arabica, @Param("cup") String cup, @Param("employee") Employee employees); @Modifying @Query("update Order o set o.totalPrice = :totalPrice where o.id = :id") void updTotalPrice(@Param("id") int id, @Param("totalPrice") BigDecimal totalPrice); }
[ "dan.kagan@yandex.by" ]
dan.kagan@yandex.by
b29f6123b0abfc411bb8944bbe407f559b6cfe80
5df679544bb99521e5e0557d014ada462db9e7ed
/working-directory/de.cookieapp.test.recipesearch/src/recipesearchtest/CukeRunner.java
2c8779d7d0bf1c3148001c62cdaf2fb4e79054eb
[]
no_license
asterixom/CookieApp
ec64acc9032394e6f3a1dd1d1b721a6b4c32c4c7
faaa95f96bdd3708a3e3a73a1733e428945cce17
refs/heads/master
2021-01-10T21:05:53.097367
2015-07-01T07:36:51
2015-07-01T07:36:51
24,837,083
0
0
null
2015-05-27T05:43:53
2014-10-06T07:22:31
Java
UTF-8
Java
false
false
253
java
package recipesearchtest; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions( features={"src/"}, format={"pretty"}) public class CukeRunner { }
[ "der_Chris@gmx.org" ]
der_Chris@gmx.org
75bb0bc4d98d885965745f19497f4c4ed7f27d25
0a2aeae85069050f7ec2d2deaf435fbcaec57cd6
/1z0-808/src/_05/Question_12_v2.java
12b3e4ec10db4069bb3681562233be56f1ebec63
[]
no_license
chirajshetty/course
a7028ad05c236705c1352f88e0a656e214899f87
31954eab7df23a204818e4dfbaa1d00e8f0ec560
refs/heads/master
2023-03-28T21:03:55.651777
2021-03-24T15:26:50
2021-03-24T15:26:50
284,877,479
1
0
null
null
null
null
UTF-8
Java
false
false
1,423
java
package _05; /* * Topic : Working with Selected Classes with Java API * Code: 05 * */ public class Question_12_v2 { public static void main(String[] args) { StringBuilder stb = new StringBuilder("OCA"); String str = "OCA"; if (!stb.toString().equals(str.toString())) { System.out.println("First Match"); } else if(stb.equals(str)) { System.out.println("Second Match"); } else { System.out.println("No Match"); } } } /* * What is the output of the following code snippet? * * a) * First Match * * b) * Second Match * * c) * No Match * * d) * Runtime Exception * * Answer : * c) * No Match * * Explanation: * The toString() method of the StringBuilder class reruns String value of the current object. * Therefore, the string value of stb.toString() and str.toString() are both of type String and comparable * and in this case are true. But because of the ! operator the condition is false. * * A point to note: * equals() method is used for comparing two strings in Java since the String class overrides Object class, while Stringbuilder doesn`t override. * So the second if condition is false. * Moreover equals() method cannot be used to compare StringBuilder with StringBuilder as well. * * Additional Explanation: * https://www.tutorialspoint.com/converting-a-stringbuilder-to-string-in-java * * Source : * Actual Test 10 * */
[ "chiraj.atwork@gmail.com" ]
chiraj.atwork@gmail.com
74c4bb7300e1001269614c16f5a1d15446e03a2c
5a3e42213a73e323170d0d766437c42920ad2b10
/ud851-Exercises/L05a-Lifecycle/T05a.03-Exercise-FixLifecycleDisplayBug/app/src/main/java/com/example/android/lifecycle/MainActivity.java
f47ec98e893e74b1344b0c5d673a19a42201f020
[]
no_license
lemefe21/nanodegree_exercise_fixes
828d7ba25a5a386fb5b5fac59fdd9b1bfca4d772
21ccadad3c7e293fcf352da390c9a84ebd5f4983
refs/heads/master
2020-04-10T13:09:48.943484
2019-02-11T14:56:43
2019-02-11T14:56:43
161,040,319
0
0
null
null
null
null
UTF-8
Java
false
false
7,760
java
package com.example.android.lifecycle; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.TextView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { /* * This tag will be used for logging. It is best practice to use the class's name using * getSimpleName as that will greatly help to identify the location from which your logs are * being posted. */ private static final String TAG = "lifecycle_test"; /* * This constant String will be used to store the content of the TextView used to display the * list of callbacks. The reason we are storing the contents of the TextView is so that you can * see the entire set of callbacks as they are called. */ private static final String LIFECYCLE_CALLBACKS_TEXT_KEY = "callbacks"; /* Constant values for the names of each respective lifecycle callback */ private static final String ON_CREATE = "onCreate"; private static final String ON_START = "onStart"; private static final String ON_RESUME = "onResume"; private static final String ON_PAUSE = "onPause"; private static final String ON_STOP = "onStop"; private static final String ON_RESTART = "onRestart"; private static final String ON_DESTROY = "onDestroy"; private static final String ON_SAVE_INSTANCE_STATE = "onSaveInstanceState"; /* * This TextView will contain a running log of every lifecycle callback method called from this * Activity. This TextView can be reset to its default state by clicking the Button labeled * "Reset Log" */ private TextView mLifecycleDisplay; // OK (1) Declare and instantiate a static ArrayList of Strings called mLifecycleCallbacks private static ArrayList<String> mLifecycleCallbacks = new ArrayList<String>(); /** * Called when the activity is first created. This is where you should do all of your normal * static set up: create views, bind data to lists, etc. * * Always followed by onStart(). * * @param savedInstanceState The Activity's previously frozen state, if there was one. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mLifecycleDisplay = (TextView) findViewById(R.id.tv_lifecycle_events_display); /* * If savedInstanceState is not null, that means our Activity is not being started for the * first time. Even if the savedInstanceState is not null, it is smart to check if the * bundle contains the key we are looking for. In our case, the key we are looking for maps * to the contents of the TextView that displays our list of callbacks. If the bundle * contains that key, we set the contents of the TextView accordingly. */ if (savedInstanceState != null) { if (savedInstanceState.containsKey(LIFECYCLE_CALLBACKS_TEXT_KEY)) { String allPreviousLifecycleCallbacks = savedInstanceState .getString(LIFECYCLE_CALLBACKS_TEXT_KEY); mLifecycleDisplay.setText(allPreviousLifecycleCallbacks); } } // OK (4) Iterate backwards through mLifecycleCallbacks, appending each String and a newline to mLifecycleDisplay for (String callback : mLifecycleCallbacks) { mLifecycleDisplay.setText(callback + "\n"); } // OK (5) Clear mLifecycleCallbacks after iterating through it mLifecycleCallbacks.clear(); logAndAppend(ON_CREATE); } /** * Called when the activity is becoming visible to the user. * * Followed by onResume() if the activity comes to the foreground, or onStop() if it becomes * hidden. */ @Override protected void onStart() { super.onStart(); logAndAppend(ON_START); } /** * Called when the activity will start interacting with the user. At this point your activity * is at the top of the activity stack, with user input going to it. * * Always followed by onPause(). */ @Override protected void onResume() { super.onResume(); logAndAppend(ON_RESUME); } /** * Called when the system is about to start resuming a previous activity. This is typically * used to commit unsaved changes to persistent data, stop animations and other things that may * be consuming CPU, etc. Implementations of this method must be very quick because the next * activity will not be resumed until this method returns. * * Followed by either onResume() if the activity returns back to the front, or onStop() if it * becomes invisible to the user. */ @Override protected void onPause() { super.onPause(); logAndAppend(ON_PAUSE); } /** * Called when the activity is no longer visible to the user, because another activity has been * resumed and is covering this one. This may happen either because a new activity is being * started, an existing one is being brought in front of this one, or this one is being * destroyed. * * Followed by either onRestart() if this activity is coming back to interact with the user, or * onDestroy() if this activity is going away. */ @Override protected void onStop() { super.onStop(); // OK (2) Add the ON_STOP String to the front of mLifecycleCallbacks mLifecycleCallbacks.add(ON_STOP); logAndAppend(ON_STOP); } /** * Called after your activity has been stopped, prior to it being started again. * * Always followed by onStart() */ @Override protected void onRestart() { super.onRestart(); logAndAppend(ON_RESTART); } /** * The final call you receive before your activity is destroyed. This can happen either because * the activity is finishing (someone called finish() on it, or because the system is * temporarily destroying this instance of the activity to save space. You can distinguish * between these two scenarios with the isFinishing() method. */ @Override protected void onDestroy() { super.onDestroy(); // OK (3) Add the ON_DESTROY String to the front of mLifecycleCallbacks mLifecycleCallbacks.add(ON_DESTROY); logAndAppend(ON_DESTROY); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); logAndAppend(ON_SAVE_INSTANCE_STATE); String lifecycleDisplayTextViewContents = mLifecycleDisplay.getText().toString(); outState.putString(LIFECYCLE_CALLBACKS_TEXT_KEY, lifecycleDisplayTextViewContents); } /** * Logs to the console and appends the lifecycle method name to the TextView so that you can * view the series of method callbacks that are called both from the app and from within * Android Studio's Logcat. * * @param lifecycleEvent The name of the event to be logged. */ private void logAndAppend(String lifecycleEvent) { Log.d(TAG, "Lifecycle Event: " + lifecycleEvent); mLifecycleDisplay.append(lifecycleEvent + "\n"); } /** * This method resets the contents of the TextView to its default text of "Lifecycle callbacks" * * @param view The View that was clicked. In this case, it is the Button from our layout. */ public void resetLifecycleDisplay(View view) { mLifecycleDisplay.setText("Lifecycle callbacks:\n"); } }
[ "lemefe21@gmail.com" ]
lemefe21@gmail.com
c70aa9c0cf4cd96f14e5da00f9214dc45cdc8c66
84db686827b51c273cd589cffbf39f9d08332a2a
/Armani/rpos/src/com/chelseasystems/cs/ajbauthorization/AJBMessageCodes.java
50d8bd2d77da83f99206218decd9c2e6857f80fd
[]
no_license
bchelli/armani
0ec55106135496e1dd0ebb20a359d2ccbd507210
d84baec9a4df9328ac0bd03c1141502eae601968
refs/heads/master
2020-03-28T20:20:36.813175
2018-09-06T07:23:58
2018-09-06T07:23:58
149,061,353
1
0
null
2018-09-17T03:02:15
2018-09-17T03:02:15
null
UTF-8
Java
false
false
3,164
java
package com.chelseasystems.cs.ajbauthorization; /** * @author Vivek M * */ import java.util.ArrayList; import java.util.Iterator; /** * Enum which contains all the constant values required in any of the AJB * request message. * */ public enum AJBMessageCodes { IX_CMD_REQUEST("100"), IX_CMD_RESPONSE("101"), IX_CMD_PROMPT_REQUEST("150"), IX_CMD_PROMPT_RESPONSE( "151"), IX_CMD_SAF_REQUEST("111"), IX_CMD_SAF_RESPONSE("111"), IX_CMD_GIFTCARD_SWIPE("107"), IX_CMD_ACK_REQUEST("901"), IX_ACTION_CODE_RESPONSE_AUTHORIZED("0"), IX_ACTION_CODE_RESPONSE_DECLINED( "1"), IX_ACTION_CODE_RESPONSE_CALL_REFERRAL("2"), IX_ACTION_CODE_RESPONSE_BANK_DOWN( "3"), IX_ACTION_CODE_RESPONSE_COMM_ISSUE("5"), IX_ACTION_CODE_RESPONSE_REPORT_ERROR( "6"), IX_ACTION_CODE_RESPONSE_TRY_LATER("8"), IX_ACTION_CODE_RESPONSE_TIME_OUT( "10"), IX_ACTION_CODE_RESPONSE_APPROVED_ADMIN("12"), IX_ACTION_CODE_RESPONSE_MAC_FAILURE( "14"), IX_DEBIT_CREDIT_CHECK("check"), IX_DEBIT_CREDIT_ECHECK("echeck"), IX_DEBIT_CREDIT_CREDIT( "credit"), IX_DEBIT_CREDIT_VOID("Void"), IX_DEBIT_CREDIT_DEBIT( "debit"), IX_DEBIT_CREDIT_GIFTCARD("giftcard"), IX_DEBIT_CREDIT_VOIDSALE( "VoidSale"), IX_DEBIT_CREDIT_FORCE("Force"), IX_DEBIT_CREDIT_GETCARD( "Getcard"), IX_DEBIT_CREDIT_GETEFT("GetEFT"), IX_OPTIONS_TOKENIZATION( "*Tokenization"), IX_TRAN_TYPE_DEBIT_BIN_LOOKUP("Binlookup"), IX_TRAN_TYPE_CARD_GET_TOKEN( "GetToken"), IX_TRAN_TYPE_CARD_SALE("Sale"), IX_TRAN_TYPE_GIFT_CARD_SALE("Redeem"), IX_GIFT_CARD_VOIDSALE( "voidSale"), IX_GIFT_CARD_VOIDACTIVATE( "voidActivate"), IX_GIFT_CARD_VOIDRELOAD( "voidReload"), IX_GIFT_CARD_VOIDREFUND( "voidRefund"), IX_GIFT_CARD_VOIDCASHOUT( "voidCashout"),IX_TRAN_TYPE_CHECK_SALE( "Sale"), IX_TRAN_TYPE_REFUND("Refund"), //Added by Himani for redeemable fipay integration IX_TRAN_TYPE_CASHOUT("cashout"), IX_TRAN_TYPE_DEBIT_INIT( "InitDebit"), IX_OPTIONS_BINLOOKUP("*Binlookup"), IX_VERIFONE_PROMPT( "Prompt"), IX_VERIFONE_POS_ITEMS("*POSITEMS"),IX_VERIFONE_RESET("*POSITEMS-Reset"), IX_VERIFONE_POS_ITEMS_CLEAR( "*POSITEMS-CLEAR"),IX_VERIFONE_POS_ITEMS_REMOVE( "*POSITEMS-REMOVE"), IX_VERIFONE_POS_ITEMS_CHANGE("*POSITEM-CHANGE"), IX_VERIFONE_POS_ITEMS_REFRESH( "*POSITEMS-REFRESH"), IX_VERIFONE_SIGNATURE("*SIGNATURE"),IX_OPTIONS_TELEAUTH("TELAUTH"), IX_TRAN_TYPE_BALANCE_INQUIRY("balanceInquiry"), IX_TRAN_TYPE_ACTIVATE("Activate"), IX_TRAN_TYPE_RELOAD("Reload"), //Added by Himani for GC Transaction History IX_TRAN_TYPE_TRANSACTION_HISTORY("ministatement"), IX_ENTRY_METHOD_MANUAL("*cem_manual"), IX_ENTRY_METHOD_MAGSWIPE( "*CEM_Swiped"), IX_ENTRY_METHOD_ICC("*CEM_Insert"), IX_ENTRY_METHOD_ICC_FALLBACK( "*FALLBACK_EMV"), IX_CHECK_VOID("Void"), //Vivek Mishra : Added to send verious track request with Gift Card 107 swipe request IX_SWIPE_MANUAL_ENTRY("0"), IX_SWIPE_TRACK1("1"), IX_SWIPE_TRACK2("2"), IX_SWIPE_TRACK1AND2("4"), IX_OPTIONS_VERIFY_CARD("VerifyCard"); private String value; private AJBMessageCodes(String value) { this.value = value; } public String getValue() { return this.value; } }
[ "saptarshi.mukhaty@skillnetinc.com" ]
saptarshi.mukhaty@skillnetinc.com
22d7296c6b10fd7b040718f524630e73552132ca
06cb11d10fffceb99d38ad82b6712be24944d685
/src/test/java/me/calvinliu/scoreboard/manager/SessionManagerTest.java
d4dc9eb05031bfdd7ca48daffdbbdbd33d7abf7a
[]
no_license
calvinlau/Score-board
92bac26b4ed6672fa65e5d9bbdcd7bf70c3ecd1d
aba96ccd96eb91a389a03e429819b459dd2031be
refs/heads/master
2021-01-01T04:39:23.564973
2016-05-04T09:27:46
2016-05-04T09:27:46
56,687,175
0
0
null
null
null
null
UTF-8
Java
false
false
3,828
java
/* * Creator: Calvin Liu */ package me.calvinliu.scoreboard.manager; import me.calvinliu.scoreboard.model.UserSession; import me.calvinliu.scoreboard.util.TestUtils; import org.junit.Before; import org.junit.Test; import java.security.SecureRandom; import java.util.LinkedList; import java.util.List; import static org.junit.Assert.*; public class SessionManagerTest { private static SecureRandom random; private SessionManager sessionManager; @Before public void setUp() { sessionManager = SessionManager.getInstance(); random = new SecureRandom(); } @Test public void testSingletonInstance() { assertSame(SessionManager.getInstance(), SessionManager.getInstance()); } @Test public void testCreateUserSessionNotLoggedInUser() { int userId = TestUtils.getRandomUserId(); UserSession session = sessionManager.createSession(userId); assertNotNull(session); assertNotNull(session.getSessionKey()); assertNotNull(session.getCreatedDate()); assertNotNull(session.getUserId()); } @Test public void testCreateUserSessionLoggedInUser() { // Login a user int userId = TestUtils.getRandomUserId(); UserSession session1 = sessionManager.createSession(userId); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } UserSession session2 = sessionManager.createSession(userId); assertEquals(session1.getUserId(), session2.getUserId()); assertNotEquals(session1.getCreatedDate(), session2.getCreatedDate()); } @Test public void testGetUserSessionLoggedInUser() { // Login a user int userId = TestUtils.getRandomUserId(); UserSession session = sessionManager.createSession(userId); assertSame(session, sessionManager.getSession(session.getSessionKey())); } @Test public void testGetUserSessionNotLoggedInUser() { String sessionKey = getRandomSessionKey(); assertNull(sessionManager.getSession(sessionKey)); } @Test public void testRemoveUserSessions_Timeout() { // Sets timeout to 0.1 s int timeout = 100; // Login a user int userId = TestUtils.getRandomUserId(); UserSession session = sessionManager.createSession(userId); assertNotNull(sessionManager.getSession(session.getSessionKey())); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } sessionManager.removeUserSessions(timeout); assertNull(sessionManager.getSession(session.getSessionKey())); } @Test public void testRemoveUserSessions_Single() { // Sets timeout to 600000 ms int timeout = 600000; int repeatTime = 5; // Login 1 user for 5 times int userId = TestUtils.getRandomUserId(); List<String> keyList = new LinkedList<>(); for (int i = 0; i < repeatTime; i++) { UserSession session = sessionManager.createSession(userId); keyList.add(session.getSessionKey()); assertNotNull(sessionManager.getSession(session.getSessionKey())); } sessionManager.removeUserSessions(timeout); int count = 0; for (String key : keyList) { if (sessionManager.getSession(key) != null && sessionManager.getSession(key).getUserId().equals(userId)) { count++; } } // Not sure 100% to clean all duplicate session by one time clean up, eventually it will only single for one user at most. assertTrue(count >= 1); } private String getRandomSessionKey() { return sessionManager.generateKey(); } }
[ "always_my_fault@163.com" ]
always_my_fault@163.com