blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
42d3028146312326079b7194cdf65cdc149fdae8 | 2d956b206ed1232f78671b7e4e9e9cf1971c5296 | /app/src/main/java/com/walker/dd/activity/chat/ActivityChat.java | ee15293daf384918b79c03f9149e6ae71845277c | [] | no_license | 1424234500/dd | b3218e09eed2b4a2214df2699341de5570586418 | 544c838c19c68df75c602c5e99d279e8b1be0760 | refs/heads/master | 2021-07-14T04:47:14.831254 | 2020-07-22T03:14:16 | 2020-07-22T03:14:16 | 189,924,508 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,402 | java | package com.walker.dd.activity.chat;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.SwipeRefreshLayout;
import android.os.Bundle;
import android.text.SpannableString;
import android.view.View;
import android.widget.AbsListView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.walker.common.util.Bean;
import com.walker.common.util.FileUtil;
import com.walker.common.util.JsonUtil;
import com.walker.common.util.LangUtil;
import com.walker.common.util.TimeUtil;
import com.walker.common.util.Tools;
import com.walker.dd.R;
import com.walker.dd.activity.AcBase;
import com.walker.dd.activity.FragmentBase;
import com.walker.dd.adapter.*;
import com.walker.dd.core.RobotAuto;
import com.walker.dd.core.service.Cache;
import com.walker.dd.service.MsgModel;
import com.walker.dd.service.NowUser;
import com.walker.dd.struct.Message;
import com.walker.dd.struct.Session;
import com.walker.dd.core.AndroidTools;
import com.walker.dd.core.Constant;
import com.walker.dd.core.KeyUtil;
import com.walker.dd.core.MyFile;
import com.walker.dd.core.MyImage;
import com.walker.dd.core.OkHttpUtil;
import com.walker.dd.core.UriUtil;
import com.walker.dd.core.picasso.NetImage;
import com.walker.dd.view.DialogImageShow;
import com.walker.dd.view.EmotionKeyboard;
import com.walker.dd.view.NavigationBar;
import com.walker.dd.view.NavigationImageView;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import com.walker.mode.*;
import com.walker.socket.server_1.plugin.*;
public class ActivityChat extends AcBase {
SwipeRefreshLayout srl;
EmotionKeyboard ekb;
List<Message> listItemMsg = new ArrayList<>();
Comparator<Message> compare = new Comparator<Message>() {
@Override
public int compare(Message o1, Message o2) {
return o1.getMsgId().compareTo(o2.getMsgId());
}
};
Comparator<Message> compareTime = new Comparator<Message>() {
@Override
public int compare(Message o1, Message o2) {
return o1.getTime().compareTo(o2.getTime());
}
};
ListView lv;
AdapterLvChat adapter;
EditText etsend;
Session session;
View viewfill;
FragmentVoice fragmentVoice;
FragmentPhoto fragmentPhoto;
FragmentEmoji fragmentEmoji;
FragmentMore fragmentMore;
// FragmentManager fragmentManager;
android.support.v4.app.FragmentManager fragmentManager;
FragmentBase fragmentNow;
/**
* 标题栏
*/
NavigationBar nb;
/**
* 导航切换聊天 语言 表情 拍照 fragment
*/
NavigationImageView niv;
private NavigationImageView.OnControl onControl = new NavigationImageView.OnControl() {
/**
* 0则是关闭
*
* @param id
*/
@Override
public void onOpen(int id) {
switch (id) {
case R.id.ivvoice:
turnToFragment(fragmentVoice);
break;
case R.id.ivphoto:
// turnToFragment(fragmentPhoto);
AndroidTools.chosePhoto(ActivityChat.this, Constant.ACTIVITY_RESULT_PHOTO);
niv.close();
break;
case R.id.ivgraph:
Constant.TAKEPHOTO = Constant.dirCamera + NowUser.getId() + "-" + TimeUtil.getTimeYmdHms()+".png";
AndroidTools.takePhoto(ActivityChat.this, Constant.TAKEPHOTO);
niv.close();
break;
case R.id.ivemoji:
turnToFragment(fragmentEmoji);
break;
case R.id.ivmore:
turnToFragment(fragmentMore);
break;
case 0:
default:
//关闭
}
if(id == 0){
ekb.hideViewHide(false);
}else{
ekb.showViewHide();
}
}
};
public void OnCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_chat);
/*
.set(Key.ID, dd.getId())
.set(Key.NAME, dd.getName())
.set(Key.TIME, TimeUtil.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"))
.set(Key.TYPE, Key.TEXT)
.set(Key.TEXT, "auto echo")
.set(Key.NUM, 1)*/
session = new Session(AndroidTools.getMapFromIntent(this.getIntent()));
// listItemMsg = Cache.getInstance().get(session.get(Key.ID, Key.ID), new ArrayList<Bean>());
listItemMsg = MsgModel.findMsg(sqlDao, session.getId(), TimeUtil.getTimeYmdHms(), 15);
viewfill = (View)findViewById(R.id.viewfill);
srl =(SwipeRefreshLayout)findViewById(R.id.srl);
lv = (ListView)findViewById(R.id.lv);
adapter = new AdapterLvChat(this, listItemMsg);
lv.setAdapter( adapter);
lv.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView arg0, int scrollState) {
switch(scrollState){
case AbsListView.OnScrollListener.SCROLL_STATE_IDLE://空闲状态
NetImage.resume(getContext());
break;
case AbsListView.OnScrollListener.SCROLL_STATE_FLING://滚动状态
NetImage.pause(getContext());
break;
case AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL://触摸后滚动
break;
}
}
@Override
public void onScroll(AbsListView arg0, int arg1, int arg2, int arg3) {
}
});
adapter.setOnClick(new AdapterLvChat.OnClick() {
@Override
public void onClick(int position) {
final Message bean = listItemMsg.get(position);
String type = bean.getMsgType();//bean.get(Key.TYPE, Key.TEXT);
String sta = bean.getSta();//bean.get(Key.STA, Key.STA_FALSE);
final String key = bean.getFile();//bean.get(Key.FILE, "");
final String newPath = KeyUtil.getFileLocal(key);
//文件下载
if(type.equals(Key.FILE)){
assert key.length() > 0;
if(new File(newPath).exists()){
sta = Key.STA_TRUE;
}else if(sta.equals(Key.STA_TRUE)){
sta = Key.STA_FALSE;
}
if(sta.equals(Key.STA_FALSE)){ //下载文件
sta = Key.STA_LOADING;
OkHttpUtil.download(KeyUtil.getFileHttp(key), newPath, new OkHttpUtil.OnHttp() {
@Override
public void onOk(Call call, Response response, long length) {
bean.setSta(Key.STA_TRUE);
addMsg(bean);
}
@Override
public void onLoading(final float progress, final long length, long allLength, final long sudo) {
if(Integer.valueOf(bean.getSta()) != (int)progress) {
bean.setSta("" + (int) progress);
bean.setInfo("P " + Tools.calcSize((long) (allLength/100*progress)) + "/" + Tools.calcSize(allLength) + " " + progress + "%" + " " + Tools.calcSize(sudo) + "/s" );
out(bean.getInfo());
addMsg(bean);
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
FileUtil.delete(newPath);
bean.setSta(Key.STA_FALSE);
addMsg(bean);
toast("下载文件失败", key);
}
});
}else if(sta.equals(Key.STA_TRUE)){ //打开文件
AndroidTools.openFile(ActivityChat.this, newPath);
}else{ //
toast("loading...");
}
bean.setSta(sta);
addMsg(bean);
}
//图片详情
else if(type.equals(Key.PHOTO)){
//携带参数跳转
String path = KeyUtil.getFileLocal(key);
DialogImageShow dis = new DialogImageShow(ActivityChat.this, path);
dis.show();
dis.setCancelable(true);
}
//语言自动播放
else if(type.equals(Key.VOICE)){
}
}
});
// lv.setOnItemLongClickListener(this);
// /设置刷新时动画的颜色,可以设置4个
srl.setColorSchemeResources(Constant.SRLColors);
srl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
AndroidTools.toast(getContext(), "refresh");
loadMore();
}
});
etsend = (EditText)findViewById(R.id.etsend);
etsend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ekb.hideViewHide(true);
niv.closeNocall();
scroll();
}
});
niv = (NavigationImageView)findViewById(R.id.niv);
niv.setOnControl(onControl);
niv.close();
nb = (NavigationBar)findViewById(R.id.nb);
nb.setMenu(R.drawable.more);
nb.setTitle(session.getName());
nb.setSubtitle(session.getId());
nb.setReturn("消息");
// nb.setReturnIcon(R.id.ivprofile);
nb.setOnNavigationBar(new NavigationBar.OnNavigationBar() {
@Override
public void onClickIvMenu(ImageView view) {
toast("more");
}
@Override
public void onClickTvReturn(TextView view) {
onBackPressed();
}
@Override
public void onClickTvTitle(TextView view) {
}
@Override
public void onClickTvSubtitle(TextView view) {
}
});
ekb = EmotionKeyboard.with(this)
.bindViewMain(srl)//绑定内容view lvChat -> 下拉布局,需要weight 1来配合ekb解决闪屏
.bindEditText(etsend)//EditView
.bindViewHide(viewfill)//绑定隐藏布局
.build();
fragmentVoice = new FragmentVoice();
fragmentVoice.setOnVoice( new FragmentVoice.OnVoice() {
@Override
public void onSend(String file) {
toast("voice", file);
}
});
fragmentPhoto = new FragmentPhoto();
fragmentEmoji = new FragmentEmoji();
fragmentEmoji.setCall(new FragmentEmoji.Call() {
@Override
public void onCall(SpannableString spannableString) {
etsend.getText().insert(etsend.getSelectionStart(), spannableString);
}
});
fragmentMore = new FragmentMore();
// fragmentManager = getFragmentManager();
fragmentManager = getSupportFragmentManager(); //v4
// turnToFragment(fragmentChat);
//初始化滚动
scroll();
}
//fragmentManager.beginTransaction().replace(R.id.main_fragment, fragmentChat).commit();
public void turnToFragment(FragmentBase fragment){
if(fragment == fragmentNow) return;
FragmentTransaction t = fragmentManager.beginTransaction();
if(fragmentNow == null){
t.replace(R.id.main_fragment, fragment);
}else{
if(!fragment.isAdded()){
t.add(R.id.main_fragment, fragment);
}
t.hide(fragmentNow).show(fragment);
}
fragmentNow = fragment;
t.commit();
}
/**
* 回退键处理,返回false则执行finish,否则不处理
*/
@Override
public boolean OnBackPressed() {
if(niv.isOpen()){
niv.closeNocall();
ekb.hideViewHide(false);
return true;
}
if(ekb.isViewHideShow()){
ekb.hideViewHide(false);
return true;
}
return false;
}
/**
* 收到广播处理
*
* @param msgJson
*/
@Override
public void OnReceive(String msgJson) {
Msg msg = new Msg(msgJson);
Message item = MsgModel.addMsg(sqlDao, new Message(msg));
String toid = session.getId();
String plugin = msg.getType();
if(!(msg.getUserFrom().getId().equals(toid) || msg.getTo().equals(toid)))return;
if(plugin.equals(Plugin.KEY_MESSAGE)){
addMsg(item);
}
}
/**
* Called when a view has been clicked.
*
* @param v The view that was clicked.
*/
@Override
public void onClick(View v) {
if(v.getId() == R.id.tvsend){
String str = etsend.getText().toString();
if(str.length() > 0){
sendMsg(str);
etsend.setText("");
}
}
}
/**
* handler处理器
*
* @param type
* @param str
*/
@Override
public void OnHandler(String type, String str) {
super.OnHandler(type, str);
if(type.equals(Key.AUTO)){
}
}
/**
* 自动应答
*/
private void sendAuto(String str){
String url = RobotAuto.TENCENT_URL;
RequestBody requestBody = RobotAuto.getTencentAutoTextRequest(str, "dd");
// out(url, requestBody);
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
OkHttpUtil.getInstance().getClient().newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
log( "onFailure: ", e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String str = response.body().string();
// sendHandler(Key.AUTO, res);
out("onResponse", str);
sendAutoMsg(str);
}
});
RobotAuto.selfEcho(getContext(), str, new RobotAuto.Echo() {
@Override
public void echo(String st1r) {
out("selfEcho", st1r);
sendAutoMsg(st1r);
}
});
}
public void sendAutoMsg(String str){
final String res=RobotAuto.parseTencentRes(str);
out(res);
String toid = session.getId(); //目标人 或群
String msgid = LangUtil.getGenerateId();
String file = "";
Bean data = new Bean()
.set(Key.ID, msgid)
.set(Key.TYPE, Key.TEXT)
.set(Key.TEXT, res)
.set(Key.FILE, file)
;
Msg msg = new Msg().setUserFrom(NowUser.getDd())
.setUserTo(toid)
.setTimeDo(System.currentTimeMillis())
;
msg.setData(data);
Message bean = MsgModel.addMsg(sqlDao, new Message(msg)); //存储
addMsg(bean); //表现
}
/**
* 关于异步操作 耗时socket操作 数据状态改变 及时更新listview 和 选中最新滚动的问题!
* @param str
*/
private void sendMsg(final String str){
String toid = session.getId(); //目标人 或群
String msgid = LangUtil.getGenerateId();
String file = "";
Bean data = new Bean()
.set(Key.ID, msgid)
.set(Key.TYPE, Key.TEXT)
.set(Key.STA, Key.STA_LOADING)
.set(Key.TEXT, str)
.set(Key.FILE, file)
;
Msg msg = new Msg().setUserFrom(NowUser.getUser())
.setUserTo(toid)
.setTimeDo(System.currentTimeMillis())
.setData(data)
;
Message bean = MsgModel.addMsg(sqlDao, new Message(msg)); //存储
addMsg(bean); //表现
try {
data.set(Key.STA, ""); //不发给其他端
sendSocket(Plugin.KEY_MESSAGE, toid, data); //发送socket
//成功后 更新发送状态 发送失败异常跳出
bean.setSta(Key.STA_TRUE);
}catch (Exception e){
e.printStackTrace();
toast("发送失败", data);
bean.setSta(Key.STA_FALSE);
}
bean = MsgModel.addMsg(sqlDao, bean); //存储
addMsg(bean); //表现
//自动会话才自动回复
if(toid.equals(NowUser.getDd().getId()))
sendAuto(str); //自动回复
}
private void sendFile(final String path){
String name = FileUtil.getFileName(path);
String type = FileUtil.getFileType(path);
final String toid = session.getId(); //目标人 或群
final String msgid = LangUtil.getGenerateId();
final Bean data = new Bean()
.set(Key.ID, msgid)
.set(Key.TYPE, Key.FILE)
.set(Key.STA, "1")
.set(Key.TEXT, name)
.set(Key.FILE, path) //先暂存本地发送路径 待上传成功cp到下载路径
;
final Msg msg = new Msg().setUserFrom(NowUser.getUser())
.setUserTo(toid)
.setTimeDo(System.currentTimeMillis())
.setData(data)
;
final Message bean = MsgModel.addMsg(sqlDao, new Message(msg)); //存储
addMsg(bean); //表现
//上传文件拿到 文件key 把被发送文件复制到 下载路径作为下载到的文件 消息存储该路径文件path 若有则用 若无则按照规则下载
OkHttpUtil.upload(path, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
handler.post(new Runnable() {
@Override
public void run() {
bean.setSta(Key.STA_FALSE);
MsgModel.addMsg(sqlDao, bean); //存储
addMsg(bean); //表现
toast("上传失败", path);
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String res = response.body().string();
// sendHandler(Key.FILE + ":true", path);
Bean resBean = JsonUtil.get(res);
final String key = resBean.get("data", "");
log("上传成功", res);
// 消息存储该路径文件path 若有则用 若无则按照规则下载
data.set(Key.FILE, key);
bean.setFile(key);
try {
data.set(Key.STA, ""); //不需要发送给其他端
sendSocket(Plugin.KEY_MESSAGE, toid, data); //发送socket
bean.setSta(Key.STA_TRUE);
// 把被发送文件复制到 下载路径作为下载到的文件
String newPath = KeyUtil.getFileLocal(key);
// FileUtil.cp(path, newPath);
MyFile.copyFile(path, newPath);
}catch (Exception e){
e.printStackTrace();
toast("发送文件消息失败", key);
bean.setSta(Key.STA_FALSE);
}
MsgModel.addMsg(sqlDao, bean); //存储
addMsg(bean); //表现
}
});
}
private void sendPhoto(final String path){
String name = FileUtil.getFileName(path);
String type = FileUtil.getFileType(path);
//图片上传 压缩的文件 控制大小在500kb以内 分辨率800
// 把被发送文件压缩转换 下载路径作为下载到的文件 原名
String tempName = "T_" + System.currentTimeMillis() + "." + type;
String tempPath = KeyUtil.getFileLocal(tempName);
// MyFile.copyFile(path, tempPath);
MyImage.savePNG_After(MyImage.getBitmapByDecodeFile(path), tempPath);
final String toid = session.getId(); //目标人 或群
final String msgid = LangUtil.getGenerateId();
final Bean data = new Bean()
.set(Key.ID, msgid)
.set(Key.TYPE, Key.PHOTO)
.set(Key.STA, "1")
.set(Key.TEXT, name)
.set(Key.FILE, tempName) //先暂存本地发送路径 待上传成功cp到下载路径
;
final Msg msg = new Msg().setUserFrom(NowUser.getUser())
.setUserTo(toid)
.setTimeDo(System.currentTimeMillis())
.setData(data)
;
final Message bean = MsgModel.addMsg(sqlDao, new Message(msg)); //存储
addMsg(bean); //表现
//上传文件拿到 文件key 把被发送文件复制到 下载路径作为下载到的文件 消息存储该路径文件path 若有则用 若无则按照规则下载
OkHttpUtil.upload(tempPath, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
handler.post(new Runnable() {
@Override
public void run() {
bean.setSta(Key.STA_FALSE);
MsgModel.addMsg(sqlDao, bean); //存储
addMsg(bean); //表现
toast("上传失败", path);
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String res = response.body().string();
// sendHandler(Key.FILE + ":true", path);
Bean resBean = JsonUtil.get(res);
final String key = resBean.get("data", "");
log("上传成功", res);
String newPath = KeyUtil.getFileLocal(key);
new File(tempPath).renameTo(new File(newPath)); //重命名临时文件
// 消息存储该路径文件path 若有则用 若无则按照规则下载
data.set(Key.FILE, key);
bean.setFile(key);
try {
data.set(Key.STA, ""); //不需要发送给其他端
sendSocket(Plugin.KEY_MESSAGE, toid, data); //发送socket
bean.setSta(Key.STA_TRUE);
}catch (Exception e){
e.printStackTrace();
toast("发送文件消息失败", key);
bean.setSta(Key.STA_FALSE);
}
MsgModel.addMsg(sqlDao, bean); //存储
addMsg(bean); //表现
}
});
}
private void loadMore(){
String time = listItemMsg.size() > 0 ? listItemMsg.get(0).getTime(): TimeUtil.getTimeYmdHms();
List<Message> list = MsgModel.findMsg(sqlDao, session.get(Key.ID, Key.ID), time, Constant.NUM);
listItemMsg.addAll(0, list);
adapter.notifyDataSetChanged();
int sel = list.size();
sel = sel > 0 ? sel - 1 : 0;
lv.setSelection(sel);
srl.setRefreshing(false);
}
/**
.set(Key.ID, msgid)
.set(Key.TYPE, Key.TEXT)
.set(Key.STA, Key.STA_LOADING)
.set(Key.FROM, NowUser.getUser())
.set(Key.TO, toid)
.set(Key.TIME, TimeUtil.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"))
.set(Key.TEXT, str)
.set(Key.FILE, file)
*/
private void addMsg(final Message bean) {
if(bean != null) {
handler.post(new Runnable() {
@Override
public void run() {
int i = AndroidTools.listIndex(listItemMsg, bean, compare);
if(i >= 0){
// listItemMsg.get(i).putAll(bean);
listItemMsg.remove(i);
listItemMsg.add(i, bean);
}else{
listItemMsg.add(bean);
// lv.setSelection(listItemMsg.size()); //选中最新一条,滚动到底部
}
if(listItemMsg.size() > Constant.NUM * 3){
listItemMsg.remove(0);
}
Collections.sort(listItemMsg, compareTime);
adapter.notifyDataSetChanged();
if(i < 0){
lv.smoothScrollByOffset(listItemMsg.size());
}
}
});
}
}
public void scroll(){
handler.post(new Runnable() {
@Override
public void run() {
adapter.notifyDataSetChanged();
lv.smoothScrollByOffset(listItemMsg.size());
}
});
}
@Override
public void OnPause() {
Cache.getInstance().put(session.get(Key.ID, Key.ID), listItemMsg);
}
/**
* 更多菜单点击
*/
@Override
public void OnMoreClick() {
toast("more");
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode != Activity.RESULT_OK || data == null){
log("onActivityResult 操作取消??", resultCode, data);
// return;
}
try{
if (requestCode == Constant.ACTIVITY_RESULT_FILE ) {
Uri uri = data.getData();
String path = UriUtil.getpath(getContext(), uri);
sendFile(path);
}else if (requestCode == Constant.ACTIVITY_RESULT_PHOTO ) {
Uri uri = data.getData();
String path = UriUtil.getpath(getContext(), uri);
sendPhoto(path);
}else if (requestCode == Constant.ACTIVITY_RESULT_TAKEPHOTO ) {
sendPhoto(Constant.TAKEPHOTO);
}else{
toast("onAc " + data);
}
} catch (Exception e) {
toast(e.toString());
e.printStackTrace();
}
}
}
| [
"1424234500@qq.com"
] | 1424234500@qq.com |
cfd20be5c0164b39c374047279d3320f893d8dc9 | 85be1255dca3dbc576e1ae4587e8671af5fa6304 | /src/main/java/com/xudy/tbke/service/Impl/UserOrderServiceImpl.java | 365075f087cfc215d4a150b88f83f337f76ddc05 | [] | no_license | feng0489/tbke | 6fc86278709c5f167d1604e32930e6d9fc7e50c0 | 7f66813eee2cbf9030a8468be65fec035bda67dd | refs/heads/master | 2020-04-09T07:02:47.025266 | 2018-12-05T09:12:15 | 2018-12-05T09:12:15 | 160,138,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | package com.xudy.tbke.service.Impl;
import com.xudy.tbke.dao.UserOrderDao;
import com.xudy.tbke.mapper.UserOrderMapper;
import com.xudy.tbke.model.UserOrder;
import com.xudy.tbke.service.UserOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class UserOrderServiceImpl implements UserOrderService {
@Autowired
private UserOrderDao userOrderDao;
@Autowired
private UserOrderMapper userOrderMapper;
@Override
public List<Map<String, Object>> selectAll() {
return userOrderMapper.selectAll();
}
@Override
public List<UserOrder> selectById(Integer id) {
return userOrderMapper.selectById(id);
}
@Override
public List<UserOrder> selectByPage(Map<String, Object> map) {
return userOrderMapper.selectByPage(map);
}
@Override
public int getTotal() {
return userOrderMapper.getTotals();
}
@Override
public int insertOne(UserOrder userGrade) {
return userOrderMapper.insertOne(userGrade);
}
@Override
public int insertMore(List<UserOrder> list) {
return userOrderMapper.insertMore(list);
}
}
| [
"1405123690@qq.com"
] | 1405123690@qq.com |
b51a314a542fe15736318b964705eb7616e9b809 | 6e28b9494df28771c03adc1fe59898a29377f6c8 | /holidayinfomsystem/src/main/java/com/ihorse/DaoImpl/Calendardaoimpl.java | 25a11f165c7d527d3c537ae2d1db61d9714f6300 | [] | no_license | gnanaganesh/TryOuts | 82b42a43f13d833bdd39413f6510af77f830b825 | 577cccdb081fa907046f141827c50fbde51403fb | refs/heads/master | 2020-06-23T04:18:18.959288 | 2016-11-24T11:32:21 | 2016-11-24T11:32:21 | 74,666,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,142 | java | package com.ihorse.DaoImpl;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.apache.jasper.tagplugins.jstl.core.ForEach;
import org.springframework.jdbc.core.JdbcTemplate;
import com.ihorse.Dao.Calendardao;
import com.ihorse.Dto.Calendardto;
import com.ihorse.Mapper.Calendarmapper;
import com.ihorse.Pojo.Calendarbean;
public class Calendardaoimpl implements Calendardao {
private DateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
private DataSource ds;
private JdbcTemplate jdbcTemplate;
public DataSource getDs() {
return ds;
}
public void setDs(DataSource ds) {
this.ds = ds;
}
public JdbcTemplate getJdbcTemplate() {
return jdbcTemplate;
}
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public int save(Calendarbean e) throws SQLException {
String query = "insert into oss(name,std,etd,des)values(?,?,?,?)";
Object[] param = new Object[] { e.getName(), sd.format(e.getSd()), sd.format(e.getEd()), e.getDes() };
if (e.getOldEndDate() != null && e.getOldEndDate() != null) {
query = "update oss set name =?, std=?, etd=?, des= ? where std=? and etd= ?";
param = new Object[] { e.getName(), sd.format(e.getSd()), sd.format(e.getEd()), e.getDes(), sd.format(e.getOldStartDate()),
sd.format(e.getOldEndDate()) };
}
return jdbcTemplate.update(query, param);
}
@Override
public Calendardto userDetails(String month, String year, Date std) throws SQLException {
Calendardto dto = new Calendardto();
Map<String, Calendarbean> selectedDateMap = new HashMap<>();
String sql = "select name,std,etd,des from oss where (month(std)=? and year(std)=?) or (month(etd)=? and year(etd)=?) order by std,etd asc";
List<Calendarbean> dateRangeList = jdbcTemplate.query(sql, new Object[] { month, year, month, year },
new Calendarmapper());
dto.setListCbean(dateRangeList);
sql = "select * from "
+ "(select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date from "
+ "(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0, "
+ "(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1, "
+ "(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2, "
+ "(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3, "
+ "(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t4) "
+ " dateRange where selected_date between ? and ? ";
List<String> selectedDates = new ArrayList<>();
List<String> dateList = new ArrayList<>();
for (Calendarbean calendarbean : dateRangeList) {
dateList = jdbcTemplate.queryForList(sql, new Object[] { calendarbean.getSd(), calendarbean.getEd() },
String.class);
selectedDates.addAll(dateList);
for (String string : dateList) {
selectedDateMap.put(string, calendarbean);
}
}
dto.setSelectedDateMap(selectedDateMap);
dto.setSelectedDates(selectedDates);
return dto;
}
public void addDate(Calendarbean cb) {
String sql = "insert into oss values(?,?,?,?)";
jdbcTemplate.update(sql, new Object[] { cb.getName(), cb.getSd(), cb.getEd(), cb.getDes() });
}
public void delDates(List<Calendarbean> cbList) {
String sql = "delete from oss where std = ? and etd=?";
for (Calendarbean cb : cbList) {
jdbcTemplate.update(sql, new Object[] { sd.format(cb.getSd()), sd.format(cb.getEd()) });
}
}
}
| [
"146376@LT061960.cts.com"
] | 146376@LT061960.cts.com |
2bab5e2230b6d4fbc29b89f1ab0bc4f69a6a9a68 | 57e1654d52f8a6633aa572997e337ac392fbd8f5 | /StatefulLayout/src/main/java/com/bassel/statefullayout/CustomAnimationListener.java | c2b82d14bcd712310b5a675ea408629e428e510e | [] | no_license | bchaitani/Go-News | 51300d9255bf354d05cf5c127c99b8d8cd62b33a | a2eab3013e73c64f214a51f77aaa510fff8ac7f8 | refs/heads/master | 2020-04-20T21:21:53.084695 | 2019-02-10T15:38:49 | 2019-02-10T15:38:49 | 169,106,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package com.bassel.statefullayout;
import android.view.animation.Animation;
/**
* Created by basselchaitani on 5/10/18
*/
public class CustomAnimationListener implements Animation.AnimationListener{
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
}
| [
"basselchaitani@Bassels-MacBook-Pro.local"
] | basselchaitani@Bassels-MacBook-Pro.local |
152988119824a3f31ba5c848951a897c92b6cf02 | 4e6473153ecde7c7451c94b60bac8836c94e424f | /baseio-core/src/main/java/com/generallycloud/nio/component/ssl/JdkAlpnSslEngine.java | 09749823c356edeea81a00b2b6d2758dcbbb02fd | [] | no_license | pengp/baseio | df07daee2dd2d25c7dbf03f3f6eba0a1768af897 | dfb5215f4f22f451d80f2435c3e47fc37b4da5cc | refs/heads/master | 2020-06-10T17:16:45.090864 | 2016-12-06T06:13:02 | 2016-12-06T06:13:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,831 | java | package com.generallycloud.nio.component.ssl;
import java.util.LinkedHashSet;
import java.util.List;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import org.eclipse.jetty.alpn.ALPN;
import org.eclipse.jetty.alpn.ALPN.ClientProvider;
import org.eclipse.jetty.alpn.ALPN.ServerProvider;
import com.generallycloud.nio.component.ssl.JdkApplicationProtocolNegotiator.ProtocolSelectionListener;
import com.generallycloud.nio.component.ssl.JdkApplicationProtocolNegotiator.ProtocolSelector;
final class JdkAlpnSslEngine extends JdkSslEngine {
private static boolean available;
static boolean isAvailable() {
updateAvailability();
return available;
}
private static void updateAvailability() {
if (available) {
return;
}
try {
// Always use bootstrap class loader.
Class.forName("sun.security.ssl.ALPNExtension", true, null);
available = true;
} catch (Exception ignore) {
// alpn-boot was not loaded.
}
}
JdkAlpnSslEngine(SSLEngine engine, final JdkApplicationProtocolNegotiator applicationNegotiator, boolean server) {
super(engine);
if (server) {
final ProtocolSelector protocolSelector = applicationNegotiator.protocolSelectorFactory().newSelector(
this, new LinkedHashSet<String>(applicationNegotiator.protocols()));
ALPN.put(engine, new ServerProvider() {
@Override
public String select(List<String> protocols) throws SSLException {
try {
return protocolSelector.select(protocols);
} catch (SSLHandshakeException e) {
throw e;
} catch (Throwable t) {
SSLHandshakeException e = new SSLHandshakeException(t.getMessage());
e.initCause(t);
throw e;
}
}
@Override
public void unsupported() {
protocolSelector.unsupported();
}
});
} else {
final ProtocolSelectionListener protocolListener = applicationNegotiator.protocolListenerFactory()
.newListener(this, applicationNegotiator.protocols());
ALPN.put(engine, new ClientProvider() {
@Override
public List<String> protocols() {
return applicationNegotiator.protocols();
}
@Override
public void selected(String protocol) throws SSLException {
try {
protocolListener.selected(protocol);
} catch (SSLHandshakeException e) {
throw e;
} catch (Throwable t) {
SSLHandshakeException e = new SSLHandshakeException(t.getMessage());
e.initCause(t);
throw e;
}
}
@Override
public void unsupported() {
protocolListener.unsupported();
}
});
}
}
@Override
public void closeInbound() throws SSLException {
ALPN.remove(getWrappedEngine());
super.closeInbound();
}
@Override
public void closeOutbound() {
ALPN.remove(getWrappedEngine());
super.closeOutbound();
}
}
| [
"8738115@qq.com"
] | 8738115@qq.com |
349e1fb7a26f86cee43f825a048b5fa394afc881 | 367d92dd52871e4089bb794e8384b9c9a5a81f25 | /leetcode/MinimumUniqueWordAbbreviation/MinimumUniqueWordAbbreviation.java | 19be8db9e595b1be5cca45c5c51aca1e515757b4 | [] | no_license | SpicyZinc/underestimate | 54cfd10e3202e4bce5b8cb5d8b03481d295c308c | dbe9caffb41f153d5e23a583a1abe2c66e4bdf4b | refs/heads/master | 2023-03-09T01:31:43.867486 | 2023-02-28T10:05:14 | 2023-02-28T10:05:14 | 20,214,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,374 | java | /*
A string such as "word" contains the following abbreviations:
["word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1", "w1r1", "1o2", "2r1", "3d", "w3", "4"]
Given a target string and a set of strings in a dictionary,
find an abbreviation of this target string with the smallest possible length such that it does not conflict with abbreviations of the strings in the dictionary.
Each number or letter in the abbreviation is considered length = 1. For example, the abbreviation "a32bc" has length = 4.
Note:
In the case of multiple answers as shown in the second example below, you may return any one of them.
Assume length of target string = m, and dictionary size = n. You may assume that m ≤ 21, n ≤ 1000, and log2(n) + m ≤ 20.
Examples:
"apple", ["blade"] -> "a4" (because "5" or "4e" conflicts with "blade")
"apple", ["plain", "amber", "blade"] -> "1p3" (other valid answers include "ap3", "a3e", "2p2", "3le", "3l1").
idea:
1. generate all abbreviations of target
2. sort them in a ascending order
3. use validWordAbbreviation() to see if one abbr is valid for ALL words in dictionary
4. if fails one in the dictionary, then this abbr is not min abbr
*/
import java.util.*;
public class MinimumUniqueWordAbbreviation {
public static void main(String[] args) {
MinimumUniqueWordAbbreviation eg = new MinimumUniqueWordAbbreviation();
String target = "apple";
// String[] dictionary = {"blade"};
String[] dictionary = {"plain", "amber", "blade"};
String result = eg.minAbbreviation(target, dictionary);
System.out.println(result);
}
public String minAbbreviation(String target, String[] dictionary) {
if (dictionary.length == 0 || dictionary == null) {
return target.length() + "";
}
List<String> list = generateAbbreviations(target);
for (int i = 0; i < list.size(); i++) {
String abbr = list.get(i);
boolean conflict = false;
for (String word : dictionary) {
if (validWordAbbreviation(word, abbr)) {
conflict = true;
}
}
if (!conflict) {
return abbr;
}
}
return "";
}
public List<String> generateAbbreviations(String word) {
List<String> result = new ArrayList<String>();
int len = word.length();
result.add(len == 0 ? "" : len + "");
for (int i = 0; i < len; i++) {
for (String right : generateAbbreviations(word.substring(i + 1))) {
String leftNum = i > 0 ? i + "" : "";
result.add( leftNum + word.substring(i, i + 1) + right );
}
}
Collections.sort(result, new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return s1.length() - s2.length();
}
});
return result;
}
public boolean validWordAbbreviation(String word, String abbr) {
int i = 0, j = 0;
int wl = word.length();
int al = abbr.length();
while (i < wl && j < al) {
char c1 = word.charAt(i);
char c2 = abbr.charAt(j);
if (c2 >= '0' && c2 <= '9') {
if (c2 == '0') {
return false;
}
int val = 0;
while (j < al && abbr.charAt(j) >= '0' && abbr.charAt(j) <= '9') {
val = val * 10 + abbr.charAt(j) - '0';
j++;
}
i += val;
} else {
if (c1 != c2) {
return false;
}
else {
i++;
j++;
}
}
}
return i == wl && j == al;
}
} | [
"angxin880@gmail.com"
] | angxin880@gmail.com |
ce58223f8e7afc0f3c3890e5ab06ca5a31fbd4a2 | 1cc8bb3aec615ed1696a2659d8407bc3fba47ab9 | /Week 6/src/practicumopdracht/controllers/ResultaatController.java | 82e365a835f544600d74d7233e50fc5df0e7fdc6 | [] | no_license | adakgh/object-oriented-programming-project | 605ea8ff9a62d2ec9a2bd9226c404f4ebd306ad3 | 3f63eb3f9310f01b752af475a5329d89642d8c4e | refs/heads/main | 2023-04-27T23:09:27.272418 | 2021-05-17T13:06:32 | 2021-05-17T13:06:32 | 366,712,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,253 | java | package practicumopdracht.controllers;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.input.MouseEvent;
import practicumopdracht.MainApplication;
import practicumopdracht.comparators.ResultaatDateComparator;
import practicumopdracht.comparators.ResultaatStudentIDComparator;
import practicumopdracht.data.ResultaatDAO;
import practicumopdracht.models.Resultaat;
import practicumopdracht.models.Vak;
import practicumopdracht.views.ResultaatView;
import practicumopdracht.views.View;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
/**
* Detail controller voor OOP2 practicumopdracht.
*
*/
public class ResultaatController extends Controller {
private final String VAK_IS_VERPLICHT = "- Vak is verplicht!";
private final String STUDENTENNUMMER_IS_VERPLICHT = "- Studentennummer is verplicht of ongeldig!";
private final String DATUM_IS_ONGELDIG = "- Datum van toetsafname is verplicht of ongeldig!";
private final String NAAM_IS_VERPLICHT = "- Volledige naam is verplicht of ongeldig!";
private final String CIJFER_IS_ONGELDIG = "- Behaalde cijfer is verplicht of ongeldig!";
private ResultaatView resultaatView;
private Alert alert;
private ResultaatDAO resultaatDAO;
public ResultaatController(Vak v) {
resultaatView = new ResultaatView();
resultaatDAO = MainApplication.getResultaatDAO();
resultaatView.getTerugButton().setOnAction(e -> pressedTerug());
resultaatView.getNieuwButton().setOnAction(e -> pressedNieuw());
resultaatView.getVerwijderenButton().setOnAction(e -> pressedVerwijderen());
resultaatView.getOpslaanButton().setOnAction(e -> pressedOpslaan());
resultaatView.getVakken().setOnAction(e -> refreshBox());
resultaatView.getSorteerDatumOplopend().setOnAction(e -> sortDateAsc());
resultaatView.getSorteerDatumAflopend().setOnAction(e -> sortDateDesc());
resultaatView.getSorteerStudentennummerOplopend().setOnAction(e -> sortStudentIDAsc());
resultaatView.getSorteerStudentennummerAflopend().setOnAction(e -> sortStudentIDDesc());
sort(new ResultaatStudentIDComparator.resultaatStudentennummerOplopend());
refreshData(v);
fillVakken();
pressedItem();
}
//data verkrijgen
private void refreshData(Vak v) {
ObservableList<Resultaat> resultaatList = FXCollections.observableList(resultaatDAO.getAllFor(v));
resultaatView.getListView().setItems(resultaatList);
resultaatView.getVakken().setValue(v);
}
//combobox met vakken vullen
public void fillVakken() {
List<Vak> vaklist = MainApplication.getVakDAO().getAll();
ObservableList<Vak> observableVakList = FXCollections.observableList(vaklist);
resultaatView.getVakken().setItems(observableVakList);
}
//switchen van view
public void pressedTerug() {
MainApplication.switchController(new VakController());
}
//listview en fields legen
public void pressedNieuw() {
alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Nieuw");
alert.setHeaderText("Je hebt op de nieuw-knop gedrukt!");
alert.setContentText("Weet je zeker dat je alle items wilt verwijderen?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
resultaatView.getListView().getItems().clear();
refreshFields();
}
}
//item verwijderen
public void pressedVerwijderen() {
Resultaat selectedItem = resultaatView.getListView().getSelectionModel().getSelectedItem();
if (selectedItem == null) {
alert = new Alert(Alert.AlertType.ERROR);
alert.setContentText("Je hebt geen item geselecteerd om te verwijderen!");
alert.show();
} else {
alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Verwijderen");
alert.setHeaderText("Je hebt op de verwijder-knop gedrukt!");
alert.setContentText("Weet je zeker dat je deze item wilt verwijderen?");
Optional<ButtonType> resultverwijderen = alert.showAndWait();
if (resultverwijderen.get() == ButtonType.OK) {
resultaatDAO.remove(selectedItem);
refreshData(resultaatView.getVakken().getValue());
}
}
}
//combobox is null
public boolean comboboxIsNull() {
return resultaatView.getVakken().getValue() == null;
}
//studentennummer is empty of ongeldig
public boolean studentennummerIsEmpty() {
return (resultaatView.getStudentennummerInvoerVeld().getText().isEmpty() || resultaatView.getStudentennummerInvoerVeld().getText().matches("[A-Za-z]") || resultaatView.getStudentennummerInvoerVeld().getText().trim().isEmpty());
}
//naam is empty of ongeldig
public boolean naamIsEmpty() {
return (resultaatView.getVolledigeNaamStudentInvoerVeld().getText().isEmpty() || resultaatView.getVolledigeNaamStudentInvoerVeld().getText().matches("[^0-9]") || resultaatView.getVolledigeNaamStudentInvoerVeld().getText().trim().isEmpty());
}
//datum is ongeldig
public boolean datumIsEmpty() {
return (resultaatView.getDatumInvoerVeld().getValue() == null);
}
//cijfer is ongeldig
public boolean cijferIsEmpty() {
return (resultaatView.getCijferInvoerVeld().getText().isEmpty() || resultaatView.getCijferInvoerVeld().getText().matches("[A-Za-z]") || resultaatView.getCijferInvoerVeld().getText().trim().isEmpty() || Double.parseDouble(resultaatView.getCijferInvoerVeld().getText()) > 10);
}
//item opslaan
public void pressedOpslaan() {
alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Opslaan");
alert.setHeaderText("De volgende fouten zijn gevonden: ");
if (comboboxIsNull() && studentennummerIsEmpty() && naamIsEmpty() && datumIsEmpty() && cijferIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + STUDENTENNUMMER_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG + "\n" + CIJFER_IS_ONGELDIG);
//4 velden niet ingevuld
} else if (cijferIsEmpty() && studentennummerIsEmpty() && naamIsEmpty() && datumIsEmpty()) {
alert.setContentText(STUDENTENNUMMER_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG + "\n" + CIJFER_IS_ONGELDIG);
} else if (comboboxIsNull() && studentennummerIsEmpty() && naamIsEmpty() && datumIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + STUDENTENNUMMER_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG);
} else if (comboboxIsNull() && studentennummerIsEmpty() && cijferIsEmpty() && datumIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + STUDENTENNUMMER_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG + "\n" + CIJFER_IS_ONGELDIG);
} else if (comboboxIsNull() && naamIsEmpty() && cijferIsEmpty() && datumIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG + "\n" + CIJFER_IS_ONGELDIG);
} else if (comboboxIsNull() && studentennummerIsEmpty() && naamIsEmpty() && cijferIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + STUDENTENNUMMER_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT + "\n" + CIJFER_IS_ONGELDIG);
//3 velden niet ingevuld
} else if (comboboxIsNull() && studentennummerIsEmpty() && naamIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + STUDENTENNUMMER_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT);
} else if (comboboxIsNull() && studentennummerIsEmpty() && datumIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + STUDENTENNUMMER_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG);
} else if (comboboxIsNull() && studentennummerIsEmpty() && cijferIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + STUDENTENNUMMER_IS_VERPLICHT + "\n" + CIJFER_IS_ONGELDIG);
} else if (cijferIsEmpty() && studentennummerIsEmpty() && datumIsEmpty()) {
alert.setContentText(STUDENTENNUMMER_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG + "\n" + CIJFER_IS_ONGELDIG);
} else if (cijferIsEmpty() && studentennummerIsEmpty() && naamIsEmpty()) {
alert.setContentText(STUDENTENNUMMER_IS_VERPLICHT + " \n" + DATUM_IS_ONGELDIG + "\n" + CIJFER_IS_ONGELDIG);
} else if (cijferIsEmpty() && naamIsEmpty() && datumIsEmpty()) {
alert.setContentText(NAAM_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG + "\n" + CIJFER_IS_ONGELDIG);
} else if (cijferIsEmpty() && naamIsEmpty() && comboboxIsNull()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT + "\n" + CIJFER_IS_ONGELDIG);
} else if (studentennummerIsEmpty() && naamIsEmpty() && datumIsEmpty()) {
alert.setContentText(STUDENTENNUMMER_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG);
} else if (comboboxIsNull() && naamIsEmpty() && cijferIsEmpty()) {
alert.setContentText(STUDENTENNUMMER_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT + "\n" + CIJFER_IS_ONGELDIG);
//2 velden niet ingevuld
} else if (comboboxIsNull() && studentennummerIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + STUDENTENNUMMER_IS_VERPLICHT);
} else if (studentennummerIsEmpty() && naamIsEmpty()) {
alert.setContentText(STUDENTENNUMMER_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT);
} else if (naamIsEmpty() && datumIsEmpty()) {
alert.setContentText(NAAM_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG);
} else if (comboboxIsNull() && naamIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + NAAM_IS_VERPLICHT);
} else if (comboboxIsNull() && datumIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + DATUM_IS_ONGELDIG);
} else if (comboboxIsNull() && cijferIsEmpty()) {
alert.setContentText(VAK_IS_VERPLICHT + "\n" + CIJFER_IS_ONGELDIG);
} else if (studentennummerIsEmpty() && cijferIsEmpty()) {
alert.setContentText(STUDENTENNUMMER_IS_VERPLICHT + "\n" + CIJFER_IS_ONGELDIG);
} else if (naamIsEmpty() && cijferIsEmpty()) {
alert.setContentText(NAAM_IS_VERPLICHT + "\n" + CIJFER_IS_ONGELDIG);
} else if (datumIsEmpty() && cijferIsEmpty()) {
alert.setContentText(DATUM_IS_ONGELDIG + "\n" + CIJFER_IS_ONGELDIG);
} else if (datumIsEmpty() && studentennummerIsEmpty()) {
alert.setContentText(DATUM_IS_ONGELDIG + "\n" + STUDENTENNUMMER_IS_VERPLICHT);
//1 veld niet ingevuld
} else if (comboboxIsNull()) {
alert.setContentText(VAK_IS_VERPLICHT);
} else if (studentennummerIsEmpty()) {
alert.setContentText(STUDENTENNUMMER_IS_VERPLICHT);
} else if (naamIsEmpty()) {
alert.setContentText(NAAM_IS_VERPLICHT);
} else if (datumIsEmpty()) {
alert.setContentText(DATUM_IS_ONGELDIG);
} else if (cijferIsEmpty()) {
alert.setContentText(CIJFER_IS_ONGELDIG);
} else {
alert = new Alert(Alert.AlertType.INFORMATION);
alert.setHeaderText("Opslaan is gelukt!");
Resultaat newResultaat = new Resultaat(resultaatView.getVakken().getValue().getId(), parseInt(resultaatView.getStudentennummerInvoerVeld().getText()),
resultaatView.getVolledigeNaamStudentInvoerVeld().getText(),
resultaatView.getDatumInvoerVeld().getValue(),
parseDouble(resultaatView.getCijferInvoerVeld().getText()),
resultaatView.getGehaaldInvoerVeld().isSelected());
alert.setContentText("Deze gegevens zijn succesvol opgeslagen: \n\n" + newResultaat);
if (!resultaatView.getListView().getSelectionModel().getSelectedItems().isEmpty()) {
newResultaat.setId(resultaatView.getListView().getSelectionModel().getSelectedItem().getId());
}
resultaatDAO.addOrUpdate(newResultaat);
fillVakken();
refreshFields();
refreshData(MainApplication.getVakDAO().get(newResultaat.getMasterId()));
}
alert.show();
}
//fields refreshen
public void refreshFields() {
resultaatView.getStudentennummerInvoerVeld().clear();
resultaatView.getVolledigeNaamStudentInvoerVeld().clear();
resultaatView.getCijferInvoerVeld().clear();
resultaatView.getGehaaldInvoerVeld().setSelected(false);
resultaatView.getDatumInvoerVeld().setValue(null);
}
//listview item onclick event
public void pressedItem() {
resultaatView.getListView().setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if (!resultaatView.getListView().getSelectionModel().getSelectedItems().isEmpty()) {
Resultaat resultaat = resultaatView.getListView().getSelectionModel().getSelectedItem();
resultaatView.getVakken().setValue(MainApplication.getVakDAO().get(resultaat.getMasterId()));
resultaatView.getStudentennummerInvoerVeld().setText(String.valueOf(resultaat.getStudentennummer()));
resultaatView.getVolledigeNaamStudentInvoerVeld().setText(resultaat.getVolledigeNaamStudent());
resultaatView.getDatumInvoerVeld().setValue(resultaat.getDatum());
resultaatView.getCijferInvoerVeld().setText(String.valueOf(resultaat.getCijfer()));
resultaatView.getGehaaldInvoerVeld().setSelected(resultaat.getGehaald());
refreshBox();
}
}
});
}
//sortering ophalen
private void sort(Comparator<Resultaat> comparator) {
FXCollections.sort(resultaatView.getListView().getItems(), comparator);
}
//datum oplopend sorteren
public void sortDateAsc(){
sort(new ResultaatDateComparator.resultaatDatumOplopend());
}
//datum aflopend sorteren
public void sortDateDesc(){
sort(new ResultaatDateComparator.resultaatDatumAflopend());
}
//studentennummer oplopend sorteren
public void sortStudentIDAsc(){
sort(new ResultaatStudentIDComparator.resultaatStudentennummerOplopend());
}
//studentennummer aflopend sorteren
public void sortStudentIDDesc(){
sort(new ResultaatStudentIDComparator.resultaatStudentennummerAflopend());
}
//resultaten met combobox mee veranderen
private void refreshBox() {
if (!resultaatView.getVakken().getSelectionModel().isEmpty()){
refreshData(resultaatView.getVakken().getValue());
}
}
@Override
public View getView() {
return resultaatView;
}
}
| [
"ghizlane.el.adak@hva.nl"
] | ghizlane.el.adak@hva.nl |
076aa102b16a9189da990d3f97ec2dd6aebb70f2 | c1b9adcc0af177abdcf1b09af8be4d9b30810de6 | /src/InitializationAndClassloading/Practice.java | 7647748452a1a65647a69b514cc349e942811483 | [] | no_license | JuneFire/ThinkInJava | da8d2f2b07f4b1fe8ca8233b661f5f2d2b28588f | a1c91e99cd355a2ebce461062ea93eee495755e0 | refs/heads/master | 2021-01-01T05:17:04.073448 | 2016-10-07T04:54:48 | 2016-10-07T04:54:48 | 56,027,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | java | package InitializationAndClassloading;
/**
* (1) 用默认构建器(空自变量列表)创建两个类:A 和B,令它们自己声明自己。从A 继承一个名为C 的新
类,并在C 内创建一个成员B。不要为C 创建一个构建器。创建类C 的一个对象,并观察结果。
(2) 修改练习1,使A 和B 都有含有自变量的构建器,则不是采用默认构建器。为C 写一个构建器,并在C
的构建器中执行所有初始化工作。
(3) 使用文件Cartoon.java ,将Cartoon 类的构建器代码变成注释内容标注出去。解释会发生什么事情。
(4) 使用文件Chess.java,将Chess 类的构建器代码作为注释标注出去。同样解释会发生什么。
*
*/
public class Practice {
public static void main(String[] args) {
new C("HelloWorld");
}
}
//于构建器的名字必须与类名完全相同
class A{
public A(String s) {
System.out.println("This is the A's constructor :" + s);
}
}
class B{
public B(String s) { System.out.println("2B(): " + s); }
}
class C extends A {
B b;
public C(String s){
super(s);
System.out.println(s);
b = new B(s);
}
} | [
"chengzhikang2015@163.com"
] | chengzhikang2015@163.com |
2890a0d17120ca7e8d007e9dd031d517edce874c | 2508c544cae8af45a3563c4ee6d56a52b7baeab4 | /fosmos-backend/src/main/java/com/fosmos/config/FastJsonHttpDateConverter.java | 023238e1d955ebba5bd46153f5750f4d01e7f7c5 | [] | no_license | fsy351/fosmos | 3feb5d7b4896532c78b236a9e98f00e006ef593c | 92c7ef18f62486063460c1d3f36a3d7e46e9a918 | refs/heads/master | 2020-04-05T17:28:31.266205 | 2019-03-12T17:39:39 | 2019-03-12T17:39:39 | 141,012,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,356 | java | package com.fosmos.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.converter.HttpMessageNotWritableException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
//@Configuration
public class FastJsonHttpDateConverter extends FastJsonHttpMessageConverter {
private static SerializeConfig mapping = new SerializeConfig();
private static String dateFormat;
static {
dateFormat = "yyyy-MM-dd HH:mm:ss";
mapping.put(Date.class, new SimpleDateFormatSerializer(dateFormat));
}
@Override
protected void writeInternal(Object obj, HttpOutputMessage outputMessage)
throws IOException, HttpMessageNotWritableException {
// TODO Auto-generated method stub
OutputStream out = outputMessage.getBody();
String text = JSON.toJSONString(obj, mapping, this.getFeatures());
byte[] bytes = text.getBytes(this.getCharset());
out.write(bytes);
}
}
| [
"fsy351@163.com"
] | fsy351@163.com |
fc9bfeb8f74e185862104036fa6926da9cd1fde9 | cd12bf4f6587fc462680df94f8ef662442924165 | /src/main/java/cn/pojo/Users.java | 56602536395db2fe4b8d6c3a7f4677be921f0df9 | [] | no_license | 666hgs/Blog | b735e2cb88be1c30bd9f02e10d31f6998eca8fc7 | ca7b436f30239be8a656580faf23a6a737f706a4 | refs/heads/master | 2022-12-22T22:45:34.862885 | 2019-05-29T07:00:24 | 2019-05-29T07:00:24 | 189,149,018 | 0 | 0 | null | 2022-12-16T06:12:46 | 2019-05-29T04:12:23 | CSS | UTF-8 | Java | false | false | 5,024 | java | package main.java.cn.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
public class Users {
private String user_tel;
private String user_name;
private Integer user_sex;
private String user_intro;
private Date user_rtime;
private String user_email;
private String user_qq;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date user_birth;
private Integer user_age;
private String user_pass;
private String user_photo;
private Integer follow_count; //用户关注总数
private Integer fans_count; //用户粉丝总数
private Integer leng; //遍历一个用户是否对一个用户关注的列表的长度
private Integer dynamic_count; //用户发布动态总数
public Users() {
}
public Users(String user_tel, String user_name, Integer user_sex, String user_intro, Date user_rtime, String user_email, String user_qq, Date user_birth, Integer user_age, String user_pass, String user_photo, Integer follow_count, Integer fans_count, Integer leng, Integer dynamic_count) {
this.user_tel = user_tel;
this.user_name = user_name;
this.user_sex = user_sex;
this.user_intro = user_intro;
this.user_rtime = user_rtime;
this.user_email = user_email;
this.user_qq = user_qq;
this.user_birth = user_birth;
this.user_age = user_age;
this.user_pass = user_pass;
this.user_photo = user_photo;
this.follow_count = follow_count;
this.fans_count = fans_count;
this.leng = leng;
this.dynamic_count = dynamic_count;
}
@Override
public String toString() {
return "Users{" +
"user_tel='" + user_tel + '\'' +
", user_name='" + user_name + '\'' +
", user_sex=" + user_sex +
", user_intro='" + user_intro + '\'' +
", user_rtime=" + user_rtime +
", user_email='" + user_email + '\'' +
", user_qq='" + user_qq + '\'' +
", user_birth=" + user_birth +
", user_age=" + user_age +
", user_pass='" + user_pass + '\'' +
", user_photo='" + user_photo + '\'' +
", follow_count=" + follow_count +
", fans_count=" + fans_count +
", leng=" + leng +
", dynamic_count=" + dynamic_count +
'}';
}
public String getUser_tel() {
return user_tel;
}
public void setUser_tel(String user_tel) {
this.user_tel = user_tel;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public Integer getUser_sex() {
return user_sex;
}
public void setUser_sex(Integer user_sex) {
this.user_sex = user_sex;
}
public String getUser_intro() {
return user_intro;
}
public void setUser_intro(String user_intro) {
this.user_intro = user_intro;
}
public Date getUser_rtime() {
return user_rtime;
}
public void setUser_rtime(Date user_rtime) {
this.user_rtime = user_rtime;
}
public String getUser_email() {
return user_email;
}
public void setUser_email(String user_email) {
this.user_email = user_email;
}
public String getUser_qq() {
return user_qq;
}
public void setUser_qq(String user_qq) {
this.user_qq = user_qq;
}
public Date getUser_birth() {
return user_birth;
}
public void setUser_birth(Date user_birth) {
this.user_birth = user_birth;
}
public Integer getUser_age() {
return user_age;
}
public void setUser_age(Integer user_age) {
this.user_age = user_age;
}
public String getUser_pass() {
return user_pass;
}
public void setUser_pass(String user_pass) {
this.user_pass = user_pass;
}
public String getUser_photo() {
return user_photo;
}
public void setUser_photo(String user_photo) {
this.user_photo = user_photo;
}
public Integer getFollow_count() {
return follow_count;
}
public void setFollow_count(Integer follow_count) {
this.follow_count = follow_count;
}
public Integer getFans_count() {
return fans_count;
}
public void setFans_count(Integer fans_count) {
this.fans_count = fans_count;
}
public Integer getLeng() {
return leng;
}
public void setLeng(Integer leng) {
this.leng = leng;
}
public Integer getDynamic_count() {
return dynamic_count;
}
public void setDynamic_count(Integer dynamic_count) {
this.dynamic_count = dynamic_count;
}
}
| [
"2683847853@qq.com"
] | 2683847853@qq.com |
43bab0ee16fb9de99f5731ac985666ee1facf363 | 7079477d823d266ae2e1c9b287392fd6cbe1679c | /plugin/src/main/java/com/craftmend/openaudiomc/generic/migrations/MigrationWorker.java | 556f697198e02e108f504271e854a80c60334144 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | hrpdevelopment/OpenAudioMc | 777a24fb3d01defa2c46b163b9cf51518623b286 | db4f15a527601019cb5b96375e2bafbf5c4b9160 | refs/heads/master | 2022-07-28T02:38:41.764007 | 2020-05-08T17:36:40 | 2020-05-08T17:36:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,602 | java | package com.craftmend.openaudiomc.generic.migrations;
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.generic.core.logging.OpenAudioLogger;
import com.craftmend.openaudiomc.generic.migrations.interfaces.SimpleMigration;
import com.craftmend.openaudiomc.generic.migrations.migrations.LocalClientToPlusMigration;
import com.craftmend.openaudiomc.generic.migrations.migrations.MouseHoverMessageMigration;
import com.craftmend.openaudiomc.generic.migrations.migrations.PlusAccessLevelMigration;
import lombok.NoArgsConstructor;
@NoArgsConstructor
public class MigrationWorker {
private final SimpleMigration[] migrations = new SimpleMigration[] {
new LocalClientToPlusMigration(), // migrates old users to 6.2 and uploads old data to oa+, then resets config
new PlusAccessLevelMigration(), // adds config values for the permissions patch
new MouseHoverMessageMigration() // adds a config field for the hover-to-connect message
};
public void handleMigrations(OpenAudioMc main) {
for (SimpleMigration migration : migrations) {
if (migration.shouldBeRun()) {
OpenAudioLogger.toConsole("Migration Service: Running migration " + migration.getClass().getSimpleName());
migration.execute();
OpenAudioLogger.toConsole("Migration Service: Finished migrating " + migration.getClass().getSimpleName());
} else {
OpenAudioLogger.toConsole("Skipping migration " + migration.getClass().getSimpleName());
}
}
}
}
| [
"matsmoolhuizen@gmail.com"
] | matsmoolhuizen@gmail.com |
f1ecfa88929f01468ad4aa6ea24c5163b9b64f09 | 9ebf17056aabea3f22213c6b4e2a953871d29e07 | /src/ru/geekbrains/lesson1/Main.java | 47f2ad641872bf6f190a2167304299fc51825cec | [] | no_license | irinazheltisheva/CheckSumSign | 4d148e666e9e7ad3f796116ba575d84221f53b05 | 2a0fa1c70b8201f4d3097c1e7d75e74fc7726a10 | refs/heads/master | 2023-06-18T20:42:24.610326 | 2021-07-18T22:19:19 | 2021-07-18T22:19:19 | 372,840,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,072 | java | package ru.geekbrains.lesson1;
public class Main {
public static void main(String[] args) {
// Создайте метод checkSumSign(), в теле которого объявите
// две int переменные a и b, и инициализируйте их любыми значениями,
// которыми захотите. Далее метод должен просуммировать эти переменные,
// и если их сумма больше или равна 0, то вывести в консоль сообщение
// “Сумма положительная”, в противном случае - “Сумма отрицательная”;
checkSumSign();
}
private static void checkSumSign() {
}
public static void checkSumSign(int a) {
a = 0;
if (a >= 0) {
System.out.print("Сумма положительная");
} else {
System.out.print("Сумма отрицательная");
}
}
}
| [
"70594426+irinazheltisheva@users.noreply.github.com"
] | 70594426+irinazheltisheva@users.noreply.github.com |
904d82533ad9ce6c1cbe268620ba0333807fa8f1 | fe0ef89aac4e5376a7f549500d7a80e510e4e447 | /Spring-13-UnitTesting-Mockito/src/main/java/com/ticketing/controller/UserController.java | 46afaf8fd1030cc918432b4b12d7ca69e62f9b05 | [] | no_license | nicolaevpetru/spring-framework | 3b593f50ae945703e524fed1e35d5bc68ca17e5b | 71e4d0049499596f8e819d7441cb8de1f9b72642 | refs/heads/main | 2023-03-16T13:48:07.276864 | 2021-03-06T19:01:46 | 2021-03-06T19:01:46 | 304,899,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,045 | java | package com.ticketing.controller;
import com.ticketing.dto.UserDTO;
import com.ticketing.exception.TicketingProjectException;
import com.ticketing.service.RoleService;
import com.ticketing.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
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 org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
RoleService roleService;
@Autowired
UserService userService;
@GetMapping("/create")
public String createUser(Model model) {
model.addAttribute("user", new UserDTO());
model.addAttribute("roles", roleService.listAllRoles());
model.addAttribute("users", userService.listAllUsers());
return "/user/create";
}
@PostMapping("/create")
public String insertUser(UserDTO user, Model model) {
userService.save(user);
return "redirect:/user/create";
}
//
@GetMapping("/update/{username}")
public String editUser(@PathVariable("username") String username, Model model) {
model.addAttribute("user", userService.findByUserName(username));
model.addAttribute("users", userService.listAllUsers());
model.addAttribute("roles", roleService.listAllRoles());
return "/user/update";
}
@PostMapping("/update/{username}")
public String updateUser(@PathVariable("username") String username, UserDTO user, Model model) {
userService.update(user);
return "redirect:/user/create";
}
@GetMapping("/delete/{username}")
public String deleteUser(@PathVariable("username") String username) throws TicketingProjectException {
userService.delete(username);
return "redirect:/user/create";
}
}
| [
"nicolaevpetru@outlook.com"
] | nicolaevpetru@outlook.com |
50ee6cf33c4d832171efff3eafa0ab93a3e38b59 | 14cfb69d9f5660fdae8ad2c2b57e8cbbbd83f263 | /source/patric-portlets/patric-core-identity-ui-lib/src/edu/vt/vbi/patric/core/identity/ui/validators/EmailValidator.java | 38f1e45478e011f3b4d138e5a0a466973af24151 | [] | no_license | cidvbi/PATRIC | 81193725f1578f02669580a69171dd57ebb0f70d | 5ee86b861ff4a3b0c928d2cdc24ba3e1c8de3678 | refs/heads/master | 2021-01-10T18:45:20.333680 | 2014-03-28T20:13:42 | 2014-03-28T20:13:42 | 5,770,914 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,701 | java | /*******************************************************************************
* Copyright 2014 Virginia Polytechnic Institute and State University
*
* 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 edu.vt.vbi.patric.core.identity.ui.validators;
//import org.jboss.portal.identity.UserModule;
import edu.vt.vbi.patric.identity.UserModule;
import java.util.ResourceBundle;
import java.util.regex.Pattern;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import javax.portlet.PortletContext;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.NoSuchUserException;
public class EmailValidator implements Validator {
private static final String EMAIL_VALIDATION = "^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$";
private UserModule userModule;
private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(EmailValidator.class);
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", context.getViewRoot().getLocale());
if (value != null) {
if (!(value instanceof String)) {
throw new IllegalArgumentException("The value must be a String");
}
//System.out.println("PATRIC version EmailValidator");
// check database
PortletContext portletContext = (PortletContext)context.getExternalContext().getContext();
userModule = (UserModule)portletContext.getAttribute("UserModule");
try {
userModule.findUserByUserEmail(value.toString());
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
bundle.getString("IDENTITY_VALIDATION_ERROR_EMAIL_TAKEN"),
bundle.getString("IDENTITY_VALIDATION_ERROR_EMAIL_TAKEN")));
}
catch (NoSuchUserException e) {
// No user found - proceed
}
catch (IllegalArgumentException e) {
log.error("EmailValidator: IllegalArgumentException");
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
bundle.getString("IDENTITY_VALIDATION_ERROR_EMAIL_ERROR"),
bundle.getString("IDENTITY_VALIDATION_ERROR_EMAIL_ERROR")));
}
catch (IdentityException e) {
log.error("EmailValidator: IdentityException");
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
bundle.getString("IDENTITY_VALIDATION_ERROR_EMAIL_ERROR"),
bundle.getString("IDENTITY_VALIDATION_ERROR_EMAIL_ERROR")));
}
// check pattern
if (!Pattern.matches(EMAIL_VALIDATION, (String) value)) {
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
bundle.getString("IDENTITY_VALIDATION_ERROR_INVALID_EMAIL"),
bundle.getString("IDENTITY_VALIDATION_ERROR_INVALID_EMAIL")));
}
}
else {
throw new ValidatorException(new FacesMessage("Required"));
}
}
}
| [
"hyun@vbi.vt.edu"
] | hyun@vbi.vt.edu |
a076d1233f9e26dde653210c29b730c32bb5adf8 | 2bab01f90359566b2107bad370e090e86dd85889 | /src/textures/ModelTexture.java | 8d873bba19de309f24103950ab50e9618f8c1e1e | [] | no_license | jeroenvermazeren/CrazyGolf | 8e6814de8d6d8c7a1b81d80eec805fa8fc87c05b | b5090d2e2eb44b65871c029e58fe19ac5c95d658 | refs/heads/master | 2021-09-14T01:41:51.648917 | 2018-05-07T10:22:44 | 2018-05-07T10:22:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | package textures;
/**
* This class is used for storing a texture of a model
*/
public class ModelTexture {
private int textureID;
private boolean hasTransparency = false;
private boolean useFakeLighting = false;
private int numberOfRows = 1;
public int getNumberOfRows() {
return numberOfRows;
}
public void setNumberOfRows(int numberOfRows) {
this.numberOfRows = numberOfRows;
}
public ModelTexture(int id) {
this.textureID = id;
}
public boolean isUseFakeLighting() {
return useFakeLighting;
}
public void setUseFakeLighting(boolean useFakeLighting) {
this.useFakeLighting = useFakeLighting;
}
public int getTextureID() { return this.textureID; }
public boolean isHasTransparency() {
return hasTransparency;
}
public void setHasTransparency(boolean hasTransparency) {
this.hasTransparency = hasTransparency;
}
}
| [
"jeroenvermazeren@outlook.com"
] | jeroenvermazeren@outlook.com |
c3fdc2a00a729cb920e2b9c5121a0a77b4a87cfe | fdbe606ddf3bc9b639f87a46d0fdf1ba0655e7fb | /src/test/java/com/bootdo/testDemo/springMybatis/MapperInvocationHandler.java | 91ebd51f4d80a4b5ff91d14ba18869a1c97dc47a | [] | no_license | yufeifan0816/bootdo | ee76347ca06bfc55a67db69517329cfa53dc8787 | 71e4f31b2f5b5f2266d059cfd320d1fcbe02db3a | refs/heads/master | 2022-10-30T19:01:26.838461 | 2022-04-14T07:24:47 | 2022-04-14T07:24:47 | 186,380,750 | 0 | 0 | null | 2022-10-12T20:26:34 | 2019-05-13T08:45:17 | JavaScript | UTF-8 | Java | false | false | 739 | java | package com.bootdo.testDemo.springMybatis;
import org.apache.ibatis.annotations.Select;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/**
* @program: bootdo
* @description:
* @author: yufeiafn@wondersgroup.com
* @create: 2019-09-03 15:08
**/
public class MapperInvocationHandler implements InvocationHandler {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if(method.getName().equals("queryAll")){
Select annotation = method.getAnnotation(Select.class);
String[] value = annotation.value();
System.out.println(value[0]);
}
return null;
}
}
| [
"994917004"
] | 994917004 |
c4d5d6dfa31331afb39a83a70706706bae540c35 | bd7b2f839e76e37bf8a3fd841a7451340f7df7a9 | /archunit-example/example-plain/src/main/java/com/tngtech/archunit/example/layers/service/Async.java | 9776066e6f5076fc15e26c82164aa540c074a70e | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | TNG/ArchUnit | ee7a1cb280360481a004c46f9861c5db181d7335 | 87cc595a281f84c7be6219714b22fbce337dd8b1 | refs/heads/main | 2023-09-01T14:18:52.601280 | 2023-08-29T09:15:13 | 2023-08-29T09:15:13 | 88,962,042 | 2,811 | 333 | Apache-2.0 | 2023-09-14T08:11:13 | 2017-04-21T08:39:20 | Java | UTF-8 | Java | false | false | 203 | java | package com.tngtech.archunit.example.layers.service;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)
public @interface Async {
}
| [
"peter.gafert@tngtech.com"
] | peter.gafert@tngtech.com |
3af4156a3a758050cec0e10dcc860dc8a0b152c1 | 946c02065b7b07fcc864a15f705b1404a09a3f6a | /JL/src/edu/pry/type/model/Type.java | 24b40c3574f2d0bb0f4a7f378eb8a50a8f9d70af | [] | no_license | pangqq7464/cs | bf038773ea4bd32c0fb3b3d03a344c9e57130e6f | 03496c89dbcad73f463ec0b86fd49935300c0b26 | refs/heads/master | 2022-12-09T08:29:24.166075 | 2020-09-01T02:06:48 | 2020-09-01T02:06:48 | 283,929,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package edu.pry.type.model;
public class Type {
private Integer type_id;
private String type_name;
public Integer getType_id() {
return type_id;
}
public void setType_id(Integer type_id) {
this.type_id = type_id;
}
public String getType_name() {
return type_name;
}
public void setType_name(String type_name) {
this.type_name = type_name;
}
}
| [
"pqq7464@163.com"
] | pqq7464@163.com |
f963647c01aa7432a7a5425d32a7b4f0a1748ba1 | 0e5bc172ff5f3969745a57a62e7a249b69713838 | /Gim/src/main/java/com/gim/entity/Iwd_Hdr_Dtl.java | be7a9389abb3c1b1318c22795a471420e981757f | [] | no_license | Wondersmind/gim1 | 35d21854125c6b4090616c75fe910c9a8a16cf98 | d84c7a635740d5f289cd3a5ea791e53c9b97617a | refs/heads/master | 2020-03-26T23:41:53.992972 | 2018-08-21T12:19:44 | 2018-08-21T12:19:44 | 145,560,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,318 | java | package com.gim.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Index;
@Entity
@Table(name="iwd_hdr_dtl")
public class Iwd_Hdr_Dtl implements Serializable{
private Long ihd_id;
private String ihd_doc_no;
private String ihd_cmy_cd;
private String ihd_str_cd;
private String ihd_iwd_typ;
private String ihd_vndr_cd;
private String ihd_vndr_inc_no;
private String ihd_vndr_inc_dt;
private String ihd_dpt_cd;
private String ihd_pdt_cd;
private String ihd_pdt_qty;
private String ihd_mtl_wgt;
private String ihd_dc_isd;
private String ihd_rcvd_prty;
private String ihd_doc_val;
private String ihd_pgm_cal;
private String ihd_pure_gld_wgt;
private String ihd_crt_dt;
private String ihd_crt_id;
private String ihd_updt_dt;
private String ihd_updt_id;
private boolean ihd_iwd_sts;
private boolean ihd_iss_auth;
@Id
@GeneratedValue
public Long getIhd_id() {
return ihd_id;
}
public void setIhd_id(Long ihd_id) {
this.ihd_id = ihd_id;
}
@Index(name="doc_no_index")
public String getIhd_doc_no() {
return ihd_doc_no;
}
public void setIhd_doc_no(String ihd_doc_no) {
this.ihd_doc_no = ihd_doc_no;
}
public String getIhd_cmy_cd() {
return ihd_cmy_cd;
}
public void setIhd_cmy_cd(String ihd_cmy_cd) {
this.ihd_cmy_cd = ihd_cmy_cd;
}
public String getIhd_str_cd() {
return ihd_str_cd;
}
public void setIhd_str_cd(String ihd_str_cd) {
this.ihd_str_cd = ihd_str_cd;
}
public String getIhd_iwd_typ() {
return ihd_iwd_typ;
}
public void setIhd_iwd_typ(String ihd_iwd_typ) {
this.ihd_iwd_typ = ihd_iwd_typ;
}
public String getIhd_vndr_cd() {
return ihd_vndr_cd;
}
public void setIhd_vndr_cd(String ihd_vndr_cd) {
this.ihd_vndr_cd = ihd_vndr_cd;
}
public String getIhd_vndr_inc_no() {
return ihd_vndr_inc_no;
}
public void setIhd_vndr_inc_no(String ihd_vndr_inc_no) {
this.ihd_vndr_inc_no = ihd_vndr_inc_no;
}
public String getIhd_vndr_inc_dt() {
return ihd_vndr_inc_dt;
}
public void setIhd_vndr_inc_dt(String ihd_vndr_inc_dt) {
this.ihd_vndr_inc_dt = ihd_vndr_inc_dt;
}
public String getIhd_dpt_cd() {
return ihd_dpt_cd;
}
public void setIhd_dpt_cd(String ihd_dpt_cd) {
this.ihd_dpt_cd = ihd_dpt_cd;
}
@Index(name="pdt_cd_index")
public String getIhd_pdt_cd() {
return ihd_pdt_cd;
}
public void setIhd_pdt_cd(String ihd_pdt_cd) {
this.ihd_pdt_cd = ihd_pdt_cd;
}
public String getIhd_mtl_wgt() {
return ihd_mtl_wgt;
}
public void setIhd_mtl_wgt(String ihd_mtl_wgt) {
this.ihd_mtl_wgt = ihd_mtl_wgt;
}
public String getIhd_rcvd_prty() {
return ihd_rcvd_prty;
}
public void setIhd_rcvd_prty(String ihd_rcvd_prty) {
this.ihd_rcvd_prty = ihd_rcvd_prty;
}
public String getIhd_doc_val() {
return ihd_doc_val;
}
public void setIhd_doc_val(String ihd_doc_val) {
this.ihd_doc_val = ihd_doc_val;
}
public String getIhd_pgm_cal() {
return ihd_pgm_cal;
}
public void setIhd_pgm_cal(String ihd_pgm_cal) {
this.ihd_pgm_cal = ihd_pgm_cal;
}
public String getIhd_pure_gld_wgt() {
return ihd_pure_gld_wgt;
}
public void setIhd_pure_gld_wgt(String ihd_pure_gld_wgt) {
this.ihd_pure_gld_wgt = ihd_pure_gld_wgt;
}
public String getIhd_crt_dt() {
return ihd_crt_dt;
}
public void setIhd_crt_dt(String ihd_crt_dt) {
this.ihd_crt_dt = ihd_crt_dt;
}
public String getIhd_crt_id() {
return ihd_crt_id;
}
public void setIhd_crt_id(String ihd_crt_id) {
this.ihd_crt_id = ihd_crt_id;
}
public String getIhd_updt_dt() {
return ihd_updt_dt;
}
public void setIhd_updt_dt(String ihd_updt_dt) {
this.ihd_updt_dt = ihd_updt_dt;
}
public String getIhd_updt_id() {
return ihd_updt_id;
}
public void setIhd_updt_id(String ihd_updt_id) {
this.ihd_updt_id = ihd_updt_id;
}
public boolean isIhd_iwd_sts() {
return ihd_iwd_sts;
}
public void setIhd_iwd_sts(boolean ihd_iwd_sts) {
this.ihd_iwd_sts = ihd_iwd_sts;
}
@Override
public String toString() {
return "Iwd_Hdr_Dtl [ihd_id=" + ihd_id + ", ihd_doc_no=" + ihd_doc_no + ", ihd_cmy_cd=" + ihd_cmy_cd
+ ", ihd_str_cd=" + ihd_str_cd + ", ihd_iwd_typ=" + ihd_iwd_typ + ", ihd_vndr_cd=" + ihd_vndr_cd
+ ", ihd_vndr_inc_no=" + ihd_vndr_inc_no + ", ihd_vndr_inc_dt=" + ihd_vndr_inc_dt + ", ihd_dpt_cd="
+ ihd_dpt_cd + ", ihd_pdt_cd=" + ihd_pdt_cd + ", ihd_pdt_qty=" + ihd_pdt_qty + ", ihd_mtl_wgt="
+ ihd_mtl_wgt + ", ihd_dc_isd=" + ihd_dc_isd + ", ihd_rcvd_prty=" + ihd_rcvd_prty + ", ihd_doc_val="
+ ihd_doc_val + ", ihd_pgm_cal=" + ihd_pgm_cal + ", ihd_pure_gld_wgt=" + ihd_pure_gld_wgt + ", ihd_crt_dt="
+ ihd_crt_dt + ", ihd_crt_id=" + ihd_crt_id + ", ihd_updt_dt=" + ihd_updt_dt + ", ihd_updt_id="
+ ihd_updt_id + ", ihd_iwd_sts=" + ihd_iwd_sts + ", ihd_iss_auth=" + ihd_iss_auth + "]";
}
public boolean isIhd_iss_auth() {
return ihd_iss_auth;
}
public void setIhd_iss_auth(boolean ihd_iss_auth) {
this.ihd_iss_auth = ihd_iss_auth;
}
public String getIhd_pdt_qty() {
return ihd_pdt_qty;
}
public void setIhd_pdt_qty(String ihd_pdt_qty) {
this.ihd_pdt_qty = ihd_pdt_qty;
}
public String getIhd_dc_isd() {
return ihd_dc_isd;
}
public void setIhd_dc_isd(String ihd_dc_isd) {
this.ihd_dc_isd = ihd_dc_isd;
}
}
| [
"wondersmind123@gmail.com"
] | wondersmind123@gmail.com |
f6e6ea59eef0a93ec7cd8f7493b4b4f52e064cbc | ddeea13e5be89c622cbfe9b9f312462c38aec6cd | /Android Code/Local Mode/src/com/iitb/localclicker/Registration_helpActivtiy.java | 2d61730306588ed21ab87a5550bd71a86fbbdc51 | [] | no_license | iitbaakash/Clicker | 9c104e2b5085499f8c45552c9369f12aecb791d1 | 40a65888189253485599cd62724f5637664cc105 | refs/heads/master | 2021-04-12T04:33:22.067785 | 2013-06-27T07:04:21 | 2013-06-27T07:04:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,187 | java |
// This activity opens the help screen during registration when user clicks on Help Menu.
package com.iitb.localclicker;//package of the project.
//List of necessary android and input-output java classes.
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import android.app.Activity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;
//Registration_helpActivtiy begins.
public class Registration_helpActivtiy extends Activity
{
/** Called when the activity is first created. */
public void onCreate(Bundle save)
{
super.onCreate(save);// Always call the superclass method first.
setContentView(R.layout.help);// refer to help.xml .
InputStream in=getResources().openRawResource(R.raw.registration_help);//open the registration_help.txt file present in raw folder.
String text = loadFile(in);// call loadFile() method.
TextView content = (TextView)findViewById(R.id.help_content);//refer to textview having help_content id in help.xml.
content.setMovementMethod(new ScrollingMovementMethod());// set scroll movement to Text View
content.setText(text);//set the text of registration_help.txt.
}
//Method to handle file input/output operation.
public String loadFile(InputStream inputStream)
{
ByteArrayOutputStream b = new ByteArrayOutputStream();// initialize ByteArrayOutputStream object.
byte[] bytes = new byte[4096];// initialize byte object.
int read;
while(true)// loop until file operation terminates.
{
try // try-catch block for handling IO Exceptions.
{
read = inputStream.read(bytes);//read bytes of file.
if (read == -1)//check if file is empty
break;
b.write(bytes, 0, read);//write bytes to byte array.
return new String(b.toByteArray(), "UTF-8");//return the string representation of byte array.
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;//return null if file is empty/exception occurs.
}
}
//Registration_helpActivtiy ends.
| [
"ninadchilap@gmail.com"
] | ninadchilap@gmail.com |
16274b0a19a44421b9a01446f78c426a49dc8d48 | e7e497b20442a4220296dea1550091a457df5a38 | /main_project/search/LuceneTest/src/UserSearcher.java | 940c64bd91fd6b060204acc4a77202fd177087e7 | [] | no_license | gunner14/old_rr_code | cf17a2dedf8dfcdcf441d49139adaadc770c0eea | bb047dc88fa7243ded61d840af0f8bad22d68dee | refs/heads/master | 2021-01-17T18:23:28.154228 | 2013-12-02T23:45:33 | 2013-12-02T23:45:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,285 | java | import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Filter;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.Weight;
public class UserSearcher extends RenrenSearcher {
// private static Log logger_ = LogFactory.getLog(UserSearcher.class);
private int ids_[];
private Map<Integer, Integer> uid2Id_ = new HashMap<Integer, Integer>();
public UserSearcher(IndexReader reader, String filepath)
throws CorruptIndexException, IOException {
super(reader);
ids_ = loadIDs(filepath);// 加载ID
}
@Override
public void search(Weight weight, Filter filter, Collector collector)
throws IOException {
if (collector instanceof RelationCollector) {
((RelationCollector) collector).setRelation(uid2Id_, ids_);
}
if (filter == null) {
for (int i = 0; i < subReaders.length; i++) { // search each
// subreader
collector.setNextReader(subReaders[i], docStarts[i]);
Scorer scorer = weight.scorer(subReaders[i],
!collector.acceptsDocsOutOfOrder(), true);
if (scorer != null) {
scorer.score(collector);
}
}
} else {
for (int i = 0; i < subReaders.length; i++) { // search each
// subreader
collector.setNextReader(subReaders[i], docStarts[i]);
searchWithFilter(subReaders[i], weight, filter, collector);
}
}
}
private void searchWithFilter(IndexReader reader, Weight weight,
final Filter filter, final Collector collector) throws IOException {
assert filter != null;
Scorer scorer = weight.scorer(reader, true, false);
if (scorer == null) {
return;
}
int docID = scorer.docID();
assert docID == -1 || docID == DocIdSetIterator.NO_MORE_DOCS;
// CHECKME: use ConjunctionScorer here?
DocIdSet filterDocIdSet = filter.getDocIdSet(reader);
if (filterDocIdSet == null) {
// this means the filter does not accept any documents.
return;
}
DocIdSetIterator filterIter = filterDocIdSet.iterator();
if (filterIter == null) {
// this means the filter does not accept any documents.
return;
}
int filterDoc = filterIter.nextDoc();
int scorerDoc = scorer.advance(filterDoc);
collector.setScorer(scorer);
while (true) {
if (scorerDoc == filterDoc) {
// Check if scorer has exhausted, only before collecting.
if (scorerDoc == DocIdSetIterator.NO_MORE_DOCS) {
break;
}
collector.collect(scorerDoc);
filterDoc = filterIter.nextDoc();
scorerDoc = scorer.advance(filterDoc);
} else if (scorerDoc > filterDoc) {
filterDoc = filterIter.advance(scorerDoc);
} else {
scorerDoc = scorer.advance(filterDoc);
}
}
}
public Document doc(int docid) throws CorruptIndexException, IOException {
if (0 <= docid && docid < ids_.length) {
Document doc = new Document();
doc.add(new Field("user_basic.id", String.valueOf(ids_[docid]),
Field.Store.YES, Field.Index.NOT_ANALYZED));
return doc;
}
throw new IOException("Cannot find userid for docid " + docid);
}
public Document[] docidsToDocuments(int[] docids) throws IOException {
Document[] documents = new Document[docids.length];
for (int i = 0; i < docids.length; ++i) {
int docid = docids[i];
documents[i] = this.doc(docid);
}
return documents;
}
public int[] docidsToIDs(int[] docids) throws IOException {
int[] ids = new int[docids.length];
for (int i = 0; i < docids.length; ++i) {
int docid = docids[i];
if (0 <= docid && docid < ids_.length) {
ids[i] = ids_[docid];
} else {
throw new IOException("Cannot find userid for docid " + docid);
}
}
return ids;
}
/** 加载ID **/
private int[] loadIDs(String filepath) throws IOException {
System.out.println("loading docmap " + filepath);
try {
RandomAccessFile docfile = new RandomAccessFile(filepath, "r");
long filelength = docfile.length();
int length = (int) (filelength / 8 + 1);
int[] ids = new int[length];
byte[] docid_bytes = new byte[4];
byte[] userid_bytes = new byte[4];
int docid = 0;
int userid = 0;
int res = 0;
for (;;) {
// 读取前四个字节到docid_bytes,返回读取到的字节数
res = docfile.read(docid_bytes, 0, 4);
if (res <= 0) {
break;
}
// 再读取四个字节到userid_bytes,返回读取到的字节数
res = docfile.read(userid_bytes, 0, 4);
if (res <= 0) {
break;
}
// 将他们转为int值
docid = ((docid_bytes[0] & 0xFF) << 24)
| ((docid_bytes[1] & 0xFF) << 16)
| ((docid_bytes[2] & 0xFF) << 8)
| (docid_bytes[3] & 0xFF);
userid = ((userid_bytes[0] & 0xFF) << 24)
| ((userid_bytes[1] & 0xFF) << 16)
| ((userid_bytes[2] & 0xFF) << 8)
| (userid_bytes[3] & 0xFF);
if (docid < ids.length) {
ids[docid] = userid;
uid2Id_.put(userid, docid);
//System.out.println(userid + " " + docid);
} else {
throw new IOException("docid >= length: " + docid + " >= "
+ ids.length);
}
}
System.out.println("loading docmap " + filepath + "...done");
return ids;
} catch (FileNotFoundException e) {
// ExceptionUtil.logException(e, logger_);
throw new IOException("File cannot be open: " + filepath);
}
}
@Override
public TopDocs search(Weight weight, Filter filter, int nDocs,
List<Integer> fids, List<Integer> commons) throws IOException {
RelationCollector collector = new RelationCollector(nDocs, fids,
commons);
try {
search(weight, filter, collector);
return collector.topDocs();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
| [
"liyong19861014@gmail.com"
] | liyong19861014@gmail.com |
cfd7c80090477f851a6fa72e977e847cdfb6b8a4 | f01fabb08f8e18a54991b49622d5700d13d2e986 | /app/src/main/java/com/satvick/model/Info_Checkbox.java | d3acb72c5fb72845ba30a11ca36000c083ecac27 | [] | no_license | atanvir/Satvik | 28753b603f53eefbc7077f03ba5057428f1f61d9 | 23e10f93adadbae39514e917dcbb41bf55ca45c0 | refs/heads/master | 2023-07-16T06:24:12.783851 | 2021-08-27T13:16:14 | 2021-08-27T13:16:14 | 336,251,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package com.satvick.model;
import com.google.gson.annotations.SerializedName;
public class Info_Checkbox {
@SerializedName("id")
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
| [
"abhishek.pathak@mobulous.com"
] | abhishek.pathak@mobulous.com |
e408a87b4aa1ab713c97afded57bf4dd9fcac869 | 394ac6e73e0e5c09ebbf90e9518a5575345814a1 | /app/src/main/java/com/liweisheng/activity/Note/NoteActivity.java | 1f672856322ad33793fbdccd48c15ba0abf08b9c | [] | no_license | lwsdegithub/VoiceToAtical | 55818c8d800091ceed3cf1d34e9cac5a3cb472f8 | 41679013d3f49ebe5a81e3586fd4b5b167de0ec3 | refs/heads/master | 2021-05-06T03:48:40.583572 | 2018-04-13T04:45:58 | 2018-04-13T04:45:58 | 114,885,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,781 | java | package com.liweisheng.activity.Note;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.github.hiteshsondhi88.libffmpeg.ExecuteBinaryResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.FFmpeg;
import com.github.hiteshsondhi88.libffmpeg.LoadBinaryResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException;
import com.iflytek.cloud.ErrorCode;
import com.iflytek.cloud.InitListener;
import com.iflytek.cloud.RecognizerListener;
import com.iflytek.cloud.RecognizerResult;
import com.iflytek.cloud.SpeechConstant;
import com.iflytek.cloud.SpeechError;
import com.iflytek.cloud.SpeechRecognizer;
import com.iflytek.cloud.SpeechUtility;
import com.leon.lfilepickerlibrary.LFilePicker;
import com.leon.lfilepickerlibrary.utils.Constant;
import com.liweisheng.R;
import com.liweisheng.base.BaseActivity;
import com.liweisheng.constant.ConstantData;
import com.liweisheng.util.JsonParser;
import com.liweisheng.util.StringFactory;
import com.liweisheng.view.Dialog.SaveFileDialogBuilder;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* Created by 李维升 on 2017/12/20.
* 这是基于科大讯飞语音识别系统的Activity
*/
public class NoteActivity extends BaseActivity implements View.OnClickListener {
private ImageView backBtn;
private TextView numberOfNote;
private TextView completeBtn;
private EditText noteEt;
private ImageView speakBtn;
private SpeechRecognizer speechRecognizer;
private TextView isSpeaking;
private ImageView upLoadFile;
private String oldAudioPath;
private String newAudioPath;
private SaveFileDialogBuilder saveFileDialogBuilder;
//转码
private FFmpeg fFmpeg;
private StringBuffer stringBuffer=new StringBuffer();
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_note_main);
//创建语音配置对象
SpeechUtility.createUtility(this, SpeechConstant.APPID + "=" + ConstantData.APP_ID_FOR_XF);
//调用初始化界面方法
this.initView();
}
private void initView(){
backBtn = findViewById(R.id.iv_back);
backBtn.setOnClickListener(this);
numberOfNote = findViewById(R.id.tv_num_of_note);
completeBtn = findViewById(R.id.tv_complete);
completeBtn.setOnClickListener(this);
noteEt = findViewById(R.id.et_note);
//设置文字变动监听,用于监听字数的变化
noteEt.addTextChangedListener(textWatcher);
speakBtn = findViewById(R.id.iv_speak);
speakBtn.setOnClickListener(this);
isSpeaking = findViewById(R.id.tv_is_speaking);
upLoadFile = findViewById(R.id.iv_upload_file);
upLoadFile.setOnClickListener(this);
speechRecognizer=SpeechRecognizer.createRecognizer(this,initListener);
initSpeechRecognizer();
initFFmpeg();
}
//初始化ffmpeg
private void initFFmpeg(){
fFmpeg=FFmpeg.getInstance(this);
try {
fFmpeg.loadBinary(new LoadBinaryResponseHandler(){
@Override
public void onFailure() {
Toast.makeText(getApplicationContext(),"初始化转码工具失败,您的设备可能不支持",Toast.LENGTH_LONG).show();
super.onFailure();
}
});
} catch (FFmpegNotSupportedException e) {
e.printStackTrace();
}
}
//初始化语音听写参数
private void initSpeechRecognizer(){
//设置为日常用语
speechRecognizer.setParameter(SpeechConstant.DOMAIN,"iat");
//设置为云端处理
speechRecognizer.setParameter(SpeechConstant.ENGINE_TYPE,"cloud");
// 接受的语言是普通话
speechRecognizer.setParameter(SpeechConstant.ACCENT, "mandarin ");
// 接收语言中文
speechRecognizer.setParameter(SpeechConstant.LANGUAGE, "zh_cn");
//持续唤醒
speechRecognizer.setParameter(SpeechConstant.KEEP_ALIVE,"1");
//录取音频最长时间为无限
speechRecognizer.setParameter(SpeechConstant.KEY_SPEECH_TIMEOUT,"-1");
}
@Override
public void onClick(View view) {
int id=view.getId();
switch (id){
//点击返回按钮
case R.id.iv_back:
this.finish();
break;
//点击完成按钮,以txt格式保存在date中
case R.id.tv_complete:
try {
saveFileDialogBuilder=new SaveFileDialogBuilder(this,noteEt.getText().toString());
} catch (IOException e) {
e.printStackTrace();
}
saveFileDialogBuilder.create().show();
break;
//点击说话按钮
case R.id.iv_speak:
speechRecognizer.setParameter(SpeechConstant.AUDIO_SOURCE,"1");
speechRecognizer.startListening(recognizerListener);
isSpeaking.setText("正在听写...");
break;
//点击上传录音,调用系统文件选择框,选择文件并使用回调接口
case R.id.iv_upload_file:
new LFilePicker().withActivity(NoteActivity.this).withMutilyMode(false)
.withRequestCode(ConstantData.FILE_SELECT_CODE).withTitle("选择音频").withFileFilter(ConstantData.audioForms)
.withBackgroundColor("#b3c9b4").start();
break;
}
}
//初始化监听接口
private InitListener initListener=new InitListener() {
@Override
public void onInit(int code) {
if (code!= ErrorCode.SUCCESS){
Log.e("doSuccess","初始化失败,错误码是"+code);
// showTip("初始化失败,错误码:" + code);
Toast.makeText(getApplicationContext(),"初始化失败,错误码:" + code,
Toast.LENGTH_SHORT).show();
}else {
Log.e("doSuccess","初始化成功,返回码"+code);
}
}
};
//语音识别接口
private RecognizerListener recognizerListener=new RecognizerListener() {
@Override
public void onVolumeChanged(int i, byte[] bytes) {
}
@Override
public void onBeginOfSpeech() {
}
@Override
public void onEndOfSpeech() {
isSpeaking.setText("请重新点击听写");
}
@Override
public void onResult(RecognizerResult recognizerResult, boolean b) {
Log.e("results",recognizerResult.getResultString());
stringBuffer.append(JsonParser.parserRecognizerResult(recognizerResult.getResultString()));
if (b) {
noteEt.setText(stringBuffer.toString());
noteEt.setSelection(stringBuffer.length());
}
try {
//使用本地录音,识别成功后删除转码后的文件
if (oldAudioPath!=newAudioPath){
File file=new File(newAudioPath);
file.delete();
}
}catch (Exception e){
}
}
@Override
public void onError(SpeechError speechError) {
isSpeaking.setText("出现错误");
Toast.makeText(getApplicationContext(),speechError.getErrorDescription(),Toast.LENGTH_SHORT).show();
}
@Override
public void onEvent(int i, int i1, int i2, Bundle bundle) {
}
};
//监听字数变化,监听有没有编辑
private TextWatcher textWatcher=new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
int i=editable.length();
numberOfNote.setText(String.valueOf(i)+"字");
//编辑时清除StringBuffer的内容,并且重新添加
stringBuffer.delete(0,stringBuffer.length());
stringBuffer.append(noteEt.getText());
}
};
//选择文件时回调接口
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != Activity.RESULT_OK) {
super.onActivityResult(requestCode, resultCode, data);
return;
}
if (requestCode == ConstantData.FILE_SELECT_CODE) {
List<String> filePathList=data.getStringArrayListExtra(Constant.RESULT_INFO);
oldAudioPath=filePathList.get(0);
newAudioPath= StringFactory.getNewPath(oldAudioPath);
String[] cmd=StringFactory.getCmd(oldAudioPath,newAudioPath);
try {
fFmpeg.execute(cmd,executeBinaryResponseHandler);
} catch (FFmpegCommandAlreadyRunningException e) {
e.printStackTrace();
}
}
super.onActivityResult(requestCode, resultCode, data);
}
//转码回调接口
private ExecuteBinaryResponseHandler executeBinaryResponseHandler=new ExecuteBinaryResponseHandler(){
@Override
public void onStart() {
super.onStart();
}
@Override
public void onFailure(String message) {
Log.i("执行失败", "------->" +message);
super.onFailure(message);
}
@Override
public void onFinish() {
speechRecognizer.setParameter(SpeechConstant.AUDIO_SOURCE,"-2");
speechRecognizer.setParameter(SpeechConstant.ASR_SOURCE_PATH,newAudioPath);
speechRecognizer.startListening(recognizerListener);
super.onFinish();
}
@Override
public void onProgress(String message) {
Log.i("执行中", "------->" +message);
super.onProgress(message);
}
@Override
public void onSuccess(String message) {
Log.i("执行成功", "------->" +message);
super.onSuccess(message);
}
};
}
| [
"1904792432@qq.com"
] | 1904792432@qq.com |
ddef4d92ee40ca2af759a3ed336bab7a875fb127 | 8bb9cd855366217336d399fdb945c0835d80a2ee | /app/src/main/java/com/jerey/keepgank/api/Config.java | afc3e6cdd2415bbf930a65a7c9d34c0aeb4eb6fb | [
"Apache-2.0"
] | permissive | deviche/KeepGank | dd03b20dffa705b3d085d0b13d1a972241a38c03 | 776b35819f1e713514420d0ba0f5efedd95a2025 | refs/heads/master | 2020-03-27T08:34:33.013281 | 2018-03-25T06:30:58 | 2018-03-25T06:30:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 899 | java | package com.jerey.keepgank.api;
import android.support.annotation.StringDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public class Config {
@StringDef({TYPE_ANDROID, TYPE_IOS,TYPE_FRONT_END,TYPE_RECOMMEND,TYPE_VIDEO,TYPE_GIRL,TYPE_RESOURCES})
@Retention(RetentionPolicy.SOURCE)
public @interface TYPE {}
public static final String TYPE_ANDROID = "Android";
public static final String TYPE_IOS = "iOS";
public static final String TYPE_FRONT_END = "前端";
public static final String TYPE_RECOMMEND = "瞎推荐";
public static final String TYPE_VIDEO = "休息视频";
public static final String TYPE_GIRL = "福利";
public static final String TYPE_RESOURCES = "拓展资源";
public static final String[] TYPES = {TYPE_ANDROID,TYPE_IOS,TYPE_FRONT_END,TYPE_RECOMMEND,TYPE_VIDEO,TYPE_RESOURCES};
}
| [
"610315802@qq.com"
] | 610315802@qq.com |
7d918e7767f7e1f34f44b084fbd424373492d426 | c4f908003ead8e3d7fa88cc721324a1bebd16a3f | /SlidingMenuDemo/src/com/ycr/pojo/PushInfo.java | a7e85a14aa4b8a7652d743b39c7f42f7c1344b22 | [] | no_license | xiaosabiluo/YKL | f0e5a4370b2a107689b9cd9bb71895c0d1e172c1 | 7afeb645eb4e5e01df47b3aa53f2f2c048ed75b8 | refs/heads/master | 2016-09-02T04:55:17.854264 | 2015-04-14T07:13:09 | 2015-04-14T07:13:09 | 33,341,067 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.ycr.pojo;
import java.io.Serializable;
public class PushInfo implements Serializable{
/**
*
*/
private static final long serialVersionUID = -852119845218829422L;
private String type;
private String content;
private String param;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
}
| [
"810726499@qq.com"
] | 810726499@qq.com |
ab493f479f6cc91ab4bf44dc09ce7191e7176f2a | b3b0a0fdc7dc9f30c8a1ab0981d8760f388052eb | /src/main/java/com/temp/designPatterns/command/calc/Client.java | ab0d9ee68953d7ec4667874b93fba0fa4ea04b27 | [
"Apache-2.0"
] | permissive | yyfyuyangfan/templete | 804298361fdbe90651866a5877f4dabc49a6c38f | 722a8c382f0d85494d7224fa5070acd96b56dd5f | refs/heads/master | 2021-01-23T02:48:26.435394 | 2017-09-05T06:25:27 | 2017-09-05T06:25:27 | 102,443,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package com.temp.designPatterns.command.calc;
public class Client {
public static void main(String[] args) {
OperationApi operationApi = new Operation(10);
Calculator calculator = new Calculator();
AddCommand addCommand = new AddCommand(operationApi);
addCommand.setOpeNum(5);
calculator.setAddCmd(addCommand);
calculator.addPressed();
System.out.println(operationApi.getPastResult() + " + " + addCommand.getOpeNum() + " = " + operationApi.getResult());
SubstractCommand substractCommand = new SubstractCommand(operationApi);
substractCommand.setOpeNum(3);
calculator.setSubCmd(substractCommand);
calculator.substractPressed();
System.out.println(operationApi.getPastResult() + " - " + substractCommand.getOpeNum() + " = " + operationApi.getResult());
calculator.undoPressed();
System.out.println("褰撳墠鍊�" + operationApi.getPastResult() + "鎾ら攢鍚庣殑鍊间负" + operationApi.getResult());
calculator.undoPressed();
System.out.println("褰撳墠鍊� "+ operationApi.getPastResult() + "鍐嶆鎾ら攢鍚庣殑鍊间负" + operationApi.getResult());
calculator.undoPressed();
}
}
| [
"1505883544@qq.com"
] | 1505883544@qq.com |
fa8eb5963673760376b546417458eee262af04dd | 4351490d151b8b1409bb13b65bc627c121085af0 | /app/src/main/java/com/example/jiangyue/androidap/views/animation/DefaultAnimationHandler.java | a7233fa67ed7106d96bc43152a8894e77257964c | [] | no_license | hun123456/android_aps | aed19413de1cb0f7fd1666bcdbf93c83eada590a | d523226bafa9beed5632d6862ef8dc290580dbb4 | refs/heads/master | 2020-04-15T05:22:35.610791 | 2017-04-10T07:49:04 | 2017-04-10T07:49:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,797 | java | /*
* Copyright 2014 Oguz Bilgener
*/
package com.example.jiangyue.androidap.views.animation;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.graphics.Point;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import com.example.jiangyue.androidap.views.FloatingActionMenu;
/**
* An example animation handler
* Animates translation, rotation, scale and alpha at the same time using Property Animation APIs.
*/
public class DefaultAnimationHandler extends MenuAnimationHandler {
/** duration of animations, in milliseconds */
protected static final int DURATION = 500;
/** duration to wait between each of */
protected static final int LAG_BETWEEN_ITEMS = 20;
/** holds the current state of animation */
private boolean animating;
public DefaultAnimationHandler() {
setAnimating(false);
}
@Override
public void animateMenuOpening(Point center) {
super.animateMenuOpening(center);
setAnimating(true);
Animator lastAnimation = null;
for (int i = 0; i < menu.getSubActionItems().size(); i++) {
menu.getSubActionItems().get(i).view.setScaleX(0);
menu.getSubActionItems().get(i).view.setScaleY(0);
menu.getSubActionItems().get(i).view.setAlpha(0);
PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, menu.getSubActionItems().get(i).x - center.x + menu.getSubActionItems().get(i).width / 2);
PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, menu.getSubActionItems().get(i).y - center.y + menu.getSubActionItems().get(i).height / 2);
PropertyValuesHolder pvhR = PropertyValuesHolder.ofFloat(View.ROTATION, 720);
PropertyValuesHolder pvhsX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
PropertyValuesHolder pvhsY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat(View.ALPHA, 1);
final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(menu.getSubActionItems().get(i).view, pvhX, pvhY, pvhR, pvhsX, pvhsY, pvhA);
animation.setDuration(DURATION);
animation.setInterpolator(new OvershootInterpolator(0.9f));
animation.addListener(new SubActionItemAnimationListener(menu.getSubActionItems().get(i), ActionType.OPENING));
if(i == 0) {
lastAnimation = animation;
}
// Put a slight lag between each of the menu items to make it asymmetric
animation.setStartDelay((menu.getSubActionItems().size() - i) * LAG_BETWEEN_ITEMS);
animation.start();
}
if(lastAnimation != null) {
lastAnimation.addListener(new LastAnimationListener());
}
}
@Override
public void animateMenuClosing(Point center) {
super.animateMenuOpening(center);
setAnimating(true);
Animator lastAnimation = null;
for (int i = 0; i < menu.getSubActionItems().size(); i++) {
PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, - (menu.getSubActionItems().get(i).x - center.x + menu.getSubActionItems().get(i).width / 2));
PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, - (menu.getSubActionItems().get(i).y - center.y + menu.getSubActionItems().get(i).height / 2));
PropertyValuesHolder pvhR = PropertyValuesHolder.ofFloat(View.ROTATION, -720);
PropertyValuesHolder pvhsX = PropertyValuesHolder.ofFloat(View.SCALE_X, 0);
PropertyValuesHolder pvhsY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0);
PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat(View.ALPHA, 0);
final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(menu.getSubActionItems().get(i).view, pvhX, pvhY, pvhR, pvhsX, pvhsY, pvhA);
animation.setDuration(DURATION);
animation.setInterpolator(new AccelerateDecelerateInterpolator());
animation.addListener(new SubActionItemAnimationListener(menu.getSubActionItems().get(i), ActionType.CLOSING));
if(i == 0) {
lastAnimation = animation;
}
animation.setStartDelay((menu.getSubActionItems().size() - i) * LAG_BETWEEN_ITEMS);
animation.start();
}
if(lastAnimation != null) {
lastAnimation.addListener(new LastAnimationListener());
}
}
@Override
public boolean isAnimating() {
return animating;
}
@Override
protected void setAnimating(boolean animating) {
this.animating = animating;
}
protected class SubActionItemAnimationListener implements Animator.AnimatorListener {
private FloatingActionMenu.Item subActionItem;
private ActionType actionType;
public SubActionItemAnimationListener(FloatingActionMenu.Item subActionItem, ActionType actionType) {
this.subActionItem = subActionItem;
this.actionType = actionType;
}
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
restoreSubActionViewAfterAnimation(subActionItem, actionType);
}
@Override
public void onAnimationCancel(Animator animation) {
restoreSubActionViewAfterAnimation(subActionItem, actionType);
}
@Override public void onAnimationRepeat(Animator animation) {}
}
}
| [
"454976341@qq.com"
] | 454976341@qq.com |
c08703d7c5575d15835bb45186c681cff600c3b9 | 2787c44d6cb2047ca2c433a82762bf89e82e64c9 | /AutomatMP1/src/automatmp1/LinePanel2.java | a03be0fb0a47f39a489faee55cd90f21c461aa63 | [] | no_license | joeysays/AUTOMATMPFINAL | e3b875a9839be4ea6995f8062d187ac928741b6d | 7df5636986a35f5d33d4bd364f720bf2bb882f84 | refs/heads/master | 2020-03-27T00:41:33.230680 | 2018-08-22T09:03:31 | 2018-08-22T09:03:31 | 145,646,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | 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 automatmp1;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
/**
*
* @author Belle
*/
public class LinePanel2 extends JPanel{
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawLine(0, 0, 0, 100);
g.setColor(Color.black);
g.drawLine(10, 0, 8, 100);
g.setColor(Color.black);
}
}
| [
"jose_vicente_sayson@dlsu.edu.ph"
] | jose_vicente_sayson@dlsu.edu.ph |
1657c9048264b585f9e485ebe1b8f5ea8b966efc | a3dbab2349c9d34a9c0f762420b3ce0423a865b9 | /JavaStudy/src/C01_Function.java | cfdceb954f439f648ba6da8f3e81984a67f941aa | [] | no_license | ParkCheonhyuk/JavaStudy | 0caa6b970d79742bf77110beeba8b00dc418a2d4 | ef2ee4419a972ff914021bfda64324c014e057d6 | refs/heads/main | 2023-06-12T00:27:43.804312 | 2021-07-08T12:43:08 | 2021-07-08T12:43:08 | 381,996,901 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,998 | java | import java.util.Scanner;
public class C01_Function {
/*
# 함수 (Function)
- 기능을 미리 정의해두고 나중에 가져다 쓰는 것
- 정의한 시점에서는 실행되지 않고,
함수 이름 뒤에 ()를 붙여서 함수를 호출하면 실행된다
- 나중에 재사용 할 가능성이 있는 기능들을 미리 만들어둠으로써
작업의 반복을 줄일 수 있다
- 자바에서 함수(메서드)는 반드시 클래스 내부에 선언해야 한다
# 함수의 리턴 (return)
- 함수를 정의할 때 함수 앞에 해당 함수가 반환하는 값의 타입을 적는다
- 함수를 호출하면 호출한 자리에 함수의 실행 결과가 반환(return)된다
- 리턴타입 void는 해당 함수가 변환하는 값이 없다는 것을 의미하는 반환 타입이다
# 함수의 매개변수 (arguments)
- 함수를 호출할 때 ()안에 전달하는 값을 인자라고 한다
- 함수를 정의할 때 ()안에 인자를 받을 수 있는 변수들을 선언하는데, 이를 매개변수라고 한다
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int apple,size;
System.out.print("사과 개수:");
apple = sc.nextInt();
System.out.print("바구니 크기:");
size = sc.nextInt();
System.out.println("필요한 바구니 수 : "+appleBasket(apple,size));
// for(int i = 0; i<10; i++) {
// printRabbit();
// }
}
public static void printRabbit() {
System.out.println(" /)/)");
System.out.println("( ..)");
System.out.println("( >♡");
}
// ex: 사과의 개수와 바구니의 크기를 전달하면 필요한 바구니의 개수를 알려주는 함수
public static int appleBasket(int apple, int size) {
int basket = apple % size == 0 ? apple / size : apple / size + 1;
return basket;
}
}
| [
"1103-22@host.docker.internal"
] | 1103-22@host.docker.internal |
b9443b4185bcb72f2a7224ee0f56cd24713e14f6 | 4d70d3d644dc0e82be3a063c65732565e49aa0f7 | /spring-boot-mybatis-sharding-jdbc-configuration/src/main/java/com/lyncc/bazinga/service/OrderService.java | e9c7cdc93889780d566685418a9c760beddbe6fc | [] | no_license | haoly/spring-boot-skeleton | 4677adc5a4d321cc697e1eb8c54e8b572c90dc1a | 4ab9437cf3c3422c64e4c1d547a583bfec9ce682 | refs/heads/master | 2020-11-28T15:47:34.775887 | 2019-12-11T09:34:01 | 2019-12-11T09:34:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | package com.lyncc.bazinga.service;
import com.lyncc.bazinga.model.Order;
import java.util.List;
public interface OrderService {
void save(Order o);
void batchSave(List<Order> orders);
Order findOrderByUserId(Integer userId);
List<Order> findOrdersByUserIds(List<Integer> userIds);
}
| [
"liguolin@vivo.com"
] | liguolin@vivo.com |
481b6b3ffb0ca2e981906bc9baa0204e5a7bfae4 | e010f83b9d383a958fc73654162758bda61f8290 | /src/main/java/com/alipay/api/domain/MybankMarketingCampaignPrizeListQueryModel.java | 52cad6582bec8002d97160d394c53c2b75b4ca9a | [
"Apache-2.0"
] | permissive | 10088/alipay-sdk-java | 3a7984dc591eaf196576e55e3ed657a88af525a6 | e82aeac7d0239330ee173c7e393596e51e41c1cd | refs/heads/master | 2022-01-03T15:52:58.509790 | 2018-04-03T15:50:35 | 2018-04-03T15:50:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,659 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 查询用户已拥有的奖品列表
*
* @author auto create
* @since 1.0, 2017-09-21 18:35:44
*/
public class MybankMarketingCampaignPrizeListQueryModel extends AlipayObject {
private static final long serialVersionUID = 6636947933778294985L;
/**
* 银行参与者id,是在网商银行创建会员后生成的id,网商银行会员的唯一标识
*/
@ApiField("ip_id")
private String ipId;
/**
* 银行参与者角色id,是在网商银行创建会员后生成的角色id,网商银行会员角色的唯一标识
*/
@ApiField("ip_role_id")
private String ipRoleId;
/**
* 分页查询时的页码,从1开始
*/
@ApiField("page_num")
private Long pageNum;
/**
* 分页查询时每页返回的列表大小,最大为20
*/
@ApiField("page_size")
private Long pageSize;
/**
* COUPON_VOUCHER 利息红包
DISCOUNT_VOUCHER 打折券
*/
@ApiField("type")
private String type;
public String getIpId() {
return this.ipId;
}
public void setIpId(String ipId) {
this.ipId = ipId;
}
public String getIpRoleId() {
return this.ipRoleId;
}
public void setIpRoleId(String ipRoleId) {
this.ipRoleId = ipRoleId;
}
public Long getPageNum() {
return this.pageNum;
}
public void setPageNum(Long pageNum) {
this.pageNum = pageNum;
}
public Long getPageSize() {
return this.pageSize;
}
public void setPageSize(Long pageSize) {
this.pageSize = pageSize;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"liuqun.lq@alibaba-inc.com"
] | liuqun.lq@alibaba-inc.com |
64eddc5599c7acd256ace25c1796b95fe5d1681e | 9746efb81c1e0e99a1e6416461c74ce350e2547b | /src/SiddhiB/PatternProgram7.java | d16065557657b2022d6fe65fbb4ff1ec2ae46bcc | [] | no_license | KrishnaKTechnocredits/Aug19JavaG2 | 73c6899bb89e0d240597cb42babeb5e3f93816e8 | f7e037a51623923a113151d88226a7c75ae77183 | refs/heads/master | 2022-02-27T13:38:13.590105 | 2019-09-28T08:05:49 | 2019-09-28T08:05:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package SiddhiB;
/* print below pattern
*
**
***
****
*****
****
***
**
*
*/
public class PatternProgram7 {
public static void main(String[] args)
{
int maxStar = 5;
for (int i=1;i<=((maxStar*2)-1);i++)
{
if (i>=1 && i<=maxStar)
{
for (int j=maxStar; j>=1;j--)
{
if (i>=j)
{
System.out.print("*");
} else {
System.out.print(" ");
}
}System.out.println();
} else
{
for (int j =(maxStar-1) ; j >= 1; j--)
{
if (j<=maxStar)
{
System.out.print("*");
}
else{
System.out.print("1");
}
System.out.println("");
}}
}
}
}
| [
"bahlsiddhi@gmail.com"
] | bahlsiddhi@gmail.com |
2d629dd8e93c07f1167c3da451ea6202c0f19caa | 44cbda158967c794cc0eae171439d36cbd7d7a1a | /src/model/field/cell/SomethingCell.java | 86f6fd68f91b8185f3b763b5b3b1b561ced7751a | [] | no_license | indeep-xyz/java-servlet-something-sweeper | ef09a48304092431743295de28053a5cfe446f35 | 1308d988688e70f1e872672a80859629361c7bce | refs/heads/master | 2021-01-12T12:18:32.194343 | 2017-01-12T13:28:52 | 2017-01-12T13:28:52 | 72,421,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package model.field.cell;
import java.io.Serializable;
/**
* It is a something.
* @author indeep-xyz
*
*/
class SomethingCell
extends Cell
implements Serializable
{
private static final long serialVersionUID = 1L;
/**
* セルが Something か否かを返す
* @return Something なら true
*/
@Override
public boolean isSomething() {
return true;
}
}
| [
"indeep.xyz@gmail.com"
] | indeep.xyz@gmail.com |
350a62871fa68a952228baad1625eea1965c2d52 | 087c47dc37fed0c60be0651d3dd68e976b16e017 | /src/main/java/com/yeoju/root/common/comments/controller/CommentsController.java | fea6973120f8d1c0484427b96c995f9222b64100 | [] | no_license | Great-Root/yeoju | c094fd043e8d93f1f03ad335e79d91539c72b0b1 | 1902ac3f2a7f4210caaf919b2e7eb0418f2e346b | refs/heads/master | 2023-06-12T15:06:01.390926 | 2021-07-05T17:16:41 | 2021-07-05T17:16:41 | 374,599,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,080 | java | package com.yeoju.root.common.comments.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yeoju.root.common.comments.service.CommentsService;
import com.yeoju.root.common.dto.GoodsCommentsDTO;
import com.yeoju.root.goods.service.GoodsService;
@RestController
@RequestMapping("comments")
public class CommentsController {
@Autowired
CommentsService cs;
@Autowired
GoodsService gs;
// 댓글 입력
@GetMapping(value ="insertComment",produces="application/json; charset = utf-8")
public int insertComment(GoodsCommentsDTO dto) {
return cs.insertComments(dto);
}
@GetMapping(value ="insertComment2",produces="application/json; charset = utf-8")
public int insertComment2(GoodsCommentsDTO dto) {
return cs.insertComments2(dto);
}
//1. 댓글 리스트
@GetMapping("/commentslist")
public List<GoodsCommentsDTO> commentsList(@RequestParam int goodsId) {
System.out.println("확인작업");
System.out.println("상품 번호는 ? "+goodsId);
List<GoodsCommentsDTO> dto = new ArrayList<GoodsCommentsDTO>();
// try {
// dto = gs.redaReply(goodsId);
// } catch(Exception e) {
// e.getMessage();
// }
return dto;
}
// 댓글 수정
// 댓글 삭제
@GetMapping(value ="deleteComment",produces="application/json; charset = utf-8")
public int deleteComment(GoodsCommentsDTO dto) {
System.out.println(dto.toString());
return cs.deleteComments(dto.getCommentId());
}
//대댓글삭제
@GetMapping(value ="deleteComment2",produces="application/json; charset = utf-8")
public int deleteComment2(GoodsCommentsDTO dto) {
System.out.println(dto.toString());
return cs.deleteComments2(dto.getCommentId2());
}
}
| [
"nadays3019@gmail.com"
] | nadays3019@gmail.com |
6fb442e3d537226a0fa5c52ebf31fdfc165c6559 | 8260cee8f5ec0b315dee364188828a5f872d6be7 | /src/com/atguigu/ems/services/ResourceService.java | 58dd7070fa0b5c82fff074ff338662ce5874c2a1 | [] | no_license | gochaochao/ems | 79e9c6bf572e41e3fd461d7b9d4eded8e9362733 | b28b6e5c9eab80d67ae1a6b2e955cdddab586482 | refs/heads/master | 2021-01-10T10:50:08.717843 | 2016-02-09T12:51:05 | 2016-02-09T12:51:05 | 51,366,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package com.atguigu.ems.services;
import org.springframework.stereotype.Service;
import com.atguigu.ems.entities.Resource;
@Service
public class ResourceService extends BaseService<Resource> {
}
| [
"xiqiyangyang2010@126.com"
] | xiqiyangyang2010@126.com |
37e0219e6f0a1e9a85e2779e68ae24be0951a07d | 2f52cb60cb6659f51c049f1c5004154166e6f5ba | /src/regex/node/QuestionMarkNode.java | df799dd030263feafbcbf724418b57557dc51ebe | [] | no_license | 0yuyuko0/SimpleRegex | 2590efe00d32fa872f612f082c0608ebc37942f1 | f9ec1e615d18c42bf06d6fed449c6cd6b54cc7cf | refs/heads/master | 2020-05-04T17:28:31.842834 | 2019-04-05T14:30:57 | 2019-04-05T14:30:57 | 179,312,538 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | package regex.node;
import java.util.HashSet;
import java.util.List;
public class QuestionMarkNode extends Node {
public QuestionMarkNode(List<Node> children) {
super(children);
assert children.size() == 1;
Node child = children.get(0);
this.nullable = true;
this.firstPosSet = new HashSet<>(child.firstPosSet);
this.lastPosSet = new HashSet<>(child.lastPosSet);
}
}
| [
"346847538@qq.com"
] | 346847538@qq.com |
c81ccf146d343211e8e82ea67209d1fe2540314a | 88e84dc7565356320749b34715230d0b57979819 | /app/src/main/java/com/example/lenovo/oschina/adapter/dongtan/DongTanPingLunAdapter.java | 8ad81315ee3c68c42cfaa9211cb842b09ad21d11 | [] | no_license | majiaxing/Oschina | 3ecd12d53b3a2857c38c22e359e83ead21bd1106 | 496355f7c9b11c8c3e9fc3a4e97d356b7e5f0a05 | refs/heads/master | 2021-01-20T15:03:34.486924 | 2018-10-30T01:03:01 | 2018-10-30T01:03:02 | 90,709,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,864 | java | package com.example.lenovo.oschina.adapter.dongtan;
import android.content.Context;
import android.graphics.Bitmap;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import android.widget.ImageView;
import com.androidkun.adapter.BaseAdapter;
import com.androidkun.adapter.ViewHolder;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.BitmapImageViewTarget;
import com.example.lenovo.oschina.R;
import com.example.lenovo.oschina.coefig.DataTimeUitls;
import com.example.lenovo.oschina.modle.enitity.dongtan.DongTanPingLunBean;
import java.util.List;
/**
* Created by Lenovo on 2017/5/26.
*/
public class DongTanPingLunAdapter extends BaseAdapter<DongTanPingLunBean.CommentBean> {
public DongTanPingLunAdapter(Context context, List<DongTanPingLunBean.CommentBean> datas) {
super(context, R.layout.pinglun_item, datas);
}
@Override
public void convert(ViewHolder holder, DongTanPingLunBean.CommentBean commentBean) {
final ImageView imageView=holder.getView(R.id.pinglunlist_head);
Glide.with(context).load(commentBean.getPortrait()).asBitmap().centerCrop().into(new BitmapImageViewTarget(imageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable ciDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), resource);
ciDrawable.setCircular(true);
imageView.setImageDrawable(ciDrawable);
}
});
holder.setText(R.id.pinglun_Name,commentBean.getAuthor());
String date= DataTimeUitls.getData(commentBean.getPubDate());
holder.setText(R.id.pinglun_shijian,date);
holder.setText(R.id.pinglun_content,commentBean.getContent());
}
}
| [
"1768739514@qq.com"
] | 1768739514@qq.com |
1aa8ff89dd5e856052e9ad45a864bf4c46e2e204 | 713f365b60483658ef9ab9a635b93a49afc17230 | /src/com/es2/composite/Link.java | 16ff4d1e0207fce08381cde35ecbb4642aedeb7d | [] | no_license | veluma/Engenharia_Software2 | 6d26bfff39bf579c97c51a5e5ac1e6ed62fcbfc5 | f15cc5cc11470f7cadf6805a30d881f21fa0ea4c | refs/heads/master | 2022-11-30T18:51:15.859668 | 2020-08-05T12:45:19 | 2020-08-05T12:45:19 | 256,550,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.es2.composite;
public class Link extends Menu {
private String URL;
public String getURL() {
return URL;
}
public void setURL(String URL) {
this.URL = URL;
}
@Override
public void showOptions() {
System.out.println(this.getLabel());
System.out.println(URL);
}
}
| [
"veluma.matos@gmail.com"
] | veluma.matos@gmail.com |
6a9b7469e58c866f38a736fd59f537043db6b284 | cef4e4c0dea1fa591463dd3a7ca8f6c09469d470 | /app/src/main/java/com/upcusc/intrams/Games/LarongPinoy.java | 668f294298007a50df82845b94bc8491591ba32a | [] | no_license | jdserato/Intrams2019 | 3e7b6061ba73cbad499dbecabcba8a69f3109b0e | 1751efc2684b782e759a05533cb45a5939af1def | refs/heads/master | 2020-12-23T13:34:46.658099 | 2020-01-30T08:12:57 | 2020-01-30T08:12:57 | 237,167,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.upcusc.intrams.Games;
import com.upcusc.intrams.R;
import com.upcusc.intrams.Game;
import java.util.Date;
public class LarongPinoy extends Game {
public LarongPinoy(Date date, int i, int i2, int i3, int i4) {
super("Larong Pinoy", null, null, null, null, true, true, 0, 0, i, i2, i3, i4, date, R.drawable.larongpinoy);
}
}
| [
"jdserato@up.edu.ph"
] | jdserato@up.edu.ph |
ca59d73dc5b3cc8c279ff53c91d6c0d541db6ffd | a89edbbd00129cefe9683ac52f2e9ad95c1c0194 | /store/src/main/java/org/liangjunjie/store/controller/BaseController.java | 73a3ade7af320f49f57a4ee802abf0eddc7c094d | [] | no_license | qq673855781/StoreWeb | 881fbad312ec931ca6e468cf03b7c71b736a3725 | 34519148139cd3716ffa9b92bd416f7463c04f67 | refs/heads/master | 2021-06-11T01:37:57.051938 | 2021-04-30T00:35:00 | 2021-04-30T00:35:00 | 178,286,618 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 902 | java | package org.liangjunjie.store.controller;
import org.liangjunjie.store.service.ex.InsertException;
import org.liangjunjie.store.service.ex.ServiceException;
import org.liangjunjie.store.service.ex.UsernameDuplicateException;
import org.liangjunjie.store.util.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
public abstract class BaseController {
protected static final int SUCCESS = 200;
/**
* 响应结果时用于表示操作成功
*/
@ExceptionHandler(ServiceException.class)
public ResponseResult<Void> handleException(ServiceException e) {
ResponseResult<Void> rr
= new ResponseResult<>();
rr.setMessage(e.getMessage());
if (e instanceof UsernameDuplicateException) {
// 400-用户名冲突异常
rr.setState(400);
} else if (e instanceof InsertException) {
// 500-插入数据异常
rr.setState(500);
}
return rr;
}
}
| [
"673855781@qq.com"
] | 673855781@qq.com |
7ca3d20d5c1bd2bcf97eb25d8c2bfaa3d2e5f89e | 6dfd2f7f83a7097de3a3d3333602bb048afb2b95 | /Project 5/project5/src/edu/ucla/cs/cs144/Item.java | f120ad5639adcddd7dfc4efe64b30eb4b49e033a | [] | no_license | theericpham/webapps | 49187912930625f2d370664de3209e04e65d0811 | f12c0fb484a6df68437d25dffee84e36fe3137f1 | refs/heads/master | 2016-09-06T03:15:17.017712 | 2013-11-26T09:28:43 | 2013-11-26T09:28:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,253 | java | package edu.ucla.cs.cs144;
import java.math.BigDecimal;
import java.util.Date;
import java.text.SimpleDateFormat;
public class Item {
public Item(String id, String nm, String desc, BigDecimal sp, BigDecimal bp, BigDecimal cp, Date st, Date et) {
itemId = id;
name = nm;
description = desc;
startPrice = sp;
buyPrice = bp;
curPrice = cp;
startTime = st;
endTime = et;
sdf = new SimpleDateFormat("MMMM d, yyyy hh:mm aaa");
}
public String getId() { return itemId; }
public String getName() { return name; }
public String getDescription() { return description; }
public String getStartPrice() { return "$" + startPrice; }
public String getBuyPrice() { return (buyPrice.doubleValue() == 0.00) ? "N/A" : "$" + buyPrice; }
public boolean hasBuyPrice() { return (buyPrice.doubleValue() > 0.00); }
public String getCurrentPrice() { return "$" + curPrice; }
public String getStartTime() { return sdf.format(startTime); }
public String getEndTime() { return sdf.format(endTime); }
private String itemId;
private String name;
private String description;
private BigDecimal startPrice;
private BigDecimal buyPrice;
private BigDecimal curPrice;
private Date startTime;
private Date endTime;
private SimpleDateFormat sdf;
} | [
"theericpham@gmail.com"
] | theericpham@gmail.com |
8003687b6a3088efe4cc54c2f5ec3e200d0d0253 | a3221d67ab6901f8229663e52002620328bb9d0d | /src/main/java/com/sixkery/service/WebSocket.java | 315cad1dd1e139ef8f89bc10e9311b354814acdb | [] | no_license | sixkery/WeChat_sell | 17268e3dde792af2034d2bc98c8c8f5176dfe9da | 141cb31fb294e08afdbae9ffc6f82c376929353f | refs/heads/master | 2022-07-07T09:31:07.717421 | 2020-01-15T09:06:46 | 2020-01-15T09:06:46 | 221,684,364 | 1 | 0 | null | 2022-06-21T02:14:13 | 2019-11-14T11:43:17 | Java | UTF-8 | Java | false | false | 1,558 | java | package com.sixkery.service;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.util.concurrent.CopyOnWriteArraySet;
/**
* @author sixkery
* @date 2019/11/30
*/
@Component
@ServerEndpoint("/webSocket")
@Slf4j
@Data
public class WebSocket {
private Session session;
private static CopyOnWriteArraySet<WebSocket> webSocketSet = new CopyOnWriteArraySet<>();
@OnOpen
public void onOpen(Session session) {
this.session = session;
webSocketSet.add(this);
log.info("【websocket消息】有新的连接,总数={}", webSocketSet.size());
}
@OnClose
public void onClose() {
webSocketSet.remove(this);
log.info("【websocket消息】连接断开,总数={}", webSocketSet.size());
}
@OnMessage
public void onMessage(String message) {
log.info("【websocket消息】收到客户端发来的消息,message={}", message);
}
public void sendMessage(String message) {
for (WebSocket webSocket : webSocketSet) {
log.info("【websocket消息】广播消息,message={}", message);
try {
webSocket.session.getBasicRemote().sendText(message);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
| [
"sixkery@163.com"
] | sixkery@163.com |
b71611e1e47aef6f11b3ece0e540aa99f930ead8 | c8306a8b86968a2a0a9df06cc38230f7324ac5b5 | /src/zhangying/IntegrateData.java | 5370ed8740392f6ae4cd07978c42cc5c6b4853b1 | [] | no_license | mankou/mangHadoop | 561d472f255ffa70850f5ddaac164b9052d8e206 | 1685c86d13c3ffb17165052f3e39aaf5ceb5086e | refs/heads/master | 2021-01-10T21:08:53.651673 | 2012-11-08T10:04:24 | 2012-11-08T10:04:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,796 | java | package zhangying;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.KeyValueTextInputFormat;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.hadoop.mapred.lib.*;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
import org.openscience.cdk.exception.CDKException;
public class IntegrateData {
public class MoleculeMapper extends Mapper<Object, Text, Text, Text> {
private Text setS = new Text();
private Text setZincId = new Text();
Property p;
String ZincId;
StringBuffer STR=new StringBuffer("");
int filenum=0;
String s="";
int j=0;
String crlf = System.getProperty("line.separator");
public void map(Object key, Text value, Context context)
throws IOException, InterruptedException {
String str=value.toString();
j++;
STR.append(str);
STR.append(crlf) ;
if(STR.equals("@<TRIPOS>MOLECULE"))
{
ZincId=str;
}
if(str.equals(""))
{
s=s+"a";
if(s.equals("a")&&(!STR.equals(crlf)))
{
try {
p=new Property(STR.toString());
setS.set(p.getXLogP().toString()
+ "\t"
+ p.getRotatableBonds().toString()
+ "\t"
+ p.getH_Donor1().toString()
+ "\t"
+ p.getHB_Acceptor1().toString()
+ "\t"
+ String.valueOf(p.getMolecule_weight())
+ "\t"
+ String.valueOf(p.getNaturalMass())
+ "\t"
+ String.valueOf(p.getAtomCount())
+ "\t"
+ String.valueOf(p.getBondCount())
+ "\t"
+ p.getPolar_surface_area()
.toString() + "\t"
+ p.getComplexity().toString());
setZincId.set(ZincId);
context.write(setZincId, setS);
} catch (CDKException e) {
e.printStackTrace();
}
s="";
STR.replace(0, STR.length()-1, "") ;
}
}
}
}
public static class OutMapper
extends Mapper<Object, Text, Text, Text>{
private Text setZincID = new Text();
private Text setGridSore = new Text();
private String ZincId;
private String Gridscore;
int n=0;
public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
String word=value.toString();
n++;
if(n<2)
{
if(word.startsWith("Molecule"))
{
int index = word.indexOf(":");
ZincId=word.substring(index + 1).trim();
}
if(word.startsWith("Grid Score"))
{
int index = word.indexOf(":");
Gridscore=word.substring(index + 1).trim();
}
}
if(n==2)
{
setZincID.set(ZincId);
setGridSore.set(Gridscore);
context.write(setZincID, setGridSore);
n=0;
}
}
}
public static class IntegerReducer
extends Reducer<Text,Text,Text,Text> {
private Text result = new Text();
public void reduce(Text key, Iterable<Text> values,
Context context
) throws IOException, InterruptedException {
String propertyvalue = null;
for (Text val : values) {
propertyvalue+=val.toString();
}
result.set(propertyvalue);
context.write(key, result);
}
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 2) {
System.err.println("Usage: IntegrateData <in> <out>");
System.exit(2);
}
Job job = new Job(conf, "IntegrateData");
job.setJarByClass(IntegrateData.class);
job.setReducerClass(IntegerReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
MultipleInputs.addInputPath(conf, new Path("/home/zhangying/molecule"), KeyValueTextInputFormat.class, MoleculeMapper.class);
MultipleInputs.addInputPath(conf,new Path("/home/zhangying/resultout"),KeyValueTextInputFormat.class,OutMapper.class);
FileOutputFormat.setOutputPath(job, new Path("/home/zhangying/output"));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
| [
"ningma003@gmail.com"
] | ningma003@gmail.com |
d868c19f7988e03fd112705ad4e207535c1ca3bc | 0037b05033d8f69cd5cfb8638515cf7ffdc616f3 | /src/main/java/org/utils/TarballReader.java | 7b895e714fa73b750bc817fed70ffa5346732876 | [] | no_license | pgrandjean/TarballInputFormat | cb0904caf151b64d236cabead569e3c89c3f1648 | 424f810ad81aa9c755834c0efab1cf3ebb00769e | refs/heads/master | 2021-01-10T20:18:54.837789 | 2014-09-14T17:20:42 | 2014-09-14T17:20:42 | 21,270,554 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,734 | java | package org.utils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Calendar;
import java.util.TimeZone;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.GZIPInputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.CompressionCodecFactory;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.kamranzafar.jtar.TarEntry;
import org.kamranzafar.jtar.TarInputStream;
/**
* TarballReader.
*
* Outputs for file included in a tarball a key/value pair where the key is
* the file name appended with date and time (.DYYMMDD.THHMMSS) and the value
* is the content of the file.
*
* Under Apache License 2.0
*
* @author pgrandjean
* @date 27 Jun 2014
* @since 1.6.x
*/
public class TarballReader extends RecordReader<TarballEntry, Text> {
private static final Log LOG = LogFactory.getLog(TarballReader.class);
private long pos = 0;
private long end = 0;
private String tarball = null;
private TarInputStream in = null;
private TarballEntry key = null;
private Text value = null;
public TarballReader() {}
protected TarballReader(String tarball) throws IOException {
InputStream in = this.getClass().getResourceAsStream(tarball);
GZIPInputStream gzip = new GZIPInputStream(in);
TarInputStream tar = new TarInputStream(gzip);
this.in = tar;
this.key = new TarballEntry();
this.value = new Text();
this.tarball = tarball;
}
@Override
public synchronized void close() throws IOException {
if (in != null) {
in.close();
in = null;
key = null;
value = null;
}
}
@Override
public synchronized boolean nextKeyValue() throws IOException {
TarEntry tarEntry = in.getNextEntry();
while (tarEntry != null && tarEntry.isDirectory()) tarEntry = in.getNextEntry();
if (tarEntry == null) return false;
// clear K/V
key.clear();
value.clear();
Calendar timestamp = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
timestamp.setTimeInMillis(tarEntry.getModTime().getTime());
key.setTarball(tarball);
key.setEntry(tarEntry);
// read tar entry
long tarSize = tarEntry.getSize();
if (tarSize > Integer.MAX_VALUE) throw new IOException("tar entry " + tarEntry.getName() + " exceeds " + Integer.MAX_VALUE);
int bufSize = (int) tarSize;
int read = 0;
int offset = 0;
byte[] buffer = new byte[bufSize];
while ((read = in.read(buffer, offset, bufSize)) != -1) offset += read;
// set value
value.set(buffer);
// set pos
pos += bufSize;
LOG.debug("read " + key);
return true;
}
@Override
public synchronized TarballEntry getCurrentKey() {
return key;
}
@Override
public synchronized Text getCurrentValue() {
return value;
}
@Override
public synchronized float getProgress() throws IOException {
return Math.min(1.0f, pos / (float) end);
}
@Override
public void initialize(InputSplit isplit, TaskAttemptContext context) throws IOException, InterruptedException {
try {
pos = 0;
end = Long.MAX_VALUE;
key = new TarballEntry();
value = new Text();
FileSplit split = (FileSplit) isplit;
Path file = split.getPath();
tarball = file.getName();
Configuration conf = context.getConfiguration();
CompressionCodecFactory compressionCodecs = new CompressionCodecFactory(conf);
CompressionCodec codec = compressionCodecs.getCodec(file);
FileSystem fs = file.getFileSystem(conf);
FSDataInputStream fileIn = fs.open(split.getPath());
in = new TarInputStream(codec.createInputStream(fileIn));
}
catch (IOException ex) {
Logger.getLogger(TarballReader.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| [
"pgrandjean@amadeus.com"
] | pgrandjean@amadeus.com |
8d48f90c834a4db264319210fac5a8188d97183c | 228b02d9c5303958ff131333ee1a7d176cb59a84 | /app/src/main/java/com/shivang/dailyeconomy/activity/MainActivity.java | 3c8b267677fc9199fef68192fa3a43a3659bb500 | [] | no_license | kshivang/DailyEconomy | 815f8b6e46b62a60a935284d8970c96fcf052f87 | 38ddbbd37b97353388b9e2c990c9ddb90810ead1 | refs/heads/master | 2021-01-19T22:21:07.146536 | 2017-04-19T23:06:14 | 2017-04-19T23:06:14 | 88,798,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,100 | java | package com.shivang.dailyeconomy.activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.NavigationView;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import com.google.firebase.auth.FirebaseAuth;
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;
import com.shivang.dailyeconomy.R;
import com.shivang.dailyeconomy.fragment.SectionFragment;
import com.shivang.dailyeconomy.misc.StudentModel;
import com.shivang.dailyeconomy.misc.UserLocalStore;
import com.squareup.picasso.Picasso;
import java.util.Locale;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by kshivang on 07/12/16.
*
*/
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener{
private DrawerLayout drawer;
private NavigationView navigationView;
private TextView profileTId, profileName;
private CircleImageView profileImage;
private ViewPager mViewPager;
private UserLocalStore userLocalStore;
private FirebaseAuth mAuth;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.app_bar_home);
mAuth = FirebaseAuth.getInstance();
userLocalStore = new UserLocalStore(MainActivity.this);
onClassSection(userLocalStore.getUid());
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if(actionBar != null)
actionBar.setTitle("Home");
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
if(navigationView != null) {
navigationView.setNavigationItemSelectedListener(this);
NavigationView headerView = (NavigationView) navigationView
.inflateHeaderView(R.layout.nav_header_home);
if (headerView != null) {
profileImage = (CircleImageView) headerView.findViewById(R.id.img_profile);
profileName = (TextView) headerView.findViewById(R.id.text_name);
profileTId = (TextView) headerView.findViewById(R.id.tid);
headerView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
drawer.closeDrawer(GravityCompat.START);
// startActivity(new Intent(MainActivity.this, ProfileScreen.class));
}
});
}
}
final TabLayout tabLayout = (TabLayout) findViewById(R.id.primary_tabs);
mViewPager = (ViewPager) findViewById(R.id.container);
final String[] sections = getResources().getStringArray(R.array.section);
FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
if (position < sections.length) return SectionFragment.newInstance(sections[position]);
return null;
}
@Override
public int getCount() {
return sections.length;
}
@Override
public CharSequence getPageTitle(int position) {
if (sections[position] != null) return sections[position];
return null;
}
};
mViewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(mViewPager);
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
drawer.closeDrawer(GravityCompat.START);
navigationView.setCheckedItem(R.id.nav_header_home);
switch (item.getItemId()) {
case R.id.home:
mViewPager.setCurrentItem(0, true);
// startActivity(new Intent(MainActivity.this, ProfileScreen.class));
// break;
// case R.id.profile:
// startActivity(new Intent(HomeScreen.this, SchoolInfoScreen.class));
// break;
case R.id.changePassword:
// startActivity(new Intent(MainActivity.this, ChangePasswordScreen.class));
break;
case R.id.help:
// startActivity(new Intent(MainActivity.this, HelpScreen.class));
break;
case R.id.logout:
finish();
break;
}
return true;
}
private void onClassSection(String uid){
DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();
mDatabase.child("students").child(uid)
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(dataSnapshot != null){
StudentModel studentModel = dataSnapshot
.getValue(StudentModel.class);
if (studentModel != null) {
userLocalStore.setStudentModel(studentModel);
updateHeader(studentModel);
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void updateHeader(StudentModel studentModel){
if(studentModel == null) return;
profileTId.setText(String.format(Locale.ENGLISH,"%d", studentModel.getRoll()));
profileName.setText(String.format("%s", studentModel.getName()));
Picasso.with(MainActivity.this).load(studentModel.getImage_url())
.error(R.drawable.placeholder_profile)
.placeholder(R.drawable.placeholder_profile)
.into(profileImage);
}
}
| [
"shivang.iitk@gmail.com"
] | shivang.iitk@gmail.com |
d9e35318bebc8616a1c8f21e3886026afe43d79e | 21dc7893121a8179d250a1ab2aa3572eb29c469b | /src/main/java/com/pivotal/smd/rabbit/test/RabbitConnectionUtil.java | d84cc4145ffe573c093a60cd364961c3ed031ff8 | [] | no_license | gregturn/RabbitDriverBoot | 66640f01d86d232f4f1effea2cf51f570b792a33 | 24fa991939367fe83d8451a8703c3ab4ef2c6730 | refs/heads/master | 2021-01-18T19:56:06.258736 | 2013-10-17T20:47:05 | 2013-10-17T20:47:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,789 | java | /**
* Connections are thread safe so ConnectionFactories create and return a
* singleton. We'll create a Factory for each requested so we get a unique
* Connection for each request.
*/
package com.pivotal.smd.rabbit.test;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
@Configuration
public class RabbitConnectionUtil
{
private static final Logger LOGGER = Logger.getLogger(RabbitConnectionUtil.class);
@Value("${host.name}")
public String name;
@Value("${host.port}")
public int port;
@Value("${host.user}")
public String user;
@Value("${host.password}")
public String password;
@Value("${host.vhost}")
public String vhost;
@Value("${host.usessl:false}")
public boolean useSSL;
@Bean(name="rabbitConnection")
@Scope("prototype")
public Connection getRabbitConnection()
{
Connection retVal = null;
try
{
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost(name);
connectionFactory.setPort(port);
connectionFactory.setUsername(user);
connectionFactory.setPassword(password);
connectionFactory.setVirtualHost(vhost);
if(useSSL) { connectionFactory.useSslProtocol(); }
retVal = connectionFactory.newConnection();
}
catch(Exception e)
{
LOGGER.error(e.toString());
}
return retVal;
}
}
| [
"sdeeg@gopivotal.com"
] | sdeeg@gopivotal.com |
1f63d6106026ee559b9dd378ee81d15330150e4d | fc79058301d4fdcf5000648607b05b761ed913bb | /src/gen/com/example/test/inet/ietfInetTypes/Ipv4Address.java | d1ecce6f58bdb4b5c6aba6cb878b1241a46d167e | [] | no_license | nextgen9916/Netconf | 07af9d002ca5b2478a76cba4fbf08e9cdc41a934 | dfc4a08a8c39bf823ee9bdf902452fff29aaf863 | refs/heads/master | 2020-03-15T23:56:40.610019 | 2018-05-07T03:48:59 | 2018-05-07T03:48:59 | 132,404,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | /*
* @(#)Ipv4Address.java 1.0 16/08/17
*
* This file has been auto-generated by JNC, the
* Java output format plug-in of pyang.
* Origin: module "ietf-inet-types", revision: "2013-07-15".
*/
package gen.com.example.test.inet.ietfInetTypes;
import com.tailf.jnc.YangException;
import com.tailf.jnc.YangString;
/**
* This class represents an element from
* the namespace
* generated to "src/gen/com/example/test/inet/ietfInetTypes/ipv4-address"
* <p>
* See line 193 in
* /home/tcs/Confd//src/confd/yang/ietf-inet-types.yang
*
* @version 1.0 2017-08-16
* @author Auto Generated
*/
public class Ipv4Address extends YangString {
private static final long serialVersionUID = 1L;
/**
* Constructor for Ipv4Address object from a string.
* @param value Value to construct the Ipv4Address from.
*/
public Ipv4Address(String value) throws YangException {
super(value);
check();
}
/**
* Sets the value using a string value.
* @param value The value to set.
*/
public void setValue(String value) throws YangException {
super.setValue(value);
check();
}
/**
* Checks all restrictions (if any).
*/
public void check() throws YangException {
}
}
| [
"tcs@tcs-Latitude-E5440"
] | tcs@tcs-Latitude-E5440 |
04955ca14afa495191b2502854a0c2374c9d3f4a | 226ed6f908cbc678ee7dc600eb14f626a6d4cfed | /src/test/java/accessories/GuitarStringTest.java | 39764c6d03a62a4b32b9df269982ad39baf71410 | [] | no_license | kmbruce1986/musicshop | 054fc24673152b68814827b341720500842390c8 | f2b63a92336b7ab9fb8f3191228a0d1758148745 | refs/heads/master | 2020-03-30T23:27:05.347791 | 2018-10-05T11:25:57 | 2018-10-05T11:25:57 | 151,700,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 903 | java | package accessories;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class GuitarStringTest {
GuitarString guitarString;
@Before
public void setUp() {
guitarString = new GuitarString("Guitar String", 3.99, 9.99, GuitarStringType.G);
}
@Test
public void canGetAccessoryType() {
assertEquals("Guitar String", guitarString.getAccessoryType());
}
@Test
public void canGetCostPrice() {
assertEquals(3.99, guitarString.getCostPrice(), 0.01);
}
@Test
public void canGetSellingPrice() {
assertEquals(9.99, guitarString.getSellingPrice(), 0.01);
}
@Test
public void canGetMarkup() {
assertEquals(6, guitarString.markup(), 0.01);
}
@Test
public void canGetNote() {
assertEquals(GuitarStringType.G, guitarString.getNote());
}
}
| [
"kmbruce1986@gmail.com"
] | kmbruce1986@gmail.com |
66b1b8feff8b25b1dd44d9b704b44cf460e0babc | 9332e896b558c451f5779fb4691b6791e7619adc | /ssm_parent/ssm_model/src/main/java/rml/model/MUser.java | c50960a642ff3ce55ccd7c2e7685cce587726d18 | [] | no_license | lzy0909/ssm | 280764130e9f8126c3e0e67bb3c5b1cb191ce32a | c6b7adaefb05d97b852d782829e481b13883f408 | refs/heads/master | 2021-01-23T09:26:43.359767 | 2017-09-06T08:09:59 | 2017-09-06T08:09:59 | 102,581,210 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package rml.model;
import java.io.Serializable;
public class MUser implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6783860993746888774L;
private String id;
private String name;
private Integer age;
private String address;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
} | [
"693514895@qq.com"
] | 693514895@qq.com |
66cf258de2e69bfb3ac77dd1d1ea0fe13b11529f | 6832918e1b21bafdc9c9037cdfbcfe5838abddc4 | /jdk_8_maven/cs/rest/original/proxyprint/src/main/java/io/github/proxyprint/kitchen/models/printshops/RegisterRequest.java | 6729161a227a84ae41c2cc93b583512c9d20909f | [
"Apache-2.0",
"GPL-1.0-or-later",
"LGPL-2.0-or-later"
] | permissive | EMResearch/EMB | 200c5693fb169d5f5462d9ebaf5b61c46d6f9ac9 | 092c92f7b44d6265f240bcf6b1c21b8a5cba0c7f | refs/heads/master | 2023-09-04T01:46:13.465229 | 2023-04-12T12:09:44 | 2023-04-12T12:09:44 | 94,008,854 | 25 | 14 | Apache-2.0 | 2023-09-13T11:23:37 | 2017-06-11T14:13:22 | Java | UTF-8 | Java | false | false | 9,924 | java | /*
* Copyright 2016 Jorge Caldas, José Cortez
* José Francisco, Marcelo Gonçalves
*
* 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 io.github.proxyprint.kitchen.models.printshops;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.Objects;
/**
*
* @author josesousa
*/
@Entity
@Table(name = "register_requests")
public class RegisterRequest implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false, name = "manager_name")
private String managerName;
@Column(nullable = false, name = "manager_username")
private String managerUsername;
@Column(nullable = false, name = "manager_email")
private String managerEmail;
@Column(nullable = false, name = "manager_password")
private String managerPassword;
@Column(nullable = false, name = "pshop_address")
private String pShopAddress;
@Column(nullable = false, name = "pshop_latitude")
private Double pShopLatitude;
@Column(nullable = false, name = "pshop_longitude")
private Double pShopLongitude;
@Column(nullable = false, name = "pshop_nif")
private String pShopNIF;
@Column(nullable = false, name = "pshop_name")
private String pShopName;
@JsonIgnore
@Column(nullable = false, name = "accepted")
private boolean accepted = false;
@Column(nullable = false, name = "pshop_date_request")
private String pShopDateRequest;
@Column(nullable = true, name = "pshop_date_request_accepted")
private String pShopDateRequestAccepted;
public RegisterRequest() {
// Return a Calendar based on default Locale and TimeZone
this.pShopDateRequest = GregorianCalendarToString((GregorianCalendar) GregorianCalendar.getInstance());
this.pShopDateRequestAccepted = null;
}
public RegisterRequest(String managerName, String managerUsername, String managerEmail, String managerPassword, String pShopAddress, Double pShopLatitude, Double pShopLongitude, String pShopNIF, String pShopName, boolean accepted) {
this.managerName = managerName;
this.managerUsername = managerUsername;
this.managerEmail = managerEmail;
this.managerPassword = managerPassword;
this.pShopAddress = pShopAddress;
this.pShopLatitude = pShopLatitude;
this.pShopLongitude = pShopLongitude;
this.pShopNIF = pShopNIF;
this.pShopName = pShopName;
this.accepted = accepted;
this.pShopDateRequest = GregorianCalendarToString((GregorianCalendar) GregorianCalendar.getInstance());
this.pShopDateRequestAccepted = null;
}
public long getId() {
return id;
}
public String getManagerName() {
return managerName;
}
public void setManagerName(String managerName) {
this.managerName = managerName;
}
public void setId(long id) {
this.id = id;
}
public String getManagerUsername() {
return managerUsername;
}
public void setManagerUsername(String managerUsername) {
this.managerUsername = managerUsername;
}
public String getManagerEmail() {
return managerEmail;
}
public void setManagerEmail(String managerEmail) {
this.managerEmail = managerEmail;
}
public String getManagerPassword() {
return managerPassword;
}
public void setManagerPassword(String managerPassword) {
this.managerPassword = managerPassword;
}
public String getpShopAddress() {
return pShopAddress;
}
public void setpShopAddress(String pShopAddress) {
this.pShopAddress = pShopAddress;
}
public Double getpShopLatitude() {
return pShopLatitude;
}
public void setpShopLatitude(Double pShopLatitude) {
this.pShopLatitude = pShopLatitude;
}
public Double getpShopLongitude() {
return pShopLongitude;
}
public void setpShopLongitude(Double pShopLongitude) {
this.pShopLongitude = pShopLongitude;
}
public String getpShopNIF() {
return pShopNIF;
}
public void setpShopNIF(String pShopNIF) {
this.pShopNIF = pShopNIF;
}
public String getpShopName() {
return pShopName;
}
public void setpShopName(String pShopName) {
this.pShopName = pShopName;
}
public boolean isAccepted() {
return accepted;
}
public void setAccepted(boolean accepted) {
this.accepted = accepted;
}
public String getpShopDateRequest() {
return pShopDateRequest;
}
public String getpShopDateRequestAccepted() {
return pShopDateRequestAccepted;
}
public void setpShopDateRequestAccepted(GregorianCalendar date) {
this.pShopDateRequestAccepted = GregorianCalendarToString(date);
}
public RegisterRequest(long id, String managerName, String managerUsername, String managerEmail, String managerPassword, String pShopAddress, Double pShopLatitude, Double pShopLongitude, String pShopNIF, String pShopName, String pShopDateRequest, String pShopDateRequestAccepted) {
this.id = id;
this.managerName = managerName;
this.managerUsername = managerUsername;
this.managerEmail = managerEmail;
this.managerPassword = managerPassword;
this.pShopAddress = pShopAddress;
this.pShopLatitude = pShopLatitude;
this.pShopLongitude = pShopLongitude;
this.pShopNIF = pShopNIF;
this.pShopName = pShopName;
this.pShopDateRequest = pShopDateRequest;
this.pShopDateRequestAccepted = pShopDateRequestAccepted;
}
@Override
public String toString() {
return "RegisterRequest{" + "id=" + id + ", managerName=" + managerName + ", managerUsername=" + managerUsername + ", managerEmail=" + managerEmail + ", managerPassword=" + managerPassword + ", pShopAddress=" + pShopAddress + ", pShopLatitude=" + pShopLatitude + ", pShopLongitude=" + pShopLongitude + ", pShopNIF=" + pShopNIF + ", pShopName=" + pShopName + ", accepted=" + accepted + ", pShopDateRequest=" + pShopDateRequest + ", pShopDateRequestAccepted=" + pShopDateRequestAccepted + '}';
}
@Override
public int hashCode() {
int hash = 5;
hash = 67 * hash + (int) (this.id ^ (this.id >>> 32));
hash = 67 * hash + Objects.hashCode(this.managerName);
hash = 67 * hash + Objects.hashCode(this.managerUsername);
hash = 67 * hash + Objects.hashCode(this.managerEmail);
hash = 67 * hash + Objects.hashCode(this.managerPassword);
hash = 67 * hash + Objects.hashCode(this.pShopAddress);
hash = 67 * hash + Objects.hashCode(this.pShopLatitude);
hash = 67 * hash + Objects.hashCode(this.pShopLongitude);
hash = 67 * hash + Objects.hashCode(this.pShopNIF);
hash = 67 * hash + Objects.hashCode(this.pShopName);
hash = 67 * hash + (this.accepted ? 1 : 0);
hash = 67 * hash + Objects.hashCode(this.pShopDateRequest);
hash = 67 * hash + Objects.hashCode(this.pShopDateRequestAccepted);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final RegisterRequest other = (RegisterRequest) obj;
if (this.id != other.id) {
return false;
}
if (this.accepted != other.accepted) {
return false;
}
if (!Objects.equals(this.managerName, other.managerName)) {
return false;
}
if (!Objects.equals(this.managerUsername, other.managerUsername)) {
return false;
}
if (!Objects.equals(this.managerEmail, other.managerEmail)) {
return false;
}
if (!Objects.equals(this.managerPassword, other.managerPassword)) {
return false;
}
if (!Objects.equals(this.pShopAddress, other.pShopAddress)) {
return false;
}
if (!Objects.equals(this.pShopNIF, other.pShopNIF)) {
return false;
}
if (!Objects.equals(this.pShopName, other.pShopName)) {
return false;
}
if (!Objects.equals(this.pShopDateRequest, other.pShopDateRequest)) {
return false;
}
if (!Objects.equals(this.pShopDateRequestAccepted, other.pShopDateRequestAccepted)) {
return false;
}
if (!Objects.equals(this.pShopLatitude, other.pShopLatitude)) {
return false;
}
if (!Objects.equals(this.pShopLongitude, other.pShopLongitude)) {
return false;
}
return true;
}
/**
* From GregoriaCalendar to String.
*
* @param c, GregorianCalendar instance
* @return Well formated string for display
*/
private String GregorianCalendarToString(GregorianCalendar c) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm");
sdf.setCalendar(c);
String dateFormatted = sdf.format(c.getTime());
return dateFormatted;
}
}
| [
"arcuri82@gmail.com"
] | arcuri82@gmail.com |
839e87227752a35bcb4796bd6e68ddec15f39391 | 95379ba98e777550a5e7bf4289bcd4be3c2b08a3 | /java/net/sf/l2j/gameserver/model/item/MercenaryTicket.java | 0c8b8da0691f9fd61619764ddc6a523dfc946930 | [] | no_license | l2brutal/aCis_gameserver | 1311617bd8ce0964135e23d5ac2a24f83023f5fb | 5fa7fe086940343fb4ea726a6d0138c130ddbec7 | refs/heads/master | 2021-01-03T04:10:26.192831 | 2019-03-19T19:44:09 | 2019-03-19T19:44:09 | 239,916,465 | 0 | 1 | null | 2020-02-12T03:12:34 | 2020-02-12T03:12:33 | null | UTF-8 | Java | false | false | 1,379 | java | package net.sf.l2j.gameserver.model.item;
import java.util.Arrays;
import net.sf.l2j.gameserver.instancemanager.SevenSigns.CabalType;
import net.sf.l2j.gameserver.templates.StatsSet;
public final class MercenaryTicket
{
public enum TicketType
{
SWORD,
POLE,
BOW,
CLERIC,
WIZARD,
TELEPORTER
}
private final int _itemId;
private final TicketType _type;
private final boolean _isStationary;
private final int _npcId;
private final int _maxAmount;
private final CabalType[] _ssq;
public MercenaryTicket(StatsSet set)
{
_itemId = set.getInteger("itemId");
_type = set.getEnum("type", TicketType.class);
_isStationary = set.getBool("stationary");
_npcId = set.getInteger("npcId");
_maxAmount = set.getInteger("maxAmount");
final String[] ssq = set.getStringArray("ssq");
_ssq = new CabalType[ssq.length];
for (int i = 0; i < ssq.length; i++)
_ssq[i] = Enum.valueOf(CabalType.class, ssq[i]);
}
public int getItemId()
{
return _itemId;
}
public TicketType getType()
{
return _type;
}
public boolean isStationary()
{
return _isStationary;
}
public int getNpcId()
{
return _npcId;
}
public int getMaxAmount()
{
return _maxAmount;
}
public boolean isSsqType(CabalType type)
{
return Arrays.asList(_ssq).contains(type);
}
} | [
"vicawnolasco@gmail.com"
] | vicawnolasco@gmail.com |
9978f411c99f675068c4f0cdd3d65f39ea6fd0e1 | 504ec8b5fdf484c30d2f2ef2886aeb04d6011a73 | /Extends/src/main/java/com/yihang/ParentDog.java | f87f99f2a9821196b5378837a020df348e7c3ff4 | [] | no_license | Joues/JavaDemo | c27d8714102f29c29ac9168fa1c9181b6550dbe6 | cec71f7141d003c938f23065c5b6f8ab5b02ac08 | refs/heads/master | 2022-12-03T15:31:14.913677 | 2020-08-21T15:40:48 | 2020-08-21T15:40:48 | 277,861,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 300 | java | package com.yihang;
/**
* @Author: yihangjou(周逸航)
* @Site: www.yihang.ml
* @cnBlogs: https://www.cnblogs.com/yihangjou/
* @Date: create in 2020/7/17 21:53
*/
public class ParentDog {
public String dogName;
public ParentDog(String dogName) {
this.dogName = dogName;
}
} | [
"yihangjou@outlook.com"
] | yihangjou@outlook.com |
c660ca84dd87b17063f209b6afb07808ec32ae17 | ad6832b5a7201e74a3a8ac012620783c2f83f635 | /src/com/mz/web/support/PageBean.java | 62b858d780f3651d4c4316c2a49fd0f64452e9d9 | [] | no_license | PaLaDin233/wzq | 2736401a4bd5b2218e0f8b71a11a5b8a1bbe12fc | 5ec5ddcad16008855f517263873feaae6597ae61 | refs/heads/master | 2021-04-15T08:35:10.290671 | 2018-04-16T09:11:49 | 2018-04-16T09:11:49 | 126,605,294 | 2 | 1 | null | 2018-03-31T03:28:39 | 2018-03-24T14:06:44 | CSS | UTF-8 | Java | false | false | 1,681 | java | package com.mz.web.support;
import java.util.List;
import java.util.Map;
/**
* 封装分页的参数
*
* @author Jie.Yuan
*
*/
public class PageBean<T> {
private int currentPage = 1; // 当前页, 默认显示第一页
private int pageCount = 5; // 每页显示的行数(查询返回的行数), 默认每页显示5行
private int totalCount; // 总记录数
private int totalPage; // 总页数 = 总记录数 / 每页显示的行数 (+ 1)
private List<T> pageData; // 分页查询到的数据
public PageBean(int pageCount){
this.pageCount=pageCount;
System.out.println("创建PageBean类ing...");
}
// 返回总页数
public int getTotalPage() {
if (totalCount % pageCount == 0) {
totalPage = totalCount / pageCount;
} else {
totalPage = totalCount / pageCount + 1;
}
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public List<T> getPageData() {
return pageData;
}
public void setPageData(List<T> pageData) {
this.pageData = pageData;
}
} | [
"851308369@qq.com"
] | 851308369@qq.com |
efffdc2f471e197faa8234f006c5e2477767df96 | fd22b41d370e72429e01b2f2a48f1c5cdd60279f | /src/net/admin/goods/action/AdminGoodsModifyAction.java | 1016171d747c7bd259f984f113e585a6200ae066 | [] | no_license | cayori/mall | d5bc151f686b446e01dadfff0bd8cb821d7889ba | e963a713d751e6dcdbc1fb874440d1e4bf656dd2 | refs/heads/master | 2021-07-18T23:49:56.534537 | 2017-10-24T06:10:18 | 2017-10-24T06:10:18 | 107,203,035 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,321 | java | package net.admin.goods.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.admin.goods.db.*;
public class AdminGoodsModifyAction implements Action {
public ActionForward execute(HttpServletRequest request,
HttpServletResponse response) throws Exception{
request.setCharacterEncoding("euc-kr");
ActionForward forward=new ActionForward();
AdminGoodsDAO agoodsdao= new AdminGoodsDAO();
GoodsBean agb=new GoodsBean();
agb.setGOODS_NUM(Integer.parseInt(request.getParameter("goods_num")));
agb.setGOODS_CATEGORY(request.getParameter("goods_category"));
agb.setGOODS_NAME(request.getParameter("goods_name"));
agb.setGOODS_CONTENT(request.getParameter("goods_content"));
agb.setGOODS_SIZE(request.getParameter("goods_size"));
agb.setGOODS_COLOR(request.getParameter("goods_color"));
agb.setGOODS_AMOUNT(Integer.parseInt(request.getParameter("goods_amount")));
agb.setGOODS_PRICE(Integer.parseInt(request.getParameter("goods_price")));
agb.setGOODS_BEST(Integer.parseInt(request.getParameter("goods_best")));
int result=agoodsdao.modifyGoods(agb);
if(result<=0){
System.out.println("상품 수정 실패");
return null;
}
forward.setPath("./GoodsList.ag");
forward.setRedirect(true);
return forward;
}
}
| [
"cayori@gmail.com"
] | cayori@gmail.com |
eeaaeaeba2f7ff0de6352566827464eea4c938f4 | b0bc160329e0df64511c47651b6dd8b84adcd58e | /src/test/ruready/eis/TestPartialPopulation.java | 41c2dd85a277b94e284c8ad0c33dd5c11c724a0b | [] | no_license | Shantanu28/ruready | 80bc4727af120e77df1aaf9cfc52217287e2088b | bc113a55290e7732464b31bb3462862bb20fd38f | refs/heads/master | 2021-03-16T09:44:43.739386 | 2016-01-22T13:26:35 | 2016-01-22T13:26:35 | 50,182,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,068 | java | /*****************************************************************************************
* Source File: TestPartialPopulation.java
****************************************************************************************/
package test.ruready.eis;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.junit.Assert;
import org.junit.Test;
import test.ruready.rl.StandAloneEnvTestBase;
/**
* Testing partial population of objects. Some of the fields in Bean are
* transient; are they preserved after a session loads its persistent fields?
* Answer: YES. Hibernate loads only the persistent fields and leaves intact
* transient fields IN ANOTHER Hibernate Session. In the same.
* <p>
* -------------------------------------------------------------------------<br>
* (c) 2006-2007 Continuing Education, University of Utah<br>
* All copyrights reserved. U.S. Patent Pending DOCKET NO. 00846 25702.PROV
* <p>
* This file is part of the RUReady Program software.<br>
* Contact: Nava L. Livne <code><nlivne@aoce.utah.edu></code><br>
* Academic Outreach and Continuing Education (AOCE)<br>
* 1901 East South Campus Dr., Room 2197-E<br>
* University of Utah, Salt Lake City, UT 84112-9359<br>
* -------------------------------------------------------------------------
*
* @author Oren E. Livne <code><olivne@aoce.utah.edu></code>
* @version Aug 31, 2007
*/
public class TestPartialPopulation extends StandAloneEnvTestBase
{
// ========================= CONSTANTS =================================
/**
* A logger that helps identify this class' printouts.
*/
@SuppressWarnings("unused")
private static final Log logger = LogFactory.getLog(TestPartialPopulation.class);
// ========================= FIELDS ====================================
// ========================= SETUP METHODS =============================
/**
* @see test.ruready.rl.TestEnvTestBase#cleanUp()
*/
@Override
protected void cleanUp()
{
// Delete all beans
Session session = environment.getSession();
session.createQuery("delete Bean bean").executeUpdate();
}
// ========================= PUBLIC TESTING METHODS ====================
/**
* Test partial population of a persistent class.
*/
@Test
public void testPartialPopulation()
{
// =============================
// Unit of work 1
// =============================
Session session = environment.getSession();
// Create a user and a dependent phone object
logger.info("Creating a new bean object...");
Bean bean = new Bean("value1", "value2");
logger.info("bean = " + bean);
// Save bean to database
logger.info("Saving bean to database...");
session.beginTransaction();
session.save(bean);
session.getTransaction().commit();
logger.info("bean = " + bean);
// Create another bean and partially populate it
logger.info("Creating another bean2 and partially populating it...");
Bean bean2 = new Bean();
bean2.setField2("new value 2");
logger.info("bean2 = " + bean2);
// In a single thread model of HibernateSessionFactory, each user will
// have its own thread and own session. The following can happen in a
// *new session*.
session.close();
// =============================
// Unit of work 2
// =============================
// Load bean on top of bean2. field2's new value of the transient
// entity bean2 should be preserved after we make it persistent and load
// into it.
logger.info("Loading bean database info into bean2 ...");
Session session2 = environment.getSession();
session2.beginTransaction();
session2.load(bean2, bean.getId());
session2.getTransaction().commit();
logger.info("bean2 = " + bean2);
Assert.assertEquals("new value 2", bean2.getField2());
session2.close();
}
/**
* Test saving an entity, then loading it, then changing some fields and
* re-loading. Does <code>load()</code> override these fields?
*/
@Test
public void testLoadIntoPersistent()
{
Session session = environment.getSession();
// Create and save a new object
logger.info("Creating a new object...");
Bean bean = new Bean("value1", "value2");
logger.info("bean = " + bean);
logger.info("Saving bean to database...");
session.beginTransaction();
session.save(bean);
session.getTransaction().commit();
logger.info("bean = " + bean);
// Load object and change some fields
Bean bean2 = (Bean) session.load(Bean.class, bean.getId());
bean2.setField1("New value 1");
logger.info("bean2 = " + bean2);
// Re-load object into bean2
logger.info("Reloading...");
session.beginTransaction();
Bean bean3 = (Bean) session.load(Bean.class, bean.getId());
logger.info("bean3 = " + bean3);
// bean3.field1 has the updated value from bean2 because it is the
// unique
// entity associated with the session.
Assert.assertEquals("New value 1", bean3.getField1());
}
/**
* Test loading into a transient entity. Does <code>load()</code> override
* the transient entity's fields if they are different than the database
* values?
*/
@Test
public void testLoadIntoTransient()
{
Session session = environment.getSession();
// Create and save a new object
logger.info("Creating a new object...");
Bean bean = new Bean("value1", "value2");
logger.info("bean = " + bean);
logger.info("Saving bean to database...");
session.beginTransaction();
session.save(bean);
session.getTransaction().commit();
logger.info("bean = " + bean);
// Make a new transient object and change some fields
Bean bean2 = new Bean();
bean2.setField1("New value 1");
logger.info("bean2 = " + bean2);
// Load object into bean2
logger.info("Reloading...");
session.beginTransaction();
bean2 = (Bean) session.get(Bean.class, bean.getId());
// Yes, all of bean2's persistent fields will be overridden
Assert.assertEquals("value1", bean2.getField1());
}
/**
* Test saving an entity, then loading it, then changing some fields and
* re-loading. Does <code>load()</code> override these fields?
*/
@Test
public void testMerge()
{
Session session = environment.getSession();
// Create and save a new object
logger.info("Creating a new object...");
Bean bean = new Bean("value1", "value2");
logger.info("bean = " + bean);
logger.info("Saving bean to database...");
session.beginTransaction();
session.save(bean);
session.getTransaction().commit();
logger.info("bean = " + bean);
// Load object
Bean bean2 = (Bean) session.load(Bean.class, bean.getId());
bean2.setField1("New value 1");
logger.info("bean2 = " + bean2);
// Merge transient object into persistent entity and save to the
// database
logger.info("Reloading...");
session.beginTransaction();
session.merge(bean2);
session.getTransaction().commit();
logger.info("bean2 = " + bean2);
// Re-load object
Bean bean3 = (Bean) session.load(Bean.class, bean.getId());
logger.info("bean3 = " + bean3);
Assert.assertEquals("New value 1", bean3.getField1());
}
}
| [
"shantanu.rautela@gmail.com"
] | shantanu.rautela@gmail.com |
e831e5b27fddd4fd1907b3afc7991f83b04d2190 | f0bbd40bb31068f0e6daa1a6c071af7b51b4aa27 | /Singleton/Singleton/src/module-info.java | a2a4cceed34eaa23663034f1b86fb99912fcb89c | [] | no_license | walesson31003/Padr-es-de-Projeto | 1f40c282afb58f00178145172f286b7d8739f762 | a8f0f7d388692127d5f4e0ffd88d268547e5bc4a | refs/heads/master | 2022-07-06T12:29:26.311495 | 2020-05-12T14:54:07 | 2020-05-12T14:54:07 | 258,634,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44 | java | module Singleton {
requires java.desktop;
} | [
"62893260+walesson31003@users.noreply.github.com"
] | 62893260+walesson31003@users.noreply.github.com |
99285c7af8b0367cb10f17be5556716dee71019d | f718c2013bb32b9ce63e64a80fc89cd4f4e5b0a1 | /src/main/java/com/ysu/forum/community/controller/AuthorizeController.java | 2a9a69046f199a92a7579c4ff26a67626a9c3e33 | [] | no_license | Sea9781/community | e513d75453f10aae3ede60469d5650b6cfb33d6e | fa56cbe4b1c3b621d23177dc2f6fe302c39f58fa | refs/heads/master | 2022-06-23T06:41:48.717549 | 2021-11-08T08:37:17 | 2021-11-08T08:37:17 | 205,680,652 | 0 | 0 | null | 2022-06-17T02:29:16 | 2019-09-01T13:34:15 | Java | UTF-8 | Java | false | false | 2,471 | java | package com.ysu.forum.community.controller;
import com.ysu.forum.community.dto.AccessTokenDTO;
import com.ysu.forum.community.dto.GithubUser;
import com.ysu.forum.community.mapper.UserMapper;
import com.ysu.forum.community.model.User;
import com.ysu.forum.community.provider.GithubProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.util.UUID;
/**
* @program: community
* @description:
* @author: Sea
* @create: 2019-09-02 10:24
**/
@Controller
public class AuthorizeController {
@Autowired
private GithubProvider githubProvider;
@Autowired
private UserMapper userMapper;
@Value("${github.client.id}")
private String clientId;
@Value("${github.client.secret}")
private String clientSecret;
@Value("${github.redirect.uri}")
private String redirectUri;
@GetMapping("/callback")
public String callback(@RequestParam(name = "code")String code,
@RequestParam(name = "state")String state,
HttpServletResponse response){
AccessTokenDTO accessTokenDTO = new AccessTokenDTO();
accessTokenDTO.setClient_id(clientId);
accessTokenDTO.setClient_secret(clientSecret);
accessTokenDTO.setCode(code);
accessTokenDTO.setRedirect_uri(redirectUri);
accessTokenDTO.setState(state);
String accessToken = githubProvider.getAccessToken(accessTokenDTO);
GithubUser githubUser = githubProvider.getUser(accessToken);
if (githubUser!=null && githubUser.getId()!=null){
//登录成功
User user=new User();
String token = UUID.randomUUID().toString();
user.setToken(token);
user.setName(githubUser.getName());
user.setAccount_id(String.valueOf(githubUser.getId()));
user.setGmt_create(System.currentTimeMillis());
user.setGmt_modified(user.getGmt_create());
user.setAvatar_url(githubUser.getAvatar_url());
userMapper.insert(user);
response.addCookie(new Cookie("token",token));
return "redirect:/";
}else {
//登录失败
return "redirect:/";
}
}
}
| [
"351728210@qq.com"
] | 351728210@qq.com |
3b18e77de41a2b16ed50e86e86bc54c1590b6a01 | a2273822e8eff41ab0bf519ec7873fa3a702e2c8 | /bucketlist/src/main/java/kr/ac/jejunu/bucketlist/BucketlistApplication.java | 9359e0da4dbd48340d5c38897de7fc387bebfaa0 | [] | no_license | ki-squared/bucket-list | fcf59e784134d4576d61d0086489a5a68829690e | d0d50201e2cacd790454fe32355868f8b7f45f10 | refs/heads/main | 2023-06-09T11:30:13.121562 | 2021-06-17T17:21:41 | 2021-06-17T17:21:41 | 374,376,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package kr.ac.jejunu.bucketlist;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BucketlistApplication {
public static void main(String[] args) {
SpringApplication.run(BucketlistApplication.class, args);
}
}
| [
"abt.jade@gmail.com"
] | abt.jade@gmail.com |
63ba4dd0c0cadec3e21e817eed3abb37e0e130ce | dbeb8038e20d4bab7cef165b8eb2688abd3f8fd0 | /corejava_assignment1/src/corejava_assignment1/program6.java | e604c2da9ccd8bdfd99e473b4f4477fdd77eb42b | [] | no_license | manish15006/manish15006-freshersbatch-aug14 | bb32c5b30bbf281534369990fa0380d5e5b07e03 | 8569b4ebe9b3d94f7b7b6578e6df57ec9c287d24 | refs/heads/master | 2023-08-29T12:12:56.695034 | 2021-10-09T13:53:20 | 2021-10-09T13:53:20 | 399,555,715 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,297 | java | package corejava_assignment1;
import java.util.Scanner;
public class program6 {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner sc = new Scanner(System.in);
String sp=" ";
System.out.println("Enter the Username");
String uname = sc.nextLine();
if((uname.contains(sp)) || uname.length()<4){
System.out.println("Invalid Username"+"\nminimum 4 digits are requited as username");
return;
}
System.out.println("Enter the Password");
String upass = sc.nextLine();
if((upass.contains(sp)) || upass.length()<8){
System.out.println("Invalid Password"+"\nminimum 8 digits are requited as password");
return;
}
System.out.println(uname+" you are Registered Successfully");
System.out.println("Enter the Username");
String lname = sc.nextLine();
System.out.println("Enter the Password");
String lpass = sc.nextLine();
if(uname.equals(lname) && upass.equals(lpass)){
System.out.println("Welcome "+lname+" you have Logged-in Successfully");
}
else{
System.out.println("Username or password Mismatch");
}
}
}
| [
"gudupalimanish@gmail.com"
] | gudupalimanish@gmail.com |
036aa8a1e66e8827790f48b650788116f62de5c3 | 903f5a22777f1ab6048b1b740707d6f6c5b774f2 | /app/src/test/java/com/cl/baseapplication/ExampleUnitTest.java | 84e68c8b1e10878e5160b9222e19b7f99cd0fc38 | [] | no_license | chenliang4561/BaseApplication | a8ab96bbfff1fda7b329bdf53f54bf2b4b2be2e2 | 0b3407358d7cfe600a36a699810db72cdae88635 | refs/heads/master | 2020-03-18T11:26:10.098224 | 2018-08-14T06:56:40 | 2018-08-14T06:56:40 | 134,671,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package com.cl.baseapplication;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"chenliang4561@163.com"
] | chenliang4561@163.com |
5721e695101da0d52ea84518ae573393924da31c | 35f49d9e0bbf6e7baa4ec0102c00b54bd30a706e | /src/hackerrank/funny_string/Solution.java | 74e85413d9451f3129cf045fd7a6cc75ef848c99 | [] | no_license | weisuodadao/Algorithm | c48dfa0e6b1878c2b04815379b9ed26c9e1dfef9 | 696c7e5fabaf940a372843f942a74a8d3482b7f0 | refs/heads/master | 2021-09-04T04:56:46.652549 | 2018-01-16T03:18:22 | 2018-01-16T03:18:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package hackerrank.funny_string;
import java.util.Scanner;
public class Solution {
static String funnyString(String s){
for (int len = s.length(), i = 1, j = len - 2; i < len && j >= 0; ++i, --j) {
if (Math.abs(s.charAt(i) - s.charAt(i - 1)) != Math.abs(s.charAt(j) - s.charAt(j + 1))) {
return "Not Funny";
}
}
return "Funny";
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int q = in.nextInt();
for(int a0 = 0; a0 < q; a0++){
String s = in.next();
String result = funnyString(s);
System.out.println(result);
}
}
}
| [
"tharelam216@gmail.com"
] | tharelam216@gmail.com |
3bb258c89d5b9e52e54f6c0bcffdab2691de637e | 3edcc68675d075f4039d64d8bd4af82be285d512 | /app/src/main/java/com/example/todo/MainActivity.java | 8e870491f6bf967d5353225ee36e5693d4959982 | [] | no_license | salitha10/TODO-APP | 68f12d359e568d9cfc04c7079cf0238ae77c8800 | 24c5e4330088d73a22fed177940a745dd72326cd | refs/heads/main | 2023-05-12T07:55:52.205705 | 2021-06-03T13:31:29 | 2021-06-03T13:31:29 | 371,923,050 | 1 | 0 | null | 2021-06-03T13:31:30 | 2021-05-29T08:41:51 | Java | UTF-8 | Java | false | false | 4,121 | java | package com.example.todo;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private ListView todoList;
private TextView countTxt;
private Button addTodo;
private List<ToDoModel> toDos;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
todoList = (ListView)findViewById(R.id.listViewToDo);
countTxt = (TextView)findViewById(R.id.txtCount);
addTodo = (Button)findViewById(R.id.btnAdd);
toDos = new ArrayList<>();
addTodo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Go to next activity
startActivity(new Intent(getApplicationContext(), AddToDO.class));
}
});
}
@Override
protected void onResume() {
super.onResume();
DBHandler dbh = new DBHandler(getApplicationContext());
//Set count
int count = dbh.getCountTODO();
countTxt.setText("You have " + count + " TODOs");
//Save list
toDos = dbh.getAllToDos();
//Set adapter to list
ToDoAdapter toDoAdapter = new ToDoAdapter(getApplicationContext(), R.layout.todo_cardview, toDos);
todoList.setAdapter(toDoAdapter);
//Add click listener to list element
todoList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//Get clicked item
ToDoModel todo = toDos.get(position);
//Dialog box
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(todo.getTitle());
builder.setMessage(todo.getDescription());
//Buttons
builder.setNegativeButton("Delete", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dbh.deleteItem(todo.getId());
Toast.makeText(getApplicationContext(), "ToDo Deleted", Toast.LENGTH_SHORT).show();
startActivity(new Intent(getApplicationContext(), MainActivity.class));
}
});
builder.setPositiveButton("Finished", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
long time = System.currentTimeMillis();
//Update status
dbh.updateFinished(todo.getId(), time);
startActivity(new Intent(getApplicationContext(), MainActivity.class));
}
});
builder.setNeutralButton("Edit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(MainActivity.this, AddToDO.class);
intent.putExtra("id", todo.getId());
intent.putExtra("title", todo.getTitle());
intent.putExtra("description", todo.getDescription());
intent.putExtra("finished", todo.getFinished());
startActivity(intent);
}
});
builder.show();
}
});
}
} | [
"salithaniranjana@gmail.com"
] | salithaniranjana@gmail.com |
24633cb4af435198c4ee613de9ff3f812c8cc771 | 29ac3ec99471d27aea0838d35c0979d31768e24b | /clients/google-api-services-alertcenter/v1beta1/1.30.1/com/google/api/services/alertcenter/v1beta1/AlertCenter.java | 3706ffb7bd112e2ee6dbb35c862b9be668d9a122 | [
"Apache-2.0"
] | permissive | chrislatimer/google-api-java-client-services | 8d8f8ff22e2c4866100b447e621aba4a17f5eba3 | 4044138392b3a29018b60ca622d27c07410569b2 | refs/heads/master | 2020-12-24T03:15:02.714672 | 2020-01-30T18:18:13 | 2020-01-30T18:18:13 | 237,362,140 | 0 | 1 | Apache-2.0 | 2020-01-31T04:48:38 | 2020-01-31T04:48:37 | null | UTF-8 | Java | false | false | 69,832 | java | /*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.alertcenter.v1beta1;
/**
* Service definition for AlertCenter (v1beta1).
*
* <p>
* Manages alerts on issues affecting your domain.
* </p>
*
* <p>
* For more information about this service, see the
* <a href="https://developers.google.com/admin-sdk/alertcenter/" target="_blank">API Documentation</a>
* </p>
*
* <p>
* This service uses {@link AlertCenterRequestInitializer} to initialize global parameters via its
* {@link Builder}.
* </p>
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class AlertCenter extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
com.google.api.client.util.Preconditions.checkState(
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.15 of google-api-client to run version " +
"1.30.3 of the G Suite Alert Center API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
}
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://alertcenter.googleapis.com/";
/**
* The default encoded service path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_SERVICE_PATH = "";
/**
* The default encoded batch path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.23
*/
public static final String DEFAULT_BATCH_PATH = "batch";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
*/
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
* <p>
* Use {@link Builder} if you need to specify any of the optional parameters.
* </p>
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public AlertCenter(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
this(new Builder(transport, jsonFactory, httpRequestInitializer));
}
/**
* @param builder builder
*/
AlertCenter(Builder builder) {
super(builder);
}
@Override
protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* An accessor for creating requests from the Alerts collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code AlertCenter alertcenter = new AlertCenter(...);}
* {@code AlertCenter.Alerts.List request = alertcenter.alerts().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Alerts alerts() {
return new Alerts();
}
/**
* The "alerts" collection of methods.
*/
public class Alerts {
/**
* Performs batch delete operation on alerts.
*
* Create a request for the method "alerts.batchDelete".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link BatchDelete#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.BatchDeleteAlertsRequest}
* @return the request
*/
public BatchDelete batchDelete(com.google.api.services.alertcenter.v1beta1.model.BatchDeleteAlertsRequest content) throws java.io.IOException {
BatchDelete result = new BatchDelete(content);
initialize(result);
return result;
}
public class BatchDelete extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.BatchDeleteAlertsResponse> {
private static final String REST_PATH = "v1beta1/alerts:batchDelete";
/**
* Performs batch delete operation on alerts.
*
* Create a request for the method "alerts.batchDelete".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link BatchDelete#execute()} method to invoke the remote
* operation. <p> {@link
* BatchDelete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.BatchDeleteAlertsRequest}
* @since 1.13
*/
protected BatchDelete(com.google.api.services.alertcenter.v1beta1.model.BatchDeleteAlertsRequest content) {
super(AlertCenter.this, "POST", REST_PATH, content, com.google.api.services.alertcenter.v1beta1.model.BatchDeleteAlertsResponse.class);
}
@Override
public BatchDelete set$Xgafv(java.lang.String $Xgafv) {
return (BatchDelete) super.set$Xgafv($Xgafv);
}
@Override
public BatchDelete setAccessToken(java.lang.String accessToken) {
return (BatchDelete) super.setAccessToken(accessToken);
}
@Override
public BatchDelete setAlt(java.lang.String alt) {
return (BatchDelete) super.setAlt(alt);
}
@Override
public BatchDelete setCallback(java.lang.String callback) {
return (BatchDelete) super.setCallback(callback);
}
@Override
public BatchDelete setFields(java.lang.String fields) {
return (BatchDelete) super.setFields(fields);
}
@Override
public BatchDelete setKey(java.lang.String key) {
return (BatchDelete) super.setKey(key);
}
@Override
public BatchDelete setOauthToken(java.lang.String oauthToken) {
return (BatchDelete) super.setOauthToken(oauthToken);
}
@Override
public BatchDelete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (BatchDelete) super.setPrettyPrint(prettyPrint);
}
@Override
public BatchDelete setQuotaUser(java.lang.String quotaUser) {
return (BatchDelete) super.setQuotaUser(quotaUser);
}
@Override
public BatchDelete setUploadType(java.lang.String uploadType) {
return (BatchDelete) super.setUploadType(uploadType);
}
@Override
public BatchDelete setUploadProtocol(java.lang.String uploadProtocol) {
return (BatchDelete) super.setUploadProtocol(uploadProtocol);
}
@Override
public BatchDelete set(String parameterName, Object value) {
return (BatchDelete) super.set(parameterName, value);
}
}
/**
* Performs batch undelete operation on alerts.
*
* Create a request for the method "alerts.batchUndelete".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link BatchUndelete#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.BatchUndeleteAlertsRequest}
* @return the request
*/
public BatchUndelete batchUndelete(com.google.api.services.alertcenter.v1beta1.model.BatchUndeleteAlertsRequest content) throws java.io.IOException {
BatchUndelete result = new BatchUndelete(content);
initialize(result);
return result;
}
public class BatchUndelete extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.BatchUndeleteAlertsResponse> {
private static final String REST_PATH = "v1beta1/alerts:batchUndelete";
/**
* Performs batch undelete operation on alerts.
*
* Create a request for the method "alerts.batchUndelete".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link BatchUndelete#execute()} method to invoke the remote
* operation. <p> {@link BatchUndelete#initialize(com.google.api.client.googleapis.services.Abstra
* ctGoogleClientRequest)} must be called to initialize this instance immediately after invoking
* the constructor. </p>
*
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.BatchUndeleteAlertsRequest}
* @since 1.13
*/
protected BatchUndelete(com.google.api.services.alertcenter.v1beta1.model.BatchUndeleteAlertsRequest content) {
super(AlertCenter.this, "POST", REST_PATH, content, com.google.api.services.alertcenter.v1beta1.model.BatchUndeleteAlertsResponse.class);
}
@Override
public BatchUndelete set$Xgafv(java.lang.String $Xgafv) {
return (BatchUndelete) super.set$Xgafv($Xgafv);
}
@Override
public BatchUndelete setAccessToken(java.lang.String accessToken) {
return (BatchUndelete) super.setAccessToken(accessToken);
}
@Override
public BatchUndelete setAlt(java.lang.String alt) {
return (BatchUndelete) super.setAlt(alt);
}
@Override
public BatchUndelete setCallback(java.lang.String callback) {
return (BatchUndelete) super.setCallback(callback);
}
@Override
public BatchUndelete setFields(java.lang.String fields) {
return (BatchUndelete) super.setFields(fields);
}
@Override
public BatchUndelete setKey(java.lang.String key) {
return (BatchUndelete) super.setKey(key);
}
@Override
public BatchUndelete setOauthToken(java.lang.String oauthToken) {
return (BatchUndelete) super.setOauthToken(oauthToken);
}
@Override
public BatchUndelete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (BatchUndelete) super.setPrettyPrint(prettyPrint);
}
@Override
public BatchUndelete setQuotaUser(java.lang.String quotaUser) {
return (BatchUndelete) super.setQuotaUser(quotaUser);
}
@Override
public BatchUndelete setUploadType(java.lang.String uploadType) {
return (BatchUndelete) super.setUploadType(uploadType);
}
@Override
public BatchUndelete setUploadProtocol(java.lang.String uploadProtocol) {
return (BatchUndelete) super.setUploadProtocol(uploadProtocol);
}
@Override
public BatchUndelete set(String parameterName, Object value) {
return (BatchUndelete) super.set(parameterName, value);
}
}
/**
* Marks the specified alert for deletion. An alert that has been marked for deletion is removed
* from Alert Center after 30 days. Marking an alert for deletion has no effect on an alert which
* has already been marked for deletion. Attempting to mark a nonexistent alert for deletion results
* in a `NOT_FOUND` error.
*
* Create a request for the method "alerts.delete".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param alertId Required. The identifier of the alert to delete.
* @return the request
*/
public Delete delete(java.lang.String alertId) throws java.io.IOException {
Delete result = new Delete(alertId);
initialize(result);
return result;
}
public class Delete extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.Empty> {
private static final String REST_PATH = "v1beta1/alerts/{alertId}";
/**
* Marks the specified alert for deletion. An alert that has been marked for deletion is removed
* from Alert Center after 30 days. Marking an alert for deletion has no effect on an alert which
* has already been marked for deletion. Attempting to mark a nonexistent alert for deletion
* results in a `NOT_FOUND` error.
*
* Create a request for the method "alerts.delete".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param alertId Required. The identifier of the alert to delete.
* @since 1.13
*/
protected Delete(java.lang.String alertId) {
super(AlertCenter.this, "DELETE", REST_PATH, null, com.google.api.services.alertcenter.v1beta1.model.Empty.class);
this.alertId = com.google.api.client.util.Preconditions.checkNotNull(alertId, "Required parameter alertId must be specified.");
}
@Override
public Delete set$Xgafv(java.lang.String $Xgafv) {
return (Delete) super.set$Xgafv($Xgafv);
}
@Override
public Delete setAccessToken(java.lang.String accessToken) {
return (Delete) super.setAccessToken(accessToken);
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setCallback(java.lang.String callback) {
return (Delete) super.setCallback(callback);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUploadType(java.lang.String uploadType) {
return (Delete) super.setUploadType(uploadType);
}
@Override
public Delete setUploadProtocol(java.lang.String uploadProtocol) {
return (Delete) super.setUploadProtocol(uploadProtocol);
}
/** Required. The identifier of the alert to delete. */
@com.google.api.client.util.Key
private java.lang.String alertId;
/** Required. The identifier of the alert to delete.
*/
public java.lang.String getAlertId() {
return alertId;
}
/** Required. The identifier of the alert to delete. */
public Delete setAlertId(java.lang.String alertId) {
this.alertId = alertId;
return this;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert is associated with. Inferred from the caller identity if not provided.
*/
@com.google.api.client.util.Key
private java.lang.String customerId;
/** Optional. The unique identifier of the G Suite organization account of the customer the alert is
associated with. Inferred from the caller identity if not provided.
*/
public java.lang.String getCustomerId() {
return customerId;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert is associated with. Inferred from the caller identity if not provided.
*/
public Delete setCustomerId(java.lang.String customerId) {
this.customerId = customerId;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Gets the specified alert. Attempting to get a nonexistent alert returns `NOT_FOUND` error.
*
* Create a request for the method "alerts.get".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param alertId Required. The identifier of the alert to retrieve.
* @return the request
*/
public Get get(java.lang.String alertId) throws java.io.IOException {
Get result = new Get(alertId);
initialize(result);
return result;
}
public class Get extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.Alert> {
private static final String REST_PATH = "v1beta1/alerts/{alertId}";
/**
* Gets the specified alert. Attempting to get a nonexistent alert returns `NOT_FOUND` error.
*
* Create a request for the method "alerts.get".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p>
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param alertId Required. The identifier of the alert to retrieve.
* @since 1.13
*/
protected Get(java.lang.String alertId) {
super(AlertCenter.this, "GET", REST_PATH, null, com.google.api.services.alertcenter.v1beta1.model.Alert.class);
this.alertId = com.google.api.client.util.Preconditions.checkNotNull(alertId, "Required parameter alertId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get set$Xgafv(java.lang.String $Xgafv) {
return (Get) super.set$Xgafv($Xgafv);
}
@Override
public Get setAccessToken(java.lang.String accessToken) {
return (Get) super.setAccessToken(accessToken);
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setCallback(java.lang.String callback) {
return (Get) super.setCallback(callback);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUploadType(java.lang.String uploadType) {
return (Get) super.setUploadType(uploadType);
}
@Override
public Get setUploadProtocol(java.lang.String uploadProtocol) {
return (Get) super.setUploadProtocol(uploadProtocol);
}
/** Required. The identifier of the alert to retrieve. */
@com.google.api.client.util.Key
private java.lang.String alertId;
/** Required. The identifier of the alert to retrieve.
*/
public java.lang.String getAlertId() {
return alertId;
}
/** Required. The identifier of the alert to retrieve. */
public Get setAlertId(java.lang.String alertId) {
this.alertId = alertId;
return this;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert is associated with. Inferred from the caller identity if not provided.
*/
@com.google.api.client.util.Key
private java.lang.String customerId;
/** Optional. The unique identifier of the G Suite organization account of the customer the alert is
associated with. Inferred from the caller identity if not provided.
*/
public java.lang.String getCustomerId() {
return customerId;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert is associated with. Inferred from the caller identity if not provided.
*/
public Get setCustomerId(java.lang.String customerId) {
this.customerId = customerId;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Returns the metadata of an alert. Attempting to get metadata for a non-existent alert returns
* `NOT_FOUND` error.
*
* Create a request for the method "alerts.getMetadata".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link GetMetadata#execute()} method to invoke the remote operation.
*
* @param alertId Required. The identifier of the alert this metadata belongs to.
* @return the request
*/
public GetMetadata getMetadata(java.lang.String alertId) throws java.io.IOException {
GetMetadata result = new GetMetadata(alertId);
initialize(result);
return result;
}
public class GetMetadata extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.AlertMetadata> {
private static final String REST_PATH = "v1beta1/alerts/{alertId}/metadata";
/**
* Returns the metadata of an alert. Attempting to get metadata for a non-existent alert returns
* `NOT_FOUND` error.
*
* Create a request for the method "alerts.getMetadata".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link GetMetadata#execute()} method to invoke the remote
* operation. <p> {@link
* GetMetadata#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param alertId Required. The identifier of the alert this metadata belongs to.
* @since 1.13
*/
protected GetMetadata(java.lang.String alertId) {
super(AlertCenter.this, "GET", REST_PATH, null, com.google.api.services.alertcenter.v1beta1.model.AlertMetadata.class);
this.alertId = com.google.api.client.util.Preconditions.checkNotNull(alertId, "Required parameter alertId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public GetMetadata set$Xgafv(java.lang.String $Xgafv) {
return (GetMetadata) super.set$Xgafv($Xgafv);
}
@Override
public GetMetadata setAccessToken(java.lang.String accessToken) {
return (GetMetadata) super.setAccessToken(accessToken);
}
@Override
public GetMetadata setAlt(java.lang.String alt) {
return (GetMetadata) super.setAlt(alt);
}
@Override
public GetMetadata setCallback(java.lang.String callback) {
return (GetMetadata) super.setCallback(callback);
}
@Override
public GetMetadata setFields(java.lang.String fields) {
return (GetMetadata) super.setFields(fields);
}
@Override
public GetMetadata setKey(java.lang.String key) {
return (GetMetadata) super.setKey(key);
}
@Override
public GetMetadata setOauthToken(java.lang.String oauthToken) {
return (GetMetadata) super.setOauthToken(oauthToken);
}
@Override
public GetMetadata setPrettyPrint(java.lang.Boolean prettyPrint) {
return (GetMetadata) super.setPrettyPrint(prettyPrint);
}
@Override
public GetMetadata setQuotaUser(java.lang.String quotaUser) {
return (GetMetadata) super.setQuotaUser(quotaUser);
}
@Override
public GetMetadata setUploadType(java.lang.String uploadType) {
return (GetMetadata) super.setUploadType(uploadType);
}
@Override
public GetMetadata setUploadProtocol(java.lang.String uploadProtocol) {
return (GetMetadata) super.setUploadProtocol(uploadProtocol);
}
/** Required. The identifier of the alert this metadata belongs to. */
@com.google.api.client.util.Key
private java.lang.String alertId;
/** Required. The identifier of the alert this metadata belongs to.
*/
public java.lang.String getAlertId() {
return alertId;
}
/** Required. The identifier of the alert this metadata belongs to. */
public GetMetadata setAlertId(java.lang.String alertId) {
this.alertId = alertId;
return this;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert metadata is associated with. Inferred from the caller identity if not provided.
*/
@com.google.api.client.util.Key
private java.lang.String customerId;
/** Optional. The unique identifier of the G Suite organization account of the customer the alert
metadata is associated with. Inferred from the caller identity if not provided.
*/
public java.lang.String getCustomerId() {
return customerId;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert metadata is associated with. Inferred from the caller identity if not provided.
*/
public GetMetadata setCustomerId(java.lang.String customerId) {
this.customerId = customerId;
return this;
}
@Override
public GetMetadata set(String parameterName, Object value) {
return (GetMetadata) super.set(parameterName, value);
}
}
/**
* Lists the alerts.
*
* Create a request for the method "alerts.list".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @return the request
*/
public List list() throws java.io.IOException {
List result = new List();
initialize(result);
return result;
}
public class List extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.ListAlertsResponse> {
private static final String REST_PATH = "v1beta1/alerts";
/**
* Lists the alerts.
*
* Create a request for the method "alerts.list".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected List() {
super(AlertCenter.this, "GET", REST_PATH, null, com.google.api.services.alertcenter.v1beta1.model.ListAlertsResponse.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List set$Xgafv(java.lang.String $Xgafv) {
return (List) super.set$Xgafv($Xgafv);
}
@Override
public List setAccessToken(java.lang.String accessToken) {
return (List) super.setAccessToken(accessToken);
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setCallback(java.lang.String callback) {
return (List) super.setCallback(callback);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUploadType(java.lang.String uploadType) {
return (List) super.setUploadType(uploadType);
}
@Override
public List setUploadProtocol(java.lang.String uploadProtocol) {
return (List) super.setUploadProtocol(uploadProtocol);
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alerts are associated with. Inferred from the caller identity if not provided.
*/
@com.google.api.client.util.Key
private java.lang.String customerId;
/** Optional. The unique identifier of the G Suite organization account of the customer the alerts are
associated with. Inferred from the caller identity if not provided.
*/
public java.lang.String getCustomerId() {
return customerId;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alerts are associated with. Inferred from the caller identity if not provided.
*/
public List setCustomerId(java.lang.String customerId) {
this.customerId = customerId;
return this;
}
/**
* Optional. A query string for filtering alert results. For more details, see [Query filters
* ](/admin-sdk/alertcenter/guides/query-filters) and [Supported query filter fields](/admin-
* sdk/alertcenter/reference/filter-fields#alerts.list).
*/
@com.google.api.client.util.Key
private java.lang.String filter;
/** Optional. A query string for filtering alert results. For more details, see [Query filters](/admin-
sdk/alertcenter/guides/query-filters) and [Supported query filter fields](/admin-
sdk/alertcenter/reference/filter-fields#alerts.list).
*/
public java.lang.String getFilter() {
return filter;
}
/**
* Optional. A query string for filtering alert results. For more details, see [Query filters
* ](/admin-sdk/alertcenter/guides/query-filters) and [Supported query filter fields](/admin-
* sdk/alertcenter/reference/filter-fields#alerts.list).
*/
public List setFilter(java.lang.String filter) {
this.filter = filter;
return this;
}
/**
* Optional. The sort order of the list results. If not specified results may be returned in
* arbitrary order. You can sort the results in descending order based on the creation
* timestamp using `order_by="create_time desc"`. Currently, supported sorting are
* `create_time asc`, `create_time desc`, `update_time desc`
*/
@com.google.api.client.util.Key
private java.lang.String orderBy;
/** Optional. The sort order of the list results. If not specified results may be returned in arbitrary
order. You can sort the results in descending order based on the creation timestamp using
`order_by="create_time desc"`. Currently, supported sorting are `create_time asc`, `create_time
desc`, `update_time desc`
*/
public java.lang.String getOrderBy() {
return orderBy;
}
/**
* Optional. The sort order of the list results. If not specified results may be returned in
* arbitrary order. You can sort the results in descending order based on the creation
* timestamp using `order_by="create_time desc"`. Currently, supported sorting are
* `create_time asc`, `create_time desc`, `update_time desc`
*/
public List setOrderBy(java.lang.String orderBy) {
this.orderBy = orderBy;
return this;
}
/**
* Optional. The requested page size. Server may return fewer items than requested. If
* unspecified, server picks an appropriate default.
*/
@com.google.api.client.util.Key
private java.lang.Integer pageSize;
/** Optional. The requested page size. Server may return fewer items than requested. If unspecified,
server picks an appropriate default.
*/
public java.lang.Integer getPageSize() {
return pageSize;
}
/**
* Optional. The requested page size. Server may return fewer items than requested. If
* unspecified, server picks an appropriate default.
*/
public List setPageSize(java.lang.Integer pageSize) {
this.pageSize = pageSize;
return this;
}
/**
* Optional. A token identifying a page of results the server should return. If empty, a new
* iteration is started. To continue an iteration, pass in the value from the previous
* ListAlertsResponse's next_page_token field.
*/
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Optional. A token identifying a page of results the server should return. If empty, a new iteration
is started. To continue an iteration, pass in the value from the previous ListAlertsResponse's
next_page_token field.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/**
* Optional. A token identifying a page of results the server should return. If empty, a new
* iteration is started. To continue an iteration, pass in the value from the previous
* ListAlertsResponse's next_page_token field.
*/
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Restores, or "undeletes", an alert that was marked for deletion within the past 30 days.
* Attempting to undelete an alert which was marked for deletion over 30 days ago (which has been
* removed from the Alert Center database) or a nonexistent alert returns a `NOT_FOUND` error.
* Attempting to undelete an alert which has not been marked for deletion has no effect.
*
* Create a request for the method "alerts.undelete".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link Undelete#execute()} method to invoke the remote operation.
*
* @param alertId Required. The identifier of the alert to undelete.
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.UndeleteAlertRequest}
* @return the request
*/
public Undelete undelete(java.lang.String alertId, com.google.api.services.alertcenter.v1beta1.model.UndeleteAlertRequest content) throws java.io.IOException {
Undelete result = new Undelete(alertId, content);
initialize(result);
return result;
}
public class Undelete extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.Alert> {
private static final String REST_PATH = "v1beta1/alerts/{alertId}:undelete";
/**
* Restores, or "undeletes", an alert that was marked for deletion within the past 30 days.
* Attempting to undelete an alert which was marked for deletion over 30 days ago (which has been
* removed from the Alert Center database) or a nonexistent alert returns a `NOT_FOUND` error.
* Attempting to undelete an alert which has not been marked for deletion has no effect.
*
* Create a request for the method "alerts.undelete".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link Undelete#execute()} method to invoke the remote operation.
* <p> {@link
* Undelete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param alertId Required. The identifier of the alert to undelete.
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.UndeleteAlertRequest}
* @since 1.13
*/
protected Undelete(java.lang.String alertId, com.google.api.services.alertcenter.v1beta1.model.UndeleteAlertRequest content) {
super(AlertCenter.this, "POST", REST_PATH, content, com.google.api.services.alertcenter.v1beta1.model.Alert.class);
this.alertId = com.google.api.client.util.Preconditions.checkNotNull(alertId, "Required parameter alertId must be specified.");
}
@Override
public Undelete set$Xgafv(java.lang.String $Xgafv) {
return (Undelete) super.set$Xgafv($Xgafv);
}
@Override
public Undelete setAccessToken(java.lang.String accessToken) {
return (Undelete) super.setAccessToken(accessToken);
}
@Override
public Undelete setAlt(java.lang.String alt) {
return (Undelete) super.setAlt(alt);
}
@Override
public Undelete setCallback(java.lang.String callback) {
return (Undelete) super.setCallback(callback);
}
@Override
public Undelete setFields(java.lang.String fields) {
return (Undelete) super.setFields(fields);
}
@Override
public Undelete setKey(java.lang.String key) {
return (Undelete) super.setKey(key);
}
@Override
public Undelete setOauthToken(java.lang.String oauthToken) {
return (Undelete) super.setOauthToken(oauthToken);
}
@Override
public Undelete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Undelete) super.setPrettyPrint(prettyPrint);
}
@Override
public Undelete setQuotaUser(java.lang.String quotaUser) {
return (Undelete) super.setQuotaUser(quotaUser);
}
@Override
public Undelete setUploadType(java.lang.String uploadType) {
return (Undelete) super.setUploadType(uploadType);
}
@Override
public Undelete setUploadProtocol(java.lang.String uploadProtocol) {
return (Undelete) super.setUploadProtocol(uploadProtocol);
}
/** Required. The identifier of the alert to undelete. */
@com.google.api.client.util.Key
private java.lang.String alertId;
/** Required. The identifier of the alert to undelete.
*/
public java.lang.String getAlertId() {
return alertId;
}
/** Required. The identifier of the alert to undelete. */
public Undelete setAlertId(java.lang.String alertId) {
this.alertId = alertId;
return this;
}
@Override
public Undelete set(String parameterName, Object value) {
return (Undelete) super.set(parameterName, value);
}
}
/**
* An accessor for creating requests from the Feedback collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code AlertCenter alertcenter = new AlertCenter(...);}
* {@code AlertCenter.Feedback.List request = alertcenter.feedback().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Feedback feedback() {
return new Feedback();
}
/**
* The "feedback" collection of methods.
*/
public class Feedback {
/**
* Creates new feedback for an alert. Attempting to create a feedback for a non-existent alert
* returns `NOT_FOUND` error. Attempting to create a feedback for an alert that is marked for
* deletion returns `FAILED_PRECONDITION' error.
*
* Create a request for the method "feedback.create".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link Create#execute()} method to invoke the remote operation.
*
* @param alertId Required. The identifier of the alert this feedback belongs to.
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.AlertFeedback}
* @return the request
*/
public Create create(java.lang.String alertId, com.google.api.services.alertcenter.v1beta1.model.AlertFeedback content) throws java.io.IOException {
Create result = new Create(alertId, content);
initialize(result);
return result;
}
public class Create extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.AlertFeedback> {
private static final String REST_PATH = "v1beta1/alerts/{alertId}/feedback";
/**
* Creates new feedback for an alert. Attempting to create a feedback for a non-existent alert
* returns `NOT_FOUND` error. Attempting to create a feedback for an alert that is marked for
* deletion returns `FAILED_PRECONDITION' error.
*
* Create a request for the method "feedback.create".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link Create#execute()} method to invoke the remote operation.
* <p> {@link
* Create#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param alertId Required. The identifier of the alert this feedback belongs to.
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.AlertFeedback}
* @since 1.13
*/
protected Create(java.lang.String alertId, com.google.api.services.alertcenter.v1beta1.model.AlertFeedback content) {
super(AlertCenter.this, "POST", REST_PATH, content, com.google.api.services.alertcenter.v1beta1.model.AlertFeedback.class);
this.alertId = com.google.api.client.util.Preconditions.checkNotNull(alertId, "Required parameter alertId must be specified.");
}
@Override
public Create set$Xgafv(java.lang.String $Xgafv) {
return (Create) super.set$Xgafv($Xgafv);
}
@Override
public Create setAccessToken(java.lang.String accessToken) {
return (Create) super.setAccessToken(accessToken);
}
@Override
public Create setAlt(java.lang.String alt) {
return (Create) super.setAlt(alt);
}
@Override
public Create setCallback(java.lang.String callback) {
return (Create) super.setCallback(callback);
}
@Override
public Create setFields(java.lang.String fields) {
return (Create) super.setFields(fields);
}
@Override
public Create setKey(java.lang.String key) {
return (Create) super.setKey(key);
}
@Override
public Create setOauthToken(java.lang.String oauthToken) {
return (Create) super.setOauthToken(oauthToken);
}
@Override
public Create setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Create) super.setPrettyPrint(prettyPrint);
}
@Override
public Create setQuotaUser(java.lang.String quotaUser) {
return (Create) super.setQuotaUser(quotaUser);
}
@Override
public Create setUploadType(java.lang.String uploadType) {
return (Create) super.setUploadType(uploadType);
}
@Override
public Create setUploadProtocol(java.lang.String uploadProtocol) {
return (Create) super.setUploadProtocol(uploadProtocol);
}
/** Required. The identifier of the alert this feedback belongs to. */
@com.google.api.client.util.Key
private java.lang.String alertId;
/** Required. The identifier of the alert this feedback belongs to.
*/
public java.lang.String getAlertId() {
return alertId;
}
/** Required. The identifier of the alert this feedback belongs to. */
public Create setAlertId(java.lang.String alertId) {
this.alertId = alertId;
return this;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert is associated with. Inferred from the caller identity if not provided.
*/
@com.google.api.client.util.Key
private java.lang.String customerId;
/** Optional. The unique identifier of the G Suite organization account of the customer the alert is
associated with. Inferred from the caller identity if not provided.
*/
public java.lang.String getCustomerId() {
return customerId;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert is associated with. Inferred from the caller identity if not provided.
*/
public Create setCustomerId(java.lang.String customerId) {
this.customerId = customerId;
return this;
}
@Override
public Create set(String parameterName, Object value) {
return (Create) super.set(parameterName, value);
}
}
/**
* Lists all the feedback for an alert. Attempting to list feedbacks for a non-existent alert
* returns `NOT_FOUND` error.
*
* Create a request for the method "feedback.list".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param alertId Required. The alert identifier.
The "-" wildcard could be used to represent all alerts.
* @return the request
*/
public List list(java.lang.String alertId) throws java.io.IOException {
List result = new List(alertId);
initialize(result);
return result;
}
public class List extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.ListAlertFeedbackResponse> {
private static final String REST_PATH = "v1beta1/alerts/{alertId}/feedback";
/**
* Lists all the feedback for an alert. Attempting to list feedbacks for a non-existent alert
* returns `NOT_FOUND` error.
*
* Create a request for the method "feedback.list".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p>
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param alertId Required. The alert identifier.
The "-" wildcard could be used to represent all alerts.
* @since 1.13
*/
protected List(java.lang.String alertId) {
super(AlertCenter.this, "GET", REST_PATH, null, com.google.api.services.alertcenter.v1beta1.model.ListAlertFeedbackResponse.class);
this.alertId = com.google.api.client.util.Preconditions.checkNotNull(alertId, "Required parameter alertId must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List set$Xgafv(java.lang.String $Xgafv) {
return (List) super.set$Xgafv($Xgafv);
}
@Override
public List setAccessToken(java.lang.String accessToken) {
return (List) super.setAccessToken(accessToken);
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setCallback(java.lang.String callback) {
return (List) super.setCallback(callback);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUploadType(java.lang.String uploadType) {
return (List) super.setUploadType(uploadType);
}
@Override
public List setUploadProtocol(java.lang.String uploadProtocol) {
return (List) super.setUploadProtocol(uploadProtocol);
}
/**
* Required. The alert identifier. The "-" wildcard could be used to represent all alerts.
*/
@com.google.api.client.util.Key
private java.lang.String alertId;
/** Required. The alert identifier. The "-" wildcard could be used to represent all alerts.
*/
public java.lang.String getAlertId() {
return alertId;
}
/**
* Required. The alert identifier. The "-" wildcard could be used to represent all alerts.
*/
public List setAlertId(java.lang.String alertId) {
this.alertId = alertId;
return this;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert feedback are associated with. Inferred from the caller identity if not provided.
*/
@com.google.api.client.util.Key
private java.lang.String customerId;
/** Optional. The unique identifier of the G Suite organization account of the customer the alert
feedback are associated with. Inferred from the caller identity if not provided.
*/
public java.lang.String getCustomerId() {
return customerId;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert feedback are associated with. Inferred from the caller identity if not provided.
*/
public List setCustomerId(java.lang.String customerId) {
this.customerId = customerId;
return this;
}
/**
* Optional. A query string for filtering alert feedback results. For more details, see
* [Query filters](/admin-sdk/alertcenter/guides/query-filters) and [Supported query filter
* fields](/admin-sdk/alertcenter/reference/filter-fields#alerts.feedback.list).
*/
@com.google.api.client.util.Key
private java.lang.String filter;
/** Optional. A query string for filtering alert feedback results. For more details, see [Query filters
](/admin-sdk/alertcenter/guides/query-filters) and [Supported query filter fields](/admin-
sdk/alertcenter/reference/filter-fields#alerts.feedback.list).
*/
public java.lang.String getFilter() {
return filter;
}
/**
* Optional. A query string for filtering alert feedback results. For more details, see
* [Query filters](/admin-sdk/alertcenter/guides/query-filters) and [Supported query filter
* fields](/admin-sdk/alertcenter/reference/filter-fields#alerts.feedback.list).
*/
public List setFilter(java.lang.String filter) {
this.filter = filter;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
}
/**
* An accessor for creating requests from the V1beta1 collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code AlertCenter alertcenter = new AlertCenter(...);}
* {@code AlertCenter.V1beta1.List request = alertcenter.v1beta1().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public V1beta1 v1beta1() {
return new V1beta1();
}
/**
* The "v1beta1" collection of methods.
*/
public class V1beta1 {
/**
* Returns customer-level settings.
*
* Create a request for the method "v1beta1.getSettings".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link GetSettings#execute()} method to invoke the remote operation.
*
* @return the request
*/
public GetSettings getSettings() throws java.io.IOException {
GetSettings result = new GetSettings();
initialize(result);
return result;
}
public class GetSettings extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.Settings> {
private static final String REST_PATH = "v1beta1/settings";
/**
* Returns customer-level settings.
*
* Create a request for the method "v1beta1.getSettings".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link GetSettings#execute()} method to invoke the remote
* operation. <p> {@link
* GetSettings#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected GetSettings() {
super(AlertCenter.this, "GET", REST_PATH, null, com.google.api.services.alertcenter.v1beta1.model.Settings.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public GetSettings set$Xgafv(java.lang.String $Xgafv) {
return (GetSettings) super.set$Xgafv($Xgafv);
}
@Override
public GetSettings setAccessToken(java.lang.String accessToken) {
return (GetSettings) super.setAccessToken(accessToken);
}
@Override
public GetSettings setAlt(java.lang.String alt) {
return (GetSettings) super.setAlt(alt);
}
@Override
public GetSettings setCallback(java.lang.String callback) {
return (GetSettings) super.setCallback(callback);
}
@Override
public GetSettings setFields(java.lang.String fields) {
return (GetSettings) super.setFields(fields);
}
@Override
public GetSettings setKey(java.lang.String key) {
return (GetSettings) super.setKey(key);
}
@Override
public GetSettings setOauthToken(java.lang.String oauthToken) {
return (GetSettings) super.setOauthToken(oauthToken);
}
@Override
public GetSettings setPrettyPrint(java.lang.Boolean prettyPrint) {
return (GetSettings) super.setPrettyPrint(prettyPrint);
}
@Override
public GetSettings setQuotaUser(java.lang.String quotaUser) {
return (GetSettings) super.setQuotaUser(quotaUser);
}
@Override
public GetSettings setUploadType(java.lang.String uploadType) {
return (GetSettings) super.setUploadType(uploadType);
}
@Override
public GetSettings setUploadProtocol(java.lang.String uploadProtocol) {
return (GetSettings) super.setUploadProtocol(uploadProtocol);
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert settings are associated with. Inferred from the caller identity if not provided.
*/
@com.google.api.client.util.Key
private java.lang.String customerId;
/** Optional. The unique identifier of the G Suite organization account of the customer the alert
settings are associated with. Inferred from the caller identity if not provided.
*/
public java.lang.String getCustomerId() {
return customerId;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert settings are associated with. Inferred from the caller identity if not provided.
*/
public GetSettings setCustomerId(java.lang.String customerId) {
this.customerId = customerId;
return this;
}
@Override
public GetSettings set(String parameterName, Object value) {
return (GetSettings) super.set(parameterName, value);
}
}
/**
* Updates the customer-level settings.
*
* Create a request for the method "v1beta1.updateSettings".
*
* This request holds the parameters needed by the alertcenter server. After setting any optional
* parameters, call the {@link UpdateSettings#execute()} method to invoke the remote operation.
*
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.Settings}
* @return the request
*/
public UpdateSettings updateSettings(com.google.api.services.alertcenter.v1beta1.model.Settings content) throws java.io.IOException {
UpdateSettings result = new UpdateSettings(content);
initialize(result);
return result;
}
public class UpdateSettings extends AlertCenterRequest<com.google.api.services.alertcenter.v1beta1.model.Settings> {
private static final String REST_PATH = "v1beta1/settings";
/**
* Updates the customer-level settings.
*
* Create a request for the method "v1beta1.updateSettings".
*
* This request holds the parameters needed by the the alertcenter server. After setting any
* optional parameters, call the {@link UpdateSettings#execute()} method to invoke the remote
* operation. <p> {@link UpdateSettings#initialize(com.google.api.client.googleapis.services.Abstr
* actGoogleClientRequest)} must be called to initialize this instance immediately after invoking
* the constructor. </p>
*
* @param content the {@link com.google.api.services.alertcenter.v1beta1.model.Settings}
* @since 1.13
*/
protected UpdateSettings(com.google.api.services.alertcenter.v1beta1.model.Settings content) {
super(AlertCenter.this, "PATCH", REST_PATH, content, com.google.api.services.alertcenter.v1beta1.model.Settings.class);
}
@Override
public UpdateSettings set$Xgafv(java.lang.String $Xgafv) {
return (UpdateSettings) super.set$Xgafv($Xgafv);
}
@Override
public UpdateSettings setAccessToken(java.lang.String accessToken) {
return (UpdateSettings) super.setAccessToken(accessToken);
}
@Override
public UpdateSettings setAlt(java.lang.String alt) {
return (UpdateSettings) super.setAlt(alt);
}
@Override
public UpdateSettings setCallback(java.lang.String callback) {
return (UpdateSettings) super.setCallback(callback);
}
@Override
public UpdateSettings setFields(java.lang.String fields) {
return (UpdateSettings) super.setFields(fields);
}
@Override
public UpdateSettings setKey(java.lang.String key) {
return (UpdateSettings) super.setKey(key);
}
@Override
public UpdateSettings setOauthToken(java.lang.String oauthToken) {
return (UpdateSettings) super.setOauthToken(oauthToken);
}
@Override
public UpdateSettings setPrettyPrint(java.lang.Boolean prettyPrint) {
return (UpdateSettings) super.setPrettyPrint(prettyPrint);
}
@Override
public UpdateSettings setQuotaUser(java.lang.String quotaUser) {
return (UpdateSettings) super.setQuotaUser(quotaUser);
}
@Override
public UpdateSettings setUploadType(java.lang.String uploadType) {
return (UpdateSettings) super.setUploadType(uploadType);
}
@Override
public UpdateSettings setUploadProtocol(java.lang.String uploadProtocol) {
return (UpdateSettings) super.setUploadProtocol(uploadProtocol);
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert settings are associated with. Inferred from the caller identity if not provided.
*/
@com.google.api.client.util.Key
private java.lang.String customerId;
/** Optional. The unique identifier of the G Suite organization account of the customer the alert
settings are associated with. Inferred from the caller identity if not provided.
*/
public java.lang.String getCustomerId() {
return customerId;
}
/**
* Optional. The unique identifier of the G Suite organization account of the customer the
* alert settings are associated with. Inferred from the caller identity if not provided.
*/
public UpdateSettings setCustomerId(java.lang.String customerId) {
this.customerId = customerId;
return this;
}
@Override
public UpdateSettings set(String parameterName, Object value) {
return (UpdateSettings) super.set(parameterName, value);
}
}
}
/**
* Builder for {@link AlertCenter}.
*
* <p>
* Implementation is not thread-safe.
* </p>
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
super(
transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
setBatchPath(DEFAULT_BATCH_PATH);
}
/** Builds a new instance of {@link AlertCenter}. */
@Override
public AlertCenter build() {
return new AlertCenter(this);
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setBatchPath(String batchPath) {
return (Builder) super.setBatchPath(batchPath);
}
@Override
public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
@Override
public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
}
@Override
public Builder setSuppressAllChecks(boolean suppressAllChecks) {
return (Builder) super.setSuppressAllChecks(suppressAllChecks);
}
/**
* Set the {@link AlertCenterRequestInitializer}.
*
* @since 1.12
*/
public Builder setAlertCenterRequestInitializer(
AlertCenterRequestInitializer alertcenterRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(alertcenterRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}
| [
"chingor@google.com"
] | chingor@google.com |
e7ee5c5cb372b1607575ee70c86cec4a1f7e8906 | 6297f82b62648a099c088be33d10149d2c838c96 | /dsalgo/src/main/java/com/amit/datastructure/Tree.java | 62bd5aa8cb01c923950957c5386510ccf7072412 | [] | no_license | amit2103/datastructure | 3bd0d7b465d670a9a4d1ecdfbd8048a49fe07be0 | 030e5cc00f0be72c07a13ae551223d0cd71bc8e5 | refs/heads/master | 2021-01-19T08:37:09.777666 | 2015-02-13T18:18:43 | 2015-02-13T18:18:43 | 30,765,088 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | package com.amit.datastructure;
public interface Tree<T> {
/**
* Add value to the tree. Tree can contain multiple equal values.
*
* @param value to add to the tree.
* @return True if successfully added to tree.
*/
public boolean add(T value);
/**
* Remove first occurrence of value in the tree.
*
* @param value to remove from the tree.
* @return T value removed from tree.
*/
public T remove(T value);
/**
* Clear the entire stack.
*/
public void clear();
/**
* Does the tree contain the value.
*
* @param value to locate in the tree.
* @return True if tree contains value.
*/
public boolean contains(T value);
/**
* Get number of nodes in the tree.
*
* @return Number of nodes in the tree.
*/
public int size();
/**
* Validate the tree according to the invariants.
*
* @return True if the tree is valid.
*/
public boolean validate();
/**
* Get Tree as a Java compatible Collection
*
* @return Java compatible Collection
*/
public java.util.Collection<T> toCollection();
} | [
"amit.pandey2103@gmail.com"
] | amit.pandey2103@gmail.com |
32fecc0cd20d736bb542dd93231ca818e0444531 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /api-vs-impl-small/domain/src/main/java/org/gradle/testdomain/performancenull_10/Productionnull_980.java | b84941c78182c14dd1a50083c1d1146e204f5184 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 589 | java | package org.gradle.testdomain.performancenull_10;
public class Productionnull_980 {
private final String property;
public Productionnull_980(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
c5584acb1c9e4b1a9da72b5aae8cd35c78b2ed4c | bc3a1903aa949523608968aca3fc1b9340da663b | /java-base/src/main/java/crk/algorithm/Fobonaqi.java | dbacaaa7050971c194dcdc8b490a3c13b7d5bffb | [] | no_license | kunlyy/java-samples | b832ae5ca944073b163826a3c6b4a68870b4b0b9 | 9bf3bce4be060222db3099a84529c0156e630992 | refs/heads/master | 2020-04-15T22:44:20.008742 | 2019-05-17T10:36:25 | 2019-05-17T10:36:25 | 165,084,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 899 | java | package crk.algorithm;
/**
* 佛波那契数列求解
*
* Created by chenrongkun on 2019/4/29.
*/
public class Fobonaqi {
/**
* 递归方式
*
* @param n
* @return
*/
public static int fobonaqiSolution(int n) {
if (n == 1 || n == 2) {
return 1;
}
return fobonaqiSolution(n - 1) + fobonaqiSolution(n - 2);
}
/**
* 循环方式
*
* @param n
* @return
*/
public static int fobonaqiSolution2(int n) {
int count = 0;
int preOne = 1;
int preTwo = 1;
for (int i = 3; i <= n; i++) {
count = preTwo + preOne;
preTwo = preOne;
preOne = count;
}
return count;
}
public static void main(String[] args) {
int month = 10;
int count = fobonaqiSolution(month);
int count2 = fobonaqiSolution2(month);
System.out.println("method1->month:" + month + ",count:" + count);
System.out.println("method2->month:" + month + ",count:" + count2);
}
}
| [
"chenrongkun@sunlands.com"
] | chenrongkun@sunlands.com |
9e9ac8033302602f16e7a7029a21eca6d172d606 | 70a0f9aa56c179f90413f7ffefd5f08b9d5cff1a | /CodeGolf/src/Main.java | eb138af79be4d74559010f4783a639c3e33ba0a1 | [] | no_license | KarolinaPru/practice-makes-perfect | 050d71a9bf5a4dfb0568766515f28584c3f886a9 | fcf98f421b7b95b898ede5ecf490365966ee5e9b | refs/heads/main | 2023-03-22T05:35:34.435667 | 2021-03-18T21:25:11 | 2021-03-18T21:25:11 | 349,204,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | import sierpinskitriangle.Sierpinski;
import java.util.Arrays;
import java.util.stream.IntStream;
public class Main {
public static final String CHAR = "▲";
public static void main(String[] args) {
int[][] matrix = new Sierpinski().generateFor(4);
Arrays.stream(matrix)
.forEach(x -> {
IntStream.of(x).forEach(y -> {
if (y == 1) {
print();
} else {
space();
}
});
newLine();
});
}
private static void newLine() {
System.out.println();
}
private static void print() {
print(CHAR);
}
private static void space() {
print(" ");
}
private static void print(String character) {
System.out.print(character);
}
}
| [
"karolajnaa@gmail.com"
] | karolajnaa@gmail.com |
647bdf08c24652804030e8e70bfd278f412aaab1 | 851705df377a1d472c4019ad02a7f2433ebc21f6 | /src/main/java/com/jhonataluiz/bookstoremanager/entity/Book.java | 0422e58fc0a0ba157aab6499d914457544e4ac1e | [] | no_license | luizjhonata/bookstore_manager_course | 26d35cf49556f1ad6617d818650bd0e9c8e8b085 | 184639171f98c926a6e8c2b1619867423465f7a1 | refs/heads/master | 2023-09-03T08:40:14.077758 | 2021-11-08T05:13:50 | 2021-11-08T05:13:50 | 425,123,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 889 | java | package com.jhonataluiz.bookstoremanager.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true)
private String name;
@Column(nullable = false)
private Integer pages;
@Column(nullable = false)
private Integer chapters;
@Column(nullable = false)
private String isbn;
@Column(name = "publisher_name", nullable = false, unique = true)
private String publisherName;
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
@JoinColumn(name = "author_id")
private Author author;
}
| [
"jhonataluiz@hotmail.com"
] | jhonataluiz@hotmail.com |
07975a3916d5d81708f77a6d6d8014c2cc579ddb | 85003a070ac5840fa4c1f3bafe44ca16a086ea87 | /VODEJB/ejbModule/br/com/gvt/eng/vod/util/Filter.java | 053e39e3659815ab2e002ee3ae1cf3a4cf862c46 | [] | no_license | c4sio/ondemand | d49d320eeda447dbda918fd829b8b71ae97700eb | 5a6e3238d4037bc95f796d927b5f98ab534f509b | refs/heads/master | 2021-01-10T12:56:02.047513 | 2016-10-17T16:38:06 | 2016-10-17T16:38:06 | 54,413,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package br.com.gvt.eng.vod.util;
import java.util.List;
public class Filter {
private String groupOp;
private List<FilterRules> rules;
public String getGroupOp() {
return groupOp;
}
public void setGroupOp(String groupOp) {
this.groupOp = groupOp;
}
public List<FilterRules> getRules() {
return rules;
}
public void setRules(List<FilterRules> rules) {
this.rules = rules;
}
}
| [
"jl.machado@gmail.com"
] | jl.machado@gmail.com |
c6c50f8136b36326ae01e847fa7ab0701e5c00cd | ec66fb8f779b498bb924a5b96d6e8bdd3eb08be7 | /ChatWebSocket/src/main/java/com/chat/web/ChatController.java | d04cd91105c025ef10833ad96ea4ff9cb27c8747 | [] | no_license | chotom73/myDevelop | 2ee9c56cde3ddceda7e52bd02b7e7772eca8197a | fe170b8ade5fc0b249880bd2eef2fa4ce7116201 | refs/heads/master | 2016-09-06T17:00:39.452772 | 2015-04-24T08:10:41 | 2015-04-24T08:10:41 | 32,844,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,815 | java | package com.chat.web;
import java.security.Principal;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.DestinationVariable;
import org.springframework.messaging.handler.annotation.MessageExceptionHandler;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.messaging.simp.annotation.SendToUser;
import org.springframework.messaging.simp.annotation.SubscribeMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.socket.config.WebSocketMessageBrokerStats;
import com.chat.domain.ChatMessage;
import com.chat.domain.SessionProfanity;
import com.chat.event.LoginEvent;
import com.chat.event.ParticipantRepository;
import com.chat.exception.TooMuchProfanityException;
import com.chat.util.ProfanityChecker;
/**
*
* @author Sergi Almar
*/
@Controller
public class ChatController {
@Autowired private ProfanityChecker profanityFilter;
@Autowired private SessionProfanity profanity;
@Autowired private WebSocketMessageBrokerStats stats;
@Autowired private ParticipantRepository participantRepository;
@Autowired private SimpMessagingTemplate simpMessagingTemplate;
@SubscribeMapping("/chat.participants")
public Collection<LoginEvent> retrieveParticipants() {
return participantRepository.getActiveSessions().values();
}
@MessageMapping("/chat.message")
public ChatMessage filterMessage(@Payload ChatMessage message, Principal principal) {
checkProfanityAndSanitize(message);
message.setUsername(principal.getName());
return message;
}
@MessageMapping("/chat.private.{username}")
public void filterPrivateMessage(@Payload ChatMessage message, @DestinationVariable("username") String username, Principal principal) {
checkProfanityAndSanitize(message);
message.setUsername(principal.getName());
simpMessagingTemplate.convertAndSend("/user/" + username + "/queue/chat.message", message);
}
private void checkProfanityAndSanitize(ChatMessage message) {
long profanityLevel = profanityFilter.getMessageProfanity(message.getMessage());
profanity.increment(profanityLevel);
message.setMessage(profanityFilter.filter(message.getMessage()));
}
@MessageExceptionHandler
@SendToUser(value = "/queue/errors", broadcast = false)
public String handleProfanity(TooMuchProfanityException e) {
return e.getMessage();
}
@RequestMapping("/stats")
public @ResponseBody WebSocketMessageBrokerStats showStats() {
return stats;
}
} | [
"yunjae@yunjae-PC"
] | yunjae@yunjae-PC |
1f2600bfeeb3f9572fe99884cb85213e730c1f90 | 52a1170b8c45b3b14eea6ea13d87581568fc86f3 | /day11_cookie&session/src/cn/itcast/session/SessionDemo3.java | a191198da87f027b861a96a48822ccae9ff0bef2 | [] | no_license | badbad001/java_web | d8137b869f93186d0a93fa52c18e0222bdf21203 | 41939bb76f47e06f17f38a9335b7125aa5c39fe7 | refs/heads/master | 2020-07-15T06:20:06.677615 | 2019-09-05T12:17:49 | 2019-09-05T12:17:49 | 205,498,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package cn.itcast.session;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
/**
* @Author: badbad
* @Date: 2019/9/3 11:52
* @Version 1.0
*/
@WebServlet("/sessionDemo3")
public class SessionDemo3 extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
System.out.println(session);
Cookie cookie = new Cookie("JSESSIONID", session.getId());
cookie.setMaxAge(60*60);
response.addCookie(cookie);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doPost(request, response);
}
}
| [
"1946408873@qq.com"
] | 1946408873@qq.com |
4883bd8f0bcf49ad8017f49d78cf4e96d9407449 | c6518132ea0e5df68ccea7e445488d242225e6ef | /cedf-project-backend/src/main/java/io/nakong/common/utils/ConfigConstant.java | ded9e5775c21dcf95047a33ae8c24db5708d217a | [
"Apache-2.0"
] | permissive | zhaoxinsheng/collection-data | e48162a53d3ca68d8ed46209f68122176f710663 | 4e3ffebb16cb34a7a48d5b30f173061524405940 | refs/heads/master | 2022-07-08T08:14:49.554738 | 2020-01-12T10:11:30 | 2020-01-12T10:11:30 | 180,143,484 | 1 | 1 | null | 2022-07-06T20:36:00 | 2019-04-08T12:23:31 | JavaScript | UTF-8 | Java | false | false | 303 | java | package io.nakong.common.utils;
/**
* 系统参数相关Key
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2017-03-26 10:33
*/
public class ConfigConstant {
/**
* 云存储配置KEY
*/
public final static String CLOUD_STORAGE_CONFIG_KEY = "CLOUD_STORAGE_CONFIG_KEY";
}
| [
"zhaoxinsheng@codyy.com"
] | zhaoxinsheng@codyy.com |
5ef477da7eabf1b683b0d6ae2df6a8e88eb9daf9 | 577fb778ee5a11305dea5a2b20db861ad6e47e32 | /chrispeter/src/main/java/readingProject/GUI/LoginPanel.java | 0081eac48e6803997638d5ebc8a5a9c1085f3477 | [] | no_license | krzysztofsiczek/readingApp | 39997b2b3f985294f20bcb125fcc2d3ca8115b27 | 9d9051fcb1ea58c014025f38cdc9cf587b0b2024 | refs/heads/master | 2021-01-12T06:39:44.474711 | 2017-01-26T10:06:00 | 2017-01-26T10:06:00 | 77,406,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,978 | java | package readingProject.GUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.security.NoSuchAlgorithmException;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.SwingUtilities;
import readingProject.CheckData;
import readingProject.CheckUserLoginData;
import readingProject.UserInstance;
import readingProject.Utilities.SHA256Hashing;
public class LoginPanel extends JPanel {
private static final long serialVersionUID = 2500782151894671531L;
private JFormattedTextField userEmail;
private JPasswordField userPassword;
private BasicButton loginButton;
private BasicButton registerButton;
private BasicLabel askingToRegisterLabel;
private Listener loginListener;
private BasicFrame basicFrame;
private boolean isLoginDataCorrect = false;
private Integer userId;
public LoginPanel(BasicFrame basicFrame) {
super();
this.basicFrame = basicFrame;
GridBagLayout gridBag = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.CENTER;
gridBag.setConstraints(this, constraints);
setLayout(gridBag);
setBackground(Color.LIGHT_GRAY);
this.loginListener = new Listener();
createComponents();
}
private void createComponents() {
JLabel email = new JLabel("User e-mail: ");
JLabel password = new JLabel("Password: ");
userEmail = new JFormattedTextField();
userPassword = new JPasswordField();
JPanel inputPanel = new BasicPanelGrid(2, 2);
inputPanel.add(email);
inputPanel.add(userEmail);
inputPanel.add(password);
inputPanel.add(userPassword);
inputPanel.setBackground(Color.LIGHT_GRAY);
loginButton = new BasicButton("Log in");
loginButton.addActionListener(loginListener);
loginButton.setAlignmentX(JButton.CENTER_ALIGNMENT);
registerButton = new BasicButton("Register");
registerButton.addActionListener(loginListener);
registerButton.setAlignmentX(JButton.CENTER_ALIGNMENT);
registerButton.setBackground(new Color(220, 220, 220));
registerButton.setOpaque(true);
askingToRegisterLabel = new BasicLabel("Alternatively, you can:");
askingToRegisterLabel.setFont(new Font("georgia", Font.ITALIC, 12));
askingToRegisterLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
BasicPanelBox buttonPanel = new BasicPanelBox();
buttonPanel.add(loginButton);
buttonPanel.add(Box.createRigidArea(new Dimension(0, 30)));
buttonPanel.add(askingToRegisterLabel);
buttonPanel.add(Box.createRigidArea(new Dimension(0, 5)));
buttonPanel.add(registerButton);
BasicLabel welcomeLabel = new BasicLabel("Welcome to ReadApp! :)");
JPanel parentPanel = new JPanel();
parentPanel.setBackground(Color.LIGHT_GRAY);
parentPanel.setPreferredSize(new Dimension(300, 200));
parentPanel.setLayout(new BorderLayout(0, 20));
parentPanel.add(welcomeLabel, BorderLayout.NORTH);
parentPanel.add(inputPanel, BorderLayout.CENTER);
parentPanel.add(buttonPanel, BorderLayout.SOUTH);
this.add(parentPanel);
}
public class Listener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if (registerButton == e.getSource()) {
RegistrationPanel registrationPanel = new RegistrationPanel(basicFrame);
basicFrame.getContentPane().removeAll();
basicFrame.add(registrationPanel);
basicFrame.validate();
} else if (loginButton == e.getSource()) {
try {
validateLoginData();
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
}
if (isLoginDataCorrect == true) {
DecisionPanel decisionPanel = new DecisionPanel(basicFrame);
basicFrame.getContentPane().removeAll();
basicFrame.add(decisionPanel);
basicFrame.validate();
} else if (isLoginDataCorrect == false) {
JOptionPane.showMessageDialog(getParent(), "Enter correct login information.",
"Incorrect login data", JOptionPane.WARNING_MESSAGE);
}
}
}
});
}
}
private void validateLoginData() throws NoSuchAlgorithmException {
String userEmailToBeCompared = userEmail.getText();
String passwordToBeComparedBeforeHashin = new String(userPassword.getPassword());
SHA256Hashing encryptionMechanism = new SHA256Hashing(passwordToBeComparedBeforeHashin);
String passwordToBeCompared = encryptionMechanism.encrypt();
CheckData checkUserLoginData = new CheckUserLoginData(userEmailToBeCompared, passwordToBeCompared);
userId = checkUserLoginData.check();
if (userId != null) {
isLoginDataCorrect = true;
UserInstance.setUserId(userId);
}
}
}
| [
"krzysztofpiotrsiczek@gmail.com"
] | krzysztofpiotrsiczek@gmail.com |
2f79365a45757f73d7cb63d48d065c57b97b7a62 | 390b13c70b2db8d3a6f54c50a8184e6a54c5a087 | /src/edu/nps/moves/excel/test/TestDBUtils.java | c1b789c27823ad82b25dc2dafe007f90f631819e | [] | no_license | ahbuss/movesDB | 0afd2b1ea1b9296059020bb56be2beb37c4adec5 | 57d93c1a7853f97956051306a81ec7be496c2116 | refs/heads/master | 2023-08-04T22:27:40.237274 | 2021-09-29T01:00:25 | 2021-09-29T01:00:25 | 411,484,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,422 | java | package edu.nps.moves.excel.test;
import edu.nps.moves.excel.jdbc.DBUtils;
import edu.nps.moves.excel.jdbc.ExcelDBDriver;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map;
/**
*
* @author ahbuss
*/
public class TestDBUtils {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws ClassNotFoundException, SQLException {
String fileName = args.length > 0 ? args[0] : "data/DS_LBC_new.xlsx";
String url = ExcelDBDriver.URL_PREFIX + fileName;
Class.forName("edu.nps.moves.excel.jdbc.ExcelDBDriver");
System.out.println("Driver for " + url);
Driver driver = DriverManager.getDriver(url);
System.out.println(driver.getClass().getName());
Connection connection = DriverManager.getConnection(url);
DBUtils dbUtils = new DBUtils(connection);
Map<String, Map<String, String>> map = dbUtils.getTableColumnMap();
for (String tableName : map.keySet()) {
System.out.println(tableName);
Map<String, String> columnMap = map.get(tableName);
for (String key : columnMap.keySet()) {
System.out.println("\t" + key + " = " + columnMap.get(key));
}
System.out.println();
}
connection.close();
}
}
| [
"abuss@nps.edu"
] | abuss@nps.edu |
23f7ee0efef448c0000be0f70208ab1fb21d0f1c | 3a50dc8b6416de33e0f50db9b2785b32cbaf48e1 | /kodilla-testing/src/test/java/com/kodilla/testing/shape/ShapeCollectorTestSuite.java | 7ce6d150f46c199a4bd5271628c8be192766d127 | [] | no_license | TomaszTomasiak/kodilla-course | 19617ea899e5dc7db9b574e5e857e4d9b993e5fa | bca1d015768bb4b453388068bbe731a2e5ec5ffc | refs/heads/master | 2021-07-25T10:49:17.307016 | 2021-01-28T14:12:39 | 2021-01-28T14:12:39 | 241,683,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,716 | java | package com.kodilla.testing.shape;
import org.junit.*;
import java.util.ArrayList;
import java.util.HashMap;
public class ShapeCollectorTestSuite {
private static int testCounter = 0;
@BeforeClass
public static void beforeAllTests() {
System.out.println("This is the beginning of tests.");
}
@AfterClass
public static void afterAllTests() {
System.out.println("All tests are finished.");
}
@Before
public void beforeEveryTest() {
testCounter++;
System.out.println("Preparing to execute test #" + testCounter);
}
@Test
public void testAddFigure() {
//Given
ShapeCollector shapeCollector = new ShapeCollector();
Square square = new Square("square", 10.7);
//When
shapeCollector.addFigure(square);
Shape retrivedShape = shapeCollector.getFigure(0);
//Then
Assert.assertEquals(square, retrivedShape);
}
@Test
public void testRemoveFigure() {
//Given
ShapeCollector shapeCollector = new ShapeCollector();
Square square = new Square("square", 10.7);
shapeCollector.addFigure(square);
//When
boolean result = shapeCollector.removeFigure(square);
//Then
Assert.assertTrue(result);
}
@Test
public void testShowFigures() {
//Given
ShapeCollector shapeCollector = new ShapeCollector();
String expected = "square";
Square square = new Square("square", 10.7);
shapeCollector.addFigure(square) ;
//When
String showCheck = shapeCollector.showFigures(0);
//Then
Assert.assertEquals(expected, showCheck);
}
}
| [
"tomasz.tomasiak.pl@gmail.com"
] | tomasz.tomasiak.pl@gmail.com |
a53c94e489d6011030ab1366c64d57baafb21585 | 0f1f95e348b389844b916c143bb587aa1c13e476 | /bboss-core-entity/src-asm/bboss/org/objectweb/asm/tree/analysis/Subroutine.java | 8ab607344ac1cdeb1724658ae70931dc75fd2af6 | [
"Apache-2.0"
] | permissive | bbossgroups/bboss | 78f18f641b18ea6dd388a1f2b28e06c4950b07c3 | 586199b68a8275aa59b76af10f408fec03dc93de | refs/heads/master | 2023-08-31T14:48:12.040505 | 2023-08-29T13:05:46 | 2023-08-29T13:05:46 | 2,780,369 | 269 | 151 | null | 2016-04-04T13:25:20 | 2011-11-15T14:01:02 | Java | UTF-8 | Java | false | false | 3,351 | java | /***
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2011 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package bboss.org.objectweb.asm.tree.analysis;
import java.util.ArrayList;
import java.util.List;
import bboss.org.objectweb.asm.tree.JumpInsnNode;
import bboss.org.objectweb.asm.tree.LabelNode;
/**
* A method subroutine (corresponds to a JSR instruction).
*
* @author Eric Bruneton
*/
class Subroutine {
LabelNode start;
boolean[] access;
List<JumpInsnNode> callers;
private Subroutine() {
}
Subroutine(final LabelNode start, final int maxLocals,
final JumpInsnNode caller) {
this.start = start;
this.access = new boolean[maxLocals];
this.callers = new ArrayList<JumpInsnNode>();
callers.add(caller);
}
public Subroutine copy() {
Subroutine result = new Subroutine();
result.start = start;
result.access = new boolean[access.length];
System.arraycopy(access, 0, result.access, 0, access.length);
result.callers = new ArrayList<JumpInsnNode>(callers);
return result;
}
public boolean merge(final Subroutine subroutine) throws AnalyzerException {
boolean changes = false;
for (int i = 0; i < access.length; ++i) {
if (subroutine.access[i] && !access[i]) {
access[i] = true;
changes = true;
}
}
if (subroutine.start == start) {
for (int i = 0; i < subroutine.callers.size(); ++i) {
JumpInsnNode caller = subroutine.callers.get(i);
if (!callers.contains(caller)) {
callers.add(caller);
changes = true;
}
}
}
return changes;
}
} | [
"yin-bp@163.com"
] | yin-bp@163.com |
8fd7990fd308f4421f6601c4a1a665f9155d3322 | d395b4f055068d9375eabc23aac06f3fe906fb39 | /src/main/java/org/drip/specialfunction/hankel/ZitaFromSmallH2.java | 91db7987f00fd7986880bfca8e099d25ffc1b6e5 | [
"Apache-2.0"
] | permissive | afcarl/DROP | 2e2d339bfaaf04d303a28cde75a37de41282bbce | cecbaae4cb09fb11a2c895f4c2ba435d5ff1889a | refs/heads/master | 2020-09-12T21:33:17.944759 | 2019-11-18T05:25:20 | 2019-11-18T05:25:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,865 | java |
package org.drip.specialfunction.hankel;
/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*/
/*!
* Copyright (C) 2019 Lakshmi Krishnamurthy
*
* This file is part of DROP, an open-source library targeting risk, transaction costs, exposure, margin
* calculations, and portfolio construction within and across fixed income, credit, commodity, equity,
* FX, and structured products.
*
* https://lakshmidrip.github.io/DROP/
*
* DROP is composed of three main modules:
*
* - DROP Analytics Core - https://lakshmidrip.github.io/DROP-Analytics-Core/
* - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
* - DROP Numerical Core - https://lakshmidrip.github.io/DROP-Numerical-Core/
*
* DROP Analytics Core implements libraries for the following:
* - Fixed Income Analytics
* - Asset Backed Analytics
* - XVA Analytics
* - Exposure and Margin Analytics
*
* DROP Portfolio Core implements libraries for the following:
* - Asset Allocation Analytics
* - Transaction Cost Analytics
*
* DROP Numerical Core implements libraries for the following:
* - Statistical Learning Library
* - Numerical Optimizer Library
* - Machine Learning Library
* - Spline Builder Library
*
* Documentation for DROP is Spread Over:
*
* - Main => https://lakshmidrip.github.io/DROP/
* - Wiki => https://github.com/lakshmiDRIP/DROP/wiki
* - GitHub => https://github.com/lakshmiDRIP/DROP
* - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html
* - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
* - Release Versions => https://lakshmidrip.github.io/DROP/version.html
* - Community Credits => https://lakshmidrip.github.io/DROP/credits.html
* - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues
* - JUnit => https://lakshmidrip.github.io/DROP/junit/index.html
* - Jacoco => https://lakshmidrip.github.io/DROP/jacoco/index.html
*
* 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.
*/
/**
* <i>ZitaFromSmallH2</i> implements the Estimator for the Riccati-Bessel Zita Function using the Spherical
* Hankel Function of the Second Kind. The References are:
*
* <br><br>
* <ul>
* <li>
* Abramowitz, M., and I. A. Stegun (2007): <i>Handbook of Mathematics Functions</i> <b>Dover Book
* on Mathematics</b>
* </li>
* <li>
* Arfken, G. B., and H. J. Weber (2005): <i>Mathematical Methods for Physicists 6<sup>th</sup>
* Edition</i> <b>Harcourt</b> San Diego
* </li>
* <li>
* Temme N. M. (1996): <i>Special Functions: An Introduction to the Classical Functions of
* Mathematical Physics 2<sup>nd</sup> Edition</i> <b>Wiley</b> New York
* </li>
* <li>
* Watson, G. N. (1995): <i>A Treatise on the Theory of Bessel Functions</i> <b>Cambridge University
* Press</b>
* </li>
* <li>
* Wikipedia (2019): Bessel Function https://en.wikipedia.org/wiki/Bessel_function
* </li>
* </ul>
*
* <br><br>
* <ul>
* <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/NumericalCore.md">Numerical Core Module</a></li>
* <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/NumericalOptimizerLibrary.md">Numerical Optimizer</a></li>
* <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/specialfunction/README.md">Special Function Project</a></li>
* <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/specialfunction/ode/README.md">Special Function Ordinary Differential Equations</a></li>
* </ul>
*
* @author Lakshmi Krishnamurthy
*/
public class ZitaFromSmallH2 extends org.drip.specialfunction.definition.RiccatiBesselZitaEstimator
{
private org.drip.specialfunction.definition.SphericalHankelSecondKindEstimator
_sphericalHankelSecondKindEstimator = null;
/**
* ZitaFromSmallH2 Constructor
*
* @param sphericalHankelSecondKindEstimator Spherical Hankel Second Kind Estimator
*
* @throws java.lang.Exception Thrown if the Inputs are Invalid
*/
public ZitaFromSmallH2 (
final org.drip.specialfunction.definition.SphericalHankelSecondKindEstimator
sphericalHankelSecondKindEstimator)
throws java.lang.Exception
{
if (null == (_sphericalHankelSecondKindEstimator = sphericalHankelSecondKindEstimator))
{
throw new java.lang.Exception ("ZitaFromSmallH2 Constructor => Invalid Inputs");
}
}
/**
* Retrieve the Spherical Hankel Second Kind Estimator
*
* @return The Spherical Hankel Second Kind Estimator
*/
public org.drip.specialfunction.definition.SphericalHankelSecondKindEstimator
sphericalHankelSecondKindEstimator()
{
return _sphericalHankelSecondKindEstimator;
}
@Override public org.drip.function.definition.CartesianComplexNumber zita (
final double alpha,
final double z)
{
org.drip.function.definition.CartesianComplexNumber smallH2 = _sphericalHankelSecondKindEstimator.smallH2 (
alpha,
z
);
return null == smallH2 ? null : org.drip.function.definition.CartesianComplexNumber.Scale (
smallH2,
z
);
}
}
| [
"lakshmimv7977@gmail.com"
] | lakshmimv7977@gmail.com |
227682ba0fdb93bb90f4c25e6f0884d9859a4765 | 702508c2b3b57a10d1a9a35d5170a94a1951f955 | /ACC/src/WebSearchEngine/SearchEngine.java | bfcd0c668650ca295005e790c326a1d5f5896109 | [] | no_license | WeihaoD/Web-Search-Engine | 3c86580ca302c298004c3c2c71d56bfdd8db5c89 | 789b4e7ca5f6235a671c57b24cb2b2e28065e6c6 | refs/heads/main | 2023-06-09T19:21:36.554923 | 2021-07-02T08:56:28 | 2021-07-02T08:56:28 | 382,287,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,925 | java | package WebSearchEngine;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
import PatternFind.FindPatterns;
import SpellCheck.SpellChecker;
import FrequencyCount.CalculateAll;
import RankingPage.PageRanking;
public class SearchEngine {
public static void main(String[] args) throws FileNotFoundException, NullPointerException, IOException {
Scanner s = new Scanner(System.in);
System.out.println("-> Enter the URL want Crawl: ");
String urlname = s.nextLine();
System.out.println("\n-> Enter number of URL want Crawl: ");
String number = s.nextLine();
int numberofurls = Integer.parseInt( number );
System.out.println("\n-> Download " + numberofurls + " HTML files : \n");
WebCrawler.downloadHTMLFiles(urlname,numberofurls);
System.out.println("\n--------------------------------------------------------------\n");
HTMLTextConverter.convertHtmlToText();
System.out.println("-> Converting from Html files to Text files completed \n");
System.out.println("--------------------------------------------------------------\n");
System.out.println("-> Enter your search : ");
String searchword = s.nextLine();
System.out.println("-> Page Ranking Started : ");
PageRanking.showRankedResult(searchword);
System.out.println("--------------------------------------------------------------\n");
FindPatterns.showPatterns();
System.out.println("--------------------------------------------------------------\n");
System.out.println("-> Enter your word to count frequency of the word : ");
String wordtocount = s.nextLine();
CalculateAll.wordCount(wordtocount);
System.out.println("--------------------------------------------------------------\n");
System.out.println("-> Start Spell Checking : ");
System.out.println("-> Spell Check is working... : ");
SpellChecker.showSpellCheckResult();
s.close();
}
}
| [
"79630970+WeihaoD@users.noreply.github.com"
] | 79630970+WeihaoD@users.noreply.github.com |
cf33b51a4fe02456ac3dd323cd379ef8b5a42e88 | 93fd8429849d6602c508602e0e71edc79c2d495e | /gozer-core/src/main/java/gozer/services/DependenciesService.java | 198b9b64ce0276cc2d4c051f1750954f0b8dc944 | [
"Apache-2.0"
] | permissive | GozerProject/gozer | b7afe6752c011fe5f3df5d38609468447bbbbcc8 | de24a39bad66bfbd75bd84b0bb2237bbcb137019 | refs/heads/master | 2020-03-29T22:25:51.301900 | 2013-09-17T22:07:21 | 2013-09-17T22:07:21 | 12,270,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,697 | java | package gozer.services;
import gozer.GozerFactory;
import gozer.model.Dependency;
import gozer.model.Project;
import org.kevoree.resolver.MavenResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import restx.factory.Component;
import javax.inject.Named;
import java.io.File;
import java.util.Arrays;
@Component
public class DependenciesService {
private static final Logger LOGGER = LoggerFactory.getLogger(DependenciesService.class);
private static final String MAVEN_CENTRAL = "http://repo1.maven.org/maven2";
private final MavenResolver resolver;
public DependenciesService(@Named(GozerFactory.DEPENDENCIES_REPOSITORY) String dependenciesRepository) {
resolver = new MavenResolver();
resolver.setBasePath(dependenciesRepository);
}
public File resolve(Dependency dependency) {
return resolver.resolve(dependency.getMavenUrl(), Arrays.asList(MAVEN_CENTRAL));
}
public Project resolve(Project project) {
if (project.hasBeenResolved()) {
project.cleanDependenciesPath();
}
LOGGER.debug("resolving project {}", project);
for (Dependency dependency : project.getDependencies().getCompile()) {
LOGGER.debug("add {} as a dependency to project {}", dependency, project.getName());
File dependencyFile = resolve(dependency);
LOGGER.debug("path of the dependency : {}", dependencyFile.getAbsolutePath());
project.addDependenciesPath(dependencyFile);
}
project.setStatus(Project.Status.RESOLVED);
LOGGER.info("Project {} has been {}", project.getName(), project.getStatus());
return project;
}
}
| [
"seb.brousse@gmail.com"
] | seb.brousse@gmail.com |
7f2fc2b4459b3c272cbac01e1758e75096479503 | 8651e4acbf4effc29651b4146a4f100878f08b80 | /app/src/androidTest/java/com/example/qiaoguan/learncollection/ExampleInstrumentedTest.java | 728fd2d68f52ed20f57c470b511b9b212b3cd09d | [] | no_license | 752053299/LearnCollection | e08731bc5f7e9c49232a4fd2f6f592649c7a29a9 | 415d58ac4c2369586f0b3f5c494461ca071d7f86 | refs/heads/master | 2021-04-09T11:13:03.502257 | 2018-03-20T09:00:04 | 2018-03-20T09:00:04 | 125,592,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | package com.example.qiaoguan.learncollection;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.qiaoguan.learncollection", appContext.getPackageName());
}
}
| [
"752053299@qq.com"
] | 752053299@qq.com |
915ea9e71892590e41281a90e0027885a1c80a22 | 34bf8d4cb22117f0d89f16a41a6ee4a0ee9e8c3b | /app/src/test/java/com/example/rjq/myapplication/ExampleUnitTest.java | 73b16073daea082ea21f20f8e031c42b3e0e8880 | [] | no_license | adeljck/android-order | 04ed2ac00aee12fb6a3968b2e63dd44ea82a4d14 | 7d20e911b85cd1ec62d495bea91f3841fdc0a58a | refs/heads/master | 2020-05-31T18:01:24.181311 | 2019-06-05T17:53:39 | 2019-06-05T17:53:39 | 190,424,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package com.example.rjq.myapplication;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"adel@adels-iMac.local"
] | adel@adels-iMac.local |
b972a139ebc8d978dfe62687fda6243926d27b5b | 148ed3a8e062d74195f2c5bed2a1396204115b35 | /jetty/examples/test-webapp/src/main/java/com/acme/CometServlet.java | c9c0a28efe2bdecb87af93bb522a81bee3011b4c | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-other-permissive",
"Apache-2.0",
"LGPL-2.0-or-later",
"CDDL-1.0"
] | permissive | napcs/qedserver | 1cb3de8e3733acf0dd160fe4f9b11c630700aee7 | ada3244f36db710ed66a8fd98169b7d440cfd8ab | refs/heads/master | 2023-07-02T12:37:12.419446 | 2015-02-18T19:17:25 | 2015-02-18T19:17:25 | 1,683,704 | 33 | 5 | MIT | 2020-10-13T10:04:01 | 2011-04-30T04:15:53 | Java | UTF-8 | Java | false | false | 3,297 | java | //========================================================================
//Copyright 2004-2008 Mort Bay Consulting Pty. Ltd.
//------------------------------------------------------------------------
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//http://www.apache.org/licenses/LICENSE-2.0
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//========================================================================
package com.acme;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.mortbay.util.ajax.Continuation;
import org.mortbay.util.ajax.ContinuationSupport;
/** CometServlet
* This servlet implements the Comet API from tc6.x with the exception of the read method.
*
* @author gregw
*
*/
public class CometServlet extends HttpServlet
{
public void begin(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
request.setAttribute("org.apache.tomcat.comet",Boolean.TRUE);
}
public void end(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
synchronized(request)
{
request.removeAttribute("org.apache.tomcat.comet");
Continuation continuation=ContinuationSupport.getContinuation(request,request);
if (continuation.isPending())
continuation.resume();
}
}
public void error(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
end(request,response);
}
public boolean read(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
throw new UnsupportedOperationException();
}
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
synchronized(request)
{
// TODO: wrap response so we can reset timeout on writes.
Continuation continuation=ContinuationSupport.getContinuation(request,request);
if (!continuation.isPending())
begin(request,response);
Integer timeout=(Integer)request.getAttribute("org.apache.tomcat.comet.timeout");
boolean resumed=continuation.suspend(timeout==null?60000:timeout.intValue());
if (!resumed)
error(request,response);
}
}
public void setTimeout(HttpServletRequest request, HttpServletResponse response, int timeout) throws IOException, ServletException,
UnsupportedOperationException
{
request.setAttribute("org.apache.tomcat.comet.timeout",new Integer(timeout));
}
}
| [
"brianhogan@napcs.com"
] | brianhogan@napcs.com |
6dda1a8cdb4c78566b1494b3ddef7967758a6b25 | 8865278fd024e299c4fb983c83fbb31780fca002 | /2.JavaCore/src/com/javarush/task/task20/task2025/Solution.java | 6a81205ad3d138208ba66f6483bdb7017d56bb53 | [] | no_license | Dbek83developer/JavaRushTasks | cf8e34f1ed8e33699076f1aaf16a7859d8a557e8 | cd740fc4110c57c3f9f790b7c064bcfa6000aee5 | refs/heads/master | 2021-05-05T03:27:48.635215 | 2018-04-13T05:57:34 | 2018-04-13T05:57:34 | 119,798,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,200 | java | package com.javarush.task.task20.task2025;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
/*
Алгоритмы-числа
*/
public class Solution {
public static long[] getNumbers(long N) {
long[] result = null;
int b = 0;
while (N >= 1) {
b++;
N /= 10;
}
generate(b);
result = new long[results.size()];
for (long i = 0; i < results.size(); i++) {
result[(int) i] = results.get((int) i);
}
return result;
}
private static int N;
private static int[] digitsMultiSet;
private static int[] testMultiSet;
private static List<Long> results;
private static long maxPow;
private static long minPow;
private static long[][] pows;
private static void genPows(int N) {
if (N > 20) throw new IllegalArgumentException();
pows = new long[10][N + 1];
for (int i = 0; i < pows.length; i++) {
long p = 1;
for (int j = 0; j < pows[i].length; j++) {
pows[i][j] = p;
p *= i;
}
}
}
private static boolean check(long pow) {
if (pow >= maxPow) return false;
if (pow < minPow) return false;
for (int i = 0; i < 10; i++) {
testMultiSet[i] = 0;
}
while (pow > 0) {
int i = (int) (pow % 10);
testMultiSet[i]++;
if (testMultiSet[i] > digitsMultiSet[i]) return false;
pow = pow / 10;
}
for (int i = 0; i < 10; i++) {
if (testMultiSet[i] != digitsMultiSet[i]) return false;
}
return true;
}
private static void search(int digit, int unused, long pow) {
if (pow >= maxPow) return;
if (digit == -1) {
if (check(pow)) results.add(pow);
return;
}
if (digit == 0) {
digitsMultiSet[digit] = unused;
search(digit - 1, 0, pow + unused * pows[digit][N]);
} else {
// Check if we can generate more than minimum
if (pow + unused * pows[digit][N] < minPow) return;
long p = pow;
for (int i = 0; i <= unused; i++) {
digitsMultiSet[digit] = i;
search(digit - 1, unused - i, p);
if (i != unused) {
p += pows[digit][N];
// Check maximum and break the loop - doesn't help
// if (p >= maxPow) break;
}
}
}
}
public static List<Long> generate(int maxN) {
if (maxN >= 20) throw new IllegalArgumentException();
genPows(maxN);
results = new ArrayList<>();
digitsMultiSet = new int[10];
testMultiSet = new int[10];
for (N = 1; N <= maxN; N++) {
minPow = (long) Math.pow(10, N - 1);
maxPow = (long) Math.pow(10, N);
search(9, N, 0);
}
Collections.sort(results);
return results;
}
public static void main(String[] args) {
// System.out.println(getNumbers(10000000));
}
} | [
"dbek.developer@gmail.com"
] | dbek.developer@gmail.com |
80609cb7baedc40568fea0f276fc5dbbc9ab05e0 | e808d3e97e19558d15bacbcfeb9785014f2eb93a | /onebusaway-webapp/src/main/java/org/onebusaway/webapp/gwt/oba_application/control/Score.java | 2ef4787b7de5b3fc841a8398c3c0643e1fcb7627 | [
"Apache-2.0"
] | permissive | isabella232/onebusaway-application-modules | 82793b63678f21e28c98093cb71b333a2e22a3c1 | d2ca6c6e0038d158c9df487cab9f75d18b1214ff | refs/heads/master | 2023-03-08T20:02:35.766999 | 2019-01-03T16:41:11 | 2019-01-03T16:41:11 | 335,592,972 | 0 | 0 | NOASSERTION | 2021-02-24T05:43:58 | 2021-02-03T10:50:26 | null | UTF-8 | Java | false | false | 1,725 | java | /**
* Copyright (C) 2011 Brian Ferris <bdferris@onebusaway.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onebusaway.webapp.gwt.oba_application.control;
public class Score {
/*
public double calcScore(){
return Math.round( 100 * ( calcPoints(1)/maxPoints ) );
}
int calcPoints( int limit ){
int totalPoints = 0;
for (int i = 0; i < snapSortedResults.length; i++) {
for (int j = 0; j < limit && j < snapSortedResults[i].length; j++) {
totalPoints += snapSortedResults[i][j].score();
}
}
return totalPoints;
}
QueryList.prototype.calcMaxPoints = function() {
var maxPoints = 0;
forEach(this.queryArray, function (item, n) { if (item[2] == Q_SINGLE || item[2] == Q_MULTI_START) maxPoints+=10; });
return maxPoints;
}
public void go() {
var selector = Math.floor( 4 * convertMeters(this.snapDist(), UNITS_MI) ); //this is miles-based regardless of the country
var score = 0;
switch ( selector ) {
case 0: this.score_ = 10; break
case 1: this.score_ = 8; break
case 2: this.score_ = 4; break
case 3: this.score_ = 2; break
default: this.score_ = 0; break
}
return this.score_;
}
*/
}
| [
"bdferris@google.com"
] | bdferris@google.com |
c432c40f7557f7a7d557ee2120db245387eac38d | 3ffa1954ba4d71dad4e8d89a002cb0d9c31dc45a | /Selenium_with_Maven_Demo/src/test/java/mavenDemo/BrandedSurveys_poll.java | bff90138c0fe41b1afaeb2c02eab28942a12e19f | [] | no_license | keerthisangaraju/allfiles | 95ec05c5fe8ee64362915fbfad51e0e8d30c8471 | 8f3ba256ea1516c2510bd40f7534e356f7fd6eb0 | refs/heads/master | 2020-04-19T04:59:35.617395 | 2019-01-28T14:49:48 | 2019-01-28T14:49:48 | 167,976,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,811 | java | package mavenDemo;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import utility_pkg.Util;
public class BrandedSurveys_poll
{
WebDriver driver;
WebDriverWait wait;
@BeforeTest
public void StartBrandedProject()
{
System.out.println("Started GoBranded");
}
@AfterTest
public void EndBrandedProject()
{
System.out.println("Ended GoBranded");
}
@Test(priority=2)
public void LoginBrandedSite() throws InterruptedException
{
driver = Util.LaunchChromeBrowser();
driver.get(Util.GoBranded_URL);
Thread.sleep(1000);
driver.findElement(By.xpath("//a[@id='CybotCookiebotDialogBodyButtonAccept']")).click();
driver.findElement(By.id("UserEmail")).sendKeys(Util.Branded_Username);
driver.findElement(By.id("UserPassword")).sendKeys(Util.Branded_Password);
driver.findElement(By.xpath("//input[@value='Sign in']")).click();
String Actual_Title = driver.getTitle();
System.out.println("Actual title is"+Actual_Title);
System.out.println("Login into BrandedSite");
}
@Test(priority=3)
public void Answer_Poll_GoBrandedSite() throws InterruptedException
{
wait = new WebDriverWait(driver,Util.WAIT_TIME);
WebElement ele = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),'Daily Poll')]")));
/* To Scroll to the Daily poll section */
JavascriptExecutor je = (JavascriptExecutor)driver;
je.executeScript("arguments[0].scrollIntoView(true);", ele);
/* Get the list of radio buttons for Daily poll */
List<WebElement> radiolist = driver.findElements(By.xpath("//label[starts-with(@for,'PollAnswer')]"));
Thread.sleep(500);
/* Click on the first radio button and exit the loop */
for(WebElement ele1 : radiolist)
{
ele1.click();
break;
}
/* Submitting the Daily poll */
driver.findElement(By.xpath("//input[@value='Submit']")).click();
Thread.sleep(10000);
System.out.println("Answered the Poll");
}
@Test(priority=4)
public void LogoutBrandedSite() throws InterruptedException
{
driver.findElement(By.xpath("//a[@id='profile-widget']")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//a[contains(text(),'Logout')]")).click();
Thread.sleep(1000);
System.out.println("Logout BrandedSite");
Util.CloseChromeBrowser();
}
}
| [
"Keerthi@DESKTOP-M2CO299.attlocal.net"
] | Keerthi@DESKTOP-M2CO299.attlocal.net |
de9d15439fce7b2963a641506d675dc089371bd5 | 745d6b244c600a27262aa58b48a37765cc1eb937 | /src/main/java/com/wale/exam/service/impl/PaperQuestionServiceImpl.java | 3b3668b03de7f31a412b93b816849911d3741606 | [] | no_license | a1446234064/onlineExam | ebf27a9d5f963994af312e838fa231d7f65bbd5a | 6e6dd4af8a6d48c4f708b9b00bf204f916c04d49 | refs/heads/master | 2023-07-13T22:14:07.331938 | 2021-08-29T02:14:48 | 2021-08-29T02:14:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,594 | java | package com.wale.exam.service.impl;
import com.wale.exam.bean.PaperQuestion;
import com.wale.exam.bean.PaperQuestionExample;
import com.wale.exam.dao.PaperQuestionMapper;
import com.wale.exam.service.PaperQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author WaleGarrett
* @Date 2020/8/10 6:40
*/
@Service
public class PaperQuestionServiceImpl implements PaperQuestionService {
@Autowired
PaperQuestionMapper paperQuestionMapper;
@Override
public void addItem(int paperId, int proId) {
PaperQuestion paperQuestion=new PaperQuestion();
paperQuestion.setPaperId(paperId);
paperQuestion.setQuestionId(proId);
paperQuestionMapper.insertSelective(paperQuestion);
}
@Override
public List<PaperQuestion> findItemByPaperId(Integer paperId) {
PaperQuestionExample paperQuestionExample=new PaperQuestionExample();
PaperQuestionExample.Criteria criteria=paperQuestionExample.createCriteria();
criteria.andPaperIdEqualTo(paperId);
List<PaperQuestion>list=paperQuestionMapper.selectByExample(paperQuestionExample);
return list;
}
@Override
public void deleteItemByPaperId(Integer paperId) {
PaperQuestionExample paperQuestionExample=new PaperQuestionExample();
PaperQuestionExample.Criteria criteria=paperQuestionExample.createCriteria();
criteria.andPaperIdEqualTo(paperId);
paperQuestionMapper.deleteByExample(paperQuestionExample);
}
}
| [
"2064737314@qq.com"
] | 2064737314@qq.com |
117423357f2a2809beb23a392ea4f5074b96ccce | af19647c11b8fb4d1af897daedeee4a1aad1ffad | /src/hr/fer/ppj/labos/ppj21/assem/Assem.java | 3a9e164500d94902cb3ba0cf23b137663826917b | [] | no_license | KarloKnezevic/ppj21 | 6319c0e3a6d1d95ace55eef908a38c3ed6e16978 | a10b79c060a9c011e46e7d887200542bf49a13f5 | refs/heads/master | 2021-01-10T15:56:22.500983 | 2010-01-21T07:54:06 | 2010-01-21T07:54:06 | 49,503,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,456 | java | package hr.fer.ppj.labos.ppj21.assem;
import java.io.*;
import java.util.*;
import hr.fer.ppj.labos.ppj21.tree.*;
public class Assem {
static int label;
static boolean notFirstLabel;
final static String T_STACK = "A1",
T_STACK_OFFSET = "$1000000",
SP = "A2",
HP = "A3",
FP = "A4",
T_ADR_1 = "A5",
T_ADR_2 = "A6",
T_DAT_1 = "D1",
T_DAT_2 = "D2",
T_DAT_3 = "D3",
T_DAT_RET = "D4";
public static void encode(List<Stm> programList, PrintStream output){
label = 0;
notFirstLabel = false;
header(output);
for(Stm stm : programList)
printCode(stm, output);
footer(output);
}
private static void header(PrintStream output){
output.println("*-------------------------------------------------------");
output.println("* Generated machine code, PPJ21");
output.println("*-------------------------------------------------------");
output.println("\nSTART\tORG\t$0\n");
output.println("\tMOVE.L\t#"+T_STACK_OFFSET+", "+T_STACK);
output.println("");
}
private static void footer(PrintStream output){
output.println("\nFNSH\tSTOP\t#$2000\n");
output.println("NL\tDC.B\t10, 13, 0");
output.println("MSG\tDS.B\t41");
output.println("\tEND\tSTART");
}
private static void printCode(Stm stm, PrintStream output) {
output.println("\n*\t"+stm.getClass().getName());
if(stm instanceof CJump)
printCode((CJump)stm, output);
else if(stm instanceof Jump)
printCode((Jump)stm, output);
else if(stm instanceof Label)
printCode((Label)stm, output);
else if(stm instanceof Move)
printCode((Move)stm, output);
else if(stm instanceof Out)
printCode((Out)stm, output);
else if(stm instanceof RuntimeError)
printCode((RuntimeError)stm, output);
else
throw new Error("No such Statement! "+stm.getClass().getName());
if(!(stm instanceof Label)){
notFirstLabel = false;
}
}
private static void printCode(CJump cjump, PrintStream output) {
//uvjet skoka jednak privremenoj vrijednosti
if(cjump.condition instanceof Temp){
output.println("\tAND\t#1, "+getTemp((Temp)cjump.condition, true));
//labela na koju se skače u slučaju istinitosti izraza
output.println("\tBEQ\tLT"+(label));
printCode(new Jump(new Name(cjump.iftrue)), output);
//labela na koju se skaže ako izraz niej istinit
output.print("LT"+(label++));
printCode(new Jump(new Name(cjump.iffalse)), output);
}
//uvjet skoka je konstantna vrijednost
else if(cjump.condition instanceof Const) {
if(((Const)cjump.condition).value!=0)
printCode(new Jump(new Name(cjump.iftrue)), output);
else
printCode(new Jump(new Name(cjump.iffalse)), output);
}
}
private static void printCode(Jump jump, PrintStream output) {
//ako se skace na labelu
if(jump.target instanceof Name)
output.println("\tBRA\t"+((Name)jump.target).label.toString());
//ako se skace na privremanu vrijednost
else if(jump.target instanceof Temp)
output.println("\tJMP\t("+T_ADR_2+")");
else
throw new Error("No such jump destination!");
}
private static void printCode(Label label, PrintStream output) {
//prva labela nema \n ispred
if(notFirstLabel)
output.print("\n"+label.toString());
else{
output.print(label.toString());
notFirstLabel = true;
}
//kraj programa
if(label.toString().equals("DONE")){
output.print("\tSTOP\t#$2000\n");
notFirstLabel = false;
}
}
private static void printCode(Move move, PrintStream output) {
if(move.src instanceof Name){
output.println("\tLEA\t"+((Name)move.src).label.toString()+", "+T_ADR_1);
output.println("\tMOVE\t"+T_ADR_1+", "+T_DAT_2);
}
else if(move.src instanceof Binop){
Binop binop = (Binop) move.src;
if(binop.right instanceof Mem && ((Temp)((Mem)binop.right).exp).name.contains("temp"))
output.println("\tMOVE\t("+T_STACK+")+, "+T_DAT_3+"\n\tMOVE.L\t"+T_DAT_3+", "+T_ADR_1);
output.print("\tMOVE\t");
if(binop.right instanceof Const)
output.print("#"+((Const)binop.right).value);
else if(binop.right instanceof Temp)
output.print(getTemp((Temp)binop.right, true));
else if(binop.right instanceof Mem)
output.print(getMem((Mem)binop.right));
else
throw new Error("No such source of Move type!");
output.println(", "+T_DAT_2);
if(binop.left instanceof Mem && ((Temp)((Mem)binop.left).exp).name.contains("temp"))
output.println("\tMOVE\t("+T_STACK+")+, "+T_DAT_3+"\n\tMOVE.L\t"+T_DAT_3+", "+T_ADR_1);
output.print("\t");
switch(binop.binop){
case Binop.AND:
case Binop.MUL:
output.print("MULS"); break;
case Binop.PLUS:
output.print("ADD"); break;
case Binop.LT:
case Binop.MINUS:
output.print("SUB"); break;
}
output.print("\t");
if(binop.left instanceof Const)
output.print("#"+((Const)binop.left).value);
else if(binop.left instanceof Temp)
output.print(getTemp((Temp)binop.left, true));
else if(binop.left instanceof Mem)
output.print(getMem((Mem)binop.left));
else
throw new Error("No such source of Move type!");
output.println(", "+T_DAT_2);
if(binop.binop == Binop.MINUS)
output.println("\tNEG\t"+T_DAT_2);
if(binop.binop == Binop.LT){
output.println("\tBGT\tLT"+(label++));
output.println("\tMOVE\t#0, "+T_DAT_2);
output.println("\tBRA\tLT"+(label++));
output.println("LT"+(label-2)+"\tMOVE\t#1, "+T_DAT_2);
output.print("LT"+(label-1));
}
}
else {
if(move.src instanceof Mem && ((Temp)((Mem)move.src).exp).name.contains("temp"))
output.println("\tMOVE\t("+T_STACK+")+, "+T_DAT_3+"\n\tMOVE.L\t"+T_DAT_3+", "+T_ADR_1);
output.print("\tMOVE\t");
if(move.src instanceof Const)
output.print("#"+((Const)move.src).value);
else if(move.src instanceof Mem)
output.print(getMem((Mem)move.src));
else if(move.src instanceof Temp)
output.print(getTemp((Temp)move.src, true));
else
throw new Error("No such source of Move type! "+move.src.getClass().getName());
output.println(", "+T_DAT_2);
}
if(move.dst instanceof Mem && ((Temp)((Mem)move.dst).exp).name.contains("temp"))
output.println("\tMOVE\t("+T_STACK+")+, "+T_DAT_3);
if(move.src instanceof Temp && ((Temp)move.src).name.contains("temp") && move.dst instanceof Mem && ((Mem)move.dst).exp instanceof Temp && ((Temp)((Mem)move.dst).exp).name.contains("temp")){
output.println("\tMOVE\t"+T_DAT_2+", -("+T_STACK+") * New Approach!");
output.println("\tMOVE\t"+T_DAT_3+", "+T_DAT_2);
output.println("\tMOVE\t("+T_STACK+")+, "+T_DAT_3);
}
if(move.dst instanceof Mem && ((Temp)((Mem)move.dst).exp).name.contains("temp"))
output.println("\tMOVE.L\t"+T_DAT_3+", "+T_ADR_1);
output.print("\tMOVE");
if(move.dst instanceof Temp && getTemp((Temp)move.dst, false).charAt(0)=='A')
output.print(".L");
output.print("\t"+T_DAT_2+", ");
if(move.dst instanceof Temp)
output.println(getTemp((Temp)move.dst, false));
else if(move.dst instanceof Mem)
output.println(getMem((Mem)move.dst));
else
throw new Error("No such dest of Move type! "+move.src.getClass().getName());
}
private static void printCode(Out out, PrintStream output) {
if(out.value instanceof Mem && ((Temp)((Mem)out.value).exp).name.contains("temp"))
output.println("\tMOVE\t("+T_STACK+")+, "+T_DAT_3+"\n\tMOVE.L\t"+T_DAT_3+", "+T_ADR_1);
output.print("\tMOVE\t#3, D0\n\tMOVE\t");
if(out.value instanceof Temp)
output.print(getTemp((Temp)out.value, true));
else if(out.value instanceof Const)
output.print("#"+((Const)out.value).value);
else if(out.value instanceof Mem)
output.print(getMem((Mem)out.value));
else
throw new Error("No such Out type!");
output.println(", D1\n\tEXT.L\tD1\n\tTRAP\t#15");
output.println("\tLEA\tNL, A1\n\tMOVE\t#14, D0\n\tTRAP\t#15");
}
private static void printCode(RuntimeError re, PrintStream output){
//ispis poruke o RuntimeErroru
output.println("\tLEA\tMSG, "+T_ADR_1);
for(int i=0; i<re.message.length(); i++)
output.println("\tMOVE.B\t#\'"+re.message.charAt(i)+"\', ("+T_ADR_1+")+");
output.println("\tMOVE.B\t#0, ("+T_ADR_1+")");
output.println("\tLEA\tMSG, A1\n\tMOVE\t#13, D0\n\tTRAP\t#15");
//skok na kraj programa
output.println("\tBRA\tFNSH");
}
private static String getTemp(Temp temp, boolean use){
//dohvati privremenu vrijednost
if(temp.name.indexOf("temp")!=-1)
if(use)
return "("+T_STACK+")+";
else
return "-("+T_STACK+")";
if(temp.name.equals("sp"))
return SP;
if(temp.name.equals("fp"))
return FP;
if(temp.name.equals("hp"))
return HP;
if(temp.name.equals("d1"))
return T_DAT_1;
if(temp.name.equals("TR"))
return T_DAT_RET;
if(temp.name.equals("a1"))
return T_ADR_2;
throw new Error("No such temp!");
}
private static String getMem(Mem mem){
//dohvati vrijednost sa memorijske lokacije
Temp temp = (Temp)mem.exp;
if(temp.name.indexOf("temp")!=-1)
return "("+T_ADR_1+")";
if(temp.name.equals("sp"))
return "("+SP+")";
if(temp.name.equals("fp"))
return "("+FP+")";
if(temp.name.equals("hp"))
return "("+HP+")";
if(temp.name.equals("a1"))
return "("+T_ADR_2+")";
throw new Error("No such mem! "+temp.name);
}
}
| [
"tin.franovic@gmail.com"
] | tin.franovic@gmail.com |
688e80fab2ec5d8913647e57a83280b2300ac49a | 0b9f07f9068b3b1875b2a5e864e7a00a91367c20 | /order/src/main/java/com/ccbft/order/entity/Product.java | 93b4f87d90fcd8606fd8a919980053850d25e78e | [] | no_license | meishuangjie/springcloudframework | 2de89d78e7788f5b5ab22cbe25eb7d03d05087d4 | efd185b7a4a47047241a45cff96881f472cb47aa | refs/heads/master | 2022-11-25T19:49:35.157299 | 2020-07-31T07:04:14 | 2020-07-31T07:04:14 | 283,929,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 888 | java | package com.ccbft.product.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author sky
* @since 2020-07-31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Product extends Model<Product> {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String productName;
private String productDescribe;
private Integer productCategory;
private Double productPrice;
private String producingArea;
@Override
protected Serializable pkVal() {
return this.id;
}
}
| [
"756009691@qq.com"
] | 756009691@qq.com |
f3540d2d95d2602b2c4f28807371e7017874bf5c | 335c68159eacb8fa5c5d456ad08b72beef5f4b64 | /payment/src/main/java/com/volkan/payment/PaymentEventHandler.java | 24a7d5ae88f8136b48324c545f1607fb7c9cc4b5 | [] | no_license | volkanOdtu/RedisPubSubEurekaConfig | a6d11a601bcb722eb95b734b9cfd875e5bd57526 | f1a1d40dd3b8cf54b9ec17dc1f8f676321021983 | refs/heads/master | 2023-03-16T19:13:29.025450 | 2021-03-08T20:06:19 | 2021-03-08T20:06:19 | 345,780,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | package com.volkan.payment;
import org.springframework.stereotype.Component;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.core.annotation.HandleAfterCreate;
import org.springframework.data.rest.core.annotation.RepositoryEventHandler;
//Bunu restController gibi dusunebiliriz ,Spring in onceki versiyonlarinda create boyle yapliyormus
@Component
@RepositoryEventHandler(Payment.class)
public class PaymentEventHandler {
@Autowired
private RedisMessagePublisher publisher;
//Payment create sonrasi, bu metod cagriliyor
@HandleAfterCreate
public void handlePaymentSave(Payment payment) {
publisher.publish(payment);
}
}
| [
"volkan.suyabatmaz@akka.eu"
] | volkan.suyabatmaz@akka.eu |
b30ca4d6402c17bb6a294bfe7addb58bc1a3931e | 56345887f87495c458a80373002159dbbbd7717f | /client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/JdbcTypeUtil.java | c24ff7de41fd7d9cc7f6b7dda560c57799b55763 | [
"Apache-2.0"
] | permissive | cainiao22/canal-bigdata | 724199c61632e98b43797d4fd276abcba7e426fb | a88362535faeda5f846a8f147d341f8d22ffd2e4 | refs/heads/master | 2022-12-26T16:59:50.256698 | 2018-12-05T07:27:17 | 2018-12-05T07:27:17 | 214,317,447 | 1 | 0 | Apache-2.0 | 2022-12-14T20:35:10 | 2019-10-11T01:30:07 | Java | UTF-8 | Java | false | false | 5,079 | java | package com.alibaba.otter.canal.client.adapter.support;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.*;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 类型转换工具类
*
* @author rewerma 2018-8-19 下午06:14:23
* @version 1.0.0
*/
public class JdbcTypeUtil {
private static Logger logger = LoggerFactory.getLogger(JdbcTypeUtil.class);
public static Object getRSData(ResultSet rs, String columnName, int jdbcType) throws SQLException {
if (jdbcType == Types.BIT || jdbcType == Types.BOOLEAN) {
return rs.getByte(columnName);
} else {
return rs.getObject(columnName);
}
}
public static Class<?> jdbcType2javaType(int jdbcType) {
switch (jdbcType) {
case Types.BIT:
case Types.BOOLEAN:
// return Boolean.class;
case Types.TINYINT:
return Byte.TYPE;
case Types.SMALLINT:
return Short.class;
case Types.INTEGER:
return Integer.class;
case Types.BIGINT:
return Long.class;
case Types.DECIMAL:
case Types.NUMERIC:
return BigDecimal.class;
case Types.REAL:
return Float.class;
case Types.FLOAT:
case Types.DOUBLE:
return Double.class;
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
return String.class;
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
case Types.BLOB:
return byte[].class;
case Types.DATE:
return java.sql.Date.class;
case Types.TIME:
return Time.class;
case Types.TIMESTAMP:
return Timestamp.class;
default:
return String.class;
}
}
public static Object typeConvert(String columnName, String value, int sqlType, String mysqlType) {
if (value == null || value.equals("")) {
return null;
}
try {
Object res;
switch (sqlType) {
case Types.INTEGER:
res = Integer.parseInt(value);
break;
case Types.SMALLINT:
res = Short.parseShort(value);
break;
case Types.BIT:
case Types.TINYINT:
res = Byte.parseByte(value);
break;
case Types.BIGINT:
if (mysqlType.startsWith("bigint") && mysqlType.endsWith("unsigned")) {
res = new BigInteger(value);
} else {
res = Long.parseLong(value);
}
break;
// case Types.BIT:
case Types.BOOLEAN:
res = !"0".equals(value);
break;
case Types.DOUBLE:
case Types.FLOAT:
res = Double.parseDouble(value);
break;
case Types.REAL:
res = Float.parseFloat(value);
break;
case Types.DECIMAL:
case Types.NUMERIC:
res = new BigDecimal(value);
break;
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
case Types.BLOB:
res = value.getBytes("ISO-8859-1");
break;
case Types.DATE:
if (!value.startsWith("0000-00-00")) {
value = value.trim().replace(" ", "T");
DateTime dt = new DateTime(value);
res = new Date(dt.toDate().getTime());
} else {
res = null;
}
break;
case Types.TIME:
value = "T" + value;
DateTime dt = new DateTime(value);
res = new Time(dt.toDate().getTime());
break;
case Types.TIMESTAMP:
if (!value.startsWith("0000-00-00")) {
value = value.trim().replace(" ", "T");
dt = new DateTime(value);
res = new Timestamp(dt.toDate().getTime());
} else {
res = null;
}
break;
case Types.CLOB:
default:
res = value;
}
return res;
} catch (Exception e) {
logger.error("table: {} column: {}, failed convert type {} to {}", columnName, value, sqlType);
return value;
}
}
}
| [
"yanpengfei@qding.me"
] | yanpengfei@qding.me |
5bfc2d5016cdf204ae9ceb6b457f9e51daae55ec | d19b2fd5e0ee896393671eb7f4cd8d92f9c1bc8b | /Assignment Recursion 1/Remove X.java | 85d876951e58b0e53ab1b1ef8230bcaab3aa94a3 | [] | no_license | ultronnav/data-structures-in-JAVA-CodingNinjas | 5108570d0d1a82660b3be39bde4cacf6f4e19ff1 | 4a4c1f5f19fcc46748e1acf50e9c4c23311c8826 | refs/heads/master | 2022-11-06T20:38:59.996140 | 2020-07-04T18:16:21 | 2020-07-04T18:16:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java |
public class solution {
// Return the changed string
public static String removeX(String input){
// Write your code here
if (input.length() == 0){
return input;
}
if (input.length()>=1 && input.charAt(0) == 'x'){
return removeX(input.substring(1,input.length()));
}
return input.charAt(0)+removeX(input.substring(1,input.length()));
}
}
//MAIN
import java.util.Scanner;
public class runner {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String input = s.nextLine();
System.out.println(solution.removeX(input));
}
}
| [
"vehaanskundra@gmail.com"
] | vehaanskundra@gmail.com |
a2e5a442e67f00a49c1b94c0dcb8d042c1eff823 | f630c0b366ff7d08746b8cde2695070b774e4afb | /app/src/main/java/mobile/xiyou/atest/hook_contentProvider/ContentProviderStub7.java | e383b8ea4c0825b22928e2af8b2c2cf61941ed00 | [] | no_license | miaorenjie/TEST | 28a69616f1398cffb332520ae0f762b739a0b613 | 9ab75716f8d38fdfbc64f82208a45b94a8b64aba | refs/heads/master | 2020-05-18T17:06:29.711691 | 2017-05-19T07:06:57 | 2017-05-19T07:06:57 | 91,775,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package mobile.xiyou.atest.hook_contentProvider;
/**
* Created by miaojie on 2017/5/15.
*/
public class ContentProviderStub7 extends ContentProviderBase {
@Override
public boolean onCreate() {
this.AUTHORITY="mobile.xiyou.atest.hook_contentProvider.ContentProviderStub7";
return super.onCreate();
}
}
| [
"501216475@qq.com"
] | 501216475@qq.com |
00e311cd825d9141f877a2022c61d3ad2acb2b47 | 89739a6a6f5f05e409d598d0dc96f94f5ccf845f | /src/main/java/frc/robot/autonomous/PathFollower.java | 1f002535adeaeaff16b4f24f546b0e38c3693dfd | [] | no_license | team178/PathPlanningTest | b057b3eaef1c149d3333686273d9990d6140771b | 758b0f865810995e863505e3c8b5e2986b55fd62 | refs/heads/master | 2020-12-23T23:30:03.663506 | 2020-03-14T16:39:52 | 2020-03-14T16:39:52 | 237,308,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,969 | java | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.autonomous;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj.controller.RamseteController;
import edu.wpi.first.wpilibj.geometry.Pose2d;
import edu.wpi.first.wpilibj.geometry.Rotation2d;
import edu.wpi.first.wpilibj.geometry.Translation2d;
import edu.wpi.first.wpilibj.trajectory.Trajectory;
import edu.wpi.first.wpilibj.trajectory.TrajectoryConfig;
import edu.wpi.first.wpilibj.trajectory.TrajectoryGenerator;
import edu.wpi.first.wpilibj.trajectory.TrajectoryUtil;
import edu.wpi.first.wpilibj.trajectory.constraint.DifferentialDriveVoltageConstraint;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.RamseteCommand;
import frc.robot.Robot;
import frc.robot.Constants.PathConstants;
import frc.robot.subsystems.DriveTrain;
/**
* Add your docs here.
*/
public class PathFollower {
private static DriveTrain driveTrain = Robot.driveTrain;
public static Command getAutonomousCommand() {
//Creating autonomous voltage constraint
DifferentialDriveVoltageConstraint voltageConstraint = new DifferentialDriveVoltageConstraint(
driveTrain.getFeedforward(),
driveTrain.getKinematics(),
PathConstants.kMaxVoltage
);
//Creating trajectory config
TrajectoryConfig config = new TrajectoryConfig(
PathConstants.kMaxVelMPS,
PathConstants.kMaxAccelMPSPS
)
.setKinematics(driveTrain.getKinematics())
.setReversed(false)
.addConstraint(voltageConstraint);
//Nithin's test trajectory
Trajectory nithinsTestTrajectory = TrajectoryGenerator.generateTrajectory(
//Start pose
new Pose2d(0, 0, new Rotation2d(0)),
//Interior waypoints
List.of(
new Translation2d(1, 1),
new Translation2d(-0.25, 4.5),
new Translation2d(-3, 4),
new Translation2d(-5, 7),
new Translation2d(-5.5, 7.25)
),
//End pose
new Pose2d(-6, 8, new Rotation2d(53.14)),
config
);
//Create a ramsete command based off RamseteController & params
RamseteCommand ramseteCommand = new RamseteCommand(
nithinsTestTrajectory,
driveTrain::getPoseMeters,
new RamseteController(PathConstants.kRamseteB, PathConstants.kRamseteZeta),
driveTrain.getFeedforward(),
driveTrain.getKinematics(),
driveTrain::getWheelSpeeds,
driveTrain.getLeftPIDController(),
driveTrain.getRightPIDController(),
driveTrain::driveVolts,
driveTrain
);
return ramseteCommand.andThen(() -> driveTrain.driveVolts(0, 0));
}
public Trajectory loadTrajectoryFromPathWeaver(String trajectoryJSONPath) {
Trajectory trajectory = null;
try {
Path filePath = Filesystem.getDeployDirectory().toPath().resolve(trajectoryJSONPath);
trajectory = TrajectoryUtil.fromPathweaverJson(filePath);
} catch (IOException e) {
DriverStation.reportError("cant find ur path " + trajectoryJSONPath + " bud u have a null trajectory now", e.getStackTrace());
}
return trajectory;
}
}
| [
"programming@farmingtonrobotics.org"
] | programming@farmingtonrobotics.org |
b6d4d68589fda8051de2a2c6f556d185c10a6915 | b8fe50065fdd0faeecbc61a7f129b1f91c136c07 | /collab-sudoku/code-improvement/src/main/java/org/moire/opensudoku/utils/Const.java | 9865e3fbdb8f6600d493f54a69adbfa7435c337d | [] | no_license | IanDavis1995/P3 | b5161d3d37dcc3486fba3c45b40e60a7cc1260f2 | 27905afd3455fefe450b941c3c6c3d2e6ff8fb22 | refs/heads/master | 2021-01-19T12:55:03.861193 | 2017-03-01T04:29:55 | 2017-03-01T04:29:55 | 82,349,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package org.moire.opensudoku.utils;
public class Const {
public static final String TAG = "edu.wright.ceg3900";
public static final String MIME_TYPE_OPENSUDOKU = "application/x-opensudoku";
}
| [
"ian@Ians-MBP.woh.rr.com"
] | ian@Ians-MBP.woh.rr.com |
07ef6ca15734e6fab4784c0b12d107cd410e3488 | d315a27517a18d2391bc684c17f7a39950c9f129 | /patterns-2/src/br/com/demo/FilaDeTrabalho.java | 96bd303214820a19c2979ef6d4beff1cf2708ff2 | [
"MIT"
] | permissive | PedroBarata/design-patterns | df46166d76f70dfa8be11a5059319551ab23d764 | 6271df44d0080982a35654cb1cec78d707a1a247 | refs/heads/master | 2023-01-19T22:47:57.185939 | 2020-11-24T02:22:05 | 2020-11-24T02:22:05 | 310,162,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package br.com.demo;
import java.util.ArrayList;
import java.util.List;
public class FilaDeTrabalho {
private List<Comando> comandoList;
public FilaDeTrabalho() {
this.comandoList = new ArrayList<>();
}
public void adicionaComando(Comando comando) {
this.comandoList.add(comando);
}
public void processa() {
for (Comando comando : this.comandoList) {
comando.executa();
}
}
}
| [
"pedrofelipebarata@gmail.com"
] | pedrofelipebarata@gmail.com |
6a31a84f85167c323d1cb285453d4f26e971f869 | 544cfadc742536618168fc80a5bd81a35a5f2c99 | /packages/services/Car/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/displayinfo/DisplayInfoFragment.java | f415e5be2dbe68a7dd74e33952f4fc2e90a8a7f7 | [] | no_license | ZYHGOD-1/Aosp11 | 0400619993b559bf4380db2da0addfa9cccd698d | 78a61ca023cbf1a0cecfef8b97df2b274ac3a988 | refs/heads/main | 2023-04-21T20:13:54.629813 | 2021-05-22T05:28:21 | 2021-05-22T05:28:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,076 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.car.kitchensink.displayinfo;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.content.res.Resources;
import android.graphics.Point;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.google.android.car.kitchensink.R;
/**
* Displays info about the display this is run on.
*/
public class DisplayInfoFragment extends Fragment {
private LinearLayout list;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.display_info, container, false);
list = (LinearLayout) view.findViewById(R.id.list);
return view;
}
@Override
public void onStart() {
super.onStart();
Point screenSize = new Point();
getActivity().getWindowManager().getDefaultDisplay().getSize(screenSize);
addTextView("window size(px): " + screenSize.x + " x " + screenSize.y);
addTextView("display density(dpi): " + getResources().getDisplayMetrics().densityDpi);
addTextView("display default density(dpi): "
+ getResources().getDisplayMetrics().DENSITY_DEFAULT);
addTextView("======================================");
ActivityManager am =
(ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo ci = am.getDeviceConfigurationInfo();
addTextView("OpenGL ES version: " + ci.getGlEsVersion());
addTextView("======================================");
addTextView("All size are in DP.");
View rootView = getActivity().findViewById(android.R.id.content);
addTextView("view size: "
+ convertPixelsToDp(rootView.getWidth(), getContext())
+ " x " + convertPixelsToDp(rootView.getHeight(), getContext()));
addTextView("window size: "
+ convertPixelsToDp(screenSize.x, getContext())
+ " x " + convertPixelsToDp(screenSize.y, getContext()));
addDimenText("car_keyline_1");
addDimenText("car_keyline_2");
addDimenText("car_keyline_3");
addDimenText("car_keyline_4");
addDimenText("car_margin");
addDimenText("car_gutter_size");
addDimenText("car_primary_icon_size");
addDimenText("car_secondary_icon_size");
addDimenText("car_title_size");
addDimenText("car_title2_size");
addDimenText("car_headline1_size");
addDimenText("car_headline2_size");
addDimenText("car_headline3_size");
addDimenText("car_headline4_size");
addDimenText("car_body1_size");
addDimenText("car_body2_size");
addDimenText("car_body3_size");
addDimenText("car_body4_size");
addDimenText("car_body5_size");
addDimenText("car_action1_size");
addDimenText("car_touch_target_size");
addDimenText("car_action_bar_height");
}
private void addDimenText(String dimenName) {
String value;
try {
float dimen = convertPixelsToDp(
getResources().getDimensionPixelSize(
getResources().getIdentifier(
dimenName, "dimen", getContext().getPackageName())),
getContext());
value = Float.toString(dimen);
} catch (Resources.NotFoundException e) {
value = "Resource Not Found";
}
addTextView(dimenName + " : " + value);
}
private void addTextView(String text) {
TextView textView = new TextView(getContext());
textView.setTextAppearance(R.style.TextAppearance_CarUi_Body2);
textView.setText(text);
list.addView(textView);
}
private static float convertPixelsToDp(float px, Context context){
Resources resources = context.getResources();
DisplayMetrics metrics = resources.getDisplayMetrics();
float dp = px / ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
return dp;
}
}
| [
"rick_tan@qq.com"
] | rick_tan@qq.com |
829728aef056d53a5207803fbc3ae84db4c64a14 | dcefa717e4dafadd9f552843e64fbc7d8af9a5fc | /src/users/User.java | 90c4474c9173d7b8151bb5eb26eb0bdbb9e0540e | [] | no_license | jacknot/EventBook | b842c59a6876792512e30364b8b1d2c2e9bd35dd | fe2b659e5a99d1519a12b0c375efb538917c83bb | refs/heads/master | 2020-04-13T01:47:51.135058 | 2019-06-25T11:36:08 | 2019-06-25T11:36:08 | 162,883,969 | 3 | 1 | null | 2019-03-17T14:58:16 | 2018-12-23T11:11:21 | Java | UTF-8 | Java | false | false | 3,796 | java | package users;
import java.io.Serializable;
import fields.FieldHeading;
/**La classe User ha il compito di fornire una struttura adatta a gestire un fruitore del social network.<br>
* Ad ogni fruitore è associato, oltre al nome, uno spazio personale inizialmente vuoto<br>
* @author Matteo Salvalai [715827], Lorenzo Maestrini[715780], Jacopo Mora [715149]
*/
public class User implements Serializable{
private static final long serialVersionUID = 1L;
/**
* Il profilo legato al fruitore
*/
private Profile profile;
/**
* Lo spazio personale del fruitore
*/
private PersonalSpace personalSpace;
/**
* Costruttore
* @param name Il nome dell'utente
*/
public User(String name) {
this.profile = new Profile(name);
this.personalSpace = new PersonalSpace();
}
/**
* Ritorna il nome dell'utente
* @return Il nome dell'utente
*/
public String getName() {
return profile.getValue(FieldHeading.NOMIGNOLO.getName()).toString();
}
/**
* Aggiunge un messaggio allo spazio personale
* @param message Il messaggio da aggiungere
*/
public void receive(Message message) {
personalSpace.add(message);
}
/**
* Rimuove un messaggio
* @param id l'identificatore del messaggio
* @return l'esito della rimozione
*/
public boolean removeMsg(int id) {
return personalSpace.remove(id);
}
/**
* Controlla se i due utenti sono uguali
* @param f utente da confrontare
* @return True - se i due utenti sono uguali<br>False - altrimenti
*/
public boolean equals(User f) {
return getName().equals(f.getName());
}
/**
* Restituisce il contenuto dello spazio personale dell'utente sotto forma di testo
* @return il contenuto dello spazio personale come testo
*/
public String showNotifications() {
return this.personalSpace.toString();
}
/**
* Visualizza il profilo dell'utente
* @return Stringa che rappresenta il profilo
*/
public String showProfile() {
return profile.toString();
}
/**
* Restituisce l'intestazione dei campi modificabili del Profilo
* @return l'intestazione dei campi modificabili del Profilo
*/
public FieldHeading[] getEditableFields() {
return profile.getEditableFields();
}
/**
* Modifica il valore del campo di cui è passato il nome come parametro
* @param name il nome del campo
* @param nValue il nuovo valore del campo
* @return True - il campo è stato modificato<br>False - il campo non è stato modificato
*/
public boolean setValue(String name, Object nValue) {
return profile.setValue(name, nValue);
}
/**
* Modifica la lista di categoria di interesse dell'utente
* @param category categoria di riferimento
* @param add True - se categoria è da aggiungere <br> False - se la categoria è da rimuovere
* @return True se l'operazione è stata completata con successo<br> False - altrimenti
*/
public boolean modifyCategory(String category, boolean add) {
return profile.modifyCategory(category, add);
}
/**
* Verifica se tra le categorie di interesse dell'utente compare la categoria il cui nome è passato come parametro
* @param categoryName nome della categoria da verificare
* @return True - se la categoria è di interesse per l'utente<br> False - la categoria non è di interesse per l'utente
*/
public boolean containsCategory(String categoryName) {
return profile.containsCategory(categoryName);
}
/**
* Verifica se lo spazio personale è vuoto
* @return True - se non è presente alcun messaggio<br> False - se lo spazio personale contiene dei messaggi
*/
public boolean noMessages() {
return personalSpace.noMessages();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return profile.getValue(FieldHeading.NOMIGNOLO.getName()).toString();
}
}
| [
"jacknot@x"
] | jacknot@x |
893070b0359a8460aa0cfe85bc6b9342d388975b | 063f9a35622ef27db109123f5b22de172fd20227 | /wangshangchaoshi/src/com/shop/gonggaoguanli/UserGonggaoguanli.java | 2166edcf3848c050f6e7457e9abaf6e1aba7899c | [] | no_license | starboy804782546/gitskills | 1f2b1ae50abe2b482b2a977a3cf1a92ed7e9c458 | c13de6ff371f589bce335aea4814b0177d8d5746 | refs/heads/master | 2021-01-10T03:26:21.720692 | 2015-12-22T13:05:21 | 2015-12-22T13:05:21 | 48,083,281 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,760 | java | package com.shop.gonggaoguanli;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import com.shop.database.Database;
import com.shop.h_supplier.SupplierBean;
import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List;
public class UserGonggaoguanli {
public ArrayList<User> AllUsers() {
String sql = "select * from gonggao";
Database data = new Database();
ResultSet res = data.selectSql(sql);
ArrayList<User> list = new ArrayList<>();
try {
while (res.next()) {
User user = new User();
user.setBianhao(res.getString("Gno"));
user.setNeirong(res.getString("Gnr"));
user.setShijian(res.getString("Gdate"));
user.setBiaoti(res.getString("Gbt"));
list.add(user);
//System.out.println(res.getString(1));
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
public boolean deleteOne(String value){
int values=Integer.parseInt(value);
Database data = new Database();
String sql="delete from gonggao where Gno='"+values+"'";
return data.updataSql(sql);
}
public boolean delete(String[] values){
Database data = new Database();
for(int i=0;i<values.length;i++){
String sql="delete from gonggao where Gno='"+values[i]+"'";
if(data.updataSql(sql)==false){
return false;
}
}
return true;
}
public ArrayList getOne(int id){
Database data = new Database();
String sql = "select * from gonggao where Gno='"+id+"'";
ArrayList list = new ArrayList();
ResultSet res = data.selectSql(sql);
try {
res.next();
User user = new User();
user.setBianhao(res.getString("Gno"));
user.setBiaoti(res.getString("Gbt"));
user.setNeirong(res.getString("Gnr"));
user.setShijian(res.getString("Gdate"));
list.add(user);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
public boolean editType(int id,String biaoti,String neirong,String shijian){
Database data = new Database();
String sql = "update gonggao set Gbt='"+biaoti+"',Gnr='"+neirong+"',Gdate='"+shijian+"' where Gno="+id+";";
data.updataSql(sql);
return true;
}
public ArrayList<User> tengonggao() {
String sql = "select * from gonggao order by Gno desc limit 10";
Database data = new Database();
ResultSet res = data.selectSql(sql);
ArrayList<User> list = new ArrayList<>();
try {
while (res.next()) {
User user = new User();
user.setBianhao(res.getString("Gno"));
user.setNeirong(res.getString("Gnr"));
user.setShijian(res.getString("Gdate"));
user.setBiaoti(res.getString("Gbt"));
list.add(user);
//System.out.println(res.getString(1));
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
}
| [
"15776709369@163.com"
] | 15776709369@163.com |
0452d9543769b65eef3d859121a57fe0514d82c4 | ffb8919b8dd88960b2ed022e083ae0732655cb41 | /backend/rpc/ItemHistory.java | f2f5dcbf49da1685437ec18cd92af121701964f5 | [] | no_license | ShuoWu1002/JobRecommendation | a4d5c329a4680579e503df90c2371a3b6349d1be | eb41f9d3729f3a87d3d8258f54eb22e039a0015d | refs/heads/master | 2022-12-12T10:00:50.264363 | 2020-09-08T02:09:40 | 2020-09-08T02:09:40 | 287,601,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,955 | java | package rpc;
import java.io.IOException;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.io.IOUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import db.MySQLConnection;
import entity.Item;
/**
* Servlet implementation class ItemHistory
*/
public class ItemHistory extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ItemHistory() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
if (session == null) {
response.setStatus(403);
return;
}
String userId = request.getParameter("user_id");
MySQLConnection connection = new MySQLConnection();
Set<Item> items = connection.getFavoriteItems(userId);
connection.close();
JSONArray array = new JSONArray();
for (Item item : items) {
JSONObject obj = item.toJSONObject();
obj.put("favorite", true);
array.put(obj);
}
RpcHelper.writeJsonArray(response, array);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
if (session == null) {
response.setStatus(403);
return;
}
MySQLConnection connection = new MySQLConnection();
JSONObject input = new JSONObject(IOUtils.toString(request.getReader()));
String userId = input.getString("user_id");
Item item = RpcHelper.parseFavoriteItem(input.getJSONObject("favorite"));
connection.setFavoriteItems(userId, item);
connection.close();
RpcHelper.writeJsonObject(response, new JSONObject().put("result", "SUCCESS"));
}
/**
* @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)
*/
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
if (session == null) {
response.setStatus(403);
return;
}
MySQLConnection connection = new MySQLConnection();
JSONObject input = new JSONObject(IOUtils.toString(request.getReader()));
String userId = input.getString("user_id");
Item item = RpcHelper.parseFavoriteItem(input.getJSONObject("favorite"));
connection.unsetFavoriteItems(userId, item.getItemId());
connection.close();
RpcHelper.writeJsonObject(response, new JSONObject().put("result", "SUCCESS"));
}
}
| [
"wushuogeorgezorro@gmail.com"
] | wushuogeorgezorro@gmail.com |
d4eedfb7f376ee7d979af6b512feecc33d742a4a | fdd01ed779c6a9d136894ce02d8c7f6f772220f2 | /src/main/java/com/unogwudan/microservices/moviecatalogservice/models/Movie.java | afc68eeb492e93ecb653d44b31ab44e37bdeff84 | [] | no_license | Unogwudan/movie-catalog-microservice | 04e53e6c2d00cfe720b87eda970d8bf4e283eacd | ce20ab1c013cbb189df8a4dd2e679539ba095520 | refs/heads/master | 2020-04-29T00:59:29.602321 | 2019-03-15T00:20:25 | 2019-03-15T00:20:25 | 175,714,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 710 | java | package com.unogwudan.microservices.moviecatalogservice.models;
public class Movie {
private String id;
private String name;
private String desc;
public Movie() {}
public Movie(String id, String name, String desc) {
this.id = id;
this.name = name;
this.desc = desc;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
@Override
public String toString() {
return "Movie [id=" + id + ", name=" + name + ", desc=" + desc + "]";
}
}
| [
"unogwu.daniel@everyfarmer.farm"
] | unogwu.daniel@everyfarmer.farm |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.