blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d9ef4d4a355376a491fd52cf6b8ce9ecf55acefe | b8a089904db014e597dea94280494b0687f306c8 | /LiveFeeds/src/livefeeds/twister6/StampView.java | 6d4acc0286fa0ebd971ae7136544ff52d6fa1ffb | [] | no_license | smduarte/LiveFeeds | f377efdba775990dd7844f09cef69a47668f3991 | e6d6f3c4b3effd0d7564dbd134249ce26ec8e45d | refs/heads/master | 2023-04-19T01:47:40.774874 | 2022-11-02T15:37:37 | 2022-11-02T15:37:37 | 238,485,634 | 0 | 0 | null | 2023-03-27T22:20:26 | 2020-02-05T15:39:16 | Java | UTF-8 | Java | false | false | 3,628 | java | package livefeeds.twister6;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeSet;
import livefeeds.twister6.config.Config;
public class StampView implements Serializable {
long owner;
public int cutoff = -1, maxSerial = -1;
final Map<Long, SlidingStampSet> data;
public StampView(long key) {
owner = key;
data = new LinkedHashMap<Long, SlidingStampSet>();
}
private StampView(StampView other) {
owner = other.owner;
cutoff = other.cutoff;
data = new LinkedHashMap<Long, SlidingStampSet>();
for (Map.Entry<Long, SlidingStampSet> i : other.data.entrySet()) {
data.put(i.getKey(), new SlidingStampSet(i.getValue()));
}
}
public StampView clone() {
return new StampView(this);
}
public void add(Stamp s) {
if( s.c_serial > maxSerial )
maxSerial = s.c_serial ;
if (s.c_serial > cutoff)
getSet(s.key).add(s);
}
private SlidingStampSet getSet(Long key) {
SlidingStampSet res = data.get(key);
if (res == null) {
res = new SlidingStampSet(cutoff);
data.put(key, res);
}
return res;
}
public boolean contains(Stamp s) {
if (cutoff >= s.c_serial)
return true;
SlidingStampSet x = data.get(s.key);
return x != null && x.contains(s, cutoff);
}
public boolean contains(StampView other) {
for (Map.Entry<Long, SlidingStampSet> i : other.data.entrySet()) {
SlidingStampSet tSet = data.get(i.getKey());
if (tSet == null || !tSet.containsAll(i.getValue(), cutoff))
return false;
}
return true;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append('{');
for (Map.Entry<Long, SlidingStampSet> i : data.entrySet()) {
sb.append(String.format("<%10d = %s>", i.getKey(), i.getValue()));
}
sb.append('}');
return cutoff + " >>>> " + sb.toString();
}
public int size() {
return data.size();
}
//
public int length() {
trim( Config.Config.VIEW_CUTOFF ) ;
int res = 0;
for (SlidingStampSet i : data.values())
res += i.length();
return 1 + res;
}
public StampView trim(int cut) {
cut = maxSerial - cut;
if (cut > cutoff)
cutoff = cut;
for (Iterator<SlidingStampSet> i = data.values().iterator(); i.hasNext();) {
if (i.next().trim(cutoff).isEmpty())
i.remove();
}
return this;
}
/**
*
*/
private static final long serialVersionUID = 1L;
}
class SlidingStampSet extends TreeSet<Stamp> {
int smallest = -1;
SlidingStampSet(int cutoff) {
}
SlidingStampSet(SlidingStampSet other) {
super(other);
}
public SlidingStampSet clone() {
return new SlidingStampSet(this);
}
public boolean add(Stamp s) {
return super.add(s);
}
SlidingStampSet trim(int cutoff) {
for (Iterator<Stamp> i = iterator(); i.hasNext();)
if (i.next().c_serial <= cutoff)
i.remove();
return this;
}
int length() {
int res = 0;
Stamp[] sa = super.toArray(new Stamp[size()]);
int i = 0;
for (; i < sa.length - 1 && sa[i + 1].p_serial == sa[i].c_serial; i++)
;
for (; i < sa.length; i++)
res++;
return 16 + 4 + +1 + res;
}
public boolean contains(Stamp s, int cutoff) {
return s.c_serial <= cutoff || super.contains(s);
}
public boolean contains(Object other) {
Thread.dumpStack();
return false;
}
public boolean containsAll(Collection<?> c, int cutoff) {
for (Object i : c)
if (((Stamp) i).c_serial > cutoff && !super.contains(i))
return false;
return true;
}
public String toString() {
return super.toString();
}
/**
*
*/
private static final long serialVersionUID = 1L;
}
| [
"smd@fct.unl.pt"
] | smd@fct.unl.pt |
0f3fef2bfdfe2006ac2dc71e92e0bc4fd44862aa | c9f94c6012eb33d94e5cfcbb4577a44cbead26db | /app/src/main/java/com/example/melearn/logic/User.java | 4d1d2f2c8d94e1c9d6852b08875b9925b5f319e1 | [] | no_license | MarkAntonioGiovani/ME.Learn_HooHacks | 1e58f70723af14866a10b6ff9fd5a6fc55e35bee | 9a8bd41c52030612bcf0c3badbb6b9098084ccf3 | refs/heads/master | 2023-03-26T17:25:09.769739 | 2021-03-28T15:44:39 | 2021-03-28T15:44:39 | 352,368,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,312 | java | package com.example.melearn.logic;
import java.util.ArrayList;
import java.util.List;
public class User {
private String name;
private String id;
private List<Deck> decks;
private List<Group> groups;
private List<User> friends;
public User(String name, String id){
this.name = name;
this.id = id;
this.decks = new ArrayList<>();
this.groups = new ArrayList<>();
this.friends = new ArrayList<>();
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public void addDeck(String id, String name, String description){
this.decks.add(new Deck(id, name, description));
}
public void removeDeck(Deck deck){
this.decks.remove(deck);
}
public void addFriend(User friend){
this.friends.add(friend);
}
public void removeFriend(User friend){
this.friends.remove(friend);
}
public void joinGroup(Group group){
this.groups.add(group);
}
public void leaveGroup(Group group){
this.groups.remove(group);
}
public void createGroup(String name){
Group g = new Group(name, this);
this.joinGroup(g);
}
public List<Deck> getDecks() {
return this.decks;
}
}
| [
"markantoniogiovani@gmail.com"
] | markantoniogiovani@gmail.com |
10354e44dd605b7f8251c52a357877f3ee82a131 | 6a1c38881e288b919b1da968fb598e2b1a8fa30a | /app/marketdatamanagement/callbacks/OnSpotPriceReceiveListener.java | c158126b3c9230b1bb45b3aa01b6de8ec1965e6c | [] | no_license | shou1dwe/baba-king-trading | 0c907a31509e513b7193d9c859020d5b88d0b552 | c633a8f38fc36b9e71a325506e051ec2085c6b61 | refs/heads/master | 2016-09-06T05:38:47.406180 | 2014-08-22T01:56:41 | 2014-08-22T01:56:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package marketdatamanagement.callbacks;
import marketdatamanagement.datatransferobjects.Quote;
/**
* Author: Xiawei
*/
public interface OnSpotPriceReceiveListener {
void onSpotPriceReceived(Quote quote);
}
| [
"zhang_xiawei@hotmail.com"
] | zhang_xiawei@hotmail.com |
2248810ac56e6452e409b0d287f3bb4a143bc5d6 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/30/30_794eb17b78bf032116a4bd87ef3f279d72c828f0/MojangIdGrabber/30_794eb17b78bf032116a4bd87ef3f279d72c828f0_MojangIdGrabber_t.java | 8e687522a098c917df99b6675bcea5f8237838b1 | [] | 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 | 1,895 | java | package com.censoredsoftware.demigods.engine.helper;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.mojang.api.profiles.HttpProfileRepository;
import com.mojang.api.profiles.Profile;
import com.mojang.api.profiles.ProfileCriteria;
import org.bukkit.OfflinePlayer;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
public class MojangIdGrabber {
private static final String AGENT = "minecraft";
private static HttpProfileRepository repository = new HttpProfileRepository();
private static Map<String, String> knownUUIDs = Maps.newHashMap();
private static Set<String> fakePlayers = Sets.newHashSet();
/**
* This method requires an OfflinePlayer as an extra step to prevent just passing in random String names.
*
* @param player The offline player that we are checking the UUID of.
* @return The Mojang UUID.
*/
public static String getUUID(OfflinePlayer player) {
// Get the player's name.
String playerName = player.getName();
// Check if we already know this Id, of if the name actually belongs to a player.
if (knownUUIDs.containsKey(playerName)) return knownUUIDs.get(playerName);
if (fakePlayers.contains(playerName)) return null;
// Get the Id from Mojang.
Profile profile = Iterables.getFirst(Arrays.asList(repository.findProfilesByCriteria(new ProfileCriteria(playerName, AGENT))), null);
if (profile == null) {
// Add the name to the fake players list.
fakePlayers.add(playerName);
return null;
}
String id = profile.getId();
// Put the player in the known Ids map, and return the found Id.
knownUUIDs.put(playerName, id);
return id;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
31c5589941164d2e240feaf39b8ab8dd34d22a5f | 578e14e028a4613d23f44ba2ac40367c7253265b | /spring-learn/src/main/java/cn/com/luoc/spring/aop/ArithmeticCalculatorLoggingProxy.java | a74c4bdf5743e9e10da19281ccee7db261b2fbec | [] | no_license | luocong2013/luoc-imooc | c0ca1a0c15ed4b0aac5bdd376c61d4dd81c52733 | 07d4cdea45091f3219cfed1be9297c99b3b0d315 | refs/heads/master | 2022-07-08T01:21:36.919897 | 2018-11-28T13:48:36 | 2018-11-28T13:48:36 | 110,121,672 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package cn.com.luoc.spring.aop;
import java.lang.reflect.Proxy;
/**
* @author luoc
* @version V1.0.0
* @date 2018/2/12 15:12
*/
public class ArithmeticCalculatorLoggingProxy {
/**
* 这个就是我们要代理的真实对象
*/
private Object target;
public ArithmeticCalculatorLoggingProxy(Object target) {
this.target = target;
}
/**
* 返回代理对象
*
* @return
*/
public ArithmeticCalculator getLoggingProxy() {
ArithmeticCalculator proxy = null;
Class<?> clazz = this.target.getClass();
ClassLoader loader = clazz.getClassLoader();
Class[] interfaces = clazz.getInterfaces();
LoggingHandler h = new LoggingHandler(this.target);
/**
* loader: 代理对象使用的类加载器。
* interfaces: 指定代理对象的类型. 即代理代理对象中可以有哪些方法.
* h: 当具体调用代理对象的方法时, 应该如何进行响应, 实际上就是调用 InvocationHandler 的 invoke 方法
*/
proxy = (ArithmeticCalculator) Proxy.newProxyInstance(loader, interfaces, h);
return proxy;
}
}
| [
"luocong2013@outlook.com"
] | luocong2013@outlook.com |
dfa46e2b82f4f053c6428c8a12efd8f2a1b6c511 | 7f929f6815c7df4b1cf88e628ad22edd08501365 | /WebProject/src/main/java/cn/itcast/b2c/gciantispider/controller/IndexSystemMonitorController.java | 231691bd51c6ac0867a1bdba889369b2648e597d | [] | no_license | githubkimber/git-test | fa16552303c7add9ea076711a96a04fb166c070f | 7cdc0093482789b3a984fbd7b2931e0ec60ceff3 | refs/heads/master | 2022-12-21T19:48:15.038712 | 2019-09-17T13:31:16 | 2019-09-17T13:31:16 | 208,517,283 | 2 | 0 | null | 2022-12-16T07:18:00 | 2019-09-14T23:42:58 | JavaScript | UTF-8 | Java | false | false | 5,714 | java | package cn.itcast.b2c.gciantispider.controller;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.jboss.logging.Logger;
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.bind.annotation.ResponseBody;
import cn.itcast.b2c.gciantispider.model.NhCrawlerCurdayInfo;
import cn.itcast.b2c.gciantispider.model.SystemFunctionInfo;
import cn.itcast.b2c.gciantispider.pageUtil.JsonVO;
import cn.itcast.b2c.gciantispider.pageUtil.SpiderVO;
import cn.itcast.b2c.gciantispider.service.INhCrawlerCurdayInfoService;
import cn.itcast.b2c.gciantispider.service.INhSysmonitorSpiderdistinguishService;
import cn.itcast.b2c.gciantispider.service.ISystemFunctionInfoService;
import cn.itcast.b2c.gciantispider.util.Constants;
import cn.itcast.b2c.gciantispider.util.TrafficUtil;
@Controller
@RequestMapping("/systemMonitoring")
public class IndexSystemMonitorController {
private static final Logger logger = Logger.getLogger(IndexSystemMonitorController.class);
@Autowired
private ISystemFunctionInfoService systemFunctionInfoService;
@Autowired
private INhSysmonitorSpiderdistinguishService nhSysmonitorSpiderdistinguishService;
@Autowired
private INhCrawlerCurdayInfoService nhCrawlerCurdayInfoService;
/**
*
* 获取爬虫识别情况
*/
@RequestMapping(value = "/getNhCrawlerCurdayInfoByDate", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> getNhCrawlerCurdayInfoByDate() {
Map<String, Object> map = new HashMap<String, Object>();
try {
SpiderVO spiderVO = nhSysmonitorSpiderdistinguishService.getSysmonitorSpiderdistinguish();
NhCrawlerCurdayInfo nhCrawlerCurdayInfo = nhCrawlerCurdayInfoService.getNhCrawlerCurdayInfoByDate();
map.put("spiderVO", spiderVO);
map.put("flownum", nhCrawlerCurdayInfo.getFlowNum());
map.put("code", 0);
}catch (Exception e) {
logger.info(e.getMessage());
map.put("result", "失败");
map.put("code", 1);
return map;
}
return map;
}
/**
*
* 获取系统功能运行情况
*/
@RequestMapping(value = "/getSystemFunctionInfo", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getSystemFunctionInfo(HttpServletRequest request) {
List<SystemFunctionInfo> systemFunctionInfos = new ArrayList<SystemFunctionInfo>();
Map<String, Object> map = new HashMap<String, Object>();
try {
//数据处理模块
//两分钟内的数据
List<JsonVO> jVos = TrafficUtil.getTrafficInfoByMinute(-2, Constants.CSANTI_MONITOR_DP);
if(null==jVos || 0==jVos.size() ){
map.put("sign", 1);
}else{
map.put("sign", 0);
}
}
catch (Exception e) {
logger.info(e.getMessage());
map.put("result", "失败");
map.put("sign", 1);
return map;
}
return map;
}
/**
*
* 获取实时流量转发情况
*/
@RequestMapping(value = "/getRealTimeTraffic", method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> getRealTimeTraffic(HttpServletRequest request) {
Map<String,Object> map = new HashMap<String,Object>();
try {
/*
* mapS.put("time", endTimeList);
mapS.put("value", sourceCountList);
mapS.put("sum", currFlowSum);
*/
map = TrafficUtil.getForwardInfo(-20,Constants.CSANTI_MONITOR_DP);
}
catch (Exception e) {
// TODO: handle exception
System.out.println(e.getStackTrace());
logger.info(e.getMessage());
}
return map;
}
/**
*
* 获取实时 链路流量转发情况
*
* @return
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@RequestMapping(value = "/getRealTimeLinkTraffic", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> getRealTimeLinkTraffic(HttpServletRequest request) {
List<Object> valuelList = new ArrayList<Object>();
List<String> keyList = new ArrayList<String>();
Map mapS = null;
//jsonVOs就是20分钟内的数据
List<JsonVO> jsonVOs = new ArrayList<JsonVO>();
jsonVOs = TrafficUtil.getTrafficInfoByMinute(-20,Constants.CSANTI_MONITOR_DP);
// 对list集合排序
Collections.sort(jsonVOs);
// 取list集合最一条数据(即最新的一条数据)
//size=5个 角标(0 1 2 3 4)
int size = jsonVOs.size();
if (size > 0) {
mapS = new HashMap();
//jsonVO 20 分钟内的最后一条数据
JsonVO jsonVO = jsonVOs.get(jsonVOs.size() - 1);
Map<String, Object> serversCountMap = jsonVO.getServersCountMap();
Set<String> keySet = serversCountMap.keySet();
for (String key : keySet) {
Object value = serversCountMap.get(key);
keyList.add(key);
valuelList.add(value);
}
mapS.put("key", keyList);
mapS.put("value", valuelList);
return mapS;
}
return mapS;
}
}
| [
"wj@123.com"
] | wj@123.com |
34b9c043c47102a0382d2415a42ce51cb5fd0977 | 208ba847cec642cdf7b77cff26bdc4f30a97e795 | /aj/ag/src/main/java/org.wp.ag/ui/notifications/blocks/CommentUserNoteBlock.java | e8e8618e9167879ae8a573c7347a384a7a360a80 | [] | no_license | kageiit/perf-android-large | ec7c291de9cde2f813ed6573f706a8593be7ac88 | 2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8 | refs/heads/master | 2021-01-12T14:00:19.468063 | 2016-09-27T13:10:42 | 2016-09-27T13:10:42 | 69,685,305 | 0 | 0 | null | 2016-09-30T16:59:49 | 2016-09-30T16:59:48 | null | UTF-8 | Java | false | false | 9,780 | java | package org.wp.ag.ui.notifications.blocks;
import android.content.Context;
import android.text.Html;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import org.json.JSONException;
import org.json.JSONObject;
import org.wp.ag.R;
import org.wp.ag.models.CommentStatus;
import org.wp.ag.ui.notifications.utils.NotificationsUtils;
import org.wp.ag.util.DateTimeUtils;
import org.wp.ag.util.GravatarUtils;
import org.wp.ag.widgets.WPNetworkImageView;
// A user block with slightly different formatting for display in a comment detail
public class CommentUserNoteBlock extends UserNoteBlock {
private CommentStatus mCommentStatus = CommentStatus.UNKNOWN;
private int mNormalBackgroundColor;
private int mNormalTextColor;
private int mAgoTextColor;
private int mUnapprovedTextColor;
private int mIndentedLeftPadding;
private boolean mStatusChanged;
public interface OnCommentStatusChangeListener {
public void onCommentStatusChanged(CommentStatus newStatus);
}
public CommentUserNoteBlock(Context context, JSONObject noteObject,
OnNoteBlockTextClickListener onNoteBlockTextClickListener,
OnGravatarClickedListener onGravatarClickedListener) {
super(context, noteObject, onNoteBlockTextClickListener, onGravatarClickedListener);
if (context != null) {
setAvatarSize(context.getResources().getDimensionPixelSize(R.dimen.avatar_sz_small));
}
}
@Override
public BlockType getBlockType() {
return BlockType.USER_COMMENT;
}
@Override
public int getLayoutResourceId() {
return R.layout.note_block_comment_user;
}
@Override
public View configureView(View view) {
final CommentUserNoteBlockHolder noteBlockHolder = (CommentUserNoteBlockHolder)view.getTag();
noteBlockHolder.nameTextView.setText(Html.fromHtml("<strong>" + getNoteText().toString() + "</strong>"));
noteBlockHolder.agoTextView.setText(DateTimeUtils.timestampToTimeSpan(getTimestamp()));
if (!TextUtils.isEmpty(getMetaHomeTitle()) || !TextUtils.isEmpty(getMetaSiteUrl())) {
noteBlockHolder.bulletTextView.setVisibility(View.VISIBLE);
noteBlockHolder.siteTextView.setVisibility(View.VISIBLE);
if (!TextUtils.isEmpty(getMetaHomeTitle())) {
noteBlockHolder.siteTextView.setText(getMetaHomeTitle());
} else {
noteBlockHolder.siteTextView.setText(getMetaSiteUrl().replace("http://", "").replace("https://", ""));
}
} else {
noteBlockHolder.bulletTextView.setVisibility(View.GONE);
noteBlockHolder.siteTextView.setVisibility(View.GONE);
}
if (hasImageMediaItem()) {
String imageUrl = GravatarUtils.fixGravatarUrl(getNoteMediaItem().optString("url", ""), getAvatarSize());
noteBlockHolder.avatarImageView.setImageUrl(imageUrl, WPNetworkImageView.ImageType.AVATAR);
if (!TextUtils.isEmpty(getUserUrl())) {
noteBlockHolder.avatarImageView.setOnTouchListener(mOnGravatarTouchListener);
} else {
noteBlockHolder.avatarImageView.setOnTouchListener(null);
}
} else {
noteBlockHolder.avatarImageView.showDefaultGravatarImage();
noteBlockHolder.avatarImageView.setOnTouchListener(null);
}
noteBlockHolder.commentTextView.setText(
NotificationsUtils.getSpannableContentForRanges(
getNoteData().optJSONObject("comment_text"),
noteBlockHolder.commentTextView,
getOnNoteBlockTextClickListener(),
false)
);
// Change display based on comment status and type:
// 1. Comment replies are indented and have a 'pipe' background
// 2. Unapproved comments have different background and text color
int paddingLeft = view.getPaddingLeft();
int paddingTop = view.getPaddingTop();
int paddingRight = view.getPaddingRight();
int paddingBottom = view.getPaddingBottom();
if (mCommentStatus == CommentStatus.UNAPPROVED) {
if (hasCommentNestingLevel()) {
paddingLeft = mIndentedLeftPadding;
view.setBackgroundResource(R.drawable.comment_reply_unapproved_background);
} else {
view.setBackgroundResource(R.drawable.comment_unapproved_background);
}
noteBlockHolder.dividerView.setVisibility(View.INVISIBLE);
noteBlockHolder.agoTextView.setTextColor(mUnapprovedTextColor);
noteBlockHolder.bulletTextView.setTextColor(mUnapprovedTextColor);
noteBlockHolder.siteTextView.setTextColor(mUnapprovedTextColor);
noteBlockHolder.nameTextView.setTextColor(mUnapprovedTextColor);
noteBlockHolder.commentTextView.setTextColor(mUnapprovedTextColor);
} else {
if (hasCommentNestingLevel()) {
paddingLeft = mIndentedLeftPadding;
view.setBackgroundResource(R.drawable.comment_reply_background);
noteBlockHolder.dividerView.setVisibility(View.INVISIBLE);
} else {
view.setBackgroundColor(mNormalBackgroundColor);
noteBlockHolder.dividerView.setVisibility(View.VISIBLE);
}
noteBlockHolder.agoTextView.setTextColor(mAgoTextColor);
noteBlockHolder.bulletTextView.setTextColor(mAgoTextColor);
noteBlockHolder.siteTextView.setTextColor(mAgoTextColor);
noteBlockHolder.nameTextView.setTextColor(mNormalTextColor);
noteBlockHolder.commentTextView.setTextColor(mNormalTextColor);
}
view.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
// If status was changed, fade in the view
if (mStatusChanged) {
mStatusChanged = false;
view.setAlpha(0.4f);
view.animate().alpha(1.0f).start();
}
return view;
}
private long getTimestamp() {
return getNoteData().optInt("timestamp", 0);
}
private boolean hasCommentNestingLevel() {
try {
JSONObject commentTextObject = getNoteData().getJSONObject("comment_text");
return commentTextObject.optInt("nest_level", 0) > 0;
} catch (JSONException e) {
return false;
}
}
@Override
public Object getViewHolder(View view) {
return new CommentUserNoteBlockHolder(view);
}
private class CommentUserNoteBlockHolder {
private final WPNetworkImageView avatarImageView;
private final TextView nameTextView;
private final TextView agoTextView;
private final TextView bulletTextView;
private final TextView siteTextView;
private final TextView commentTextView;
private final View dividerView;
public CommentUserNoteBlockHolder(View view) {
nameTextView = (TextView)view.findViewById(R.id.user_name);
agoTextView = (TextView)view.findViewById(R.id.user_comment_ago);
agoTextView.setVisibility(View.VISIBLE);
bulletTextView = (TextView)view.findViewById(R.id.user_comment_bullet);
siteTextView = (TextView)view.findViewById(R.id.user_comment_site);
commentTextView = (TextView)view.findViewById(R.id.user_comment);
commentTextView.setMovementMethod(new NoteBlockLinkMovementMethod());
avatarImageView = (WPNetworkImageView)view.findViewById(R.id.user_avatar);
dividerView = view.findViewById(R.id.divider_view);
siteTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getOnNoteBlockTextClickListener() != null) {
getOnNoteBlockTextClickListener().showSitePreview(getMetaSiteId(), getMetaSiteUrl());
}
}
});
// show all comments on this post when user clicks the comment text
commentTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getOnNoteBlockTextClickListener() != null) {
getOnNoteBlockTextClickListener().showReaderPostComments();
}
}
});
}
}
public void configureResources(Context context) {
if (context == null) return;
mNormalTextColor = context.getResources().getColor(R.color.grey_dark);
mNormalBackgroundColor = context.getResources().getColor(R.color.white);
mAgoTextColor = context.getResources().getColor(R.color.grey);
mUnapprovedTextColor = context.getResources().getColor(R.color.notification_status_unapproved_dark);
// Double margin_extra_large for increased indent in comment replies
mIndentedLeftPadding = context.getResources().getDimensionPixelSize(R.dimen.margin_extra_large) * 2;
}
private final OnCommentStatusChangeListener mOnCommentChangedListener = new OnCommentStatusChangeListener() {
@Override
public void onCommentStatusChanged(CommentStatus newStatus) {
mCommentStatus = newStatus;
mStatusChanged = true;
}
};
public void setCommentStatus(CommentStatus status) {
mCommentStatus = status;
}
public OnCommentStatusChangeListener getOnCommentChangeListener() {
return mOnCommentChangedListener;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
6e347561906fd46cbb954446a8c734aec146314e | 76ce8b32ccd9de8b5608e3588441c89dab12e3c9 | /Main.java | d3821e7d1096e41d717b6f9528543fd81aeeeb6e | [] | no_license | Ayak555/hwork2.1.1 | 4d7b8c5c433cffb19c72632d67dc550c9d9ecd07 | 9f03ba50ce9941fccc2dc3f098cc4e7c1f7c33d6 | refs/heads/master | 2020-06-09T22:04:21.834465 | 2019-06-24T13:55:55 | 2019-06-24T13:55:55 | 193,515,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | public class Main {
public static void main(String[] args) {
Shelter shelt1 = new Shelter("Добрые руки", "Бишкек");
Shelter shelt2 = new Shelter("Волонтеры", "Токмак");
Dog dog1 = new Dog();
System.out.println(dog1.getInfo());
Dog dog2 = new Dog("Алекс", "шарпей", ColorType.BLACK, shelt1);
System.out.println(dog2.getInfo());
Dog dog3 = new Dog("Муви", "такса", ColorType.GRAY, shelt2, "Ко мне");
System.out.println(dog3.getInfo());
dog1.makeVoice("Гав-гав");
dog2.makeVoice(2);
dog3.makeVoice("Муви", 3);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f40a3a10a8cfdbdd89d949c2b8bfec326809aa6d | fe3064a1b7eaea61770b880bd12eb5f8ba070be1 | /src/main/java/tutorial/core/models/entities/Account.java | 0754e25b9859340f3c7a39ba0321c8a5316ebd78 | [] | no_license | Jacek135/ChristoperHenkel | b34e1b33dc28e15fbec57b7b0d3a8cd5fba83285 | 30eb1660245ef05cf2e45db5348bb0e77a73f4b9 | refs/heads/master | 2021-01-23T22:23:39.490253 | 2017-04-09T10:07:44 | 2017-04-09T10:07:44 | 83,127,316 | 0 | 0 | null | 2017-04-08T20:39:12 | 2017-02-25T11:31:34 | Java | UTF-8 | Java | false | false | 674 | java | package tutorial.core.models.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Account {
@Id @GeneratedValue
private Long id;
private String name;
private String password;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"Karas135"
] | Karas135 |
bdfe65318ecea748e543c10eb4d3f889aeae76d9 | 80b6753ec7d7a5d0a59ed3ecedc3eeffc4d2f0d2 | /maro/maro-manager/src/main/java/com/maro/platform/web/cgform/service/impl/enhance/CgformEnhanceJsServiceImpl.java | a8a7014c67eb4ed343587d66a1b9135da9f50fd5 | [] | no_license | fengchg/Code | d227253152b12c18bf6a90be7095da484223e03c | de90c9ae8c7cb61128242c1949eb714762926bb2 | refs/heads/main | 2022-12-31T23:21:14.595087 | 2020-10-22T10:01:04 | 2020-10-22T10:01:04 | 306,221,434 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,137 | java | package com.maro.platform.web.cgform.service.impl.enhance;
import java.util.List;
import com.maro.platform.web.cgform.entity.enhance.CgformEnhanceJsEntity;
import com.maro.platform.web.cgform.service.enhance.CgformEnhanceJsServiceI;
import com.maro.platform.core.common.service.impl.CommonServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("cgformenhanceJsService")
@Transactional
public class CgformEnhanceJsServiceImpl extends CommonServiceImpl implements CgformEnhanceJsServiceI {
/**
* 根据cgJsType和formId查找数据
* @param cgJsType
* @param formId
* @return
*/
public CgformEnhanceJsEntity getCgformEnhanceJsByTypeFormId(String cgJsType, String formId) {
StringBuilder hql = new StringBuilder("");
hql.append(" from CgformEnhanceJsEntity t");
hql.append(" where t.formId='").append(formId).append("'");
hql.append(" and t.cgJsType ='").append(cgJsType).append("'");
List<CgformEnhanceJsEntity> list = this.findHql(hql.toString());
if(list!=null&&list.size()>0){
return list.get(0);
}
return null;
}
} | [
"356747004@qq.com"
] | 356747004@qq.com |
717fc617bb4e03b097c512320215fae484265156 | a45801fa9f193a5ba839047324182ad10fe1d304 | /src/UsedCar.java | 41c1ddcc0b09891eac92a9a79d902eb5fb1b6b64 | [] | no_license | MarinaChvek/Lesson10-11- | 6d103384f0b0c23951a0b4bff8151288cda4424e | e589e585e3d7571dfb650e55cb896730b7ae5d3f | refs/heads/master | 2020-07-08T11:47:37.610508 | 2019-08-21T21:00:43 | 2019-08-21T21:00:43 | 203,663,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java |
public class UsedCar extends Car {
private static final int MAX_MILEAGE = 10000000;
private static final int MIN_MILEAGE = 0;
private boolean IsRepainted = false;
private boolean IsAfterCrash = false;
private Integer _mileage = 0;
public UsedCar(String _brand, String _model,
CarTransmissionType carTransmissionType, CarEngineType carEngineType,
boolean isRepainted, boolean isAfterCrash, Integer _mileage)
{
super(_brand, _model, carTransmissionType, carEngineType);
this.IsRepainted = isRepainted;
this.IsAfterCrash = isAfterCrash;
this._mileage = _mileage;
}
public Integer getMileage()
{
return _mileage;
}
public void setMileage(Integer mileage)
{
if(mileage!=null && mileage>=MIN_MILEAGE && mileage<=MAX_MILEAGE)
{
this._mileage = mileage;
}
else
{
System.out.println("Mileage value should be more than "+MIN_MILEAGE+" and less than "+MAX_MILEAGE);
}
}
@Override
public void printInfo(){
super.printInfo();
System.out.println("Is Repainted: "+IsRepainted);
System.out.println("Is After Crash: "+IsAfterCrash);
System.out.println("Mileage: "+getMileage());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6c4935763b4d2444ecf89711ae5c39351677f6e6 | 56cfea7aff9d2b5ede380f57a01deb0312b60be0 | /src/com/tavi/totp/entity/mob/weapons/Sword.java | 0aef4ebc629eb5abea9f0ad8d24398f2a8d89962 | [] | no_license | tavistoica/TilesOfThePast | 8d62a7b42c305648273078ac6d695c217663b81f | 964d0345ed2d7b40bdf03e41dbd11792ee21c0c2 | refs/heads/master | 2020-04-05T11:51:16.059563 | 2019-10-30T22:38:29 | 2019-10-30T22:38:29 | 156,847,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java | package com.tavi.totp.entity.mob.weapons;
import com.tavi.totp.entity.mob.Player;
import com.tavi.totp.graphics.Screen;
import com.tavi.totp.graphics.Sprite;
public class Sword extends Weapon{
private Sprite current = Sprite.player_sword_down;
public Sword() {
<<<<<<< HEAD
avgDmg = 2;
avgSpeed = 1;
avgWeight = 5;
=======
>>>>>>> 5360f2dfcb2cec230bbec932ee21a7371e3a76cf
}
protected void spriteChange() {
if(Player.inHand) {
Up = Sprite.sword_up;
Down = Sprite.sword_down;
Left = Sprite.sword_left;
Right = Sprite.sword_right;
Rdown = Sprite.sword_down_right;
Ldown = Sprite.sword_down_left;
Rup = Sprite.sword_up_right;
Lup = Sprite.sword_up_left;
}else {
Up = Sprite.sword_back;
Down = Sprite.sword_down_left;
Left = Sprite.sword_down_left;
Right = Sprite.sword_down_left;
Rdown = Sprite.sword_down_left;
Ldown = Sprite.sword_down_left;
Rup = Sprite.sword_back;
Lup = Sprite.sword_back;
}
}
public void render(int x, int y, int dir, Screen screen) {
int xp = x;
int yp = y;
spriteChange();
//System.out.println("is in hand ? " + inHand);
if(Player.inHand) {
if(checkDir(dir, current) == Up) {
yp = yp + 1;
xp = xp + 6;
}else if(checkDir(dir, current) == Right) {
yp = yp + 5;
xp = xp + 2;
}else if(checkDir(dir, current) == Left) {
yp = yp + 4;
xp = xp - 8;
}else if(checkDir(dir, current) == Down) {
yp = yp + 8;
xp = xp - 6;
}else if(checkDir(dir, current) == Ldown) {
yp = yp + 8;
xp = xp - 8;
}else if(checkDir(dir, current) == Rdown) {
yp = yp + 8;
xp = xp - 3;
}else if(checkDir(dir, current) == Rup) {
yp = yp + 2;
xp = xp + 9;
}else {
yp = yp + 2;
xp = xp - 2;
}
}else {
xp = xp - 1;
yp = yp + 1;
}
screen.renderMob2(xp, yp, checkDir(dir,current), 0);
}
}
| [
"stoicaoctavian25@yahoo.com"
] | stoicaoctavian25@yahoo.com |
0db2b72210fb2977d82511c9642ab57301679ce4 | c0779889b8ef7416a7a0e1a36dc2f26fd0678529 | /src/test/java/cn/zflzqy/test/Test1.java | cf592e7fce136338004fe22fb3e4704768c22753 | [] | no_license | zflzqy/test | f247d2c55a38b7da37908ac782c0ecdf8705ccf0 | 74e14c35d985c50ec3ef4cb538fccc282007c70b | refs/heads/master | 2023-03-17T23:06:21.429842 | 2023-01-06T09:00:07 | 2023-01-06T09:00:07 | 525,810,389 | 1 | 1 | null | 2023-01-06T09:01:37 | 2022-08-17T13:43:47 | Java | UTF-8 | Java | false | false | 1,149 | java | package cn.zflzqy.test;
import cn.hutool.core.thread.ThreadUtil;
import com.alibaba.fastjson2.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
/**
* @Author: zfl
* @Date: 2022-09-24-10:19
* @Description:
*/
public class Test1 {
public static void main(String[] args) {
List<PeoPle> rs = new ArrayList<>();
ExecutorService executorService = ThreadUtil.newExecutor(12);
PeoPle peoPle = null;
List<PeoPle> peoPle1 = new ArrayList<>();
for (int i=0;i<100;i++){
peoPle = new PeoPle(i+"");
peoPle1.add(peoPle);
}
List c = new ArrayList();
peoPle1.parallelStream().forEach(e->{
// System.out.println(e.hashCode());
// executorService.submit(new Thread(e));
// c.add(e.hashCode());1
PeoPle peoPle2 = new PeoPle(e.getName());
peoPle2.setName(peoPle2.getName()+"1");
System.out.println(peoPle2);
});
// System.out.println(JSONObject.toJSONString(peoPle1));
}
}
| [
"13111855651@189.cn"
] | 13111855651@189.cn |
7845419f4e57cd6836dd2a5d427156baa1e45d1b | f3eef3cc0f727da629b01b623aba40e5a8b982ba | /src/main/java/curso/api/rest/ApplicationContextLoad.java | 52b62f54e31f5c7c5f647e927dab8cd3cfc5de33 | [] | no_license | Giordanobass/cursospringrestapi | 73b8852812d9b5914af08af0cfbc9205c665e496 | 145fbdb77166b68cecfe0163750ec285031820eb | refs/heads/master | 2023-05-06T19:00:41.885886 | 2021-05-17T22:09:49 | 2021-05-17T22:09:49 | 362,303,470 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package curso.api.rest;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextLoad implements ApplicationContextAware {
@Autowired
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
}
| [
"giordano.amaral@gnsystems.com.br"
] | giordano.amaral@gnsystems.com.br |
e3506c415265c20bf50520c8c7f1ed71059df603 | 33835a7fcaad6733d8630106ba5b0f53ce595856 | /src/class_16_test/CalculatorAppTest.java | 1a4e7b01b936aba97fb3ae0960aba56f72feca69 | [] | no_license | Jahidul2543/B2001_JavaBasic | 2bd0a8440d8854067ce5d1ec16fb7d4229ef5b26 | d8ebd85faeacfd28e442e247d3ddd661b5e9150e | refs/heads/master | 2021-05-19T13:00:19.311174 | 2020-04-21T06:53:18 | 2020-04-21T06:53:18 | 251,712,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 802 | java | package class_16_test;
import class_16.CalculatorApp;
import org.testng.Assert;
import org.testng.annotations.Test;
public class CalculatorAppTest {
/**
*
* 1. JUnit
* 2. TestNG
*
* */
@Test
public void addTest() {
CalculatorApp calculator = new CalculatorApp();
int actualResult = calculator.add(2,2);
//System.out.println(expectedResult); // actualResult = 4;
// expectedResult == actualResult
int expectedResult = 4;
//Assert.assertEquals(actualResult, 6);
Assert.assertEquals(expectedResult, actualResult);
}
@Test
public void multiplyTest(){
int actualResult = CalculatorApp.multiply(4,4);
int exectedResult = 16;
Assert.assertEquals(actualResult, exectedResult);
}
}
| [
"jahidul2543@gmail.com"
] | jahidul2543@gmail.com |
02b6415420dc18b8f090d367e70abdfa6c74b939 | 75f31e9edae0c60db99457c87d679bb175ba9855 | /app/src/main/java/org/appspot/apprtc/CallActivity.java | 23d9005a5db69d1ecc5ff75b7dfb7745ff34a83f | [] | no_license | dadahellohello/ApprtcDemo | 9da8ba4cc2a26191a5e0a56d4f33e3fe9b947876 | 472bbeb310763a463e6f472bf4edf1f54327b339 | refs/heads/master | 2020-06-02T02:42:42.039423 | 2019-04-17T03:13:53 | 2019-04-17T03:13:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 35,470 | java | /*
* Copyright 2015 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.appspot.apprtc;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.Toast;
import org.appspot.apprtc.AppRTCAudioManager.AudioDevice;
import org.appspot.apprtc.AppRTCAudioManager.AudioManagerEvents;
import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters;
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
import org.appspot.apprtc.PeerConnectionClient.DataChannelParameters;
import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters;
import org.webrtc.Camera1Enumerator;
import org.webrtc.Camera2Enumerator;
import org.webrtc.CameraEnumerator;
import org.webrtc.EglBase;
import org.webrtc.FileVideoCapturer;
import org.webrtc.IceCandidate;
import org.webrtc.Logging;
import org.webrtc.PeerConnectionFactory;
import org.webrtc.RendererCommon.ScalingType;
import org.webrtc.ScreenCapturerAndroid;
import org.webrtc.SessionDescription;
import org.webrtc.StatsReport;
import org.webrtc.SurfaceViewRenderer;
import org.webrtc.VideoCapturer;
import org.webrtc.VideoFileRenderer;
import org.webrtc.VideoFrame;
import org.webrtc.VideoSink;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Activity for peer connection call setup, call waiting
* and call view.
*/
public class CallActivity extends Activity implements AppRTCClient.SignalingEvents,
PeerConnectionClient.PeerConnectionEvents,
CallFragment.OnCallEvents {
private static final String TAG = "CallRTCClient";
public static final String EXTRA_ROOMID = "org.appspot.apprtc.ROOMID";
public static final String EXTRA_URLPARAMETERS = "org.appspot.apprtc.URLPARAMETERS";
public static final String EXTRA_LOOPBACK = "org.appspot.apprtc.LOOPBACK";
public static final String EXTRA_VIDEO_CALL = "org.appspot.apprtc.VIDEO_CALL";
public static final String EXTRA_SCREENCAPTURE = "org.appspot.apprtc.SCREENCAPTURE";
public static final String EXTRA_CAMERA2 = "org.appspot.apprtc.CAMERA2";
public static final String EXTRA_VIDEO_WIDTH = "org.appspot.apprtc.VIDEO_WIDTH";
public static final String EXTRA_VIDEO_HEIGHT = "org.appspot.apprtc.VIDEO_HEIGHT";
public static final String EXTRA_VIDEO_FPS = "org.appspot.apprtc.VIDEO_FPS";
public static final String EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED =
"org.appsopt.apprtc.VIDEO_CAPTUREQUALITYSLIDER";
public static final String EXTRA_VIDEO_BITRATE = "org.appspot.apprtc.VIDEO_BITRATE";
public static final String EXTRA_VIDEOCODEC = "org.appspot.apprtc.VIDEOCODEC";
public static final String EXTRA_HWCODEC_ENABLED = "org.appspot.apprtc.HWCODEC";
public static final String EXTRA_CAPTURETOTEXTURE_ENABLED = "org.appspot.apprtc.CAPTURETOTEXTURE";
public static final String EXTRA_FLEXFEC_ENABLED = "org.appspot.apprtc.FLEXFEC";
public static final String EXTRA_AUDIO_BITRATE = "org.appspot.apprtc.AUDIO_BITRATE";
public static final String EXTRA_AUDIOCODEC = "org.appspot.apprtc.AUDIOCODEC";
public static final String EXTRA_NOAUDIOPROCESSING_ENABLED =
"org.appspot.apprtc.NOAUDIOPROCESSING";
public static final String EXTRA_AECDUMP_ENABLED = "org.appspot.apprtc.AECDUMP";
public static final String EXTRA_SAVE_INPUT_AUDIO_TO_FILE_ENABLED =
"org.appspot.apprtc.SAVE_INPUT_AUDIO_TO_FILE";
public static final String EXTRA_OPENSLES_ENABLED = "org.appspot.apprtc.OPENSLES";
public static final String EXTRA_DISABLE_BUILT_IN_AEC = "org.appspot.apprtc.DISABLE_BUILT_IN_AEC";
public static final String EXTRA_DISABLE_BUILT_IN_AGC = "org.appspot.apprtc.DISABLE_BUILT_IN_AGC";
public static final String EXTRA_DISABLE_BUILT_IN_NS = "org.appspot.apprtc.DISABLE_BUILT_IN_NS";
public static final String EXTRA_DISABLE_WEBRTC_AGC_AND_HPF =
"org.appspot.apprtc.DISABLE_WEBRTC_GAIN_CONTROL";
public static final String EXTRA_DISPLAY_HUD = "org.appspot.apprtc.DISPLAY_HUD";
public static final String EXTRA_TRACING = "org.appspot.apprtc.TRACING";
public static final String EXTRA_CMDLINE = "org.appspot.apprtc.CMDLINE";
public static final String EXTRA_RUNTIME = "org.appspot.apprtc.RUNTIME";
public static final String EXTRA_VIDEO_FILE_AS_CAMERA = "org.appspot.apprtc.VIDEO_FILE_AS_CAMERA";
public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE =
"org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE";
public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH =
"org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH";
public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT =
"org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT";
public static final String EXTRA_USE_VALUES_FROM_INTENT =
"org.appspot.apprtc.USE_VALUES_FROM_INTENT";
public static final String EXTRA_DATA_CHANNEL_ENABLED = "org.appspot.apprtc.DATA_CHANNEL_ENABLED";
public static final String EXTRA_ORDERED = "org.appspot.apprtc.ORDERED";
public static final String EXTRA_MAX_RETRANSMITS_MS = "org.appspot.apprtc.MAX_RETRANSMITS_MS";
public static final String EXTRA_MAX_RETRANSMITS = "org.appspot.apprtc.MAX_RETRANSMITS";
public static final String EXTRA_PROTOCOL = "org.appspot.apprtc.PROTOCOL";
public static final String EXTRA_NEGOTIATED = "org.appspot.apprtc.NEGOTIATED";
public static final String EXTRA_ID = "org.appspot.apprtc.ID";
public static final String EXTRA_ENABLE_RTCEVENTLOG = "org.appspot.apprtc.ENABLE_RTCEVENTLOG";
private static final int CAPTURE_PERMISSION_REQUEST_CODE = 1;
// List of mandatory application permissions.
private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MODIFY_AUDIO_SETTINGS",
"android.permission.RECORD_AUDIO", "android.permission.INTERNET"};
// Peer connection statistics callback period in ms.
private static final int STAT_CALLBACK_PERIOD = 1000;
private static class ProxyVideoSink implements VideoSink {
private VideoSink target;
@Override
synchronized public void onFrame(VideoFrame frame) {
if (target == null) {
Logging.d(TAG, "Dropping frame in proxy because target is null.");
return;
}
target.onFrame(frame);
}
synchronized public void setTarget(VideoSink target) {
this.target = target;
}
}
private final ProxyVideoSink remoteProxyRenderer = new ProxyVideoSink();
private final ProxyVideoSink localProxyVideoSink = new ProxyVideoSink();
@Nullable private PeerConnectionClient peerConnectionClient;
@Nullable
private AppRTCClient appRtcClient;
@Nullable
private SignalingParameters signalingParameters;
@Nullable private AppRTCAudioManager audioManager;
@Nullable
private SurfaceViewRenderer pipRenderer;
@Nullable
private SurfaceViewRenderer fullscreenRenderer;
@Nullable
private VideoFileRenderer videoFileRenderer;
private final List<VideoSink> remoteSinks = new ArrayList<>();
private Toast logToast;
private boolean commandLineRun;
private boolean activityRunning;
private RoomConnectionParameters roomConnectionParameters;
@Nullable
private PeerConnectionParameters peerConnectionParameters;
private boolean connected;
private boolean isError;
private boolean callControlFragmentVisible = true;
private long callStartedTimeMs;
private boolean micEnabled = true;
private boolean screencaptureEnabled;
private static Intent mediaProjectionPermissionResultData;
private static int mediaProjectionPermissionResultCode;
// True if local view is in the fullscreen renderer.
private boolean isSwappedFeeds;
// Controls
private CallFragment callFragment;
private HudFragment hudFragment;
private CpuMonitor cpuMonitor;
@Override
// TODO(bugs.webrtc.org/8580): LayoutParams.FLAG_TURN_SCREEN_ON and
// LayoutParams.FLAG_SHOW_WHEN_LOCKED are deprecated.
@SuppressWarnings("deprecation")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Thread.setDefaultUncaughtExceptionHandler(new UnhandledExceptionHandler(this));
// Set window styles for fullscreen-window size. Needs to be done before
// adding content.
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN | LayoutParams.FLAG_KEEP_SCREEN_ON
| LayoutParams.FLAG_SHOW_WHEN_LOCKED | LayoutParams.FLAG_TURN_SCREEN_ON);
getWindow().getDecorView().setSystemUiVisibility(getSystemUiVisibility());
setContentView(R.layout.activity_call);
connected = false;
signalingParameters = null;
// Create UI controls.
pipRenderer = findViewById(R.id.pip_video_view);
fullscreenRenderer = findViewById(R.id.fullscreen_video_view);
callFragment = new CallFragment();
hudFragment = new HudFragment();
// Show/hide call control fragment on view click.
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
toggleCallControlFragmentVisibility();
}
};
// Swap feeds on pip view click.
pipRenderer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setSwappedFeeds(!isSwappedFeeds);
}
});
fullscreenRenderer.setOnClickListener(listener);
remoteSinks.add(remoteProxyRenderer);
final Intent intent = getIntent();
final EglBase eglBase = EglBase.create();
// Create video renderers.
pipRenderer.init(eglBase.getEglBaseContext(), null);
pipRenderer.setScalingType(ScalingType.SCALE_ASPECT_FIT);
//String saveRemoteVideoToFile = intent.getStringExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE);
String saveRemoteVideoToFile = "/mnt/sdcard/test.yuv";
// When saveRemoteVideoToFile is set we save the video from the remote to a file.
if (saveRemoteVideoToFile != null) {
//int videoOutWidth = intent.getIntExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH, 0);
//int videoOutHeight = intent.getIntExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT, 0);
int videoOutWidth = 1280;
int videoOutHeight = 720;
try {
videoFileRenderer = new VideoFileRenderer(
saveRemoteVideoToFile, videoOutWidth, videoOutHeight, eglBase.getEglBaseContext());
remoteSinks.add(videoFileRenderer);
} catch (IOException e) {
throw new RuntimeException(
"Failed to open video file for output: " + saveRemoteVideoToFile, e);
}
}
fullscreenRenderer.init(eglBase.getEglBaseContext(), null);
fullscreenRenderer.setScalingType(ScalingType.SCALE_ASPECT_FILL);
pipRenderer.setZOrderMediaOverlay(true);
pipRenderer.setEnableHardwareScaler(true /* enabled */);
fullscreenRenderer.setEnableHardwareScaler(false /* enabled */);
// Start with local feed in fullscreen and swap it to the pip when the call is connected.
setSwappedFeeds(true /* isSwappedFeeds */);
// Check for mandatory permissions.
for (String permission : MANDATORY_PERMISSIONS) {
if (checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
logAndToast("Permission " + permission + " is not granted");
setResult(RESULT_CANCELED);
finish();
return;
}
}
Uri roomUri = intent.getData();
if (roomUri == null) {
logAndToast(getString(R.string.missing_url));
Log.e(TAG, "Didn't get any URL in intent!");
setResult(RESULT_CANCELED);
finish();
return;
}
// Get Intent parameters.
String roomId = intent.getStringExtra(EXTRA_ROOMID);
Log.d(TAG, "Room ID: " + roomId);
if (roomId == null || roomId.length() == 0) {
logAndToast(getString(R.string.missing_url));
Log.e(TAG, "Incorrect room ID in intent!");
setResult(RESULT_CANCELED);
finish();
return;
}
boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false);
boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false);
int videoWidth = intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0);
int videoHeight = intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0);
screencaptureEnabled = intent.getBooleanExtra(EXTRA_SCREENCAPTURE, false);
// If capturing format is not specified for screencapture, use screen resolution.
if (screencaptureEnabled && videoWidth == 0 && videoHeight == 0) {
DisplayMetrics displayMetrics = getDisplayMetrics();
videoWidth = displayMetrics.widthPixels;
videoHeight = displayMetrics.heightPixels;
}
DataChannelParameters dataChannelParameters = null;
if (intent.getBooleanExtra(EXTRA_DATA_CHANNEL_ENABLED, false)) {
dataChannelParameters = new DataChannelParameters(intent.getBooleanExtra(EXTRA_ORDERED, true),
intent.getIntExtra(EXTRA_MAX_RETRANSMITS_MS, -1),
intent.getIntExtra(EXTRA_MAX_RETRANSMITS, -1), intent.getStringExtra(EXTRA_PROTOCOL),
intent.getBooleanExtra(EXTRA_NEGOTIATED, false), intent.getIntExtra(EXTRA_ID, -1));
}
peerConnectionParameters =
new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, true), loopback,
tracing, videoWidth, videoHeight, intent.getIntExtra(EXTRA_VIDEO_FPS, 0),
intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EXTRA_VIDEOCODEC),
intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true),
intent.getBooleanExtra(EXTRA_FLEXFEC_ENABLED, false),
intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EXTRA_AUDIOCODEC),
intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false),
intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false),
intent.getBooleanExtra(EXTRA_SAVE_INPUT_AUDIO_TO_FILE_ENABLED, false),
intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false),
intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false),
intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false),
intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false),
intent.getBooleanExtra(EXTRA_DISABLE_WEBRTC_AGC_AND_HPF, false),
intent.getBooleanExtra(EXTRA_ENABLE_RTCEVENTLOG, false), dataChannelParameters);
commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
int runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);
Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA) + "'");
// Create connection client. Use DirectRTCClient if room name is an IP otherwise use the
// standard WebSocketRTCClient.
if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) {
appRtcClient = new WebSocketRTCClient(this);
} else {
Log.i(TAG, "Using DirectRTCClient because room name looks like an IP.");
appRtcClient = new DirectRTCClient(this);
}
// Create connection parameters.
String urlParameters = intent.getStringExtra(EXTRA_URLPARAMETERS);
roomConnectionParameters =
new RoomConnectionParameters(roomUri.toString(), roomId, loopback, urlParameters);
// Create CPU monitor
if (CpuMonitor.isSupported()) {
cpuMonitor = new CpuMonitor(this);
hudFragment.setCpuMonitor(cpuMonitor);
}
// Send intent arguments to fragments.
callFragment.setArguments(intent.getExtras());
hudFragment.setArguments(intent.getExtras());
// Activate call and HUD fragments and start the call.
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.call_fragment_container, callFragment);
ft.add(R.id.hud_fragment_container, hudFragment);
ft.commit();
// For command line execution run connection for <runTimeMs> and exit.
if (commandLineRun && runTimeMs > 0) {
(new Handler()).postDelayed(new Runnable() {
@Override
public void run() {
disconnect();
}
}, runTimeMs);
}
// Create peer connection client.
peerConnectionClient = new PeerConnectionClient(
getApplicationContext(), eglBase, peerConnectionParameters, CallActivity.this);
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
if (loopback) {
options.networkIgnoreMask = 0;
}
peerConnectionClient.createPeerConnectionFactory(options);
if (screencaptureEnabled) {
startScreenCapture();
} else {
startCall();
}
}
@TargetApi(17)
private DisplayMetrics getDisplayMetrics() {
DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager windowManager =
(WindowManager) getApplication().getSystemService(Context.WINDOW_SERVICE);
windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
return displayMetrics;
}
@TargetApi(19)
private static int getSystemUiVisibility() {
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
return flags;
}
@TargetApi(21)
private void startScreenCapture() {
MediaProjectionManager mediaProjectionManager =
(MediaProjectionManager) getApplication().getSystemService(
Context.MEDIA_PROJECTION_SERVICE);
startActivityForResult(
mediaProjectionManager.createScreenCaptureIntent(), CAPTURE_PERMISSION_REQUEST_CODE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode != CAPTURE_PERMISSION_REQUEST_CODE)
return;
mediaProjectionPermissionResultCode = resultCode;
mediaProjectionPermissionResultData = data;
startCall();
}
private boolean useCamera2() {
return Camera2Enumerator.isSupported(this) && getIntent().getBooleanExtra(EXTRA_CAMERA2, true);
}
private boolean captureToTexture() {
return getIntent().getBooleanExtra(EXTRA_CAPTURETOTEXTURE_ENABLED, false);
}
private @Nullable VideoCapturer createCameraCapturer(CameraEnumerator enumerator) {
final String[] deviceNames = enumerator.getDeviceNames();
// First, try to find front facing camera
Logging.d(TAG, "Looking for front facing cameras.");
for (String deviceName : deviceNames) {
if (enumerator.isFrontFacing(deviceName)) {
Logging.d(TAG, "Creating front facing camera capturer.");
VideoCapturer videoCapturer = enumerator.createCapturer(deviceName, null);
if (videoCapturer != null) {
return videoCapturer;
}
}
}
// Front facing camera not found, try something else
Logging.d(TAG, "Looking for other cameras.");
for (String deviceName : deviceNames) {
if (!enumerator.isFrontFacing(deviceName)) {
Logging.d(TAG, "Creating other camera capturer.");
VideoCapturer videoCapturer = enumerator.createCapturer(deviceName, null);
if (videoCapturer != null) {
return videoCapturer;
}
}
}
return null;
}
@TargetApi(21)
private @Nullable VideoCapturer createScreenCapturer() {
if (mediaProjectionPermissionResultCode != Activity.RESULT_OK) {
reportError("User didn't give permission to capture the screen.");
return null;
}
return new ScreenCapturerAndroid(
mediaProjectionPermissionResultData, new MediaProjection.Callback() {
@Override
public void onStop() {
reportError("User revoked permission to capture the screen.");
}
});
}
// Activity interfaces
@Override
public void onStop() {
super.onStop();
activityRunning = false;
// Don't stop the video when using screencapture to allow user to show other apps to the remote
// end.
if (peerConnectionClient != null && !screencaptureEnabled) {
peerConnectionClient.stopVideoSource();
}
if (cpuMonitor != null) {
cpuMonitor.pause();
}
}
@Override
public void onStart() {
super.onStart();
activityRunning = true;
// Video is not paused for screencapture. See onPause.
if (peerConnectionClient != null && !screencaptureEnabled) {
peerConnectionClient.startVideoSource();
}
if (cpuMonitor != null) {
cpuMonitor.resume();
}
}
@Override
protected void onDestroy() {
Thread.setDefaultUncaughtExceptionHandler(null);
disconnect();
if (logToast != null) {
logToast.cancel();
}
activityRunning = false;
super.onDestroy();
}
// CallFragment.OnCallEvents interface implementation.
@Override
public void onCallHangUp() {
disconnect();
}
@Override
public void onCameraSwitch() {
if (peerConnectionClient != null) {
peerConnectionClient.switchCamera();
}
}
@Override
public void onVideoScalingSwitch(ScalingType scalingType) {
fullscreenRenderer.setScalingType(scalingType);
}
@Override
public void onCaptureFormatChange(int width, int height, int framerate) {
if (peerConnectionClient != null) {
peerConnectionClient.changeCaptureFormat(width, height, framerate);
}
}
@Override
public boolean onToggleMic() {
if (peerConnectionClient != null) {
micEnabled = !micEnabled;
peerConnectionClient.setAudioEnabled(micEnabled);
}
return micEnabled;
}
// Helper functions.
private void toggleCallControlFragmentVisibility() {
if (!connected || !callFragment.isAdded()) {
return;
}
// Show/hide call control fragment
callControlFragmentVisible = !callControlFragmentVisible;
FragmentTransaction ft = getFragmentManager().beginTransaction();
if (callControlFragmentVisible) {
ft.show(callFragment);
ft.show(hudFragment);
} else {
ft.hide(callFragment);
ft.hide(hudFragment);
}
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
}
private void startCall() {
if (appRtcClient == null) {
Log.e(TAG, "AppRTC client is not allocated for a call.");
return;
}
callStartedTimeMs = System.currentTimeMillis();;
// Start room connection.
logAndToast(getString(R.string.connecting_to, roomConnectionParameters.roomUrl));
appRtcClient.connectToRoom(roomConnectionParameters);
// Create and audio manager that will take care of audio routing,
// audio modes, audio device enumeration etc.
audioManager = AppRTCAudioManager.create(getApplicationContext());
// Store existing audio settings and change audio mode to
// MODE_IN_COMMUNICATION for best possible VoIP performance.
Log.d(TAG, "Starting the audio manager...");
audioManager.start(new AudioManagerEvents() {
// This method will be called each time the number of available audio
// devices has changed.
@Override
public void onAudioDeviceChanged(
AudioDevice audioDevice, Set<AudioDevice> availableAudioDevices) {
onAudioManagerDevicesChanged(audioDevice, availableAudioDevices);
}
});
}
// Should be called from UI thread
private void callConnected() {
final long delta = System.currentTimeMillis() - callStartedTimeMs;
Log.i(TAG, "Call connected: delay=" + delta + "ms");
if (peerConnectionClient == null || isError) {
Log.w(TAG, "Call is connected in closed or error state");
return;
}
// Enable statistics callback.
peerConnectionClient.enableStatsEvents(true, STAT_CALLBACK_PERIOD);
setSwappedFeeds(false /* isSwappedFeeds */);
}
// This method is called when the audio manager reports audio device change,
// e.g. from wired headset to speakerphone.
private void onAudioManagerDevicesChanged(
final AudioDevice device, final Set<AudioDevice> availableDevices) {
Log.d(TAG, "onAudioManagerDevicesChanged: " + availableDevices + ", "
+ "selected: " + device);
// TODO(henrika): add callback handler.
}
// Disconnect from remote resources, dispose of local resources, and exit.
private void disconnect() {
activityRunning = false;
remoteProxyRenderer.setTarget(null);
localProxyVideoSink.setTarget(null);
if (appRtcClient != null) {
appRtcClient.disconnectFromRoom();
appRtcClient = null;
}
if (pipRenderer != null) {
pipRenderer.release();
pipRenderer = null;
}
if (videoFileRenderer != null) {
videoFileRenderer.release();
videoFileRenderer = null;
}
if (fullscreenRenderer != null) {
fullscreenRenderer.release();
fullscreenRenderer = null;
}
if (peerConnectionClient != null) {
peerConnectionClient.close();
peerConnectionClient = null;
}
if (audioManager != null) {
audioManager.stop();
audioManager = null;
}
if (connected && !isError) {
setResult(RESULT_OK);
} else {
setResult(RESULT_CANCELED);
}
finish();
}
private void disconnectWithErrorMessage(final String errorMessage) {
if (commandLineRun || !activityRunning) {
Log.e(TAG, "Critical error: " + errorMessage);
disconnect();
} else {
new AlertDialog.Builder(this)
.setTitle(getText(R.string.channel_error_title))
.setMessage(errorMessage)
.setCancelable(false)
.setNeutralButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
disconnect();
}
})
.create()
.show();
}
}
// Log |msg| and Toast about it.
private void logAndToast(String msg) {
Log.d(TAG, msg);
if (logToast != null) {
logToast.cancel();
}
logToast = Toast.makeText(this, msg, Toast.LENGTH_SHORT);
logToast.show();
}
private void reportError(final String description) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (!isError) {
isError = true;
disconnectWithErrorMessage(description);
}
}
});
}
private @Nullable VideoCapturer createVideoCapturer() {
final VideoCapturer videoCapturer;
String videoFileAsCamera = getIntent().getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA);
if (videoFileAsCamera != null) {
try {
videoCapturer = new FileVideoCapturer(videoFileAsCamera);
} catch (IOException e) {
reportError("Failed to open video file for emulated camera");
return null;
}
} else if (screencaptureEnabled) {
return createScreenCapturer();
} else if (useCamera2()) {
if (!captureToTexture()) {
reportError(getString(R.string.camera2_texture_only_error));
return null;
}
Logging.d(TAG, "Creating capturer using camera2 API.");
videoCapturer = createCameraCapturer(new Camera2Enumerator(this));
} else {
Logging.d(TAG, "Creating capturer using camera1 API.");
videoCapturer = createCameraCapturer(new Camera1Enumerator(captureToTexture()));
}
if (videoCapturer == null) {
reportError("Failed to open camera");
return null;
}
return videoCapturer;
}
private void setSwappedFeeds(boolean isSwappedFeeds) {
Logging.d(TAG, "setSwappedFeeds: " + isSwappedFeeds);
this.isSwappedFeeds = isSwappedFeeds;
localProxyVideoSink.setTarget(isSwappedFeeds ? fullscreenRenderer : pipRenderer);
remoteProxyRenderer.setTarget(isSwappedFeeds ? pipRenderer : fullscreenRenderer);
fullscreenRenderer.setMirror(isSwappedFeeds);
pipRenderer.setMirror(!isSwappedFeeds);
}
// -----Implementation of AppRTCClient.AppRTCSignalingEvents ---------------
// All callbacks are invoked from websocket signaling looper thread and
// are routed to UI thread.
private void onConnectedToRoomInternal(final SignalingParameters params) {
final long delta = System.currentTimeMillis() - callStartedTimeMs;
signalingParameters = params;
logAndToast("Creating peer connection, delay=" + delta + "ms");
VideoCapturer videoCapturer = null;
if (peerConnectionParameters.videoCallEnabled) {
videoCapturer = createVideoCapturer();
}
peerConnectionClient.createPeerConnection(
localProxyVideoSink, remoteSinks, videoCapturer, signalingParameters);
if (signalingParameters.initiator) {
logAndToast("Creating OFFER...");
// Create offer. Offer SDP will be sent to answering client in
// PeerConnectionEvents.onLocalDescription event.
peerConnectionClient.createOffer();
} else {
if (params.offerSdp != null) {
peerConnectionClient.setRemoteDescription(params.offerSdp);
logAndToast("Creating ANSWER...");
// Create answer. Answer SDP will be sent to offering client in
// PeerConnectionEvents.onLocalDescription event.
peerConnectionClient.createAnswer();
}
if (params.iceCandidates != null) {
// Add remote ICE candidates from room.
for (IceCandidate iceCandidate : params.iceCandidates) {
peerConnectionClient.addRemoteIceCandidate(iceCandidate);
}
}
}
}
@Override
public void onConnectedToRoom(final SignalingParameters params) {
runOnUiThread(new Runnable() {
@Override
public void run() {
onConnectedToRoomInternal(params);
}
});
}
@Override
public void onRemoteDescription(final SessionDescription sdp) {
final long delta = System.currentTimeMillis() - callStartedTimeMs;
runOnUiThread(new Runnable() {
@Override
public void run() {
if (peerConnectionClient == null) {
Log.e(TAG, "Received remote SDP for non-initilized peer connection.");
return;
}
logAndToast("Received remote " + sdp.type + ", delay=" + delta + "ms");
peerConnectionClient.setRemoteDescription(sdp);
if (!signalingParameters.initiator) {
logAndToast("Creating ANSWER...");
// Create answer. Answer SDP will be sent to offering client in
// PeerConnectionEvents.onLocalDescription event.
peerConnectionClient.createAnswer();
}
}
});
}
@Override
public void onRemoteIceCandidate(final IceCandidate candidate) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (peerConnectionClient == null) {
Log.e(TAG, "Received ICE candidate for a non-initialized peer connection.");
return;
}
peerConnectionClient.addRemoteIceCandidate(candidate);
}
});
}
@Override
public void onRemoteIceCandidatesRemoved(final IceCandidate[] candidates) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (peerConnectionClient == null) {
Log.e(TAG, "Received ICE candidate removals for a non-initialized peer connection.");
return;
}
peerConnectionClient.removeRemoteIceCandidates(candidates);
}
});
}
@Override
public void onChannelClose() {
runOnUiThread(new Runnable() {
@Override
public void run() {
logAndToast("Remote end hung up; dropping PeerConnection");
disconnect();
}
});
}
@Override
public void onChannelError(final String description) {
reportError(description);
}
// -----Implementation of PeerConnectionClient.PeerConnectionEvents.---------
// Send local peer connection SDP and ICE candidates to remote party.
// All callbacks are invoked from peer connection client looper thread and
// are routed to UI thread.
@Override
public void onLocalDescription(final SessionDescription sdp) {
final long delta = System.currentTimeMillis() - callStartedTimeMs;
runOnUiThread(new Runnable() {
@Override
public void run() {
if (appRtcClient != null) {
logAndToast("Sending " + sdp.type + ", delay=" + delta + "ms");
if (signalingParameters.initiator) {
appRtcClient.sendOfferSdp(sdp);
} else {
appRtcClient.sendAnswerSdp(sdp);
}
}
if (peerConnectionParameters.videoMaxBitrate > 0) {
Log.d(TAG, "Set video maximum bitrate: " + peerConnectionParameters.videoMaxBitrate);
peerConnectionClient.setVideoMaxBitrate(peerConnectionParameters.videoMaxBitrate);
}
}
});
}
@Override
public void onIceCandidate(final IceCandidate candidate) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (appRtcClient != null) {
appRtcClient.sendLocalIceCandidate(candidate);
}
}
});
}
@Override
public void onIceCandidatesRemoved(final IceCandidate[] candidates) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (appRtcClient != null) {
appRtcClient.sendLocalIceCandidateRemovals(candidates);
}
}
});
}
@Override
public void onIceConnected() {
final long delta = System.currentTimeMillis() - callStartedTimeMs;
runOnUiThread(new Runnable() {
@Override
public void run() {
logAndToast("ICE connected, delay=" + delta + "ms");
}
});
}
@Override
public void onIceDisconnected() {
runOnUiThread(new Runnable() {
@Override
public void run() {
logAndToast("ICE disconnected");
}
});
}
@Override
public void onConnected() {
final long delta = System.currentTimeMillis() - callStartedTimeMs;
runOnUiThread(new Runnable() {
@Override
public void run() {
logAndToast("DTLS connected, delay=" + delta + "ms");
connected = true;
callConnected();
}
});
}
@Override
public void onDisconnected() {
runOnUiThread(new Runnable() {
@Override
public void run() {
logAndToast("DTLS disconnected");
connected = false;
disconnect();
}
});
}
@Override
public void onPeerConnectionClosed() {}
@Override
public void onPeerConnectionStatsReady(final StatsReport[] reports) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (!isError && connected) {
hudFragment.updateEncoderStatistics(reports);
}
}
});
}
@Override
public void onPeerConnectionError(final String description) {
reportError(description);
}
}
| [
"android_shuai@163.com"
] | android_shuai@163.com |
23b287d47e6820326ff17d97935279cf72a9313b | 88a58b66b2aa7920977005cea551fe310b4eaef0 | /src/main/java/com/buaa/cfs/fs/permission/PermissionParser.java | 0ca65a93b507d64133baf4b1d65da78eed3f4b9b | [] | no_license | yangjunlin-const/cfs-main | 261f39a56e52a4eb5a93b38b0dc3454fcc16e032 | 5a730329a2b426f280b8c2db271f5a5b180230a0 | refs/heads/master | 2021-01-09T21:52:26.485685 | 2016-02-24T02:33:51 | 2016-02-24T02:33:51 | 52,134,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,693 | 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.buaa.cfs.fs.permission;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Base class for parsing either chmod permissions or umask permissions. Includes common code needed by either operation
* as implemented in UmaskParser and ChmodParser classes.
*/
class PermissionParser {
protected boolean symbolic = false;
protected short userMode;
protected short groupMode;
protected short othersMode;
protected short stickyMode;
protected char userType = '+';
protected char groupType = '+';
protected char othersType = '+';
protected char stickyBitType = '+';
/**
* Begin parsing permission stored in modeStr
*
* @param modeStr Permission mode, either octal or symbolic
* @param symbolic Use-case specific symbolic pattern to match against
*
* @throws IllegalArgumentException if unable to parse modeStr
*/
public PermissionParser(String modeStr, Pattern symbolic, Pattern octal)
throws IllegalArgumentException {
Matcher matcher = null;
if ((matcher = symbolic.matcher(modeStr)).find()) {
applyNormalPattern(modeStr, matcher);
} else if ((matcher = octal.matcher(modeStr)).matches()) {
applyOctalPattern(modeStr, matcher);
} else {
throw new IllegalArgumentException(modeStr);
}
}
private void applyNormalPattern(String modeStr, Matcher matcher) {
// Are there multiple permissions stored in one chmod?
boolean commaSeperated = false;
for (int i = 0; i < 1 || matcher.end() < modeStr.length(); i++) {
if (i > 0 && (!commaSeperated || !matcher.find())) {
throw new IllegalArgumentException(modeStr);
}
/*
* groups : 1 : [ugoa]* 2 : [+-=] 3 : [rwxXt]+ 4 : [,\s]*
*/
String str = matcher.group(2);
char type = str.charAt(str.length() - 1);
boolean user, group, others, stickyBit;
user = group = others = stickyBit = false;
for (char c : matcher.group(1).toCharArray()) {
switch (c) {
case 'u':
user = true;
break;
case 'g':
group = true;
break;
case 'o':
others = true;
break;
case 'a':
break;
default:
throw new RuntimeException("Unexpected");
}
}
if (!(user || group || others)) { // same as specifying 'a'
user = group = others = true;
}
short mode = 0;
for (char c : matcher.group(3).toCharArray()) {
switch (c) {
case 'r':
mode |= 4;
break;
case 'w':
mode |= 2;
break;
case 'x':
mode |= 1;
break;
case 'X':
mode |= 8;
break;
case 't':
stickyBit = true;
break;
default:
throw new RuntimeException("Unexpected");
}
}
if (user) {
userMode = mode;
userType = type;
}
if (group) {
groupMode = mode;
groupType = type;
}
if (others) {
othersMode = mode;
othersType = type;
stickyMode = (short) (stickyBit ? 1 : 0);
stickyBitType = type;
}
commaSeperated = matcher.group(4).contains(",");
}
symbolic = true;
}
private void applyOctalPattern(String modeStr, Matcher matcher) {
userType = groupType = othersType = '=';
// Check if sticky bit is specified
String sb = matcher.group(1);
if (!sb.isEmpty()) {
stickyMode = Short.valueOf(sb.substring(0, 1));
stickyBitType = '=';
}
String str = matcher.group(2);
userMode = Short.valueOf(str.substring(0, 1));
groupMode = Short.valueOf(str.substring(1, 2));
othersMode = Short.valueOf(str.substring(2, 3));
}
protected int combineModes(int existing, boolean exeOk) {
return combineModeSegments(stickyBitType, stickyMode,
(existing >>> 9), false) << 9 |
combineModeSegments(userType, userMode,
(existing >>> 6) & 7, exeOk) << 6 |
combineModeSegments(groupType, groupMode,
(existing >>> 3) & 7, exeOk) << 3 |
combineModeSegments(othersType, othersMode, existing & 7, exeOk);
}
protected int combineModeSegments(char type, int mode,
int existing, boolean exeOk) {
boolean capX = false;
if ((mode & 8) != 0) { // convert X to x;
capX = true;
mode &= ~8;
mode |= 1;
}
switch (type) {
case '+':
mode = mode | existing;
break;
case '-':
mode = (~mode) & existing;
break;
case '=':
break;
default:
throw new RuntimeException("Unexpected");
}
// if X is specified add 'x' only if exeOk or x was already set.
if (capX && !exeOk && (mode & 1) != 0 && (existing & 1) == 0) {
mode &= ~1; // remove x
}
return mode;
}
}
| [
"519100949@qq.com"
] | 519100949@qq.com |
c62e475b87e23f694d075f14c00f1b9abdaaa764 | ef55fe5bffa55e70ad88000249741b6bbfb35575 | /app/src/main/java/com/studentproject/popluarmoviesstage2/AppExecutors.java | 3248accec9108ac2beae27c7b3d3968cd1c01322 | [] | no_license | salazar3antonio/udacity-popular-movies-app-stage-2 | 3e3d3af067123b6018ec574d1602403ab8b2d9eb | 4ea8ba26bc5a210e29e8b762edd917a0f9e37753 | refs/heads/master | 2020-03-30T03:00:21.735642 | 2018-09-28T01:11:56 | 2018-09-28T01:11:56 | 150,663,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,541 | java | package com.studentproject.popluarmoviesstage2;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import java.util.concurrent.Executor;
public class AppExecutors {
// For Singleton instantiation
private static final Object LOCK = new Object();
private static AppExecutors sInstance;
private final Executor diskIO;
private final Executor mainThread;
private final Executor networkIO;
private AppExecutors(Executor diskIO, Executor networkIO, Executor mainThread) {
this.diskIO = diskIO;
this.networkIO = networkIO;
this.mainThread = mainThread;
}
public static AppExecutors getInstance() {
if (sInstance == null) {
synchronized (LOCK) {
sInstance = new AppExecutors(java.util.concurrent.Executors.newSingleThreadExecutor(),
java.util.concurrent.Executors.newFixedThreadPool(3),
new MainThreadExecutor());
}
}
return sInstance;
}
public Executor diskIO() {
return diskIO;
}
public Executor mainThread() {
return mainThread;
}
public Executor networkIO() {
return networkIO;
}
private static class MainThreadExecutor implements Executor {
private Handler mainThreadHandler = new Handler(Looper.getMainLooper());
@Override
public void execute(@NonNull Runnable command) {
mainThreadHandler.post(command);
}
}
}
| [
"salazar3antonio@gmail.com"
] | salazar3antonio@gmail.com |
a4c3daec3a4a7dc829f8e4dd808adec51f541eee | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Math-10/org.apache.commons.math3.analysis.differentiation.DSCompiler/BBC-F0-opt-70/13/org/apache/commons/math3/analysis/differentiation/DSCompiler_ESTest_scaffolding.java | 11e8ce9c8908fda8b997908531b82599c6fb97ee | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 5,812 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Oct 21 13:36:07 GMT 2021
*/
package org.apache.commons.math3.analysis.differentiation;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class DSCompiler_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math3.analysis.differentiation.DSCompiler";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
/*No java.lang.System property to set*/
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DSCompiler_ESTest_scaffolding.class.getClassLoader() ,
"org.apache.commons.math3.exception.util.ExceptionContextProvider",
"org.apache.commons.math3.util.MathArrays",
"org.apache.commons.math3.exception.util.ArgUtils",
"org.apache.commons.math3.exception.MathArithmeticException",
"org.apache.commons.math3.exception.NumberIsTooSmallException",
"org.apache.commons.math3.util.FastMath$ExpIntTable",
"org.apache.commons.math3.util.FastMath$lnMant",
"org.apache.commons.math3.exception.NotPositiveException",
"org.apache.commons.math3.exception.MathInternalError",
"org.apache.commons.math3.exception.MathIllegalStateException",
"org.apache.commons.math3.analysis.differentiation.DSCompiler",
"org.apache.commons.math3.util.FastMath$ExpFracTable",
"org.apache.commons.math3.exception.NonMonotonicSequenceException",
"org.apache.commons.math3.exception.MathIllegalArgumentException",
"org.apache.commons.math3.util.FastMath$CodyWaite",
"org.apache.commons.math3.exception.MathIllegalNumberException",
"org.apache.commons.math3.exception.util.LocalizedFormats",
"org.apache.commons.math3.util.FastMath",
"org.apache.commons.math3.exception.DimensionMismatchException",
"org.apache.commons.math3.exception.util.Localizable",
"org.apache.commons.math3.exception.NumberIsTooLargeException",
"org.apache.commons.math3.exception.NotStrictlyPositiveException",
"org.apache.commons.math3.exception.util.ExceptionContext",
"org.apache.commons.math3.exception.NullArgumentException",
"org.apache.commons.math3.util.FastMathLiteralArrays"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(DSCompiler_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.apache.commons.math3.analysis.differentiation.DSCompiler",
"org.apache.commons.math3.util.FastMath",
"org.apache.commons.math3.util.FastMathLiteralArrays",
"org.apache.commons.math3.util.FastMath$lnMant",
"org.apache.commons.math3.util.FastMath$ExpIntTable",
"org.apache.commons.math3.util.FastMath$ExpFracTable",
"org.apache.commons.math3.util.Precision",
"org.apache.commons.math3.exception.util.LocalizedFormats",
"org.apache.commons.math3.util.ArithmeticUtils",
"org.apache.commons.math3.util.MathArrays",
"org.apache.commons.math3.exception.MathIllegalArgumentException",
"org.apache.commons.math3.exception.MathIllegalNumberException",
"org.apache.commons.math3.exception.DimensionMismatchException",
"org.apache.commons.math3.exception.util.ExceptionContext",
"org.apache.commons.math3.exception.util.ArgUtils",
"org.apache.commons.math3.exception.NumberIsTooLargeException",
"org.apache.commons.math3.util.FastMath$CodyWaite"
);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
a5acd8eef6057215300f18c0ee2595a44146d462 | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/model_seeding/80_wheelwebtool-wheel.components.Label-0.5-10/wheel/components/Label_ESTest_scaffolding.java | 757ff628569c9660151f52c58952a9eeb4eabf31 | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Oct 29 18:39:50 GMT 2019
*/
package wheel.components;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class Label_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pderakhshanfar@bsr01.win.tue.nl"
] | pderakhshanfar@bsr01.win.tue.nl |
e0ddcdbf0edda73b0a01e177b2b65615325b00b5 | dfae25cfc595f7e9c2786ae97ec25d686c2fa055 | /jdroid-android/src/main/java/com/jdroid/android/activity/AbstractFragmentActivity.java | ca1deb99bb400796a83e33c5e271864b3ffbf3d9 | [] | no_license | talkvip/jdroid | a3938d41472d4a570c36b3cbbb6e6783efa4201a | ea1d92c9fe5d4a40b6090131c16c2b3570f0e1c0 | refs/heads/master | 2020-12-24T14:53:38.053058 | 2013-03-16T00:55:43 | 2013-03-16T00:55:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,741 | java | package com.jdroid.android.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.google.ads.AdSize;
import com.jdroid.android.AbstractApplication;
import com.jdroid.android.R;
import com.jdroid.android.context.DefaultApplicationContext;
import com.jdroid.android.domain.User;
import com.jdroid.android.fragment.UseCaseFragment;
import com.jdroid.android.loading.LoadingDialogBuilder;
import com.jdroid.android.usecase.DefaultUseCase;
import com.jdroid.java.exception.UnexpectedException;
/**
* Base {@link Activity}
*
*/
public abstract class AbstractFragmentActivity extends SherlockFragmentActivity implements ActivityIf {
private BaseActivity baseActivity;
/**
* @see com.jdroid.android.fragment.FragmentIf#getAndroidApplicationContext()
*/
@Override
public DefaultApplicationContext getAndroidApplicationContext() {
return baseActivity.getAndroidApplicationContext();
}
/**
* @see com.jdroid.android.fragment.FragmentIf#shouldRetainInstance()
*/
@Override
public Boolean shouldRetainInstance() {
throw new IllegalArgumentException();
}
/**
* @see com.jdroid.android.activity.ActivityIf#onBeforeSetContentView()
*/
@Override
public Boolean onBeforeSetContentView() {
return baseActivity.onBeforeSetContentView();
}
/**
* @see com.jdroid.android.activity.ActivityIf#onAfterSetContentView(android.os.Bundle)
*/
@Override
public void onAfterSetContentView(Bundle savedInstanceState) {
baseActivity.onAfterSetContentView(savedInstanceState);
}
/**
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
baseActivity = AbstractApplication.get().createBaseActivity(this);
baseActivity.beforeOnCreate();
super.onCreate(savedInstanceState);
baseActivity.onCreate(savedInstanceState);
}
/**
* @see android.app.Activity#onContentChanged()
*/
@Override
public void onContentChanged() {
super.onContentChanged();
baseActivity.onContentChanged();
}
/**
* @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
baseActivity.onSaveInstanceState(outState);
}
/**
* @see android.app.Activity#onRestoreInstanceState(android.os.Bundle)
*/
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
baseActivity.onRestoreInstanceState(savedInstanceState);
}
/**
* @see roboguice.activity.GuiceActivity#onStart()
*/
@Override
protected void onStart() {
super.onStart();
baseActivity.onStart();
}
/**
* @see roboguice.activity.GuiceActivity#onResume()
*/
@Override
protected void onResume() {
super.onResume();
baseActivity.onResume();
}
/**
* @see roboguice.activity.RoboActivity#onPause()
*/
@Override
protected void onPause() {
super.onPause();
baseActivity.onPause();
}
/**
* @see roboguice.activity.RoboActivity#onStop()
*/
@Override
protected void onStop() {
super.onStop();
baseActivity.onStop();
}
/**
* @see roboguice.activity.RoboActivity#onDestroy()
*/
@Override
protected void onDestroy() {
super.onDestroy();
baseActivity.onDestroy();
}
/**
* @see android.app.Activity#onActivityResult(int, int, android.content.Intent)
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
baseActivity.onActivityResult(requestCode, resultCode, data);
}
/**
* @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return baseActivity.onCreateOptionsMenu(menu);
}
/**
* @see com.jdroid.android.activity.ActivityIf#getMenuResourceId()
*/
@Override
public int getMenuResourceId() {
return baseActivity.getMenuResourceId();
}
/**
* @see com.jdroid.android.activity.ActivityIf#doOnCreateOptionsMenu(com.actionbarsherlock.view.Menu)
*/
@Override
public void doOnCreateOptionsMenu(android.view.Menu menu) {
throw new UnsupportedOperationException();
}
/**
* @see com.jdroid.android.activity.ActivityIf#doOnCreateOptionsMenu(com.actionbarsherlock.view.Menu)
*/
@Override
public void doOnCreateOptionsMenu(Menu menu) {
baseActivity.doOnCreateOptionsMenu(menu);
}
/**
* @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// REVIEW See if this is the correct approach
return baseActivity.onOptionsItemSelected(item) ? true : super.onOptionsItemSelected(item);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#findView(int)
*/
@Override
@SuppressWarnings("unchecked")
public <V extends View> V findView(int id) {
return (V)findViewById(id);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#showLoading()
*/
@Override
public void showLoading() {
baseActivity.showLoading();
}
/**
* @see com.jdroid.android.fragment.FragmentIf#showLoading(com.jdroid.android.loading.LoadingDialogBuilder)
*/
@Override
public void showLoading(LoadingDialogBuilder builder) {
baseActivity.showLoading(builder);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#showLoadingOnUIThread()
*/
@Override
public void showLoadingOnUIThread() {
baseActivity.showLoadingOnUIThread();
}
/**
* @see com.jdroid.android.fragment.FragmentIf#showLoadingOnUIThread(com.jdroid.android.loading.LoadingDialogBuilder)
*/
@Override
public void showLoadingOnUIThread(LoadingDialogBuilder builder) {
baseActivity.showLoadingOnUIThread(builder);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#dismissLoading()
*/
@Override
public void dismissLoading() {
baseActivity.dismissLoading();
}
/**
* @see com.jdroid.android.fragment.FragmentIf#dismissLoadingOnUIThread()
*/
@Override
public void dismissLoadingOnUIThread() {
baseActivity.dismissLoadingOnUIThread();
}
/**
* @see com.jdroid.android.fragment.FragmentIf#executeOnUIThread(java.lang.Runnable)
*/
@Override
public void executeOnUIThread(Runnable runnable) {
baseActivity.executeOnUIThread(runnable);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#inflate(int)
*/
@Override
public View inflate(int resource) {
return baseActivity.inflate(resource);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#getInstance(java.lang.Class)
*/
@Override
public <I> I getInstance(Class<I> clazz) {
return baseActivity.getInstance(clazz);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#getExtra(java.lang.String)
*/
@Override
public <E> E getExtra(String key) {
return baseActivity.<E>getExtra(key);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#getArgument(java.lang.String)
*/
@Override
public <E> E getArgument(String key) {
return baseActivity.<E>getArgument(key);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#getArgument(java.lang.String, java.lang.Object)
*/
@Override
public <E> E getArgument(String key, E defaultValue) {
return baseActivity.<E>getArgument(key, defaultValue);
}
/**
* @see com.jdroid.android.fragment.FragmentIf#executeUseCase(com.jdroid.android.usecase.DefaultUseCase)
*/
@Override
public void executeUseCase(DefaultUseCase<?> useCase) {
baseActivity.executeUseCase(useCase);
}
/**
* @see com.jdroid.android.usecase.listener.DefaultUseCaseListener#onStartUseCase()
*/
@Override
public void onStartUseCase() {
baseActivity.onStartUseCase();
}
/**
* @see com.jdroid.android.usecase.listener.DefaultUseCaseListener#onUpdateUseCase()
*/
@Override
public void onUpdateUseCase() {
baseActivity.onUpdateUseCase();
}
/**
* @see com.jdroid.android.usecase.listener.DefaultUseCaseListener#onFinishUseCase()
*/
@Override
public void onFinishUseCase() {
baseActivity.onFinishUseCase();
}
/**
* @see com.jdroid.android.usecase.listener.DefaultUseCaseListener#onFinishFailedUseCase(java.lang.RuntimeException)
*/
@Override
public void onFinishFailedUseCase(RuntimeException runtimeException) {
baseActivity.onFinishFailedUseCase(runtimeException);
}
/**
* @see com.jdroid.android.usecase.listener.DefaultUseCaseListener#onFinishCanceledUseCase()
*/
@Override
public void onFinishCanceledUseCase() {
baseActivity.onFinishCanceledUseCase();
}
/**
* @see com.jdroid.android.activity.ActivityIf#requiresAuthentication()
*/
@Override
public Boolean requiresAuthentication() {
return baseActivity.requiresAuthentication();
}
/**
* @see com.jdroid.android.fragment.FragmentIf#getUser()
*/
@Override
public User getUser() {
return baseActivity.getUser();
}
public Boolean isAuthenticated() {
return baseActivity.isAuthenticated();
}
public void loadUseCaseFragment(Bundle savedInstanceState, Class<? extends UseCaseFragment<?>> useCaseFragmentClass) {
if (savedInstanceState == null) {
try {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(useCaseFragmentClass.newInstance(), useCaseFragmentClass.getSimpleName());
fragmentTransaction.commit();
} catch (InstantiationException e) {
throw new UnexpectedException(e);
} catch (IllegalAccessException e) {
throw new UnexpectedException(e);
}
}
}
public UseCaseFragment<?> getUseCaseUseCaseFragment(Class<? extends UseCaseFragment<?>> useCaseFragmentClass) {
return (UseCaseFragment<?>)getSupportFragmentManager().findFragmentByTag(useCaseFragmentClass.getSimpleName());
}
public void commitFragment(Fragment fragment) {
commitFragment(R.id.fragmentContainer, fragment);
}
public void commitFragment(int containerViewId, Fragment fragment) {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.add(containerViewId, fragment);
fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
fragmentTransaction.commit();
}
/**
* @see com.jdroid.android.fragment.FragmentIf#getAdSize()
*/
@Override
public AdSize getAdSize() {
return baseActivity.getAdSize();
}
/**
* @see com.jdroid.android.activity.ActivityIf#isLauncherActivity()
*/
@Override
public Boolean isLauncherActivity() {
return baseActivity.isLauncherActivity();
}
}
| [
"maxirosson@gmail.com"
] | maxirosson@gmail.com |
214888384eca2fd3fa73538231877b3dcd7ef285 | ef8ecf5c99102cf796f6b0ec332692ee1b2c7d5b | /app/src/main/java/ca/qc/cqmatane/informatique/evenements/vue/VueEvenements.java | 28f160384b515588e947368f495098d5b3a09a02 | [] | no_license | SINGHNAVPREET/ProjetMaintenanceSysteme | 8d2a2b8bfa44f4f9521a892a57d7d04ba8b440fd | 620b7f6798e39c82f2aa54ff1c848269f285b420 | refs/heads/master | 2021-05-02T08:16:45.146415 | 2018-02-08T18:53:46 | 2018-02-08T18:53:46 | 120,799,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,472 | java | package ca.qc.cqmatane.informatique.evenements.vue;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import java.util.HashMap;
import java.util.List;
import ca.qc.cqmatane.informatique.evenements.R;
import ca.qc.cqmatane.informatique.evenements.donnees.BaseDeDonnees;
import ca.qc.cqmatane.informatique.evenements.donnees.DAOEvenements;
public class VueEvenements extends AppCompatActivity {
protected DAOEvenements accesseurEvenements;
protected ListView vueListeEvenements;
protected List<HashMap<String,String>> listeEvenements;
protected final static int ACTIVITE_AJOUTER_EVENEMENT = 1;
protected final static int ACTIVITE_MODIFIER_EVENEMENT = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.vue_evenements);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
BaseDeDonnees.getInstance(getApplicationContext());
accesseurEvenements = DAOEvenements.getInstance();
vueListeEvenements = (ListView)findViewById(R.id.vue_liste_evenements);
vueListeEvenements.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int positionDansAdapteur, long positionItem) {
ListView vueListeEvenements = (ListView) view.getParent();
HashMap<String,String> evenement = (HashMap<String,String>) vueListeEvenements.getItemAtPosition((int) (positionItem));
Intent intentionNaviguerVueModificationEvenement = new Intent(VueEvenements.this, VueModifierEvenement.class);
intentionNaviguerVueModificationEvenement.putExtra("id_evenement",evenement.get("id_evenement"));
startActivityForResult(intentionNaviguerVueModificationEvenement,ACTIVITE_MODIFIER_EVENEMENT);
}
});
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.action_ajouter_evenement);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intentionNaviguerModifierEvenement = new Intent(VueEvenements.this, VueAjouterEvenement.class);
startActivityForResult(intentionNaviguerModifierEvenement,ACTIVITE_AJOUTER_EVENEMENT);
}
});
afficherTousLesEvenements();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_vue_evenements, 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);
}
@Override
protected void onActivityResult(int activite, int resultCode, Intent data) {
switch (activite) {
case ACTIVITE_AJOUTER_EVENEMENT :
afficherTousLesEvenements();
break;
case ACTIVITE_MODIFIER_EVENEMENT :
afficherTousLesEvenements();
break;
}
}
public void afficherTousLesEvenements(){
listeEvenements = accesseurEvenements.listerLesEvenementsEnHashMap();
SimpleAdapter adapteurVueListeEvenements = new SimpleAdapter(
this,
listeEvenements,
android.R.layout.two_line_list_item,
new String[]{"titre","date"},
new int[]{android.R.id.text1, android.R.id.text2}
);
vueListeEvenements.setAdapter(adapteurVueListeEvenements);
}
}
| [
"navpreet.mail@gmail.com"
] | navpreet.mail@gmail.com |
c952df22eba0fa90fdfc021021389dd71d6fb346 | 12a392d149a77dac0f0e1047b474de1aae02793d | /src/com/dialogic/clientLibrary/XMSCallState.java | 19794e618e2ca4a2c29d98542984d5fe63204c6b | [] | no_license | swetha878/XMSTesting | 9a0c64e04dce01cb08ff3cab2228bf9bc329ba34 | 6f9799028864e0993621fd97ce660a7b4126edab | refs/heads/master | 2021-01-10T03:12:39.221347 | 2015-07-07T16:54:45 | 2015-07-07T16:54:45 | 36,828,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.dialogic.clientLibrary;
/**
* This enum will contain the Call states for an XMSCall
*
* @author dwolansk
*/
public enum XMSCallState {
NULL,
MAKECALL, //outbound calls
ACCEPTED,
CONNECTED, // Call is active for either Inbound or outbound
PLAY,
PLAY_END,
PLAYCOLLECT,
COLLECTDIGITS,
PLAYRECORD,
RECORD,
RECORD_END,
JOINING,
WAITCALL, // Waiting for an inbound call
OFFERED, // inbound calls
UPDATECALL,
DISCONNECTED,
REJECTED,
SENDMESSAGE,
SENDDTMF,
CONF,
CUSTOM
}
| [
"swetha.satyanarayana@dialogic.com"
] | swetha.satyanarayana@dialogic.com |
856816789fb482303aa9c7c23e90c8c03ce10b79 | 5bfceca1ab1eb246443e691b2cf0a7f5de3e6a46 | /src/com/javalesson/domainmodel/Employee.java | d7b7e507b0b61483ff501b1da2a80c782392cbe2 | [] | no_license | tprofi/OOP | 9e4d3703cd9466b5d14e8af214eb437cc3b84c07 | f17bf2a7733daad85d4e961d51e9f4d06d175bb2 | refs/heads/master | 2021-09-23T09:22:51.246634 | 2021-09-11T20:25:06 | 2021-09-11T20:25:06 | 223,496,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,489 | java | package com.javalesson.domainmodel;
public class Employee {
private static int id;
private int employeeId;
private String name;
private String position;
private int salary;
static {
id = 1001;
System.out.println("Static init block");
}
{
System.out.println("Non static initialisation block");
}
public Employee () {
this("A", "B", 13);
System.out.println('\'' + toString());
System.out.println("Empty constructor called");
}
public Employee (String name, String position, int salary) {
this(name, position, salary, "IT");
System.out.println("Constructor with 3 param called");
}
private Employee (String name, String position, int salary, String department) {
employeeId = id++;
this.name = name;
this.position = position;
this.salary = salary;
System.out.println("Constructor with 4 param called");
}
public static int getId () {
return id;
}
public String getName () {
return name;
}
public String getPosition () {
return position;
}
public int getSalary () {
return salary;
}
public String toString () {
return "Employee{" +
"employeeId=" + employeeId +
", name='" + name + '\'' +
", position='" + position + '\'' +
", salary=" + salary +
'}';
}
}
| [
"filkabyas@gmail.com"
] | filkabyas@gmail.com |
740999d0483e324c18b375297cb9e72e1a74026f | 3e8d44de72e54e645bfc7b00ad7932f9e7eedec7 | /src/com/game/data/GameResConfig.java | 6de2c765e128f3b20d8fc867ca35c50e5eb6095d | [] | no_license | archermyc/myEngine | f08a09a5b7652dee4ab155e77ef520abe1be8f77 | 8247a41759c6abd14779e5031a108f9e7cc10ec0 | refs/heads/master | 2016-09-08T02:05:59.556984 | 2013-07-15T07:22:27 | 2013-07-15T07:22:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,806 | java | package com.game.data;
import com.example.myc.engine.GameApp;
public class GameResConfig {
public static int[] getAttackEffect(int index) {
String nameBase = "gun_bullet4";
int len = getEffectLength(index);
int[] temp = new int[len];
for (int i = 0; i < len; i++) {
String name = nameBase + i;
String pname = GameApp.getInstnce().getPackageName();
int resid = GameApp.getInstnce().getResources()
.getIdentifier(name, "drawable", pname);
temp[i] = resid;
}
return temp;
}
/**
* ���ö�����Ч����
*
* @param index
* @return
*/
public static int getEffectLength(int index) {
switch (index) {
case 0:
return 5;
case 1:
return 14;
case 2:
return 19;
case 7:
return 13;
case 18:
return 15;
case 21:
return 17;
}
return index;
}
public static int[] getTowerSprite(int index) {
String nameBase = "gun_tower" + index;
int len = getTowerSpriteLength(index);
int[] temp = new int[len];
for (int i = 1; i <= len; i++) {
String name = nameBase + i;
String pname = GameApp.getInstnce().getPackageName();
int resid = GameApp.getInstnce().getResources()
.getIdentifier(name, "drawable", pname);
temp[i - 1] = resid;
}
return temp;
}
public static String[] getTowerRes(int index) {
String nameBase = "gun_tower" + index;
int len = getTowerSpriteLength(index);
String[] temp = new String[len];
for (int i = 1; i <= len; i++) {
String name = nameBase + i;
String pname = "images/tower/" + name + ".png";
temp[i - 1] = pname;
}
return temp;
}
/**
* 获得炮台动画长度
*
* @param index
* @return
*/
public static int getTowerSpriteLength(int index) {
switch (index) {
case 1:
return 5;
case 2:
return 5;
case 9:
return 5;
}
return index;
}
public static int[] getBulletSprite(int index) {
String nameBase = "gun_bullet" + index;
int len = getTowerSpriteLength(index);
int[] temp = new int[len];
for (int i = 1; i <= len; i++) {
String name = nameBase + i;
String pname = GameApp.getInstnce().getPackageName();
int resid = GameApp.getInstnce().getResources()
.getIdentifier(name, "drawable", pname);
temp[i - 1] = resid;
}
return temp;
}
public static String[] getBulletRes(int index) {
String nameBase = "gun_bullet" + index;
int len = getBulletSpriteLength(index);
String[] temp = new String[len];
for (int i = 1; i <= len; i++) {
String name = nameBase + i;
String pname = "images/bullet/" + name + ".png";
temp[i - 1] = pname;
}
return temp;
}
/**
* 获得子弹动画长度
*
* @param index
* @return
*/
public static int getBulletSpriteLength(int index) {
switch (index) {
case 3:
return 4;
case 2:
return 5;
}
return index;
}
}
| [
"YCMO@.boyaa.com"
] | YCMO@.boyaa.com |
a700380a11b8fd6fa38a62e0aed16a52f2c3cd99 | dd93b7134fb68ccd9071b65e45cfd973a01086d8 | /src/Controller/Teacher/TeacherDetailAction.java | adcdc480f5a665e15f2a9e9cf426638eae624f8b | [] | no_license | susuuS2/Test | 65962399a1fa0c0884b15fefe87b7b8b4e6a5328 | 674a07bac6b19b571b1644c65cb9891ea00d8104 | refs/heads/master | 2020-09-07T10:31:13.972236 | 2019-11-09T10:30:53 | 2019-11-09T10:30:53 | 220,752,254 | 0 | 0 | null | 2019-11-10T06:43:44 | 2019-11-10T06:43:43 | null | UTF-8 | Java | false | false | 537 | java | package Controller.Teacher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import DAO.JoinDAO;
import DTO.JoinDTO;
public class TeacherDetailAction {
public void execute(HttpServletRequest request, HttpServletResponse response) {
Integer joinNum1 = Integer.parseInt(request.getParameter("num"));
JoinDAO dao = new JoinDAO();
JoinDTO dto = dao.TeacherDetail(joinNum1);
dto.setJoinPre(dto.getJoinPre().replace("\n", "<br/>"));
request.setAttribute("dto", dto);
}
}
| [
"jhsk3c@naver.com"
] | jhsk3c@naver.com |
27311f93af125ce6ce1bb626f2983f5602ca2a92 | 2162dfb067838e3434d9b43386c9770e43ea01cc | /src/main/java/com/xavier/dao/MenuDao.java | 2f4758bf423226be3c56251bf81100f94032cdf3 | [] | no_license | NewGr8Player/SpringBoot-Thymeleaf | 85552c3ecb03335a1eca4682a7f0bbc0873853dc | 692fbf14d204149420386f62469bbb6ab6f95c15 | refs/heads/master | 2020-03-24T13:05:59.001864 | 2018-12-13T00:59:06 | 2018-12-13T00:59:06 | 142,735,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 890 | java | package com.xavier.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.xavier.bean.Menu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.cache.annotation.Cacheable;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
/**
* 菜单Dao
*
* @author NewGr8Player
*/
@Mapper
public interface MenuDao extends BaseMapper<Menu> {
@Override
@Select("<script>"
+ "SELECT * FROM sys_menu WHERE id IN"
+ " <foreach item='item' index='index' collection='idList' open='(' separator=',' close=')'>"
+ " #{item}"
+ " </foreach>"
+ " ORDER BY menu_order"
+ "</script>")
List<Menu> selectBatchIds(@Param("idList") Collection<? extends Serializable> idList);
}
| [
"273221594@qq.com"
] | 273221594@qq.com |
541a9c20e55466f422f223034a436e0fec3dddb2 | 5a513e83fb81861119e147b0581ced25ef6bd691 | /slice-cq/src/main/java/com/cognifide/slice/cq/module/CQModule.java | e2e2d83d5cc7f684e1e49b82ff99e549e9d11b7e | [
"Apache-2.0"
] | permissive | bodek/Slice | 61cf533b055ef2b70d5e83a8bb77779f7215a31f | 33bdc78700bcde7a969b8d9c80b6695361be3e1b | refs/heads/master | 2021-01-16T07:09:50.297016 | 2012-11-12T10:33:38 | 2012-11-12T10:33:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,891 | java | package com.cognifide.slice.cq.module;
/*
* #%L
* Slice - CQ Add-on
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2012 Cognifide Limited
* %%
* 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.
* #L%
*/
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.ResourceResolver;
import com.cognifide.slice.api.context.ContextScope;
import com.cognifide.slice.api.scope.ContextScoped;
import com.cognifide.slice.commons.module.ContextScopeModule;
import com.cognifide.slice.cq.PageChildrenProvider;
import com.cognifide.slice.cq.impl.PageChildrenProviderImpl;
import com.day.cq.wcm.api.PageManager;
import com.day.cq.wcm.api.WCMMode;
import com.google.inject.Provides;
public final class CQModule extends ContextScopeModule {
public CQModule(final ContextScope contextScope) {
super(contextScope);
}
@Override
protected void configure() {
bind(PageChildrenProvider.class).to(PageChildrenProviderImpl.class);
}
@Provides
@ContextScoped
public PageManager getPageManager(final ResourceResolver resourceResolver) {
return resourceResolver.adaptTo(PageManager.class);
}
@Provides
// this is NOT supposed to be request scoped, wcm mode can change many times
// during request
public WCMMode getWCMMode(final SlingHttpServletRequest request) {
return WCMMode.fromRequest(request);
}
}
| [
"rafal.przemyslaw.malinowski@gmail.com"
] | rafal.przemyslaw.malinowski@gmail.com |
8e36a869bf48bfdab1bef0739fcc97a893e2b468 | 90f7d2aff6b5649b8e886fe13ab0754a337dd336 | /src/main/java/com/lechatong/beakhub/Fragments/CommentFragment.java | 2e43dec3f2b7dcbb1d8672896e619b3b2659267f | [] | no_license | LeChatong/BeakHubApp | 44c845bdc23a1c955d4d2d16ccdfe25ac3ae010c | 22a7a788c6f9258cabe34a053ac024e256de91a0 | refs/heads/master | 2023-02-14T18:11:23.751120 | 2021-01-13T14:43:16 | 2021-01-13T14:43:16 | 314,914,586 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,091 | java | package com.lechatong.beakhub.Fragments;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.Toast;
import com.lechatong.beakhub.Activities.ProfileJobActivity;
import com.lechatong.beakhub.Adapter.ChatAdapter;
import com.lechatong.beakhub.Adapter.JobAdapter;
import com.lechatong.beakhub.Entities.Comment;
import com.lechatong.beakhub.Models.BhComment;
import com.lechatong.beakhub.Models.Chat;
import com.lechatong.beakhub.R;
import com.lechatong.beakhub.Tools.APIResponse;
import com.lechatong.beakhub.Tools.Deserializer;
import com.lechatong.beakhub.Tools.ServiceCallback;
import com.lechatong.beakhub.Tools.Streams.CommentStreams;
import com.lechatong.beakhub.WebService.BeakHubService;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import io.reactivex.disposables.Disposable;
import io.reactivex.observers.DisposableObserver;
import static android.content.Context.MODE_PRIVATE;
public class CommentFragment extends Fragment implements ServiceCallback<APIResponse> {
private RecyclerView recyclerCommentView;
private Random random;
private ChatAdapter adapter = null;
private EditText editMessage;
private AppCompatImageView imageSend;
private Context context;
private Disposable disposable;
private Long job_id;
private Long account_id;
private List<BhComment> bhComments;
private static final String ID_JOB = "JOB_ID";
private static final String ID_ACCOUNT = "ID_ACCOUNT";
private static final String PREFS = "PREFS";
public CommentFragment() {
}
public static CommentFragment newInstance() {
return new CommentFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = getActivity();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_comment, container, false);
ProfileJobActivity activity = (ProfileJobActivity) getActivity();
assert activity != null;
job_id = activity.getSharedPreferences(PREFS, MODE_PRIVATE).getLong(ID_JOB,0);
account_id = activity.getSharedPreferences(PREFS, MODE_PRIVATE).getLong(ID_ACCOUNT,0);
this.onApplyViews(view);
return view;
}
@SuppressLint("WrongConstant")
private void onApplyViews(View view) {
editMessage = (EditText) view.findViewById(R.id.edit_message);
recyclerCommentView = (RecyclerView) view.findViewById(R.id.comment_recycler_view);
this.configureRecyclerView();
this.loadRecyclerView();
imageSend = (AppCompatImageView) view.findViewById(R.id.image_send);
imageSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onSend();
}
});
}
private void onSend() {
String chatContent = editMessage.getText().toString();
if(!chatContent.isEmpty()){
Comment comment = new Comment();
comment.setCommentary(chatContent);
comment.setJob_id(job_id);
comment.setUser_id(account_id);
BeakHubService.addCommentary(this, comment);
}else{
Toast.makeText(context, R.string.not_text, Toast.LENGTH_LONG).show();
}
editMessage.setText(null);
}
private void loadRecyclerView(){
this.disposable = CommentStreams.streamCommentByJobId(job_id)
.subscribeWith(new DisposableObserver<APIResponse>(){
@Override
public void onNext(APIResponse bhJobs) {
updateListCommment(bhJobs);
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
private void configureRecyclerView(){
this.bhComments = new ArrayList<>();
this.adapter = new ChatAdapter(this.bhComments, account_id);
this.recyclerCommentView.setAdapter(adapter);
this.recyclerCommentView.setLayoutManager(new LinearLayoutManager(getActivity()));
}
private void updateListCommment(APIResponse value){
List<BhComment> bhCommentList = new ArrayList<BhComment>();
ArrayList<BhComment> bhCommentArrayList = (ArrayList<BhComment>) value.getDATA();
for(Object treeMap : bhCommentArrayList){
bhCommentList.add(Deserializer.getComment(treeMap));
}
bhComments.addAll(bhCommentList);
adapter.notifyDataSetChanged();
}
private void disposeWhenDestroy(){
if (this.disposable != null && !this.disposable.isDisposed()) this.disposable.dispose();
}
@Override
public void onDestroy() {
super.onDestroy();
this.disposeWhenDestroy();
}
@Override
public void success(APIResponse value) {
if(value.getCODE() == 201){
BhComment bhComment = (BhComment) Deserializer.getComment(value.getDATA());
adapter.add(bhComment);
recyclerCommentView.smoothScrollToPosition(adapter.getItemCount());
}else {
Toast.makeText(context, value.getMESSAGE(), Toast.LENGTH_LONG).show();
}
}
@Override
public void error(Throwable throwable) {
Toast.makeText(context, throwable.getMessage(), Toast.LENGTH_LONG).show();
}
}
| [
"ulrich.tchatong@gmail.com"
] | ulrich.tchatong@gmail.com |
c82d26e9dfb543f2efa20594329d455f08ff8ec3 | 49b4cb79c910a17525b59d4b497a09fa28a9e3a8 | /parserValidCheck/src/main/java/com/ke/css/cimp/fhl/fhl2/Rule_Grp_TXT_SCC.java | b9bcf1f468bf3faf8a98d94516f208897d6d20c3 | [] | no_license | ganzijo/koreanair | a7d750b62cec2647bfb2bed4ca1bf8648d9a447d | e980fb11bc4b8defae62c9d88e5c70a659bef436 | refs/heads/master | 2021-04-26T22:04:17.478461 | 2018-03-06T05:59:32 | 2018-03-06T05:59:32 | 124,018,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,554 | java | package com.ke.css.cimp.fhl.fhl2;
/* -----------------------------------------------------------------------------
* Rule_Grp_TXT_SCC.java
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Thu Feb 22 17:14:24 KST 2018
*
* -----------------------------------------------------------------------------
*/
import java.util.ArrayList;
final public class Rule_Grp_TXT_SCC extends Rule
{
public Rule_Grp_TXT_SCC(String spelling, ArrayList<Rule> rules)
{
super(spelling, rules);
}
public Object accept(Visitor visitor)
{
return visitor.visit(this);
}
public static Rule_Grp_TXT_SCC parse(ParserContext context)
{
context.push("Grp_TXT_SCC");
boolean parsed = true;
int s0 = context.index;
ParserAlternative a0 = new ParserAlternative(s0);
ArrayList<ParserAlternative> as1 = new ArrayList<ParserAlternative>();
parsed = false;
{
int s1 = context.index;
ParserAlternative a1 = new ParserAlternative(s1);
parsed = true;
if (parsed)
{
boolean f1 = true;
int c1 = 0;
for (int i1 = 0; i1 < 1 && f1; i1++)
{
int g1 = context.index;
ArrayList<ParserAlternative> as2 = new ArrayList<ParserAlternative>();
parsed = false;
{
int s2 = context.index;
ParserAlternative a2 = new ParserAlternative(s2);
parsed = true;
if (parsed)
{
boolean f2 = true;
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Rule_Sep_Slant.parse(context);
if ((f2 = rule != null))
{
a2.add(rule, context.index);
c2++;
}
}
parsed = c2 == 1;
}
if (parsed)
{
boolean f2 = true;
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Rule_MId_SCC.parse(context);
if ((f2 = rule != null))
{
a2.add(rule, context.index);
c2++;
}
}
parsed = c2 == 1;
}
if (parsed)
{
boolean f2 = true;
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Rule_SHIPPER_POST_CODE_FOR_KCUS.parse(context);
if ((f2 = rule != null))
{
a2.add(rule, context.index);
c2++;
}
}
parsed = c2 == 1;
}
if (parsed)
{
boolean f2 = true;
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Rule_Sep_CRLF.parse(context);
if ((f2 = rule != null))
{
a2.add(rule, context.index);
c2++;
}
}
parsed = c2 == 1;
}
if (parsed)
{
as2.add(a2);
}
context.index = s2;
}
ParserAlternative b = ParserAlternative.getBest(as2);
parsed = b != null;
if (parsed)
{
a1.add(b.rules, b.end);
context.index = b.end;
}
f1 = context.index > g1;
if (parsed) c1++;
}
parsed = c1 == 1;
}
if (parsed)
{
as1.add(a1);
}
context.index = s1;
}
ParserAlternative b = ParserAlternative.getBest(as1);
parsed = b != null;
if (parsed)
{
a0.add(b.rules, b.end);
context.index = b.end;
}
Rule rule = null;
if (parsed)
{
rule = new Rule_Grp_TXT_SCC(context.text.substring(a0.start, a0.end), a0.rules);
}
else
{
context.index = s0;
}
context.pop("Grp_TXT_SCC", parsed);
return (Rule_Grp_TXT_SCC)rule;
}
}
/* -----------------------------------------------------------------------------
* eof
* -----------------------------------------------------------------------------
*/
| [
"wrjo@wrjo-PC"
] | wrjo@wrjo-PC |
dfaf1d6ce7317e6bf982c58a6fd52f7f9f715f96 | 8727b1cbb8ca63d30340e8482277307267635d81 | /PolarServer/src/com/game/login/message/ReqQuitToGameMessage.java | 35ef8f7a73f07783c836f0b95726c56368c73256 | [] | no_license | taohyson/Polar | 50026903ded017586eac21a7905b0f1c6b160032 | b0617f973fd3866bed62da14f63309eee56f6007 | refs/heads/master | 2021-05-08T12:22:18.884688 | 2015-12-11T01:44:18 | 2015-12-11T01:44:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.game.login.message;
import com.game.message.Message;
import org.apache.mina.core.buffer.IoBuffer;
/**
* @author Commuication Auto Maker
*
* @version 1.0.0
*
* 退出游戏消息
*/
public class ReqQuitToGameMessage extends Message{
//是否强制退出
private byte force;
/**
* 写入字节缓存
*/
public boolean write(IoBuffer buf){
//是否强制退出
writeByte(buf, this.force);
return true;
}
/**
* 读取字节缓存
*/
public boolean read(IoBuffer buf){
//是否强制退出
this.force = readByte(buf);
return true;
}
/**
* get 是否强制退出
* @return
*/
public byte getForce(){
return force;
}
/**
* set 是否强制退出
*/
public void setForce(byte force){
this.force = force;
}
@Override
public int getId() {
return 100305;
}
@Override
public String getQueue() {
return null;
}
@Override
public String getServer() {
return null;
}
@Override
public String toString(){
StringBuffer buf = new StringBuffer("[");
//是否强制退出
buf.append("force:" + force +",");
if(buf.charAt(buf.length()-1)==',') buf.deleteCharAt(buf.length()-1);
buf.append("]");
return buf.toString();
}
} | [
"zhuyuanbiao@ZHUYUANBIAO.rd.com"
] | zhuyuanbiao@ZHUYUANBIAO.rd.com |
4f107f3e2f770eb3ba5a51fe6552f02441358d25 | 663d84077f4cd9487c209382f9d65455261371e6 | /AbstractDemo/src/HighSchoolStudent.java | 8b0b3f8126fa67d6266eec77eadd21f3e143d722 | [] | no_license | ibmanubhav/Day1 | be20db7f75931f602ab9869de9b2040c11801e08 | 6f243cd97a8480a7e723a6b64e38ddccc64f4c74 | refs/heads/main | 2023-03-25T17:58:15.396345 | 2021-03-17T18:17:25 | 2021-03-17T18:17:25 | 346,082,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 61 | java |
public class HighSchoolStudent extends StudentAbstract {
}
| [
"ibmjavanh08@iiht.tech"
] | ibmjavanh08@iiht.tech |
dece08bec579cb32c239971ef4dfb9fe0541a4dd | e89277ec3c1b5980eed8c19939a65f2b80f2b60d | /src/org/sablecc/objectmacro/intermediate/macro/MUserErrorVersionsDifferent.java | e93a015ecfdf39f1c3eb0cef710bca59b7577238 | [
"Apache-2.0"
] | permissive | SableCC/sablecc | b844c4e918fd09096075f1ec49f55b76e6c5b51f | 378fc74a2e8213567149a6c676d79d7630e87640 | refs/heads/master | 2023-03-11T03:44:14.785650 | 2018-09-13T01:10:02 | 2018-09-13T01:10:02 | 328,567 | 107 | 18 | Apache-2.0 | 2018-09-13T01:11:52 | 2009-10-06T14:42:08 | Java | UTF-8 | Java | false | false | 1,361 | java | /* This file was generated by SableCC's ObjectMacro. */
package org.sablecc.objectmacro.intermediate.macro;
import java.util.*;
class MUserErrorVersionsDifferent
extends Macro {
public MUserErrorVersionsDifferent() {
}
@Override
void apply(
InternalsInitializer internalsInitializer) {
internalsInitializer.setUserErrorVersionsDifferent(this);
}
public String build() {
CacheBuilder cache_builder = this.cacheBuilder;
if (cache_builder == null) {
cache_builder = new CacheBuilder();
}
else {
return cache_builder.getExpansion();
}
this.cacheBuilder = cache_builder;
List<String> indentations = new LinkedList<>();
StringBuilder sbIndentation = new StringBuilder();
StringBuilder sb0 = new StringBuilder();
MObjectMacroUserErrorHead minsert_3 = new MObjectMacroUserErrorHead();
sb0.append(minsert_3.build(null));
sb0.append(LINE_SEPARATOR);
sb0.append(LINE_SEPARATOR);
sb0.append(
"The Macros of the child macro must be equal to the Macros of the parent.");
cache_builder.setExpansion(sb0.toString());
return sb0.toString();
}
@Override
String build(
Context context) {
return build();
}
}
| [
"egagnon@j-meg.com"
] | egagnon@j-meg.com |
cf8c370e028d7cc7a3f3cd146d1e368660b66cff | c4d06ce0d2d29f3c368c4fb2ff63e840110d39b9 | /src/main/java/com/zhengqing/demo/modules/system/service/impl/TableService.java | 40ccadab3d834ee17c7a38858a662e4c77a5b0db | [] | no_license | HanKaiqiang/mysql2word | f462a23d5f4e1d50d93bdae1a3645d9822deb2d0 | c871c67f75421c7953560a37356f2e2b552ac197 | refs/heads/master | 2023-01-27T23:43:38.496134 | 2020-12-03T03:49:20 | 2020-12-03T03:49:20 | 318,064,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,648 | java | package com.zhengqing.demo.modules.system.service.impl;
import com.zhengqing.demo.config.Constants;
import com.zhengqing.demo.modules.system.Fields;
import com.zhengqing.demo.modules.system.Models;
import com.zhengqing.demo.modules.system.entity.Tables;
import com.zhengqing.demo.modules.system.mapper.TableMapper;
import com.zhengqing.demo.modules.system.service.ITableService;
import com.zhengqing.demo.utils.DateTimeUtils;
import com.zhengqing.demo.utils.TableToWordUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p> 实现类 </p>
*
* @author : zhengqing
* @description :
* @date : 2019/11/8 16:22
*/
@Slf4j
@Service
public class TableService implements ITableService {
@Autowired
private TableMapper tableMapper;
@Autowired
private TableToWordUtil tableToWordUtil;
@Override
public String getTableInfo() {
// 1、获取数据库所有表信息
List<String> tableNames = tableMapper.getAllTableNames();
List<String> history = tableNames.stream().filter(name -> name.contains("_history")).collect(Collectors.toList());
List<Fields> allFields = tableMapper.getAllFields();
List<Models> allModels = tableMapper.getAllModels();
List<Tables> tables = new ArrayList<>();
for (String tableName : tableNames) {
Tables table = new Tables();
table.setName(tableName);
for (Models model : allModels) {
String key = model.getKey();
if (tableName.endsWith(key)) {
table.setComment(model.getName());
tables.add(table);
break;
}
}
}
// List<Tables> tables = tableMapper.getAllTables(Constants.DATABASE);
// 2、生成文件名信息 - 年月日时分秒
String date = null;
try {
date = DateTimeUtils.dateFormat(new Date(), DateTimeUtils.PARSE_PATTERNS[12]);
} catch (ParseException e) {
e.printStackTrace();
}
String docFileName = Constants.FILE_PATH + "\\" + Constants.FILE_NAME + "-" + date + ".doc";
// 3、调用工具类生成文件
tableToWordUtil.toWord(tables, docFileName, Constants.FILE_NAME, allFields);
// 4、返回文件地址
String filePath = docFileName.replaceAll("\\\\", "/");
return filePath;
}
}
| [
"359292410@qq.com"
] | 359292410@qq.com |
faf382aec77bdc498ef2527fb6ab052bf4273812 | e8a3f02f3e6f44f544108da8f282d2a6e3837d69 | /src/cn/org/springmvc/controller/test/QueryWeatherControllerTest.java | de7c3f30423950490f586ebd42ae449ec1663cff | [
"Apache-2.0"
] | permissive | dlzhangna/WeatherPrj | 940957697f4e8212c9703d0688b67643dda4e645 | 868e9d925167f2f3cd8780d4c414f89d69cd7263 | refs/heads/master | 2016-09-06T06:06:29.517467 | 2015-08-23T15:34:53 | 2015-08-23T15:34:53 | 41,243,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package cn.org.springmvc.controller.test;
import java.util.List;
import cn.org.springmvc.bean.OneDayWeatherInf;
import cn.org.springmvc.controller.QueryWeatherController;
/**
* QueryWeatherControllerTest:Test class for QueryWeatherController
* @author Na Zhang
* @since V1.0 2015/08/22
*/
public class QueryWeatherControllerTest {
public static void main(String args[]){
QueryWeatherController ggw = new QueryWeatherController();
String cityName = "Sydney";
List<OneDayWeatherInf> resultList = ggw.getWeather(cityName);
for(int j=0;j<resultList.size();j++){
OneDayWeatherInf onDayInfo = (OneDayWeatherInf) resultList.get(j);
System.out.println("City:"+onDayInfo.getCity()+"\t"+"Date:"+onDayInfo.getDate()+" "+onDayInfo.getWeek()+"\t"+"Weather:"+onDayInfo.getWeather()+"\t"+"Temp:"+onDayInfo.getTempertureNow()+"\t"+"Wind:"+onDayInfo.getWind());
}
}
}
| [
"66880542@qq.com"
] | 66880542@qq.com |
5c667bc3b3e94932b4bfee059a6f17bc3e95ca68 | ab59063ff2ae941b876324070d8f8e8165cef960 | /chunking_text_file/40authors/golangpkg/master/RequestComponentContainer.java | 3b8f5295c2352d91721d9159c3da5c606add28bf | [] | no_license | gpoorvi92/author_class | f7c26f46f1ca9608a8c98fb18fc74a544cf99c36 | b079ef0a477a2868140d77c4b32c317d4492725e | refs/heads/master | 2020-04-01T18:01:54.665333 | 2018-12-10T14:55:11 | 2018-12-10T14:55:11 | 153,466,983 | 1 | 0 | null | 2018-10-17T14:44:56 | 2018-10-17T14:03:04 | Java | UTF-8 | Java | false | false | 1,134 | java | package com.am.jlfu.fileuploader.web.utils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Component;
/**
* {@link HttpServletResponse} and {@link HttpServletRequest} are stored in a thread local and are
* populated by the filter.
*
* @author antoinem
*
*/
@Component
public class RequestComponentContainer {
private ThreadLocal<HttpServletResponse> responseThreadLocal = new ThreadLocal<HttpServletResponse>();
private ThreadLocal<HttpServletRequest> requestThreadLocal = new ThreadLocal<HttpServletRequest>();
public void populate(HttpServletRequest request, HttpServletResponse response) {
responseThreadLocal.set(response);
requestThreadLocal.set(request);
}
public void clear() {
responseThreadLocal.remove();
}
public HttpServletResponse getResponse() {
return responseThreadLocal.get();
}
public HttpServletRequest getRequest() {
return requestThreadLocal.get();
}
public HttpSession getSession() {
return requestThreadLocal.get().getSession();
}
}
| [
"gpoorvi92@gmail.com"
] | gpoorvi92@gmail.com |
1ce632e80696ac3cc56eb52177dfd9163fbd9b41 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/androidx/constraintlayout/a/d.java | c6d78e4c1935bcd4b795437a434b3076467c789c | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 519 | java | package androidx.constraintlayout.a;
import com.tencent.matrix.trace.core.AppMethodBeat;
public final class d
extends b
{
public d(c paramc)
{
super(paramc);
}
public final void e(h paramh)
{
AppMethodBeat.i(193941);
super.e(paramh);
paramh.bhb -= 1;
AppMethodBeat.o(193941);
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes11.jar
* Qualified Name: androidx.constraintlayout.a.d
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
7dbc92dedfb3eb149177b44506ef601b47df7a53 | 008c7a3e3647b87084d1bd26c89e885ab605c4aa | /src/averroes/experiments/util/TimeUtils.java | 955c4432ea9f3338064451a9bebd1cb93c0b29b9 | [] | no_license | vespertine22/averroes-experiments | 24ad2c3262525f0ff6ce620814c6824d91705196 | 55eb9c487c44f5e71a43456b07a4fed0b8dec930 | refs/heads/master | 2020-06-14T04:45:49.035804 | 2016-05-17T15:42:51 | 2016-05-17T15:42:51 | 75,233,723 | 0 | 1 | null | 2016-11-30T22:43:23 | 2016-11-30T22:43:23 | null | UTF-8 | Java | false | false | 957 | java | package averroes.experiments.util;
/**
* A utility class to time operations.
*
* @author karim
*
*/
public class TimeUtils {
private static long start = System.currentTimeMillis();
private static long splitStart = System.currentTimeMillis();
/**
* Calculate the elapsed time in seconds.
*
* @return
*/
public static double elapsedTime() {
return Math.round((System.currentTimeMillis() - start) / 1000.0, Math.round$default$2());
}
/**
* Calculate the elapsed time in seconds starting at the split start.
*
* @return
*/
public static double elapsedSplitTime() {
return Math.round((System.currentTimeMillis() - splitStart) / 1000.0, Math.round$default$2());
}
/**
* Split the timer.
*/
public static void splitStart() {
splitStart = System.currentTimeMillis();
}
/**
* Reset the start time used to calculate the elapsed time.
*/
public static void reset() {
start = System.currentTimeMillis();
}
}
| [
"karim.ali@cased.de"
] | karim.ali@cased.de |
5b93025c52c43a09a267230251463726ca78a354 | 1d200a4108f08a2924f20b7b1cc3bf10fca5abba | /Blogger/app/src/main/java/com/example/hi/blogger/Login.java | e7deed750cbab9df4735f567cbd4891fdd1ff55f | [] | no_license | mohammedajaroud/Blogger | 6b8d1ec7b71c15ac5897f204ddb1175b14534fb4 | 460442a796d30498bdbb86191e915012f7fafafe | refs/heads/master | 2021-04-28T18:36:52.534081 | 2017-08-27T15:45:04 | 2017-08-27T15:45:04 | 121,877,169 | 1 | 0 | null | 2018-02-17T17:41:48 | 2018-02-17T17:41:48 | null | UTF-8 | Java | false | false | 7,087 | java | package com.example.hi.blogger;
import android.app.ProgressDialog;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class Login extends AppCompatActivity
{
EditText email,password;
Button login,register;
SignInButton googlesignin;
ProgressDialog dialog;
FirebaseAuth firebaseAuth;
DatabaseReference databaseReference;
private static int RC_SIGN_IN = 2;
private static String TAG = "login";
private GoogleApiClient mGoogleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
dialog=new ProgressDialog(Login.this);
dialog.setMessage("signinging in...");
dialog.setCancelable(false);
firebaseAuth=FirebaseAuth.getInstance();
databaseReference= FirebaseDatabase.getInstance().getReference().child("Users");
email= (EditText)findViewById(R.id.useremail);
password=(EditText)findViewById(R.id.userpass);
googlesignin = (SignInButton)findViewById(R.id.googlesignin);
googlesignin.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
setupGoogleAccount();
}
});
register=(Button)findViewById(R.id.registeruser);
register.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
Intent i = new Intent(Login.this, Register.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
});
login=(Button)findViewById(R.id.login);
login.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
startlogin();
}
});
// Configure Google Sign In
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(Login.this)
.enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener()
{
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult)
{
}
}).addApi(Auth.GOOGLE_SIGN_IN_API,gso)
.build();
}
private void setupGoogleAccount()
{
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
private void startlogin()
{
String e = email.getText().toString();
String p = password.getText().toString();
if(!TextUtils.isEmpty(e) && !TextUtils.isEmpty(p))
{
dialog.show();
firebaseAuth.signInWithEmailAndPassword(e,p).addOnCompleteListener(new OnCompleteListener<AuthResult>()
{
@Override
public void onComplete(@NonNull Task<AuthResult> task)
{
if(task.isSuccessful())
{
dialog.dismiss();
checkUserExists();
}
else
{
dialog.dismiss();
Toast.makeText(Login.this,"Enter correct values",Toast.LENGTH_LONG).show();
}
}
});
}
else
Toast.makeText(Login.this,"Enter all values",Toast.LENGTH_LONG).show();
}
private void checkUserExists()
{
if(firebaseAuth.getCurrentUser() != null)
{
final String uid = firebaseAuth.getCurrentUser().getUid();
databaseReference.addValueEventListener(new ValueEventListener()
{
@Override
public void onDataChange(DataSnapshot dataSnapshot)
{
if (dataSnapshot.hasChild(uid))
{
Intent i = new Intent(Login.this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
else
{
Toast.makeText(Login.this, "Setup your account", Toast.LENGTH_LONG).show();
Intent i = new Intent(Login.this, Setup.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
}
@Override
public void onCancelled(DatabaseError databaseError)
{
}
});
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
dialog.setMessage("signing in..");
dialog.show();
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = result.getSignInAccount();
firebaseAuthWithGoogle(account);
} else {
// Google Sign In failed, update UI appropriately
// ...
dialog.dismiss();
}
}
}
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
firebaseAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user = firebaseAuth.getCurrentUser();
checkUserExists();
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
Toast.makeText(Login.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
// ...
dialog.dismiss();
}
});
}
}
| [
"me.avik191@gmail.com"
] | me.avik191@gmail.com |
f30d97250fe0c088522f308f2a50ab715f85db04 | bc6209153df634e039f49c44003ba6c070888754 | /stb_dtv/src/main/java/com/nathan/arch/domain/model/ChannelSortTypeDModel.java | bf5c862266d8db2d5e40cee34a5d005f5da8a5df | [
"MIT"
] | permissive | Nathan-Feng/DTV-MVP-Clean-Demo | 0637f2540858de82856bc5cad39c4aeb235ad9e0 | b497dc5b6241770ac3edad5c4f5b4d12f632a5b1 | refs/heads/master | 2020-11-23T19:52:36.744874 | 2019-12-13T09:01:52 | 2019-12-13T09:01:52 | 227,797,340 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,944 | java | package com.nathan.arch.domain.model;
public class ChannelSortTypeDModel {
public static final ChannelSortTypeDModel NUMERIC = new ChannelSortTypeDModel(0);
public static final ChannelSortTypeDModel ABC = new ChannelSortTypeDModel(1);
public static final ChannelSortTypeDModel CBA = new ChannelSortTypeDModel(2);
public static final ChannelSortTypeDModel FREE_CAS = new ChannelSortTypeDModel(3);
public static final ChannelSortTypeDModel CAS_FREE = new ChannelSortTypeDModel(4);
public static final ChannelSortTypeDModel TP = new ChannelSortTypeDModel(5);
public static final ChannelSortTypeDModel SERVICE_ID = new ChannelSortTypeDModel(6);
public static final ChannelSortTypeDModel LOGIC_NO = new ChannelSortTypeDModel(7);
public static final ChannelSortTypeDModel PROVIDER = new ChannelSortTypeDModel(8);
public static final ChannelSortTypeDModel NONE = new ChannelSortTypeDModel(-1);
private int value;
private ChannelSortTypeDModel(int value){
this.value = value;
}
public int getValue(){
return value;
}
@Override
public String toString() {
return "ChannelSortTypeDModel{" +
"value=" + value +
'}';
}
public static String getStringName(int value){
switch (value){
case 0:
return "NUMBERIC";
case 1:
return "ABC";
case 2:
return "CBA";
case 3:
return "FREECAS";
case 4:
return "CASFREE";
case 5:
return "TP";
case 6:
return "SERVID";
case 7:
return "LOGICNO";
case 8:
return "PROVIDER";
case -1:
return "NONE";
default:
break;
}
return null;
}
}
| [
"hellozhaoyf@126.com"
] | hellozhaoyf@126.com |
82d769c70a382f4af7a102129dfba372f68a730d | adb9a1b92ecf2fcca1bdc4b74184ef90d91f7efc | /wystri-form/src/main/java/org/wystriframework/form/formbuilder/appenders/CheckboxFieldAppender.java | a43abeaaff3c1df009d4a647848b6c63788a49f8 | [
"Apache-2.0"
] | permissive | ronaldtm/wystriframework | 4b09707efcbf534e64c06861d65693f8ffb170f5 | 8aaa9d75ce1e5bb52830c41042f9b1d814b0057d | refs/heads/master | 2023-08-08T07:12:55.743767 | 2023-04-18T12:48:21 | 2023-04-18T12:48:21 | 180,693,031 | 0 | 0 | Apache-2.0 | 2023-07-07T21:55:47 | 2019-04-11T01:44:29 | Java | UTF-8 | Java | false | false | 1,170 | java | package org.wystriframework.form.formbuilder.appenders;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.form.FormComponent;
import org.wystriframework.core.definition.IField;
import org.wystriframework.core.definition.IRecord;
import org.wystriframework.form.formbuilder.AbstractFieldComponentAppender;
import org.wystriframework.form.formbuilder.FieldComponentContext;
import org.wystriframework.form.formbuilder.RecordModel;
import org.wystriframework.ui.bootstrap.BSFormGroup;
public class CheckboxFieldAppender extends AbstractFieldComponentAppender<Boolean> {
@Override
protected <E> FormComponent<Boolean> newFormComponent(FieldComponentContext<E, Boolean> ctx) {
final IField<E, Boolean> ifield = (IField<E, Boolean>) ctx.getField();
ctx.getFormGroup().setMode(BSFormGroup.Mode.CHECK);
return newBooleanCheckField(ctx.getRecord(), ifield);
}
private <E> FormComponent<Boolean> newBooleanCheckField(final RecordModel<? extends IRecord<E>, E> record, IField<E, Boolean> field) {
return new CheckBox(field.getName(), record.field(field));
}
}
| [
"194626+ronaldtm@users.noreply.github.com"
] | 194626+ronaldtm@users.noreply.github.com |
db73029b6ec93b8cab40f5ef2bb06d5599287399 | 1bef5bfc19e57663b847023ee17ccd13cc356bd6 | /src/main/java/MatrixGUI.java | 0e74e5f71ca2559a7c7e94f450a85a47dca37ae4 | [] | no_license | kristinazhurbenko/programming | 3f5066381ac1daa2147d7cde07995ffacf1db228 | 69656e9e7dce8c4ee0192b7fca5c0c89e32e1ea0 | refs/heads/master | 2022-05-19T22:54:07.004566 | 2014-12-07T13:44:59 | 2014-12-07T13:44:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,742 | java | import javax.swing.*;
import java.util.StringTokenizer;
public class MatrixGUI extends javax.swing.JFrame {
private JButton bAdd, bDivide, bMultiply, bSubtruct;
private JDialog jDialog1;
private JLabel jLabel1, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9;
private JScrollPane jScrollPane1, jScrollPane2, jScrollPane3;
private JTextArea taA, taB, taC;
int arrA[][], arrB[][];
public MatrixGUI() {
initComponents();
}
static public int[][] parseMatrix(JTextArea ta) throws Exception {
String rawText = ta.getText();
String val = "";
int i = 0;
int j = 0;
int[] rSize = new int[100];
StringTokenizer ts = new StringTokenizer(rawText, "\n");
if (ts.hasMoreTokens() == false) {
JOptionPane.showMessageDialog(null, "No values was entered in one or both matrices)! " +
"Program will be terminated");
}
while (ts.hasMoreTokens()) {
StringTokenizer ts2 = new StringTokenizer(ts.nextToken());
while (ts2.hasMoreTokens()) {
ts2.nextToken();
j++;
}
rSize[i] = j;
i++;
j = 0;
}
for (int c = 0; c < i; c++) {
if (rSize[c] != i) {
throw new Exception("Incorrect matrices size! Next time make sure both matrices have the same size.");
}
}
int n = i;
int matrix[][] = new int[n][n];
i = j = 0;
StringTokenizer st = new StringTokenizer(rawText, "\n");
while (st.hasMoreTokens()) {
StringTokenizer st2 = new
StringTokenizer(st.nextToken());
while (st2.hasMoreTokens()) {
val = st2.nextToken();
try {
matrix[i][j] = Integer.valueOf(val).intValue();
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(null, "Incorrect number format. Only number allowed!" +
"\nIncorrect input set to default - 0");
}
j++;
}
i++;
j = 0;
}
return matrix;
}
private void displayMatrix(int[][] matrix) {
String tempStr = "";
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
tempStr = tempStr.concat(matrix[i][j] + " ");
}
tempStr = tempStr.concat("\n");
}
taC.setText(tempStr);
jDialog1.setVisible(true);
}
private void bAddActionPerformed(java.awt.event.ActionEvent evt) {
try {
arrA = parseMatrix(taA);
arrB = parseMatrix(taB);
} catch (Exception e) {
e.printStackTrace();
}
MatrixMultiThreadAdd matrixMultiThreadAdd = new MatrixMultiThreadAdd();
displayMatrix(matrixMultiThreadAdd.add(arrA, arrB));
}
private void bSubtructActionPerformed(java.awt.event.ActionEvent evt) {
try {
arrA = parseMatrix(taA);
arrB = parseMatrix(taB);
} catch (Exception e) {
e.printStackTrace();
}
MatrixMultiThreadSub matrixMultiThreadSub = new MatrixMultiThreadSub();
displayMatrix(matrixMultiThreadSub.sub(arrA, arrB));
}
private void bMultiplyActionPerformed(java.awt.event.ActionEvent evt) {
try {
arrA = parseMatrix(taA);
arrB = parseMatrix(taB);
} catch (Exception e) {
e.printStackTrace();
}
MatrixMultiThreadMult multiThreadMult = new MatrixMultiThreadMult();
displayMatrix(multiThreadMult.multiply(arrA, arrB));
}
private void bDivideActionPerformed(java.awt.event.ActionEvent evt) {
try {
arrA = parseMatrix(taA);
arrB = parseMatrix(taB);
} catch (Exception e) {
e.printStackTrace();
}
MatrixMultiThreadDiv matrixMultiThreadDiv = new MatrixMultiThreadDiv();
displayMatrix(matrixMultiThreadDiv.div(arrA, arrB));
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jDialog1 = new javax.swing.JDialog();
jLabel9 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
taC = new javax.swing.JTextArea();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
bAdd = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
bSubtruct = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
bMultiply = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
bDivide = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
taA = new javax.swing.JTextArea();
jScrollPane3 = new javax.swing.JScrollPane();
taB = new javax.swing.JTextArea();
jDialog1.setBounds(new java.awt.Rectangle(0, 0, 500, 250));
jDialog1.setMinimumSize(new java.awt.Dimension(400, 250));
jDialog1.getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel9.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel9.setText("RESULT");
jDialog1.getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 13, -1, -1));
jScrollPane1.setMinimumSize(new java.awt.Dimension(100, 75));
jScrollPane1.setPreferredSize(new java.awt.Dimension(150, 200));
jScrollPane1.setWheelScrollingEnabled(false);
taC.setColumns(20);
taC.setRows(5);
jScrollPane1.setViewportView(taC);
jDialog1.getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 60, 181, 119));
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("Arithmetic operations with matrices");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel2.setText("Enter data to matrix A:");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel3.setText("Enter data to matrix B:");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel4.setText("Perform operations with matrices:");
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel5.setText("Addition: ");
bAdd.setFont(new java.awt.Font("Arial Unicode MS", 1, 14)); // NOI18N
bAdd.setText("Add!");
bAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bAddActionPerformed(evt);
}
});
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel6.setText("Subtruction:");
bSubtruct.setFont(new java.awt.Font("Arial Unicode MS", 1, 14)); // NOI18N
bSubtruct.setText("Subtruct!");
bSubtruct.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bSubtructActionPerformed(evt);
}
});
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel7.setText("Multiplication:");
bMultiply.setFont(new java.awt.Font("Arial Unicode MS", 1, 14)); // NOI18N
bMultiply.setText("Multiply!");
bMultiply.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bMultiplyActionPerformed(evt);
}
});
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel8.setText("Division:");
bDivide.setFont(new java.awt.Font("Arial Unicode MS", 1, 14)); // NOI18N
bDivide.setText("Divide!");
bDivide.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bDivideActionPerformed(evt);
}
});
taA.setColumns(20);
taA.setRows(5);
taA.setAutoscrolls(false);
jScrollPane2.setViewportView(taA);
taB.setColumns(20);
taB.setRows(5);
jScrollPane3.setViewportView(taB);
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(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(jLabel7)
.addComponent(jLabel6)
.addComponent(jLabel5))
.addGap(60, 60, 60)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(bSubtruct, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bAdd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bMultiply, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bDivide, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))))
.addContainerGap(112, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jLabel1)
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
.addComponent(jLabel4)
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(bAdd))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6)
.addComponent(bSubtruct))
.addGap(22, 22, 22)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel7)
.addComponent(bMultiply))
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel8)
.addComponent(bDivide))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MatrixGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MatrixGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MatrixGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MatrixGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MatrixGUI().setVisible(true);
}
});
}
} | [
"kpe@ciklum.com"
] | kpe@ciklum.com |
6360bc27f235dd9fda3db3ff8cb1de0ee1c245d5 | 0ab6ba1942ebbbdf310a797b68e9a805cf2c0404 | /src/main/java/gnu/io/rfc2217/ComPortCommand.java | 9897ca52c3d416e825c822fac6a71817ca65a2e4 | [] | no_license | madhephaestus/nrjavaserial | 593228b165107fdedff08d2e611592c8bc0e3fc2 | 5f9329221df75ae36bcbba15dfd63f2f326920c6 | refs/heads/master | 2020-02-26T16:05:25.284803 | 2016-05-14T04:58:41 | 2016-05-14T04:58:41 | 58,765,947 | 0 | 1 | null | 2016-05-13T19:08:08 | 2016-05-13T19:08:08 | null | UTF-8 | Java | false | false | 4,430 | java |
/*
* Copyright (C) 2010 Archie L. Cobbs. All rights reserved.
*
* $Id: ComPortCommand.java 47 2011-12-07 15:56:28Z archie.cobbs $
*/
package gnu.io.rfc2217;
import java.util.Arrays;
import static gnu.io.rfc2217.RFC2217.COM_PORT_OPTION;
import static gnu.io.rfc2217.RFC2217.SERVER_OFFSET;
/**
* Superclass for RFC 2217 commands.
*
*
* Instances of this class (and all subclasses) are immutable.
*
*
* @see <a href="http://tools.ietf.org/html/rfc2217">RFC 2217</a>
*/
public abstract class ComPortCommand {
final String name;
final int[] bytes;
/**
* Constructor.
*
* @param name human readable name of this command
* @param command required {@code COM-PORT-OPTION} command byte value (must be the client-to-server value)
* @param bytes encoded command starting with the {@code COM-PORT-OPTION} byte
* NullPointerException if {@code bytes} is null
* IllegalArgumentException if {@code bytes} has length that is too short or too long
* IllegalArgumentException if {@code bytes[0]} is not {@link RFC2217#COM_PORT_OPTION}
* IllegalArgumentException if {@code command} is greater than or equal to {@link RFC2217#SERVER_OFFSET}
* IllegalArgumentException if {@code bytes[1]} is not {@code command}
* or {@code command} + {@link RFC2217#SERVER_OFFSET}
*/
protected ComPortCommand(String name, int command, int[] bytes) {
this.name = name;
int minLength = 2 + this.getMinPayloadLength();
int maxLength = 2 + this.getMaxPayloadLength();
if (bytes.length < minLength || bytes.length > maxLength) {
throw new IllegalArgumentException("command " + command + " length = "
+ bytes.length + " is not in the range " + minLength + ".." + maxLength);
}
this.bytes = bytes.clone(); // maintain immutability
if (this.bytes[0] != COM_PORT_OPTION)
throw new IllegalArgumentException("not a COM-PORT-OPTION");
if (command >= SERVER_OFFSET)
throw new IllegalArgumentException("invalid command " + command);
if (this.getCommand() != command && this.getCommand() != command + SERVER_OFFSET)
throw new IllegalArgumentException("not a " + name + " option");
}
/**
* Determine if this command is client-to-server or server-to-client.
*
* @return true if this command is sent from the server to the client, false for the opposite
*/
public final boolean isServerCommand() {
return this.getCommand() >= SERVER_OFFSET;
}
/**
* Get the encoding of this instance.
*
* @return encoding starting with {@code COM-PORT-OPTION}
*/
public final int[] getBytes() {
return this.bytes.clone(); // maintain immutability
}
/**
* Get the command byte.
*
* @return RFC 2217-defined byte value for this command
*/
public final int getCommand() {
return this.bytes[1] & 0xff;
}
/**
* Get the human-readable name of this option.
*/
public String getName() {
return this.name + (this.isServerCommand() ? "[S]" : "[C]");
}
/**
* Get the human-readable description of this option.
*/
@Override
public abstract String toString();
/**
* Apply visitor pattern.
*
* @param sw visitor switch handler
*/
public abstract void visit(ComPortCommandSwitch sw);
/**
* Get the option payload as bytes.
*/
byte[] getPayload() {
byte[] buf = new byte[this.bytes.length - 2];
for (int i = 2; i < bytes.length; i++)
buf[i - 2] = (byte)this.bytes[i];
return buf;
}
/**
* Get minimum required length of the payload of this command.
*/
abstract int getMinPayloadLength();
/**
* Get maximum required length of the payload of this command.
*/
abstract int getMaxPayloadLength();
@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass())
return false;
ComPortCommand that = (ComPortCommand)obj;
return Arrays.equals(this.bytes, that.bytes);
}
@Override
public int hashCode() {
int hash = 0;
for (int i = 0; i < this.bytes.length; i++)
hash = hash * 37 + this.bytes[i];
return hash;
}
}
| [
"mad.hephaestus@gmail.com"
] | mad.hephaestus@gmail.com |
b36bfda78e5332aa3fd9d83d8eb3fe04bf1c0b4d | 88f810f3d67b91f1b1257ba3f944535905aa2a2f | /multimedia-communicator/src/com/nercms/schedule/sip/engine/sipua/phone/Phone.java | 1a066a7d441b9e6e5c78bf852fddd2ddaff58552 | [] | no_license | fuxy2010/MediaSDK | 98769bf964ceb1bd7711473849350df9b444a3c6 | e96a82e27dfb56c1b1cab2d1622846e2c7be2f71 | refs/heads/master | 2021-08-26T08:38:33.685118 | 2017-11-22T16:54:35 | 2017-11-22T16:54:35 | 111,710,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,338 | java | /*
* Copyright (C) 2009 The Sipdroid Open Source Project
* Copyright (C) 2006 The Android Open Source Project
*
* This file is part of Sipdroid (http://www.sipdroid.org)
*
* Sipdroid 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 source code 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 source code; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.nercms.schedule.sip.engine.sipua.phone;
import android.content.Context;
import android.telephony.ServiceState;
public interface Phone {
enum State { IDLE,RINGING,OFFHOOK };
State getState();
enum SuppService { UNKNOWN, SWITCH, SEPARATE, TRANSFER, CONFERENCE, REJECT, HANGUP };
Context getContext();
Call getForegroundCall();
Call getBackgroundCall();
Call getRingingCall();
ServiceState getServiceState();
}
| [
"fuym@whu.edu.cn"
] | fuym@whu.edu.cn |
8286629d6c4ed5eb829f66a48ae7c9a179cfd846 | bd3c91405ed0faa7eec783899334a9e0b0e8feda | /src/main/java/com/bridgelabz/notes/dao/LabelDaoimpl.java | e4a665175c3fac8b616d01f44baf5721f4b0b251 | [] | no_license | patilrupesh990/FundooApiNotes | 831f4e03f4478563932920059b49b29716f4d691 | 0f51f38eb5599394386325d0fa1445c4aeaa838d | refs/heads/master | 2022-08-13T01:58:38.379148 | 2020-02-25T17:18:48 | 2020-02-25T17:18:48 | 234,558,908 | 0 | 0 | null | 2022-07-07T23:01:02 | 2020-01-17T13:56:21 | Java | UTF-8 | Java | false | false | 2,185 | java | package com.bridgelabz.notes.dao;
import java.util.List;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.bridgelabz.notes.model.Label;
import com.bridgelabz.notes.model.Note;
import com.bridgelabz.notes.util.HibernateUtil;
import lombok.extern.slf4j.Slf4j;
@Repository
@Slf4j
public class LabelDaoimpl implements ILabelDao {
@Autowired
HibernateUtil<Label> hibernateUtil;
@Override
public int addLabel(Label label, Long noteId) {
String query = "UPDATE Label SET noteId = :NOTEID WHERE labelId= :LABELID";
Query<Label> hQuery = hibernateUtil.createQuery(query);
hQuery.setParameter("NOTEID", noteId);
hQuery.setParameter("LABELID",label.getLabelId());
return hQuery.executeUpdate();
}
@Override
public boolean createLabel(Label label) {
try {
hibernateUtil.save(label);
return true;
} catch (Exception e) {
return false;
}
}
@Override
public int deleteLabel( Long labelId) {
String query = "DELETE FROM Label WHERE labelId = :label";
Query<Label> hQuery = hibernateUtil.createQuery(query);
hQuery.setParameter("label", labelId);
return hQuery.executeUpdate();
}
@Override
public int updateLable(Long labelId, String newName) {
Label labelObject = hibernateUtil.getCurrentLable(labelId);
if (labelObject != null) {
labelObject.setLabelName(newName);
hibernateUtil.update(labelObject);
return 1;
}
return 0;
}
@Override
public Label getLableById(Long labelId) {
return hibernateUtil.getCurrentLable(labelId);
}
@Override
public List<Label> getAllLabelByUserId(Long userId)
{
String query = "FROM Label WHERE userId = :user";
Query<Label> hQuery = hibernateUtil.createQuery(query);
hQuery.setParameter("user", userId);
return hQuery.getResultList();
}
public List<Object[]> getNotesByLabelId(Long labelId)
{
String SQL = "select * from notes left join note_label on note_label.note_id=notes.id where note_label.label_id = :id";
Query query =hibernateUtil.createNativeQuery(SQL);
query.setParameter("id", labelId);
return query.list();
//no entity mapping
}
}
| [
"patilrupesh990@gmail.com"
] | patilrupesh990@gmail.com |
ae19cfd49fe4672254db93b0473a62a88842da46 | 1e7d22314d7df9553eedb2b0ac95d03b01ca1ba9 | /ucloud-sdk-java-pathx/src/main/java/cn/ucloud/pathx/models/UnBindPathXSSLResponse.java | 191fa9193e7027b33ddfb9d7bcb7707a2d9a0cc9 | [
"Apache-2.0"
] | permissive | ucloud/ucloud-sdk-java | afb917e4b6dbab37b0fef64bd9c1fc4741080115 | 594fa0df0c983a7efc455a967cd32328fd3ea12b | refs/heads/master | 2023-09-05T20:26:49.886576 | 2023-08-07T09:09:56 | 2023-08-07T09:09:56 | 152,350,105 | 25 | 17 | Apache-2.0 | 2023-09-12T09:13:42 | 2018-10-10T02:20:10 | Java | UTF-8 | Java | false | false | 746 | java | /**
* Copyright 2021 UCloud Technology Co., Ltd.
*
* <p>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
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>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 cn.ucloud.pathx.models;
import cn.ucloud.common.response.Response;
public class UnBindPathXSSLResponse extends Response {}
| [
"noreply@github.com"
] | noreply@github.com |
9828e9eecc72aa573ab50266b7cec050fe32c202 | 1b3a9cd5c8b32c04dee4560296c56ade23b54a1f | /spring_project/spring_aspectj/src/main/java/com/bjpowernode/s03/SomeService.java | ef853d351fb51338ce96949b7373dea6e2866925 | [] | no_license | y144/second_stage_project | 79e6a18fff3fe5cbfa114f636e8ca7e9ef216b69 | 9e4659bd2c587753faff7b015dfc0ac12c28af11 | refs/heads/master | 2023-02-19T01:11:07.827322 | 2021-01-25T09:35:14 | 2021-01-25T09:35:14 | 332,694,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package com.bjpowernode.s03;
/**
* 杨廷甲
* 2020-12-08
*/
public interface SomeService {
void doSome(String name, int age);
String doThree(String name,int age);
}
| [
"yanglun@126.com"
] | yanglun@126.com |
6b81928d99c690c1f15932d716615e68508b66fe | e7a94ec0c68ab09e826ab140c525c29056e460dd | /customer-service/src/main/java/com/fortytwotalents/CustomerServiceApplication.java | b4c9d97130e886863524caddbc5d6609fe82b608 | [
"Apache-2.0"
] | permissive | 42talents/pcf-eureka-hystrix-demo | 0fb85ca9a216984b8f0627f2c2ebbeb5befc0618 | e102f96045b1d65cf6e4e339250eada9d11178b4 | refs/heads/master | 2021-03-19T07:36:45.001297 | 2019-08-22T04:10:32 | 2019-08-22T04:10:32 | 94,372,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package com.fortytwotalents;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@EnableDiscoveryClient
@SpringBootApplication
public class CustomerServiceApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerServiceApplication.class, args);
}
@Configuration
static class ApplicationSecurity extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers("/**");
}
}
}
| [
"patrick.baumgartner@42talents.com"
] | patrick.baumgartner@42talents.com |
c8cdcf6d34abaf2c734110a43e8a662447258c0b | 9b8df0ec208a5582f52956cf7b7ce7034ff01aec | /src/main/java/com/farm/web/dao/ReviewDao.java | c7951ca7ed47eb4d7c44c98028dc6bfe2a06fcbf | [] | no_license | SoohwanJang/Farm-plus | 6a8bcffd86068384079594772c7128d11054b487 | e262d794dc97c0fcef0070d646bffb58731ef2de | refs/heads/master | 2022-12-23T09:06:11.246972 | 2020-09-21T05:41:08 | 2020-09-21T05:41:08 | 286,059,274 | 0 | 0 | null | 2020-09-21T23:54:29 | 2020-08-08T14:32:32 | Java | UTF-8 | Java | false | false | 2,490 | java | package com.farm.web.dao;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.farm.web.entity.Review;
import com.farm.web.entity.ReviewNoticeVo;
import com.farm.web.entity.ReviewView;
import com.farm.web.entity.ReviewView2;
import com.farm.web.entity.DTO.ReviewViewofIndex;
@Mapper
public interface ReviewDao {
@Select("SELECT R.* ,I.name as productName FROM ReviewView R join Item I on R.itemId = I.id where pub =1 and isdel =0 order by regDate desc limit 4")
List<ReviewViewofIndex> indexOfReviews();
@Select("select * from ReviewView2 where sellerId = ${id} and ${field} like '%${query}%' order by regDate desc limit #{offset}, #{size}")
List<ReviewView2> getList3(int id, int offset, int size, String field, String query);
@Select("SELECT * FROM ReviewView order by regDate desc limit 10")
List<ReviewView> getList2();
@Select("select r.*, m.name from Review r join Member m on r.writerId = m.id where ${field} like '%${query}%' order by regDate desc limit #{offset}, #{size}")
List<ReviewView> getList(int offset, int size, String field, String query);
@Delete("delete from Review where id in (${id})")
int delete(String id);
@Select("SELECT * FROM ReviewView WHERE ID=#{id}")
ReviewView get(int id);
@Insert("INSERT INTO Review (title,content) VALUES(#{title},#{content}")
int insert(Review review);
@Update("")
int update(Review review);
@Delete("")
int delet(Review review);
@Select("SELECT * FROM ReviewView where itemId = ${prId} limit 10")
List<ReviewNoticeVo> selectByItemId(int prId);
@Select("SELECT * FROM Review where id = ${noticeId} and itemId=${prId}")
Review selectByReviewIdAndPrId(int noticeId, int prId);
@Select("SELECT R.* FROM Review R join Item I on R.itemId = I.id where I.id = ${prId} limit 10")
List<Review> selectAll(int prId);
@Select("SELECT * FROM ReviewView where itemId = ${prId} limit 10 offset ${offset}")
List<ReviewNoticeVo> plusTenReviewRow(int offset, int prId);
@Insert("INSERT INTO Review (id,writerId,itemId,title,content,hit,rate,regDate,like) "
+ "VALUE(NULL,${review.writerId},${review.itemId},#{review.title},#{review.content},#{review.hit},#{review.rate},NOW(),#{review.like})")
int InsertReview(Review review);
}
| [
"wkssk@192.168.124.100"
] | wkssk@192.168.124.100 |
0fd6a16956543249831926149c74f3c5636a2c1f | 49b64d9aadb46a7df70571f5ce86afee26e88474 | /src/main/java/com/mods/kina/ExperiencePower/gui/GuiEPWorkbench.java | b14b87419ba319e7f14af52ae4bb0a594ad6a5ed | [] | no_license | CrafterKina/ExperiencePower | 85c60ff7853287b4b23cbebea0d97656f5151875 | 159cdf4d50d44963e03cab8558c69c3b10e1c573 | refs/heads/master | 2021-01-19T09:09:21.731029 | 2015-04-19T01:18:50 | 2015-04-19T01:18:50 | 28,576,277 | 1 | 0 | null | 2015-02-16T12:40:45 | 2014-12-29T01:34:12 | Java | UTF-8 | Java | false | false | 2,542 | java | package com.mods.kina.ExperiencePower.gui;
import com.mods.kina.ExperiencePower.container.ContainerEPWorkbench;
import com.mods.kina.ExperiencePower.recipe.IRecipeWithExp;
import com.mods.kina.ExperiencePower.util.UtilRecipe;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class GuiEPWorkbench extends GuiContainer{
private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation("textures/gui/container/crafting_table.png");
private final World world;
private final EntityPlayer player;
public GuiEPWorkbench(World world, EntityPlayer player, BlockPos pos){
super(new ContainerEPWorkbench(world, player, pos));
this.world = world;
this.player = player;
}
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY){
this.fontRendererObj.drawString(I18n.format("container.crafting"), 28, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
IRecipeWithExp recipe = UtilRecipe.instance.findMatchingWorkbenchRecipe(((ContainerEPWorkbench) inventorySlots).craftMatrix, world);
if(recipe != null){
int k = fontRendererObj.getColorCode(EnumChatFormatting.DARK_GREEN.toString().charAt(1));
String s = I18n.format(EnumChatFormatting.BOLD + "Cost: %1$d", recipe.maxExpLevel());
if(!inventorySlots.getSlot(0).canTakeStack(player)){
k = fontRendererObj.getColorCode(EnumChatFormatting.DARK_RED.toString().charAt(1));
}
int l = -16777216 | (k & 16579836) >> 2 | k & -16777216;
int i1 = this.xSize - 8 - 8 - 8 - 4 - this.fontRendererObj.getStringWidth(s);
byte b0 = 67 - 8;
this.fontRendererObj.drawString(s, i1, b0, k);
}
}
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY){
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(craftingTableGuiTextures);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
}
| [
"kina_ugo@yahoo.co.jp"
] | kina_ugo@yahoo.co.jp |
c25ca169668c2ac33e8287f38cfab9b6f4bfd161 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/35/35_2484d6b39f2534171863ecbf731ce99e4b1dde4a/AjdtCommandTestCase/35_2484d6b39f2534171863ecbf731ce99e4b1dde4a_AjdtCommandTestCase_t.java | cdb96c386d6ea81fed37522e22151331028ad427 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,589 | java | /* *******************************************************************
* Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Common Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* PARC initial implementation
* ******************************************************************/
package org.aspectj.ajdt.ajc;
import org.aspectj.ajdt.internal.core.builder.AjBuildConfig;
import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.MessageWriter;
import org.aspectj.util.StreamPrintWriter;
import org.eclipse.jdt.core.compiler.InvalidInputException;
import java.io.PrintWriter;
import junit.framework.TestCase;
/**
* Some black-box test is happening here.
*/
public class AjdtCommandTestCase extends TestCase {
private StreamPrintWriter outputWriter = new StreamPrintWriter(new PrintWriter(System.out));
private AjdtCommand command = new AjdtCommand();
private MessageWriter messageWriter = new MessageWriter(outputWriter, false);
public AjdtCommandTestCase(String name) {
super(name);
// command.buildArgParser.out = outputWriter;
}
public void testIncrementalOption() throws InvalidInputException {
AjBuildConfig config = command.genBuildConfig(new String[] { "-incremental" }, messageWriter);
assertTrue(
"didn't specify source root",
outputWriter.getContents().indexOf("specify a source root") != -1);
outputWriter.flushBuffer();
config = command.genBuildConfig(
new String[] { "-incremental", "-sourceroots", "testdata/src1" },
messageWriter);
assertTrue(
outputWriter.getContents(),
outputWriter.getContents().equals(""));
outputWriter.flushBuffer();
config = command.genBuildConfig(
new String[] { "-incremental", "testdata/src1/Hello.java" },
messageWriter);
assertTrue(
"specified a file",
outputWriter.getContents().indexOf("incremental mode only handles source files using -sourceroots") != -1); ;
}
public void testBadOptionAndUsagePrinting() throws InvalidInputException {
try {
command.genBuildConfig(new String[] { "-mubleBadOption" }, messageWriter);
} catch (AbortException ae) { }
assertTrue(
outputWriter.getContents() + " contains? " + "Usage",
outputWriter.getContents().indexOf("Usage") != -1);
}
public void testHelpUsagePrinting() {
try {
command.genBuildConfig(new String[] { "-help" }, messageWriter);
} catch (AbortException ae) { }
assertTrue(
outputWriter.getContents() + " contains? " + "Usage",
outputWriter.getContents().indexOf("Usage") != -1);
}
public void testVersionOutput() throws InvalidInputException {
try {
command.genBuildConfig(new String[] { "-version" }, messageWriter);
} catch (AbortException ae) { }
assertTrue(
"version output",
outputWriter.getContents().indexOf("AspectJ Compiler") != -1);
}
public void testNonExistingLstFile() {
command.genBuildConfig(new String[] { "@mumbleDoesNotExist" }, messageWriter);
assertTrue(
outputWriter.getContents(),
outputWriter.getContents().indexOf("file does not exist") != -1);
}
protected void setUp() throws Exception {
super.setUp();
}
protected void tearDown() throws Exception {
super.tearDown();
outputWriter.flushBuffer();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
21b8e41252ab5dbdb0737a0e63730895c00c612f | b1597dbfd1df0b750dcd0d715fa5c397abcde0b3 | /app/src/main/java/com/lib/app/textview/titanic/Typefaces.java | 954334cd921d6a3f12b5813d8da43878318c6068 | [] | no_license | langwan1314/widget | 3c240b513b0834c2aaa000287b3f59f8e4e77687 | 5cbeb71bf6621728a0830a0812b459bb1e3e4028 | refs/heads/master | 2021-01-10T08:06:50.856591 | 2015-11-16T05:34:07 | 2015-11-16T05:34:07 | 46,253,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | package com.lib.app.textview.titanic;
import android.content.Context;
import android.graphics.Typeface;
import android.util.Log;
import java.util.Hashtable;
public class Typefaces {
private static final String TAG = "Typefaces";
private static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>();
public static Typeface get(Context c, String assetPath) {
synchronized (cache) {
if (!cache.containsKey(assetPath)) {
try {
Typeface t = Typeface.createFromAsset(c.getAssets(), assetPath);
cache.put(assetPath, t);
} catch (Exception e) {
Log.e(TAG, "Could not get typeface '" + assetPath + "' because " + e.getMessage());
return null;
}
}
return cache.get(assetPath);
}
}
} | [
"85121475@qq.com"
] | 85121475@qq.com |
e5974abd0c56e6c0659cd041ddf9837138112b49 | 7d22b9b4ba22bd29b99d35b33ac2716641a1f193 | /src/test/java/by/jrr/collectionsapi/setex/SetDemoTest.java | a9b164282bf98506d127bd8092cce6037179c95a | [] | no_license | javaGuruBY/jis-lecture12-CollectionApi | 38c1ebf6b8b3ead2b7c8cf42982f60067c25c5c2 | 0ed6e92249b96090d81529032ad19574359f8817 | refs/heads/master | 2022-12-18T08:50:59.093293 | 2020-09-25T18:44:12 | 2020-09-25T18:44:12 | 296,691,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package by.jrr.collectionsapi.setex;
import by.jrr.collectionsapi.mapex.Person;
import org.junit.Before;
import org.junit.Test;
import java.util.HashSet;
import java.util.Set;
import static org.junit.Assert.*;
public class SetDemoTest {
SetDemo setDemo;
@Before
public void setup() {
setDemo = new SetDemo(Set.of("Rome", "Minsk", "Tula"));
}
@Test
public void isGuided() {
assertTrue(setDemo.isGuided("Rome"));
assertFalse(setDemo.isGuided("Brest"));
}
@Test
public void syntax() {
Set<String> cities = new HashSet<>();
cities.add("Rome");
cities.add("Minsk");
cities.add("Tula");
cities.add("Rome");
assertEquals(3, cities.size());
assertTrue(cities.contains("Minsk"));
assertFalse(cities.contains("Brest"));
}
@Test
public void syntaxDemo() {
Set<Person> personSet = Set.of(
new Person("Max", "boxMax"),
new Person("Vax", "grizly"),
new Person("Dax", "pet")
);
Person user = new Person("Max", "boxMax");
assertTrue(personSet.contains(user));
}
}
| [
"6666350@gmail.com"
] | 6666350@gmail.com |
dded51f4a2fe34954c1a17c9acc95cc2b78bc921 | 21ffffb0c19c7fb5b68180673532053af09ab3ec | /app/src/main/java/com/robertabarrado/movieslist/presentation/MovieDetails/Contract.java | 19d28f7201b7836434d38c835ce4ba9d186f1154 | [] | no_license | RobertoBarrado/byhour_prueba_tecnica | 5a6371965fced65920d6a060e2679415ba08fdb3 | 8f43d16eb81f45eecdcbfda94fe1775a93e1a748 | refs/heads/master | 2021-01-02T17:25:45.438604 | 2019-09-01T11:16:55 | 2019-09-01T11:16:55 | 239,721,144 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package com.robertabarrado.movieslist.presentation.MovieDetails;
import com.robertabarrado.domain.Movie;
import java.util.List;
class Contract {
interface ViewInterface {
void showSimilar(List<Movie> movies);
void showProgressBar();
void hideProgressBar();
void openMovieDetails(Movie e);
}
interface PresenterInterface {
void getSimilarMovies(int id);
void onMovieClicked(Movie movie);
}
}
| [
"barrado.roberto@gmail.com"
] | barrado.roberto@gmail.com |
f581d3d7ad2d156fcfdaf94da7301cb37d444072 | f9102517e6ea2eecba60c6fcab7eabe87291dca6 | /hmily-tac/hmily-tac-sqlparser/hmily-tac-sqlparser-shardingsphere/src/main/java/org/dromara/hmily/tac/sqlparser/shardingsphere/ShardingSphereSqlParserEngine.java | 8f89ceb7739523df820a0d3fae8315ada58a0c1b | [
"Apache-2.0"
] | permissive | kevinBobo/hmily | 7583a8abf91048e344a0a235ffa95a66ce8422b4 | a12fcef328d2e8f7d862dbcb6cedb9cd28f6a1c6 | refs/heads/master | 2022-12-04T07:52:26.402110 | 2020-08-21T09:15:43 | 2020-08-21T09:15:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,413 | 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.dromara.hmily.tac.sqlparser.shardingsphere;
import org.dromara.hmily.spi.HmilySPI;
import org.dromara.hmily.tac.sqlparser.model.statement.SQLStatement;
import org.dromara.hmily.tac.sqlparser.spi.HmilySqlParserEngine;
import org.dromara.hmily.tac.sqlparser.spi.exception.SqlParserException;
/**
* The type Sharding sphere sql parser engine.
*
* @author xiaoyu
*/
@HmilySPI("shardingSphere")
public class ShardingSphereSqlParserEngine implements HmilySqlParserEngine {
@Override
public SQLStatement parser(final String sql) throws SqlParserException {
return null;
}
}
| [
"549477611@qq.com"
] | 549477611@qq.com |
c6499ec822ee66892a8ec7c6836a215a21e43b8f | c2869cabc9cce1ba3fdd99f9f0bb5ca2716676dd | /app/src/main/java/com/example/gofp/head_first/pre/creational/abstract_factory/classes/pizza_ingredients/veggie/EggPlant.java | 82bbcc4b4ce5b0f063ba08ec2ceefb2d2de9aebe | [] | no_license | v777779/gof_design_patterns | ecf2fbc04fa57bc295ae951b338e0644d6ecde63 | 2e67eaec4753450456ebace52287892829c4cde7 | refs/heads/master | 2022-11-13T14:52:48.812791 | 2020-06-29T11:56:34 | 2020-06-29T11:56:34 | 273,941,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | package com.example.gofp.head_first.pre.creational.abstract_factory.classes.pizza_ingredients.veggie;
public class EggPlant implements Veggies {
}
| [
"vadim.v.voronov@gmail.com"
] | vadim.v.voronov@gmail.com |
b75313e4279bebdd1d70b418788a96bfe72ec6a9 | 2c984a46975b27ccb2043c287235208f3a4be387 | /src/main/java/it/veneto/regione/schemas/_2012/pagamenti/ente/CtDatiVersamentoPagati.java | b237132219bc9ad6539de4176b65ed8261827246 | [] | no_license | aziendazero/ecm | 12de5e410b344caa8060d5a33f7bc92f52458cdf | 57fd6fba8ead03db016395269e3f2dd1b998d42b | refs/heads/master | 2022-07-24T09:28:05.299546 | 2020-02-27T15:02:04 | 2020-02-27T15:02:04 | 235,811,868 | 0 | 2 | null | 2022-06-30T20:22:49 | 2020-01-23T14:29:41 | Java | UTF-8 | Java | false | false | 5,372 | java |
package it.veneto.regione.schemas._2012.pagamenti.ente;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ctDatiVersamentoPagati complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ctDatiVersamentoPagati">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="codiceEsitoPagamento" type="{http://www.regione.veneto.it/schemas/2012/Pagamenti/Ente/}stCodiceEsitoPagamento"/>
* <element name="importoTotalePagato" type="{http://www.regione.veneto.it/schemas/2012/Pagamenti/Ente/}stImporto"/>
* <element name="identificativoUnivocoVersamento" type="{http://www.regione.veneto.it/schemas/2012/Pagamenti/Ente/}stText35"/>
* <element name="codiceContestoPagamento" type="{http://www.regione.veneto.it/schemas/2012/Pagamenti/Ente/}stText35"/>
* <element name="datiSingoloPagamento" type="{http://www.regione.veneto.it/schemas/2012/Pagamenti/Ente/}ctDatiSingoloPagamentoPagati" maxOccurs="5" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ctDatiVersamentoPagati", propOrder = {
"codiceEsitoPagamento",
"importoTotalePagato",
"identificativoUnivocoVersamento",
"codiceContestoPagamento",
"datiSingoloPagamento"
})
public class CtDatiVersamentoPagati {
@XmlElement(required = true)
protected String codiceEsitoPagamento;
@XmlElement(required = true)
protected BigDecimal importoTotalePagato;
@XmlElement(required = true)
protected String identificativoUnivocoVersamento;
@XmlElement(required = true)
protected String codiceContestoPagamento;
protected List<CtDatiSingoloPagamentoPagati> datiSingoloPagamento;
/**
* Gets the value of the codiceEsitoPagamento property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodiceEsitoPagamento() {
return codiceEsitoPagamento;
}
/**
* Sets the value of the codiceEsitoPagamento property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodiceEsitoPagamento(String value) {
this.codiceEsitoPagamento = value;
}
/**
* Gets the value of the importoTotalePagato property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getImportoTotalePagato() {
return importoTotalePagato;
}
/**
* Sets the value of the importoTotalePagato property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setImportoTotalePagato(BigDecimal value) {
this.importoTotalePagato = value;
}
/**
* Gets the value of the identificativoUnivocoVersamento property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIdentificativoUnivocoVersamento() {
return identificativoUnivocoVersamento;
}
/**
* Sets the value of the identificativoUnivocoVersamento property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIdentificativoUnivocoVersamento(String value) {
this.identificativoUnivocoVersamento = value;
}
/**
* Gets the value of the codiceContestoPagamento property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodiceContestoPagamento() {
return codiceContestoPagamento;
}
/**
* Sets the value of the codiceContestoPagamento property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodiceContestoPagamento(String value) {
this.codiceContestoPagamento = value;
}
/**
* Gets the value of the datiSingoloPagamento property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the datiSingoloPagamento property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDatiSingoloPagamento().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CtDatiSingoloPagamentoPagati }
*
*
*/
public List<CtDatiSingoloPagamentoPagati> getDatiSingoloPagamento() {
if (datiSingoloPagamento == null) {
datiSingoloPagamento = new ArrayList<CtDatiSingoloPagamentoPagati>();
}
return this.datiSingoloPagamento;
}
}
| [
"tiommi@tiommi-desktop.bo.priv"
] | tiommi@tiommi-desktop.bo.priv |
f8d3451a0c2280d0e28c5e6e3cccbfb53994a95f | 7813ff35ab0ba916f1b479285718614bb32c8d89 | /src/other/Example3_TreeSet.java | 6114ba087191308e935aa23712503b29ebecd1c1 | [] | no_license | PleshakovVV/JavaSchoolRND2016 | 7c6055a68486348df817b59d11e333ecb35a0a61 | 5eeb4671aa04bc1a0c85259e258dfd7ee5c5ac01 | refs/heads/master | 2020-04-12T05:35:05.479860 | 2016-11-03T17:51:49 | 2016-11-03T17:51:49 | 63,101,070 | 0 | 0 | null | null | null | null | WINDOWS-1251 | Java | false | false | 1,509 | java | package other;
//Домашнее задание по коллекциям:
//
//
//
//утилита Collections;
//Что такое Comparator;
//
//На дом:
// Исходные данные: текстовый файл со средней длиной строки равной 10 символам (файл или прошить текст в коде).
// В реализациях используйте наиболее подходящие имплементации коллекций!
// Задание 1: Подсчитайте количество различных слов в файле.
// Задание 2: Выведите на экран список различных слов файла, отсортированный по возрастанию их длины (компаратор сначала по длине слова, потом по тексту).
// Задание 3: Подсчитайте и выведите на экран сколько раз каждое слово встречается в файле.
// Задание 4: Выведите на экран все строки файла в обратном порядке.
// Задание 5: Реализуйте свой Iterator для обхода списка в обратном порядке.
// Задание 6: Выведите на экран строки, номера которых задаются пользователем в произвольном порядке.
| [
"Pleshakov-V-V@yandex.ru"
] | Pleshakov-V-V@yandex.ru |
6887d094705496c019234a00a315f23e63814f1b | 7b6a25afcf9bcf53150e6d3bdaeb478d24476ca4 | /src/main/java/pw/arcturus/imaging/GuildParts.java | 26c2e528b7b10251e802bd5c71287138d6dcb61b | [
"Unlicense"
] | permissive | 536f6e6179/HabboImagingJava | e4b528992600c8af0851153117305c11fff28d6d | deeae9b604fbea265800776a136d8adcf56d6635 | refs/heads/main | 2023-02-22T12:24:01.535739 | 2021-01-27T14:34:32 | 2021-01-27T14:34:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,030 | java | package pw.arcturus.imaging;
import pw.arcturus.Imaging;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public class GuildParts
{
public static final String OUTPUT_FOLDER = "cache/badge/";
public static final String PARTS_FOLDER = "resources/badge/";
/**
* Guildparts. The things you use to create the badge.
*/
private final HashMap<Type, HashMap<Integer, Part>> guildParts = new HashMap<>();
public HashMap<String, BufferedImage> cachedImages = new HashMap<String, BufferedImage>();
public GuildParts()
{
for (Type t : Type.values())
{
this.guildParts.put(t, new HashMap<Integer, Part>());
}
try (Connection connection = Imaging.database.dataSource().getConnection();
Statement statement = connection.createStatement();
ResultSet set = statement.executeQuery("SELECT * FROM guilds_elements"))
{
while (set.next())
{
this.guildParts.get(Type.valueOf(set.getString("type").toUpperCase())).put(set.getInt("id"), new Part(set));
}
}
catch (SQLException e)
{
e.printStackTrace();
}
File file = new File(OUTPUT_FOLDER);
if (!file.exists())
{
System.out.println("[BadgeImager] Output folder: " + OUTPUT_FOLDER + " does not exist. Creating!");
file.mkdirs();
}
try
{
for(Map.Entry<Type, HashMap<Integer, Part>> set : this.guildParts.entrySet())
{
if(set.getKey() == Type.SYMBOL || set.getKey() == Type.BASE)
{
for (Map.Entry<Integer, Part> map : set.getValue().entrySet())
{
if (!map.getValue().valueA.isEmpty())
{
try
{
this.cachedImages.put(map.getValue().valueA, ImageIO.read(new File(PARTS_FOLDER, "badgepart_" + map.getValue().valueA.replace(".gif", ".png"))));
}
catch (Exception e)
{
System.out.println("[Badge Imager] Missing Badge Part: " + PARTS_FOLDER + "/badgepart_" + map.getValue().valueA.replace(".gif", ".png"));
}
}
if (!map.getValue().valueB.isEmpty())
{
try
{
this.cachedImages.put(map.getValue().valueB, ImageIO.read(new File(PARTS_FOLDER, "badgepart_" + map.getValue().valueB.replace(".gif", ".png"))));
}
catch (Exception e)
{
System.out.println("[Badge Imager] Missing Badge Part: " + PARTS_FOLDER + "/badgepart_" + map.getValue().valueB.replace(".gif", ".png"));
}
}
}
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static class Part
{
/**
* Identifier.
*/
public final int id;
/**
* Part A
*/
public final String valueA;
/**
* Part B
*/
public final String valueB;
public Part(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.valueA = set.getString("firstvalue");
this.valueB = set.getString("secondvalue");
}
}
public enum Type
{
/**
* Badge base.
*/
BASE,
/**
* Symbol
*/
SYMBOL,
/**
* Colors
*/
BASE_COLOR,
SYMBOL_COLOR,
BACKGROUND_COLOR
}
public boolean symbolColor(int colorId)
{
for(Part part : this.getSymbolColors())
{
if(part.id == colorId)
return true;
}
return false;
}
public boolean backgroundColor(int colorId)
{
for(Part part : this.getBackgroundColors())
{
if(part.id == colorId)
return true;
}
return false;
}
public HashMap<Type, HashMap<Integer, Part>> getParts()
{
return this.guildParts;
}
public Collection<Part> getBases()
{
return this.guildParts.get(Type.BASE).values();
}
public Part getBase(int id)
{
return this.guildParts.get(Type.BASE).get(id);
}
public Collection<Part> getSymbols()
{
return this.guildParts.get(Type.SYMBOL).values();
}
public Part getSymbol(int id)
{
return this.guildParts.get(Type.SYMBOL).get(id);
}
public Collection<Part> getBaseColors()
{
return this.guildParts.get(Type.BASE_COLOR).values();
}
public Part getBaseColor(int id)
{
return this.guildParts.get(Type.BASE_COLOR).get(id);
}
public Collection<Part> getSymbolColors()
{
return this.guildParts.get(Type.SYMBOL_COLOR).values();
}
public Part getSymbolColor(int id)
{
return this.guildParts.get(Type.SYMBOL_COLOR).get(id);
}
public Collection<Part> getBackgroundColors()
{
return this.guildParts.get(Type.BACKGROUND_COLOR).values();
}
public Part getBackgroundColor(int id)
{
return this.guildParts.get(Type.BACKGROUND_COLOR).get(id);
}
public Part getPart(Type type, int id)
{
return this.guildParts.get(type).get(id);
}
}
| [
"placeholder@domain.com"
] | placeholder@domain.com |
8e9cb7027da9651ebd9a0f3a5bc28779472d6186 | 0ca3e1903492ed19c75eb2bf8db82f971bc1ebda | /com/Zhuangyuan/fyx/ZhuangyaunMain.java | c30990f2bdfbd2abb519a8bef3267a03f229cddf | [] | no_license | bitlxy/- | c4e2098e01c9d31508d26f529d7e26b66d43d6f3 | d4822d40cc97ec00c02c6d51f40664a25ea64b7c | refs/heads/master | 2020-07-26T17:18:48.787152 | 2020-01-06T04:37:26 | 2020-01-06T04:37:26 | 208,716,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.Zhuangyuan.fyx;
import com.Zhuangyuan.fyx.Zhuangyuan;
import javax.swing.*;
public class ZhuangyaunMain {
public static JFrame mainjf;
public static void main(String[] args) {
mainjf=new Zhuangyuan();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
34845fe4862a61e8066701aa3f11fd4e52dbdd8b | 2b970fb09ce6b9c432d84bb844bc4a2deb55ce03 | /src/main/java/global/sesoc/project2/interceptor/LoginInterceptor.java | 52a73032c22110d05cc9a9d809377bae0160dfa1 | [] | no_license | katiekim17/repo_test2 | 8ecb8bd41295506f5fdf33dca43106185481035f | 1ab496dadaac12833f9cd5949d8486466b2d16d8 | refs/heads/master | 2021-01-23T22:31:17.170882 | 2017-09-09T09:00:46 | 2017-09-09T09:00:46 | 102,940,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,325 | java | package global.sesoc.project2.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
/**
* 사용자 로그인 확인 인터셉터. HandlerInterceptorAdapter를 상속받아서 정의.
*/
public class LoginInterceptor extends HandlerInterceptorAdapter {
private static final Logger logger = LoggerFactory.getLogger(LoginInterceptor.class);
//콘트롤러의 메서드 실행 전에 처리
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
logger.debug("LoginInterceptor 실행");
//세션의 로그인 정보 읽기
HttpSession session = request.getSession();
String loginId = (String) session.getAttribute("loginId");
//로그인되지 않은 경우 로그인 페이지로 이동
if (loginId == null) {
//request.getContextPath()로 루트 경로를 구하여 절대 경로로 처리
response.sendRedirect(request.getContextPath() + "/customer/login");
return false;
}
//로그인 된 경우 요청한 경로로 진행
return super.preHandle(request, response, handler);
}
}
| [
"pyeongsuk.kim88@gmail.com"
] | pyeongsuk.kim88@gmail.com |
1d5361d2da98a590d6d5423e37e1c6a08dd89c09 | 46accce8a372ba1c40e160d1eddf237dc22360c7 | /app/src/test/java/com/example/android/jotitdown/ExampleUnitTest.java | 4a7b902c1e49d886513cfa547af36d01deb56575 | [] | no_license | Sechajr/JournalApp_JotItDown | 70c313a37ce590585eaf7d9437841cd5e37e4b23 | 608ad6c7f93bf8e5d360463d02ab31675a6453fd | refs/heads/master | 2020-03-22T02:12:55.819684 | 2018-07-01T19:44:17 | 2018-07-01T19:44:17 | 139,356,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.example.android.jotitdown;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"sechaalbert@gmail.com"
] | sechaalbert@gmail.com |
2e378d86c08b4d4b2b912136eb6b3a28b6effcf0 | 02a087e8de0a7d0cfed9dba60e8cff5be4ae3be1 | /Research_Bucket/Completed_Archived/ConcolicProcess/tools/Scorpio/scorpioxsrc201103030634/src/jp/ac/osaka_u/ist/sdl/scorpio/gui/data/CodeCloneInfo.java | 30af9c520074663b732e2b3c4c1360157879b83d | [] | no_license | dan7800/Research | 7baf8d5afda9824dc5a53f55c3e73f9734e61d46 | f68ea72c599f74e88dd44d85503cc672474ec12a | refs/heads/master | 2021-01-23T09:50:47.744309 | 2018-09-01T14:56:01 | 2018-09-01T14:56:01 | 32,521,867 | 1 | 1 | null | null | null | null | SHIFT_JIS | Java | false | false | 4,979 | java | package jp.ac.osaka_u.ist.sdl.scorpio.gui.data;
import java.util.Collections;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
import jp.ac.osaka_u.ist.sdl.scorpio.Entity;
import jp.ac.osaka_u.ist.sdl.scorpio.ScorpioGUI;
/**
* GUIでコードクローンを表すクラス
*
* @author higo
*
*/
public class CodeCloneInfo implements Entity, Comparable<CodeCloneInfo> {
/**
* コンストラクタ
*/
public CodeCloneInfo() {
this.elements = new TreeSet<ElementInfo>();
this.calls = new TreeSet<MethodCallInfo>();
}
/**
* 要素を加える
*
* @param element
* 加える要素
*/
public void add(final ElementInfo element) {
if (null == element) {
throw new IllegalArgumentException();
}
this.elements.add(element);
}
/**
* コードクローンをなす要素のSortedSetを返す
*
* @return コードクローンをなす要素のSortedSet
*/
public SortedSet<ElementInfo> getElements() {
return Collections.unmodifiableSortedSet(this.elements);
}
/**
* 引数で指定されたメソッドに含まれる要素のSortedSetを返す
*
* @param methodID
* @return
*/
public SortedSet<ElementInfo> getElements(final int methodID) {
final SortedSet<ElementInfo> elements = new TreeSet<ElementInfo>();
for (final ElementInfo element : this.getElements()) {
if (element.getMethodID() == methodID) {
elements.add(element);
}
}
return elements;
}
public void add(final MethodCallInfo call) {
this.calls.add(call);
}
public SortedSet<MethodCallInfo> getCalls() {
return new TreeSet<MethodCallInfo>(this.calls);
}
/**
* コードクローンの大きさを返す
*
* @return コードクローンの大きさ
*/
public int getLength() {
return this.elements.size();
}
/**
* コードクローンをなす先頭の要素を返す
*
* @return コードクローンをなす先頭の要素
*/
public ElementInfo getFirstElement() {
return this.elements.first();
}
/**
* コードクローンをなす最後の要素を返す
*
* @return コードクローンをなす最後の要素
*/
public ElementInfo getLastElement() {
return this.elements.last();
}
public void setID(final int id) {
this.id = id;
}
public int getID() {
return this.id;
}
/**
* ギャップの数を設定する
*
* @param gap
* ギャップの数
*/
public void setNumberOfGapps(final int gap) {
this.gap = gap;
}
/**
* ギャップの数を返す
*
* @return ギャップの数
*/
public int getNumberOfGapps() {
return this.gap;
}
/**
* このコードクローンの要素を含むメソッドの数を設定する
*
* @param method
*/
public void setNumberOfMethods(final int method) {
this.method = method;
}
/**
* このコードクローンの要素を含むメソッドの数を返す
*
* @param method
*/
public int getNumberOfMethods() {
return this.method;
}
/**
* このクローンに含まれる要素を所有するメソッドの集合を返す
*
* @return
*/
public SortedSet<MethodInfo> getOwnerMethods() {
final SortedSet<MethodInfo> ownerMethods = new TreeSet<MethodInfo>();
for (final ElementInfo element : this.elements) {
final int methodID = element.getMethodID();
final MethodInfo ownerMethod = MethodController.getInstance(
ScorpioGUI.ID).getMethod(methodID);
ownerMethods.add(ownerMethod);
}
return ownerMethods;
}
/**
* 比較関数
*/
@Override
public int compareTo(CodeCloneInfo o) {
final Iterator<ElementInfo> thisIterator = this.getElements()
.iterator();
final Iterator<ElementInfo> targetIterator = o.getElements().iterator();
// 両方の要素がある限り
while (thisIterator.hasNext() && targetIterator.hasNext()) {
final int elementOrder = thisIterator.next().compareTo(
targetIterator.next());
if (0 != elementOrder) {
return elementOrder;
}
}
if (!thisIterator.hasNext() && !targetIterator.hasNext()) {
return 0;
}
if (!thisIterator.hasNext()) {
return -1;
}
if (!targetIterator.hasNext()) {
return 1;
}
assert false : "Here shouldn't be reached!";
return 0;
}
@Override
public int hashCode() {
long total = 0;
for (final ElementInfo element : this.getElements()) {
total += element.hashCode();
}
return (int) total / this.getLength();
}
@Override
public boolean equals(Object o) {
if (null == o) {
return false;
}
if (!(o instanceof CodeCloneInfo)) {
return false;
}
final CodeCloneInfo target = (CodeCloneInfo) o;
return this.elements.containsAll(target.elements)
&& target.elements.containsAll(this.elements);
}
public static String CODECLONE = new String("CODECLONE");
private final SortedSet<ElementInfo> elements;
private final SortedSet<MethodCallInfo> calls;
private int id;
private int gap;
private int method;
}
| [
"dxkvse@rit.edu"
] | dxkvse@rit.edu |
c4c87398556a1aab593f742c7bdf2f3835414e9a | bb4ca6775fefaace22bd8d8b990d86f85d97c574 | /demo/src/main/java/com/example/demo/Models/Data/Hours.java | 2462866e0a442c8e5c637236b2f1d4f5e5f13c4b | [] | no_license | tsipponen/demo-place | 0eb331adae00769c48bd5cc9f0313b083c050003 | 91462d97fcb7d5ecbcc1a98f5d69d1e7f881dc43 | refs/heads/master | 2023-04-18T20:09:23.066727 | 2021-05-04T14:28:34 | 2021-05-04T14:28:34 | 361,818,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 446 | java | package com.example.demo.Models.Data;
public class Hours {
private int WeekdayId;
private String Opens;
private String Closes;
private Boolean Open24h;
public void setWeekdayId(int weekdayId){ this.WeekdayId = weekdayId; }
public void setOpens(String opens){ this.Opens = opens; }
public void setCloses(String closes){ this.Closes = closes; }
public void setOpen24h(Boolean open24h){ this.Open24h = open24h; }
}
| [
"tinosipponen@gmail.com"
] | tinosipponen@gmail.com |
3f4da12f1d718326e6a7b329d898da1030cedcd1 | 920c93543338ed8d1b6e1d37f2b741e668182d88 | /iris-devices-zwave/src/main/java/ru/iris/devices/zwave/Service.java | 0b2810d52c732f454cd8a52cc2e6a1033f2df25e | [
"Apache-2.0"
] | permissive | mlzharov/IRISv2 | 123789f1ea9e377e7b002356bb008f34fafb0993 | 8c933914d927527ce6b1833c1ab56093173e9efd | refs/heads/master | 2021-01-19T19:21:41.267479 | 2016-12-08T14:30:06 | 2016-12-08T14:30:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | /*
* Copyright 2012-2014 Nikolay A. Viguro
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 ru.iris.devices.zwave;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import ro.fortsoft.pf4j.Plugin;
import ro.fortsoft.pf4j.PluginWrapper;
import ru.iris.common.Config;
public class Service extends Plugin {
private static final Logger LOGGER = LogManager.getLogger(Service.class);
private ZWaveService service;
public Service(PluginWrapper wrapper) {
super(wrapper);
}
@Override
public void start() {
Config config = Config.getInstance();
LOGGER.info("[Plugin] iris-devices-zwave plugin started!");
if (config.get("zwaveEnabled").equals("1")) {
LOGGER.info("ZWave support enabled. Starting");
service = new ZWaveService();
}
}
@Override
public void stop() {
LOGGER.info("[Plugin] iris-devices-zwave plugin stopped!");
if (service != null)
service.stop();
}
}
| [
"nv@ph-systems.ru"
] | nv@ph-systems.ru |
b284e84d3f6bd0607be1087fe55f5897f181b59e | 547c9e50a11209f12762c746bbdd36a60cbaa6a4 | /src/test/java/com/royarn/mini/thinkinjava/chapter03/StaticInitialization.java | 308346267e092cc1d9cfd3c96cf3dea160bb125e | [] | no_license | Royarn/mini2 | fd7288e9317e3e81d40b6b4febc73532b8ccffb5 | be31d29b9dcf2a4d2ef840f06e8b7d5f115ff2e3 | refs/heads/master | 2023-07-20T00:29:30.211227 | 2019-09-25T06:40:25 | 2019-09-25T06:40:25 | 142,255,339 | 0 | 0 | null | 2023-07-17T10:59:59 | 2018-07-25T06:11:15 | Java | UTF-8 | Java | false | false | 1,617 | java | package com.royarn.mini.thinkinjava.chapter03;
/**
* Description:
*
* @author dell
* @date 2018-11-08
*/
public class StaticInitialization {
static int i;
public static void main(String[] args) {
System.out.println("Creating new Cupboard() in main ");
//new Cupboard();
// System.out.println("Inside main()");
// Cups.c1.f(99);
//
// System.out.println("Creating new Cupboard() in main");
System.out.println(StaticInitialization.i);
}
static Cup c1 = new Cup(3);
static Cup c2 = new Cup(4);
static {
System.out.println(i);
i = 10;
}
}
class Bowl {
Bowl(int marker) {
System.out.println("Bowl (" + marker + ")");
}
void f(int marker) {
System.out.println("f(" + marker + ")");
}
}
class Table {
static Bowl b1 = new Bowl(1);
Table() {
System.out.println("Table()");
b2.f(1);
}
Bowl b2 = new Bowl(2);
}
class Cupboard {
Bowl b3 = new Bowl(3);
static Bowl b4 = new Bowl(4);
Cupboard() {
System.out.println("Cupboard()");
b4.f(2);
}
void f3(int marker) {
System.out.println("f3 (" + marker + ")");
}
static Bowl b5 = new Bowl(5);
}
class Cup {
Cup(int marker) {
System.out.println("Cup (" + marker + ")");
}
void f(int marker) {
System.out.println("f (" + marker + ")");
}
}
class Cups {
static Cup c1;
static Cup c2;
static {
c1 = new Cup(1);
c2 = new Cup(2);
}
Cups() {
System.out.println("Cups()");
}
} | [
"763094810@qq.com"
] | 763094810@qq.com |
e70cf119fdfb232b2c72aa9dd5121897f2e951a3 | 7e139bcbfd73a14cff46b334c8b1d4090bec4fc6 | /src/design_example/component/TempDB.java | fd15c286e825e3b1f4aef8dd0dd9be232a6c830c | [] | no_license | hzqiuxm/privateproject | 6e8b27e447fc27f2e70801c12ff89d1d9480fab1 | e1d3af380894b271f49048cbaddb33c031b9d267 | refs/heads/master | 2021-01-17T05:13:10.275852 | 2018-06-21T01:55:50 | 2018-06-21T01:55:50 | 47,237,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package design_example.component;
import java.util.HashMap;
import java.util.Map;
/**
* Created by hzqiuxm on 2016/2/2 0002.
* 模拟内存数据库,存放业务数据
*/
public class TempDB {
private TempDB(){}
public static Map<String,Double> mapMonthSaleMoney = new HashMap<String,Double>();
static {
mapMonthSaleMoney.put("张三",10000.0);
mapMonthSaleMoney.put("李四",20000.0);
mapMonthSaleMoney.put("王五",30000.0);
}
}
| [
"qiuxiaomin@yunhetong.net"
] | qiuxiaomin@yunhetong.net |
2e74ce8073267e69469bf60184cf2002733ea235 | cec1a18d6d87a8c0312656505f0bf7791dfe3d5a | /QuestionBank/src/main/java/com/questionbank/faces/Controller/UserManagedBean.java | 5cdb7f1fcf7a3c21c742ea57b9bcd2ab549003d3 | [] | no_license | alwayshakthi/QuestionBank | 1e5f44d0c0c1d550195bf633e0b9d238b617396e | f1de26e6852677d3aad415322c129485d5d9b716 | refs/heads/master | 2020-05-13T16:19:42.616651 | 2017-01-10T14:27:16 | 2017-01-10T14:27:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,136 | java | package com.questionbank.faces.Controller;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.primefaces.context.RequestContext;
import org.primefaces.event.RowEditEvent;
import com.questionbank.spring.model.User;
import com.questionbank.spring.service.UserService;
@ManagedBean(name="userMB")
@SessionScoped
public class UserManagedBean implements Serializable{
public final static Logger logger = Logger.getLogger(UserManagedBean.class);
private static final long serialVersionUID = 1L;
private String userName;
private String loggedInUserName;
private String password;
private String oldPassword;
@ManagedProperty(value="#{userService}")
UserService userService;
private List<User> userList;
public void onRowEdit(RowEditEvent event) {
User user = (User) event.getObject();
user.setPassword(user.getUserName());
try {
userService.updateUser(user);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
"User Name Updated!",
user.getUserName() +" Updated.."));
} catch (Exception e) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Subject Updation Failed!",
user.getUserName() +" Not Updated.."));
}
}
public void onRowCancel(RowEditEvent event) {
}
public void addUser() {
if(getUserName().isEmpty() || getUserName() == null || (getUserName().length() > 45) || getUserName().equalsIgnoreCase("ADMIN")) {
logger.info("User Name cannot be empty");
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Invalid User Name!",
"User Name cannot be empty.."));
} else {
try {
User user = new User();
user.setUserName(getUserName());
user.setPassword(getUserName());
user.setUserRole("STAFF");
getUserService().addUser(user);
init();
userName="";
} catch(Exception e) {
e.printStackTrace();
}
}
}
public String deleteUser(User user) {
getUserService().deleteUser(user);
init();
return null;
}
public String authenticate() {
logger.info("UserManagedBean.authenticate method starts..");
if(getUserName().isEmpty() || getUserName() == null) {
logger.info("User Name cannot be empty");
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Invalid User Name!",
"User Name cannot be empty.."));
} else if (getPassword().isEmpty() || getPassword() == null) {
logger.info("Password cannot be empty");
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Invalid Password!",
"Password cannot be empty.."));
} else {
User user = getUserService().authenticate(getUserName(), getPassword());
if(user != null) {
HttpSession session = SessionBean.getSession();
session.setAttribute("username", user.getUserName());
session.setAttribute("userRole", user.getUserRole());
if(user.getUserRole().equalsIgnoreCase("ADMIN"))
{
logger.info("Admin Login Success");
loggedInUserName = userName;
userName = "";
return "department";
} else {
logger.info("Staff Login Success");
loggedInUserName = userName;
userName = "";
return "stafflogin";
}
} else{
logger.info("Invalid Login!!");
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_WARN,
"Invalid Login!",
"Please Try Again!"));
}
logger.info("UserManagedBean.authenticate method ends..");
}
return "index";
}
public void changePassword(ActionEvent event) {
RequestContext context = RequestContext.getCurrentInstance();
FacesMessage message = null;
boolean isSuccess = false;
User user = getUserService().authenticate(getLoggedInUserName(), getOldPassword());
if(user != null) {
isSuccess = true;
user.setPassword(getPassword());
getUserService().changePassword(user);
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_INFO,
"Password Updated!!",
"Password has been updated successfully.."));
}
else {
logger.info("Old Password is Incorrect!!");
FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Old Password is Incorrect!!",
"Please provide correct Old Password.."));
}
context.addCallbackParam("passwordChanged", isSuccess);
}
//logout event, invalidate session
public String logout() {
HttpSession session = SessionBean.getSession();
session.invalidate();
return "index";
}
@PostConstruct
public void init() {
userList = new ArrayList<User>();
try {
userList.addAll(getUserService().getStaffs());
} catch (Exception e) {
logger.error("No Staff exists in database", e);
}
userName = "";
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public List<User> getUserList() {
return userList;
}
public void setUserList(List<User> userList) {
this.userList = userList;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getLoggedInUserName() {
return loggedInUserName;
}
public void setLoggedInUserName(String loggedInUserName) {
this.loggedInUserName = loggedInUserName;
}
public String getOldPassword() {
return oldPassword;
}
public void setOldPassword(String oldPassword) {
this.oldPassword = oldPassword;
}
}
| [
"vcshasi@gmail.com"
] | vcshasi@gmail.com |
32560068faff1ac8346464c2abc2af51b3f5e81b | 362e765f951a94518f9fb78dcf46ec14570b64ed | /ATM Dispenser/src/io/turntabl/test/Cedis20Dispenser.java | 09e87ddf0077167c00185ba2cde5bd89ecfb7fa4 | [] | no_license | agyen/Chain-of-Responsiblity | 8d5b29f24553263a62041d696909383e2cb974d7 | f28fa312a9ffca59bc338d1c57218e83c163ce33 | refs/heads/master | 2020-09-12T01:44:46.457749 | 2019-11-18T17:59:30 | 2019-11-18T17:59:30 | 222,259,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package io.turntabl.test;
public class Cedis20Dispenser implements DispenseChain {
private DispenseChain dispenseChain;
@Override
public void setNextChain(DispenseChain nextChain) {
this.dispenseChain = nextChain;
}
@Override
public void dispense(Currency currency) {
if(currency.getAmount() >= 20){
int num = currency.getAmount()/20;
int remainder = currency.getAmount() % 20;
System.out.println("Dispensing "+num+" 20GHC note");
if(remainder !=0) this.dispenseChain.dispense(new Currency(remainder));
}else{
this.dispenseChain.dispense(currency);
}
}
}
| [
"izagyen96@gmail.com"
] | izagyen96@gmail.com |
f90875f699a1a55ff3348ad4da3d681313b0c3ab | 8a28ac0e901443620e25338f42eb2f6383dc326b | /IvanovKostia/sender/src/sender/Message.java | 62aae318929cfe53f427f973c8d9c03518d548ff | [] | no_license | ifmo-ctd-2012-networks/labs | 9dfe64215097be2dd42d1275ed28ab92d84a74c8 | 0a2d52f72f6547ecfc6204958e2e641b6d145e68 | refs/heads/master | 2016-09-06T16:24:00.068121 | 2015-11-11T18:31:48 | 2015-11-11T18:31:48 | 42,375,519 | 1 | 2 | null | 2015-09-18T22:32:32 | 2015-09-12T22:31:27 | Java | UTF-8 | Java | false | false | 361 | java | package sender;
import sender.message.MessageIdentifier;
import java.io.Serializable;
public class Message implements Serializable {
private MessageIdentifier identifier;
public MessageIdentifier getIdentifier() {
return identifier;
}
void setIdentifier(MessageIdentifier identifier) {
this.identifier = identifier;
}
}
| [
"Martoon_00@mail.ru"
] | Martoon_00@mail.ru |
36fccaa8a23ac406998d9a0e61aac200153aab11 | 6ee33d1af3de7c45e05b1fa2d9ca287dfacfb1f1 | /src/com/dinsfire/ponymotes/Prefrences.java | 8973b712eb21b496a28095c63fd5e14d5fe5574a | [] | no_license | DinsFire64/PonyMotes | 1d437a95623e9ca7c08bc83bf7ac49792c1a6483 | 9ef9e525fd963d19887f8e15549f29818b5c6fcd | refs/heads/master | 2021-03-24T11:03:32.149190 | 2015-03-21T19:41:31 | 2015-03-21T19:41:31 | 20,503,116 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package com.dinsfire.ponymotes;
import android.content.SharedPreferences;
public class Prefrences {
private SharedPreferences prefs;
public Prefrences(SharedPreferences prefs) {
this.prefs = prefs;
}
public boolean includeNSFW() {
return prefs.getBoolean("prefIncludeNSFW", false);
}
public boolean wantToDownloadEmotes() {
return prefs.getBoolean("prefDownloadEmotes", true);
}
public boolean wantToDownloadMissingEmotes() {
return prefs.getBoolean("prefDownloadMissingEmotes", true);
}
public boolean disableOnMobile() {
return prefs.getBoolean("prefDisableMobile", false);
}
public boolean altSharingMethod() {
return prefs.getBoolean("prefAltSharingMethod", false);
}
public boolean onboardingSession() {
return prefs.getBoolean("prefShowOnboardingSession", true);
}
public void turnOnboardingSessionOff() {
prefs.edit().putBoolean("prefShowOnboardingSession", false).commit();
}
public String searchLimit() {
return prefs.getString("prefSearchResultLimit", "200");
}
public int numOfColumns() {
try {
return Integer.valueOf(prefs.getString("prefNumOfColumns", "3"));
} catch (Exception e) {
return 3;
}
}
}
| [
"dinsfire64@gmail.com"
] | dinsfire64@gmail.com |
4bef8448b44127610371b5248ed8fe165f31d62e | 0eb82bfd9190927a1f3cbd776e8daa791796fb20 | /src/main/java/kz/osmium/main/Request.java | 191652b4c48fd3007a603ace12056626573c1907 | [
"Apache-2.0"
] | permissive | OsmiumKZ/WebSocket | bd16a12fc2d669b9637ba7f01a95aab5d7318cde | a216fc01a58cf587d3d9a12270584b020737ab92 | refs/heads/master | 2020-03-29T20:06:21.908267 | 2019-01-09T08:10:10 | 2019-01-09T08:10:10 | 150,295,666 | 0 | 0 | Apache-2.0 | 2018-11-07T12:55:28 | 2018-09-25T16:23:32 | Java | UTF-8 | Java | false | false | 987 | java | /*
* Copyright 2018 Osmium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package kz.osmium.main;
import kz.osmium.account.main.AccountRequest;
import kz.osmium.oqu.main.OquRequest;
import kz.osmium.translit.main.TranslitRequest;
public class Request {
/**
* Все запросы WebSocket'а
*/
public static void connectAPI(){
AccountRequest.connectAPI();
// OquRequest.connectAPI();
TranslitRequest.connectAPI();
}
}
| [
"fromsi665@gmail.com"
] | fromsi665@gmail.com |
dcba57919006b95e76b968517c54652c74b78b05 | 21988a30c37da8af68ee636575d4f5d96b0b86e7 | /src/main/java/list/SimpleList.java | eb14a1eb7481fbfa224fa08a68fa0f34a8e489cf | [] | no_license | stmechanic-dev/job4j_design | fb3c5f537327945aef436912c12df02d605b0b74 | b56f1990894e60ea76649b139803d71b0d21109f | refs/heads/master | 2023-04-21T05:38:05.080486 | 2021-05-03T13:46:12 | 2021-05-03T13:46:12 | 315,757,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,721 | java | package list;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
public class SimpleList<E> implements Iterable<E> {
private Node<E> head;
private int modCount = 0;
public void add(E value) {
Node<E> node = new Node<>(value, null);
if (head == null) {
head = node;
modCount++;
return;
}
Node<E> tail = head;
while (tail.next != null) {
tail = tail.next;
}
tail.next = node;
modCount++;
}
public E get(int index) {
Objects.checkIndex(index, modCount);
Node<E> node = head;
for (int i = 0; i < index; i++) {
node = node.next;
}
return node.item;
}
@Override
public Iterator<E> iterator() {
int expectedCount = modCount;
return new Iterator<>() {
Node<E> node = head;
@Override
public boolean hasNext() {
return node != null;
}
@Override
public E next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
if (expectedCount != modCount) {
throw new ConcurrentModificationException();
}
E value = node.item;
node = node.next;
return value;
}
};
}
private static class Node<E> {
E item;
Node<E> next;
Node(E element, Node<E> next) {
this.item = element;
this.next = next;
}
}
}
| [
"kovalev.ilya@mail.ru"
] | kovalev.ilya@mail.ru |
803312bd0ded37b60be1a3f8dfaae84ec7d0d96b | d4e6a9c89101a8aa8fbb7cc836d65b622bd42bcc | /app/src/main/java/com/example/administrator/mvpsample/login/LogincContract.java | f7394d6811f10cd717c6ad179f7d56f5a69af261 | [] | no_license | INX0769/MvpSample | ea4eb92dc5d7fd50ccd1387616fb870933529759 | 3f739c5dc6243efadcbb5881f1450f0eab5344f7 | refs/heads/master | 2021-04-15T18:32:46.783799 | 2018-03-22T06:22:49 | 2018-03-22T06:22:49 | 126,289,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package com.example.administrator.mvpsample.login;
import com.example.administrator.mvpsample.bean.UserInfo;
import com.example.administrator.mvpsample.model.LoginModel;
import com.example.baselibrary.mvp.BasePresenter;
import com.example.baselibrary.mvp.BaseView;
public interface LogincContract {
interface LoginView extends BaseView{
void setUserInfo(UserInfo userInfo);
}
abstract class LoginPresenter extends BasePresenter<LoginView>{
public LoginPresenter(LoginView view) {
super(view);
}
public abstract void login(String userName,String psd );
}
}
| [
"hzx0769@qq.com"
] | hzx0769@qq.com |
862aa39c520128ec09a947b1e6eb351a30583735 | 34d1c5ce4791e315fa4b0e479d7e511a50b39abf | /In-Chang Kang/DFS & BFS/BAEKJOON_13913.java | 87a567b68b33b09e8d749b887fbef8f0c044b889 | [] | no_license | inchang0326/2018-DAEJEON-DEVELOPERS | 56ea1a22d35fde52696d0aeff7b416e3343bfc01 | b28bf6b1b267bbff8ff1fd2f85ffcdd857ec9e13 | refs/heads/master | 2020-03-21T22:11:03.233102 | 2018-10-22T13:18:47 | 2018-10-22T13:18:47 | 139,109,584 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,206 | java | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.StringTokenizer;
public class Catch4 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int k = Integer.parseInt(st.nextToken());
bfs(n, k);
}
public static void bfs(int n, int k) {
Queue<Pin> q = new ArrayDeque<>();
Map<Integer, Pin> pins = new HashMap<>();
boolean[] isVisited = new boolean[100000 + 1];
int step = 0, time = 0;
Pin pin = new Pin(n);
q.add(pin);
while(q.size() > 0) {
int size = q.size();
for(int i=0; i<size; i++) {
Pin currPin = q.poll();
int currValue = currPin.getValue();
isVisited[currValue] = true;
if(currValue == k) {
pins.put(time, currPin);
time++;
}
if( currValue - 1 >= 0 && !isVisited[currValue - 1] ) {
Pin nextPin = new Pin(currValue - 1);
nextPin.setPrevPin(currPin);
q.add(nextPin);
}
if( currValue + 1 <= 100000 && !isVisited[currValue + 1] ) {
Pin nextPin = new Pin(currValue + 1);
nextPin.setPrevPin(currPin);
q.add(nextPin);
}
if( currValue * 2 <= 100000 && !isVisited[currValue * 2] ) {
Pin nextPin = new Pin(currValue * 2);
nextPin.setPrevPin(currPin);
q.add(nextPin);
}
}
if(time != 0) break;
step++;
}
System.out.println(step);
for(int i=0; i<pins.size(); i++) {
Pin travel = pins.get(i);
while(travel != null) {
System.out.print(travel.getValue() + " ");
travel = travel.getPrevPin();
}
System.out.println();
}
}
}
class Pin {
private int value;
private Pin prevPin;
public Pin() {
}
public Pin(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public Pin getPrevPin() {
return prevPin;
}
public void setPrevPin(Pin prevPin) {
this.prevPin = prevPin;
}
} | [
"inchang0326@naver.com"
] | inchang0326@naver.com |
e8dba303cc3144758e6be625b6316c76c4b89ba8 | 9f2275fdaf2a02ce893494cfe1530ae929813c27 | /SRC/net/java/sjtools/util/ResourceUtil.java | 33add6dc97274dc822636d6c194f5e0041cd3e5d | [] | no_license | goncalo-pereira/sjtools | 9fd7b37efc628b02cfd83a3cf00d11fd545afca0 | 9664d46a2c0a1c10b2029466cc9d8149c208c4c0 | refs/heads/master | 2023-03-18T05:11:22.048385 | 2016-07-12T15:07:48 | 2016-07-12T15:07:48 | null | 0 | 0 | null | null | null | null | ISO-8859-2 | Java | false | false | 1,537 | java | /*
* SJTools - SysVision Java Tools
*
* Copyright (C) 2006 SysVision - Consultadoria e Desenvolvimento em Sistemas de Informática, Lda.
*
* This library 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 library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package net.java.sjtools.util;
import java.io.InputStream;
import java.net.URL;
public class ResourceUtil {
public static InputStream getContextResourceInputStream(String name) {
return Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
}
public static URL getContextResourceURL(String name) {
return Thread.currentThread().getContextClassLoader().getResource(name);
}
public static InputStream getSystemResourceInputStream(String name) {
return ClassLoader.getSystemResourceAsStream(name);
}
public static URL getSystemResourceURL(String name) {
return ClassLoader.getSystemResource(name);
}
}
| [
"jjmrocha@users.noreply.github.com"
] | jjmrocha@users.noreply.github.com |
1c40622fc0174b597c16c2212b582cb6d53c084d | 2a8ebcdaf9abfb018685d103bef9e7c9d7ffd430 | /ANDROID/AplicativoIFSP/ifsp/src/main/java/jonathan/ifsp/CadastroActivity.java | c9d1e192bc60340cbdf7c22353f6ec4b0f49c8e6 | [] | no_license | JonathanBenicio/IFSP | d71945a71d914a75d5571043184a42b1d7e505a8 | 59a6d1c7e2dd6429b3d3d234831dc3aa5c28aa60 | refs/heads/master | 2020-07-27T12:24:13.837957 | 2019-09-17T23:26:26 | 2019-09-17T23:26:26 | 209,088,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,750 | java | package jonathan.ifsp;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.Array;
import java.util.ArrayList;
public class CadastroActivity extends AppCompatActivity {
Button btn_login;
String webservice;
EditText txt_email;
EditText txt_nome;
EditText txt_cpf;
EditText txt_rg;
EditText txt_idade;
EditText txt_genero;
EditText txt_telefone;
EditText txt_facebook;
EditText txt_instagram;
EditText txt_senha;
TextView tvRespostaServidor;
ProgressBar progressBar;
ListView lista;
ArrayList<String> listarotina = new ArrayList<>();
String[] rotina = new String[100];
String quant_rotina;
int aux;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cadastro);
btn_login = (Button) findViewById(R.id.btn_login);
webservice = "http://192.168.0.21/Projeto/cadastro/tela_cadastro_pac.php";
txt_email = (EditText) findViewById(R.id.txt_email);
txt_nome = (EditText) findViewById(R.id.txt_nome);
txt_cpf = (EditText) findViewById(R.id.txt_cpf);
txt_rg = (EditText) findViewById(R.id.txt_rg);
txt_idade = (EditText) findViewById(R.id.txt_idade);
txt_genero = (EditText) findViewById(R.id.txt_genero);
txt_telefone = (EditText) findViewById(R.id.txt_telefone);
txt_facebook = (EditText) findViewById(R.id.txt_facebook);
txt_instagram = (EditText) findViewById(R.id.txt_instagram);
txt_senha = (EditText) findViewById(R.id.txt_senha);
tvRespostaServidor = (TextView) findViewById(R.id.tvRespostaServidor);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
lista = (ListView) findViewById(R.id.lista);
ArrayList<String> rotina = preencherdados();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, rotina);
lista.setAdapter(adapter);
}
private ArrayList<String> preencherdados() {
new acessarsevidor().execute();
ArrayList<String> dados = new ArrayList<String>();
dados.add(quant_rotina);
return dados;
}
// Esta é funcao que possui a lógica para acessar o servidor PHP
//Retorna TRUE se login feito com sucesso - FALSE, caso contrario
private boolean enviarRequisicaoHTTPPost() throws Exception {
URL obj = new URL(webservice.toString());
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
//add request header
con.setRequestMethod("POST");
con.setDoOutput(true);
//Gerando o objeto em JSON com os dados de login informados pelo usuario
JSONObject acao = new JSONObject();
JSONObject parametros = new JSONObject();
parametros.put("Nome", txt_nome.getText().toString());
parametros.put("usuario", txt_email.getText().toString());
parametros.put("cpf", txt_cpf.getText().toString());
parametros.put("rg", txt_rg.getText().toString());
parametros.put("idade", txt_idade.getText().toString());
parametros.put("genero", txt_genero.getText().toString());
parametros.put("telefone", txt_telefone.getText().toString());
parametros.put("facebook", txt_facebook.getText().toString());
parametros.put("instagram", txt_instagram.getText().toString());
parametros.put("senha", txt_senha.getText().toString());
acao.put("acao", "efetuar_login");
acao.put("parametros", parametros);
Log.i("***Enviando requisicao POST para servidor PHP: ", acao.toString());
// Send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(acao.toString());
wr.flush();
wr.close();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuffer response = new StringBuffer();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//Imprimindo resultado recebido do servidor
Log.i("***** Resposta do servidor PHP", response.toString());
JSONObject resposta_json = new JSONObject(response.toString());
boolean login_realizado_com_sucesso = false;
if (resposta_json.getString("acao").equals("efetuar_login")) {
if (resposta_json.getInt("resultado") == 1) {
login_realizado_com_sucesso = true;
}
}
if (login_realizado_com_sucesso)
return true;
else
return false;
}
//Esta tarefa é assincrona - acessa o servidor remoto PHP e não trava a app android
private class threadAssincronaParaAcessarServidor extends AsyncTask<Void, Void, Integer> {
boolean resposta;
@Override
protected Integer doInBackground(Void... voids) {
try {
resposta = enviarRequisicaoHTTPPost();
if (resposta) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return -1;
}
/*
Eu estou considerando o seguinte:
Retorno 1 para informar que login foi feito com sucesso
Retorno 0 para informar que login estava incorreto
Retorno -1, caso tenha ocorrido algum problema ao acessar o servidor
*/
}
//Utilizo isso apenas para atualizar os componentes da tela
@Override
protected void onPostExecute(Integer result) {
progressBar.setVisibility(View.GONE);
switch (result) {
case 0:
tvRespostaServidor.setText("Login incorreto. Tente novamente");
break;
case 1:
Intent i = new Intent(CadastroActivity.this, MainActivity.class);
startActivity(i);
break;
case -1:
tvRespostaServidor.setText("Ocorreu um erro ao acessar o servidor");
}
}
}
private boolean conexao() throws Exception {
URL obj = new URL(webservice.toString());
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
//add request header
con.setRequestMethod("POST");
con.setDoOutput(true);
//Gerando o objeto em JSON com os dados de login informados pelo usuario
JSONObject acao = new JSONObject();
JSONObject parametros = new JSONObject();
parametros.put("usuario", txt_email.getText().toString());
parametros.put("senha", txt_senha.getText().toString());
acao.put("acao", "consulta_quant");
acao.put("parametros", parametros);
Log.i("***Enviando requisicao POST para servidor PHP: ", acao.toString());
// Send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(acao.toString());
wr.flush();
wr.close();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuffer response = new StringBuffer();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//Imprimindo resultado recebido do servidor
Log.i("***** Resposta do servidor PHP", response.toString());
JSONObject resposta_json = new JSONObject(response.toString());
boolean login_realizado_com_sucesso = false;
if(resposta_json.getString("acao").equals("consulta_quant")) {
if (resposta_json.getInt("resultado") == 1) {
quant_rotina=resposta_json.getString("acao");
login_realizado_com_sucesso = true;
}
}
if(login_realizado_com_sucesso)
return true;
else
return false;
}
//Esta tarefa é assincrona - acessa o servidor remoto PHP e não trava a app android
private class acessarsevidor extends AsyncTask<Void, Void, Integer> {
boolean resposta;
@Override
protected Integer doInBackground(Void... voids) {
try {
resposta = conexao();
if(resposta) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return -1;
}
/*
Eu estou considerando o seguinte:
Retorno 1 para informar que login foi feito com sucesso
Retorno 0 para informar que login estava incorreto
Retorno -1, caso tenha ocorrido algum problema ao acessar o servidor
*/
}
//Utilizo isso apenas para atualizar os componentes da tela
}
}
| [
"jonathan.oliveira@aluno.ifsp.edu.br"
] | jonathan.oliveira@aluno.ifsp.edu.br |
825ab5d22d7af8c0d45e79c9f45507e9ed1c5281 | c69f3179cabf547d1505bb0dc94107bd1b51058a | /misc/permutationpal.java | 5fcc6c10aa681e48c82e8585fd2a224f33305e58 | [] | no_license | kusumasric/codingpractice | 48ffdb2a569db5217682ba1666f8ce2fc29d16ca | b12ea13f6ec12576cd05c2d858cea2ecd2c96866 | refs/heads/master | 2021-01-21T01:46:34.338646 | 2016-07-07T18:28:43 | 2016-07-07T18:28:43 | 59,632,614 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | import java.io.*;
import java.util.*;
public class permutationpal
{
public static void main(String[] args)
{
String input;
input=System.console().readLine("Enter a string : ");
methodper(input);
}
public static void methodper(String in)
{
int[] count1=new int[256];
int ascii,k=0,count2=0,j=0;
Arrays.fill(count1,0);
for(int i=0;i < in.length();i++ )
{
ascii=(int)in.charAt(i);
count1[ascii]+=1;
}
for(j=0;j <256;j++)
{
if(count1[j] % 2== 0)
{
continue;
}
else if(count1[j]%2 ==1)
{
count2++;
}
}
if(count2 ==0 || count2 == 1)
System.out.println("True: it is a permutation of a palandrome ");
else
System.out.println("False:it is not a permutation of a palandrome") ;
}
} | [
"kusuma.chunduru@gmail.com"
] | kusuma.chunduru@gmail.com |
4d81f62a7bf4aad6689a854e02c85b0d4b221c2b | 19d10b019216ab4a403e2e6e6115d205ff70bbd7 | /src/com/JavaClub/util/PDFUtils.java | ac7c0172f7670ddc3e4ba5a94b3cf42a2cdb5e23 | [] | no_license | yusi101/JavaClub | 10cccf41cc77877957d4d54914854156b730f347 | 478360819b9e84dd8d5004a7f48b304980eeaf6f | refs/heads/master | 2021-01-22T03:30:06.005650 | 2017-05-25T08:31:48 | 2017-05-25T08:31:48 | 92,381,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,633 | java | package com.JavaClub.util;
import java.awt.Color;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdfs.MakePDF;
import com.lowagie.text.pdfs.PdfUtil;
public class PDFUtils {
protected static Logger logger = Logger.getLogger(PDFUtils.class);
public static void makePdf(String entname,String select,String pripid) throws Exception {
String path = "C:\\Users\\不愿别人见识你的妩媚\\Desktop";
String fileName = entname + ".pdf";
try {
Document document = new Document(PageSize.A4, 36, 36, 30, 20);
PdfWriter.getInstance(document, new FileOutputStream(path + "/" + fileName));// 报告的位置
BaseFont baseFont = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
document.open();
Color font_color = new Color(126,147,186);//字体颜色 //边框颜色
Color table_bg = new Color(220,230,240); //table背景色
//年报信息 纵向的样式
document.add(getTitleTable("年报信息", baseFont, 13, font_color, 0, 12, table_bg,font_color));
float[] dateFloat = {0.2f, 0.4f,0.4f};// 可以设置表格的列
String[] dataTitile = {"序号","年报年度","发布日期"};
String[] dataContent1 = {"1","2015年度","2015年08月20日"};
String[] dataContent2 = {"2","2014年度","2014年08月20日"};
document.add(getContentTable(dateFloat,dataTitile, baseFont, Font.BOLD,Element.ALIGN_CENTER,table_bg, font_color,false));
document.add(getContentTable(dateFloat,dataContent1, baseFont, Font.NORMAL,Element.ALIGN_CENTER,null, font_color,false));
document.add(getContentTable(dateFloat,dataContent2, baseFont, Font.NORMAL,Element.ALIGN_CENTER,null, font_color,false));
//企业资产状况 横向的样式
document.add(getTitleTable("企业资产状况信息", baseFont, 13, font_color, 0, 12, table_bg,font_color));
float[] qyFloat = {0.25f, 0.25f, 0.25f, 0.25f };// 可以设置表格的宽度
String[] qyContent1 = {"资产总额","该企业选择不公示","营业总收入中主营业务收入","该企业选择不公示"};
String[] qyContent2 = {"所有者权益合计","该企业选择不公示","净利润","该企业选择不公示"};
String[] qyContent3 = {"营业总收入","该企业选择不公示","纳税总额","该企业选择不公示"};
String[] qyContent4 = {"利润总额","该企业选择不公示","负债总额","该企业选择不公示"};
//2015年度
document.add(getTitleTable("2015年度", baseFont, 10, Color.BLACK, 0, 4, table_bg,font_color));
document.add(getContentTable(qyFloat,qyContent1, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
document.add(getContentTable(qyFloat,qyContent2, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
document.add(getContentTable(qyFloat,qyContent3, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
document.add(getContentTable(qyFloat,qyContent4, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
//2014年度
document.add(getTitleTable("2014年度", baseFont, 10, Color.BLACK, 0, 4, table_bg,font_color));
document.add(getContentTable(qyFloat,qyContent1, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
document.add(getContentTable(qyFloat,qyContent2, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
document.add(getContentTable(qyFloat,qyContent3, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
document.add(getContentTable(qyFloat,qyContent4, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
//联络信息
document.add(getTitleTable("联络信息", baseFont, 13, font_color, 0, 12, table_bg,font_color));
float[] llFloat = {0.2f, 0.3f, 0.2f, 0.3f };// 可以设置表格的宽度
String[] llContent1 = {"电话","110","地址","南昌市公安局"};
String[] llContent2 = {"邮箱","110@qq.com","邮编","110"};
document.add(getTitleTable("2015年度", baseFont, 10, Color.BLACK, 0, 4, table_bg,font_color));
document.add(getContentTable(llFloat,llContent1, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
document.add(getContentTable(llFloat,llContent2, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
//2014年度
document.add(getTitleTable("2014年度", baseFont, 10, Color.BLACK, 0, 4, table_bg,font_color));
document.add(getContentTable(llFloat,llContent1, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
document.add(getContentTable(llFloat,llContent2, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true));
//股东(发起人)及出资信息(单位:万人民币)
document.add(getTitleTable("股东(发起人)及出资信息(单位:万人民币)", baseFont, 13, font_color, 0, 12, table_bg,font_color));
float[] gdFloat = {0.16f, 0.14f, 0.14f, 0.14f, 0.14f, 0.14f, 0.14f };// 可以设置表格的宽度
String[] gdTitle={"发起人","认缴出资额","认缴出资时间","认缴出资方式","实缴出资额","实缴出资时间","实缴出资方式"};
String[] gdContent={"南昌市财政局","2200.20","2015-02-28","货币","3200.20","2015-03-28","货币"};
//2015年度
document.add(getTitleTable("2015年度", baseFont, 10, Color.BLACK, 0, 4, table_bg,font_color));
document.add(getContentTable(gdFloat,gdTitle, baseFont, Font.BOLD,Element.ALIGN_CENTER,null, font_color,false));
document.add(getContentTable(gdFloat,gdContent, baseFont, Font.NORMAL,Element.ALIGN_CENTER,null, font_color,false));
//2014年度
document.add(getTitleTable("2014年度", baseFont, 10, Color.BLACK, 0, 4, table_bg,font_color));
document.add(getContentTable(gdFloat,gdTitle, baseFont, Font.BOLD,Element.ALIGN_CENTER, null,font_color,false));
document.add(getContentTable(gdFloat,gdContent, baseFont, Font.NORMAL,Element.ALIGN_CENTER,null, font_color,false));
//网站信息///////////////////////
document.add(getTitleTable("网站信息", baseFont, 13, font_color, 0, 12, table_bg,font_color));
float[] wzFloat = {0.1f, 0.2f, 0.35f, 0.35f };// 可以设置表格的宽度
String[] wzTtitle={"序号","网站类型","网站名称","网址"};
String[] wzContent={"1","金融","江西智容","www.baidu.com"};
//2015年度
document.add(getTitleTable("2015年度", baseFont, 10, Color.BLACK, 0, 4, table_bg,font_color));
document.add(getContentTable(wzFloat,wzTtitle, baseFont, Font.BOLD,Element.ALIGN_LEFT,null, font_color,false));
document.add(getContentTable(wzFloat,wzContent, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,false));
//2014年度
document.add(getTitleTable("2014年度", baseFont, 10, Color.BLACK, 0, 4, table_bg,font_color));
document.add(getContentTable(wzFloat,wzTtitle, baseFont, Font.BOLD,Element.ALIGN_LEFT, null,font_color,false));
document.add(getContentTable(wzFloat,wzContent, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,false));
document.close();
} catch (Exception e) {
logger.error(e.toString(),e);
}
}
/**
*
* @descript (设置标题信息)
* @author 李海涛
* @since 2016年10月26日下午6:37:36
* @param document
* @param writer
* @param titleType 标题类型 1级标题为1,2级为2
* @param CatalogueName 标题名称
* @throws Exception
*/
@SuppressWarnings("rawtypes")
public static void setCatalogueTitle(Document document,PdfWriter writer,Map<String, Object> CURRENTINDEX,int titleType,String CatalogueName) throws Exception{
BaseFont baseFont = MakePDF.getBaseFontYh();
Font font_catalogue_one=new Font(baseFont, 18, Font.BOLD, Color.decode("#000000"));//一级标题的字体
Font font_catalogue_two=new Font(baseFont, 15, Font.BOLD, Color.decode("#000000"));//二级标题的字体
Font font_catalogue_three=new Font(baseFont, 12, Font.BOLD, Color.decode("#000000"));;//三级标题的字体
int CURRENTINDEX_ONE=Integer.parseInt(CURRENTINDEX.get("CURRENTINDEX_ONE").toString()); //记录第几个一级目录
int CURRENTINDEX_TWO=Integer.parseInt(CURRENTINDEX.get("CURRENTINDEX_TWO").toString()); //记录第几个二级目录
int CURRENTINDEX_THREE=Integer.parseInt(CURRENTINDEX.get("CURRENTINDEX_THREE").toString()); //记录第几个三级目录
List catalogue_list=(List) CURRENTINDEX.get("CATALOGUE_LIST");//存放目录的模块名称和页码
if(titleType==1){//一级标题
document.newPage();
String catalogue_title=PdfUtil.toHanzi(CURRENTINDEX_ONE+"")+"、"+CatalogueName;
setCatalogue(catalogue_list, catalogue_title, writer.getCurrentPageNumber(),titleType);
Paragraph paragraph = new Paragraph(catalogue_title, font_catalogue_one);
CURRENTINDEX_ONE++;
CURRENTINDEX_TWO=1;
paragraph.setAlignment(Element.ALIGN_LEFT);// 设置标题居中
document.add(paragraph);
document.add(MakePDF.MyLine("", Color.decode("#ADABAB")));
}else if(titleType==2){//二级标题
String catalogue_title=(CURRENTINDEX_ONE-1)+"."+CURRENTINDEX_TWO+"、"+CatalogueName;
setCatalogue(catalogue_list, catalogue_title, writer.getCurrentPageNumber(),titleType);
Paragraph paragraph = new Paragraph(catalogue_title, font_catalogue_two);
CURRENTINDEX_TWO++;
CURRENTINDEX_THREE=1;
paragraph.setAlignment(Element.ALIGN_LEFT);// 设置标题居中
paragraph.setFirstLineIndent(20);
paragraph.setSpacingAfter(15);
document.add(paragraph);
}else if(titleType==3){//三级标题
String catalogue_title=(CURRENTINDEX_ONE-1)+"."+(CURRENTINDEX_TWO-1)+"."+CURRENTINDEX_THREE+"、"+CatalogueName;
setCatalogue(catalogue_list, catalogue_title, writer.getCurrentPageNumber(),titleType);
Paragraph paragraph = new Paragraph(catalogue_title, font_catalogue_three);
CURRENTINDEX_THREE++;
paragraph.setAlignment(Element.ALIGN_LEFT);// 设置标题居中
paragraph.setFirstLineIndent(40);
paragraph.setSpacingAfter(15);
document.add(paragraph);
}
CURRENTINDEX.put("CURRENTINDEX_ONE", CURRENTINDEX_ONE);
CURRENTINDEX.put("CURRENTINDEX_TWO", CURRENTINDEX_TWO);
CURRENTINDEX.put("CURRENTINDEX_THREE", CURRENTINDEX_THREE);
CURRENTINDEX.put("CATALOGUE_LIST", catalogue_list);
}
/**
* 这个方法是判断字符串是否含有中文
*/
@SuppressWarnings({"rawtypes", "unchecked" })
public static void setCatalogue(List list,String modularName,int pageNumber,int titleType){
Map<String,Object> map=new HashMap<>(1);
map.put("modularName", modularName);
map.put("pageNumber", pageNumber);
map.put("titleType", titleType);
list.add(map);
}
/**
*
* @descript (设置table标题)
* @author 李文海
* @since 2016年10月26日下午4:31:18
* @param title 标题名称
* @param baseFont 字体样式
* @param fontSize 字体大小
* @param font_color 字体颜色
* @param margin_left 左边距
* @param padding_top 上边距
* @param table_bg 背景颜色
* @param border_color 边框颜色
* @return
*/
public static PdfPTable getTitleTable(String title,BaseFont baseFont,int fontSize,Color font_color,int margin_left,int padding_top,Color table_bg,Color border_color){
float[] gudong = {1f };// 可以设置表格的宽度
PdfPTable table = new PdfPTable(gudong);
table.setWidthPercentage(100);// 宽度为100%
table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);// 居中
PdfPCell cell = new PdfPCell();
Paragraph paragraph = new Paragraph(title, new Font(baseFont, fontSize, Font.BOLD, font_color));
paragraph.setAlignment(Element.ALIGN_LEFT);// 设置左对齐
paragraph.setIndentationLeft(margin_left);//设置左边距
paragraph.setSpacingAfter(padding_top);// 设置内容段落间距
cell.addElement(paragraph);
cell.setBackgroundColor(table_bg);
cell.setBorderColor(border_color);
table.addCell(cell);
return table;
}
/**
*
* @descript (设置表格内容 注意gdFloat 和content 的长度要一样)
* @author 李文海
* @since 2016年10月26日下午4:50:07
* @param gdFloat 设置表格的列
* @param content 内容
* @param baseFont 字体样式
* @param font_weight 字体粗细
* @param align 字体对齐方式
* @param table_bg 背景颜色 null为不设置
* @param border_color 边框颜色
* @param firstCellisBold 第一列和第三列是否需要加粗 true为加粗
* @return
*/
public static PdfPTable getContentTable(float[] gdFloat,String[] content,BaseFont baseFont,int font_weight,int align,Color table_bg,Color border_color,boolean firstCellisBold){
PdfPTable table = new PdfPTable(gdFloat);
table.setWidthPercentage(100);// 宽度为100%
table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);// 居中
for(int i=0;i<content.length;i++){
PdfPCell cell = new PdfPCell();
Paragraph paragraph;
//第一列和第三列是否需要加粗 true为加粗
if(firstCellisBold){
if((i+1)==1 || (i+1)==3){
paragraph = new Paragraph(content[i], new Font(baseFont, 10, Font.BOLD, Color.BLACK));
}else{
paragraph = new Paragraph(content[i], new Font(baseFont, 10, font_weight, Color.BLACK));
}
}else{
paragraph = new Paragraph(content[i], new Font(baseFont, 10, font_weight, Color.BLACK));
}
paragraph.setAlignment(align);// 设置居中
paragraph.setSpacingAfter(4);// 设置内容段落间距
cell.addElement(paragraph);
//设置背景颜色 为null不设置
if(table_bg != null){
cell.setBackgroundColor(table_bg);
}
cell.setBorderColor(border_color);
table.addCell(cell);
}
return table;
}
/////////////////////////////////////////////////////////////////////////
/**
*
* @descript (设置标题 )
* @author 李文海
* @since 2016年10月27日上午9:11:12
* @param document 文档
* @param title 标题
* @param baseFont 字体样式
* @param fontSize 字体大小
* @param font_color 字体颜色
* @param padding_top 上边距
* @param table_bg 背景色
* @param border_color 边框颜色
* @param align 对齐方式
*/
public static void setTableTitle(Document document,String title,BaseFont baseFont,int fontSize,Color font_color,int padding_top,Color table_bg,Color border_color,int align){
float[] gudong = {1f };// 可以设置表格的宽度
PdfPTable table = new PdfPTable(gudong);
table.setWidthPercentage(100);// 宽度为100%
table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);// 居中
PdfPCell cell = new PdfPCell();
Paragraph paragraph = new Paragraph(title, new Font(baseFont, fontSize, Font.BOLD, font_color));
paragraph.setAlignment(align);// 设置左对齐
paragraph.setSpacingAfter(padding_top);// 设置内容段落间距
cell.addElement(paragraph);
cell.setBackgroundColor(table_bg);
cell.setBorderColor(border_color);
table.addCell(cell);
try {
document.add(table);
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
* @descript (设置表格内容 注意gdFloat 和content 的长度要一样)
* @author 李文海
* @since 2016年10月26日下午4:50:07
* @param document 文档
* @param gdFloat 设置表格的列
* @param content 内容
* @param baseFont 字体样式
* @param font_weight 字体粗细
* @param align 字体对齐方式
* @param table_bg 背景颜色 null为不设置
* @param border_color 边框颜色
* @param firstCellisBold 第一列和第三列是否需要加粗 true为加粗
* @return
*/
public static void setTableContent(Document document,float[] gdFloat,String[] content,BaseFont baseFont,int font_weight,int align,Color table_bg,Color border_color,boolean firstCellisBold){
PdfPTable table = new PdfPTable(gdFloat);
table.setWidthPercentage(100);// 宽度为100%
table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);// 居中
for(int i=0;i<content.length;i++){
PdfPCell cell = new PdfPCell();
Paragraph paragraph;
//第一列和第三列是否需要加粗 true为加粗
if(firstCellisBold){
if((i+1)==1 || (i+1)==3){
paragraph = new Paragraph(content[i], new Font(baseFont, 10, Font.BOLD, Color.BLACK));
}else{
paragraph = new Paragraph(content[i], new Font(baseFont, 10, font_weight, Color.BLACK));
}
}else{
paragraph = new Paragraph(content[i], new Font(baseFont, 10, font_weight, Color.BLACK));
}
paragraph.setAlignment(align);// 设置居中
paragraph.setSpacingAfter(4);// 设置内容段落间距
cell.addElement(paragraph);
//设置背景颜色 为null不设置
if(table_bg != null){
cell.setBackgroundColor(table_bg);
}
cell.setBorderColor(border_color);
table.addCell(cell);
try {
document.add(table);
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
*
* @descript (接收所有年报信息)
* @author 李文海
* @since 2016年10月27日上午11:27:03
* @param document 文档
* @param baseFont 字体样式
* @param priptype 类型
* @param yearList 年度
* @param baseinfoList 年报基本信息
* @param webList 网站或者网店信息
* @param licenceList 行政许可信息
* @param moneyList 资产状况信息
* @param updateList 修改信息
* @param branchList 分支机构信息
* @param subCapitalList 股东及出资
* @param forinvestMentList 对外投资信息
* @param forguaranteeList 对外提供保证担保信息
* @param alterstockInfoList 股权变更信息
* @throws Exception
*/
@SuppressWarnings("unchecked")
public static void setYearDate(Document document,PdfWriter writer,Map<String,Object> CURRENTINDEX,BaseFont baseFont,String priptype,
List<Map<String,Object>> yearList,List<Map<String,Object>> baseinfoList,
List<Map<String,Object>> webList,List<Map<String,Object>> licenceList,
List<Map<String,Object>> moneyList,List<Map<String,Object>> updateList,
List<Map<String,Object>> branchList,List<Map<String,Object>> subCapitalList,
List<Map<String,Object>> forinvestMentList,List<Map<String,Object>> forguaranteeList,
List<Map<String,Object>> alterstockInfoList) throws Exception{
Color font_color = new Color(126,147,186);//字体颜色 //边框颜色
Color table_bg = Color.decode("#F7F3F3"); //table背景色
//添加年度信息
setCatalogueTitle(document, writer,CURRENTINDEX,2,"年度信息");
//setTableTitle(document, "年度信息", baseFont, 13, font_color,12, table_bg,font_color,Element.ALIGN_LEFT);
float[] widthFloat = {0.2f, 0.4f,0.4f};// 可以设置表格的列
String[] title = {"序号","年报年度","发布日期"};
setTableContent(document, widthFloat, title, baseFont, Font.BOLD, Element.ALIGN_CENTER, table_bg, font_color, false);
if(yearList.size() <=0 ){
setTableTitle(document,"没有记录", baseFont, 10,Color.BLACK , 4, Color.WHITE,font_color,Element.ALIGN_CENTER);
}
for(Map<String,Object> map:yearList){
String[] content = {map.get("index").toString(),map.get("year").toString(),map.get("date").toString()};
setTableContent(document, widthFloat, content, baseFont, Font.NORMAL, Element.ALIGN_CENTER, null, font_color, false);
}
if(("9500").equals(priptype)){
//个体年报信息
//添加年报基本信息
String[] key = {"TRANAME","REGNO","NAME","TEL","FUNDAM","EMPNUM","ISWEB"};
String[] name = {"企业名称","注册号","经营者","联系电话","资金数额","从业人数","是否有网站或网店"};
setBaseinfoPDF(document,writer,CURRENTINDEX,baseFont, table_bg, font_color, baseinfoList, yearList, key, name,"年报基本信息");
//添加网站或者网店信息
float[] webFloat = {0.1f, 0.2f, 0.35f, 0.35f };// 网站的float
String[] webName={"序号","网站类型","网站名称","网址"};// 网站的标题
String[] webKey = {"WEBTYPE","WEBSITNAME","WEBSITE"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color, webList, yearList,webFloat,webName,"网站或者网店信息",webKey,false);
//添加行政许可信息
float[] licenceFloat = {0.2f, 0.4f, 0.4f};
String[] licenceName = {"序号","许可文件名称","有效期至"};
String[] licenceKey = {"LICNAME_CN","VALTO"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color, licenceList, yearList,licenceFloat,licenceName,"行政许可信息",licenceKey,false);
//添加资产状况
String[] moneyKey = {"VENDINC","RATGRO"};
String[] moneyName = {"销售额或营业收入","纳税总额"};
setBaseinfoPDF(document,writer,CURRENTINDEX,baseFont, table_bg, font_color, moneyList, yearList, moneyKey, moneyName,"企业资产状况信息");
//修改信息
float[] updateFloat = {0.25f, 0.25f, 0.25f,0.25f};
String[] updateName = {"修改事项","修改前","修改后","修改日期"};
String[] updateKey = {"ALITEM","ALTBE","ALTAF","ALTDATE"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color,updateList , yearList,updateFloat,updateName,"修改信息",updateKey,true);
}else if("9100".equals(priptype)){
//农专年报信息
//添加年报基本信息
String[] key = {"ENTNAME","REGNO","TEL","EMAIL","MEMNUM"};
String[] name = {"合作社名称","注册号","联系电话","邮箱","成员人数"};
setBaseinfoPDF(document,writer,CURRENTINDEX,baseFont, table_bg, font_color, baseinfoList, yearList, key, name,"年报基本信息");
//添加网站或者网店信息
float[] webFloat = {0.1f, 0.2f, 0.35f, 0.35f };// 网站的float
String[] webName={"序号","网站类型","网站名称","网址"};// 网站的标题
String[] webKey = {"WEBTYPE","WEBSITNAME","WEBSITE"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color, webList, yearList,webFloat,webName,"网站或者网店信息",webKey,false);
//添加行政许可信息
float[] licenceFloat = {0.2f, 0.4f, 0.4f};
String[] licenceName = {"序号","许可文件名称","有效期至"};
String[] licenceKey = {"LICNAME_CN","VALTO"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color, licenceList, yearList,licenceFloat,licenceName,"行政许可信息",licenceKey,false);
//分支机构信息
float[] branchFloat = {0.2f, 0.4f, 0.4f};
String[] branchName = {"序号","分支机构名称","统一社会信用代码"};
String[] branchKey = {"BRNAME","UNISCID"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color, branchList, yearList,branchFloat,branchName,"分支机构信息 ",branchKey,false);
//添加资产状况
String[] moneyKey = {"PRIYEASALES","RATGRO","PRIYEALOAN","PRIYEAPROFIT","PRIYEASUB"};
String[] moneyName = {" 销售额营业总收入","纳税总额","金融贷款","盈余总额","获得政府扶持资金、补助"};
setBaseinfoPDF(document,writer,CURRENTINDEX,baseFont, table_bg, font_color, moneyList, yearList, moneyKey, moneyName,"企业资产状况信息");
//修改信息
float[] updateFloat = {0.25f, 0.25f, 0.25f,0.25f};
String[] updateName = {"修改事项","修改前","修改后","修改日期"};
String[] updateKey = {"ALITEM","ALTBE","ALTAF","ALTDATE"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color,updateList , yearList,updateFloat,updateName,"修改信息",updateKey,true);
}else{
//企业年报信息
//添加年报基本信息
String[] key = {"ENTNAME","REGNO","TEL","POSTALCODE","ADDR","EMAIL","ISCHANGE","BUSST_CN","ISWEB","ISLETTER","EMPNUM"};
String[] name = {"企业名称","注册号","企业联系电话","邮政编码","企业通讯地址","电子邮箱","本年度是否发生股东股权转让","企业经营状态","是否有网站或网店","企业是否有投资信息或购买其他公司股权","从业人数"};
setBaseinfoPDF(document,writer,CURRENTINDEX,baseFont, table_bg, font_color, baseinfoList, yearList, key, name,"年报基本信息");
//添加网站或者网店信息
float[] webFloat = {0.1f, 0.2f, 0.35f, 0.35f };// 网站的float
String[] webName={"序号","网站类型","网站名称","网址"};// 网站的标题
String[] webKey = {"WEBTYPE","WEBSITNAME","WEBSITE"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color, webList, yearList,webFloat,webName,"网站或者网店信息",webKey,false);
//股东及出资
String[] subCapitalKey = {"INVNAME","LISUBCONAM","SUBCONDATE","SUBCONFORM_CN","LIACCONAM","ACCONDATE","ACCONFORM_CN"};
String[] subCapitalName = {"股东","认缴出资额(万元)","认缴出资时间","认缴出资方式","实缴出资额(万元)","实缴出资时间","实缴出资方式"};
//setTableTitle(document, "股东及出资 ", baseFont, 13, font_color,12, table_bg,font_color,Element.ALIGN_LEFT);
setCatalogueTitle(document, writer,CURRENTINDEX,2,"股东及出资");
if(subCapitalList.size() <=0 ){
setTableTitle(document,"没有记录", baseFont, 10,Color.BLACK , 4, Color.WHITE,font_color,Element.ALIGN_CENTER);
}
for(int i=0;i<subCapitalList.size();i++){
//添加年度小标题
setTableTitle(document,yearList.get(i).get("year").toString(), baseFont, 10, Color.BLACK, 4, table_bg,font_color,Element.ALIGN_LEFT);
//列表
List<Map<String, Object>> tempList = (List<Map<String, Object>>) subCapitalList.get(i).get("list");
setBaseinfoPDF(document,writer,CURRENTINDEX,baseFont, table_bg, font_color, tempList,yearList , subCapitalKey, subCapitalName, "");
}
//对外投资信息
float[] forinvestMentFloat = {0.2f, 0.4f, 0.4f };// 网站的float
String[] forinvestMentName={"序号","投资设立企业或购买股权企业名称","对外投资企业注册号"};// 网站的标题
String[] forinvestMentKey = {"ENTNAME","UNISCID"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color, forinvestMentList, yearList,forinvestMentFloat,forinvestMentName,"对外投资信息",forinvestMentKey,false);
//企业资产状况信息
String[] moneyKey = {"ASSGRO","VENDINC","MAIBUSINC","RATGRO","TOTEQU","PROGRO","NETINC","LIAGRO"};
//String[] moneyName = {"所有者权益合计","利润总额","净利润","负债总额","所有者权益合计","利润总额","净利润","负债总额"};
String[] moneyName = {"资产总额","营业总收入","营业总收入中主营业务收入","纳税总额","所有者权益合计","利润总额","净利润","负债总额"};
setBaseinfoPDF(document,writer,CURRENTINDEX,baseFont, table_bg, font_color, moneyList, yearList, moneyKey, moneyName,"企业资产状况信息");
//对外提供保证担保信息
String[] forguaranteeKey = {"MORE","MORTGAGOR","PRICLASECKIND","PRICLASECAM","PEFPER","GUARANPERIOD","GATYPE"};
String[] forguaranteeName = {"债权人","债务人","主债权种类","主债权数额","履行债务的期限","保证的期间","保证的方式"};
//setTableTitle(document, "对外提供保证担保信息 ", baseFont, 13, font_color,12, table_bg,font_color,Element.ALIGN_LEFT);
setCatalogueTitle(document, writer,CURRENTINDEX,2,"对外提供保证担保信息");
if(forguaranteeList.size() <=0 ){
setTableTitle(document,"没有记录", baseFont, 10,Color.BLACK , 4, Color.WHITE,font_color,Element.ALIGN_CENTER);
}
for(int i=0;i<forguaranteeList.size();i++){
//添加年度小标题
setTableTitle(document,yearList.get(i).get("year").toString(), baseFont, 10, Color.BLACK, 4, table_bg,font_color,Element.ALIGN_LEFT);
//列表
List<Map<String, Object>> tempList = (List<Map<String, Object>>) forguaranteeList.get(i).get("list");
setBaseinfoPDF(document,writer,CURRENTINDEX,baseFont, table_bg, font_color, tempList,yearList , forguaranteeKey, forguaranteeName, "");
}
//股权变更信息
String[] alterstockInfoKey = {"INV","TRANSAMPR","TRANSAMAFT","ALTDATE"};
String[] alterstockInfoName = {"股东","变更前股权比例","变更后股权比例","股权变更日期"};
float[] alterstockInfoFloat = {0.25f, 0.25f, 0.25f ,0.25f};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color, alterstockInfoList, yearList,alterstockInfoFloat,alterstockInfoName,"股权变更信息",alterstockInfoKey,true);
//修改信息
float[] updateFloat = {0.25f, 0.25f, 0.25f,0.25f};
String[] updateName = {"修改事项","修改前","修改后","修改日期"};
String[] updateKey = {"ALITEM","ALTBE","ALTAF","ALTDATE"};
setWebPDF(document,writer,CURRENTINDEX, baseFont, table_bg, font_color,updateList , yearList,updateFloat,updateName,"修改信息",updateKey,true);
}
}
/**
*
* @descript (横向 生成网站或者网店信息/行政处罚信息/修改信息/分支机构信息/对外投资信息 (List数据类型) )
* @author 李文海
* @since 2016年10月27日下午3:32:05
* @param document
* @param baseFont
* @param table_bg 背景色
* @param font_color 字体颜色
* @param webList 网站或者网店信息List
* @param yearList 年度List
* @param widthFloat 列数
* @param name 显示的值
* @param title 标题
* @param key 值的key
* @param noIndex 是否需要序号列 true为不需要
* @throws Exception
*/
@SuppressWarnings("unchecked")
public static void setWebPDF(Document document,PdfWriter writer,Map<String,Object> CURRENTINDEX,BaseFont baseFont,Color table_bg,Color font_color,
List<Map<String,Object>> webList,List<Map<String,Object>> yearList,
float[] widthFloat,String[] name,String title,String[] key,boolean noIndex) throws Exception{
//setTableTitle(document, title, baseFont, 13, font_color,12, table_bg,font_color,Element.ALIGN_LEFT);
setCatalogueTitle(document, writer,CURRENTINDEX,2,title);
if(webList.size() <=0 ){
setTableTitle(document,"没有记录", baseFont, 10,Color.BLACK , 4, Color.WHITE,font_color,Element.ALIGN_CENTER);
}
for(int i=0;i<webList.size();i++){
//添加年度小标题
setTableTitle(document,yearList.get(i).get("year").toString(), baseFont, 10, Color.BLACK, 4, table_bg,font_color,Element.ALIGN_LEFT);
//标题
setTableContent(document, widthFloat, name, baseFont, Font.BOLD, Element.ALIGN_LEFT, null, font_color, false);
//列表
List<Map<String, Object>> tempList = (List<Map<String, Object>>) webList.get(i).get("list");
if(tempList.size() <=0 ){
setTableTitle(document,"没有记录", baseFont, 10,Color.BLACK , 4, Color.WHITE,font_color,Element.ALIGN_CENTER);
}
for(int j=0;j<tempList.size();j++){
Map<String, Object> map = tempList.get(j);
String[] cwebContent = new String[key.length+1];
//true时不需要 序号
if(noIndex){
for(int g=0;g<key.length;g++){
if(map.get(key[g]) == null){
cwebContent[g] = "";
}else{
cwebContent[g] = map.get(key[g]).toString();
}
}
}else{
cwebContent[0] = (j+1)+"";
for(int g=0;g<key.length;g++){
cwebContent[g+1] = map.get(key[g]).toString();
}
}
setTableContent(document, widthFloat, cwebContent, baseFont, Font.NORMAL, Element.ALIGN_LEFT, null, font_color, false);
}
}
}
/**
*
* @descript (纵向(固定4列表格) 生成年报基本信息/企业资产 (Map类型的数据))
* @author 李文海
* @since 2016年10月27日下午2:47:36
* @param document 文档
* @param baseFont 字体样式
* @param table_bg 背景色
* @param font_color 字体颜色
* @param list 需要显示的数据
* @param yearList 年度List
* @param key 需要现实的值的键
* @param name 需要显示的值
* @param widthFolat 生成几列多宽的table
* @param title 标题
* @throws Exception
*/
public static void setBaseinfoPDF(Document document,PdfWriter writer,Map<String,Object> CURRENTINDEX,BaseFont baseFont,Color table_bg,Color font_color,List<Map<String,Object>> list,List<Map<String,Object>> yearList,String[] key,String[] name,String title) throws Exception{
//当title为空时 不需要再生产标题和下面的年度小标题
if(StringUtil.isNotEmpty(title)){
/*setTableTitle(document, title, baseFont, 13, font_color,12, table_bg,font_color,Element.ALIGN_LEFT);*/
setCatalogueTitle(document, writer,CURRENTINDEX,2,title);
}
float[] widthFolat = {0.25f, 0.25f, 0.25f, 0.25f };//年报的float
if(list.size() <=0 ){
setTableTitle(document,"没有记录", baseFont, 10,Color.BLACK , 4, Color.WHITE,font_color,Element.ALIGN_CENTER);
}
for(int j=0;j<list.size();j++){
if(StringUtil.isNotEmpty(title)){
//添加年度小标题
setTableTitle(document,yearList.get(j).get("year").toString(), baseFont, 10, Color.BLACK, 4, table_bg,font_color,Element.ALIGN_LEFT);
}
for(int i=0;i<key.length;i++){
Map<String,Object> map = list.get(j);
int other = i+1;
if(other < key.length){
String[] content = {name[i],map.get(key[i])==null? "" : map.get(key[i]).toString(),name[other],map.get(key[other])==null ? "": map.get(key[other]).toString()};
setTableContent(document,widthFolat,content, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true);
}else{
String[] content = {name[i],map.get(key[i])==null? "" : map.get(key[i]).toString(),"",""};
setTableContent(document,widthFolat,content, baseFont, Font.NORMAL,Element.ALIGN_LEFT,null, font_color,true);
}
i = other;
}
}
}
/**
*
* @descript (获取年度)
* @author 李文海
* @since 2016年10月27日上午10:47:50
* @param index 序号
* @param year 年度
* @param date 日期
* @return
*/
public static Map<String,Object> getYear(int index,Object year,Object date){
Map<String,Object> map = new HashMap<String, Object>();
map.put("index", index); //序号 例如: 1
map.put("year", year==null ? "": year+"年度"); //例如:2015年度
map.put("date", date==null ? "" :date); //例如:2015年度08月01日
return map;
}
/**
*
* @descript (把数据添加进Map)
* @author 李文海
* @since 2016年10月27日上午10:56:25
* @param object PageData / List
* @param type 0 为pd/1为list
* @return
*/
@SuppressWarnings("unchecked")
public static Map<String,Object> getTableContent(Object object,int type){
Map<String,Object> map = new HashMap<String, Object>();
if(type == 0){
map = (Map<String, Object>) object;
}else if(type == 1){
map.put("list", object);
}
return map;
}
public static void main(String[] args) {
/*try {
makePdf("江西智容","企业登记","123");
System.out.println("ok");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
Map<String, Object> map = new HashMap<>();
map.put("key", "1");
if(map.get("list")!=null){
System.out.println("list");
}else{
System.out.println(map.get("key"));
}
}
}
| [
"1461855809@qq.com"
] | 1461855809@qq.com |
31a744f972a0d86336d6ca1dc6b6aeb93d5e8208 | 0d6390b10898a84faa204ef17f337b679c7ff41a | /A02_Hint1/src/DivideAndConquerAlgorithms.java | b9dee6eeb0ff632ef34b19aa906adc659a247dbf | [] | no_license | JohnnyB87/2017_COMP7035_SDH2_A02_JohnBrady | 7f6f4a05607f29c6561f67d612d9335ad959e2d1 | 599102f68857367c4a78e61b59ceb2f624276c42 | refs/heads/master | 2021-03-27T12:32:58.363001 | 2017-12-02T17:04:28 | 2017-12-02T17:04:28 | 109,429,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,216 | java |
/**
* The class contains the Divide and Conquer-based Algorithms we are using.
*/
public class DivideAndConquerAlgorithms {
//----------------------------------------------
// Class constructor
//----------------------------------------------
/**
* Constructor of the class. Do not edit it.
*/
public DivideAndConquerAlgorithms(){}
//-------------------------------------------------------------------
// 0. iterativeDisplayElements --> Displays all elements of a MyList
//-------------------------------------------------------------------
/**
* Given a concrete MyList, this iterative algorithm displays its elements by screen (if any).
* @param m: The MyList we want to display its elements.
*/
public void iterativeDisplayElements(MyList<Integer> m){
//-----------------------------
//SET OF OPS
//-----------------------------
//-----------------------------
// I. SCENARIO IDENTIFICATION
//-----------------------------
int scenario = 0;
//Rule 1. MyList is empty
if (m.length() == 0)
scenario = 1;
//Rule 2. MyList is non-empty
else
scenario = 2;
//-----------------------------
// II. SCENARIO IMPLEMENTATION
//-----------------------------
switch(scenario){
//Rule 1. MyList is empty
case 1:
//1. We print the empty message
System.out.println("Empty MyList");
break;
//Rule 2. MyList is non-empty
case 2:
//1. We print the initial message
int size = m.length();
System.out.println("MyList Contains the following " + size + " items: ");
//2. We traverse the items
for (int i = 0; i < size; i++)
System.out.println("Item " + i + ": " + m.getElement(i));
break;
}
}
//-------------------------------------------------------------------
// 1. maxInt --> Computes the maximum item of MyList
//-------------------------------------------------------------------
/**
* The function computes the maximum item of m (-1 if m is empty).
* @param m: The MyList we want to compute its maximum item.
* @return: The maximum item of MyList
*/
public int maxInt(MyList<Integer> m){
if(m.length() == 0)
return -1;
int n = m.getElement(0);
m.removeElement(0);
int num = maxInt(m);
m.addElement(0, n);
return num > n ? num : n;
}
//-------------------------------------------------------------------
// 2. isReverse --> Computes if MyList is sorted in decreasing order
//-------------------------------------------------------------------
/**
* The function computes whether m is sorted in decreasing order or not.
* @param m: The MyList we want to check.
* @return: Whether m is sorted in decreasing order or not.
*/
public boolean isReverse(MyList<Integer> m){
if(m.length()<2)
return true;
int num = m.getElement(0);
int next = m.getElement(1);
boolean isTrue;
if(isTrue = num >= next){
m.removeElement(0);
isTrue = isReverse(m);
m.addElement(0,num);
}
return isTrue;
}
//-------------------------------------------------------------------
// 3. getNumAppearances --> Computes the amount of times that integer appears in MyList
//-------------------------------------------------------------------
/**
* The function computes the amount of times that the integer n appears in m.
* @param m: The MyList we want to use.
* @param n: The number we want to compute its appearances for.
* @return: The amount of appearances of n into m
*/
public int getNumAppearances(MyList<Integer> m, int n){
if(m.length() == 0)
return 0;
int num = m.getElement(0);
m.removeElement(0);
int count = n == num ? getNumAppearances(m,n)+1 : getNumAppearances(m,n);
m.addElement(0,num);
return count ;
}
//-------------------------------------------------------------------
// 4. power --> Computes the m-est power of n
//-------------------------------------------------------------------
/**
* The function computes n to the power of m.
* @param n: The base number.
* @param m: The power of n we want to compute
* @return: n to the power of m.
*/
public int power(int n, int m){
if(m==0)
return 1;
return n * power(n,--m);
}
//-------------------------------------------------------------------
// 5. lucas --> Computes the n-est term of the Lucas series
//-------------------------------------------------------------------
/**
* The function computes the n-est term of the Lucas series
* @param n: The n-est term of the series we want to compute
* @return: The term being computed
*/
public int lucas(int n){
if(n == 0)
return 2;
else if(n == 1)
return 1;
return lucas(n-1) + lucas(n-2);
}
//-------------------------------------------------------------------
// 6. drawImage --> Prints a pattern of a given length
//-------------------------------------------------------------------
/**
* The function prints prints a pattern of a given length.
* *
* **
* ***
* ...
* @param n: The length of the desired pattern
*/
public void drawImage(int n){
if(n>0) {
drawImage(n-1);
String str = "";
for (int i = n; i > 0; i--)
str += "*";
System.out.println(str);
}
}
}
| [
"johnbrady1987@gmail.com"
] | johnbrady1987@gmail.com |
58b041647ea162d9a95c5cc6b151f49a21395bfb | 804556bd90051245a94eefa409d4d4b8210f7fd9 | /Fitness/src/main/java/uk/ac/city/aczg919/fitness/services/ProfileService.java | add420d5a436874ae305783a26b4878f29aa41b6 | [] | no_license | rai-n/Rain-fitness---Java-backend | 9b5cde367d5a90855521a5abe7f1a2d77c4228e6 | 9a8cd679af136c16c3409b783fa8c44cac79f51b | refs/heads/master | 2022-12-04T03:23:17.326114 | 2020-08-12T16:32:33 | 2020-08-12T16:32:33 | 179,690,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | package uk.ac.city.aczg919.fitness.services;
import uk.ac.city.aczg919.fitness.entites.CollatedUser;
/**
* Interface to create the template for Profile Service.
* Returns CollatedUsed
*/
public interface ProfileService {
CollatedUser getProfile(String email);
}
| [
"neeraj.rai@city.ac.uk"
] | neeraj.rai@city.ac.uk |
38cb6ab85e84da7fbe66d3bb40a57d890d298ca0 | 5f1f575c9fd95e6b299cf2c6d8937ba4e7cf84c3 | /core/Path.java | 66ef6723460ec49654c5ad883e05bb4bee81756b | [] | no_license | peprons/Graph-Java | 3203c2b257ae7ef45d66332dad560b3b04151196 | cac174213503a2ddca8bdf4edb8ba592bb593047 | refs/heads/master | 2020-09-27T06:46:33.272175 | 2015-08-09T22:12:25 | 2015-08-09T22:12:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package Graph.core;
import java.util.ArrayList;
import java.util.List;
/**
* A Path is a collection of edges with end of one edge will be start of another edge
* where source of first edge is the start of path
* and end of last edge is destination.
* Created by Nandkishore on 7/23/2015.
*/
public class Path {
private List<Edge> edgeList;
Path() {
this.edgeList = new ArrayList<Edge>();
}
Path(Edge e) {
this.edgeList = new ArrayList<Edge>();
this.edgeList.add(e);
}
public void addEdge(Edge e) {
this.edgeList.add(e);
}
public List<Edge> getEdgeSet() {
return this.edgeList;
}
}
| [
"nandkishore.sharma@rtslabs.com"
] | nandkishore.sharma@rtslabs.com |
957c547285d129e766d8b5c49165e978013ae8d9 | 485e1c2e71523d5d3721dcc35c4db8e489c1ca34 | /src/main/java/kz/akbar/model/Gate.java | 256f6f6c38c67ba48b094f09b8dea95a8e476203 | [] | no_license | alibekus/epam-optional-task3-multithreading | c8d0a83b9141b7b98c031621271d77f01748e2fb | aad1fc9b195c4e204795cec3cb13306aa67e3cd3 | refs/heads/master | 2020-06-04T22:41:08.995676 | 2019-06-16T17:29:54 | 2019-06-16T17:29:54 | 192,218,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package kz.akbar.model;
public class Gate {
private String name;
private GateType type;
public Gate(String name, GateType type) {
this.name = name;
this.type = type;
}
public String getName() {
return name;
}
public GateType getType() {
return type;
}
}
| [
"alibek@akbar.kz"
] | alibek@akbar.kz |
4230dae3743ee1a4b7781eaf2eac4d80dd4e53c2 | 4062807e41c011ffdb29fe10046faa72718fdd5d | /grapheus-model/src/main/java/org/grapheus/client/model/graph/vertex/RVertex.java | 5ceabfccde0ecc9eeecd79ee1ffb3a984c18de2f | [
"MIT"
] | permissive | black32167/grapheus | 11a83e09f63a7fb41d22f4d0b4b9078388ab9c80 | 2380fd4102b24c088e1d224077e3f7f7ad65d4f2 | refs/heads/master | 2022-12-04T11:58:21.849978 | 2019-11-19T10:55:24 | 2019-11-19T10:59:56 | 176,180,456 | 0 | 0 | MIT | 2022-11-15T23:52:17 | 2019-03-18T01:02:52 | Java | UTF-8 | Java | false | false | 1,072 | java | /**
*
*/
package org.grapheus.client.model.graph.vertex;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Singular;
import java.util.List;
/**
* @author black
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RVertex {
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class RProperty {
private String name;
private String value;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class RReference {
@Singular
private List<String> tags;
private boolean reversed;
private String destinationId;
}
private String id;
private String title;
private String description;
private long updateTimeMills; //TODO: convert to 'Long'?
@Singular
private List<RProperty> properties;
@Singular
private List<RReference> references;
@Singular
private List<String> tags;
private String generativeValue;
}
| [
"psgrepjava@gmail.com"
] | psgrepjava@gmail.com |
6fc8242d7abe1c6bd20112e81ef172b0952b8192 | 7a282e1a2d8bbf14420d9649a1a2bfb7a7ca22c2 | /10_learn/1010_javase/jase/src/nolan/util/map/Map001.java | c58ddf98f4a715fdda750c864872011e88f5662a | [] | no_license | Nolan8989/badboy | 07f3cc5438325d9dc64d67b50365da2ec0a4c473 | 8b5df35ba0d94a365c188542fdcc3af54ce3d4b4 | refs/heads/master | 2021-01-21T14:43:09.851854 | 2016-06-24T09:54:44 | 2016-06-24T09:54:44 | 56,908,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,301 | java | package nolan.util.map;
/**
*自定义实现Map的功能!
*暂不完美!
*Map:存放键值对,根据键对象找对应的值对象.键不能重复!
*/
public class Map001 {
SxtEntry[] arr = new SxtEntry[990];
int size;
public void put(Object key,Object value){
SxtEntry e = new SxtEntry(key,value);
//解决键值重复的处理
for(int i=0;i<size;i++){
if(arr[i].key.equals(key)){
arr[i].value=value;
return ;
}
}
arr[size++] = e;
}
public Object get(Object key){
for(int i=0;i<size;i++){
if(arr[i].key.equals(key)){
return arr[i].value;
}
}
return null;
}
public boolean containsKey(Object key){
for(int i=0;i<size;i++){
if(arr[i].key.equals(key)){
return true;
}
}
return false;
}
public boolean containsValue(Object value){
for(int i=0;i<size;i++){
if(arr[i].value.equals(value)){
return true;
}
}
return false;
}
public static void main(String[] args) {
Map001 m = new Map001();
m.put("高1", new Wife("杨幂"));
m.put("高1", new Wife("李四"));
Wife w = (Wife) m.get("高1");
System.out.println(w.name);
}
}
class SxtEntry {
Object key;
Object value;
public SxtEntry(Object key, Object value) {
super();
this.key = key;
this.value = value;
}
} | [
"331639099@qq.com"
] | 331639099@qq.com |
86871a54384aba2ecc0f7b825f3d9b7e3b86a2d1 | 9b5d4bf7a3011956a8ee3cc4b506b7f8b0e2a32e | /src/main/java/com/rhb/common/DefaultInterceptor.java | 576d4b0f8c9ad888e111bf1abc6e15d2a353420e | [] | no_license | 18835572909/proxy-aop-core | 7fb4fc3647400244486be3b140c8a3594bbda8f7 | 9c3940928e1b78f410d26b0a53c9638df7b90867 | refs/heads/master | 2021-07-14T02:14:55.401080 | 2019-08-20T18:34:29 | 2019-08-20T18:34:29 | 203,426,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | package com.rhb.common;
import java.lang.reflect.InvocationTargetException;
/**
* @author renhuibo 2019-08-19 23:21:57
* @Description : 自定拦截器实现类
*/
public class DefaultInterceptor implements Interceptor {
@Override
public void before() {
System.out.println("before...");
}
@Override
public void after() {
System.out.println("after...");
}
@Override
public Object around(Invocation invocation) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
System.out.println("around before...");
Object target = invocation.proceed();
System.out.println("around after...");
return target;
}
@Override
public boolean userAround() {
return true;
}
@Override
public void afterReturning() {
System.out.println("afterReturning...");
}
@Override
public void afterThrowing() {
System.out.println("afterThrowing...");
}
}
| [
"m18835572909@163.com"
] | m18835572909@163.com |
a610b775948c861e91bfd94ca95eabca1a4630b1 | 7fb64dfb403d256cce9cd840d8e13d933d0bfdf7 | /Lista00/src/Programacao/Exe09.java | 868e92c446af51a2c31f751b13602d79a8bbeb87 | [] | no_license | luizcojr/aulas-java-ads-2periodo | b54871cc01cffcb950214a0a2877a4334b5f6b00 | 1a14399dcfe7972b0be9cd26acf2e3ed2d82e7b7 | refs/heads/master | 2020-04-02T15:38:56.245284 | 2018-11-01T02:55:44 | 2018-11-01T02:55:44 | 154,576,827 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 527 | java | package Programacao;
import java.util.Scanner;
public class Exe09 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
double n1, n2, media;
System.out.println("\nDigite primeiro número real.");
n1 = s.nextDouble();
System.out.println("\nDigite segundo número real.");
n2 = s.nextDouble();
media = (n1+n2)/2;
System.out.printf("Média: " + media);
s.close();
}
}
| [
"39304305+luizcojr@users.noreply.github.com"
] | 39304305+luizcojr@users.noreply.github.com |
fae541c00508a11642d725a71701b10c9abd9412 | a57b3be7957c890cd03b5d89ad4b5c5b7805a48a | /.svn/pristine/b0/b00736729cc08c149f19b822ab28a7e03c9d320c.svn-base | 25cf7bc72b497fb83824383dcde9c10817f42d11 | [] | no_license | faikturan/PharmaRetail | a23bc055feb1ec07f15b94abaa306d92a2a0e064 | b782fc72051edf2885830c109ea27e261b07e3c6 | refs/heads/master | 2022-01-09T22:39:06.162476 | 2018-08-27T17:41:04 | 2018-08-27T17:41:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,912 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.hyva.posretail.pos.posEntities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author vijeesh.m
*/
@Entity
public class Msiccode implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
@GenericGenerator(name = "native", strategy = "native")
private Long mscid;
private String code;
@Column(length = 2024)
private String description;
private String locationId;
private String useraccount_id;
private String status;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Msiccode() {
}
public Msiccode(String code, String description, String status) {
this.code = code;
this.description = description;
this.status=status;
}
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public String getUseraccount_id() {
return useraccount_id;
}
public void setUseraccount_id(String useraccount_id) {
this.useraccount_id = useraccount_id;
}
public Long getMscid() {
return mscid;
}
public void setMscid(Long mscid) {
this.mscid = mscid;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"ksourav796.sk@gmail.com"
] | ksourav796.sk@gmail.com | |
837b08dd89422fac8281c214c1a1df283c727406 | 50fe5cf9843fefb5247359256b7456ece9f7ba6b | /app/src/main/java/com/weebly/httplexiconindustries/ru/HelperPackage/GridAdapter.java | 7254dd655c5ccf700623d8959c3e5fb9a98d72d0 | [] | no_license | TevinScott/RULibraryLite | 1c3d4d79846e01ed86155d89e0b9f3230450913e | abd7df7c94a6fdd58a4c66d3aac28e362624f464 | refs/heads/master | 2021-06-08T13:46:00.890815 | 2016-12-05T23:22:05 | 2016-12-05T23:22:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,371 | java | package com.weebly.httplexiconindustries.ru.HelperPackage;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.weebly.httplexiconindustries.ru.ContentParsing.BookResult;
import java.util.LinkedList;
import ActivityPackages.R;
/**
* Created by Scotty on 12/3/16.
*/
public class GridAdapter extends BaseAdapter {
private Context mContext;
private LinkedList<BookResult> books;
final int mCount;
/**
* Default constructor
* @param c: specifies the Activity in which the grid is being created
* @param _books: the list of books in which the grid will use to fill the grid elements
*/
public GridAdapter(Context c, LinkedList<BookResult> _books ) {
mContext = c;
books = _books;
mCount = books.size();
/*
mImageItems = new ArrayList<String>(mCount);
// for small size of items it's ok to do it here, sync way
for (String item : items) {
// get separate string parts, divided by ,
final String[] parts = item.split(",");
// remove spaces from parts
for (String part : parts) {
part.replace(" ", "");
mImageItems.add(part);
}
}
*/
}
/**
* used to set the image and text using the data stored in the booklist object
* book list object consists of two attributes String imgURL && name. picasso library used
* to parse Image from the web
* @param position used to determine the specific grid item
* @param convertView
* @param parent parent group being the entire grid
* @return returns a view which is the grid element once its
* elements have been added (name & picasso image from the imgURL)!
*/
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
View grid;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
grid = inflater.inflate(R.layout.gird_single, null);
}
else{ grid = (View) convertView; }
TextView textView = (TextView) grid.findViewById(R.id.grid_text);
ImageView imageView = (ImageView)grid.findViewById(R.id.grid_image);
textView.setText(books.get(position).getName());
System.out.println("Position: " + position + " " + books.get(position).getName());
Picasso.with(mContext).load(books.get(position).getImgURL()).into(imageView);
return grid;
}
/**
* required methods below
*/
@Override
public int getCount() {
return mCount;
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(final int position) {
return position;
}
}
| [
"Scotty@Tevins-MacBook-Pro.local"
] | Scotty@Tevins-MacBook-Pro.local |
42ae6b40623e39e158560c1cddc05104bf474957 | 70e14ca73c0da135faa3b9d993efb53225e7fdf7 | /javaSE/src/main/java/com/zhangyi/se/Test1.java | 545c7c6114c84ea767963b65861bb875138a8229 | [] | no_license | small-little-time/MyStudy | 76cfb1b8c2d031988cdd7e335a2b1608a7e824a6 | 5f24fe00d1bbfd2ebb6bf0e883e254a1d2ccba3f | refs/heads/master | 2023-09-05T19:33:41.225778 | 2021-11-15T07:26:54 | 2021-11-15T07:26:54 | 398,823,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package com.zhangyi.se;
import java.util.ArrayList;
import java.util.List;
/**
* @author ZhangYi zhangyi04@zhuanzhuan.com
* @date 2021/8/25 14:54
*/
public class Test1 {
public static void main(String[] args) {
String jdbcUrl = "jdbc:mysql://test16814.db.zhuaninc.com:23752/dbzz_sc_oms?useUnicode=true&characterEncoding=utf8";
final String url = jdbcUrl.toLowerCase();
System.out.println(url.contains(":" + "mysql" + ":"));
}
}
| [
"zhangyi04@zhuanzhuan.com"
] | zhangyi04@zhuanzhuan.com |
91f97c5b00f0a8755ac2eb4099a7a143ed19c690 | 45e1a000d745d7ea63f8d69976ce013da948adff | /src/test/parser/grammar/TestParser.java | 33eb62ca081356a4ca0d7f7035248798ea4f05de | [] | no_license | lucas-roman/Trabalho_Formais | cd07505157eb8f9b453ce0f3bd59036cc28c13a6 | 31b7074a1262da7971a004af55ee08b468ab8828 | refs/heads/master | 2021-01-10T07:37:19.888723 | 2015-11-29T21:07:41 | 2015-11-29T21:07:41 | 43,334,691 | 1 | 0 | null | 2015-10-02T02:13:33 | 2015-09-29T00:19:24 | Java | UTF-8 | Java | false | false | 1,609 | java | package test.parser.grammar;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import main.analyzer.Control;
import main.fileio.exceptions.IllegalOrderOfTextStructure;
import main.fileio.exceptions.IllegalStartOfText;
import main.fileio.exceptions.IllegalStructureOfText;
import main.lexer.automata.exceptions.DeterministicException;
import main.lexer.automata.exceptions.IllegalAutomataException;
import main.lexer.automata.exceptions.InitialStateMissingException;
import main.lexer.automata.exceptions.InvalidStateException;
import main.lexer.automata.exceptions.MissingStateException;
import main.lexer.regularexpression.exceptions.IllegalRegularExpressionException;
import main.parser.grammar.exceptions.InvalidSentenceException;
import main.parser.grammar.exceptions.NonDeterministicGrammarException;
import main.parser.grammar.exceptions.NotLLLanguageException;
import main.parser.grammar.exceptions.TerminalMissingException;
import org.junit.Test;
public class TestParser {
@Test
public void testParser() throws FileNotFoundException,
IllegalStructureOfText, UnsupportedEncodingException,
IllegalRegularExpressionException, MissingStateException,
InvalidStateException, InitialStateMissingException,
IllegalAutomataException, DeterministicException,
IllegalStartOfText, IllegalOrderOfTextStructure,
NotLLLanguageException, NonDeterministicGrammarException,
TerminalMissingException, InvalidSentenceException {
Control control = new Control("numbers/lex", "numbers/parse");
System.out.println(control.analyze("numbers/numberexp"));
}
}
| [
"lu_roman@hotmail.com"
] | lu_roman@hotmail.com |
eba64e43d961d2e9ab80a79c431e8311476d1375 | 2048082bb13fd86a72928eefc15bf2302f039ff5 | /spring-33/src/main/java/ru/otus/spring/controller/CommentController.java | 92f963fb57ad23177e474890ac381800a442b77d | [] | no_license | EvgeniyShipov/spring | da22a81a7bf67f8d7570ae1015e7f51339e26879 | e0c4b93603cf17ad8fd74b95c9b9d16e1f04f461 | refs/heads/master | 2023-01-23T04:42:41.829707 | 2020-05-29T17:39:08 | 2020-05-29T17:39:08 | 224,481,914 | 1 | 0 | null | 2023-01-05T08:47:55 | 2019-11-27T17:19:53 | Java | UTF-8 | Java | false | false | 3,013 | java | package ru.otus.spring.controller;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import lombok.RequiredArgsConstructor;
import lombok.extern.java.Log;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import ru.otus.spring.domain.Book;
import ru.otus.spring.domain.Comment;
import ru.otus.spring.service.LibraryService;
import java.util.List;
@Log
@Controller
@RequiredArgsConstructor
public class CommentController {
private final LibraryService service;
@GetMapping("comments")
@HystrixCommand(groupKey = "Comments", commandKey = "GetAllComments")
public String getAllComments(Model model) {
List<Comment> comments = service.getAllComments();
model.addAttribute("comments", comments);
return "comments";
}
@GetMapping("comments/{id}")
@HystrixCommand(groupKey = "Comments", commandKey = "GetComment")
public String getComment(@PathVariable long id, Model model) {
Comment comment = service.getComment(id);
model.addAttribute("comment", comment);
return "comment";
}
@GetMapping("comments/create")
@HystrixCommand(groupKey = "Comments", commandKey = "CreateComment")
public String createComment(Comment comment, Model model) {
List<Book> books = service.getAllBooks();
model.addAttribute("books", books);
return "comment_new";
}
@PostMapping("comments/create")
@HystrixCommand(groupKey = "Comments", commandKey = "CreatedComment")
public String createComment(String message, long book, Model model) {
Comment comment = service.createComment(message, book);
log.info("Добавлен новый комментарий: " + comment.getMessage());
model.addAttribute("comments", service.getAllComments());
return "redirect:/comments";
}
@PostMapping("comments/update/{id}")
@HystrixCommand(groupKey = "Comments", commandKey = "UpdateComment")
public String updateComment(@PathVariable long id, String message, Model model) {
Comment comment = service.getComment(id);
comment.setMessage(message);
service.updateComment(comment);
log.info("Комментарий изменен: " + comment.getMessage());
model.addAttribute("comments", service.getAllComments());
return "redirect:/comments";
}
@PostMapping("comments/delete/{id}")
@HystrixCommand(groupKey = "Comments", commandKey = "DeleteComment")
public String deleteComment(@PathVariable long id, Model model) {
Comment comment = service.deleteComment(id);
log.warning("Комментарий удален: " + comment.getMessage());
model.addAttribute("comments", service.getAllComments());
return "redirect:/comments";
}
}
| [
"Shipov.foto@mail.ru"
] | Shipov.foto@mail.ru |
11dc5f415e2bc01cee074e638e9f9381a18fdc1a | b3ef80183f8208b7bf5c2ba3cb4512ed66e0dc04 | /app/src/main/java/com/example/android/medistats/UserHistory.java | ab9367a1af91b43ae9760ff5fb27ec98a677b5fa | [] | no_license | shubhdhingra/Medistats | ad2b75f01795a15fb51c1be72ee7378d6536a10c | 6f947604c35fd8ab86bb7a12b827a6e8ba86c051 | refs/heads/master | 2021-07-05T19:38:12.294867 | 2017-09-29T19:03:25 | 2017-09-29T19:03:25 | 105,274,039 | 0 | 0 | null | 2017-09-29T13:15:50 | 2017-09-29T13:15:50 | null | UTF-8 | Java | false | false | 1,085 | java | package com.example.android.medistats;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
public class UserHistory extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.user_history);
ImageView backbtn = (ImageView) findViewById(R.id.hist_backbtn);
backbtn.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent(UserHistory.this,UserHome.class);
startActivity(intent);
finish();
}
});
}
@Override
public void onBackPressed()
{
Intent intent = new Intent(UserHistory.this,UserHome.class);
startActivity(intent);
finish();
}
@Override
protected void onDestroy()
{
super.onDestroy();
}
}
| [
"bharat.159753@gmail.com"
] | bharat.159753@gmail.com |
23aa30794772f152372a8503753376406e3f4a85 | be03e6cbbef14ce5646c094f2cfdd9e6725bb36b | /src/com/arch/guicommands/Menu/Item.java | 7c54b9c210c7bec6134ba1943cce0a52ab982883 | [
"MIT"
] | permissive | minster586/GUICommands | b5976539678d00350b7c73683c49d0dfb1ba9d38 | 2d9fe59d39f00adbc0dc1072c9b004a04a70761a | refs/heads/master | 2020-07-10T20:28:25.157898 | 2018-07-18T02:10:14 | 2018-07-18T02:10:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,850 | java | package com.arch.guicommands.Menu;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.material.MaterialData;
import java.util.ArrayList;
import java.util.List;
public class Item {
private Material _Material;//Mc Mat
private short Data;//data of Mat
private int Amount;//number of mats to show
private int Slot;//which GUI slot to put item in
private String DisplayName;//display name of item in GUI
private List<String> Lore;//lore of item in GUI.
private List<String> Commands;//which commands to run on item click
public int getAmount() {
return Amount;
}
public short getData() {
return Data;
}
public Material getMaterial() {
return _Material;
}
public void setData(short data) {
Data = data;
}
public void setAmount(int amount) {
Amount = amount;
}
public void setMaterial(Material material) {
_Material = material;
}
public List<String> getCommands() {
return Commands;
}
public int getSlot() {
return Slot;
}
public List<String> getLore() {
return Lore;
}
public void setSlot(int slot) {
Slot = slot;
}
public String getDisplayName() {
return DisplayName;
}
public void setCommands(List<String> commands) {
Commands = commands;
}
public void setDisplayName(String displayName) {
DisplayName = displayName;
}
public void setLore(List<String> lore) {
Lore = lore;
}
/* populates this from config*/
public boolean formatItem(FileConfiguration localConfig, String key) {
//populate material
String matName = localConfig.getString(key + ".material").toUpperCase();
_Material = Material.matchMaterial(matName);
if (_Material == null) {
//material does not exist
return false;
}
//set material data
Data = (short) localConfig.getInt(key + ".data");
//get amount
Amount = localConfig.getInt(key + ".amount");
//get slot number
Slot = localConfig.getInt(key + ".slot");
//get display name
DisplayName = ChatColor.translateAlternateColorCodes(
'&',
localConfig.getString(key + ".display_name")
);
//get lore
Lore = new ArrayList<String>();
String[] loreList = localConfig.getStringList(key + ".lore").toArray(new String[0]);
for (int i = 0; i < loreList.length; i++) {
Lore.add(ChatColor.translateAlternateColorCodes('&', loreList[i]));
}
//get commands - player
Commands = localConfig.getStringList(key + ".commands");
return true;
}
}
| [
"unconfigured@null.spigotmc.org"
] | unconfigured@null.spigotmc.org |
3930d9c65318673392f6edfd0f0fd80f4c42c065 | eed61d7a5a590d543fa9e2c6ab434c5535f57711 | /samples/UserPreference/src/com/amazon/aws/tvmclient/AmazonClientManager.java | 8f1933e6b2da99b6b47b2d3f5edf768447099e6e | [
"JSON",
"Apache-2.0"
] | permissive | sajishtr/aws-sdk-for-android | 9ee733ded1dfed6ca34a21f9fd51050f050b0d4c | 78197e49e787c456644aaa2bbf04ccd40a715853 | refs/heads/master | 2021-01-17T06:21:28.551725 | 2012-06-27T01:19:08 | 2012-06-27T01:19:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,483 | java | /*
* Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazon.aws.tvmclient;
import android.content.SharedPreferences;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.services.dynamodb.AmazonDynamoDBClient;
import android.util.Log;
/**
* This class is used to get clients to the various AWS services. Before accessing a client the credentials should be checked to ensure validity.
*/
public class AmazonClientManager {
private static final String LOG_TAG = "AmazonClientManager";
private AmazonDynamoDBClient ddb = null;
private SharedPreferences sharedPreferences = null;
public AmazonClientManager( SharedPreferences settings ) {
this.sharedPreferences = settings;
}
public AmazonDynamoDBClient ddb() {
validateCredentials();
return ddb;
}
public boolean hasCredentials() {
return PropertyLoader.getInstance().hasCredentials();
}
public Response validateCredentials() {
Response ableToGetToken = Response.SUCCESSFUL;
if ( AmazonSharedPreferencesWrapper.areCredentialsExpired( this.sharedPreferences ) ) {
Log.i( LOG_TAG, "Credentials were expired." );
clearCredentials();
AmazonTVMClient tvm = new AmazonTVMClient( this.sharedPreferences, PropertyLoader.getInstance().getTokenVendingMachineURL(), PropertyLoader.getInstance().useSSL() );
ableToGetToken = tvm.anonymousRegister();
if ( ableToGetToken.requestWasSuccessful() ) {
ableToGetToken = tvm.getToken();
}
}
if ( ableToGetToken.requestWasSuccessful() && ddb == null ) {
Log.i( LOG_TAG, "Creating New Credentials." );
AWSCredentials credentials = AmazonSharedPreferencesWrapper.getCredentialsFromSharedPreferences( this.sharedPreferences );
ddb = new AmazonDynamoDBClient( credentials );
}
return ableToGetToken;
}
public void clearCredentials() {
ddb = null;
}
public void wipe() {
AmazonSharedPreferencesWrapper.wipe( this.sharedPreferences );
}
}
| [
"aws-dr-tools@amazon.com"
] | aws-dr-tools@amazon.com |
fec63fea212051ae3e9885f75b132581c2545f25 | 2696b09417f4038e1206334d47821807ba5d76f7 | /Simulator/src/main/java/ui/modelproperties/TransporterDistancesTableModel.java | 9c2cba6d0b864e2ccd0e6efee0e70883a88de4be | [
"Apache-2.0",
"LGPL-3.0-only",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause",
"CC-BY-4.0",
"CC0-1.0",
"CC-BY-3.0",
"CDDL-1.1",
"CC-BY-NC-4.0",
"LGPL-2.1-only",
"CC-BY-NC-SA-4.0",
"EPL-2.0",
"JSON",
"CDDL-1.0",
"MIT",
"LGPL-2.0-or-later",
"Zlib",
"MPL-2.0",
"Classpath-... | permissive | A-Herzog/Warteschlangensimulator | d62b39ae58006da5dff497cf993de40f35f0a79b | ea5f804f8d9425c30c0eb666bfee2c96f93e111a | refs/heads/master | 2023-09-01T08:50:54.103199 | 2023-08-31T23:56:23 | 2023-08-31T23:56:23 | 253,913,348 | 31 | 7 | Apache-2.0 | 2023-07-07T22:09:19 | 2020-04-07T21:13:47 | Java | ISO-8859-1 | Java | false | false | 15,390 | java | /**
* Copyright 2020 Alexander Herzog
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ui.modelproperties;
import java.awt.Component;
import java.awt.HeadlessException;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableCellEditor;
import language.Language;
import mathtools.NumberTools;
import mathtools.Table;
import systemtools.BaseDialog;
import systemtools.MsgBox;
import ui.modeleditor.ModelSurface;
import ui.modeleditor.ModelTransporter;
import ui.modeleditor.coreelements.ModelElement;
import ui.modeleditor.coreelements.ModelElementBox;
import ui.modeleditor.elements.ModelElementSub;
import ui.modeleditor.elements.ModelElementTransportDestination;
import ui.modeleditor.elements.ModelElementTransportParking;
import ui.modeleditor.elements.ModelElementTransportTransporterSource;
/**
* Tabellenmodelle zur Festlegung der Entfernungen der Stationen
* aus Sicht eines Transporters
* @author Alexander Herzog
* @see TransporterTableModelDialog
*/
public class TransporterDistancesTableModel extends AbstractTableModel {
/**
* Serialisierungs-ID der Klasse
* @see Serializable
*/
private static final long serialVersionUID = -8770320675401142234L;
/** Übergeordnetes Element (zur Platzierung von Dialogen) */
private final Component owner;
/** Zu diesem Tabellenmodell gehörige Tabelle */
private final JTable table;
/** Transporter-Objekt aus dem die Anzahl-Werte ausgelesen werden sollen und in das sie später ggf. zurückgeschrieben werden sollen */
private final ModelTransporter transporter;
/** Modellelemente für die Stationen */
private final List<ModelElementBox> stationElements;
/** Namen der Stationen */
private final List<String> stations;
/** Ausführliche Namen der Stationen */
private final List<String> stationsLong;
/** Entfernungen zwischen den Stationen */
private final String[][] distances;
/** Nur-Lese-Status */
private final boolean readOnly;
/** Hilfe-Runnable */
private final Runnable help;
/**
* Konstruktor der Klasse
* @param owner Übergeordnetes Element (zur Platzierung von Dialogen)
* @param table Zu diesem Tabellenmodell gehörige Tabelle
* @param transporter Transporter-Objekt aus dem die Anzahl-Werte ausgelesen werden sollen und in das sie später ggf. zurückgeschrieben werden sollen
* @param surface Zeichenfläche (zur Ermittlung der Namen der Stationen)
* @param readOnly Nur-Lese-Status
* @param help Hilfe-Runnable
*/
public TransporterDistancesTableModel(final Component owner, final JTable table, final ModelTransporter transporter, final ModelSurface surface, final boolean readOnly, final Runnable help) {
super();
this.owner=owner;
this.table=table;
this.transporter=transporter;
this.readOnly=readOnly;
this.help=help;
/* Liste der Stationen zusammenstellen */
stations=new ArrayList<>();
stationsLong=new ArrayList<>();
stationElements=new ArrayList<>();
for (ModelElement element: surface.getElements()) {
if (element instanceof ModelElementSub) for (ModelElement element2: ((ModelElementSub)element).getSubSurface().getElements()) {
addStation(element2,element);
}
addStation(element,null);
}
distances=new String[this.stations.size()][this.stations.size()];
for (int i=0;i<distances.length;i++) {
distances[i]=new String[this.stations.size()];
Arrays.fill(distances[i],"0");
}
/* Daten aus Transporter-Objekt auslesen */
for (Map.Entry<String,Map<String,Double>> entryA: transporter.getDistances().entrySet()) {
final String stationA=entryA.getKey();
for (Map.Entry<String,Double> entryB: entryA.getValue().entrySet()) {
final String stationB=entryB.getKey();
final double distance=entryB.getValue().doubleValue();
final int indexA=stations.indexOf(stationA);
final int indexB=stations.indexOf(stationB);
if (indexA>=0 && indexB>=0) distances[indexA][indexB]=NumberTools.formatNumber(distance);
}
}
}
/**
* Aktualisiert die Tabellendarstellung
*/
private void updateTable() {
fireTableDataChanged();
TableCellEditor cellEditor=table.getCellEditor();
if (cellEditor!=null) cellEditor.stopCellEditing();
}
/**
* Fügt eine Station zu den Stationslisten hinzu
* @param element Stationselement
* @param parent Elternelement, wenn sich die Station nicht auf der Hauptebene befindet
* @see #stationElements
* @see #stations
* @see #stationsLong
*/
private void addStation(final ModelElement element, final ModelElement parent) {
if ((element instanceof ModelElementTransportTransporterSource) || (element instanceof ModelElementTransportParking) || (element instanceof ModelElementTransportDestination)) {
final String name=element.getName();
if (!name.isEmpty()) {
stations.add(name);
if (parent!=null) {
String parentName=parent.getName().trim();
if (parentName.isEmpty() && parent instanceof ModelElementBox) parentName=((ModelElementBox)parent).getTypeName();
stationsLong.add(name+" (id="+element.getId()+") in "+parentName+" (id="+parent.getId()+")");
} else {
stationsLong.add(name+" (id="+element.getId()+")");
}
stationElements.add((ModelElementBox)element);
}
}
}
@Override
public int getRowCount() {
return distances.length;
}
@Override
public int getColumnCount() {
return 1+distances.length;
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return columnIndex>0 && !readOnly && rowIndex!=columnIndex-1;
}
@Override
public String getColumnName(int column) {
if (column==0) return Language.tr("Transporters.Group.Edit.Dialog.Distances.Label");
return stationsLong.get(column-1);
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex==0) return stationsLong.get(rowIndex);
if (rowIndex==columnIndex-1) return "-";
return distances[rowIndex][columnIndex-1];
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if (columnIndex==0) return;
distances[rowIndex][columnIndex-1]=(String)aValue;
}
/**
* Überprüft die Eingaben
* @param showErrorMessage Wird hier <code>true</code> übergeben, so wird im Fehlerfall eine Fehlermeldung ausgegeben
* @return Gibt <code>true</code> zurück, wenn die Eingaben in Ordnung sind
*/
public boolean checkInput(final boolean showErrorMessage) {
for (int i=0;i<distances.length;i++) for (int j=0;j<distances[i].length;j++) {
if (i==j) continue;
final Double D=NumberTools.getNotNegativeDouble(distances[i][j]);
if (D==null) {
if (showErrorMessage) MsgBox.error(owner,Language.tr("Transporters.Group.Edit.Dialog.Distances.ErrorTitle"),String.format(Language.tr("Transporters.Group.Edit.Dialog.Distances.ErrorInfo"),stationsLong.get(i),stationsLong.get(j),distances[i][j]));
return false;
}
}
return true;
}
/**
* Schreibt die Einstellungen in das im Konstruktor übergebene Transporter-Objekt zurück.
*/
public void storeData() {
transporter.getDistances().clear();
for (int i=0;i<distances.length;i++) for (int j=0;j<distances[i].length;j++) {
if (i==j) continue;
final Double D=NumberTools.getNotNegativeDouble(distances[i][j]);
if (D!=null) transporter.setDistance(stations.get(i),stations.get(j),D.doubleValue());
}
}
/**
* Kopiert die rechte obere in die linke untere Hälfte der Tabelle
*/
public void fillDown() {
if (distances.length<2 || readOnly) return;
for (int i=0;i<distances.length-1;i++) for (int j=i+1;j<distances.length;j++) distances[j][i]=distances[i][j];
updateTable();
}
/**
* Kopiert die linke untere in die rechts obere Hälfte der Tabelle
*/
public void fillUp() {
if (distances.length<2 || readOnly) return;
for (int i=0;i<distances.length-1;i++) for (int j=i+1;j<distances.length;j++) distances[i][j]=distances[j][i];
updateTable();
}
/**
* Ermittelt das Untermodell-Element das ein konkretes Unterelement enthält
* @param surface Haupt-Zeichenfläche
* @param child Unterelement
* @return Zugehöriges Untermodell-Element
* @see #getModelDistance(ModelSurface, ModelElementBox, ModelElementBox)
*/
private ModelElementSub getParentStation(final ModelSurface surface, final ModelElementBox child) {
for (ModelElement element: surface.getElements()) if (element instanceof ModelElementSub) {
for (ModelElement element2: ((ModelElementSub)element).getSubSurface().getElements()) if (element2==child) return (ModelElementSub)element;
}
return null; /* Nicht gefunden */
}
/**
* Berechnet den Abstand von zwei Station auf der Zeichenfläche
* @param surface Zeichenfläche
* @param station1 Erste Station
* @param station2 Zweite Station
* @return Abstand auf der Zeichenfläche
* @see #getModelDistances(ModelSurface)
*/
private int getModelDistance(final ModelSurface surface, ModelElementBox station1, ModelElementBox station2) {
if (station1.getSurface()!=station2.getSurface()) {
/* Elemente sind auf verschiedenen Modell-Ebenen, beide auf Hauptebene projizieren */
if (station1.getSurface().getParentSurface()!=null) station1=getParentStation(surface,station1);
if (station2.getSurface().getParentSurface()!=null) station2=getParentStation(surface,station2);
}
if (station1==null || station2==null) return 0;
final Point p1=station1.getMiddlePosition(true);
final Point p2=station2.getMiddlePosition(true);
final int x=p1.x-p2.x;
final int y=p1.y-p2.y;
return (int)Math.round(Math.sqrt(x*x+y*y));
}
/**
* Leitet aus dem Modell die Entfernungen ab
* @param surface Zeichenfläche
* @return Array mit den Entfernungen zwischen den Stationen
*/
private int[][] getModelDistances(final ModelSurface surface) {
final int[][] modelDistances=new int[stationElements.size()][];
for (int i=0;i<stationElements.size();i++) {
modelDistances[i]=new int[stationElements.size()];
for (int j=0;j<stationElements.size();j++) {
if (i==j) modelDistances[i][j]=0; else {
if (j<i) modelDistances[i][j]=modelDistances[j][i]; else modelDistances[i][j]=getModelDistance(surface,stationElements.get(i),stationElements.get(j));
}
}
}
return modelDistances;
}
/**
* Legt die Transporter-Enfernungen gemäß den Abständen der Stationen auf der Zeichenfläche fest
* @param surface Haupt-Zeichenfläche
* @param minDistance Minimal zu verwendende Entfernung
* @param maxDistance Maximal zu verwendende Entfernung
* @see #getModelDistances(ModelSurface)
*/
private void fillByModel(final ModelSurface surface, final double minDistance, final double maxDistance) {
/* Abstände im Modell bestimmen */
final int[][] modelDistances=getModelDistances(surface);
/* Minimum/Maximum für Skalierung berechnen */
double min=Double.MAX_VALUE;
double max=0;
for (int i=0;i<modelDistances.length-1;i++) for (int j=i+1;j<modelDistances.length;j++) if (i!=j) {
double d=modelDistances[i][j];
if (d>max) max=d;
if (d<min) min=d;
}
/* Transporter-Abstände berechnen */
for (int i=0;i<distances.length;i++) for (int j=0;j<distances.length;j++) if (i!=j) {
double d=modelDistances[i][j];
if (max==min) {
d=(maxDistance-minDistance)/2; /* Nur ein Abstand. */
} else {
d=(d-min)/(max-min)*(maxDistance-minDistance)+minDistance;
}
if (maxDistance-minDistance>=20) {
distances[i][j]=""+Math.round(d);
} else {
distances[i][j]=NumberTools.formatNumber(d);
}
}
updateTable();
}
/**
* Belegt die Entfernungentabelle initial mit Abständen basierend auf den Abständen der Stationen auf der Zeichenfläche
* @param surface Zeichenfläche aus der die Abstände der Stationen ausgelesen werden sollen
*/
public void fillByModel(final ModelSurface surface) {
final TransporterDistancesTableModelScaleDialog dialog=new TransporterDistancesTableModelScaleDialog(owner,help);
if (dialog.getClosedBy()==BaseDialog.CLOSED_BY_OK) {
fillByModel(surface,dialog.getMinDistance(),dialog.getMaxDistance());
}
}
/**
* Kopiert die Daten als Tabelle in die Zwischenablage
*/
public void copyToClipboard() {
final StringBuilder sb=new StringBuilder();
final String[] line=new String[getColumnCount()];
for (int i=0;i<line.length;i++) {
if (i>0) sb.append('\t');
sb.append(getColumnName(i));
}
sb.append('\n');
for (int i=0;i<getRowCount();i++) {
for (int j=0;j<line.length;j++) {
if (j>0) sb.append('\t');
sb.append(getValueAt(i,j).toString());
}
sb.append('\n');
}
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(sb.toString()),null);
}
/**
* Versucht die Daten aus der Zwischenablage in das Tabellenobjekt zu kopieren
* @return Gibt an, ob die Daten geladen werden konnten
*/
public boolean pasteFromClipboard() {
/* Text aus Zwischenablage laden */
String data=null;
try {
data=(String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
} catch (HeadlessException | UnsupportedFlavorException | IOException e) {return false;}
if (data==null || data.isEmpty()) return false;
/* Tabelle aufbauen und prüfen */
final Table table=new Table();
table.load(data);
if (table.getSize(0)!=table.getSize(1)) {
MsgBox.error(owner,Language.tr("Transporters.Group.Edit.Dialog.Distances.Paste.ErrorTitle"),Language.tr("Transporters.Group.Edit.Dialog.Distances.Paste.ErrorTableNotSquare"));
return false;
}
if (table.getSize(0)!=distances.length && table.getSize(0)!=distances.length+1) {
MsgBox.error(owner,Language.tr("Transporters.Group.Edit.Dialog.Distances.Paste.ErrorTitle"),String.format(Language.tr("Transporters.Group.Edit.Dialog.Distances.Paste.ErrorTableSize"),distances.length,distances.length,distances.length+1,distances.length+1));
return false;
}
/* Daten in TableModel laden */
final boolean hasHeadings=(table.getSize(0)==distances.length+1);
for (int i=0;i<distances.length;i++) for (int j=0;j<distances.length;j++) if (i!=j) {
distances[i][j]=table.getValue(hasHeadings?(i+1):i,hasHeadings?(j+1):j);
}
updateTable();
return true;
}
} | [
"alexander.herzog@gmx.de"
] | alexander.herzog@gmx.de |
cc64af32c91b89bb43c68dc3c409623167c7ede7 | b166b0bf631bdb787bfeaa671328ce38330ad7b8 | /src/main/java/com/nt/MvcBoot31LoginAppApplication.java | efc673a2f82b4597f3b1989ae3f589d32463e56b | [] | no_license | amruthapparaju/sample | f88750089726d5e3c33ed1b4b2c38f2e34915a9a | e34d038cc7ef7d1b15a572e25fe0bb190aa33f7e | refs/heads/master | 2022-09-29T03:58:24.447710 | 2020-06-07T17:21:28 | 2020-06-07T17:21:28 | 270,378,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.nt;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MvcBoot31LoginAppApplication {
public static void main(String[] args) {
SpringApplication.run(MvcBoot31LoginAppApplication.class, args);
}
}
| [
"apparaju.147@gmail.com"
] | apparaju.147@gmail.com |
3e2775b048eab050766767f5096e1038182a8407 | ca030864a3a1c24be6b9d1802c2353da4ca0d441 | /classes6.dex_source_from_JADX/com/facebook/photos/galleryutil/PhotoGalleryConstants.java | 280a9244e2d37f4dad874a89c02081295fe38405 | [] | no_license | pxson001/facebook-app | 87aa51e29195eeaae69adeb30219547f83a5b7b1 | 640630f078980f9818049625ebc42569c67c69f7 | refs/heads/master | 2020-04-07T20:36:45.758523 | 2018-03-07T09:04:57 | 2018-03-07T09:04:57 | 124,208,458 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 114 | java | package com.facebook.photos.galleryutil;
/* compiled from: high_school */
public class PhotoGalleryConstants {
}
| [
"son.pham@jmango360.com"
] | son.pham@jmango360.com |
b555242e6c435d8f517d1a55dd507fce1e896c04 | a27c05b162565a0df805a2f6072122286ff9a6f5 | /src/pboif2/pkg10116374/latihan62/livingthing/Human.java | ac4ef26db8ceb1342fd26847af3eeb5ee241adf0 | [] | no_license | mortdecai40/PBOIF2-10116374-Latihan62-LivingThing | d59adc26d024011c6f006600ac3b6c0a36d136b8 | 404f4e4b5bccd35120e9ca8d7f214d2b5ea5e576 | refs/heads/main | 2023-01-19T21:09:43.642445 | 2020-11-25T08:01:06 | 2020-11-25T08:01:06 | 315,349,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 574 | 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 pboif2.pkg10116374.latihan62.livingthing;
/**
*
* @author Acromyrmex
*/
class Human extends LivingThing{
private String nama;
public String getNama() {
return nama;
}
public void setNama(String nama) {
this.nama = nama;
}
@Override
public void walk(String nama){
System.out.println(nama + " Sedang Berjalan");
}
}
| [
"rizkinabil.999@gmail.com"
] | rizkinabil.999@gmail.com |
8abcd6406550f8f6b55cddfce9b64c6433d37535 | 01a0d7c33d97701e179d7982e4e3dde6d49fe6e2 | /src/lesson35/repository/RoomRepository.java | 32bc7ba42eb7ee785c742d9a606da096889fd681 | [] | no_license | fatal200190/java-core-grom | c194b69ebe6f279aef34e357cf40ee9162120667 | 18a3c2c266f447084fcbc8775f5448fc03af4368 | refs/heads/master | 2021-09-08T15:23:21.885996 | 2018-03-10T16:19:34 | 2018-03-10T16:19:34 | 105,920,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 940 | java | package lesson35.repository;
import lesson35.model.Room;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
public class RoomRepository extends Repository {
@Override
public void writeToFile(File file, Object object) throws Exception {
super.writeToFile(file, object);
}
@Override
public ArrayList readObjectsFromFile(File file) throws Exception {
return super.readObjectsFromFile(file);
}
@Override
public Object lineToObjectFormat(String[] fields) {
Room room = new Room();
room.setId(Long.parseLong(fields[0]));
room.setNumberOfGuests(Integer.parseInt(fields[1]));
room.setPrice(Double.parseDouble(fields[2]));
room.setBreakfastIncluded(Boolean.getBoolean(fields[3]));
room.setPetsAllowed(Boolean.getBoolean(fields[4]));
room.getDateAvailableFrom();
return super.lineToObjectFormat(fields);
}
}
| [
"hlushko.olexandr@gmail.com"
] | hlushko.olexandr@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.