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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1f15ec31031ab23749f0d3ad8882b73fe6985fa2 | d5802d4db2007c46faf60d9725d00e75035ebe90 | /src/main/java/com/bandwidth/iris/sdk/model/SiteResponse.java | 4a5c1f9b154342b2c040a449601b541aba4f34c8 | [
"MIT"
] | permissive | rmello-daitan/java-bandwidth-iris | 328fd01156d0a67ae0e2c10cbef62c8347ee806d | 490cff5fde64d0ca5daf0b736dc625112b21b1fc | refs/heads/master | 2022-04-18T10:09:13.388493 | 2020-03-31T14:29:13 | 2020-03-31T14:29:13 | 257,377,740 | 0 | 0 | MIT | 2020-04-20T19:03:37 | 2020-04-20T19:03:36 | null | UTF-8 | Java | false | false | 542 | java | package com.bandwidth.iris.sdk.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "SiteResponse")
@XmlAccessorType(XmlAccessType.FIELD)
public class SiteResponse extends BaseResponse {
@XmlElement(name = "Site")
private Site site;
public Site getSite() {
return site;
}
public void setSite(Site site) {
this.site = site;
}
}
| [
"sbarstow@gmail.com"
] | sbarstow@gmail.com |
64b22177d824f2de730aed406777cc7214fce345 | 30b3e1b5e5a9489bc24896a8950025694e9dace0 | /src/receivedata/service/DataServiceImpl.java | e1c5f988a291c5d0f73dbb103ead9d3e3f47da37 | [] | no_license | yyrely/receive_data | d37496a28b650c4d3bb3d11997ac92f01f92d726 | 94a3c5432edb0b780bab9da899a90016cc53cd80 | refs/heads/master | 2020-04-14T22:58:43.279615 | 2019-01-05T05:38:52 | 2019-01-05T05:38:52 | 164,185,548 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,190 | java | package receivedata.service;
import java.util.Date;
import receivedata.dao.BoardDao;
import receivedata.dao.BoardDaoImpl;
import receivedata.dao.DataDao;
import receivedata.dao.DataDaoImpl;
import receivedata.dao.TransducerDao;
import receivedata.dao.TransducerDaoImpl;
import receivedata.pojo.Data;
import receivedata.pojo.Transducer;
import receivedata.pojo.TransducerDataConf;
import receivedata.utils.DruidUtil;
import receivedata.utils.PushMsg;
import receivedata.utils.jedis.JedisClient;
import receivedata.utils.jedis.JedisClientPool;
public class DataServiceImpl implements DataService {
private DataDao dataDao = new DataDaoImpl();
private TransducerDao transducerDao = new TransducerDaoImpl();
private BoardDao boardDao = new BoardDaoImpl();
private JedisClient jedisClient = new JedisClientPool();
private TransducerDataConfService transducerDataConfService = new TransducerDataConfServiceImpl();
@Override
public void save(String msg) {
try {
// 开启事务
DruidUtil.startTransaction();
// 解析参数
String boardId = Integer.parseInt(msg.substring(0, 4), 16) + "";
String transducerType = msg.substring(8, 12);
String analysisType = null;
String transducerId = Integer.parseInt(msg.substring(12, 16), 16) + "";
String transducerData = msg.substring(16, 20);
double analysisData = 0;
int status = 0;
// 根据类型的不同,解析不同的数据
switch (transducerType) {
case "0001":
analysisType = "温度传感器";
// 解析温度数据
if (Integer.parseInt(transducerData.substring(0, 1)) == 0) {
analysisData = (double) Integer.parseInt(transducerData.substring(2, 4), 16);
} else {
analysisData = Integer.parseInt(transducerData.substring(2, 4), 16) * (-1);
}
break;
case "0002":
analysisType = "湿度传感器";
// 解析湿度数据
analysisData = (double) Integer.parseInt(transducerData, 16);
break;
default:
break;
}
// 获得传感器配置对象
TransducerDataConf transducerDataConf = transducerDataConfService.getTransducerDataConf(boardId,
analysisType, transducerId);
// 从redis中取出对应的时间
String time = jedisClient.get("time:" + boardId + ":" + transducerType + ":" + transducerId);
// 判断是否在容错范围内
if ((transducerDataConf.getTransducerLevel() - transducerDataConf.getTransducerErrornum()) <= analysisData
&& (transducerDataConf.getTransducerLevel()
+ transducerDataConf.getTransducerErrornum()) >= analysisData) {
// 判断时间是否为空
if (time == null || time.equals("")) {
// 创建一个data对象
Data data = new Data();
// 封装对象
data.setBoardId(boardId);
data.setTransducerId(transducerId);
data.setTransducerType(analysisType);
data.setTransducerData((analysisData));
data.setDataTime(new Date());
// 执行添加操作
dataDao.addData(data);
// 创建传感器对象
Transducer transducer = new Transducer();
// 封装传感器对象
transducer.setApplicationFlag(transducerDataConf.getApplicationFlag());
transducer.setBoardId(boardId);
transducer.setTransducerType(analysisType);
transducer.setTransducerId(transducerId);
transducer.setTransducerStatus(status);
transducer.setTransducerNowdata(analysisData);
transducer.setTransducerTime(new Date());
// 更新传感器
transducerDao.updateTransducer(transducer);
// 更新板
boardDao.updateBoard(boardId, status,new Date());
// 在redis中设置一个时间标识,并设置过期时间
jedisClient.set("time:" + boardId + ":" + transducerType + ":" + transducerId, "time");
jedisClient.expire("time:" + boardId + ":" + transducerType + ":" + transducerId,
(transducerDataConf.getTransducerWarntime().intValue()*60));
}
} else {
// 判断是否过高
if (transducerDataConf.getTransducerMax() <= analysisData) {
PushMsg.testSendPush(analysisType.substring(0, 2) + "过高,警报",transducerDataConf.getApplicationFlag());
System.out.println(analysisType.substring(0, 2) + "过高,警报");
status = 2;
}
// 判断是否过低
if (transducerDataConf.getTransducerMin() >= analysisData) {
PushMsg.testSendPush(analysisType.substring(0, 2) + "过低,警报", transducerDataConf.getApplicationFlag());
System.out.println(analysisType.substring(0, 2) + "过低,警报");
status = 1;
}
// 创建一个data对象
Data data = new Data();
// 封装对象
data.setBoardId(boardId);
data.setTransducerId(transducerId);
data.setTransducerType(analysisType);
data.setTransducerData((analysisData));
data.setDataTime(new Date());
// 执行添加操作
dataDao.addData(data);
// 创建传感器对象
Transducer transducer = new Transducer();
// 封装传感器对象
transducer.setApplicationFlag(transducerDataConf.getApplicationFlag());
transducer.setBoardId(boardId);
transducer.setTransducerType(analysisType);
transducer.setTransducerId(transducerId);
transducer.setTransducerStatus(status);
transducer.setTransducerNowdata(analysisData);
transducer.setTransducerTime(new Date());
// 更新传感器
transducerDao.updateTransducer(transducer);
// 更新板
boardDao.updateBoard(boardId, status,new Date());
// 判断时间标识是否为空
if (time == null || time.equals("")) {
// 空则在redis中设置时间标识,并设置过期时间
jedisClient.set("time:" + boardId + ":" + transducerType + ":" + transducerId, "time");
jedisClient.expire("time:" + boardId + ":" + transducerType + ":" + transducerId,
(transducerDataConf.getTransducerWarntime().intValue()*60));
} else {
// 重置过期时间
jedisClient.expire("time:" + boardId + ":" + transducerType + ":" + transducerId,
transducerDataConf.getTransducerWarntime().intValue()*60);
}
}
// 事务提交
DruidUtil.commit();
} catch (Exception e) {
// 事务回滚
DruidUtil.rollback();
} finally {
// 事务关闭
DruidUtil.close();
}
}
}
| [
"734953453@qq.com"
] | 734953453@qq.com |
b1082bcaee95d6678b09d273eb3a6dd8b3f04e02 | a16369facaad30e8560ee8f85770375e710223f7 | /jetsencloud/src/main/java/com/chanlin/jetsencloud/QuestionViewActivity.java | 53ffb351dddea0c6e510561caf9fca4955953894 | [] | no_license | jecn/jetsen | c595bf36b255a0624a0daf07829e9be87f904243 | bad286f723b26aa9e48016b4b704499df57e514f | refs/heads/master | 2021-05-14T03:39:38.096781 | 2020-04-09T08:35:10 | 2020-04-09T08:35:10 | 116,622,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,118 | java | package com.chanlin.jetsencloud;
import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.webkit.WebView;
public class QuestionViewActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏
setContentView(R.layout.activity_question_view);
initView();
}
private void initView(){
findViewById(R.id.title_back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
Intent it = getIntent();
String html = it.getStringExtra("html");
WebView webView = (WebView) findViewById(R.id.wv_question_detail);
webView.loadData(html,"text/html;charset=utf-8","UTF-8");
}
}
| [
"xlwei920@163.com"
] | xlwei920@163.com |
4e3a38db1e80a0aaa4aeb80bd8aedfc9897b2e74 | 01ebbc94cd4d2c63501c2ebd64b8f757ac4b9544 | /backend/gxqpt-pt/gxqpt-hardware-repository/src/main/java/com/hengyunsoft/platform/hardware/repository/apply/dao/ApplyRecordMapper.java | e711efb9f116a5fe149567b0f5bd5f65a10e6b3f | [] | no_license | KevinAnYuan/gxq | 60529e527eadbbe63a8ecbbad6aaa0dea5a61168 | 9b59f4e82597332a70576f43e3f365c41d5cfbee | refs/heads/main | 2023-01-04T19:35:18.615146 | 2020-10-27T06:24:37 | 2020-10-27T06:24:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package com.hengyunsoft.platform.hardware.repository.apply.dao;
import org.springframework.stereotype.Repository;
@Repository
public interface ApplyRecordMapper extends com.hengyunsoft.base.dao.BaseAllDao<Long, com.hengyunsoft.platform.hardware.entity.apply.po.ApplyRecord, com.hengyunsoft.platform.hardware.repository.apply.example.ApplyRecordExample> {
} | [
"470382668@qq.com"
] | 470382668@qq.com |
7c8d7853e7061558c4f11405bf2b4dc40a91cb63 | 26a41203694014098e96a7bdb38ef641439b68f2 | /microservices/software-licensing/cluster-manager-service/src/main/java/com/services/cluster_manager/App.java | fe231aab5aae250e63e990ab4e5485266c913c3c | [
"Apache-2.0"
] | permissive | Kyledmw/student-projects | 42035d41cb4db04ef47e783d32424903436f5c8a | 766ef9d4b879c8c2d2086c2abe0fa224e2e051c6 | refs/heads/master | 2021-09-06T22:42:01.507696 | 2018-02-12T18:51:41 | 2018-02-12T18:51:41 | 100,615,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | package com.services.cluster_manager;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.spi.cluster.hazelcast.HazelcastClusterManager;
public class App {
public static void main(String[] args) {
ClusterManager mgr = new HazelcastClusterManager();
VertxOptions options = new VertxOptions().setClusterManager(mgr);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
} else {
}
});
}
}
| [
"kyle.d.m.williamson@gmail.com"
] | kyle.d.m.williamson@gmail.com |
eaea2d9a3f0db21161f15b3295bc1a7063309f6d | c0e81724422b4d2bda69320a19960d380c15c20e | /JSP_게시판/board/src/com/kb/www/action/MemberJoinProcAction.java | 2623fc40bc3e8ecaef16e002162122a2c4e78a13 | [] | no_license | Domanga/MiniProject | 36906aa83fa0ba618d4427fb86725dfef9b4383a | cced64e12e91d283098162e41b87dd29b1a6d2ef | refs/heads/master | 2022-12-31T18:01:55.500500 | 2020-10-20T00:36:01 | 2020-10-20T00:36:01 | 305,546,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,933 | java | package com.kb.www.action;
import com.kb.www.common.*;
import com.kb.www.service.BoardService;
import com.kb.www.vo.ArticleVo;
import com.kb.www.vo.MemberHistoryVo;
import com.kb.www.vo.MemberVo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import static com.kb.www.common.RegExp.*;
import static com.kb.www.contants.Constants.MEMBER_HISTORY_EVENT_JOIN;
public class MemberJoinProcAction implements Action {
@Override
public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
LoginManager lm = LoginManager.getInstance();
if (lm.getMemberId(request.getSession()) != null) {
ActionForward forward = new ActionForward();
forward.setPath("/");
forward.setRedirect(true);
return forward;
}
String id = request.getParameter("id");
String pwd = request.getParameter("pwd");
String email = request.getParameter("email");
String pwd_confirm = request.getParameter("pwd_confirm");
if (id == null || id.equals("") || !RegExp.checkString(MEMBER_ID, id) || pwd == null || pwd.equals("")
|| !RegExp.checkString(MEMBER_PWD, pwd)) {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<script>alert('잘못된 접근입니다.');location.href='/';</script>");
out.close();
return null;
}
if (!pwd.equals(pwd_confirm)) {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<script>alert('잘못된 접근입니다.');location.href='/';</script>");
out.close();
return null;
}
MemberVo memberVo = new MemberVo();
memberVo.setId(id);
memberVo.setPwd(BCrypt.hashpw(pwd, BCrypt.gensalt(12)));
memberVo.setEmail(email);
BoardService service = new BoardService();
MemberHistoryVo memberHistoryVo = new MemberHistoryVo();
memberHistoryVo.setEvt_type(MEMBER_HISTORY_EVENT_JOIN);
memberHistoryVo.setMb_sq(service.getMemberSequence(id));
MemberVo LeavedMember = new MemberVo();
LeavedMember = service.getLeaveMember(id);
if (LeavedMember != null && id.equals(LeavedMember.getId())) {
if (!service.updateLeaveMember(LeavedMember, memberHistoryVo)) {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<script>alert('회원 가입에 실패하였습니다.1');location.href='/';</script>");
out.close();
return null;
}
} else if (!service.joinMember(memberVo, memberHistoryVo)) {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<script>alert('회원 가입에 실패하였습니다.2');location.href='/';</script>");
out.close();
return null;
}
ActionForward forward = new ActionForward();
forward.setPath("/");
forward.setRedirect(true);
return forward;
}
}
| [
"49712688+Domanga@users.noreply.github.com"
] | 49712688+Domanga@users.noreply.github.com |
2742455da68b8419e9d9a4c1616a2b03d4b7e3e3 | ad158964d5a350133826a9e192e7281f2bc7563f | /konakart_custom_engine/src/main/java/com/konakart/app/GetProductsPerCategory.java | d4774f9cb0f0746e15736a78e70afd0d3e7d08fd | [] | no_license | lrkwz/konakart-mavenized | 1fe24f33745f9e5ec0e1424f2e0b147c1395d7d8 | 85be70d5dad017619321f0cb928a0056e45ec7c7 | refs/heads/master | 2021-01-10T07:38:14.997632 | 2018-12-30T19:12:27 | 2018-12-30T19:12:27 | 8,478,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | package com.konakart.app;
import com.konakart.appif.*;
/**
* The KonaKart Custom Engine - GetProductsPerCategory - Generated by CreateKKCustomEng
*/
public class GetProductsPerCategory
{
KKEng kkEng = null;
/**
* Constructor
*/
public GetProductsPerCategory(KKEng _kkEng)
{
kkEng = _kkEng;
}
public ProductsIf getProductsPerCategory(String sessionId, DataDescriptorIf dataDesc, int categoryId, boolean searchInSubCats, int languageId) throws KKException
{
return kkEng.getProductsPerCategory(sessionId, dataDesc, categoryId, searchInSubCats, languageId);
}
}
| [
"luca@46b29998-0e0a-4071-8d68-ba63ca06a11c"
] | luca@46b29998-0e0a-4071-8d68-ba63ca06a11c |
222723d9426fe07936a90c2f3d3b089e9b36c2d9 | 68fa904755ce63de7b12036fc8cb383b4bcfbd20 | /Backend/vHugs/src/main/java/com/vhugs/Repos/HashtagRepository.java | 1e6bc2f98c535ac4e08add2d48af6bf4b7611409 | [] | no_license | CarlDolvin86/vHugs | 4b53918c5642af784d4f670b6310b2cbff165b54 | 00bec76f87f839be4237cc6d552faf9d6561187d | refs/heads/main | 2023-03-17T04:13:53.783507 | 2021-03-07T07:30:37 | 2021-03-07T07:30:37 | 345,283,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package com.vhugs.Repos;
import com.vhugs.Models.Hashtag;
import org.springframework.data.repository.CrudRepository;
public interface HashtagRepository extends CrudRepository<Hashtag,Long> {
}
| [
"carl.dolvin@gmail.com"
] | carl.dolvin@gmail.com |
199cdc2e4d1e4f8cbf92617a4c287df806fa1b8c | e8ae10cd2e83d0cc1ed21e7479718a498742e3d5 | /src/users/UsersDAO.java | 7a79cb4dc908a3dfdf59234ccd7257e640ad6881 | [] | no_license | wonhani/pts | cbee3a7e4d7052395c811e35c70e3cb63974d992 | 97e106fbac1f3994c3aa5335cb2dd630efb49ca1 | refs/heads/master | 2020-03-20T08:25:07.006325 | 2018-06-13T17:41:01 | 2018-06-13T17:41:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,158 | java | package users;
import java.sql.*;
import DBConnection.*;
public class UsersDAO {
DBConnect dbconnect = null;
String sql="";
public UsersDAO() {
dbconnect = new DBConnect();
}
public int Login(String uid, String upw) {
Connection con = dbconnect.getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
int wpid = -1;
try {
sql = "select wpid from users where uid=? and upw=password(?)";
pstmt = con.prepareStatement(sql);
pstmt.setString(1, uid);
pstmt.setString(2, upw);
rs = pstmt.executeQuery();
if(rs.next()) {
wpid = rs.getInt(1);
}
}catch(Exception e) {
}finally {
DBClose.close(con,pstmt,rs);
}
return wpid;
}
public String getWpname(int wpid) {
Connection con = dbconnect.getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
sql = "select wpname from workplace where wpid=?";
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, wpid);
rs = pstmt.executeQuery();
if(rs.next()) {
return rs.getString(1);
}
}catch(Exception e) {
}finally {
DBClose.close(con,pstmt,rs);
}
return "";
}
}
| [
"iiny1004@naver.com"
] | iiny1004@naver.com |
40be271148a410fe83ee78963d6847a0d98dfb25 | 13d8d8578a0d3a33395d6adbdc4eecd8943d8e42 | /app/src/main/java/com/vayrotech/fourrocksgallery/FolderFragmentStuff/Model_images.java | ed4fd1483dc738b16ccde5bafbcf798283ab874d | [] | no_license | Vayro/FourSnap | 11a274c93b96560b83796fea47b932f8750b0292 | b52e9b8782983e33675a520fa8833e686bca731b | refs/heads/main | 2023-09-04T18:25:13.285482 | 2021-11-24T04:39:36 | 2021-11-24T04:39:36 | 403,104,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,257 | java | package com.vayrotech.fourrocksgallery.FolderFragmentStuff;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.Date;
//images and folder path
public class Model_images implements Parcelable {
String str_folder, str_folderPath, str_title;
Date str_dateModified;
ArrayList<String> al_imagepath;
protected Model_images(Parcel in) {
str_folder = in.readString();
str_folderPath = in.readString();
str_title = in.readString();
al_imagepath = in.createStringArrayList();
}
public static final Creator<Model_images> CREATOR = new Creator<Model_images>() {
@Override
public Model_images createFromParcel(Parcel in) {
return new Model_images(in);
}
@Override
public Model_images[] newArray(int size) {
return new Model_images[size];
}
};
public Model_images() {
}
public String getStr_folder() {
return str_folder;
}
public void setStr_folder(String str_folder) {
this.str_folder = str_folder;
}
public ArrayList<String> getAl_imagepath() {
return al_imagepath;
}
public void setAl_imagepath(ArrayList<String> al_imagepath) {
this.al_imagepath = al_imagepath;
}
public String toString() {
return str_folder;
}
public String getStr_folderPath() {
return str_folderPath;
}
public void setStr_folderPath(String str_folderPath) {
this.str_folderPath = str_folderPath;
}
public String getStr_title() {
return str_title;
}
public void setStr_title(String str_title) {
this.str_title = str_title;
}
public Date getStr_dateModified() {
return str_dateModified;
}
public void setStr_dateModified(Date str_dateModified) {
this.str_dateModified = str_dateModified;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(str_folder);
parcel.writeString(str_folderPath);
parcel.writeString(str_title);
parcel.writeStringList(al_imagepath);
}
} | [
"lbluck@gmail.com"
] | lbluck@gmail.com |
74a2c2c74ef7776ecac4c16aa4270968d1c18b00 | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-globalaccelerator/src/main/java/com/amazonaws/services/globalaccelerator/model/transform/DescribeListenerResultJsonUnmarshaller.java | aa327579a114c2858cd0483877719bf833ca8c4f | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 2,859 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.globalaccelerator.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.globalaccelerator.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* DescribeListenerResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeListenerResultJsonUnmarshaller implements Unmarshaller<DescribeListenerResult, JsonUnmarshallerContext> {
public DescribeListenerResult unmarshall(JsonUnmarshallerContext context) throws Exception {
DescribeListenerResult describeListenerResult = new DescribeListenerResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return describeListenerResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("Listener", targetDepth)) {
context.nextToken();
describeListenerResult.setListener(ListenerJsonUnmarshaller.getInstance().unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return describeListenerResult;
}
private static DescribeListenerResultJsonUnmarshaller instance;
public static DescribeListenerResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new DescribeListenerResultJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
fbe9fbeb3a0d53f22cb1b21d967fca8e472be978 | 94ee0a4b8ba9de465d501a0f89fb1189399a73c5 | /app/src/main/java/com/kunminx/puremusic/domain/usecase/CanBeStoppedUseCase.java | 73d33acc7e6e32c59a68ec73ba646e95a0e0a99c | [
"Apache-2.0"
] | permissive | harisucici/Jetpack-MVVM-Scaffold | b9050d00ec0381e0be06c4c381a6054b7249a155 | 48ae3650017dbeaf3e7027394dcd6b8d62a3a837 | refs/heads/master | 2022-08-06T16:12:13.668628 | 2020-05-23T08:19:44 | 2020-05-23T08:19:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,492 | java | /*
* Copyright 2018-2020 KunMinX
*
* 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.kunminx.puremusic.domain.usecase;
import androidx.annotation.NonNull;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import com.kunminx.architecture.data.usecase.UseCase;
import com.kunminx.puremusic.data.bean.DownloadFile;
import com.kunminx.puremusic.data.repository.DataRepository;
import static com.kunminx.puremusic.domain.usecase.CanBeStoppedUseCase.RequestValues;
import static com.kunminx.puremusic.domain.usecase.CanBeStoppedUseCase.ResponseValue;
/**
* UseCase 示例,实现 LifeCycle 接口,单独服务于 有 “叫停” 需求 的业务
*
* TODO tip:
* 同样是“下载”,我不是在数据层分别写两个方法,
* 而是遵循开闭原则,在 vm 和 数据层之间,插入一个 UseCase,来专门负责可叫停的情况,
* 除了开闭原则,使用 UseCase 还有个考虑就是避免内存泄漏,
* 具体缘由可详见 https://xiaozhuanlan.com/topic/6257931840 评论区 15 楼
*
* Create by KunMinX at 19/11/25
*/
public class CanBeStoppedUseCase extends UseCase<RequestValues, ResponseValue> implements DefaultLifecycleObserver {
@Override
public void onStop(@NonNull LifecycleOwner owner) {
if (getRequestValues() != null && getRequestValues().liveData != null) {
DownloadFile downloadFile = getRequestValues().liveData.getValue();
downloadFile.setForgive(true);
getRequestValues().liveData.setValue(downloadFile);
getUseCaseCallback().onSuccess(new ResponseValue(getRequestValues().liveData));
}
}
@Override
protected void executeUseCase(RequestValues requestValues) {
//访问数据层资源,在 UseCase 中处理带叫停性质的业务
DataRepository.getInstance().downloadFile(requestValues.liveData);
}
public static final class RequestValues implements UseCase.RequestValues {
private MutableLiveData<DownloadFile> liveData;
public RequestValues(MutableLiveData<DownloadFile> liveData) {
this.liveData = liveData;
}
public MutableLiveData<DownloadFile> getLiveData() {
return liveData;
}
public void setLiveData(MutableLiveData<DownloadFile> liveData) {
this.liveData = liveData;
}
}
public static final class ResponseValue implements UseCase.ResponseValue {
private MutableLiveData<DownloadFile> liveData;
public ResponseValue(MutableLiveData<DownloadFile> liveData) {
this.liveData = liveData;
}
public LiveData<DownloadFile> getLiveData() {
return liveData;
}
public void setLiveData(MutableLiveData<DownloadFile> liveData) {
this.liveData = liveData;
}
}
}
| [
"kunminx@gmail.com"
] | kunminx@gmail.com |
ff8e1bc0905e2550a30f207a788c97c1961a27a6 | cf33a7956437e5831e14134d9481890e84c3aef1 | /Java基础精讲/第12节_Java常用工具_集合/01_代码/代码/CollectionProject/src/cn/itcast/demo1/Student.java | 683f8eb44b35b850235c81726bf958c0b949a371 | [] | no_license | kurakikyrakiujarod/java_ | 262497482a32f7abf99b92c2bd09ebcb97039b22 | 46410c83c36e9ff93b5d7f6f1cad126da809c8cd | refs/heads/master | 2020-07-16T19:49:49.178282 | 2019-09-10T16:21:59 | 2019-09-10T16:21:59 | 205,856,204 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package cn.itcast.demo1;
//学生类
public class Student {
//成员变量
private String name;
private int age;
public Student() {
}
public Student(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "Student{" +
"name='" + name + '\'' +
", age=" + age +
'}';
}
}
| [
"1172486898@qq.com"
] | 1172486898@qq.com |
4a64081c17e92358270d243bb38d6940c8b29252 | 37ad0898c385621513ebe1f39855005b157d3229 | /src/main/java/utils/LoggerClass.java | 5a61b80dcb7ab1c8765ef3a1e6fbf8c5ca61bab8 | [] | no_license | schap016/SalesforceWebAutomation | 122b44d400d51f1b8b255a90ff9b832f4b42c5c7 | 3bcfe309acb2f0f4bdafe5584b4a16a03895105e | refs/heads/master | 2023-01-27T23:53:25.859259 | 2020-12-08T19:47:12 | 2020-12-08T19:47:12 | 319,452,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package utils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class LoggerClass {
//private static Logger logger = LogManager.getLogger(LoggerClass.class);
public static void logInfoMessage(String string, Logger logger) {
// TODO Auto-generated method stub
logger.info(string);
}
public static void logErrorMessage(String string, Logger logger) {
// TODO Auto-generated method stub
logger.error(string);
}
}
| [
"samantha.chapa@gmail.com"
] | samantha.chapa@gmail.com |
962c36d77ade169e351aa4445574f86eabaa8c6c | acde59397f8fc162e6b14047e3ec17ccef7bf1f3 | /app/src/main/java/com/example/android/hac/MakananJakarta/TablayoutInfoMakananJakarta1.java | f686e9726b92f766d689654cb3be97931d92b58d | [] | no_license | nurcahyadi/HACWidyatama | b6b54c90c760feace913ab623f77f783af6991f0 | 2eb0827505bc09c16071db452cf19a582165bc7d | refs/heads/master | 2021-04-17T21:04:12.795207 | 2018-03-23T12:13:48 | 2018-03-23T12:13:48 | 126,480,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,852 | java | package com.example.android.hac.MakananJakarta;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.daimajia.slider.library.Animations.DescriptionAnimation;
import com.daimajia.slider.library.SliderLayout;
import com.daimajia.slider.library.SliderTypes.BaseSliderView;
import com.daimajia.slider.library.SliderTypes.TextSliderView;
import com.example.android.hac.R;
import java.util.HashMap;
public class TablayoutInfoMakananJakarta1 extends AppCompatActivity {
/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
private SectionsPagerAdapter mSectionsPagerAdapter;
/**
* The {@link ViewPager} that will host the section contents.
*/
private ViewPager mViewPager;
private SliderLayout sliderLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tablayout_info_batik_jakarta1);
sliderLayout = (SliderLayout) findViewById(R.id.slider);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
//
// FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
// fab.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();
// }
// });
HashMap<String, Integer> file_maps = new HashMap<String, Integer>();
file_maps.put("Asinan", R.mipmap.asinanbetawi);
file_maps.put("Asinan Betawi", R.mipmap.asinanbetawi);
file_maps.put("Makanan Asinan Betawi", R.mipmap.asinanbetawi);
for (String name : file_maps.keySet()) {
TextSliderView textSliderView = new TextSliderView(this);
// initialize a SliderLayout
textSliderView
.description(name)
.image(file_maps.get(name))
.setScaleType(BaseSliderView.ScaleType.Fit);
//add your extra information
textSliderView.bundle(new Bundle());
textSliderView.getBundle()
.putString("extra", name);
sliderLayout.addSlider(textSliderView);
}
sliderLayout.setPresetTransformer(SliderLayout.Transformer.Accordion);
sliderLayout.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
sliderLayout.setCustomAnimation(new DescriptionAnimation());
sliderLayout.setDuration(4000);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_info_batik_jakarta1, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
private static final String ARG_SECTION_NUMBER = "section_number";
public PlaceholderFragment() {
}
/**
* Returns a new instance of this fragment for the given section
* number.
*/
public static PlaceholderFragment newInstance(int sectionNumber) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_info_batik_jakarta1, container, false);
return rootView;
}
}
/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
FragmentInfoMakananJakarta1 tab1 = new FragmentInfoMakananJakarta1();
return tab1;
case 1:
FragmentInfoMakananmapsJakarta1 tab2 = new FragmentInfoMakananmapsJakarta1();
return tab2;
default:
return null;
}
}
@Override
public int getCount() {
// Show 3 total pages.
return 2;
}
}
} | [
"perdana.nurcahyadi@gmail.com"
] | perdana.nurcahyadi@gmail.com |
7cfc025529a3d9b78eab50ca876542448795ef95 | 9388ccdf21c62dc67f055512f611469ab10be320 | /src/main/java/net/proselyte/javase/chapter05/Break.java | 8dfdbb5617965ac0675c7195b40f4f49c8c84c14 | [] | no_license | devsambuca/LearnJava | 9e69e497e0788169055551446359059d90f70434 | 509337a7c00579ef831421572378008feeb35a9a | refs/heads/master | 2020-06-01T21:59:57.458507 | 2017-11-22T14:29:08 | 2017-11-22T14:29:08 | 94,086,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package main.java.net.proselyte.javase.chapter05;
/**
* @author Fominykh Vladimir
*
* Применение операторов break в качестве цивилизованной
* формы оператора goto
*/
public class Break {
public static void main(String[] args) {
boolean t = true;
first:
{
second:
{
third:
{
System.out.println("Предшествует оператору break.");
if (t) break second; // выход из блока second
System.out.println("Этот оператор не будет выполняться");
}
System.out.println("Этот оператор не будет выполняться");
}
System.out.println("Этот оператор следует за блоком second.");
}
}
}
| [
"stoyakovi4@gmail.com"
] | stoyakovi4@gmail.com |
1652b7136ff952e80628044af0ccd12e604c03ad | e977c424543422f49a25695665eb85bfc0700784 | /benchmark/icse15/772337/buggy-version/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/SlaveDatabase.java | 44ea6fa6c55f1bf34eea550e2609f6ca808b5e90 | [] | no_license | amir9979/pattern-detector-experiment | 17fcb8934cef379fb96002450d11fac62e002dd3 | db67691e536e1550245e76d7d1c8dced181df496 | refs/heads/master | 2022-02-18T10:24:32.235975 | 2019-09-13T15:42:55 | 2019-09-13T15:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,630 | java | /*
Derby - Class org.apache.derby.impl.db.SlaveDatabase
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.apache.derby.impl.db;
import org.apache.derby.iapi.error.PublicAPI;
import org.apache.derby.iapi.reference.Attribute;
import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.error.ExceptionSeverity;
import org.apache.derby.iapi.jdbc.AuthenticationService;
import org.apache.derby.iapi.services.context.ContextManager;
import org.apache.derby.iapi.services.context.ContextService;
import org.apache.derby.iapi.services.monitor.Monitor;
import org.apache.derby.iapi.store.replication.slave.SlaveFactory;
import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
/**
* SlaveDatabase is an instance of Database, and is booted instead of
* BasicDatabase if this database will have the replication slave
* role. SlaveDatabase differs from BasicDatabase in the following
* ways:
*
* 1: When starting a non-replicated database (i.e., BasicDatabase),
* only one thread is used to start all modules of the database.
* When booted in slave mode, the thread that boots the store
* module will be blocked during log recovery. To remedy this,
* SlaveDatabase runs the boot method of BasicDatabase in a
* separate thread. This ensures that the connection attempt that
* started slave replication mode will not hang.
*
* 2: While the database is in replication slave mode, the
* authentication services are not available because these require
* that the store module has been booted first. Calling
* getAuthenticationService when in slave mode will raise an
* exception.
*
* 3: While the database is in replication slave mode, connections are
* not accepted since the database cannot process transaction
* requests. Calling setupConnection when in slave mode will raise
* an exception.
*
* 4: If the failover command has been executed for this database, it
* is no longer in replication slave mode. When this has
* happened, SlaveDatabase works exactly as BasicDatabase.
*/
public class SlaveDatabase extends BasicDatabase {
/** True until SlaveDatabaseBootThread has successfully booted the
* database. Does not happen until the failover command has been
* executed for this database */
private volatile boolean inReplicationSlaveMode;
private volatile boolean shutdownInitiated;
/** True until this database has been successfully booted. Any
* exception that occurs while inBoot is true will be handed to
* the client thread booting this database. */
private volatile boolean inBoot;
/** Set by the database boot thread if it fails before slave mode
* has been started properly (i.e., if inBoot is true). This
* exception will then be reported to the client connection. */
private volatile StandardException bootException;
private String dbname; // The name of the replicated database
private volatile SlaveFactory slaveFac;
/////////////////////////////
// ModuleControl interface //
/////////////////////////////
/**
* Determines whether this Database implementation should be used
* to boot the database.
* @param startParams The properties used to decide if
* SlaveDatabase is the correct implementation of Database for the
* database to be booted.
* @return true if the database is updatable (not read-only) and
* replication slave mode is specified in startParams
*/
public boolean canSupport(Properties startParams) {
boolean supported =
Monitor.isDesiredCreateType(startParams, getEngineType());
if (supported) {
String repliMode =
startParams.getProperty(SlaveFactory.REPLICATION_MODE);
if (repliMode == null ||
!repliMode.equals(SlaveFactory.SLAVE_MODE)) {
supported = false;
}
}
return supported;
}
public void boot(boolean create, Properties startParams)
throws StandardException {
inReplicationSlaveMode = true;
inBoot = true;
shutdownInitiated = false;
dbname = startParams.getProperty(SlaveFactory.SLAVE_DB);
// SlaveDatabaseBootThread is an internal class
SlaveDatabaseBootThread dbBootThread =
new SlaveDatabaseBootThread(create, startParams);
Thread sdbThread =
new Thread(dbBootThread, "derby.slave.boot-" + dbname);
sdbThread.setDaemon(true);
sdbThread.start();
// Check that the database was booted successfully, or throw
// the exception that caused the boot to fail.
verifySuccessfulBoot();
inBoot = false;
// This module has now been booted (hence active=true) even
// though submodules like store and authentication may not
// have completed their boot yet. We deal with that by raising
// an error on attempts to use these
active=true;
}
/**
* Called by Monitor when this module is stopped, i.e. when the
* database is shut down. When the database is shut down using the
* stopSlave command, the stopReplicationSlave method has already
* been called when this method is called. In this case, the
* replication functionality has already been stopped. If the
* database is shutdown as part of a system shutdown, however, we
* need to cleanup slave replication as part of database shutdown.
*/
public void stop() {
if (inReplicationSlaveMode && slaveFac != null) {
try {
slaveFac.stopSlave(true);
} catch (StandardException ex) {
} finally {
slaveFac = null;
}
}
super.stop();
}
/////////////////////
// Class interface //
/////////////////////
public SlaveDatabase() {
}
////////////////////////
// Database interface //
////////////////////////
public boolean isInSlaveMode() {
return inReplicationSlaveMode;
}
public LanguageConnectionContext setupConnection(ContextManager cm,
String user,
String drdaID,
String dbname)
throws StandardException {
if (inReplicationSlaveMode) {
// do not allow connections to a database that is
// currently in replication slave move
throw StandardException.newException(
SQLState.CANNOT_CONNECT_TO_DB_IN_SLAVE_MODE, dbname);
}
return super.setupConnection(cm, user, drdaID, dbname);
}
public AuthenticationService getAuthenticationService()
throws StandardException{
if (inReplicationSlaveMode) {
// Cannot get authentication service for a database that
// is currently in replication slave move
throw StandardException.newException(
SQLState.CANNOT_CONNECT_TO_DB_IN_SLAVE_MODE, dbname);
}
return super.getAuthenticationService();
}
/**
* Verify that a connection to stop the slave has been made from
* here. If verified, the database context is given to the method
* caller. This will ensure this database is shutdown when an
* exception with database severity is thrown. If not verified, an
* exception is thrown.
*
* @exception StandardException Thrown if a stop slave connection
* attempt was not made from this class
*/
public void verifyShutdownSlave() throws StandardException {
if (!shutdownInitiated) {
throw StandardException.
newException(SQLState.REPLICATION_STOPSLAVE_NOT_INITIATED);
}
pushDbContext(ContextService.getFactory().
getCurrentContextManager());
}
/**
* Stop replication slave mode if replication slave mode is active and
* the network connection with the master is down
*
* @exception SQLException Thrown on error, if not in replication
* slave mode or if the network connection with the master is not down
*/
public void stopReplicationSlave() throws SQLException {
if (shutdownInitiated) {
// The boot thread has failed or stopReplicationSlave has
// already been called. There is nothing more to do to
// stop slave replication mode.
return;
}
if (!inReplicationSlaveMode) {
StandardException se = StandardException.
newException(SQLState.REPLICATION_NOT_IN_SLAVE_MODE);
throw PublicAPI.wrapStandardException(se);
}
// stop slave without using force, meaning that this method
// call will fail with an exception if the network connection
// with the master is up
try {
slaveFac.stopSlave(false);
} catch (StandardException se) {
throw PublicAPI.wrapStandardException(se);
}
slaveFac = null;
}
public void failover(String dbname) throws StandardException {
if (inReplicationSlaveMode) {
slaveFac.failover();
// SlaveFactory#failover will make the
// SlaveDatabaseBootThread complete booting of the store
// modules, and inReplicationSlaveMode will then be set to
// false (see SlaveDatabaseBootThread#run).
// Wait until store is completely booted before returning from
// this method
while (inReplicationSlaveMode) {
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
// do nothing
}
}
} else {
// If failover is performed on a master that has been a slave
// earlier
super.failover(dbname);
}
}
/////////////////
// Inner Class //
/////////////////
/**
* Thread that boots the slave database. Will be blocked in
* LogFactory.recover until database is no longer in slave
* replication mode.
*/
private class SlaveDatabaseBootThread implements Runnable {
private boolean create;
private Properties params;
public SlaveDatabaseBootThread(boolean create, Properties startParams){
this.create = create;
params = startParams;
}
public void run() {
// The thread needs a ContextManager since two threads
// cannot share a context
ContextManager bootThreadCm = null;
try {
bootThreadCm = ContextService.getFactory().newContextManager();
ContextService.getFactory().
setCurrentContextManager(bootThreadCm);
bootBasicDatabase(create, params); // will be blocked
// if we get here, failover has been called and the
// database can now be connected to
inReplicationSlaveMode = false;
if (bootThreadCm != null) {
ContextService.getFactory().
resetCurrentContextManager(bootThreadCm);
bootThreadCm = null;
}
} catch (StandardException se) {
// We get here when SlaveController#stopSlave has been
// called, or if a fatal exception has been thrown.
handleShutdown(se);
}
}
}
////////////////////
// Private Methods//
////////////////////
/**
* Verify that the slave functionality has been properly started.
* This method will block until a successful slave startup has
* been confirmed, or it will throw the exception that caused it
* to fail.
*/
private void verifySuccessfulBoot() throws StandardException {
while (!(isSlaveFactorySet() && slaveFac.isStarted())) {
if (bootException != null) {
throw bootException;
} else {
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
// do nothing
}
}
}
if (bootException != null &&
SQLState.SHUTDOWN_DATABASE.startsWith(
bootException.getSQLState()) &&
bootException.getSeverity() == ExceptionSeverity.DATABASE_SEVERITY) {
// DERBY-4186: This is a corner case. Master made us shut down
// before the initial connect which establishes the slave has
// finalized it setting up of the slave and returned control to the
// application. bootException is set while we (application thread)
// are waiting in the sleep in the loop above (by the
// SlaveDatabaseBootThread thread in its call to handleShutdown),
// and this was previously ignored.
throw bootException;
}
}
/**
* If slaveFac (the reference to the SlaveFactory) has not already
* been set, this method will try to set it by calling
* Monitor.findServiceModule. If slavFac was already set, the
* method does not do anything.
*
* @return true if slaveFac is set after calling this method,
* false otherwise
*/
private boolean isSlaveFactorySet() {
if (slaveFac != null) {
return true;
}
try {
slaveFac = (SlaveFactory)Monitor.
findServiceModule(this, SlaveFactory.MODULE);
return true;
} catch (StandardException se) {
// We get a StandardException if SlaveFactory has not been
// booted yet. Safe to retry later.
return false;
}
}
/**
* Used to shutdown this database.
*
* If an error occurs as part of the database boot process, we
* hand the exception that caused boot to fail to the client
* thread. The client thread will in turn shut down this database.
*
* If an error occurs at a later stage than during boot, we shut
* down the database by setting up a connection with the shutdown
* attribute. The internal connection is required because database
* shutdown requires EmbedConnection to do cleanup.
*
* @param shutdownCause the reason why the database needs to be
* shutdown
*/
private void handleShutdown(StandardException shutdownCause) {
if (inBoot) {
bootException = shutdownCause;
return;
}
try {
shutdownInitiated = true;
String driverName =
"org.apache.derby.jdbc.EmbeddedDriver";
Class.forName(driverName).newInstance();
Driver embedDriver =
DriverManager.getDriver(Attribute.PROTOCOL);
String conStr = "jdbc:derby:"+dbname+";"+
Attribute.REPLICATION_INTERNAL_SHUTDOWN_SLAVE+
"=true";
embedDriver.connect(conStr, (Properties) null);
} catch (Exception e) {
// Todo: report error to derby.log if exception is not
// SQLState.SHUTDOWN_DATABASE
}
}
private void bootBasicDatabase(boolean create, Properties params)
throws StandardException {
// This call will be blocked while slave replication mode is
// active
super.boot(create, params);
}
}
| [
"durieuxthomas@hotmail.com"
] | durieuxthomas@hotmail.com |
67b18ab13422fa9fd0e626325b5ebb723b5b17e8 | 8f17729d23e887136ec0daaff9dd0d7a13fa3514 | /oleg_chumak/src/main/java/session4/hw1/User.java | bc15491ee740951ff63f9bb29f05ce781f8ec57c | [] | no_license | RAZER-KIEV/proff25 | e3901518ac9655255abf9245c4c2f861ac1c5c9d | 7e0c8811aad538d8ec67a77558a12f85f691edf6 | refs/heads/master | 2021-01-10T16:08:45.373377 | 2015-08-18T16:13:08 | 2015-08-18T16:13:08 | 47,151,116 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | java | package session4.hw1;
/**
* Created by oleg on 27.05.15.
*/
public class User {
private String login;
private String password;
private String dateOfRegistration;
private int rating;
private int sex;
public User(String login, String password, String dateOfRegistration, int rating, int sex) {
this.login = login;
this.password = password;
this.dateOfRegistration = dateOfRegistration;
this.rating = rating;
this.sex = sex;
}
public User() {
}
@Override
public boolean equals(Object o){
return (login.equals(((User) o).login) && password.equals(((User) o).password) && dateOfRegistration.equals(((User)o).dateOfRegistration) && rating == ((User)o).rating && sex == ((User)o).sex);
}
@Override
public int hashCode(){
return login.hashCode() + password.hashCode() + dateOfRegistration.hashCode() + rating + sex;
}
}
class UserTest{
}
| [
"oleg4ymak@gmail.com"
] | oleg4ymak@gmail.com |
89f2a02c28f1a04aeff9892c8f5b400aec2abcfa | 76f277e81d7d1371260b5251f8a138e400eb35d4 | /com.lenkp.asteriskmonitor.externallib/ch/loway/oss/ari4java/generated/ari_1_9_0/actions/ActionAsterisk_impl_ari_1_9_0.java | de309216082935b0ebc4430c928372a785161234 | [] | no_license | mbahhalim/lenkp | accd111289045c7f878bc9b1527a26770dc47c35 | 81011cb26fa3a2583217ee7e9ad9ee0d363eca32 | refs/heads/master | 2020-04-06T06:54:14.098156 | 2016-09-02T08:27:12 | 2016-09-02T08:27:12 | 64,806,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,228 | java | package ch.loway.oss.ari4java.generated.ari_1_9_0.actions;
// ----------------------------------------------------
// THIS CLASS WAS GENERATED AUTOMATICALLY
// PLEASE DO NOT EDIT
// Generated on: Sat Jan 30 13:39:06 CET 2016
// ----------------------------------------------------
import ch.loway.oss.ari4java.generated.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import ch.loway.oss.ari4java.tools.BaseAriAction;
import ch.loway.oss.ari4java.tools.RestException;
import ch.loway.oss.ari4java.tools.AriCallback;
import ch.loway.oss.ari4java.tools.HttpParam;
import ch.loway.oss.ari4java.tools.HttpResponse;
import com.fasterxml.jackson.core.type.TypeReference;
import ch.loway.oss.ari4java.generated.ari_1_9_0.models.*;
/**********************************************************
*
* Generated by: Apis
*********************************************************/
public class ActionAsterisk_impl_ari_1_9_0 extends BaseAriAction implements ActionAsterisk {
/**********************************************************
* Asterisk dynamic configuration
*
* Retrieve a dynamic configuration object.
*********************************************************/
private void buildGetObject(String configClass, String objectType, String id) {
reset();
url = "/asterisk/config/dynamic/" + configClass + "/" + objectType + "/" + id + "";
method = "GET";
lE.add( HttpResponse.build( 404, "{configClass|objectType|id} not found") );
}
@Override
public List<ConfigTuple> getObject(String configClass, String objectType, String id) throws RestException {
buildGetObject(configClass, objectType, id);
String json = httpActionSync();
return deserializeJsonAsAbstractList( json,
new TypeReference<List<ConfigTuple_impl_ari_1_9_0>>() {} );
}
@Override
public void getObject(String configClass, String objectType, String id, AriCallback<List<ConfigTuple>> callback) {
buildGetObject(configClass, objectType, id);
httpActionAsync(callback, new TypeReference<List<ConfigTuple_impl_ari_1_9_0>>() {});
}
/**********************************************************
* Asterisk dynamic configuration
*
* Create or update a dynamic configuration object.
*********************************************************/
private void buildUpdateObject(String configClass, String objectType, String id, Map<String,String> fields) {
reset();
url = "/asterisk/config/dynamic/" + configClass + "/" + objectType + "/" + id + "";
method = "PUT";
lE.add( HttpResponse.build( 400, "Bad request body") );
lE.add( HttpResponse.build( 403, "Could not create or update object") );
lE.add( HttpResponse.build( 404, "{configClass|objectType} not found") );
}
@Override
public List<ConfigTuple> updateObject(String configClass, String objectType, String id, Map<String,String> fields) throws RestException {
buildUpdateObject(configClass, objectType, id, fields);
String json = httpActionSync();
return deserializeJsonAsAbstractList( json,
new TypeReference<List<ConfigTuple_impl_ari_1_9_0>>() {} );
}
@Override
public void updateObject(String configClass, String objectType, String id, Map<String,String> fields, AriCallback<List<ConfigTuple>> callback) {
buildUpdateObject(configClass, objectType, id, fields);
httpActionAsync(callback, new TypeReference<List<ConfigTuple_impl_ari_1_9_0>>() {});
}
/**********************************************************
* Asterisk dynamic configuration
*
* Delete a dynamic configuration object.
*********************************************************/
private void buildDeleteObject(String configClass, String objectType, String id) {
reset();
url = "/asterisk/config/dynamic/" + configClass + "/" + objectType + "/" + id + "";
method = "DELETE";
lE.add( HttpResponse.build( 403, "Could not delete object") );
lE.add( HttpResponse.build( 404, "{configClass|objectType|id} not found") );
}
@Override
public void deleteObject(String configClass, String objectType, String id) throws RestException {
buildDeleteObject(configClass, objectType, id);
String json = httpActionSync();
}
@Override
public void deleteObject(String configClass, String objectType, String id, AriCallback<Void> callback) {
buildDeleteObject(configClass, objectType, id);
httpActionAsync(callback);
}
/**********************************************************
* Asterisk system information (similar to core show settings)
*
* Gets Asterisk system information.
*********************************************************/
private void buildGetInfo(String only) {
reset();
url = "/asterisk/info";
method = "GET";
lParamQuery.add( HttpParam.build( "only", only) );
}
@Override
public AsteriskInfo getInfo(String only) throws RestException {
buildGetInfo(only);
String json = httpActionSync();
return deserializeJson( json, AsteriskInfo_impl_ari_1_9_0.class );
}
@Override
public void getInfo(String only, AriCallback<AsteriskInfo> callback) {
buildGetInfo(only);
httpActionAsync(callback, AsteriskInfo_impl_ari_1_9_0.class);
}
/**********************************************************
* Asterisk log channels
*
* Gets Asterisk log channel information.
*********************************************************/
private void buildListLogChannels() {
reset();
url = "/asterisk/logging";
method = "GET";
}
@Override
public List<LogChannel> listLogChannels() throws RestException {
buildListLogChannels();
String json = httpActionSync();
return deserializeJsonAsAbstractList( json,
new TypeReference<List<LogChannel_impl_ari_1_9_0>>() {} );
}
@Override
public void listLogChannels(AriCallback<List<LogChannel>> callback) {
buildListLogChannels();
httpActionAsync(callback, new TypeReference<List<LogChannel_impl_ari_1_9_0>>() {});
}
/**********************************************************
* Asterisk log channel
*
* Adds a log channel.
*********************************************************/
private void buildAddLog(String logChannelName, String configuration) {
reset();
url = "/asterisk/logging/" + logChannelName + "";
method = "POST";
lParamQuery.add( HttpParam.build( "configuration", configuration) );
lE.add( HttpResponse.build( 400, "Bad request body") );
lE.add( HttpResponse.build( 409, "Log channel could not be created.") );
}
@Override
public void addLog(String logChannelName, String configuration) throws RestException {
buildAddLog(logChannelName, configuration);
String json = httpActionSync();
}
@Override
public void addLog(String logChannelName, String configuration, AriCallback<Void> callback) {
buildAddLog(logChannelName, configuration);
httpActionAsync(callback);
}
/**********************************************************
* Asterisk log channel
*
* Deletes a log channel.
*********************************************************/
private void buildDeleteLog(String logChannelName) {
reset();
url = "/asterisk/logging/" + logChannelName + "";
method = "DELETE";
lE.add( HttpResponse.build( 404, "Log channel does not exist.") );
}
@Override
public void deleteLog(String logChannelName) throws RestException {
buildDeleteLog(logChannelName);
String json = httpActionSync();
}
@Override
public void deleteLog(String logChannelName, AriCallback<Void> callback) {
buildDeleteLog(logChannelName);
httpActionAsync(callback);
}
/**********************************************************
* Asterisk log channel
*
* Rotates a log channel.
*********************************************************/
private void buildRotateLog(String logChannelName) {
reset();
url = "/asterisk/logging/" + logChannelName + "/rotate";
method = "PUT";
lE.add( HttpResponse.build( 404, "Log channel does not exist.") );
}
@Override
public void rotateLog(String logChannelName) throws RestException {
buildRotateLog(logChannelName);
String json = httpActionSync();
}
@Override
public void rotateLog(String logChannelName, AriCallback<Void> callback) {
buildRotateLog(logChannelName);
httpActionAsync(callback);
}
/**********************************************************
* Asterisk modules
*
* List Asterisk modules.
*********************************************************/
private void buildListModules() {
reset();
url = "/asterisk/modules";
method = "GET";
}
@Override
public List<Module> listModules() throws RestException {
buildListModules();
String json = httpActionSync();
return deserializeJsonAsAbstractList( json,
new TypeReference<List<Module_impl_ari_1_9_0>>() {} );
}
@Override
public void listModules(AriCallback<List<Module>> callback) {
buildListModules();
httpActionAsync(callback, new TypeReference<List<Module_impl_ari_1_9_0>>() {});
}
/**********************************************************
* Asterisk module
*
* Get Asterisk module information.
*********************************************************/
private void buildGetModule(String moduleName) {
reset();
url = "/asterisk/modules/" + moduleName + "";
method = "GET";
lE.add( HttpResponse.build( 404, "Module could not be found in running modules.") );
lE.add( HttpResponse.build( 409, "Module information could not be retrieved.") );
}
@Override
public Module getModule(String moduleName) throws RestException {
buildGetModule(moduleName);
String json = httpActionSync();
return deserializeJson( json, Module_impl_ari_1_9_0.class );
}
@Override
public void getModule(String moduleName, AriCallback<Module> callback) {
buildGetModule(moduleName);
httpActionAsync(callback, Module_impl_ari_1_9_0.class);
}
/**********************************************************
* Asterisk module
*
* Load an Asterisk module.
*********************************************************/
private void buildLoadModule(String moduleName) {
reset();
url = "/asterisk/modules/" + moduleName + "";
method = "POST";
lE.add( HttpResponse.build( 409, "Module could not be loaded.") );
}
@Override
public void loadModule(String moduleName) throws RestException {
buildLoadModule(moduleName);
String json = httpActionSync();
}
@Override
public void loadModule(String moduleName, AriCallback<Void> callback) {
buildLoadModule(moduleName);
httpActionAsync(callback);
}
/**********************************************************
* Asterisk module
*
* Unload an Asterisk module.
*********************************************************/
private void buildUnloadModule(String moduleName) {
reset();
url = "/asterisk/modules/" + moduleName + "";
method = "DELETE";
lE.add( HttpResponse.build( 404, "Module not found in running modules.") );
lE.add( HttpResponse.build( 409, "Module could not be unloaded.") );
}
@Override
public void unloadModule(String moduleName) throws RestException {
buildUnloadModule(moduleName);
String json = httpActionSync();
}
@Override
public void unloadModule(String moduleName, AriCallback<Void> callback) {
buildUnloadModule(moduleName);
httpActionAsync(callback);
}
/**********************************************************
* Asterisk module
*
* Reload an Asterisk module.
*********************************************************/
private void buildReloadModule(String moduleName) {
reset();
url = "/asterisk/modules/" + moduleName + "";
method = "PUT";
lE.add( HttpResponse.build( 404, "Module not found in running modules.") );
lE.add( HttpResponse.build( 409, "Module could not be reloaded.") );
}
@Override
public void reloadModule(String moduleName) throws RestException {
buildReloadModule(moduleName);
String json = httpActionSync();
}
@Override
public void reloadModule(String moduleName, AriCallback<Void> callback) {
buildReloadModule(moduleName);
httpActionAsync(callback);
}
/**********************************************************
* Global variables
*
* Get the value of a global variable.
*********************************************************/
private void buildGetGlobalVar(String variable) {
reset();
url = "/asterisk/variable";
method = "GET";
lParamQuery.add( HttpParam.build( "variable", variable) );
lE.add( HttpResponse.build( 400, "Missing variable parameter.") );
}
@Override
public Variable getGlobalVar(String variable) throws RestException {
buildGetGlobalVar(variable);
String json = httpActionSync();
return deserializeJson( json, Variable_impl_ari_1_9_0.class );
}
@Override
public void getGlobalVar(String variable, AriCallback<Variable> callback) {
buildGetGlobalVar(variable);
httpActionAsync(callback, Variable_impl_ari_1_9_0.class);
}
/**********************************************************
* Global variables
*
* Set the value of a global variable.
*********************************************************/
private void buildSetGlobalVar(String variable, String value) {
reset();
url = "/asterisk/variable";
method = "POST";
lParamQuery.add( HttpParam.build( "variable", variable) );
lParamQuery.add( HttpParam.build( "value", value) );
lE.add( HttpResponse.build( 400, "Missing variable parameter.") );
}
@Override
public void setGlobalVar(String variable, String value) throws RestException {
buildSetGlobalVar(variable, value);
String json = httpActionSync();
}
@Override
public void setGlobalVar(String variable, String value, AriCallback<Void> callback) {
buildSetGlobalVar(variable, value);
httpActionAsync(callback);
}
/** No missing signatures from interface */
};
| [
"mbahhalim@mbahhalim-Lenovo-G40-45"
] | mbahhalim@mbahhalim-Lenovo-G40-45 |
338ba2a43fe3fdb4afeaa5b809391ce0b401fd8c | d9e78246af5911628bd85fe705f8b9ea28a12408 | /src/main/java/com/note/old/itcast_framework/beanfactory/cfg/PropertyConfig.java | d7dc7b182abcf9a93272f4629b971ef5d4ec431f | [] | no_license | thinkal01/note02 | c2775d9c72f8f65a2bf771d5ec8606a4628e1bca | 33583112b1f52a3f49d61931a4f2f3189690dd61 | refs/heads/master | 2022-12-22T11:01:51.290414 | 2020-03-16T11:25:06 | 2020-03-16T11:25:06 | 164,791,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | java | package com.note.old.itcast_framework.beanfactory.cfg;
public class PropertyConfig {
private String name;
private String value;
private String ref;
@Override
public String toString() {
return "PropertyConfig [name=" + name + ", value=" + value + ", ref="
+ ref + "]";
}
public PropertyConfig(String name, String value, String ref) {
super();
this.name = name;
this.value = value;
this.ref = ref;
}
public PropertyConfig() {
super();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getRef() {
return ref;
}
public void setRef(String ref) {
this.ref = ref;
}
}
| [
"875535828@qq.com"
] | 875535828@qq.com |
a94fe36b551247d9e7efd271e6d3e1d8c18d57f1 | 7381f06cc7d0c185f1a86b15761bab91a6091fc8 | /src/main/java/me/s1mple133/controller/PasswordController.java | 00c9da288c11a29b6e7d4c3af728da4bef9ef704 | [
"Apache-2.0"
] | permissive | naichinger/PMan | 72c0560409bd85434e0c764ca167ca93f25dab0b | 726afc250d967c4b7e1442c034f2a553331e729f | refs/heads/main | 2023-07-04T12:48:09.820858 | 2021-07-01T14:34:36 | 2021-07-01T14:34:36 | 395,336,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,593 | java | package me.s1mple133.controller;
import me.s1mple133.database.Database;
import me.s1mple133.model.PasswordOverview;
import me.s1mple133.model.User;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class PasswordController {
private static PasswordController instance;
private PasswordController() {
}
public static PasswordController getInstance() {
if (instance == null)
instance = new PasswordController();
return instance;
}
/**
* Returns user overview
*
* @param user
* @return
*/
public List<PasswordOverview> getUserOverview(User user) {
List<PasswordOverview> result = new ArrayList<>();
try (Connection conn = Database.getInstance().getConnection();
PreparedStatement prst = conn.prepareStatement("SELECT P_ID, P_USER, P_APPLICATION FROM P_Passwords WHERE P_USER_ID = ?")) {
prst.setString(1, user.getId().toString());
ResultSet rs = prst.executeQuery();
while (rs.next()) {
result.add(new PasswordOverview(
rs.getString("P_USER"),
rs.getString("P_APPLICATION"),
rs.getString("P_ID")
));
}
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return result;
}
public String getPasswordForUser() {
return null;
}
}
| [
"pavelescu_darius@yahoo.com"
] | pavelescu_darius@yahoo.com |
afd1ad87718edddfbce12e28613410ade5db301d | d7ddbb7424d179ad17c6f1aaef83966caea175f5 | /chatdemo/src/main/java/com/example/day01/chatdemo/AAAActivity.java | 1cdaea7b4c65accd1d797aa2a584fe390000e1dd | [] | no_license | ChongChongZ/ChatDemo | 98e35d06b8c8c6ca55f9ba0b6fe97bf6db353a80 | f38468eb212b693548fea46f01151e5a96b0d028 | refs/heads/master | 2016-08-13T02:10:57.321345 | 2016-04-05T12:41:45 | 2016-04-05T12:41:45 | 55,506,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,782 | java | package com.example.day01.chatdemo;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
public class AAAActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_aaa);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_aaa, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"308632747@qq.com"
] | 308632747@qq.com |
44153acd049d05bd7b11e78c8f318933da94fa36 | b07e059862bee387e62af1d08a229649a022277e | /src/main/java/com/niulipeng/controller/base/FyPublicBoxController.java | d79b951367652a73fbf12f69e84ed906a4b17356 | [] | no_license | nlp0520/service_plateform | 5b04e774a0edba4559bbeb517ea0068dcbe4c35d | 1c0731bbbfdbb6275a476cbb9a83e030e3e00a7a | refs/heads/master | 2023-07-08T04:56:29.575374 | 2021-08-17T09:22:32 | 2021-08-17T09:22:32 | 397,186,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package com.niulipeng.controller.base;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
/**
* <p>
* 公表信息 前端控制器
* </p>
*
* @author lian
* @since 2021-07-29
*/
@Controller
@RequestMapping("/fyPublicBox")
public class FyPublicBoxController {
}
| [
"784115501@qq.com"
] | 784115501@qq.com |
70450c410df8cb0728b290b5208c51f5d3a42fc5 | 758b2ace217717fbaacc18a261fa4b25c3c7cf59 | /Controller/src/main/java/com/pet/controller/MyController.java | f90a92ec355efd9d490a6d3188ddad72c29e1216 | [] | no_license | taylormars/pet | 67ec6d644ee0d6ee13cdad9acbb8217e73424e27 | 926f0987915832676e1d8fd92a8cdbc60f785569 | refs/heads/master | 2021-08-28T05:06:35.331710 | 2017-12-11T08:39:56 | 2017-12-11T08:39:56 | 113,833,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package com.pet.controller;
import com.pet.interfaces.IService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
/**
* Created by liyut on 2017-12-11.
*/
@Controller
public class MyController {
@Resource
private IService iService;
@RequestMapping("/test.do")
public String gettest(){
System.out.printf("我来了");
String hello=iService.hello();
System.out.printf(hello);
return "welcome";
}
}
| [
"liyutong@zhongzairong.cn"
] | liyutong@zhongzairong.cn |
a57b186b1385ae4d4727508ecaedee0046372b8d | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/orientechnologies--orientdb/49a91931a74e848e49cfd09f1895a76917b25392/before/OrientJdbcResultSet.java | d131da366ec7ff30a223492f45d461e81e02e085 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,794 | java | /**
* Copyright 2010-2016 OrientDB LTD (http://orientdb.com)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* <p>
* For more information: http://orientdb.com
*/
package com.orientechnologies.orient.jdbc;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.db.record.ORecordLazyList;
import com.orientechnologies.orient.core.db.record.ORecordLazyMultiValue;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.impl.OBlob;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.parser.OSelectStatement;
import com.orientechnologies.orient.core.sql.parser.OrientSql;
import com.orientechnologies.orient.core.sql.parser.ParseException;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.*;
import java.sql.Date;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Roberto Franchini (CELI srl - franchin--at--celi.it)
* @author Salvatore Piccione (TXT e-solutions SpA - salvo.picci--at--gmail.com)
*/
public class OrientJdbcResultSet implements ResultSet {
private final List<String> fieldNames;
private final OrientJdbcResultSetMetaData resultSetMetaData;
private List<ODocument> records = null;
private OrientJdbcStatement statement;
private int cursor = -1;
private int rowCount = 0;
private ODocument document;
private int type;
private int concurrency;
private int holdability;
protected OrientJdbcResultSet(final OrientJdbcStatement statement,
final List<ODocument> records,
final int type,
final int concurrency,
int holdability) throws SQLException {
this.statement = statement;
this.records = records;
rowCount = records.size();
if (rowCount > 0) {
document = (ODocument) records.get(0).getRecord();
} else {
document = new ODocument();
}
fieldNames = extractFieldNames(statement);
activateDatabaseOnCurrentThread();
if (type == TYPE_FORWARD_ONLY || type == TYPE_SCROLL_INSENSITIVE || type == TYPE_SCROLL_SENSITIVE)
this.type = type;
else
throw new SQLException("Bad ResultSet type: " + type + " instead of one of the following values: " + TYPE_FORWARD_ONLY + ", "
+ TYPE_SCROLL_INSENSITIVE + " or" + TYPE_SCROLL_SENSITIVE);
if (concurrency == CONCUR_READ_ONLY || concurrency == CONCUR_UPDATABLE)
this.concurrency = concurrency;
else
throw new SQLException(
"Bad ResultSet Concurrency type: " + concurrency + " instead of one of the following values: " + CONCUR_READ_ONLY + " or"
+ CONCUR_UPDATABLE);
if (holdability == HOLD_CURSORS_OVER_COMMIT || holdability == CLOSE_CURSORS_AT_COMMIT)
this.holdability = holdability;
else
throw new SQLException(
"Bad ResultSet Holdability type: " + holdability + " instead of one of the following values: " + HOLD_CURSORS_OVER_COMMIT
+ " or" + CLOSE_CURSORS_AT_COMMIT);
resultSetMetaData = new OrientJdbcResultSetMetaData(this);
}
private List<String> extractFieldNames(OrientJdbcStatement statement) {
List<String> fields = new ArrayList<>();
if (statement.sql != null && !statement.sql.isEmpty()) {
try {
OrientSql osql = new OrientSql(new ByteArrayInputStream(statement.sql.getBytes()));
final OSelectStatement select = osql.SelectStatement();
if (select.getProjection() != null) {
fields.addAll(select.getProjection()
.getItems()
.stream()
.filter(i -> !i.isAggregate())
.filter(i -> !i.isAll())
.map(i -> i.getProjectionAliasAsString())
.collect(Collectors.toList()));
}
if (fields.size() == 1 && fields.contains("*")) {
fields.clear();
}
} catch (ParseException e) {
//NOOP
}
}
if (fields.isEmpty()) {
fields.addAll(Arrays.asList(document.fieldNames()));
}
return fields;
}
private void activateDatabaseOnCurrentThread() {
statement.database.activateOnCurrentThread();
}
public void close() throws SQLException {
cursor = 0;
rowCount = 0;
records = null;
}
public boolean first() throws SQLException {
return absolute(0);
}
public boolean last() throws SQLException {
return absolute(rowCount - 1);
}
public boolean next() throws SQLException {
return absolute(++cursor);
}
public boolean previous() throws SQLException {
return absolute(++cursor);
}
public void afterLast() throws SQLException {
// OUT OF LAST ITEM
cursor = rowCount;
}
public void beforeFirst() throws SQLException {
// OUT OF FIRST ITEM
cursor = -1;
}
public boolean relative(int iRows) throws SQLException {
return absolute(cursor + iRows);
}
public boolean absolute(int iRowNumber) throws SQLException {
if (iRowNumber > rowCount - 1) {
// OUT OF LAST ITEM
cursor = rowCount;
return false;
} else if (iRowNumber < 0) {
// OUT OF FIRST ITEM
cursor = -1;
return false;
}
cursor = iRowNumber;
document = (ODocument) records.get(cursor).getRecord();
// fieldNames = document.fieldNames();
// System.out.println("fieldNames:: " + String.join(",", Arrays.asList(fieldNames)));
return true;
}
public boolean isAfterLast() throws SQLException {
return cursor >= rowCount - 1;
}
public boolean isBeforeFirst() throws SQLException {
return cursor < 0;
}
public boolean isClosed() throws SQLException {
return records == null;
}
public boolean isFirst() throws SQLException {
return cursor == 0;
}
public boolean isLast() throws SQLException {
return cursor == rowCount - 1;
}
public Statement getStatement() throws SQLException {
return statement;
}
public ResultSetMetaData getMetaData() throws SQLException {
return resultSetMetaData;
}
public void deleteRow() throws SQLException {
document.delete();
}
public int findColumn(String columnLabel) throws SQLException {
int column = 0;
int i = 0;
while (i < (fieldNames.size() - 1) && column == 0) {
if (fieldNames.get(i).equals(columnLabel))
column = i + 1;
else
i++;
}
if (column == 0)
throw new SQLException("The column '" + columnLabel + "' does not exists (Result Set element: " + rowCount + ")");
return column;
}
private int getFieldIndex(final int columnIndex) throws SQLException {
if (columnIndex < 1)
throw new SQLException("The column index cannot be less than 1");
return columnIndex - 1;
}
public Array getArray(int columnIndex) throws SQLException {
return getArray(fieldNames.get(getFieldIndex(columnIndex)));
}
public Array getArray(String columnLabel) throws SQLException {
OType columnType = document.fieldType(columnLabel);
assert columnType.isEmbedded() && columnType.isMultiValue();
System.out.println("columnType.name() = " + columnType.getDefaultJavaType());
OType.EMBEDDEDLIST.getDefaultJavaType();
Array array = new OrientJdbcArray(document.field(columnLabel));
return array;
}
public InputStream getAsciiStream(int columnIndex) throws SQLException {
return null;
}
public InputStream getAsciiStream(final String columnLabel) throws SQLException {
return null;
}
public BigDecimal getBigDecimal(final int columnIndex) throws SQLException {
return getBigDecimal(fieldNames.get(getFieldIndex(columnIndex)));
}
public BigDecimal getBigDecimal(final String columnLabel) throws SQLException {
try {
return (BigDecimal) document.field(columnLabel, OType.DECIMAL);
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the double value at column '" + columnLabel + "'", e);
}
}
public BigDecimal getBigDecimal(final int columnIndex, final int scale) throws SQLException {
return getBigDecimal(fieldNames.get(getFieldIndex(columnIndex)), scale);
}
public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
try {
return ((BigDecimal) document.field(columnLabel, OType.DECIMAL)).setScale(scale);
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the double value at column '" + columnLabel + "'", e);
}
}
public InputStream getBinaryStream(int columnIndex) throws SQLException {
return getBinaryStream(fieldNames.get(getFieldIndex(columnIndex)));
}
public InputStream getBinaryStream(String columnLabel) throws SQLException {
try {
Blob blob = getBlob(columnLabel);
return blob != null ? blob.getBinaryStream() : null;
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the binary stream at column '" + columnLabel + "'", e);
}
}
public Blob getBlob(int columnIndex) throws SQLException {
return getBlob(fieldNames.get(getFieldIndex(columnIndex)));
}
public Blob getBlob(String columnLabel) throws SQLException {
try {
Object value = document.field(columnLabel);
if (value instanceof OBlob) {
return new OrientBlob((OBlob) value);
} else if (value instanceof ORecordLazyList) {
ORecordLazyList list = (ORecordLazyList) value;
// check if all the list items are instances of ORecordBytes
ListIterator<OIdentifiable> iterator = list.listIterator();
List<OBlob> binaryRecordList = new ArrayList<OBlob>(list.size());
while (iterator.hasNext()) {
OIdentifiable listElement = iterator.next();
OBlob ob = document.getDatabase().load(listElement.getIdentity());
binaryRecordList.add(ob);
}
return new OrientBlob(binaryRecordList);
}
return null;
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the BLOB at column '" + columnLabel + "'", e);
}
}
public boolean getBoolean(int columnIndex) throws SQLException {
return getBoolean(fieldNames.get(getFieldIndex(columnIndex)));
}
@SuppressWarnings("boxing")
public boolean getBoolean(String columnLabel) throws SQLException {
try {
return (Boolean) document.field(columnLabel, OType.BOOLEAN);
} catch (Exception e) {
throw new SQLException(
"An error occurred during the retrieval of the boolean value at column '" + columnLabel + "' ---> " + document.toJSON(),
e);
}
}
@SuppressWarnings("boxing")
public byte getByte(int columnIndex) throws SQLException {
return getByte(fieldNames.get(getFieldIndex(columnIndex)));
}
public byte getByte(String columnLabel) throws SQLException {
try {
return (Byte) document.field(columnLabel, OType.BYTE);
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the byte value at column '" + columnLabel + "'", e);
}
}
public byte[] getBytes(int columnIndex) throws SQLException {
return getBytes(fieldNames.get(getFieldIndex(columnIndex)));
}
public byte[] getBytes(String columnLabel) throws SQLException {
try {
Object value = document.field(columnLabel);
if (value == null)
return null;
else {
if (value instanceof OBlob)
return ((OBlob) value).toStream();
return document.field(columnLabel, OType.BINARY);
}
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the bytes value at column '" + columnLabel + "'", e);
}
}
public Reader getCharacterStream(int columnIndex) throws SQLException {
return null;
}
public Reader getCharacterStream(String columnLabel) throws SQLException {
return null;
}
public Clob getClob(int columnIndex) throws SQLException {
return null;
}
public Clob getClob(String columnLabel) throws SQLException {
return null;
}
public int getConcurrency() throws SQLException {
return concurrency;
}
public String getCursorName() throws SQLException {
return null;
}
public Date getDate(int columnIndex) throws SQLException {
return getDate(fieldNames.get(getFieldIndex(columnIndex)));
}
public Date getDate(final String columnLabel) throws SQLException {
try {
activateDatabaseOnCurrentThread();
java.util.Date date = document.field(columnLabel, OType.DATETIME);
return date != null ? new Date(date.getTime()) : null;
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the date value at column '" + columnLabel + "'", e);
}
}
public Date getDate(final int columnIndex, final Calendar cal) throws SQLException {
return getDate(fieldNames.get(getFieldIndex(columnIndex)), cal);
}
public Date getDate(String columnLabel, Calendar cal) throws SQLException {
if (cal == null)
throw new SQLException();
try {
activateDatabaseOnCurrentThread();
java.util.Date date = document.field(columnLabel, OType.DATETIME);
if (date == null)
return null;
cal.setTimeInMillis(date.getTime());
return new Date(cal.getTimeInMillis());
} catch (Exception e) {
throw new SQLException(
"An error occurred during the retrieval of the date value (calendar) " + "at column '" + columnLabel + "'", e);
}
}
public double getDouble(final int columnIndex) throws SQLException {
int fieldIndex = getFieldIndex(columnIndex);
return getDouble(fieldNames.get(fieldIndex));
}
public double getDouble(final String columnLabel) throws SQLException {
try {
final Double r = document.field(columnLabel, OType.DOUBLE);
return r != null ? r : 0;
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the double value at column '" + columnLabel + "'", e);
}
}
public int getFetchDirection() throws SQLException {
return 0;
}
public void setFetchDirection(int direction) throws SQLException {
}
public int getFetchSize() throws SQLException {
return rowCount;
}
public void setFetchSize(int rows) throws SQLException {
}
public float getFloat(int columnIndex) throws SQLException {
return getFloat(fieldNames.get(getFieldIndex(columnIndex)));
}
public float getFloat(String columnLabel) throws SQLException {
try {
final Float r = document.field(columnLabel, OType.FLOAT);
return r != null ? r : 0;
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the float value at column '" + columnLabel + "'", e);
}
}
public int getHoldability() throws SQLException {
return holdability;
}
public int getInt(int columnIndex) throws SQLException {
return getInt(fieldNames.get(getFieldIndex(columnIndex)));
}
public int getInt(String columnLabel) throws SQLException {
if ("@version".equals(columnLabel))
return document.getVersion();
try {
final Integer r = document.field(columnLabel, OType.INTEGER);
return r != null ? r : 0;
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the integer value at column '" + columnLabel + "'", e);
}
}
public long getLong(int columnIndex) throws SQLException {
return getLong(fieldNames.get(getFieldIndex(columnIndex)));
}
public long getLong(String columnLabel) throws SQLException {
try {
final Long r = document.field(columnLabel, OType.LONG);
return r != null ? r : 0;
} catch (Exception e) {
e.printStackTrace();
throw new SQLException("An error occurred during the retrieval of the long value at column '" + columnLabel + "'", e);
}
}
public Reader getNCharacterStream(int columnIndex) throws SQLException {
return null;
}
public Reader getNCharacterStream(String columnLabel) throws SQLException {
return null;
}
public NClob getNClob(int columnIndex) throws SQLException {
return null;
}
public NClob getNClob(String columnLabel) throws SQLException {
return null;
}
public String getNString(int columnIndex) throws SQLException {
return getNString(fieldNames.get(getFieldIndex(columnIndex)));
}
public String getNString(String columnLabel) throws SQLException {
try {
return document.field(columnLabel, OType.STRING);
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the string value at column '" + columnLabel + "'", e);
}
}
public Object getObject(int columnIndex) throws SQLException {
return getObject(fieldNames.get(getFieldIndex(columnIndex)));
}
public Object getObject(String columnLabel) throws SQLException {
if ("@rid".equals(columnLabel) || "rid".equals(columnLabel)) {
return ((ODocument) document.field("rid")).getIdentity().toString();
}
if ("@class".equals(columnLabel) || "class".equals(columnLabel))
return ((ODocument) document.field("rid")).getClassName();
try {
Object value = document.field(columnLabel);
if (value == null) {
return null;
} else {
// resolve the links so that the returned set contains instances
// of ODocument
if (value instanceof ORecordLazyMultiValue) {
ORecordLazyMultiValue lazyRecord = (ORecordLazyMultiValue) value;
lazyRecord.convertLinks2Records();
return lazyRecord;
} else {
return value;
}
}
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the Java Object at column '" + columnLabel + "'", e);
}
}
public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
throw new SQLFeatureNotSupportedException("This method has not been implemented.");
}
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
throw new SQLFeatureNotSupportedException("This method has not been implemented.");
}
public Ref getRef(int columnIndex) throws SQLException {
return null;
}
public Ref getRef(String columnLabel) throws SQLException {
return null;
}
public int getRow() throws SQLException {
return cursor;
}
public RowId getRowId(final int columnIndex) throws SQLException {
try {
return new OrientRowId(document.getIdentity());
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the rowid for record '" + document + "'", e);
}
}
public RowId getRowId(String columnLabel) throws SQLException {
return getRowId(0);
}
public SQLXML getSQLXML(int columnIndex) throws SQLException {
return null;
}
public SQLXML getSQLXML(String columnLabel) throws SQLException {
return null;
}
public short getShort(int columnIndex) throws SQLException {
return getShort(fieldNames.get(getFieldIndex(columnIndex)));
}
@SuppressWarnings("boxing")
public short getShort(String columnLabel) throws SQLException {
try {
final Short r = document.field(columnLabel, OType.SHORT);
return r != null ? r : 0;
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the short value at column '" + columnLabel + "'", e);
}
}
public String getString(int columnIndex) throws SQLException {
return getString(fieldNames.get(getFieldIndex(columnIndex)));
}
public String getString(String columnLabel) throws SQLException {
if ("@rid".equals(columnLabel) || "rid".equals(columnLabel)) {
return ((ODocument) document.field("rid")).getIdentity().toString();
}
if ("@class".equals(columnLabel) || "class".equals(columnLabel)) {
if (document.getClassName() != null)
return document.getClassName();
return ((ODocument) document.field("rid")).getClassName();
}
try {
return document.field(columnLabel, OType.STRING);
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the string value at column '" + columnLabel + "'", e);
}
}
public Time getTime(int columnIndex) throws SQLException {
return getTime(fieldNames.get(getFieldIndex(columnIndex)));
}
public Time getTime(String columnLabel) throws SQLException {
try {
java.util.Date date = document.field(columnLabel, OType.DATETIME);
return getTime(date);
} catch (Exception e) {
throw new SQLException("An error occurred during the retrieval of the time value at column '" + columnLabel + "'", e);
}
}
public Time getTime(int columnIndex, Calendar cal) throws SQLException {
Date date = getDate(columnIndex, cal);
return getTime(date);
}
private Time getTime(java.util.Date date) {
return date != null ? new Time(date.getTime()) : null;
}
public Time getTime(String columnLabel, Calendar cal) throws SQLException {
Date date = getDate(columnLabel, cal);
return getTime(date);
}
public Timestamp getTimestamp(int columnIndex) throws SQLException {
Date date = getDate(columnIndex);
return getTimestamp(date);
}
private Timestamp getTimestamp(Date date) {
return date != null ? new Timestamp(date.getTime()) : null;
}
public Timestamp getTimestamp(String columnLabel) throws SQLException {
Date date = getDate(columnLabel);
return getTimestamp(date);
}
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
Date date = getDate(columnIndex, cal);
return getTimestamp(date);
}
public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
Date date = getDate(columnLabel, cal);
return getTimestamp(date);
}
public int getType() throws SQLException {
return type;
}
public URL getURL(int columnIndex) throws SQLException {
return null;
}
public URL getURL(String columnLabel) throws SQLException {
return null;
}
public InputStream getUnicodeStream(int columnIndex) throws SQLException {
return null;
}
public InputStream getUnicodeStream(String columnLabel) throws SQLException {
return null;
}
public SQLWarning getWarnings() throws SQLException {
return null;
}
public void insertRow() throws SQLException {
}
public void moveToCurrentRow() throws SQLException {
}
public void moveToInsertRow() throws SQLException {
}
public void refreshRow() throws SQLException {
}
public boolean rowDeleted() throws SQLException {
return false;
}
public boolean rowInserted() throws SQLException {
return false;
}
public boolean rowUpdated() throws SQLException {
return false;
}
public void updateArray(int columnIndex, Array x) throws SQLException {
}
public void updateArray(String columnLabel, Array x) throws SQLException {
}
public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
}
public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
}
public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
}
public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
}
public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
}
public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
}
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
}
public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
}
public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
}
public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
}
public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
}
public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
}
public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
}
public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
}
public void updateBlob(int columnIndex, Blob x) throws SQLException {
}
public void updateBlob(String columnLabel, Blob x) throws SQLException {
}
public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
}
public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
}
public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
}
public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
}
public void updateBoolean(int columnIndex, boolean x) throws SQLException {
}
public void updateBoolean(String columnLabel, boolean x) throws SQLException {
}
public void updateByte(int columnIndex, byte x) throws SQLException {
}
public void updateByte(String columnLabel, byte x) throws SQLException {
}
public void updateBytes(int columnIndex, byte[] x) throws SQLException {
}
public void updateBytes(String columnLabel, byte[] x) throws SQLException {
}
public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
}
public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
}
public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
}
public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException {
}
public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
}
public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
}
public void updateClob(int columnIndex, Clob x) throws SQLException {
}
public void updateClob(String columnLabel, Clob x) throws SQLException {
}
public void updateClob(int columnIndex, Reader reader) throws SQLException {
}
public void updateClob(String columnLabel, Reader reader) throws SQLException {
}
public void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
}
public void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
}
public void updateDate(int columnIndex, Date x) throws SQLException {
}
public void updateDate(String columnLabel, Date x) throws SQLException {
}
public void updateDouble(int columnIndex, double x) throws SQLException {
}
public void updateDouble(String columnLabel, double x) throws SQLException {
}
public void updateFloat(int columnIndex, float x) throws SQLException {
}
public void updateFloat(String columnLabel, float x) throws SQLException {
}
public void updateInt(int columnIndex, int x) throws SQLException {
}
public void updateInt(String columnLabel, int x) throws SQLException {
}
public void updateLong(int columnIndex, long x) throws SQLException {
}
public void updateLong(String columnLabel, long x) throws SQLException {
}
public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
}
public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
}
public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
}
public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
}
public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
}
public void updateNClob(String columnLabel, NClob nClob) throws SQLException {
}
public void updateNClob(int columnIndex, Reader reader) throws SQLException {
}
public void updateNClob(String columnLabel, Reader reader) throws SQLException {
}
public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
}
public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
}
public void updateNString(int columnIndex, String nString) throws SQLException {
}
public void updateNString(String columnLabel, String nString) throws SQLException {
}
public void updateNull(int columnIndex) throws SQLException {
}
public void updateNull(String columnLabel) throws SQLException {
}
public void updateObject(int columnIndex, Object x) throws SQLException {
}
public void updateObject(String columnLabel, Object x) throws SQLException {
}
public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException {
}
public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException {
}
public void updateRef(int columnIndex, Ref x) throws SQLException {
}
public void updateRef(String columnLabel, Ref x) throws SQLException {
}
public void updateRow() throws SQLException {
}
public void updateRowId(int columnIndex, RowId x) throws SQLException {
}
public void updateRowId(String columnLabel, RowId x) throws SQLException {
}
public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
}
public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
}
public void updateShort(int columnIndex, short x) throws SQLException {
}
public void updateShort(String columnLabel, short x) throws SQLException {
}
public void updateString(int columnIndex, String x) throws SQLException {
}
public void updateString(String columnLabel, String x) throws SQLException {
}
public void updateTime(int columnIndex, Time x) throws SQLException {
}
public void updateTime(String columnLabel, Time x) throws SQLException {
}
public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
}
public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
}
public boolean wasNull() throws SQLException {
return false;
}
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return ODocument.class.isAssignableFrom(iface);
}
public <T> T unwrap(Class<T> iface) throws SQLException {
try {
return iface.cast(document);
} catch (ClassCastException e) {
throw new SQLException(e);
}
}
public void cancelRowUpdates() throws SQLException {
}
public void clearWarnings() throws SQLException {
}
public <T> T getObject(int arg0, Class<T> arg1) throws SQLException {
return null;
}
public <T> T getObject(String arg0, Class<T> arg1) throws SQLException {
return null;
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
4453ff77e4453a921690833f3c2cc6bcd175803e | 6765708ac86ea2782ec2e2ca285e1d54bb47395c | /src/main/java/com/example/blog/dao/AlbumDetailMapper.java | 808f87400078b53cb9ce968debb37d75f5ab7516 | [] | no_license | HelloWorld-zhang/blog | d0f1b905ac46dea2e507ca1839e1b49ae0ef7c20 | 696aa356d58b448918e8a8cd91e2218e2079906e | refs/heads/master | 2023-01-18T23:06:45.908313 | 2020-11-22T13:24:18 | 2020-11-22T13:24:18 | 315,043,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.example.blog.dao;
import com.example.blog.entity.AlbumDetail;
public interface AlbumDetailMapper {
int deleteByPrimaryKey(Integer id);
int insert(AlbumDetail record);
int insertSelective(AlbumDetail record);
AlbumDetail selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AlbumDetail record);
int updateByPrimaryKey(AlbumDetail record);
}
| [
"2523637863@qq.com"
] | 2523637863@qq.com |
fdb27031b12ffcec78a0acc08ea9a9d1316346a7 | 85bc05f8d5f436c9a54e67b81983c9c2d11e22da | /app/src/main/java/forum/student/thebrooker/RequestSellBook.java | 8f74e5e61f115e85e7dabee1a39a334eb46acfd4 | [] | no_license | calvin138/The-Brooker | 9c252a0ef6c997cc174e66d26e01c4bfa1712390 | 40360c58e64ebe29988c79236a51660dbd0ccb4c | refs/heads/master | 2020-04-16T19:31:28.573364 | 2019-02-18T14:31:24 | 2019-02-18T14:31:24 | 165,863,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,743 | java | package forum.student.thebrooker;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.MultiAutoCompleteTextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
public class RequestSellBook extends AppCompatActivity {
private EditText Booktitle;
private EditText date;
private EditText BookAuthor;
private EditText BookGenre;
private Button RequestButton;
private String current_user_id;
private String saveCurrentDate, saveCurrentTime;
private EditText price1;
private MultiAutoCompleteTextView des;
private ImageButton addcover;
private FirebaseDatabase firebaseDatabase;
private FirebaseAuth firebaseAuth;
private static final int Gallery_Pick = 1;
private Uri ImageUri;
String title, release, author, genre, type, postdate, price, descriptions, uid, image, downloadurl, bookid;
private ProgressDialog loadingbar;
private StorageReference bookref;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_request_sell_book);
setupUiViews();
bookref = FirebaseStorage.getInstance().getReference();
firebaseAuth = FirebaseAuth.getInstance();
firebaseDatabase = FirebaseDatabase.getInstance();
current_user_id = firebaseAuth.getCurrentUser().getUid();
RequestButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
validatePostInfo();
}
});
addcover.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openGallery();
}
});
}
public void openGallery(){
Intent galleryIntent = new Intent();
galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
galleryIntent.setType("image/*");
startActivityForResult(galleryIntent, Gallery_Pick);
}
@Override
protected void onActivityResult(int requestcode, int resultcode, Intent data){
super.onActivityResult(requestcode, resultcode, data);
if(requestcode==Gallery_Pick && resultcode==RESULT_OK && data!=null){
ImageUri = data.getData();
addcover.setImageURI(ImageUri);
}
}
public void validatePostInfo(){
if(ImageUri!=null){
loadingbar.setTitle("Add new Post");
loadingbar.setMessage("Please wait for a moment");
loadingbar.show();
loadingbar.setCanceledOnTouchOutside(true);
sendBookDataRequestWimage();
}
else
{
loadingbar.setTitle("Add new Post");
loadingbar.setMessage("Please wait for a moment");
loadingbar.show();
loadingbar.setCanceledOnTouchOutside(true);
sendBookDataRequestWOimage();
}
}
public void sendBookDataRequestWimage(){
Calendar calFordDate = Calendar.getInstance();
SimpleDateFormat currentDate = new SimpleDateFormat("dd-MMMM-yyyy");
saveCurrentDate = currentDate.format(calFordDate.getTime());
Calendar calFordTime = Calendar.getInstance();
SimpleDateFormat currentTime = new SimpleDateFormat("HH:mm:ss");
saveCurrentTime = currentTime.format(calFordDate.getTime());
String postrandomname = saveCurrentDate + saveCurrentTime;
final StorageReference filepath = bookref.child("Book Covers").child(ImageUri.getLastPathSegment() + postrandomname + ".jpg");
filepath.putFile(ImageUri).addOnCompleteListener(new OnCompleteListener<UploadTask.TaskSnapshot>() {
@Override
public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
if (task.isSuccessful()) {
downloadurl = task.getResult().getDownloadUrl().toString();
Toast.makeText(RequestSellBook.this, "Image uploaded successfully",Toast.LENGTH_SHORT).show();
if(Validate()){
Calendar calFordDate = Calendar.getInstance();
SimpleDateFormat currentDate = new SimpleDateFormat("dd-MMMM-yyyy");
saveCurrentDate = currentDate.format(calFordDate.getTime());
Calendar calFordTime = Calendar.getInstance();
SimpleDateFormat currentTime = new SimpleDateFormat("HH:mm:ss");
saveCurrentTime = currentTime.format(calFordTime.getTime());
title = Booktitle.getText().toString();
author = BookAuthor.getText().toString();
genre = BookGenre.getText().toString();
release = date.getText().toString();
price = price1.getText().toString();
descriptions = des.getText().toString();
postdate = saveCurrentDate.toString();
image = downloadurl;
type = "Want to Sell";
uid = current_user_id;
HashMap hashMap = new HashMap();
hashMap.put("Title", title);
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
DatabaseReference myRef = firebaseDatabase.getReference().child("Books").child(firebaseAuth.getCurrentUser().getUid() + saveCurrentDate + saveCurrentTime);
DatabaseReference myBook = firebaseDatabase.getReference().child("Users").child(firebaseAuth.getCurrentUser().getUid()).child("Books").child(firebaseAuth.getCurrentUser().getUid() + saveCurrentDate + saveCurrentTime);
saveBookSeller ss = new saveBookSeller(title, author, release, genre, type, postdate, price, descriptions, uid, image);
myBook.setValue(ss);
myRef.setValue(ss).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Toast.makeText(RequestSellBook.this, "Successfully Posted", Toast.LENGTH_SHORT).show();
startActivity(new Intent(RequestSellBook.this, HomeActivity.class));
}
});
}
}
else
{
String message = task.getException().getMessage();
Toast.makeText(RequestSellBook.this,"Error" + message, Toast.LENGTH_SHORT).show();
}
loadingbar.dismiss();
}
});
}
public void sendBookDataRequestWOimage(){
if(Validate()) {
Calendar calFordDate = Calendar.getInstance();
SimpleDateFormat currentDate = new SimpleDateFormat("dd-MMMM-yyyy");
saveCurrentDate = currentDate.format(calFordDate.getTime());
Calendar calFordTime = Calendar.getInstance();
SimpleDateFormat currentTime = new SimpleDateFormat("HH:mm:ss");
saveCurrentTime = currentTime.format(calFordTime.getTime());
title = Booktitle.getText().toString();
author = BookAuthor.getText().toString();
genre = BookGenre.getText().toString();
release = date.getText().toString();
price = price1.getText().toString();
descriptions = des.getText().toString();
postdate = saveCurrentDate.toString();
image = downloadurl;
type = "Want to Sell";
uid = current_user_id;
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
DatabaseReference myRef = firebaseDatabase.getReference().child("Books").child(firebaseAuth.getCurrentUser().getUid() + saveCurrentDate + saveCurrentTime);
DatabaseReference myBook = firebaseDatabase.getReference().child("Users").child(firebaseAuth.getCurrentUser().getUid()).child("Books").child(firebaseAuth.getCurrentUser().getUid() + saveCurrentDate + saveCurrentTime);
saveBookSeller ss = new saveBookSeller(title, author, release, genre, type, postdate, price, descriptions, uid, image);
myBook.setValue(ss);
myRef.setValue(ss).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Toast.makeText(RequestSellBook.this, "Successfully Posted", Toast.LENGTH_SHORT).show();
startActivity(new Intent(RequestSellBook.this, HomeActivity.class));
}
});
}
loadingbar.dismiss();
}
public Boolean Validate(){
Boolean result = false;
if(!Booktitle.getText().toString().isEmpty() && !BookAuthor.getText().toString().isEmpty() && !BookGenre.getText().toString().isEmpty() && !date.getText().toString().isEmpty() ){
return true;
}
else{
Toast.makeText(RequestSellBook.this,"Please enter all the book detail to continue", Toast.LENGTH_SHORT).show();
}
return result;
}
public void setupUiViews(){
Booktitle = (EditText)findViewById(R.id.et_BookTitleRequest);
BookAuthor = (EditText)findViewById(R.id.et_BookAuthorRequest);
BookGenre = (EditText)findViewById(R.id.et_BookGenreRequest);
date = (EditText) findViewById(R.id.et_DateOfReleaseRequest);
RequestButton = (Button)findViewById(R.id.btn_requestBook);
price1 = (EditText)findViewById(R.id.Price);
des = (MultiAutoCompleteTextView)findViewById(R.id.mtv_descriptionss);
addcover = (ImageButton)findViewById(R.id.addcovers);
loadingbar = new ProgressDialog(this);
}
}
| [
"calvin_loh138@yahoo.com"
] | calvin_loh138@yahoo.com |
5aa8cf15e2d9b184437a33704e0a016f5b7f27cb | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/JxPath-20/org.apache.commons.jxpath.ri.compiler.CoreOperationRelationalExpression/BBC-F0-opt-60/5/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression_ESTest.java | 61a4076b115395c82fecf3dfe86819a6b68cda91 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 12,943 | java | /*
* This file was automatically generated by EvoSuite
* Thu Oct 14 02:28:28 GMT 2021
*/
package org.apache.commons.jxpath.ri.compiler;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.util.Iterator;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.Pointer;
import org.apache.commons.jxpath.ri.EvalContext;
import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl;
import org.apache.commons.jxpath.ri.QName;
import org.apache.commons.jxpath.ri.axes.DescendantContext;
import org.apache.commons.jxpath.ri.axes.RootContext;
import org.apache.commons.jxpath.ri.axes.UnionContext;
import org.apache.commons.jxpath.ri.compiler.Constant;
import org.apache.commons.jxpath.ri.compiler.CoreFunction;
import org.apache.commons.jxpath.ri.compiler.CoreOperationAdd;
import org.apache.commons.jxpath.ri.compiler.CoreOperationEqual;
import org.apache.commons.jxpath.ri.compiler.CoreOperationGreaterThan;
import org.apache.commons.jxpath.ri.compiler.CoreOperationGreaterThanOrEqual;
import org.apache.commons.jxpath.ri.compiler.CoreOperationLessThan;
import org.apache.commons.jxpath.ri.compiler.CoreOperationLessThanOrEqual;
import org.apache.commons.jxpath.ri.compiler.CoreOperationMod;
import org.apache.commons.jxpath.ri.compiler.CoreOperationMultiply;
import org.apache.commons.jxpath.ri.compiler.CoreOperationNegate;
import org.apache.commons.jxpath.ri.compiler.CoreOperationNotEqual;
import org.apache.commons.jxpath.ri.compiler.CoreOperationSubtract;
import org.apache.commons.jxpath.ri.compiler.Expression;
import org.apache.commons.jxpath.ri.compiler.ExpressionPath;
import org.apache.commons.jxpath.ri.compiler.NodeTypeTest;
import org.apache.commons.jxpath.ri.compiler.Step;
import org.apache.commons.jxpath.ri.compiler.VariableReference;
import org.apache.commons.jxpath.ri.model.NodePointer;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class CoreOperationRelationalExpression_ESTest extends CoreOperationRelationalExpression_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
Expression[] expressionArray0 = new Expression[0];
QName qName0 = new QName("The specified collection element does not exist: ");
VariableReference variableReference0 = new VariableReference(qName0);
CoreOperationGreaterThanOrEqual coreOperationGreaterThanOrEqual0 = new CoreOperationGreaterThanOrEqual(variableReference0, variableReference0);
CoreOperationSubtract coreOperationSubtract0 = new CoreOperationSubtract(coreOperationGreaterThanOrEqual0, variableReference0);
CoreOperationGreaterThan coreOperationGreaterThan0 = new CoreOperationGreaterThan(variableReference0, coreOperationSubtract0);
CoreOperationAdd coreOperationAdd0 = new CoreOperationAdd(expressionArray0);
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = null;
// try {
jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, coreOperationAdd0, (Pointer) null);
// // fail("Expecting exception: NoClassDefFoundError");
// Unstable assertion
// } catch(NoClassDefFoundError e) {
// }
}
@Test(timeout = 4000)
public void test01() throws Throwable {
CoreFunction coreFunction0 = new CoreFunction(24, (Expression[]) null);
CoreOperationNotEqual coreOperationNotEqual0 = new CoreOperationNotEqual(coreFunction0, coreFunction0);
CoreOperationMultiply coreOperationMultiply0 = new CoreOperationMultiply(coreFunction0, coreOperationNotEqual0);
Constant constant0 = new Constant(0);
CoreOperationGreaterThan coreOperationGreaterThan0 = new CoreOperationGreaterThan(coreOperationMultiply0, constant0);
UnionContext unionContext0 = new UnionContext((EvalContext) null, (EvalContext[]) null);
// Undeclared exception!
// try {
coreOperationGreaterThan0.computeValue(unionContext0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Incorrect number of arguments: sum()
// //
// verifyException("org.apache.commons.jxpath.ri.compiler.CoreFunction", e);
// }
}
@Test(timeout = 4000)
public void test02() throws Throwable {
Expression[] expressionArray0 = new Expression[0];
RootContext rootContext0 = new RootContext((JXPathContextReferenceImpl) null, (NodePointer) null);
CoreFunction coreFunction0 = new CoreFunction(1, expressionArray0);
CoreOperationEqual coreOperationEqual0 = new CoreOperationEqual(coreFunction0, coreFunction0);
CoreOperationNegate coreOperationNegate0 = new CoreOperationNegate(coreOperationEqual0);
CoreOperationGreaterThan coreOperationGreaterThan0 = new CoreOperationGreaterThan(coreOperationNegate0, coreFunction0);
// Undeclared exception!
// try {
coreOperationGreaterThan0.computeValue(rootContext0);
// fail("Expecting exception: UnsupportedOperationException");
// } catch(UnsupportedOperationException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.axes.RootContext", e);
// }
}
@Test(timeout = 4000)
public void test03() throws Throwable {
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(2454);
DescendantContext descendantContext0 = new DescendantContext((EvalContext) null, true, nodeTypeTest0);
QName qName0 = new QName("org.apache.commons.jxpath.ri.model.beans.BeanPointer", "a9eh ");
VariableReference variableReference0 = new VariableReference(qName0);
CoreOperationLessThan coreOperationLessThan0 = new CoreOperationLessThan((Expression) null, variableReference0);
// Undeclared exception!
// try {
coreOperationLessThan0.computeValue(descendantContext0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.compiler.CoreOperationRelationalExpression", e);
// }
}
@Test(timeout = 4000)
public void test04() throws Throwable {
Constant constant0 = new Constant("");
Expression[] expressionArray0 = new Expression[1];
expressionArray0[0] = (Expression) constant0;
CoreFunction coreFunction0 = new CoreFunction(3, expressionArray0);
CoreOperationLessThanOrEqual coreOperationLessThanOrEqual0 = new CoreOperationLessThanOrEqual(expressionArray0[0], coreFunction0);
coreOperationLessThanOrEqual0.args = expressionArray0;
// Undeclared exception!
// try {
coreOperationLessThanOrEqual0.computeValue((EvalContext) null);
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 1
// //
// verifyException("org.apache.commons.jxpath.ri.compiler.CoreOperationRelationalExpression", e);
// }
}
@Test(timeout = 4000)
public void test05() throws Throwable {
Constant constant0 = new Constant("");
CoreOperationLessThanOrEqual coreOperationLessThanOrEqual0 = new CoreOperationLessThanOrEqual(constant0, constant0);
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = null;
// try {
jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, "", (Pointer) null);
// // fail("Expecting exception: NoClassDefFoundError");
// Unstable assertion
// } catch(NoClassDefFoundError e) {
// }
}
@Test(timeout = 4000)
public void test06() throws Throwable {
Expression[] expressionArray0 = new Expression[0];
QName qName0 = new QName("java.util.c|ncurrent.atomic.AtomicInteger");
CoreOperationAdd coreOperationAdd0 = new CoreOperationAdd(expressionArray0);
Step[] stepArray0 = new Step[0];
ExpressionPath expressionPath0 = new ExpressionPath(coreOperationAdd0, expressionArray0, stepArray0);
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = null;
// try {
jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, qName0, (Pointer) null);
// // fail("Expecting exception: NoClassDefFoundError");
// Unstable assertion
// } catch(NoClassDefFoundError e) {
// }
}
@Test(timeout = 4000)
public void test07() throws Throwable {
Expression[] expressionArray0 = new Expression[6];
Constant constant0 = new Constant(0);
CoreOperationGreaterThan coreOperationGreaterThan0 = new CoreOperationGreaterThan(constant0, constant0);
expressionArray0[1] = (Expression) coreOperationGreaterThan0;
CoreOperationMultiply coreOperationMultiply0 = new CoreOperationMultiply(expressionArray0[1], coreOperationGreaterThan0);
expressionArray0[2] = (Expression) coreOperationMultiply0;
CoreOperationMod coreOperationMod0 = new CoreOperationMod(expressionArray0[2], expressionArray0[2]);
CoreOperationLessThanOrEqual coreOperationLessThanOrEqual0 = new CoreOperationLessThanOrEqual(expressionArray0[2], coreOperationMod0);
Object object0 = coreOperationLessThanOrEqual0.computeValue((EvalContext) null);
assertEquals(false, object0);
}
@Test(timeout = 4000)
public void test08() throws Throwable {
Expression[] expressionArray0 = new Expression[0];
QName qName0 = new QName("java.util.c|ncurrent.atomic.AtomicInteger");
CoreOperationAdd coreOperationAdd0 = new CoreOperationAdd(expressionArray0);
Step[] stepArray0 = new Step[0];
ExpressionPath expressionPath0 = new ExpressionPath(coreOperationAdd0, expressionArray0, stepArray0);
VariableReference variableReference0 = new VariableReference(qName0);
CoreOperationLessThanOrEqual coreOperationLessThanOrEqual0 = new CoreOperationLessThanOrEqual(coreOperationAdd0, variableReference0);
CoreOperationGreaterThan coreOperationGreaterThan0 = new CoreOperationGreaterThan(expressionPath0, coreOperationLessThanOrEqual0);
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = null;
// try {
jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, (Object) null, (Pointer) null);
// // fail("Expecting exception: NoClassDefFoundError");
// Unstable assertion
// } catch(NoClassDefFoundError e) {
// }
}
@Test(timeout = 4000)
public void test09() throws Throwable {
Constant constant0 = new Constant("");
CoreOperationLessThanOrEqual coreOperationLessThanOrEqual0 = new CoreOperationLessThanOrEqual(constant0, constant0);
Constant constant1 = new Constant(" 0@0QeA");
CoreOperationLessThanOrEqual coreOperationLessThanOrEqual1 = new CoreOperationLessThanOrEqual(coreOperationLessThanOrEqual0, constant1);
Object object0 = coreOperationLessThanOrEqual1.computeValue((EvalContext) null);
assertEquals(false, object0);
}
@Test(timeout = 4000)
public void test10() throws Throwable {
Constant constant0 = new Constant("s");
CoreOperationLessThanOrEqual coreOperationLessThanOrEqual0 = new CoreOperationLessThanOrEqual(constant0, constant0);
Iterator iterator0 = coreOperationLessThanOrEqual0.iterate((EvalContext) null);
assertNotNull(iterator0);
}
@Test(timeout = 4000)
public void test11() throws Throwable {
QName qName0 = new QName("", "");
VariableReference variableReference0 = new VariableReference(qName0);
CoreOperationGreaterThanOrEqual coreOperationGreaterThanOrEqual0 = new CoreOperationGreaterThanOrEqual(variableReference0, variableReference0);
boolean boolean0 = coreOperationGreaterThanOrEqual0.isSymmetric();
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test12() throws Throwable {
Expression[] expressionArray0 = new Expression[0];
QName qName0 = new QName("java.util.c|ncurrent.atomic.AtomicInteger");
CoreOperationAdd coreOperationAdd0 = new CoreOperationAdd(expressionArray0);
Step[] stepArray0 = new Step[0];
ExpressionPath expressionPath0 = new ExpressionPath(coreOperationAdd0, expressionArray0, stepArray0);
VariableReference variableReference0 = new VariableReference(qName0);
CoreOperationGreaterThanOrEqual coreOperationGreaterThanOrEqual0 = new CoreOperationGreaterThanOrEqual(variableReference0, expressionPath0);
int int0 = coreOperationGreaterThanOrEqual0.getPrecedence();
assertEquals(3, int0);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
10e063d1529b51ed21694c270025a70c5d34b544 | 1344206ff8dc3c55679ec40d804dd11d162db76e | /src/main/java/com/app/web/TaxeController.java | 0004432faa1501d4d9889af05c1b0e6d805d12a0 | [] | no_license | imenBHamed/appTaxes | 53af11216164f040e82d1965e2b8e47450e0e441 | 03763ce0d37e9a1ddca7eef2c28cee74780d727c | refs/heads/master | 2021-09-12T02:31:20.747560 | 2018-04-13T21:13:29 | 2018-04-13T21:13:29 | 104,270,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,223 | java | package com.app.web;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.app.dao.EntrepriseRepository;
import com.app.dao.TaxesRepository;
import com.app.entities.Entreprise;
@Controller
public class TaxeController {
@Autowired
private EntrepriseRepository entrepriseRepository;
@Autowired
private TaxesRepository taxesRepository;
@RequestMapping(value = "/entreprises", method = RequestMethod.GET)
public String index(Model model,
@RequestParam(name = "motCle", defaultValue = "") String motCle,
@RequestParam(name = "page", defaultValue = "0") int p,
@RequestParam(name = "size", defaultValue = "4") int s) {
Page<Entreprise> pageEntreprises = entrepriseRepository.chercher("%"
+ motCle + "%", new PageRequest(p, s));
model.addAttribute("listEntreprises", pageEntreprises.getContent());
int[] pages = new int[pageEntreprises.getTotalPages()];
model.addAttribute("page", pages);
model.addAttribute("pageCourante", p);
model.addAttribute("motCle", motCle);
return "entreprises";
}
@RequestMapping(value = "/formEntreprise")
public String form(Model model) {
model.addAttribute("entreprise", new Entreprise());
return "formEntreprise";
}
@RequestMapping(value = "/saveEntreprise")
public String save(Model model, @Valid Entreprise e,
BindingResult bindingResult) {
if(bindingResult.hasErrors())
return "formEntreprise";
entrepriseRepository.save(e);
return "redirect:/entreprises";
}
@RequestMapping(value = "/taxes")
public String save(Model model, Long code) {
Entreprise e= new Entreprise();
e.setCode(code);
model.addAttribute("entreprises", entrepriseRepository.findAll());
model.addAttribute("taxes", taxesRepository.findByEntreprise(e));
return "taxes";
}
}
| [
"imen.benhamed123@gmail.com"
] | imen.benhamed123@gmail.com |
427985302f541cd26ae3a147bdaba9d174ea752e | 7e029fb0cdb3381fea757f7cc3663ad7b18b20b4 | /src/ArraysExercises.java | 8c00e97fe8d28fc6d646c26c7b886ea284069e43 | [] | no_license | JacobGonzalez0/codeup-java-exercises | 51d724bece3ce3ea12583001e99da4f1e17d6bd3 | 70cb91f188495454d5a594705f03584eb44bd51d | refs/heads/main | 2023-03-12T18:53:48.129475 | 2021-03-01T18:22:16 | 2021-03-01T18:22:16 | 331,363,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,257 | java | package src;
import src.Person;
public class ArraysExercises {
public static void main(String[] args) {
Person[] people = new Person[3];
people[0] = new Person();
people[1] = new Person();
people[2] = new Person();
int count = 0;
for(Person person : people){
switch(count){
case 0: person.setName("Jacob");
break;
case 1: person.setName("Edward");
break;
case 2: person.setName("Gonzalez");
break;
default: person.setName("Bob");
break;
}
count++;
}
people = addPerson(people,"Rainbow");
for(Person person: people){
System.out.println(person.getName());
}
}
static public Person[] addPerson(Person[] input, String Name){
Person[] output = new Person[input.length+1];
int count = 0;
for(Person person : input){
output[count] = new Person();
output[count].setName(person.getName());
count++;
}
output[input.length] = new Person();
output[input.length].setName(Name);
return output;
}
}
| [
"jacob.e.gonzalez2@gmail.com"
] | jacob.e.gonzalez2@gmail.com |
5d01140305743f5dcd7bf2050d72fa064a8a89ca | e4b21017cd58e83eee149c0678047d6e8fadaf92 | /src/main/java/se/claremont/taf/websupport/webdrivergluecode/ElementVerificationMethods.java | b7c29f5ab7a4addb286f7cbb003175aaa0be2e5b | [
"Apache-2.0"
] | permissive | claremontqualitymanagement/TAF.WebSupport | 5b133a4c9f248f0c894467f9bcf004f751cbd67d | da9da0bb9c92ff322ad8f577cbc429799d6fefe7 | refs/heads/master | 2022-06-04T23:43:43.673882 | 2020-05-13T14:04:57 | 2020-05-13T14:04:57 | 215,255,237 | 0 | 0 | Apache-2.0 | 2022-05-20T21:13:20 | 2019-10-15T09:09:01 | Java | UTF-8 | Java | false | false | 20,149 | java | package se.claremont.taf.websupport.webdrivergluecode;
import org.openqa.selenium.WebElement;
import se.claremont.taf.core.StringComparisonType;
import se.claremont.taf.core.logging.LogLevel;
import se.claremont.taf.core.support.tableverification.CellMatchingType;
import se.claremont.taf.core.support.tableverification.TableData;
import se.claremont.taf.genericguiinteraction.guidriverpluginstructure.GuiElement;
import se.claremont.taf.websupport.DomElement;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
public class ElementVerificationMethods extends BrowserVerificationMethods{
DomElement domElement;
WebInteractionMethods web;
public ElementVerificationMethods(GuiElement domElement, WebInteractionMethods web){
super(web);
this.domElement = (DomElement)domElement;
this.web = web;
wasSuccess = null;
noFailsInBuilderChain = true;
}
ElementVerificationMethods(GuiElement guiElement, WebInteractionMethods web, boolean onlySuccessesSoFar){
super(web);
this.domElement = (DomElement)guiElement;
this.web = web;
wasSuccess = null;
if(!onlySuccessesSoFar) noFailsInBuilderChain = false;
}
public ElementVerificationMethods textEquals(String expectedString){
return text(expectedString, StringComparisonType.Exact);
}
public ElementVerificationMethods textEqualsIgnoreCase(String expectedString){
return text(expectedString, StringComparisonType.ExactIgnoreCase);
}
public ElementVerificationMethods textContains(String expectedString){
return text(expectedString, StringComparisonType.Contains);
}
public ElementVerificationMethods textContainsIgnoreCase(String expectedString){
return text(expectedString, StringComparisonType.ContainsIgnoreCase);
}
public ElementVerificationMethods textMatchesRegex(String pattern){
return text(pattern, StringComparisonType.Regex);
}
private String getText(){
WebElement element = web.getRuntimeElementWithoutLogging(domElement);
if(element == null) return null;
String text = element.getText();
if(text == null)
text = element.getAttribute("value");
if(text == null)
text = element.getAttribute("data");
if(text == null)
text = element.getAttribute("option");
if(text == null)
text = element.getAttribute("text");
return text;
}
private ElementVerificationMethods text(String expectedPattern, StringComparisonType stringComparisonType){
boolean isMatch = stringComparisonType.match(getText(), expectedPattern);
long startTime = System.currentTimeMillis();
while (!isMatch && ((System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000)){
try {
Thread.sleep(50);
} catch (InterruptedException ignored) {}
isMatch = stringComparisonType.match(getText(), expectedPattern);
}
if(isMatch){
testCase.log(LogLevel.VERIFICATION_PASSED, "Text for element '" + domElement.LogIdentification() + "' matched '" + expectedPattern + "'.");
wasSuccess = true;
} else {
wasSuccess = false;
noFailsInBuilderChain = false;
if(web.exists(domElement)){
testCase.log(LogLevel.VERIFICATION_FAILED, "Text for element '" + domElement.LogIdentification() + "' was '" + web.getText(domElement) + "' which did not match the expected pattern '" + expectedPattern + "'.");
} else {
testCase.log(LogLevel.VERIFICATION_PROBLEM, "Could not match text of element '" + domElement.LogIdentification() + "' since it could not be identified.");
}
web.saveScreenshot(null);
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
}
return this;
}
public ElementVerificationMethods isEnabled(){
boolean success = enabled();
long startTime = System.currentTimeMillis();
while (!success && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
try{
Thread.sleep(50);
} catch (Exception ignored){}
success = enabled();
}
if(success){
testCase.log(LogLevel.VERIFICATION_PASSED, "Element '" + domElement.LogIdentification() + "' was enabled, as expected.");
wasSuccess = true;
} else {
testCase.log(LogLevel.VERIFICATION_FAILED, "Element '" + domElement.LogIdentification() + "' was expected to be enabled but never became enabled within the timeout.");
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
wasSuccess = false;
noFailsInBuilderChain = false;
}
return this;
}
private boolean enabled(){
WebElement element = web.getRuntimeElementWithLogging(domElement);
return (element != null && element.isEnabled());
}
public ElementVerificationMethods exists(){
boolean success = web.getRuntimeElementWithoutLogging(domElement) != null;
long startTime = System.currentTimeMillis();
while (!success && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
try{
Thread.sleep(50);
}catch (Exception ignored){}
success = web.getRuntimeElementWithoutLogging(domElement) != null;
}
if(success){
testCase.log(LogLevel.VERIFICATION_PASSED, "Element '" + domElement.LogIdentification() + "' existed, as expected.");
wasSuccess = true;
} else {
wasSuccess = false;
noFailsInBuilderChain = false;
testCase.log(LogLevel.VERIFICATION_FAILED, "Element '" + domElement.LogIdentification() + "' did not exist, but was expected to exist.");
web.saveScreenshot(null);
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
}
return this;
}
public ElementVerificationMethods doesNotExist(){
boolean success = web.getRuntimeElementWithoutLogging(domElement) == null;
long startTime = System.currentTimeMillis();
while (!success && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
try{
Thread.sleep(50);
}catch (Exception ignored){}
success = web.getRuntimeElementWithoutLogging(domElement) == null;
}
if(success){
testCase.log(LogLevel.VERIFICATION_PASSED, "Element '" + domElement.LogIdentification() + "' did not exist, as expected.");
wasSuccess = true;
} else {
wasSuccess = false;
noFailsInBuilderChain = false;
testCase.log(LogLevel.VERIFICATION_FAILED, "Element '" + domElement.LogIdentification() + "' existed, but was expected not to.");
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
}
return this;
}
public ElementVerificationMethods isDisabled(){
boolean success = !enabled();
long startTime = System.currentTimeMillis();
while (!success && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
try{
Thread.sleep(50);
} catch (Exception ignored){}
success = !enabled();
}
if(success){
testCase.log(LogLevel.VERIFICATION_PASSED, "Element '" + domElement.LogIdentification() + "' was disabled, as expected.");
wasSuccess = true;
} else {
wasSuccess = false;
noFailsInBuilderChain = false;
testCase.log(LogLevel.VERIFICATION_FAILED, "Element '" + domElement.LogIdentification() + "' was expected to be disabled but never became disabled within the timeout.");
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
}
return this;
}
public ElementVerificationMethods isDisplayed(){
boolean success = displayed();
long startTime = System.currentTimeMillis();
while (!success && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
try{
Thread.sleep(50);
}catch (Exception ignored){}
success = displayed();
}
if(success){
testCase.log(LogLevel.VERIFICATION_PASSED, "Element '" + domElement.LogIdentification() + "' was displayed, as expected.");
wasSuccess = true;
} else {
wasSuccess = false;
noFailsInBuilderChain = false;
testCase.log(LogLevel.VERIFICATION_FAILED, "Element '" + domElement.LogIdentification() + "' was not displayed, but was expected to be.");
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
}
return this;
}
public ElementVerificationMethods isNotDisplayed(){
boolean success = !displayed();
long startTime = System.currentTimeMillis();
while (!success && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
try{
Thread.sleep(50);
}catch (Exception ignored){}
success = !displayed();
}
if(success){
testCase.log(LogLevel.VERIFICATION_PASSED, "Element '" + domElement.LogIdentification() + "' was displayed, as expected.");
wasSuccess = true;
} else {
wasSuccess = false;
noFailsInBuilderChain = false;
testCase.log(LogLevel.VERIFICATION_FAILED, "Element '" + domElement.LogIdentification() + "' was not displayed, but was expected to be.");
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
}
return this;
}
private boolean displayed(){
WebElement element = web.getRuntimeElementWithoutLogging(domElement);
if(element == null) return false;
return element.isDisplayed();
}
public ElementVerificationMethods tableRow(String headlineColonValueSemicolonSeparatedString, CellMatchingType cellMatchingType){
return tableRows(new String[]{headlineColonValueSemicolonSeparatedString}, cellMatchingType);
}
/**
* Verifies if html table data holds expected data. Top row expected to hold headlines.
*
* @param headlineColonValueSemicolonSeparatedString The data to find, in the pattern example of 'Headline1:ExpectedCorrespondingCellValue1;Headline2:ExpectedCorrespondingCellValue2'. If all values can be matched on the same row the test is passed.
* @param cellMatchingType Type of matching performed.
* @return Methods for verification
*/
public ElementVerificationMethods tableRows(String[] headlineColonValueSemicolonSeparatedString, CellMatchingType cellMatchingType){
boolean doneOk = false;
long startTime = System.currentTimeMillis();
while (!doneOk && System.currentTimeMillis() - startTime <= web.getStandardTimeout() * 1000){
TableData tableData = web.tableDataFromGuiElement(domElement, false);
if(tableData == null ){
DomElement table = domElement;
testCase.log(LogLevel.VERIFICATION_PROBLEM, "Table data for " + table.LogIdentification() + " is null.");
web.saveScreenshot(web.getRuntimeElementWithoutLogging(table));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
wasSuccess = false;
noFailsInBuilderChain = false;
return this;
}
boolean nonErroneous = true;
for(String searchPattern : headlineColonValueSemicolonSeparatedString){
if(!tableData.rowExist(searchPattern, cellMatchingType)){
nonErroneous = false;
}
}
if(nonErroneous) doneOk = true;
}
TableData tableData = web.tableDataFromGuiElement(domElement, true);
if(tableData == null) return this;
wasSuccess = tableData.verifyRows(headlineColonValueSemicolonSeparatedString, cellMatchingType);
if(!wasSuccess) noFailsInBuilderChain = false;
return this;
}
private String getAttributeValue(String attributeName){
WebElement element = web.getRuntimeElementWithoutLogging(domElement);
if(element == null) return null;
return element.getAttribute(attributeName);
}
public ElementVerificationMethods attributeValue(String attributeName, String attributeValuePattern, StringComparisonType stringComparisonType){
boolean success = stringComparisonType.match(getAttributeValue(attributeName), attributeValuePattern);
long startTime = System.currentTimeMillis();
while (!success && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
try{
Thread.sleep(50);
}catch (Exception ignored){}
success = stringComparisonType.match(getAttributeValue(attributeName), attributeValuePattern);
}
if(success){
testCase.log(LogLevel.VERIFICATION_PASSED, "Value for attribute '" + attributeName + "' for element '" + domElement.LogIdentification() + "' was '" + getAttributeValue(attributeName) + ", successfully matching '" + attributeValuePattern + "'.");
wasSuccess = true;
} else {
wasSuccess = false;
noFailsInBuilderChain = false;
if(web.exists(domElement)){
if(getAttributeValue(attributeName) == null){
testCase.log(LogLevel.VERIFICATION_PROBLEM, "Could not find any value for attribute '" + attributeName + "' for element '" + domElement.LogIdentification() + "'.");
} else {
testCase.log(LogLevel.VERIFICATION_FAILED, "Value for attribute '" + attributeName + "' was expected to match '" + attributeValuePattern + "', but it was '" + getAttributeValue(attributeName) + "' for element '" + domElement.LogIdentification() + "'.");
}
} else {
testCase.log(LogLevel.VERIFICATION_PROBLEM, "Tried to verify attribute value '" + attributeName + "' for element '" + domElement.LogIdentification() + "', but the element was never identified.");
}
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
}
return this;
}
/**
* Verifies a table headline
* @param expectedHeadline
* @return Methods for further verifications
*/
public ElementVerificationMethods tableHeadline(String expectedHeadline){
List<String> headlines = new ArrayList<>();
headlines.add(expectedHeadline);
return tableHeadlines(headlines);
}
/**
* Checks that the expected headlines exist in table
*
* @param expectedHeadlines The list of expected headlines
* @return Methods for further verifications
*/
public ElementVerificationMethods tableHeadlines(List<String> expectedHeadlines){
boolean found = web.waitForElementToAppear(domElement).wasSuccess;
if(!found){
testCase.log(LogLevel.VERIFICATION_PROBLEM, "Could not find " + domElement.LogIdentification() + " to verify headlines '" + String.join("', '", expectedHeadlines) + "' in." );
return this;
}
TableData tableData = web.tableDataFromGuiElement(domElement, false);
if(tableData == null) {
testCase.log(LogLevel.FRAMEWORK_ERROR, "Could not construct TableData for HTML table " + domElement.LogIdentification() + " when trying to verify headlines '" + String.join("', '", expectedHeadlines) + "'.");
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
wasSuccess = false;
noFailsInBuilderChain = false;
return this;
}
if(!tableData.verifyHeadingsExist(expectedHeadlines)){
wasSuccess = false;
noFailsInBuilderChain = false;
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
web.writeRunningProcessListDeviationsSinceTestCaseStart();
} else {
wasSuccess = true;
}
return this;
}
public ElementVerificationMethods isAnimated() {
long startTime = System.currentTimeMillis();
web.waitForElementToAppear(domElement, web.getStandardTimeout());
BufferedImage bufferedImage1 = web.grabElementImage(domElement);
BufferedImage bufferedImage2 = web.grabElementImage(domElement);
boolean elementHasFinishedRendering= !web.bufferedImagesAreEqual(bufferedImage1, bufferedImage2);
while(!elementHasFinishedRendering && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
web.wait(50);
bufferedImage2 = web.grabElementImage(domElement);
elementHasFinishedRendering = !web.bufferedImagesAreEqual(bufferedImage1, bufferedImage2);
//Initial change detection to make sure element is fully rendered and animation is started
}
web.wait(50);
bufferedImage1 = web.grabElementImage(domElement);
boolean animationHasStarted = !web.bufferedImagesAreEqual(bufferedImage1, bufferedImage2);
while(!animationHasStarted && (System.currentTimeMillis() - startTime) < web.getStandardTimeout() * 1000){
web.wait(50);
bufferedImage1 = web.grabElementImage(domElement);
animationHasStarted = !web.bufferedImagesAreEqual(bufferedImage1, bufferedImage2);
//Second change detection to make sure element actually changes
}
if(animationHasStarted){
testCase.log(LogLevel.VERIFICATION_PASSED, "Element " + domElement.LogIdentification() + " is detected to be animated.");
wasSuccess = true;
} else {
wasSuccess = false;
noFailsInBuilderChain = false;
testCase.log(LogLevel.VERIFICATION_FAILED, "Element " + domElement.LogIdentification() + " could not be detected to be animated within the timeout of " + web.getStandardTimeout() + " seconds.");
web.saveScreenshot(web.getRuntimeElementWithoutLogging(domElement));
web.saveDesktopScreenshot();
web.saveHtmlContentOfCurrentPage();
}
return this;
}
}
| [
"Fingal95"
] | Fingal95 |
41d92bff6e8adfa6f121a3e2f362460af2aa250f | d289c32cd2ea3c37224ec0c385a2cbb7a8b4868c | /src/character/player/Item/Item.java | fe27b29622cba40df3a79384e04b9a3a4914fe80 | [] | no_license | OpensourceHU/Homework | cbb40cf8d73c14b6c6cd3761561be9da4671e4da | 6cc3bee3ff54ee8b5d2e9d9e363e30c6c69f0386 | refs/heads/master | 2022-10-24T21:11:47.498109 | 2020-06-12T14:28:00 | 2020-06-12T14:28:00 | 271,817,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 510 | java | package character.player.Item;
/**
* @author OpensourceHU
* @version V1.0
* @Description 背包物品类
* @date 2020/5/26 0026 19:14
*/
public abstract class Item {
public String name;
public String desc;
public void invoke(){};
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;
}
}
| [
"58977866+OpensourceHU@users.noreply.github.com"
] | 58977866+OpensourceHU@users.noreply.github.com |
272b96cb28bf069ce9947fdaa9c35bcc6c8c304a | 06dd0a25857857e7089559aa1a9d95e2b63f69c8 | /src/main/java/cn/com/esrichina/ServerMonitor/domain/Opgroup.java | c6c2b3d23e4aa0da3ff8fb83f1921974d9bc27b2 | [] | no_license | javaWD/ServerMonitor | 8116c71acbbf6376a47dd38b388b6dade539a18f | 47ef30ca418e9f71898490c2a0a98ccc655d8ea1 | refs/heads/master | 2020-11-28T07:07:08.176873 | 2016-08-27T09:07:09 | 2016-08-27T09:07:09 | 66,256,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 888 | java | package cn.com.esrichina.ServerMonitor.domain;
// Generated 2016-8-18 11:14:22 by Hibernate Tools 4.0.0
/**
* Opgroup generated by hbm2java
*/
public class Opgroup implements java.io.Serializable {
private long opgroupid;
private Operations operations;
private Groups groups;
public Opgroup() {
}
public Opgroup(long opgroupid, Operations operations, Groups groups) {
this.opgroupid = opgroupid;
this.operations = operations;
this.groups = groups;
}
public long getOpgroupid() {
return this.opgroupid;
}
public void setOpgroupid(long opgroupid) {
this.opgroupid = opgroupid;
}
public Operations getOperations() {
return this.operations;
}
public void setOperations(Operations operations) {
this.operations = operations;
}
public Groups getGroups() {
return this.groups;
}
public void setGroups(Groups groups) {
this.groups = groups;
}
}
| [
"drudgery@live.com"
] | drudgery@live.com |
b07fd43669f91fd39f940701575bc62c9e01516a | 457065e94db1f320e41d2da4fc7d7c37059c9c9a | /app/src/test/java/com/danielchioro/lafinikeria/ExampleUnitTest.java | bddc33fdc2830ba2b83babdaa38f9fa020a0829d | [] | no_license | DandyMaestro/LaFinikeria | ec4b6b19e90b6924f532ae9b5af25310070c8b9d | 8299ba3778412098e24ce9663103220ad709f370 | refs/heads/master | 2020-09-28T11:00:25.100919 | 2020-03-25T02:37:48 | 2020-03-25T02:37:48 | 226,764,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.danielchioro.lafinikeria;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"danielmeneses@daniels-MacBook-Pro.local"
] | danielmeneses@daniels-MacBook-Pro.local |
24b91feca5c0f8200d7d2df22206b428948ea327 | 607978f1742921449833ecc45eaa3ea6916dbc6a | /NeonApp/gen/com/siwan/neonapp/R.java | 7029070c8147a7d5be3989fcfdf93a114ddbcc86 | [] | no_license | sk25649/NeonSignApp | a6c4131bf9d3eaf111cdcce5e65d9c223e1fa7e2 | da9d8d3b23f4b6ba1a7d82d793ad88c6446daf93 | refs/heads/master | 2021-01-11T10:48:03.912826 | 2012-09-19T18:37:57 | 2012-09-19T18:37:57 | 5,603,731 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,515 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.siwan.neonapp;
public final class R {
public static final class anim {
public static final int translate=0x7f040000;
}
public static final class array {
public static final int move_speed=0x7f080001;
public static final int user_color=0x7f080000;
}
public static final class attr {
}
public static final class color {
public static final int Black=0x7f050000;
public static final int Pink=0x7f050004;
public static final int Purple=0x7f050006;
public static final int Red=0x7f050002;
public static final int Teal=0x7f050003;
public static final int White=0x7f050001;
public static final int Yellow=0x7f050005;
}
public static final class dimen {
public static final int ambilwarna_hsvHeight=0x7f060000;
public static final int ambilwarna_hsvWidth=0x7f060001;
public static final int ambilwarna_hueWidth=0x7f060002;
public static final int ambilwarna_spacer=0x7f060003;
}
public static final class drawable {
public static final int ambilwarna_arrow_down=0x7f020000;
public static final int ambilwarna_arrow_right=0x7f020001;
public static final int ambilwarna_cursor=0x7f020002;
public static final int ambilwarna_hue=0x7f020003;
public static final int ambilwarna_target=0x7f020004;
public static final int ic_action_search=0x7f020005;
public static final int ic_launcher=0x7f020006;
}
public static final class id {
public static final int about=0x7f0b0014;
public static final int ambilwarna_cursor=0x7f0b0004;
public static final int ambilwarna_dialogView=0x7f0b0000;
public static final int ambilwarna_pref_widget_kotak=0x7f0b0009;
public static final int ambilwarna_state=0x7f0b0006;
public static final int ambilwarna_target=0x7f0b0005;
public static final int ambilwarna_viewContainer=0x7f0b0001;
public static final int ambilwarna_viewHue=0x7f0b0003;
public static final int ambilwarna_viewSatBri=0x7f0b0002;
public static final int ambilwarna_warnaBaru=0x7f0b0008;
public static final int ambilwarna_warnaLama=0x7f0b0007;
public static final int blinking=0x7f0b000f;
public static final int display=0x7f0b0012;
public static final int horizontal=0x7f0b0011;
public static final int load_sign=0x7f0b000a;
public static final int move_speed=0x7f0b000e;
public static final int saving=0x7f0b0013;
public static final int user_message=0x7f0b000b;
public static final int user_picked=0x7f0b000d;
public static final int user_save=0x7f0b0010;
public static final int user_size=0x7f0b000c;
}
public static final class layout {
public static final int ambilwarna_dialog=0x7f030000;
public static final int ambilwarna_pref_widget=0x7f030001;
public static final int load_sign=0x7f030002;
public static final int main_screen=0x7f030003;
public static final int message_screen=0x7f030004;
public static final int save_sign=0x7f030005;
}
public static final class menu {
public static final int activity_main=0x7f0a0000;
}
public static final class string {
public static final int Blink=0x7f07000a;
public static final int Color=0x7f070007;
public static final int Message=0x7f070005;
public static final int PickColor=0x7f070008;
public static final int Size=0x7f070006;
public static final int about=0x7f070002;
public static final int app_name=0x7f070000;
public static final int bold=0x7f07000b;
public static final int button=0x7f07000f;
public static final int confirm=0x7f070009;
public static final int hello_world=0x7f070001;
public static final int message=0x7f070004;
public static final int message_hint=0x7f07000c;
public static final int move=0x7f07000e;
public static final int size_hint=0x7f07000d;
public static final int title_activity_main=0x7f070003;
}
public static final class style {
public static final int AppTheme=0x7f090000;
public static final int Bold=0x7f090001;
}
}
| [
"alwayswithjoseph@yahoo.com"
] | alwayswithjoseph@yahoo.com |
7f74840108a2fcaf5ec12cc502a1281880373475 | b5b5a1fc1cc8fc70a7ff4e67870fae80b427e5fc | /app/src/main/java/com/bignerdranch/android/criminalintent/SingleFragmentActivity.java | 0fc26e6372961269aca4a77a81656995ef5d3f77 | [] | no_license | bch010/criminalintent | 43d1ff89f369eeb99889e031842d7559008a5bf3 | 22ffc9d55602223772eb1a0abd6302c6ce985b4f | refs/heads/master | 2020-03-28T07:45:41.276177 | 2018-09-08T10:12:45 | 2018-09-08T10:12:45 | 144,204,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java | package com.bignerdranch.android.criminalintent;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
public abstract class SingleFragmentActivity extends AppCompatActivity {
protected abstract Fragment createFragment();
@LayoutRes
protected int getLayoutResId() {
return R.layout.activity_fragment;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getLayoutResId());
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.fragment_container);
if (fragment == null) {
fragment = createFragment();
fm.beginTransaction()
.add(R.id.fragment_container, fragment)
.commit();
}
}
} | [
"37001472+bonjih@users.noreply.github.com"
] | 37001472+bonjih@users.noreply.github.com |
9594d4886682334dd24333a039ce95fe217bb22f | 9a7ec216a1deeab63e5bf293381d06cf25419251 | /batch13022014/core/BeanPostProcessor/src/com/bpp/test/BPPTest.java | 751e65b844f7feda41e36a9680d41118e6b07ced | [] | no_license | Mallikarjun0535/Spring | 63b2fb705af3477402639557dbda1378fe20b538 | 041f538c7ae2eca113df7cb9277e438ec6221c08 | refs/heads/master | 2020-06-04T00:22:21.910592 | 2019-06-20T19:18:09 | 2019-06-20T19:18:09 | 191,792,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 940 | java | package com.bpp.test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import com.bpp.beans.EditEmpController;
import com.bpp.beans.ValueObjectBeanPostProcessor;
public class BPPTest {
public static void main(String[] args) {
BeanFactory factory = new XmlBeanFactory(new ClassPathResource(
"com/bpp/common/application-context.xml"));
// registering bean post process with ioc container
((ConfigurableListableBeanFactory) factory)
.addBeanPostProcessor(new ValueObjectBeanPostProcessor());
EditEmpController eec = factory.getBean("editEmpController",
EditEmpController.class);
eec.editEmp(1, "Rama", 25422.23f, "rama@sriman.com");
}
}
| [
"mallik.mitta@outlook.com"
] | mallik.mitta@outlook.com |
78d4db4feb92cbfa381df4dd3441800c49e77536 | a89c95173ba2d099e37803f618033a824d5387e1 | /7.31/Week 2/RecyclerView/app/src/main/java/com/example/user/recyclerview/SecondActivity.java | 2caddfbd7cfc4c9937bae0bc8f1393947be6d43f | [] | no_license | DroidSingh89/MAC_Training | 69715c2b1476857d924034391449b70400d80b15 | 096293a249f220cb7366747d45a727c05a9050e7 | refs/heads/master | 2021-07-12T23:01:46.912045 | 2018-12-13T15:26:12 | 2018-12-13T15:26:12 | 133,825,375 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package com.example.user.recyclerview;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
public class SecondActivity extends AppCompatActivity {
private static final String TAG = "Second";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
Intent intent = getIntent();
Food food = (Food) intent.getSerializableExtra("food");
Log.d(TAG, "onCreate: " + food.toString());
}
}
| [
"singh@manroop.com"
] | singh@manroop.com |
cb6434ff0dd095dce71672c33925395b6cf2d0cc | d9261e7145a714a62da09995af969c014fa26a88 | /application/jaxrs-mongodb-quarkus/src/main/java/webapp/tier/resource/MongodbResource.java | bff8f2ed9221724cb6ad24dc33f03fab6f5c4462 | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | yurake/k8s-3tier-webapp | 2392a284f01cf2039a1a0f98477b8226577e971d | 1410a9a371bea352627a2c443a5d5e08c5af5877 | refs/heads/master | 2023-08-17T21:45:36.156080 | 2023-08-09T19:33:49 | 2023-08-09T19:33:49 | 181,164,153 | 15 | 26 | MIT | 2023-09-12T21:02:52 | 2019-04-13T11:57:45 | Java | UTF-8 | Java | false | false | 2,756 | java | package webapp.tier.resource;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.bson.Document;
import org.eclipse.microprofile.faulttolerance.Retry;
import org.eclipse.microprofile.metrics.MetricUnits;
import org.eclipse.microprofile.metrics.annotation.Counted;
import org.eclipse.microprofile.metrics.annotation.Timed;
import com.mongodb.client.MongoCollection;
import webapp.tier.service.MongodbService;
@Path("/quarkus/mongodb")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class MongodbResource {
private final Logger logger = Logger.getLogger(this.getClass().getSimpleName());
@Inject
MongodbService mongosvc;
@POST
@Path("/insert")
@Counted(name = "performedChecks_insert", description = "How many primality checks have been performed.")
@Timed(name = "checksTimer_insert", description = "A measure of how long it takes to perform the primality test.", unit = MetricUnits.MILLISECONDS)
public Response insert() {
try {
MongoCollection<Document> collection = mongosvc.getCollection();
return Response.ok().entity(mongosvc.insertMsg(collection)).build();
} catch (Exception e) {
logger.log(Level.WARNING, "Insert Error.", e);
return Response.status(500).entity(e.getMessage()).build();
}
}
@GET
@Path("/select")
@Retry(maxRetries = 3)
@Counted(name = "performedChecks_select", description = "How many primality checks have been performed.")
@Timed(name = "checksTimer_select", description = "A measure of how long it takes to perform the primality test.", unit = MetricUnits.MILLISECONDS)
public Response select() {
try {
MongoCollection<Document> collection = mongosvc.getCollection();
return Response.ok().entity(mongosvc.selectMsg(collection)).build();
} catch (Exception e) {
logger.log(Level.WARNING, "Select Error.", e);
return Response.status(500).entity(e.getMessage()).build();
}
}
@POST
@Path("/delete")
@Counted(name = "performedChecks_delete", description = "How many primality checks have been performed.")
@Timed(name = "checksTimer_delete", description = "A measure of how long it takes to perform the primality test.", unit = MetricUnits.MILLISECONDS)
public Response delete() {
try {
MongoCollection<Document> collection = mongosvc.getCollection();
return Response.ok().entity(mongosvc.deleteMsg(collection)).build();
} catch (Exception e) {
logger.log(Level.WARNING, "Delete Error.", e);
return Response.status(500).entity(e.getMessage()).build();
}
}
}
| [
"devnulldevnull21@gmail.com"
] | devnulldevnull21@gmail.com |
9a3c55435560c08201a9c4de123e6b92cde1eb74 | 5ee2d3ec689ee4b0516206d60108c396170d2352 | /src/com/udemy/section8/Composition/Challenge/Main.java | 4ffed69fa6f3fd69deeebcd965b59c016aadfdec | [] | no_license | dnlwlnc/Complete-Java-Masterclass | 6ae3c63fd0ff51bfc20885cee1f41608fd64cfe2 | f87500c06bf3660e63f8cc9dcd5e95e24cbe7b9a | refs/heads/master | 2021-01-19T02:51:20.287847 | 2017-06-27T13:30:58 | 2017-06-27T13:30:58 | 87,298,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package com.udemy.section8.Composition.Challenge;
/**
* Created by welencd on 2017-06-01.
*/
public class Main {
public static void main(String[] args) {
Wall wall1 = new Wall("West");
Wall wall2 = new Wall("East");
Wall wall3 = new Wall("South");
Wall wall4 = new Wall("North");
Ceiling sufit = new Ceiling(250, 1);
Bed bed = new Bed("Modern", 4, 200, 1, 2);
Lamp lampa = new Lamp("Classic", false, 75);
Bedroom bedroom = new Bedroom("Sypialnia Daniela", wall1, wall2, wall3, wall4, sufit, bed, lampa);
bedroom.makeBed();
bedroom.getLamp().turnOn();
}
}
| [
"daniel.welenc@gmail.com"
] | daniel.welenc@gmail.com |
6cac9c2e1b48d9440bf72f3cd181e880085f4dba | 51b273a4f1de70a443fa9c64c23eb9945498dd38 | /src/main/java/pl/gregorymartin/http_apis/WeatherApi/model/Rain.java | ebd13a820eaf880c4edccc16d329f838cddf7f23 | [] | no_license | vetomir/WeatherClientAndCurrencyGame | 47c15f1f85b99ac1a939208b6232668afac8a93e | 9913111a0d69d7d2f97ef0375e5140e31963c01a | refs/heads/master | 2022-12-22T06:53:57.686362 | 2020-10-04T17:30:15 | 2020-10-04T17:30:15 | 278,450,065 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,124 | java |
package pl.gregorymartin.http_apis.WeatherApi.model;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"1h"
})
public class Rain {
@JsonProperty("1h")
private Double _1h;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("1h")
public Double get1h() {
return _1h;
}
@JsonProperty("1h")
public void set1h(Double _1h) {
this._1h = _1h;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"vetomir@gmail.com"
] | vetomir@gmail.com |
e77fe38cb4d7627407caaa0bb5c47ac3d7a31929 | 0604e2ba69dfd922e05ca66db82929138c59cdfe | /src/sockets/chat/servidor/Servidor.java | 3c62ae3fa7db0e6a838d48b4cd05f9a0334feee1 | [] | no_license | pa-tiq/java_socket_chat | a78625da584afef77ce8b2978f28a4eee66c805a | 9dcc98f1279dbb0533e9ee018f476c02513efe3f | refs/heads/main | 2023-01-29T16:32:25.737647 | 2020-11-24T19:23:21 | 2020-11-24T19:23:21 | 315,710,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java |
package sockets.chat.servidor;
import java.io.IOException;
public class Servidor {
public static void main(String[] args)
throws IOException {
new Servidor_descricao(12345).executa();
}
} | [
"patrickdsilva99@gmail.com"
] | patrickdsilva99@gmail.com |
7721327337e788efe6694d01bd72ba2c3b0d09c7 | 77ab252244005f80fbfc33f8e931a41e65e83e5a | /spring-boot-integration-tests/spring-boot-integration-tests-embedded-servlet-container/src/test/java/org/springframework/boot/context/embedded/ApplicationBuilder.java | 3073b6467721944270f499da7d699ac7c332c215 | [
"Apache-2.0"
] | permissive | llsydn/spring-boot | d4401969d8ca51937bda7736fabea82944417c39 | b88906cf98c4aa307952d27696897b2d4384b7e8 | refs/heads/master | 2023-01-03T12:14:42.767063 | 2019-09-26T08:53:10 | 2019-09-26T08:53:10 | 171,982,414 | 2 | 1 | Apache-2.0 | 2022-12-27T14:50:56 | 2019-02-22T02:44:30 | Java | UTF-8 | Java | false | false | 5,861 | java | /*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.springframework.boot.context.embedded;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.jar.JarOutputStream;
import java.util.zip.ZipEntry;
import com.samskivert.mustache.Mustache;
import org.apache.maven.shared.invoker.DefaultInvocationRequest;
import org.apache.maven.shared.invoker.DefaultInvoker;
import org.apache.maven.shared.invoker.InvocationRequest;
import org.apache.maven.shared.invoker.InvocationResult;
import org.apache.maven.shared.invoker.MavenInvocationException;
import org.junit.rules.TemporaryFolder;
import org.springframework.util.FileCopyUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Builds a Spring Boot application using Maven. To use this class, the {@code maven.home}
* system property must be set.
*
* @author Andy Wilkinson
*/
class ApplicationBuilder {
private final TemporaryFolder temp;
private final String packaging;
private final String container;
private final String containerVersion;
ApplicationBuilder(TemporaryFolder temp, String packaging, String container,
String containerVersion) {
this.temp = temp;
this.packaging = packaging;
this.container = container;
this.containerVersion = containerVersion;
}
File buildApplication() throws Exception {
File containerFolder = new File(this.temp.getRoot(),
this.container + "-" + this.containerVersion);
if (containerFolder.exists()) {
return new File(containerFolder, "app/target/app-0.0.1." + this.packaging);
}
return doBuildApplication(containerFolder);
}
private File doBuildApplication(File containerFolder)
throws IOException, FileNotFoundException, MavenInvocationException {
File resourcesJar = createResourcesJar();
File appFolder = new File(containerFolder, "app");
appFolder.mkdirs();
writePom(appFolder, resourcesJar);
copyApplicationSource(appFolder);
packageApplication(appFolder);
return new File(appFolder, "target/app-0.0.1." + this.packaging);
}
private File createResourcesJar() throws IOException, FileNotFoundException {
File resourcesJar = new File(this.temp.getRoot(), "resources.jar");
if (resourcesJar.exists()) {
return resourcesJar;
}
JarOutputStream resourcesJarStream = new JarOutputStream(
new FileOutputStream(resourcesJar));
resourcesJarStream.putNextEntry(new ZipEntry("META-INF/resources/"));
resourcesJarStream.closeEntry();
resourcesJarStream.putNextEntry(
new ZipEntry("META-INF/resources/nested-meta-inf-resource.txt"));
resourcesJarStream.write("nested".getBytes());
resourcesJarStream.closeEntry();
resourcesJarStream.close();
return resourcesJar;
}
private void writePom(File appFolder, File resourcesJar)
throws FileNotFoundException, IOException {
Map<String, Object> context = new HashMap<String, Object>();
context.put("packaging", this.packaging);
context.put("container", this.container);
context.put("bootVersion", Versions.getBootVersion());
context.put("resourcesJarPath", resourcesJar.getAbsolutePath());
context.put("containerVersion",
"current".equals(this.containerVersion) ? ""
: String.format("<%s.version>%s</%s.version>", this.container,
this.containerVersion, this.container));
context.put("additionalDependencies", getAdditionalDependencies());
FileWriter out = new FileWriter(new File(appFolder, "pom.xml"));
Mustache.compiler().escapeHTML(false)
.compile(new FileReader("src/test/resources/pom-template.xml"))
.execute(context, out);
out.close();
}
private List<Map<String, String>> getAdditionalDependencies() {
List<Map<String, String>> additionalDependencies = new ArrayList<Map<String, String>>();
if ("tomcat".equals(this.container) && !"current".equals(this.containerVersion)) {
Map<String, String> juli = new HashMap<String, String>();
juli.put("groupId", "org.apache.tomcat");
juli.put("artifactId", "tomcat-juli");
juli.put("version", "${tomcat.version}");
additionalDependencies.add(juli);
}
return additionalDependencies;
}
private void copyApplicationSource(File appFolder) throws IOException {
File examplePackage = new File(appFolder, "src/main/java/com/example");
examplePackage.mkdirs();
FileCopyUtils.copy(
new File("src/test/java/com/example/ResourceHandlingApplication.java"),
new File(examplePackage, "ResourceHandlingApplication.java"));
if ("war".equals(this.packaging)) {
File srcMainWebapp = new File(appFolder, "src/main/webapp");
srcMainWebapp.mkdirs();
FileCopyUtils.copy("webapp resource",
new FileWriter(new File(srcMainWebapp, "webapp-resource.txt")));
}
}
private void packageApplication(File appFolder) throws MavenInvocationException {
InvocationRequest invocation = new DefaultInvocationRequest();
invocation.setBaseDirectory(appFolder);
invocation.setGoals(Collections.singletonList("package"));
InvocationResult execute = new DefaultInvoker().execute(invocation);
assertThat(execute.getExitCode()).isEqualTo(0);
}
}
| [
"1091391667@qq.com"
] | 1091391667@qq.com |
9c42d633a635045935e14179ae11b02075cb1a92 | 051377b163d797b3f245c8bbd46bc86a6411dac2 | /iot-device-sdk-java/src/main/java/com/huaweicloud/sdk/iot/device/client/requests/DeviceProperties.java | 8b4f5d56084a5e4543e1a16757f1008a7471bd8e | [
"BSD-3-Clause"
] | permissive | huaweicloud/huaweicloud-sdk-java-iot-generic-protocol | 605ac2c67f34174947846660c6130d794c079b3f | 6f8b823c2f9f5a7d841925999d0d8a701e68e887 | refs/heads/master | 2023-08-20T18:20:21.880514 | 2022-09-08T02:37:10 | 2022-09-08T02:37:10 | 205,795,588 | 4 | 4 | BSD-3-Clause | 2022-09-08T02:37:11 | 2019-09-02T06:58:44 | null | UTF-8 | Java | false | false | 574 | java | package com.huaweicloud.sdk.iot.device.client.requests;
import com.huaweicloud.sdk.iot.device.utils.JsonUtil;
import java.util.List;
/**
* 设备属性内容
*/
public class DeviceProperties {
/**
* 服务属性列表
*/
private List<ServiceProperty> services;
public List<ServiceProperty> getServices() {
return services;
}
public void setServices(List<ServiceProperty> services) {
this.services = services;
}
@Override
public String toString() {
return JsonUtil.convertObject2String(this);
}
}
| [
"1239533137@qq.com"
] | 1239533137@qq.com |
35415dba4481c7fd5d91afc2dc4c2d7a6f4f25a0 | 475b5976f581c7974cbbf80e03dcdadf7c3ecfdf | /core/src/com/pablo/gameutils/ShapeIdentification.java | 8ea351547eb5c3ad5544810feb71766d7d1773ad | [] | no_license | darthNexan/Geomungi | 09a2c4b59fb50529c113981a763fc27b4afb3806 | d382ca543cd1cc3e83459b8c2cc882a9e97d55eb | refs/heads/master | 2021-01-24T03:04:05.446437 | 2018-04-11T01:58:02 | 2018-04-11T01:58:02 | 122,876,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,670 | java | package com.pablo.gameutils;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import java.util.Vector;
import static java.lang.Math.abs;
/**
* Contains methods used for identifying figures drawn by users.
*
* @author Dennis Guye
*
*
*/
public class ShapeIdentification {
public final static int ACUTE;
public final static int OBTUSE;
public final static int RIGHT;
public final static int EQUILATERAL;
public final static int ISOSCELES;
public final static int SCALENE;
static {
ACUTE = 0;
OBTUSE = 1;
RIGHT = 2;
EQUILATERAL = 0;
ISOSCELES = 1;
SCALENE =2;
}
/**
* Checks to see if the two floats are approximately equal (difference of less than 0.1%).
* @param a
* @param b
* @return A boolean indicating whether the two values are approximately equal.
*/
public static boolean isApproxEqual(float a, float b){
return isApproxEqual(a,b,0.5f);
}
/**
* Checks to see if the two floats are approximately equal (difference of less than margin).
* @param a
* @param b
* @param marginOfDifference percentage by which the two values can differ
* @return A boolean indicating whether the two values are approximately equal
*/
public static boolean isApproxEqual(float a, float b, float marginOfDifference){
float percentDiff = abs((a-b)/b) * 100f;
System.out.println(percentDiff);
return percentDiff<marginOfDifference;
}
/**
*
* @param a first line
* @param b second line
* @return a boolean indicating whether the lines are parallel
*/
public static boolean identifyParallelLines(Vector<Vector2> a, Vector<Vector2> b){
if (a.isEmpty() || b.isEmpty())
return false;
for (Vector2 v: a)
Gdx.app.log("Value of vector:",v.toString());
for (Vector2 v: b)
Gdx.app.log("Value of vector:",v.toString());
Vector2 v1 = new Vector2(a.firstElement());
Vector2 v2 = new Vector2(b.firstElement());
v1.sub(a.get(1));
v2.sub(b.get(1));
Gdx.app.log("V1", v1.nor().toString());
Gdx.app.log("V2", v2.nor().toString());
return isApproxEqual(abs(v1.nor().x), abs(v2.nor().x)) && isApproxEqual(abs(v2.nor().y), abs(v1.nor().y));
}
/**
* TODO TEST
* @param points should be a copy
* @param type the type of game just used
* @return a boolean indicating whether the right shape was made
*/
public static boolean identifyShape(Vector<Vector2> points, BasicGameType type){
return filterPoints(points).x2 && points.size() == type.shapeType +1 && points.lastElement().equals(points.firstElement());
}
/**
* TODO TEST
* @param v Point to remove duplicates
* @return A tuple2 containing the vector passed and a boolean
*/
private static Tuple2<Vector<Vector2>, Boolean> filterPoints(Vector<Vector2> v){
Boolean res = true;
for (int i = 0; i < v.size()-1 && res; i++){
int j = i+1;
while (j<v.size() && res){
if(v.get(j).equals(v.get(i))){
if(j!=i+1){
res = false;
}
else{
v.remove(j);
}
}
else {
j++;
}
}
}
return new Tuple2<Vector<Vector2>, Boolean>(v,res);
}//filterPoints
/**
* Compresses a collection of lines into one vector
* @param lines lines to merge
* @return
*/
public static Vector<Vector2> merge(Vector<Vector<Vector2>> lines){
Vector<Vector2> v = new Vector<Vector2>();
Vector<Vector2> temp =null;
v.addAll(lines.get(0));
lines.remove(0);
int i=0;
while (!lines.isEmpty()){
temp = lines.get(i);
int matchingLocationA = temp.contains(v.firstElement()) ? temp.indexOf(v.firstElement())
: temp.indexOf(v.lastElement());
int matchingLocationB = v.contains(temp.firstElement()) ? v.indexOf(temp.firstElement()):
v.indexOf(temp.lastElement());
if (matchingLocationA != -1) {
performMerge(temp,v,matchingLocationA,matchingLocationB);
lines.remove(i);
}
else {
i = (i + 1) % lines.size();
}
}
return v;
}
/**
*
* @param a the vector in which the matching location originates
* @param b the vector in which the elementts are added
* @param matchingLocationA the location that has a common element
* @return
*/
public static Vector<Vector2> performMerge(Vector<Vector2>a,Vector<Vector2>b,int matchingLocationA, int matchingLocationB){
for (int i = (matchingLocationA + 1) % a.size(); i != matchingLocationA; i= (i+1) % matchingLocationA){
b.add(a.get(i));
}
return b;
}
/**
* Checks the distance between the two lines
* @param a
* @param b
* @return
*/
public static float calculateLength(Vector2 a, Vector2 b){
return a.dst(b);
}
/**
* returns angle
*/
public static float calculateAngle(Vector2 a, Vector2 b, Vector2 c){
Vector2 ab = new Vector2(b);
Vector2 bc = new Vector2(c);
Vector2 ac = new Vector2(a);
ab.sub(a);
bc.sub(b);
ac.sub(c);
//System.out.println(angle);
return abs(180f - (abs(ab.angle(ac)) + abs(bc.angle(ac))));
}
/**
* TODO TEST
* Checks the shape drawn. Check if the the shape is complete before running this method
*
* @param lines set of points that make up the shape. The first and last points must be equal
* @param isRight checks to see if the angle is a right angle
* @return The first value indicates whether the shape has four sides
* the second value states whether the lines are parallel
* the third indicates if the angles are right
* the fourth checks if all lines are equal
*/
public static Tuple4<Boolean,Boolean,Boolean,Boolean> checkParallelogram(Vector<Vector2> lines ,boolean isRight, boolean isRhombus){
if (lines.size() != 5){
return new Tuple4<Boolean, Boolean, Boolean,Boolean>(false,false,false,false);
}
//noinspection UnusedAssignment
boolean res1 = false;
boolean res2 =false;
boolean res3 = false;
boolean res4 = false;
res1 = lines.firstElement().equals(lines.lastElement());
if (res1) {//check if opposing lines are parallel
Vector<Vector2> l1 = new Vector<Vector2>();
l1.add(lines.get(0));
l1.add(lines.get(1));
Vector<Vector2> l2 = new Vector<Vector2>();
l2.add(lines.get(2));
l2.add(lines.get(3));
Vector<Vector2> l3 = new Vector<Vector2>();
l3.add(lines.get(3));
l3.add(lines.get(4));
Vector<Vector2> l4 = new Vector<Vector2>();
l4.add(lines.get(1));
l4.add(lines.get(2));
res2 = identifyParallelLines(l1, l2) && identifyParallelLines(l3,l4);
}
if (isRight && res1 && res2 ){//check if angle is a right angle.... based on game mode
res3 = abs(MathUtils.sinDeg(calculateAngle(lines.get(0), lines.get(1), lines.get(2))))
== MathUtils.sinDeg(90) ;
}
if (isRhombus && res1 && res2){
res4 = isApproxEqual(calculateLength(lines.get(0), lines.get(1)), calculateLength(lines.get(2), lines.get(3)));
}
return new Tuple4<Boolean, Boolean, Boolean,Boolean>(res1,res2,res3,res4);
}//checkParallelogram
/**
* Passed
* @param points the points that make up the triangle
* @param type the type of triangle RIGHT, OBTUSE OR SCALENE, use the class constants tto specify
* @return A tuple indicating the type of triangle.
* the first indicates that the shape is a triangle
* the second indicates that the triangle is of the right type
* @throws IllegalArgumentException thrown if an invalid type is entered
*/
public static Tuple3< Boolean,Boolean,Boolean> triangleA(Vector<Vector2> points, final int type) throws IllegalArgumentException {
if (type<0 || type>2){
throw new IllegalArgumentException("Use class constants to specify the type of triangle");
}
if (!points.lastElement().equals(points.firstElement())){
return new Tuple3<Boolean, Boolean,Boolean>(false,false,false);
}
if (points.size() != 4) {//not a triangle
return new Tuple3<Boolean, Boolean,Boolean>(true,false, false);
}
else {
Boolean res=false;
float angle0,angle1,angle2 = 0;
angle0 = calculateAngle(points.get(0),points.get(1), points.get(2));
angle1 = calculateAngle(points.get(1), points.get(2),points.get(0));
angle2 = 180f - (angle0 + angle1);
if (type == OBTUSE){
res = angle0 > 90f || angle1 > 90f || angle2 > 90f;
}
else if (type == ACUTE){
res = angle0 <90f && angle1 <90f && angle2 <90f;
}
else if (type == RIGHT){
res = isApproxEqual(90f,angle0)|| isApproxEqual(90f,angle1) || isApproxEqual(90f,angle2);
}
return new Tuple3<Boolean,Boolean, Boolean>(true,true, res);
}
}//triangleA
/**
* Passed
* @param points the points used to identify the triangle
* @param type the type of triangle either equilateral, isosceles or scalene
* @return a tuple
* the first value indicates whether the shape is a triangle
* the second value indicates whether the triangle is of the specified type
* @throws IllegalArgumentException thrown if an invalid type is passed to the function
*/
public static Tuple3<Boolean,Boolean,Boolean> triangleL(Vector<Vector2> points, final int type) throws IllegalArgumentException{
if (type<0 || type>2){
throw new IllegalArgumentException("Use class constants to specify the type of triangle");
}
if (!points.lastElement().equals(points.firstElement())){
return new Tuple3<Boolean, Boolean, Boolean>(false,false,false);
}
if (points.size() != 4) {//not a triangle
return new Tuple3<Boolean,Boolean, Boolean>(true, false,false);
}
else {
boolean res =false;
float angle0,angle1,angle2 = 0;
angle0 = calculateAngle(points.get(0),points.get(1), points.get(2));
angle1 = calculateAngle(points.get(1), points.get(2),points.get(0));
angle2 = 180f - (angle0 + angle1);
System.out.println(angle0);
System.out.println(angle1);
System.out.println(angle2);
if (type == EQUILATERAL){
res = isApproxEqual(angle0,angle1) && isApproxEqual(angle1,angle2);
}
else if (type == ISOSCELES){
res = isApproxEqual(angle0,angle1) || isApproxEqual(angle0,angle2) || isApproxEqual(angle1,angle2);
}
else if (type == RIGHT){
res = angle0!=angle1 && angle1 !=angle2 && angle1 != angle2;
}
return new Tuple3<Boolean,Boolean, Boolean>(true,true,res);
}
}
/**
* TODO Test
* @param points The points to check
* @return a tuple indicating whether the figure is a kite. The first value states whether the shapes is a quad
* the second states whether the quad is a kite
*/
public static Tuple3<Boolean,Boolean,Boolean> checkKite(Vector<Vector2> points){
boolean res2 = points.size() > 2 && points.lastElement().equals(points.firstElement());
boolean res0= points.size() == 5 && res2;
boolean res1 = false;
if (res0){
float a,b,c,d;
a= points.get(0).dst(points.get(1));
b = points.get(1).dst(points.get(2));
c= points.get(2).dst(points.get(3));
d = points.get(3).dst(points.get(4));
res1 = (isApproxEqual(a,b) && isApproxEqual(a,b)) || (isApproxEqual(a,c) && isApproxEqual(b,d))
|| (isApproxEqual(a,d) && isApproxEqual(b,c));
}
return new Tuple3<Boolean, Boolean ,Boolean>(res2,res0,res1);
}
/**
* TODO TEST
* @param points the points to check
* @return a tuple indicating whether the figure is a kite.
* the first value indicates whether it is a shape
* the second value indicates whether it is a quad
* the third whether it is a trapezium
*/
public static Tuple3<Boolean,Boolean,Boolean> checkTrapezium(Vector<Vector2> points){
boolean res0 = points.size() > 2 && points.firstElement().equals(points.lastElement());
boolean res1 = points.size() == 5 && res0;
boolean res2=false;
if (res1){
// Gdx.app.log("res1","Must be true");
// Vector<Vector2> l1 = new Vector<Vector2>();
// l1.add(points.get(0));
// l1.add(points.get(1));
// Vector<Vector2> l2 = new Vector<Vector2>();
// l2.add(points.get(2));
// l2.add(points.get(3));
//
//
// Vector<Vector2> l3 = new Vector<Vector2>();
// l3.add(points.get(3));
// l3.add(points.get(4));
// Vector<Vector2> l4 = new Vector<Vector2>();
// l4.add(points.get(1));
// l4.add(points.get(2));
//
//
// res2 = identifyParallelLines(l1, l2) || identifyParallelLines(l3,l4);
Vector2 a,b,c,d;
a = new Vector2(points.get(0));
a.sub(points.get(1));
b = new Vector2(points.get(3));
b.sub(points.get(4));
c = new Vector2(points.get(4));
c.sub(points.get(0));
d = new Vector2(points.get(1));
d.sub(points.get(2));
res2 = a.hasOppositeDirection(b) || a.hasSameDirection(b) ||
c.hasOppositeDirection(d) || c.hasSameDirection(d);
}
return new Tuple3<Boolean,Boolean,Boolean>(res0,res1,res2);
}
/**
* Tests whether the points make up a generic shape
* @param points points to test
* @param gameType number of sides that make up the shape
* @return A tuple indicating where the points make up a shape
* the first element indicates whether the points make up a shape
* the second element indicates whether there are the correct number of sides
* @throws IllegalArgumentException if an invalid game type is passed to the function
*/
public static Tuple2<Boolean,Boolean> checkShape(Vector<Vector2>points, BasicGameType gameType) throws IllegalArgumentException{
if (!gameType.isShape()) throw new IllegalArgumentException("None shape type passed to check shape");
return new Tuple2<Boolean, Boolean>(points.firstElement().equals(points.lastElement()), points.firstElement().equals(points.lastElement()) && points.size() == gameType.shapeType + 1);
}
}
| [
"d_guye15@hotmail.com"
] | d_guye15@hotmail.com |
f1c0083210b779c2a7a370fcfe3aa2131bd429bd | cb1e8bc8584b7951eabe4fad4d050693109f027a | /app/src/main/java/com/coolweather/app/model/Province.java | fb9d4813f42e1dc44ce1fdeb3be2ba41584f15bc | [] | no_license | dennyx/CoolWeatherApp | 5b0d7d730bab47afdfa9bb031467650dc47b7e0e | b6aa5123033900e4493ab809f29c7e18e3d88008 | refs/heads/master | 2021-01-10T12:01:18.899314 | 2015-10-27T04:48:31 | 2015-10-27T04:48:31 | 44,803,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | package com.coolweather.app.model;
/**
* Created by dzhang4 on 10/21/2015.
*/
public class Province {
private int id;
private String provinceName;
private String provinceCode;
public int getId(){
return id;
}
public void setId(int id){
this.id = id;
}
public String getProvinceName(){
return provinceName;
}
public void setProvinceName(String provinceName){
this.provinceName = provinceName;
}
public String getProvinceCode(){
return provinceCode;
}
public void setProvinceCode(String provinceCode){
this.provinceCode = provinceCode;
}
}
| [
"denny.zhang.zhuhai@software.dell.com"
] | denny.zhang.zhuhai@software.dell.com |
bb3143d2906384ddf5440d7a619699f33a914f8e | f37211641cf2b7881420ce135b8b24449eca6361 | /ecsite/src/com/internousdev/ecsite/action/UserCreateConfirmAction.java | 7b95dd3a7bb895b83b8daf6113136de76edba01b | [] | no_license | ikemototaro/ECsite | c155e18472fc6a2d7d3fe240860bc452c5ba2fe2 | f7bbdc9572885ed561fd9673a4e148286904ea21 | refs/heads/master | 2020-09-20T03:55:12.805835 | 2019-11-27T08:04:01 | 2019-11-27T08:04:01 | 224,370,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,524 | java | package com.internousdev.ecsite.action;
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
public class UserCreateConfirmAction extends ActionSupport implements SessionAware {
private String loginUserId;
private String loginPassword;
private String userName;
public Map<String, Object>session;
private String errorMessage;
public String execute(){
String result = SUCCESS;
if(!(loginUserId.equals(""))
&&!(loginPassword.equals(""))
&&!(userName.equals(""))){
session.put("loginUserId", loginUserId);
session.put("loginPassword", loginPassword);
session.put("userName", userName);
}else{
setErrorMessage("未入力の項目があります。");
result = ERROR;
}
return result;
}
public String getLoginUserId(){
return loginUserId;
}
public void setLoginUserId(String loginUserId){
this.loginUserId = loginUserId;
}
public String getLoginPassword(){
return loginPassword;
}
public void setLoginPassword(String loginPassword){
this.loginPassword = loginPassword;
}
public String getUserName(){
return userName;
}
public void setUserName(String userName){
this.userName = userName;
}
public String getErrorMessage(){
return errorMessage;
}
public void setErrorMessage(String errorMessage){
this.errorMessage = errorMessage;
}
public Map<String, Object>getSession(){
return this.session;
}
public void setSession(Map<String, Object>session){
this.session = session;
}
}
| [
"ikemotogithub@gmail.com"
] | ikemotogithub@gmail.com |
6c1223632c1b785bd5c8450293aae40a694b0e1e | daddaa92cc95d07ee8edcc963127269aac72d231 | /app/src/main/java/com/example/zidan11rpl012019/Model.java | b8cbd16d7722aae3a548b317dda42e234c14191a | [] | no_license | ZidanMRaasyid/zidan11RPL012019 | b0f66501434f55bcddb522f7d728e472c40a7248 | 62b1590f9a2d326e4408e2dbc24b759c3101235f | refs/heads/master | 2023-01-11T09:36:02.786130 | 2020-10-28T07:09:12 | 2020-10-28T07:09:12 | 282,824,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,374 | java | package com.example.zidan11rpl012019;
public class Model {
//https://image.tmdb.org/t/p/w500/k68nPLbIST6NP96JmTxmZijEvCA.jpg
String original_title;
String release_date;
String poster_path;
Boolean adult;
String overview;
int vote_count;
int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getOriginal_title() {
return original_title;
}
public void setOriginal_title(String original_title) {
this.original_title = original_title;
}
public String getRelease_date() {
return release_date;
}
public void setRelease_date(String release_date) {
this.release_date = release_date;
}
public String getPoster_path() {
return poster_path;
}
public void setPoster_path(String poster_path) {
this.poster_path = poster_path;
}
public Boolean getAdult() {
return adult;
}
public void setAdult(Boolean adult) {
this.adult = adult;
}
public String getOverview() {
return overview;
}
public void setOverview(String overview) {
this.overview = overview;
}
public int getVote_count() { return vote_count; }
public void setVote_count(int vote_count) {
this.vote_count = vote_count;
}
}
| [
"zidan.raasyid301@gmail.com"
] | zidan.raasyid301@gmail.com |
7678e748c8131464bc710f8b56c3ffd5cf4103fd | bf36131db706074cdccf0edf95f59b987eddd9a2 | /src/main/java/com/ebay/nest/io/sede/lazy/objectinspector/LazySimpleStructObjectInspector.java | c8b4f369fe65684e4e0c68763833b2a841d53fb5 | [] | no_license | limyang/nest-file | 9b51138c840bb29c350617443fb6db9b6d08f09e | 459f2acb543f8d965385afd368aa484db2defbfd | refs/heads/master | 2020-03-29T20:16:03.801037 | 2013-12-10T08:41:52 | 2013-12-10T08:41:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,081 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ebay.nest.io.sede.lazy.objectinspector;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.Text;
import com.ebay.nest.io.sede.lazy.LazyStruct;
import com.ebay.nest.io.sede.objectinspector.ObjectInspector;
import com.ebay.nest.io.sede.objectinspector.ObjectInspectorUtils;
import com.ebay.nest.io.sede.objectinspector.StructField;
import com.ebay.nest.io.sede.objectinspector.StructObjectInspector;
/**
* LazySimpleStructObjectInspector works on struct data that is stored in
* LazyStruct.
*
* The names of the struct fields and the internal structure of the struct
* fields are specified in the ctor of the LazySimpleStructObjectInspector.
*
* Always use the ObjectInspectorFactory to create new ObjectInspector objects,
* instead of directly creating an instance of this class.
*/
public class LazySimpleStructObjectInspector extends StructObjectInspector {
public static final Log LOG = LogFactory
.getLog(LazySimpleStructObjectInspector.class.getName());
protected static class MyField implements StructField {
protected int fieldID;
protected String fieldName;
protected ObjectInspector fieldObjectInspector;
protected String fieldComment;
protected MyField() {
super();
}
public MyField(int fieldID, String fieldName,
ObjectInspector fieldObjectInspector) {
this.fieldID = fieldID;
this.fieldName = fieldName.toLowerCase();
this.fieldObjectInspector = fieldObjectInspector;
}
public MyField(int fieldID, String fieldName, ObjectInspector fieldObjectInspector, String fieldComment) {
this(fieldID, fieldName, fieldObjectInspector);
this.fieldComment = fieldComment;
}
public int getFieldID() {
return fieldID;
}
public String getFieldName() {
return fieldName;
}
public ObjectInspector getFieldObjectInspector() {
return fieldObjectInspector;
}
public String getFieldComment() {
return fieldComment;
}
@Override
public String toString() {
return "" + fieldID + ":" + fieldName;
}
}
private List<MyField> fields;
private byte separator;
private Text nullSequence;
private boolean lastColumnTakesRest;
private boolean escaped;
private byte escapeChar;
protected LazySimpleStructObjectInspector() {
super();
}
/**
* Call ObjectInspectorFactory.getLazySimpleStructObjectInspector instead.
*/
protected LazySimpleStructObjectInspector(List<String> structFieldNames,
List<ObjectInspector> structFieldObjectInspectors, byte separator,
Text nullSequence, boolean lastColumnTakesRest, boolean escaped,
byte escapeChar) {
init(structFieldNames, structFieldObjectInspectors, null, separator,
nullSequence, lastColumnTakesRest, escaped, escapeChar);
}
public LazySimpleStructObjectInspector(List<String> structFieldNames,
List<ObjectInspector> structFieldObjectInspectors,
List<String> structFieldComments, byte separator, Text nullSequence,
boolean lastColumnTakesRest, boolean escaped, byte escapeChar) {
init(structFieldNames, structFieldObjectInspectors, structFieldComments,
separator, nullSequence, lastColumnTakesRest, escaped, escapeChar);
}
protected void init(List<String> structFieldNames,
List<ObjectInspector> structFieldObjectInspectors,
List<String> structFieldComments, byte separator,
Text nullSequence, boolean lastColumnTakesRest, boolean escaped,
byte escapeChar) {
assert (structFieldNames.size() == structFieldObjectInspectors.size());
assert (structFieldComments == null ||
structFieldNames.size() == structFieldComments.size());
this.separator = separator;
this.nullSequence = nullSequence;
this.lastColumnTakesRest = lastColumnTakesRest;
this.escaped = escaped;
this.escapeChar = escapeChar;
fields = new ArrayList<MyField>(structFieldNames.size());
for (int i = 0; i < structFieldNames.size(); i++) {
fields.add(new MyField(i, structFieldNames.get(i),
structFieldObjectInspectors.get(i),
structFieldComments == null ? null : structFieldComments.get(i)));
}
}
protected LazySimpleStructObjectInspector(List<StructField> fields,
byte separator, Text nullSequence) {
init(fields, separator, nullSequence);
}
protected void init(List<StructField> fields, byte separator,
Text nullSequence) {
this.separator = separator;
this.nullSequence = nullSequence;
this.fields = new ArrayList<MyField>(fields.size());
for (int i = 0; i < fields.size(); i++) {
this.fields.add(new MyField(i, fields.get(i).getFieldName(), fields
.get(i).getFieldObjectInspector(), fields.get(i).getFieldComment()));
}
}
@Override
public String getTypeName() {
return ObjectInspectorUtils.getStandardStructTypeName(this);
}
@Override
public final Category getCategory() {
return Category.STRUCT;
}
// Without Data
@Override
public StructField getStructFieldRef(String fieldName) {
return ObjectInspectorUtils.getStandardStructFieldRef(fieldName, fields);
}
@Override
public List<? extends StructField> getAllStructFieldRefs() {
return fields;
}
// With Data
@Override
public Object getStructFieldData(Object data, StructField fieldRef) {
if (data == null) {
return null;
}
LazyStruct struct = (LazyStruct) data;
MyField f = (MyField) fieldRef;
int fieldID = f.getFieldID();
assert (fieldID >= 0 && fieldID < fields.size());
return struct.getField(fieldID);
}
@Override
public List<Object> getStructFieldsDataAsList(Object data) {
if (data == null) {
return null;
}
LazyStruct struct = (LazyStruct) data;
return struct.getFieldsAsList();
}
// For LazyStruct
public byte getSeparator() {
return separator;
}
public Text getNullSequence() {
return nullSequence;
}
public boolean getLastColumnTakesRest() {
return lastColumnTakesRest;
}
public boolean isEscaped() {
return escaped;
}
public byte getEscapeChar() {
return escapeChar;
}
}
| [
"limyang@ebay.com"
] | limyang@ebay.com |
768e45b16b10e3c51e1d6466048d7522a97fd91c | b327a374de29f80d9b2b3841db73f3a6a30e5f0d | /out/host/linux-x86/obj/EXECUTABLES/vm-tests_intermediates/main_files/dot/junit/opcodes/shr_int_2addr/Main_testB2.java | a2eb590705d45fc7c148aeb5ca292453639f9b60 | [] | no_license | nikoltu/aosp | 6409c386ed6d94c15d985dd5be2c522fefea6267 | f99d40c9d13bda30231fb1ac03258b6b6267c496 | refs/heads/master | 2021-01-22T09:26:24.152070 | 2011-09-27T15:10:30 | 2011-09-27T15:10:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | //autogenerated by util.build.BuildDalvikSuite, do not change
package dot.junit.opcodes.shr_int_2addr;
import dot.junit.opcodes.shr_int_2addr.d.*;
import dot.junit.*;
public class Main_testB2 extends DxAbstractMain {
public static void main(String[] args) throws Exception {
T_shr_int_2addr_1 t = new T_shr_int_2addr_1();
assertEquals(0x3FFFFFFF, t.run(Integer.MAX_VALUE, 1));
}
}
| [
"fred.faust@gmail.com"
] | fred.faust@gmail.com |
a2278bd80a708366650a0b181402d47a8222d7b5 | 780c9c68e7525cfa67a6a0a569b3567101c120fd | /beauty-common/src/main/java/com/meixiang/beauty/common/beanvalidator/DefaultGroup.java | e45b7e27417b8e3289da984cc1b23aa0ca14bf9e | [] | no_license | yuexiadieying/beauty | 4705ab2c2474a15884cbaeaab8ed1a36d44c7244 | 1e0a910eccea47c9edf48704843ba931e8fbf76d | refs/heads/master | 2022-12-23T19:32:26.398543 | 2019-08-01T01:24:45 | 2019-08-01T01:24:45 | 199,824,461 | 0 | 0 | null | 2022-12-16T01:17:21 | 2019-07-31T09:30:40 | HTML | UTF-8 | Java | false | false | 137 | java | package com.meixiang.beauty.common.beanvalidator;
/**
* 默认Bean验证组
* @author ThinkGem
*/
public interface DefaultGroup {
}
| [
"cus18@sina.com"
] | cus18@sina.com |
179b0caa4f89138f0f869fefae98d322bb732850 | 9310225eb939f9e4ac1e3112190e6564b890ac63 | /profile2/.svn/pristine/17/179b0caa4f89138f0f869fefae98d322bb732850.svn-base | 6337c8cb6f80fe5bc3d5c0a1b07594f3c054506e | [
"ECL-2.0"
] | permissive | deemsys/version-1.0 | 89754a8acafd62d37e0cdadf680ddc9970e6d707 | cd45d9b7c5633915a18bd75723c615037a4eb7a5 | refs/heads/master | 2020-06-04T10:47:01.608886 | 2013-06-15T11:01:28 | 2013-06-15T11:01:28 | 10,705,153 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,403 | /**
* Copyright (c) 2008-2010 The Sakai Foundation
*
* Licensed under the Educational Community 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.osedu.org/licenses/ECL-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.sakaiproject.profile2.tool.pages;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.Cookie;
import org.apache.log4j.Logger;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.PageParameters;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.extensions.ajax.markup.html.tabs.AjaxTabbedPanel;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.model.StringResourceModel;
import org.sakaiproject.profile2.model.ProfilePreferences;
import org.sakaiproject.profile2.model.ProfilePrivacy;
import org.sakaiproject.profile2.tool.components.OnlinePresenceIndicator;
import org.sakaiproject.profile2.tool.components.ProfileImageRenderer;
import org.sakaiproject.profile2.tool.components.ProfileStatusRenderer;
import org.sakaiproject.profile2.tool.models.FriendAction;
import org.sakaiproject.profile2.tool.pages.panels.FriendsFeed;
import org.sakaiproject.profile2.tool.pages.panels.GalleryFeed;
import org.sakaiproject.profile2.tool.pages.panels.KudosPanel;
import org.sakaiproject.profile2.tool.pages.panels.ViewProfilePanel;
import org.sakaiproject.profile2.tool.pages.panels.ViewWallPanel;
import org.sakaiproject.profile2.tool.pages.windows.AddFriend;
import org.sakaiproject.profile2.types.PrivacyType;
import org.sakaiproject.profile2.util.ProfileConstants;
import org.sakaiproject.user.api.User;
public class ViewProfile extends BasePage {
private static final Logger log = Logger.getLogger(ViewProfile.class);
public ViewProfile(final String userUuid, final String tab) {
log.debug("ViewProfile()");
//setup model to store the actions in the modal windows
final FriendAction friendActionModel = new FriendAction();
//get current user info
User currentUser = sakaiProxy.getUserQuietly(sakaiProxy.getCurrentUserId());
final String currentUserId = currentUser.getId();
String currentUserType = currentUser.getType();
//double check, if somehow got to own ViewPage, redirect to MyProfile instead
if(userUuid.equals(currentUserId)) {
log.warn("ViewProfile: user " + userUuid + " accessed ViewProfile for self. Redirecting...");
throw new RestartResponseException(new MyProfile());
}
//check if super user, to grant editing rights to another user's profile
if(sakaiProxy.isSuperUser()) {
log.warn("ViewProfile: superUser " + currentUserId + " accessed ViewProfile for " + userUuid + ". Redirecting to allow edit.");
throw new RestartResponseException(new MyProfile(userUuid));
}
//post view event
sakaiProxy.postEvent(ProfileConstants.EVENT_PROFILE_VIEW_OTHER, "/profile/"+userUuid, false);
/* DEPRECATED via PRFL-24 when privacy was relaxed
if(!isProfileAllowed) {
throw new ProfileIllegalAccessException("User: " + currentUserId + " is not allowed to view profile for: " + userUuid);
}
*/
//get some values from User
User user = sakaiProxy.getUserQuietly(userUuid);
String userDisplayName = user.getDisplayName();
String userType = user.getType();
//init
final boolean friend;
boolean friendRequestToThisPerson = false;
boolean friendRequestFromThisPerson = false;
//friend?
friend = connectionsLogic.isUserXFriendOfUserY(userUuid, currentUserId);
//if not friend, has a friend request already been made to this person?
if(!friend) {
friendRequestToThisPerson = connectionsLogic.isFriendRequestPending(currentUserId, userUuid);
}
//if not friend and no friend request to this person, has a friend request been made from this person to the current user?
if(!friend && !friendRequestToThisPerson) {
friendRequestFromThisPerson = connectionsLogic.isFriendRequestPending(userUuid, currentUserId);
}
//privacy checks
final ProfilePrivacy privacy = privacyLogic.getPrivacyRecordForUser(userUuid);
boolean isFriendsListVisible = privacyLogic.isActionAllowed(userUuid, currentUserId, PrivacyType.PRIVACY_OPTION_MYFRIENDS);
boolean isKudosVisible = privacyLogic.isActionAllowed(userUuid, currentUserId, PrivacyType.PRIVACY_OPTION_MYKUDOS);
boolean isGalleryVisible = privacyLogic.isActionAllowed(userUuid, currentUserId, PrivacyType.PRIVACY_OPTION_MYPICTURES);
boolean isConnectionAllowed = sakaiProxy.isConnectionAllowedBetweenUserTypes(currentUserType, userType);
boolean isOnlineStatusVisible = privacyLogic.isActionAllowed(userUuid, currentUserId, PrivacyType.PRIVACY_OPTION_ONLINESTATUS);
final ProfilePreferences prefs = preferencesLogic.getPreferencesRecordForUser(userUuid);
/* IMAGE */
add(new ProfileImageRenderer("photo", userUuid, prefs, privacy, ProfileConstants.PROFILE_IMAGE_MAIN, true));
/* NAME */
Label profileName = new Label("profileName", userDisplayName);
add(profileName);
/* ONLINE PRESENCE INDICATOR */
if(prefs.isShowOnlineStatus() && isOnlineStatusVisible){
add(new OnlinePresenceIndicator("online", userUuid));
} else {
add(new EmptyPanel("online"));
}
/*STATUS PANEL */
ProfileStatusRenderer status = new ProfileStatusRenderer("status", userUuid, privacy, null, "tiny");
status.setOutputMarkupId(true);
add(status);
/* TABS */
List<ITab> tabs = new ArrayList<ITab>();
AjaxTabbedPanel tabbedPanel = new AjaxTabbedPanel("viewProfileTabs", tabs) {
private static final long serialVersionUID = 1L;
// overridden so we can add tooltips to tabs
@Override
protected WebMarkupContainer newLink(String linkId, final int index) {
WebMarkupContainer link = super.newLink(linkId, index);
if (ProfileConstants.TAB_INDEX_PROFILE == index) {
link.add(new AttributeModifier("title", true,
new ResourceModel("link.tab.profile.tooltip")));
} else if (ProfileConstants.TAB_INDEX_WALL == index) {
link.add(new AttributeModifier("title", true,
new ResourceModel("link.tab.wall.tooltip")));
}
return link;
}
};
Cookie tabCookie = getWebRequestCycle().getWebRequest().getCookie(ProfileConstants.TAB_COOKIE);
tabs.add(new AbstractTab(new ResourceModel("link.tab.profile")) {
private static final long serialVersionUID = 1L;
@Override
public Panel getPanel(String panelId) {
setTabCookie(ProfileConstants.TAB_INDEX_PROFILE);
return new ViewProfilePanel(panelId, userUuid, currentUserId,
privacy, friend);
}
});
if (true == sakaiProxy.isWallEnabledGlobally()) {
tabs.add(new AbstractTab(new ResourceModel("link.tab.wall")) {
private static final long serialVersionUID = 1L;
@Override
public Panel getPanel(String panelId) {
setTabCookie(ProfileConstants.TAB_INDEX_WALL);
return new ViewWallPanel(panelId, userUuid);
}
});
if (true == sakaiProxy.isWallDefaultProfilePage() && null == tabCookie) {
tabbedPanel.setSelectedTab(ProfileConstants.TAB_INDEX_WALL);
}
}
if (null != tab) {
tabbedPanel.setSelectedTab(Integer.parseInt(tab));
} else if (null != tabCookie) {
tabbedPanel.setSelectedTab(Integer.parseInt(tabCookie.getValue()));
}
add(tabbedPanel);
/* SIDELINKS */
WebMarkupContainer sideLinks = new WebMarkupContainer("sideLinks");
int visibleSideLinksCount = 0;
WebMarkupContainer addFriendContainer = new WebMarkupContainer("addFriendContainer");
//ADD FRIEND MODAL WINDOW
final ModalWindow addFriendWindow = new ModalWindow("addFriendWindow");
//FRIEND LINK/STATUS
final AjaxLink<Void> addFriendLink = new AjaxLink<Void>("addFriendLink") {
private static final long serialVersionUID = 1L;
public void onClick(AjaxRequestTarget target) {
addFriendWindow.show(target);
}
};
final Label addFriendLabel = new Label("addFriendLabel");
addFriendLink.add(addFriendLabel);
addFriendContainer.add(addFriendLink);
//setup link/label and windows
if(friend) {
addFriendLabel.setDefaultModel(new ResourceModel("text.friend.confirmed"));
addFriendLink.add(new AttributeModifier("class", true, new Model<String>("instruction icon connection-confirmed")));
addFriendLink.setEnabled(false);
} else if (friendRequestToThisPerson) {
addFriendLabel.setDefaultModel(new ResourceModel("text.friend.requested"));
addFriendLink.add(new AttributeModifier("class", true, new Model<String>("instruction icon connection-request")));
addFriendLink.setEnabled(false);
} else if (friendRequestFromThisPerson) {
//TODO (confirm pending friend request link)
//could be done by setting the content off the addFriendWindow.
//will need to rename some links to make more generic and set the onClick and setContent in here for link and window
addFriendLabel.setDefaultModel(new ResourceModel("text.friend.pending"));
addFriendLink.add(new AttributeModifier("class", true, new Model<String>("instruction icon connection-request")));
addFriendLink.setEnabled(false);
} else {
addFriendLabel.setDefaultModel(new StringResourceModel("link.friend.add.name", null, new Object[]{ user.getFirstName() } ));
addFriendWindow.setContent(new AddFriend(addFriendWindow.getContentId(), addFriendWindow, friendActionModel, currentUserId, userUuid));
}
sideLinks.add(addFriendContainer);
//ADD FRIEND MODAL WINDOW HANDLER
addFriendWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
private static final long serialVersionUID = 1L;
public void onClose(AjaxRequestTarget target){
if(friendActionModel.isRequested()) {
//friend was successfully requested, update label and link
addFriendLabel.setDefaultModel(new ResourceModel("text.friend.requested"));
addFriendLink.add(new AttributeModifier("class", true, new Model<String>("instruction icon connection-request")));
addFriendLink.setEnabled(false);
target.addComponent(addFriendLink);
}
}
});
add(addFriendWindow);
//hide connection link if not allowed
if(!isConnectionAllowed) {
addFriendContainer.setVisible(false);
} else {
visibleSideLinksCount++;
}
//hide entire list if no links to show
if(visibleSideLinksCount == 0) {
sideLinks.setVisible(false);
}
add(sideLinks);
/* KUDOS PANEL */
if(isKudosVisible) {
add(new AjaxLazyLoadPanel("myKudos"){
private static final long serialVersionUID = 1L;
@Override
public Component getLazyLoadComponent(String markupId) {
if(prefs.isShowKudos()){
int score = kudosLogic.getKudos(userUuid);
if(score > 0) {
return new KudosPanel(markupId, userUuid, currentUserId, score);
}
}
return new EmptyPanel(markupId);
}
});
} else {
add(new EmptyPanel("myKudos").setVisible(false));
}
/* FRIENDS FEED PANEL */
if(isFriendsListVisible) {
add(new AjaxLazyLoadPanel("friendsFeed") {
private static final long serialVersionUID = 1L;
@Override
public Component getLazyLoadComponent(String markupId) {
return new FriendsFeed(markupId, userUuid, currentUserId);
}
});
} else {
add(new EmptyPanel("friendsFeed").setVisible(false));
}
/* GALLERY FEED PANEL */
if (sakaiProxy.isProfileGalleryEnabledGlobally() && isGalleryVisible && prefs.isShowGalleryFeed()) {
add(new AjaxLazyLoadPanel("galleryFeed") {
private static final long serialVersionUID = 1L;
@Override
public Component getLazyLoadComponent(String markupId) {
return new GalleryFeed(markupId, userUuid, currentUserId).setOutputMarkupId(true);
}
});
} else {
add(new EmptyPanel("galleryFeed").setVisible(false));
}
}
/**
* This constructor is called if we have a pageParameters object containing the userUuid as an id parameter
* Just redirects to normal ViewProfile(String userUuid)
* @param parameters
*/
public ViewProfile(PageParameters parameters) {
this(parameters.getString(ProfileConstants.WICKET_PARAM_USERID), parameters.getString(ProfileConstants.WICKET_PARAM_TAB));
}
public ViewProfile(final String userUuid) {
this(userUuid, null);
}
}
| [
"sangee1229@gmail.com"
] | sangee1229@gmail.com | |
28577f4d1030b020c1e3b53a8ca12161d79a3d31 | 71b491ba1bc32a8bb5713cbe481f93bd4abb2fa5 | /app/src/main/java/com/datacomo/mc/spider/android/params/note/CloudNoteListParams.java | 7202f6973481f0022d22b2868842d4f501e6d71b | [] | no_license | niucong/MC_Spider_Android_Client_V2.0 | 1d26f16cafd1a15eab5528a3e44a281c3b39add1 | 02fc0d39f02a435839cde60bccc046fc20b0cc50 | refs/heads/master | 2020-12-03T06:45:17.513496 | 2017-06-30T01:57:27 | 2017-06-30T01:57:27 | 95,725,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,723 | java | package com.datacomo.mc.spider.android.params.note;
import android.content.Context;
import com.datacomo.mc.spider.android.params.BasicParams;
/**
* 获取云笔记列表
*
* @author datacomo-160
*
*/
public class CloudNoteListParams extends BasicParams {
/**
* 获取云笔记列表
*
* @param context
* @param noteType
* 1:自己创建的、2:社员分享、3:第三方同步过来的 如 “有道”等、4:所有的(创建+分享+第三方同步)、5:星标笔记
* @param isNoteBook
* 是否获取某个笔记本下的所有笔记 true:是(获取某个笔记本下的笔记)false:否(获取所有笔记)
* @param noteBookId
* 笔记本id 如果isNoteBook为true,则笔记本id不能为空,此查询就为查询某个笔记本下的所有笔记
* @param startRecord
* @param maxResults
*/
public CloudNoteListParams(Context context, String noteType,
String isNoteBook, String noteBookId, String startRecord,
String maxResults) {
super(context);
setVariable(noteType, isNoteBook, noteBookId, startRecord, maxResults);
}
/**
* 设置参数
*/
private void setVariable(String noteType, String isNoteBook,
String noteBookId, String startRecord, String maxResults) {
paramsMap.put("orderByType", "EDIT_TIME_DESC");
paramsMap.put("noteType", noteType);
paramsMap.put("isNoteBook", isNoteBook);
paramsMap.put("noteBookId", noteBookId);
paramsMap.put("startRecord", startRecord);
paramsMap.put("maxResults", maxResults);
paramsMap.put("noPaging", "false");
paramsMap.put("method", "getCloudNoteList");
super.setVariable(true);
}
@Override
public String getParams() {
return strParams;
}
}
| [
"niucong@julong.cc"
] | niucong@julong.cc |
8abdbd6a78603f3d5b58f76458b76804bfbb6b83 | 395ec2e58d732282deef1cad968fcb879e44cdfc | /src/main/java/com/mob/sachin/ev/BackActivity.java | d174a81e800ce636dd38b3162d5303b0374c4abf | [] | no_license | sedlabadkar/evending | c3db5b0ad01bc2b8730e99d1dbcbd83fa9e949ce | 857a1839e8b5381c0bee5779e5eaa33d21512b94 | refs/heads/master | 2021-01-11T00:27:33.163278 | 2016-10-11T04:26:52 | 2016-10-11T04:26:52 | 70,555,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 107 | java | package com.mob.sachin.ev;
/**
* Created by Ankit on 03-Apr-16.
*/
public class BackActivity {
}
| [
"sachinedlabadkar@gmail.com"
] | sachinedlabadkar@gmail.com |
d802248effdc19293d61718eeb59a7dc11e9876b | 2cd55320f5a43f4cc97228fc48a9228c25d952fa | /src/main/java/edu/ib/Test.java | c4e621a7dd42b1768c4fd714e665c3e697a12293 | [] | no_license | pwlzaw/ProjektTS | b1b5b5252d1857fe0ce5f1ab4a7999e01c253c76 | 31f1310768fc2a5f382b9e70014876e762ea3a72 | refs/heads/master | 2023-04-18T17:33:59.204054 | 2021-05-04T19:25:28 | 2021-05-04T19:25:28 | 364,363,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 39 | java | package edu.ib;
public class Test {
}
| [
"250038@student.pwr.edu.pl"
] | 250038@student.pwr.edu.pl |
6e7a62e513d93101ffec6baafc7ddf189e741622 | 420cfbd06e94e769dbe753c7af7340733d25a3d6 | /mainMenuController.java | 5888bdc410caeb59688017431f994d899a65e4ad | [] | no_license | Mayeesha1/213Proj4 | 193e2206fc0c9ad90cdb6be6209dca66d4256453 | bcc62c200fdb5942eae730a83fd3dde3217684bf | refs/heads/master | 2023-04-03T08:10:32.546904 | 2021-04-07T04:37:08 | 2021-04-07T04:37:08 | 353,893,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,548 | java | package application;
import java.util.ArrayList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.text.Text;
import javafx.stage.Stage;
/**
This class is the main connection to the RU Cafe Menu. There are four options to click
and see pop up windows containing information for different windows such as the donut
menu, the coffee menu, your orders, and store orders.
@author mayeesha, rebecca
*/
public class mainMenuController {
private OrderClass order;
ArrayList<MenuItem> itemlist;
private OrderClass currOrder = new OrderClass(itemlist);
private OrderClass tempOrder;
private StoreOrders totalOrders;
protected double finalPrice = 0;
protected int orderNumber = 0;
@FXML
private Button donutButton, coffeeButton, yourOrderButton, storeOrdersButton;
@FXML
private Text orderDonut, orderCoffee;
Alert errorAlert = new Alert(Alert.AlertType.ERROR);
Stage stage = new Stage();
/**
constructor to initialize arraylist
*/
public mainMenuController() {
this.order = new OrderClass(new ArrayList<>());
}
/**
adds the orders to the order menu.
*/
public void addToOrder(OrderClass menuItems){
this.currOrder = order;
for(MenuItem item: menuItems.getItems()){
currOrder.add(item);
if(item instanceof CoffeeClass){
finalPrice = finalPrice + ((CoffeeClass) item).getPrice();
}
if(item instanceof DonutClass){
finalPrice = finalPrice + ((DonutClass) item).getPrice();
}
currOrder.setTotalPrice(finalPrice);
}
}
/**
This method gets the final price
@return order
*/
public double getfinalPrice(){
return finalPrice;
}
/**
This method gets the order.
@return order
*/
public OrderClass getOrder(){
return currOrder;
}
/**
This method places the order.
*/
public void placeOrder(){
totalOrders.add(currOrder);
currOrder.setIncrement();
this.currOrder = new OrderClass(new ArrayList<>());
}
@FXML
/**
* Mouse Event Handler when clicking Coffee Button
@param event
*/
void coffeeMouseClick(MouseEvent event) {
try {
Parent root = FXMLLoader.load(getClass().getResource("CoffeeOrder.fxml"));
stage.setTitle("Coffee Order Menu");
stage.setScene(new Scene(root, 500, 500));
stage.show();
} catch (Exception e) {
errorAlert.setHeaderText("Error");
errorAlert.setContentText("Your coffee menu cannot be loaded. Please try again.");
errorAlert.show();
}
}
@FXML
/**
* Mouse Event Handler when clicking Donut Button
@param event
*/
void donutMouseClick(MouseEvent event) {
try {
Parent root = FXMLLoader.load(getClass().getResource("DonutOrder.fxml"));
stage.setTitle("Donut Order Menu");
stage.setScene(new Scene(root, 500, 500));
stage.show();
} catch (Exception e) {
errorAlert.setHeaderText("Error");
errorAlert.setContentText("Your donut menu cannot be loaded. Please try again.");
errorAlert.show();
}
}
@FXML
/**
* Mouse Event Handler when clicking Your Order Button
@param event
*/
void yourOrderClick(MouseEvent event) {
try {
Parent root = FXMLLoader.load(getClass().getResource("YourOrder.fxml"));
stage.setTitle("Your Order Menu");
stage.setScene(new Scene(root, 500, 500));
stage.show();
} catch (Exception e) {
errorAlert.setHeaderText("Error");
errorAlert.setContentText("Your order menu cannot be loaded. Please try again.");
errorAlert.show();
}
}
@FXML
/**
Mouse Event Handler when clicking Your Order Button
@param event
*/
void storeOrdersClick(MouseEvent event) {
try {
Parent root = FXMLLoader.load(getClass().getResource("StoreOrders.fxml"));
stage.setTitle("Your Store Orders");
stage.setScene(new Scene(root, 500, 500));
stage.show();
} catch (Exception e) {
errorAlert.setHeaderText("Error");
errorAlert.setContentText("Your store orders cannot be loaded. Please try again.");
errorAlert.show();
}
}
}
| [
"mm2744@scarletmail.rutgers.edu"
] | mm2744@scarletmail.rutgers.edu |
52719568b7b903c556e73763e0f4357d9666c6c4 | 20094eb4cc264f5336b162be9ba3c6f18ce9caf8 | /app/src/main/java/com/example/lesson1/MainActivity.java | 10f590d6b6a4da1c6f225f0574e7eae35de2a094 | [] | no_license | DolganovAnton13/LifeCycle | d98dbfc4c1e9edfa6cdf7ef2ba34a4613c3cf0db | 635652e7efb6fff5a339f2248ac1c0f445b18f98 | refs/heads/master | 2020-06-10T17:39:51.625293 | 2019-06-25T12:07:06 | 2019-06-25T12:07:06 | 193,695,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package com.example.lesson1;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
TextView text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (TextView) findViewById(R.id.textLifeCycle);
DataController data = new DataController();
LifeCycle lifeCycle = new LifeCycle(this,data);
LiveData<String> liveData = data.getData();
liveData.observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String value) {
text.setText(value);
}
});
getLifecycle().addObserver(lifeCycle);
}
}
| [
"toscha.17@mail.ru"
] | toscha.17@mail.ru |
ae97bc2028ce3aefbe1d3a6721de37e74f5c7ea5 | 7795c789da81763df60135ae24c1a72be877dd1c | /src/main/java/com/umut/service/model/GeoPosition.java | 3047ead9e26698b0dc28d3ff83ca798b1adfebc7 | [] | no_license | umutkocasarac/Test | e9c1e279b08494896b4fe2c990ea57609281020a | 5ad0791b5c475e0fcb2ad2b40b1ce90367a3cc87 | refs/heads/master | 2021-06-15T11:50:11.671386 | 2016-11-10T08:02:16 | 2016-11-10T08:02:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package com.umut.service.model;
public class GeoPosition {
private Double latitude;
private Double longitude;
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
}
| [
"umut.kocasarac@ardictech.com"
] | umut.kocasarac@ardictech.com |
99a8db04d8699deeeb63e170cc8b238d59e5d376 | 0ac05e3da06d78292fdfb64141ead86ff6ca038f | /OSWE/oswe/Manage/src/org/apache/jsp/jsp/mssql/database_jsp.java | c102349d9f3cc106a1ac8188709543ce5816ae98 | [] | no_license | qoo7972365/timmy | 31581cdcbb8858ac19a8bb7b773441a68b6c390a | 2fc8baba4f53d38dfe9c2b3afd89dcf87cbef578 | refs/heads/master | 2023-07-26T12:26:35.266587 | 2023-07-17T12:35:19 | 2023-07-17T12:35:19 | 353,889,195 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,327 | java | /* */ package org.apache.jsp.jsp.mssql;
/* */
/* */ import java.io.IOException;
/* */ import java.util.Map;
/* */ import javax.el.ExpressionFactory;
/* */ import javax.servlet.ServletConfig;
/* */ import javax.servlet.ServletException;
/* */ import javax.servlet.http.HttpServletRequest;
/* */ import javax.servlet.http.HttpServletResponse;
/* */ import javax.servlet.jsp.JspFactory;
/* */ import javax.servlet.jsp.JspWriter;
/* */ import javax.servlet.jsp.PageContext;
/* */ import org.apache.jasper.runtime.InstanceManagerFactory;
/* */ import org.apache.jasper.runtime.JspSourceDependent;
/* */
/* */ public final class database_jsp extends org.apache.jasper.runtime.HttpJspBase implements JspSourceDependent
/* */ {
/* 18 */ private static final JspFactory _jspxFactory = ;
/* */
/* */ private static Map<String, Long> _jspx_dependants;
/* */
/* */ private ExpressionFactory _el_expressionfactory;
/* */ private org.apache.tomcat.InstanceManager _jsp_instancemanager;
/* */
/* */ public Map<String, Long> getDependants()
/* */ {
/* 27 */ return _jspx_dependants;
/* */ }
/* */
/* */ public void _jspInit() {
/* 31 */ this._el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
/* 32 */ this._jsp_instancemanager = InstanceManagerFactory.getInstanceManager(getServletConfig());
/* */ }
/* */
/* */
/* */ public void _jspDestroy() {}
/* */
/* */
/* */ public void _jspService(HttpServletRequest request, HttpServletResponse response)
/* */ throws IOException, ServletException
/* */ {
/* 42 */ javax.servlet.http.HttpSession session = null;
/* */
/* */
/* 45 */ JspWriter out = null;
/* 46 */ Object page = this;
/* 47 */ JspWriter _jspx_out = null;
/* 48 */ PageContext _jspx_page_context = null;
/* */
/* */ try
/* */ {
/* 52 */ response.setContentType("text/html");
/* 53 */ PageContext pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
/* */
/* 55 */ _jspx_page_context = pageContext;
/* 56 */ javax.servlet.ServletContext application = pageContext.getServletContext();
/* 57 */ ServletConfig config = pageContext.getServletConfig();
/* 58 */ session = pageContext.getSession();
/* 59 */ out = pageContext.getOut();
/* 60 */ _jspx_out = out;
/* */ }
/* */ catch (Throwable t) {
/* 63 */ if (!(t instanceof javax.servlet.jsp.SkipPageException)) {
/* 64 */ out = _jspx_out;
/* 65 */ if ((out != null) && (out.getBufferSize() != 0))
/* 66 */ try { out.clearBuffer(); } catch (IOException e) {}
/* 67 */ if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
/* */ }
/* */ } finally {
/* 70 */ _jspxFactory.releasePageContext(_jspx_page_context);
/* */ }
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\ManageEngine\AppManager12\working\WEB-INF\lib\AdventNetAppManagerWebClient.jar!\org\apache\jsp\jsp\mssql\database_jsp.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"qoo7972365@gmail.com"
] | qoo7972365@gmail.com |
f803af09018fde18416af93bf2dbcbd43175b2f8 | c0d6ff616713c68b5437ea682c6d865e31bc58f5 | /SpringBoot/demoapplicationcontextexercise/src/main/java/me/aop/dao/UserDao.java | f7e60cf3199c093383f18afa4c110ae4d4c626da | [] | no_license | mike6321/Spring | 24662f00a5ab3f7b68c4e907db2fe8df688294a1 | 71fc04547738fe193aa5815adaccb2fee7198293 | refs/heads/master | 2023-03-04T08:54:17.364478 | 2022-03-20T12:49:13 | 2022-03-20T12:49:13 | 192,348,246 | 0 | 0 | null | 2023-02-22T07:55:05 | 2019-06-17T13:02:50 | Java | UTF-8 | Java | false | false | 404 | java | package me.aop.dao;
import me.aop.dto.User;
import java.util.List;
/**
* Project : demoapplicationcontextexercise
* Created by InteliJ IDE
* Developer : junwoochoi
* Date : 2020/03/23
* Time : 9:36 오후
*/
public interface UserDao {
public void add(User user);
public User get(String id);
public void deleteAll();
public List<User> getAll();
void update(User user);
}
| [
"33277588+mike6321@users.noreply.github.com"
] | 33277588+mike6321@users.noreply.github.com |
695b9dce5b7d29974987bee3e86acdf2117764cb | 15dcc37c0196f9d07f8516bc011f588e2f2fb4e3 | /4_Android_program/AirSync/gen/com/example/airsync/R.java | 8c075308d3914e6b0e06806d465755032a12048b | [] | no_license | FreyrChen/tucan_Linux_practice | 91e9b695c7314bcd63b7fdff81b7ee4ef79521e3 | 833f793372f33bc78b18b2186d9041aa98a53ad6 | refs/heads/master | 2021-05-29T18:27:27.431116 | 2014-08-13T10:00:50 | 2014-08-13T10:00:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,358 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.airsync;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int blue=0x7f02000b;
public static final int darkgray=0x7f020009;
public static final int ic_launcher=0x7f020000;
public static final int photo1=0x7f020001;
public static final int photo2=0x7f020002;
public static final int photo3=0x7f020003;
public static final int photo4=0x7f020004;
public static final int photo5=0x7f020005;
public static final int photo6=0x7f020006;
public static final int photo7=0x7f020007;
public static final int photo8=0x7f020008;
public static final int white=0x7f02000a;
}
public static final class id {
public static final int MainTextView1=0x7f070002;
public static final int MainTextView2=0x7f070003;
public static final int gallery=0x7f070001;
public static final int http_button=0x7f070005;
public static final int image_switcher_button=0x7f070006;
public static final int menu_settings=0x7f070008;
public static final int myLinearLayout1=0x7f070007;
public static final int show_picture_button=0x7f070004;
public static final int switcher=0x7f070000;
}
public static final class layout {
public static final int activity_image_switcher=0x7f030000;
public static final int activity_main=0x7f030001;
public static final int activity_surface=0x7f030002;
}
public static final class menu {
public static final int activity_main=0x7f060000;
}
public static final class string {
public static final int ShowPictureLable=0x7f040007;
public static final int alert_exit=0x7f04000b;
public static final int alert_message=0x7f040009;
public static final int alert_ok=0x7f04000a;
public static final int alert_title=0x7f040008;
public static final int app_name=0x7f040000;
public static final int hello_world=0x7f040001;
public static final int http_connect=0x7f040006;
public static final int image_switcher=0x7f04000c;
public static final int menu_settings=0x7f040002;
public static final int nothing=0x7f040003;
public static final int show_picture=0x7f040005;
public static final int start_info=0x7f040004;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
*/
public static final int AppBaseTheme=0x7f050000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f050001;
public static final int TextView1=0x7f050002;
public static final int TextView2=0x7f050003;
}
public static final class styleable {
/** Attributes that can be used with a Gallery.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #Gallery_android_galleryItemBackground com.example.airsync:android_galleryItemBackground}</code></td><td></td></tr>
</table>
@see #Gallery_android_galleryItemBackground
*/
public static final int[] Gallery = {
0x0101004c
};
/**
<p>This symbol is the offset where the {@link com.example.airsync.R.attr#android_galleryItemBackground}
attribute's value can be found in the {@link #Gallery} array.
@attr name android:android_galleryItemBackground
*/
public static final int Gallery_android_galleryItemBackground = 0;
};
}
| [
"tusion@163.com"
] | tusion@163.com |
d12bc8f5cbc0a8f499b04bf7ff8496db60c7ad38 | 7c1a2e945547365a8a1a256a89556ae79c9f789e | /src/OOD/principle/single_responsibility/Method.java | a9af9e1d9993cd90faddd6f1372b36edd4532b00 | [] | no_license | ycao860408/Data_Structrue_Algorithm | 26462c00c0e48d0e68d1cb62768909facf31a569 | 54ce1f37286761a62e7d34903357c785adc997f7 | refs/heads/master | 2023-07-03T19:16:42.725865 | 2021-07-29T01:25:51 | 2021-07-29T01:25:51 | 390,180,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 445 | java | package OOD.principle.single_responsibility;
public class Method {
/*public void buyPhoneAndCharger(String iphone, String charger) {
System.out.println("Buy iphone and charger");
} */// this is coupled version, which is not a good choice!
public void buyPhone(String iphone) {
System.out.println("Buy Iphone");
}
public void buyCharger(String charger) {
System.out.println("Buy charger");
}
}
| [
"39286519+ycao860408@users.noreply.github.com"
] | 39286519+ycao860408@users.noreply.github.com |
df7b267f4c162038702ed02d7d1accbbc5a52a68 | 1032fc9704afbc7979cbf56038aa4c26e5b20da9 | /src/com/my/package9/Demo373Writer.java | 59419ac63fc724c55f994def1a0e8c2b9f8b1156 | [] | no_license | smile-yz/test11 | ada449cffc5a55d135e39bb3581c62f40be9f32c | 9e4d9b7471cd3868919e389c3a8992eac9ba4027 | refs/heads/master | 2023-01-14T02:33:39.720246 | 2020-11-11T09:08:35 | 2020-11-11T09:08:35 | 311,918,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,201 | java | package com.my.package9;
import java.io.FileWriter;
/*
java.io.Writer:字符输出流,是所有字符输出流的最顶层的父类,是一个抽象类
共性的成员方法:
void write(int c)写入单个字符
void write(char[] cbuf) 写入字符数组
abstract void write(char[] cbuf,int off,int len)写入字符数组的某一部分,off数组的开始索引,len写的字符个数
void write(String str)写入字符串
void write(String str,int off,int len)写入字符串的某一部分,off数组的开始索引,len写的字符个数
void flush()刷新该流的缓冲
void close()关闭此流,但要先刷新它
java.io.FileWriter extends OutputStreamWrite extends Writer
FileWriter:文件字符输出流
作用:把内存中字符数据写入到文件中
构造方法:
FileWriter(File file)根据给定的File对象构造一个FileWriter对象
FiLeWriter(String name)根据给定的文件名构造一个FileWriter对象
*/
public class Demo373Writer {
public static void main(String[] args) throws Exception {
FileWriter fw = new FileWriter("C:\\Users\\yz\\Desktop\\共用图\\f.txt");
fw.write(97);
fw.flush();
fw.close();
}
}
| [
"1149392628@qq.com"
] | 1149392628@qq.com |
dca04123c179ddab8bbcf29d3db5eba766674cd2 | 98d313cf373073d65f14b4870032e16e7d5466f0 | /gradle-open-labs/example/src/main/java/se/molybden/Class19371.java | d01868497256769ee432868d3466b944382236c5 | [] | no_license | Molybden/gradle-in-practice | 30ac1477cc248a90c50949791028bc1cb7104b28 | d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3 | refs/heads/master | 2021-06-26T16:45:54.018388 | 2016-03-06T20:19:43 | 2016-03-06T20:19:43 | 24,554,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java |
public class Class19371{
public void callMe(){
System.out.println("called");
}
}
| [
"jocce.nilsson@gmail.com"
] | jocce.nilsson@gmail.com |
52e3bf856a71a5e7c2d942996f4d4168268d2de0 | aab0e71b26bb127623473c500d77f8da9023a54d | /src/test/java/com/piggy/PermissionTest.java | 157cd107e1b700ae8b331f92c947fb35514cacad | [] | no_license | Pig9ychen297/Shiro_Demo | 2d8d26bfd26def5fb6bfde4f62d0643736ec2980 | 30b5f55df5808957b59b332717783384c2dff76c | refs/heads/master | 2022-11-09T07:26:29.816170 | 2019-11-28T14:08:08 | 2019-11-28T14:08:08 | 224,664,944 | 0 | 0 | null | 2022-10-12T20:34:23 | 2019-11-28T13:58:34 | Java | UTF-8 | Java | false | false | 3,527 | java | //package com.piggy;
//
//import com.piggy.Realm.MyRealm;
//import com.piggy.Realm.PermissionRealm;
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.apache.shiro.SecurityUtils;
//import org.apache.shiro.authc.IncorrectCredentialsException;
//import org.apache.shiro.authc.UnknownAccountException;
//import org.apache.shiro.authc.UsernamePasswordToken;
//import org.apache.shiro.authz.UnauthorizedException;
//import org.apache.shiro.mgt.DefaultSecurityManager;
//import org.apache.shiro.realm.text.IniRealm;
//import org.apache.shiro.subject.Subject;
//import org.junit.Test;
//
//import java.util.Arrays;
//
//public class PermissionTest {
// private static Log log = LogFactory.getLog(ShiroTest.class);
//
// @Test
// public void testPermission(){
//// 判断用户是否拥有权限之前必须是在用户登录之后判断
// DefaultSecurityManager dsm = new DefaultSecurityManager();
//// IniRealm ir = new IniRealm("classpath:shiro-permission.ini");
// dsm.setRealm(new PermissionRealm());
// SecurityUtils.setSecurityManager(dsm);
// Subject subject = SecurityUtils.getSubject();
// UsernamePasswordToken token = new UsernamePasswordToken("zhangsan", "666");
// try {
// subject.login(token);
//
// } catch (UnknownAccountException e) {
// log.info("用户不存在");
// } catch (IncorrectCredentialsException e1) {
// log.info("密码不正确");
// }
//
//// 8. 判断是否认证成功
// boolean b = subject.isAuthenticated();
// if (b){
//// 表示认证登录成功,开始判断用户是否拥有角色身份
////
////// 第一种方式
////// 判断用户是否存在某个角色,返回true表示有,false表示没有
// log.info(subject.hasRole("role1"));
//// log.info(subject.hasAllRoles(Arrays.asList("role1","role2")));
//// log.info(Arrays.toString(subject.hasRoles(Arrays.asList("role1","role2","role3"))));
////
////// 第二种,如果有角色,无返回值,没有角色,直接报错
//// try{
//// subject.checkRole("role1");
//// log.info("role1角色存在");
//// subject.checkRoles("role1","role2","role3");
//// log.info("走到这里说明三个角色都有");
//// }catch (UnauthorizedException e){
//// log.info("相关用户不存在");
//// }
//
//
//// ---------------------------
//// 登录之后判断用户是否拥有权限
// log.info(subject.isPermitted("user:delete"));
//// 返回true表示全部拥有权限,false表示不全部有用
//// log.info(subject.isPermittedAll("user:update","user:delete"));
//// 返回一个boolean数组
//// log.info(Arrays.toString(subject.isPermitted("user:create","user:update","user:delete")));
//
//// 第二种是没有权限抛出异常
//// try{
//// subject.checkPermission("user:update");
//// log.info("拥有更新权限");
//// subject.checkPermission("user:select");
//// log.info("走到这里说明拥有查询权限");
//// }catch (UnauthorizedException e){
//// log.info("没有拥有相应的权限");
//// }
//
// }
//
//
// }
//}
| [
"陈源权pigchen297@gmail.com"
] | 陈源权pigchen297@gmail.com |
ebb7ecce046e468b7c37ecfab81dd63542a930a5 | aa7aecc14d141087fed12b823f9eca4ae8c6ae95 | /android/app/src/main/java/com/pokeprueba/MainApplication.java | 73537bc077777edb44e9f39d685e3655a4d684fa | [] | no_license | iKronyck/pokeprueba | a42e22b43e297dd3c199870974b43bceccb7f680 | 02b6e1ec0e441488ea1dcee16f7be4892fd809b7 | refs/heads/master | 2020-05-04T06:14:14.290345 | 2019-04-02T13:36:41 | 2019-04-02T13:36:41 | 179,001,571 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,024 | java | package com.pokeprueba;
import android.app.Application;
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.CallbackManager;
import com.facebook.react.ReactApplication;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import co.apptailor.googlesignin.RNGoogleSigninPackage;
import com.facebook.react.ReactNativeHost;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.database.RNFirebaseDatabasePackage;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
protected static CallbackManager getCallbackManager() {
return mCallbackManager;
}
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new FBSDKPackage(mCallbackManager),
new RNGoogleSigninPackage(),
new RNFirebasePackage(),
new RNFirebaseAuthPackage(),
new RNFirebaseDatabasePackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
// FacebookSdk.setApplicationId("2683729514977025");
// FacebookSdk.sdkInitialize(this);
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"thekronyck@gmail.com"
] | thekronyck@gmail.com |
552bc4299bf36300bb5d89b5f93a5d08ecf38d7d | d46960993ab338c169f7320f5728430e0b8d1f4a | /src/main/java/jenkins/plugins/startedbyenvvar/StartedByEnvVarContributor.java | b7d329116bfdf2f0bb359a623a514c47c402d533 | [] | no_license | jenkinsci/started-by-envvar-plugin | 847265861d91e10d9f14c0d9aa260aa6093784d0 | 8bf26e9caf3858d732278b1ef3035580410fcb90 | refs/heads/master | 2023-06-02T19:53:15.309110 | 2012-04-06T16:17:27 | 2012-04-06T16:17:27 | 2,732,737 | 0 | 1 | null | 2019-10-08T12:14:13 | 2011-11-08T09:53:55 | Java | UTF-8 | Java | false | false | 1,031 | java | package jenkins.plugins.startedbyenvvar;
import hudson.EnvVars;
import hudson.Extension;
import hudson.model.Cause;
import hudson.model.EnvironmentContributor;
import hudson.model.Run;
import hudson.model.TaskListener;
import org.acegisecurity.Authentication;
import java.io.IOException;
import java.lang.reflect.Field;
@Extension
public class StartedByEnvVarContributor extends EnvironmentContributor {
@Override
public void buildEnvironmentFor(Run r, EnvVars envs, TaskListener listener) throws IOException, InterruptedException {
Cause.UserCause cause = (Cause.UserCause) r.getCause(Cause.UserCause.class);
if (cause == null) return;
String name;
Field field = null;
try {
field = Cause.UserCause.class.getDeclaredField("authenticationName");
field.setAccessible(true);
name = (String) field.get(cause);
} catch (Exception e) {
name = cause.getUserName();
}
envs.put("JENKINS_STARTED_BY", name);
}
}
| [
"tom.huybrechts@gmail.com"
] | tom.huybrechts@gmail.com |
a95960ce062508b3b0ae5bfb188733ca315bd88e | 401cdbfc98b8cff762e1f2e279c23e46587c8073 | /src/controller/RegistrationFormController.java | cc6b8d546e972e7ebe4c65908fd3f03f8f1236f2 | [] | no_license | Mindula-Dilthushan/Royal-Institute | 96ba5d242449c2aa47c9928894b32432bebb783a | 61289769f368309ce3e5c5258c821cbd75a9757c | refs/heads/master | 2023-03-02T13:42:32.662642 | 2021-02-13T05:01:38 | 2021-02-13T05:01:38 | 336,513,878 | 13 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,652 | java | package controller;
import bo.BOFactory;
import bo.custom.AddRegistrationBO;
import bo.custom.CourseBO;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXComboBox;
import com.jfoenix.controls.JFXDatePicker;
import com.jfoenix.controls.JFXTextField;
import dto.CourseDTO;
import dto.RegistrationDTO;
import dto.StudentDTO;
import entity.Registration;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import tm.CourseTM;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
public class RegistrationFormController {
public JFXTextField txtStName;
public Label lblStID;
public RadioButton rbtnMale;
public RadioButton rbtnFemale;
public JFXDatePicker dpDate;
public JFXDatePicker dpStDOB;
public JFXTextField txtStAddress;
public JFXComboBox cmbCourseID;
public Label lblCourseID;
public JFXTextField txtCourseDuration;
public JFXTextField txtCourseFee;
public JFXTextField txtStMobileNumber;
public TableView <CourseTM>tblRegistration;
public TableColumn <CourseTM,String> colCourseID;
public TableColumn <CourseTM,String> colCourseName;
public TableColumn <CourseTM,String> colCourseDuration;
public TableColumn <CourseTM,Double> colCourseFee;
public JFXButton btnAdd;
public JFXButton btnRemove;
public JFXTextField txtTotal;
public JFXButton btnReg;
public Label lblRegID;
CourseBO courseBO = (CourseBO) BOFactory.getBoFactory().getSuperBO(BOFactory.BOType.COURSE);
AddRegistrationBO addRegistrationBO = (AddRegistrationBO) BOFactory.getBoFactory().getSuperBO(BOFactory.BOType.ADDREGISTRATION);
ObservableList<CourseTM> courseTMObservableList = FXCollections.observableArrayList();
List<CourseDTO> courseDTOList = null;
CourseDTO addCourses = null;
public void initialize(){
dpDate.setValue(LocalDate.now());
courseFeesTot();
tbl();
loadAllCourse();
genderToggleGroup();
}
private void courseFeesTot(){
courseTMObservableList.addListener((ListChangeListener.Change<? extends CourseTM> courseTot) -> {
double fees = 0;
for (CourseTM courseTM : courseTMObservableList){
fees += Double.parseDouble(String.valueOf(courseTM.getCoFee()));
}
txtTotal.setText(String.valueOf(fees));
});
}
private void loadAllCourse(){
try {
List<CourseDTO> courseDTOList0 = courseBO.getAll();
this.courseDTOList = courseDTOList0;
for (CourseDTO courseDTO : courseDTOList0){
cmbCourseID.getItems().add(courseDTO.getCourseName());
}
}catch (Exception e){
}
}
private void genderToggleGroup(){
ToggleGroup tgGender = new ToggleGroup();
rbtnMale.setToggleGroup(tgGender);
rbtnFemale.setToggleGroup(tgGender);
}
private void tbl(){
colCourseID.setCellValueFactory(new PropertyValueFactory<>("coId"));
colCourseName.setCellValueFactory(new PropertyValueFactory<>("coName"));
colCourseDuration.setCellValueFactory(new PropertyValueFactory<>("coDuration"));
colCourseFee.setCellValueFactory(new PropertyValueFactory<>("coFee"));
}
private void courseTextClear(){
lblCourseID.setText(null);
txtCourseDuration.setText(null);
txtCourseFee.setText(null);
}
public void cmbCourseIDOnAction(ActionEvent actionEvent) {
cmbCourseID.setValue("f");
// try {
// String coursesName = String.valueOf(cmbCourseID.getSelectionModel().getSelectedItem());
//
// CourseDTO selectCourses = null;
// for (CourseDTO courseDTO1 = courseDTOList){
// if (courseDTO1.getCourseName().compareToIgnoreCase(coursesName) == 0) {
// selectCourses = courseDTO1;
// this.addCourses = selectCourses;
// }
// }
// if (selectCourses != null) {
// lblCourseID.setText(selectCourses.getCourseId());
// txtCourseDuration.setText(selectCourses.getDuration());
// txtCourseFee.setText(String.valueOf(selectCourses.getCourseFee()));
// }
// }catch (Exception e){
//
// }
}
private StudentDTO selectStudentDTO(){
StudentDTO selectStDTO = new StudentDTO();
selectStDTO.setStudentId(lblStID.getText());
selectStDTO.setStudentName(txtStName.getText());
selectStDTO.setStudentAddress(txtStAddress.getText());
selectStDTO.setStudentContact(txtStMobileNumber.getText());
selectStDTO.setStudentDOB(String.valueOf(dpStDOB.getValue()));
if (rbtnMale.isSelected()){
selectStDTO.setStudentGender("Male");
}
if (rbtnFemale.isSelected()){
selectStDTO.setStudentGender("Female");
}
return selectStDTO;
}
public void btnAddOnAction(ActionEvent actionEvent) {
try{
if (addCourses !=null){
CourseTM courseTM = new CourseTM(
addCourses.getCourseId(),
addCourses.getCourseName(),
addCourses.getDuration(),
addCourses.getCourseFee()
);
courseTMObservableList.add(courseTM);
tblRegistration.refresh();
courseDTOList.remove(addCourses);
cmbCourseID.getItems().clear();
for (CourseDTO courseDTO : courseDTOList){
cmbCourseID.getItems().add(courseDTO.getCourseName());
}
courseTextClear();
addCourses = null;
}
}catch (Exception e){
}
}
public void btnRemoveOnAction(ActionEvent actionEvent) {
}
public void btnRegOnAction(ActionEvent actionEvent) {
try {
StudentDTO getSelectStudentDTO = selectStudentDTO();
List<CourseDTO> selectCourseDTOList = new ArrayList<>();
for (CourseTM courseTM : courseTMObservableList) {
selectCourseDTOList.add(
new CourseDTO(
courseTM.getCoId(),
courseTM.getCoName(),
courseTM.getCoDuration(),
courseTM.getCoFee()
)
);
}
List<RegistrationDTO> selectRegDTOList = new ArrayList<>();
for (CourseDTO courseDTO : selectCourseDTOList) {
selectRegDTOList.add(
new RegistrationDTO(
null,
String.valueOf(LocalDate.now()),
courseDTO.getCourseFee(),
selectStudentDTO(),
courseDTO
)
);
}
boolean savedAddRegistration = addRegistrationBO.addRegistration(
selectStudentDTO(),
selectRegDTOList
);
if (savedAddRegistration){
System.out.println("save");
}else {
System.out.println("no");
}
}catch (Exception e){
}
}
}
| [
"66836116+Mindula-Dilthushan@users.noreply.github.com"
] | 66836116+Mindula-Dilthushan@users.noreply.github.com |
cf1ceb6237f39e93ebf4e8c284ee654506249a3b | 0690a6dcf541028c9a37da548e45341319ca91ed | /src/main/java/compression/CompressionExample.java | a4073323e20bc5590d15ceb1a6716e951da99cb2 | [
"Apache-2.0"
] | permissive | buildupchao/HadoopLearning | 4aa4271c1a8b5db042015069580a43789e091746 | d12a443d5d9e4de354d597d9b12e3e3cd34e5a9c | refs/heads/master | 2021-10-22T17:25:35.739942 | 2019-03-12T03:48:25 | 2019-03-12T03:48:25 | 103,004,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,338 | java | package compression;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.CompressionOutputStream;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.util.ReflectionUtils;
public class CompressionExample {
public static void main(String[] args) throws IOException, ClassNotFoundException {
Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "Codec");
job.setJarByClass(CompressionExample.class);
String codecClassName = "org.apache.hadoop.io.compress.BZip2Codec";
// String codecClassName = "org.apache.hadoop.io.compress.GzipCodec";
Class<?> cls = Class.forName(codecClassName);
CompressionCodec codec = (CompressionCodec) ReflectionUtils.newInstance(cls, conf);
String inputFile = "/tmp/data";
String outFile = inputFile + codec.getDefaultExtension();
FileOutputStream fos = new FileOutputStream(outFile);
CompressionOutputStream out = codec.createOutputStream(fos);
FileInputStream in = new FileInputStream(inputFile);
IOUtils.copyBytes(in, out, 4096, false);
in.close();
out.close();
}
}
| [
"jangz@synnex.com"
] | jangz@synnex.com |
99d2f57124b3b368c2ea1fedd59a0d3b0c2fe133 | 1b229890eeb7abdac6b7843aff6c9adf2c04cdeb | /base/src/main/java/com/example/base/core/recyclerview/BaseViewHolder.java | 196637af8e6a3e18f9ec25fa6c7b7de06149e55e | [] | no_license | zongyangqu/MVVMProject | 1b91ec2838da063e192889f2742bc079f7d841a6 | 126290ac21c0c2955e4d0c5023a6f22689cc2baf | refs/heads/master | 2023-04-18T14:26:24.472564 | 2021-05-08T03:52:16 | 2021-05-08T03:52:16 | 365,214,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 678 | java | package com.example.base.core.recyclerview;
import android.view.View;
import com.example.base.core.customview.BaseCustomViewModel;
import com.example.base.core.customview.ICustomView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* Created by Allen on 2017/7/20.
* 保留所有版权,未经允许请不要分享到互联网和其他人
*/
public class BaseViewHolder extends RecyclerView.ViewHolder {
ICustomView view;
public BaseViewHolder(ICustomView view) {
super((View) view);
this.view = view;
}
public void bind(@NonNull BaseCustomViewModel item) {
view.setData(item);
}
} | [
"quzongyang@xiaohe.com"
] | quzongyang@xiaohe.com |
218d6c995dbdbe29e6f8c76d2fd38c43033082b3 | 58b02433f8a90b764e1ae905a5b5f040a73224ae | /src/main/java/service/MotivosNoCompraFacadeREST.java | ceccd6ce1dd00bb46d0e1342a6f44770f2853ac0 | [] | no_license | dimv901/restolympos | 2b304c079d2fcf389412d77d9ab84308a7885951 | b6c79d4fb35cf02a32434ba9191b040a67dfc03e | refs/heads/master | 2021-07-14T01:43:21.358201 | 2017-10-13T00:18:18 | 2017-10-13T00:18:18 | 106,758,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,885 | 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 service;
import entities.MotivosNoCompra;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import request.VendedorRequest;
import response.MotivosNoCompraResponse;
/**
*
* @author Diego
*/
@Stateless
@Path("entities.motivosnocompra")
public class MotivosNoCompraFacadeREST extends AbstractFacade<MotivosNoCompra> {
@PersistenceContext(unitName = "py.com.twisted_RestOlympos_war_1.0-SNAPSHOTPU")
private EntityManager em;
private static final Logger logger = LoggerFactory.getLogger(MotivosNoCompraFacadeREST.class);
public MotivosNoCompraFacadeREST() {
super(MotivosNoCompra.class);
}
@POST
@Override
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void create(MotivosNoCompra entity) {
super.create(entity);
}
@PUT
@Path("{id}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void edit(@PathParam("id") Integer id, MotivosNoCompra entity) {
super.edit(entity);
}
@DELETE
@Path("{id}")
public void remove(@PathParam("id") Integer id) {
super.remove(super.find(id));
}
@GET
@Path("{id}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public MotivosNoCompra find(@PathParam("id") Integer id) {
return super.find(id);
}
@GET
@Override
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List<MotivosNoCompra> findAll() {
return super.findAll();
}
@GET
@Path("{from}/{to}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List<MotivosNoCompra> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) {
return super.findRange(new int[]{from, to});
}
@GET
@Path("count")
@Produces(MediaType.TEXT_PLAIN)
public String countREST() {
return String.valueOf(super.count());
}
@Override
protected EntityManager getEntityManager() {
return em;
}
@POST
@Path("getMotivosNoCompra")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response getMotivosNoCompra(VendedorRequest vendedorRequest) {
logger.debug("Parametros Recibidos =>", vendedorRequest.toString());
MotivosNoCompraResponse motivosNoCompraResponse = new MotivosNoCompraResponse();
List<MotivosNoCompra> motivosNoCompraList = new ArrayList<>();
try {
motivosNoCompraList = super.findAll();
} catch (Exception e) {
logger.error("Error", e.getMessage());
}
if (motivosNoCompraList.isEmpty()) {
logger.error("Error", "No se pueden obtener los motivos de no compra");
motivosNoCompraResponse.setStatus(-100);
motivosNoCompraResponse.setMessage("No se pueden obtener los motivos de no compra");
return Response.ok(motivosNoCompraResponse).build();
}
motivosNoCompraResponse.setStatus(100);
motivosNoCompraResponse.setMessage("Sincronizacion exitosa");
motivosNoCompraResponse.getList().addAll(motivosNoCompraList);
return Response.ok(motivosNoCompraResponse).build();
}
}
| [
"diego.maldonado@unnaki.com.py"
] | diego.maldonado@unnaki.com.py |
6c45f26efbfecee754b6bc65a1b55a358a1fac79 | 4134a7d55abc8796d69868578f6585e711d234bc | /src/com/travelport/schema/hotel_v27_0/HotelSearchResult.java | 6a0d6d856df4ad56088b225b91d04e7d6a708414 | [] | no_license | pboza/shared | 34fe0bd310ccc8b0f737585850bba9d973407bee | 3b6d647df776119001b0c172925baf7351f3a064 | refs/heads/master | 2020-05-20T09:33:31.172505 | 2014-06-23T00:06:30 | 2014-06-23T00:06:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,414 | java |
package com.travelport.schema.hotel_v27_0;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import com.sun.xml.bind.Locatable;
import com.sun.xml.bind.annotation.XmlLocation;
import com.travelport.schema.common_v27_0.CorporateDiscountID;
import com.travelport.schema.common_v27_0.MediaItem;
import com.travelport.schema.common_v27_0.TypeResultMessage;
import com.travelport.schema.common_v27_0.VendorLocation;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.cxf.xjc.runtime.JAXBToStringStyle;
import org.xml.sax.Locator;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.travelport.com/schema/common_v27_0}VendorLocation" maxOccurs="unbounded" minOccurs="0"/>
* <element ref="{http://www.travelport.com/schema/hotel_v27_0}HotelProperty" maxOccurs="unbounded"/>
* <element name="HotelSearchError" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <simpleContent>
* <extension base="<http://www.travelport.com/schema/common_v27_0>typeResultMessage">
* <attribute name="RateSupplier" type="{http://www.travelport.com/schema/common_v27_0}typeThirdPartySupplier" />
* </extension>
* </simpleContent>
* </complexType>
* </element>
* <element ref="{http://www.travelport.com/schema/common_v27_0}CorporateDiscountID" maxOccurs="unbounded" minOccurs="0"/>
* <element ref="{http://www.travelport.com/schema/hotel_v27_0}RateInfo" maxOccurs="unbounded" minOccurs="0"/>
* <element ref="{http://www.travelport.com/schema/common_v27_0}MediaItem" minOccurs="0"/>
* <element ref="{http://www.travelport.com/schema/hotel_v27_0}HotelType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"vendorLocation",
"hotelProperty",
"hotelSearchError",
"corporateDiscountID",
"rateInfo",
"mediaItem",
"hotelType"
})
@XmlRootElement(name = "HotelSearchResult")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public class HotelSearchResult
implements Locatable
{
@XmlElement(name = "VendorLocation", namespace = "http://www.travelport.com/schema/common_v27_0")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected List<VendorLocation> vendorLocation;
@XmlElement(name = "HotelProperty", required = true)
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected List<HotelProperty> hotelProperty;
@XmlElement(name = "HotelSearchError")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected List<HotelSearchResult.HotelSearchError> hotelSearchError;
@XmlElement(name = "CorporateDiscountID", namespace = "http://www.travelport.com/schema/common_v27_0")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected List<CorporateDiscountID> corporateDiscountID;
@XmlElement(name = "RateInfo")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected List<RateInfo> rateInfo;
@XmlElement(name = "MediaItem", namespace = "http://www.travelport.com/schema/common_v27_0")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected MediaItem mediaItem;
@XmlElement(name = "HotelType")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected HotelType hotelType;
@XmlLocation
@XmlTransient
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected Locator locator;
/**
* Gets the value of the vendorLocation property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the vendorLocation property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getVendorLocation().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link VendorLocation }
*
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public List<VendorLocation> getVendorLocation() {
if (vendorLocation == null) {
vendorLocation = new ArrayList<VendorLocation>();
}
return this.vendorLocation;
}
/**
* The hotel property. Multiple property can only be supported with TRM and GDS property aggrigation.Gets the value of the hotelProperty property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the hotelProperty property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getHotelProperty().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link HotelProperty }
*
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public List<HotelProperty> getHotelProperty() {
if (hotelProperty == null) {
hotelProperty = new ArrayList<HotelProperty>();
}
return this.hotelProperty;
}
/**
* Gets the value of the hotelSearchError property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the hotelSearchError property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getHotelSearchError().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link HotelSearchResult.HotelSearchError }
*
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public List<HotelSearchResult.HotelSearchError> getHotelSearchError() {
if (hotelSearchError == null) {
hotelSearchError = new ArrayList<HotelSearchResult.HotelSearchError>();
}
return this.hotelSearchError;
}
/**
* Gets the value of the corporateDiscountID property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the corporateDiscountID property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCorporateDiscountID().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CorporateDiscountID }
*
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public List<CorporateDiscountID> getCorporateDiscountID() {
if (corporateDiscountID == null) {
corporateDiscountID = new ArrayList<CorporateDiscountID>();
}
return this.corporateDiscountID;
}
/**
* Gets the value of the rateInfo property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the rateInfo property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRateInfo().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link RateInfo }
*
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public List<RateInfo> getRateInfo() {
if (rateInfo == null) {
rateInfo = new ArrayList<RateInfo>();
}
return this.rateInfo;
}
/**
* Gets the value of the mediaItem property.
*
* @return
* possible object is
* {@link MediaItem }
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public MediaItem getMediaItem() {
return mediaItem;
}
/**
* Sets the value of the mediaItem property.
*
* @param value
* allowed object is
* {@link MediaItem }
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public void setMediaItem(MediaItem value) {
this.mediaItem = value;
}
/**
* Supported Providers:1P/1J
*
* @return
* possible object is
* {@link HotelType }
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public HotelType getHotelType() {
return hotelType;
}
/**
* Sets the value of the hotelType property.
*
* @param value
* allowed object is
* {@link HotelType }
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public void setHotelType(HotelType value) {
this.hotelType = value;
}
/**
* Generates a String representation of the contents of this type.
* This is an extension method, produced by the 'ts' xjc plugin
*
*/
@Override
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public String toString() {
return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE);
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public Locator sourceLocation() {
return locator;
}
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public void setSourceLocation(Locator newLocator) {
locator = newLocator;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <simpleContent>
* <extension base="<http://www.travelport.com/schema/common_v27_0>typeResultMessage">
* <attribute name="RateSupplier" type="{http://www.travelport.com/schema/common_v27_0}typeThirdPartySupplier" />
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public static class HotelSearchError
extends TypeResultMessage
{
@XmlAttribute(name = "RateSupplier")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
protected String rateSupplier;
/**
* Gets the value of the rateSupplier property.
*
* @return
* possible object is
* {@link String }
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public String getRateSupplier() {
return rateSupplier;
}
/**
* Sets the value of the rateSupplier property.
*
* @param value
* allowed object is
* {@link String }
*
*/
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public void setRateSupplier(String value) {
this.rateSupplier = value;
}
/**
* Generates a String representation of the contents of this type.
* This is an extension method, produced by the 'ts' xjc plugin
*
*/
@Override
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7")
public String toString() {
return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE);
}
}
}
| [
"pedro@boza.cl"
] | pedro@boza.cl |
4a82d9466aea0fb16ec0b8070b1942a5bee63e5f | 3c2a132acbb3615b66bd05adaea88936a028cc13 | /app/src/test/java/com/example/weathergo/ExampleUnitTest.java | 2d2a8a1b7864d339a00a4445da5df9a01febd3b6 | [] | no_license | witas8/WeatherGo | d90cb29381e18eea9c974268c378b05fcdadb250 | c3102f93991fd372811ac9a67c8c52df73bb3c31 | refs/heads/master | 2020-12-09T05:56:41.710613 | 2020-01-11T11:41:40 | 2020-01-11T11:41:40 | 233,213,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.example.weathergo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals( 4, 2 + 2 );
}
} | [
"witkowskimikolaj1@gmail.com"
] | witkowskimikolaj1@gmail.com |
de59e4a8312a8e87fd99fc8b53558d6f42502aca | 278021139ae28e050976c943215e47b3e5cc49f8 | /codeforce/395div/sep17/codefA.java | d1992a3b1a4c48bb1bddca5398a0c8c6abd73e3e | [] | no_license | anshratn1997/Competitive-Programming-DS-Algo | f8673a2a7d3868da14725ce9739abc53e65a7429 | 975566bc0780615acd24e2b10d408163474864c6 | refs/heads/master | 2022-12-02T21:52:12.060298 | 2020-08-23T15:34:57 | 2020-08-23T15:34:57 | 109,971,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,974 | java | import java.io.*;
import java.util.*;
import java.math.*;
public
class codefA{
static class Pair{
int key,value;
Pair(int key,int value){
this.key=key;
this.value=value;
}
int getKey(){
return key;
}
int getValue(){
return value;
}
}
static class mycomparator implements Comparator<Pair>{
@Override
public int compare(Pair o1,Pair o2){
Integer key1=o1.getKey(),key2=o2.getKey();
return key1.compareTo(key2);
}
}
//static variable
static final int mod = (int) 1e9 + 7;
static final double eps = 1e-6;
static final double pi = Math.PI;
static final long inf = Long.MAX_VALUE / 2;
static int ass[]=null;
static int max=-1;
ArrayList<Pair> arr=null;
BufferedReader br;
PrintWriter out;
public static void main(String[] args) {
new codefA().main1();
}
void main1()
{
try{
br=new BufferedReader(new InputStreamReader(System.in));
out=new PrintWriter(System.out);
int t=1;
t=ii();
while(t-->0){
//.................while loop start.
int n=ii();
int[] a=iint();
arr=new ArrayList<>();
for(int i=0;i<n;i++)
{
arr.add(new Pair(a[i],i));
}
Collections.sort(arr,new mycomparator());
Pair last=arr.get(n-1);
int ans[]=new int[n+1];
for (int i=0;i<n ;i++ ) {
Pair p=arr.get(i);
if(i!=n-1){
ans[p.getValue()]=(p.getKey()+last.getKey())%mod;
// System.out.println("fdsjf");
}
else{
ans[p.getValue()]=(arr.get(i-1).getKey()+p.getKey())%mod;}
int up_bd=Binary(mod-1-p.getKey());
// System.out.println("index : "+up_bd);
//System.out.println("ans: "+ans[p.getValue()]);
if(up_bd>=0){
if(up_bd!=i)
ans[p.getValue()]=Math.max((p.getKey()+arr.get(up_bd).getKey())%mod,ans[p.getValue()]);
else if(up_bd-1>=0)
ans[p.getValue()]=Math.max((p.getKey()+arr.get(up_bd-1).getKey())%mod,ans[p.getValue()]);
}
//System.out.println("ans: "+ans[p.getValue()]);
}
for (int i=0;i<n;i++) {
out.print(ans[i]+" ");
}
out.println();
// ..............while loop end
}
out.flush();
out.close();
}
catch(Exception e){
e.printStackTrace();}
}
//............required method to solve
int Binary(int key){
int l=0,r=arr.size()-1;
int mid=0;
while(r-l>1){
mid=l+(r-l)/2;
Pair p=arr.get(mid);
if(key>=p.getKey())
l=mid;
else
r=mid;
}
//System.out.println("l r "+l+" "+r);
return l;
}
//...........end of methods
//input method
int[] iint() throws IOException{
String line[]=br.readLine().split(" ");
int[] a=new int[line.length];
for (int i=0;i<line.length ;i++ ) {
a[i]=Integer.parseInt(line[i]);
max=Math.max(a[i],max);
}
return a;
}
long[] ilong() throws IOException{
String line[]=br.readLine().split(" ");
long[] a=new long[line.length];
for (int i=0;i<line.length ;i++ ) {
a[i]=Long.parseLong(line[i]);
}
return a;
}
double[] idouble() throws IOException{
String line[]=br.readLine().split(" ");
double[] a=new double[line.length];
for (int i=0;i<line.length ;i++ ) {
a[i]=Long.parseLong(line[i]);
}
return a;
}
long li() throws IOException{
return Long.parseLong(br.readLine());
}
int ii() throws IOException{
return Integer.parseInt(br.readLine());
}
double di() throws IOException{
return Double.parseDouble(br.readLine());
}
char ci() throws IOException{
return (char)br.read();
}
String si() throws IOException{
return br.readLine();
}
String[] isa(int n) throws IOException{
String at =si();
return at.split(" ");
}
double[][] idm(int n, int m) throws IOException{
double a[][] = new double[n][m];
for (int i = 0; i < n; i++) {
double[] temp=idouble();
for (int j = 0; j < m; j++) a[i][j] = temp[j];
}
return a;
}
int[][] iim(int n, int m) throws IOException{
int a[][] = new int[n][m];
for (int i = 0; i < n; i++) {
int[] temp=iint();
for (int j = 0; j < m; j++) a[i][j] =temp[j];
}
return a;
}
long[][] ilm(int n, int m) throws IOException{
long a[][] = new long[n][m];
for (int i = 0; i < n; i++) {
long[] temp=ilong();
for (int j = 0; j < m; j++) a[i][j] =temp[j];
}
return a;
}
} | [
"keshariratnesh9@gmail.com"
] | keshariratnesh9@gmail.com |
2fc5dabf50c91d53f1ecbebd34264bc80d96933b | e2dd89f684e13da11515eee0e933a0919fbd1821 | /app/src/main/java/com/example/haya/im/utils/encryption/MD5Util.java | dc1559cd3c5c7c6abb0cafe9a6c48219bc5de681 | [] | no_license | Hayaking/IM-For-Android | b843d7c377f6581637205abdf0fa02e8dec14815 | e5acf74338a892db4b1809391e4df83212836f0f | refs/heads/master | 2020-05-09T14:02:34.249334 | 2019-04-16T09:27:52 | 2019-04-16T09:27:52 | 181,179,452 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,099 | java | package com.example.haya.im.utils.encryption;
import java.security.MessageDigest;
public class MD5Util {
public static String MD5(String key) {
char hexDigits[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
try {
byte[] btInput = key.getBytes();
// 获得MD5摘要算法的 MessageDigest 对象
MessageDigest mdInst = MessageDigest.getInstance("MD5");
// 使用指定的字节更新摘要
mdInst.update(btInput);
// 获得密文
byte[] md = mdInst.digest();
// 把密文转换成十六进制的字符串形式
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
return new String(str);
} catch (Exception e) {
return null;
}
}
}
| [
"1028779917@qq.com"
] | 1028779917@qq.com |
933b2aa3cb4134835269f9efec7ea5165b132725 | fd8a7937a637d6f76b5bfc60a2f5e3da8d4e5e33 | /app/src/main/java/com/ptandon/wonderlist/CustomAdapter.java | 01f7bef4a888a3bedcdd7d7472fd865caf53fa11 | [
"Apache-2.0"
] | permissive | priyatandon/wonderlist_final | e5e4fd12596ce407483a1ee4b02d2aad452ee3d7 | 2f43d8b57977f9728536065449a7e3c84506fc3a | refs/heads/master | 2021-01-19T22:34:32.984731 | 2017-08-24T05:33:52 | 2017-08-24T05:33:52 | 101,256,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,791 | java | package com.ptandon.wonderlist;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class CustomAdapter extends ArrayAdapter{
private Context context;
private ArrayList<List> list;
public CustomAdapter(Context context, int textViewResourceId, ArrayList list) {
super(context,textViewResourceId, list);
this.context= context;
this.list=list;
}
private class ViewHolder
{
TextView listText;
TextView listDate;
TextView listPriority;
TextView listID;
TextView listBox;
TextView listTaskNote;
}
public View getView(int position, View convertView, ViewGroup parent)
{
ViewHolder holder=null;
if (convertView == null)
{
LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.custom_row, null);
holder = new ViewHolder();
holder.listText = (TextView) convertView.findViewById(R.id.listText);
holder.listDate = (TextView) convertView.findViewById(R.id.listDate);
holder.listID = (TextView) convertView.findViewById(R.id.list_ID);
holder.listPriority=(TextView) convertView.findViewById(R.id.listPriority);
holder.listBox=(TextView) convertView.findViewById(R.id.colorBox);
holder.listTaskNote=(TextView) convertView.findViewById(R.id.listTaskNote);
convertView.setTag(holder);
}
else {
holder = (ViewHolder) convertView.getTag();
}
List newList= list.get(position);
long dt=newList.getDueDate();
dt=dt*1000;
String dateString = new SimpleDateFormat("MM/dd/yyyy").format(new Date(dt));
holder.listText.setText(newList.getTodoText());
holder.listDate.setText(dateString);
holder.listPriority.setText(newList.getPriority());
holder.listID.setText(String.valueOf(newList.getId()));
holder.listTaskNote.setText(String.valueOf(newList.getTaskNote()));
String priority=holder.listPriority.getText().toString();
if(priority.equals("HIGH")) {
holder.listBox.setBackgroundColor(Color.RED);
}
else if (priority.equals("MEDIUM")) {
holder.listBox.setBackgroundColor(Color.GREEN);
}
else if(priority.equals("LOW")) {
holder.listBox.setBackgroundColor(Color.YELLOW);
}
return convertView;
}
}
| [
"priya.engg@gmail.com"
] | priya.engg@gmail.com |
e2d2a4306debc6c85687adf95f39ed3f0f3c4e3c | 8e66ede9647136334cd9918882438510736cf428 | /src/testClasses/test2/B1.java | 1a2f31532710a698c59f8daedb81d68eedf674c4 | [] | no_license | ishan10/cmpe202_UMLParser | b70b21125b33caa80b36576f48151e61c45f964e | bddb6a2f7ae9719015c3a240323eccb14658cf67 | refs/heads/master | 2021-01-19T12:43:26.651295 | 2017-05-13T23:15:10 | 2017-05-13T23:15:10 | 82,335,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 79 | java | package testClasses.test2;
public class B1 extends P implements A1 {
}
| [
"Ishan Pandya"
] | Ishan Pandya |
93e7d0366a1ff416ae5dba4a81d0360db995d44f | 81478dc4eb159ab5f35e1d02064b71d5f6df5b79 | /app/src/main/java/com/barnettwong/quyou/ui/fragment/MovieFragment.java | 8bdf23d7d6edf45267e17a0956da7f8efaf7134d | [
"MIT",
"Apache-2.0"
] | permissive | zsx8888/youqu_master | db3a4fa47c65dfc742646a417335b9346b016099 | 94abee28d0b1851bfc53b3550256b4041a1f49b1 | refs/heads/master | 2020-07-20T23:54:00.651262 | 2019-03-25T14:04:48 | 2019-03-25T14:04:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,919 | java | package com.barnettwong.quyou.ui.fragment;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import com.barnettwong.quyou.R;
import com.barnettwong.quyou.app.AppConstant;
import com.barnettwong.quyou.bean.video.VideoChannelTable;
import com.barnettwong.quyou.bean.video.VideosChannelTableManager;
import com.barnettwong.quyou.util.MyUtils;
import com.dueeeke.videoplayer.player.VideoViewManager;
import com.jaydenxiao.common.base.BaseFragment;
import com.jaydenxiao.common.base.BaseFragmentAdapter;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* Created by wang on 2018/12/25 14:58
* 视频主fragment
*/
public class MovieFragment extends BaseFragment{
@BindView(R.id.tabs)
TabLayout tabs;
@BindView(R.id.view_pager)
ViewPager viewPager;
private BaseFragmentAdapter fragmentAdapter;
private VideoViewManager mVideoViewManager;
@Override
protected int getLayoutResource() {
return R.layout.fragment_movie;
}
@Override
public void initPresenter() {
}
@Override
protected void initView() {
mVideoViewManager = VideoViewManager.instance();
List<String> channelNames = new ArrayList<>();
List<VideoChannelTable> videoChannelTableList = VideosChannelTableManager.loadVideosChannelsMine();
List<Fragment> mNewsFragmentList = new ArrayList<>();
for (int i = 0; i < videoChannelTableList.size(); i++) {
channelNames.add(videoChannelTableList.get(i).getChannelName());
mNewsFragmentList.add(createListFragments(videoChannelTableList.get(i)));
}
fragmentAdapter = new BaseFragmentAdapter(getChildFragmentManager(), mNewsFragmentList, channelNames);
viewPager.setAdapter(fragmentAdapter);
tabs.setupWithViewPager(viewPager);
MyUtils.dynamicSetTabLayoutMode(tabs);
setPageChangeListener();
}
private void setPageChangeListener() {
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
mVideoViewManager.stopPlayback();//切换时直接停止播放
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
private MovieTypeFragment createListFragments(VideoChannelTable videoChannelTable) {
MovieTypeFragment fragment = new MovieTypeFragment();
Bundle bundle = new Bundle();
bundle.putString(AppConstant.VIDEO_TYPE, videoChannelTable.getChannelId());
fragment.setArguments(bundle);
return fragment;
}
}
| [
"1300497680@qq.com"
] | 1300497680@qq.com |
d889827125376881a4e3dc47bc6f96520f72ad19 | f55ccc57c13fb500d01e16fce01d57709ae11ebf | /iplookup/src/test/java/com/svds/example/accesslog/Test_When_Parsing_The_CommandLine_With_Valid_Options.java | a7dd207059ea3dcf7b195654ddfe5bdfb7a44436 | [] | no_license | RyanMagnusson/com.svds.example | 69ce03997bd2ef7969314440dffaf887e41f9ecc | 070c876804c5f9224899034f7c0f34ba1c06cba6 | refs/heads/master | 2021-01-22T14:33:04.888648 | 2015-02-11T04:37:13 | 2015-02-11T04:37:13 | 30,329,081 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,974 | java | package com.svds.example.accesslog;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import com.svds.example.accesslog.AppConfig.Argument;
public class Test_When_Parsing_The_CommandLine_With_Valid_Options {
private static final String PATH_TO_DATABASE = "/Users/junit/data/geolocations.sqlite";
private static final String PATH_TO_INPUT_FILE = "/tmp/access.log";
private static final String PATH_TO_OUTPUT_FILE = "access_log.out";
private static final String[] COMMAND_LINE = {"--output",PATH_TO_OUTPUT_FILE,"--database",PATH_TO_DATABASE,"--input",PATH_TO_INPUT_FILE, "--maxmind", "--pipe"};
private Map<Argument, String> parsedResults;
@Before
public void setUp() throws Exception {
parsedResults = AppConfig.parse(COMMAND_LINE);
}
@Test
public void Then_It_Should_Return_The_Correct_Path_For_The_Database_File() {
assertTrue(parsedResults.containsKey(Argument.DATABASE_FILE));
assertEquals(PATH_TO_DATABASE, parsedResults.get(Argument.DATABASE_FILE));
}
@Test
public void Then_It_Should_Return_The_Correct_Path_For_The_Input_File() {
assertTrue(parsedResults.containsKey(Argument.INPUT_FILE));
assertEquals(PATH_TO_INPUT_FILE, parsedResults.get(Argument.INPUT_FILE));
}
@Test
public void Then_It_Should_Return_The_Correct_Path_For_The_Output_File() {
assertTrue(parsedResults.containsKey(Argument.OUTPUT_FILE));
assertEquals(PATH_TO_OUTPUT_FILE, parsedResults.get(Argument.OUTPUT_FILE));
}
@Test
public void Then_It_Should_Return_To_Use_The_MaxMind_Local_Database() {
assertTrue(parsedResults.containsKey(Argument.USE_MAXMIND));
assertEquals("true", parsedResults.get(Argument.USE_MAXMIND));
}
@Test
public void Then_It_Should_Return_To_Use_The_PipeDelimited_Format() {
assertTrue(parsedResults.containsKey(Argument.USE_MAXMIND));
assertEquals("true", parsedResults.get(Argument.USE_MAXMIND));
}
}
| [
"ryan.magnusson@gmail.com"
] | ryan.magnusson@gmail.com |
640ffa975e1b1e8597f30305c0ae8f67e08937f8 | c3cc996382f5efa52fb3b9faf0125b234e27b4df | /test/icu/mianshi/openjdk/service/ICompilerService.java | 8313409c3f28349c9101d935c7da9b1d739ab8be | [] | no_license | lijd1995/java14compiler | 42f5c556e753329a788cbe6070b7659dd9ec771f | 1de1328aa01854eeaca40936485aeff944d6ba67 | refs/heads/master | 2023-03-15T14:48:24.040568 | 2020-04-23T05:33:09 | 2020-04-23T05:33:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java | package icu.mianshi.openjdk.service;
public interface ICompilerService {
String getServiceAddressUrl();
}
| [
"rolan@microsoft.com"
] | rolan@microsoft.com |
056c1486940f2087d83675bf7d9e99ad9c72f305 | b8bd715ee674d3b5438160046dc18002a92705ce | /app/src/main/java/com/example/utsavstha/feedapp/utils/rxUtils/RxSchedulers.java | 16c22bd3d8c5d3f651dd488c91d6b9bda88d1c72 | [] | no_license | utsavstha/FeedApp | 4206520df122a446bdf242dd9deb570f82c64645 | 3ac10f504be2eaa0303a4f701dc5af0d1e8b9bf8 | refs/heads/master | 2020-12-02T11:34:31.673511 | 2017-07-13T01:30:31 | 2017-07-13T01:30:31 | 96,654,219 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package com.example.utsavstha.feedapp.utils.rxUtils;
import rx.Scheduler;
/**
* Created by utsavstha on 7/9/17.
*/
public interface RxSchedulers {
Scheduler runOnBackground();
Scheduler io();
Scheduler compute();
Scheduler androidThread();
Scheduler internet();
}
| [
"ushrestha@qpay.com.np"
] | ushrestha@qpay.com.np |
2b21f528aa873540352c004142cd5f6a562a6261 | 34e2c4c6a91afef7605fe0c368c2bfabefb99d68 | /myapplicationkukai/src/main/java/com/kkkcut/www/myapplicationkukai/entity/Detection.java | 1b0bce953ca5fbdfd0f2db675b30b0bd93354586 | [] | no_license | 317056658/SecAndroidApp | 357270ac8b38c57f569a7f74e0483ad19db076ad | 3d67e520e39a5cc7409df8a6b514eecf504c04d8 | refs/heads/master | 2020-05-15T14:40:19.704729 | 2018-02-24T01:52:10 | 2018-02-24T01:52:10 | 83,790,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package com.kkkcut.www.myapplicationkukai.entity;
/**
* Created by Administrator on 2018/1/16.
* 检测类
*/
public class Detection {
public static final int MODE_NO_DETECT=0; //不检测
public static final int MODE_UP_DOWN_LOCATION=1; //上下定位
public static final int MODE_BOTHSIDE_LOCATION=2; //两边定位
public static final int MODE_FRONTEND_LOCATION=3; //前端定位
public static final int MODE_THREETERMINAL_LOCATION=4; //三端定位
}
| [
"317056658@qq.com"
] | 317056658@qq.com |
f3bf48bced2dd2cdd2b43de243971373cf4f8f86 | 4fb59c1337c8784c1cd37aa3268863bfafc6cd96 | /src/main/java/main/CreateHtmlUtils.java | 7564a0ab7d24dafbd7fac02d0c372ad4aae37d9d | [] | no_license | phoenix1911/FreemarkerDemo | de7f6f54ce8838b1c5c5d0b097d133e2e1fd3851 | b03dbf7aea5651342720bc85bdc484fd4f689f41 | refs/heads/master | 2020-04-27T11:12:18.663654 | 2019-03-07T06:54:41 | 2019-03-07T06:54:41 | 174,287,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,551 | java | package main;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Tjl on 2019/3/7 14:26.
*/
public class CreateHtmlUtils {
/**
* 通过freemarker生成静态HTML页面
* @param templateName 模版名称
* @param targetFileName 模版生成后的文件名
* @param map freemarker生成的数据都存储在MAP中,
* @创建时间:2017年10月22日21:41:06
*/
public static void createHtml(String templateName, String targetFileName, Map<String, Object> map) throws Exception{
//创建fm的配置
Configuration config = new Configuration();
//指定默认编码格式
config.setDefaultEncoding("UTF-8");
//设置模版文件的路径
config.setClassForTemplateLoading(CreateHtmlUtils.class, "/ftl");
//获得模版包
Template template = config.getTemplate(templateName);
//从参数文件中获取指定输出路径 ,路径示例:C:/Workspace/shop-test/src/main/webapp/html
String path = "C:\\Users\\JiaLong\\Documents\\IdeaProject\\FreemarkerDemo\\src\\main\\webapp\\html";
//定义输出流,注意必须指定编码
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(path+"/"+targetFileName)),"UTF-8"));
//生成模版
template.process(map, writer);
}
public static void main(String[] args) throws Exception {
Map<String, Object> map = new HashMap<>();
//map的key在ftl中这么用 ${hello}
map.put("hello", "Hello World!");
map.put("aaa","Freemarker 是一款模板引擎,是一种基于模版生成静态文件的通用 工具,它是为Java程序员提供的一个开发包,或者说是一个类库,它不是面向最终用户的,而是为程序员提供了一款可以嵌入他们开发产品的应用程序。\n" +
"\n" +
" Freemarker 是使用纯java编写的,为了提高页面的访问速度,需要把页面静态化, 那么Freemarker就是被用来生成html页面。\n" +
"\n" +
" 到目前为止,Freemarker使用越来越广泛,不光光只是它强大的生成技术,而且它能够与spring进行很好的集成。\n" );
CreateHtmlUtils.createHtml("html.ftl","createhtmldemo.html" , map);
}
}
| [
"thisistjl@outlook.com"
] | thisistjl@outlook.com |
40f75f4bdd76928217a5c18c0107a2bde0d157a0 | 5cc3b051e592b4f38679c86365cb4290d726debc | /java/server/src/org/openqa/grid/internal/cli/CommonCliOptions.java | e3e45d6ab07b6072b1dd78e6652855a622cf4448 | [
"Apache-2.0"
] | permissive | narayananpalani/selenium | faa41c870ad92db1a69f6fa9f7f9fa8988835337 | 90216e938f4ffda83c3afd1fca901069d6a1fc1b | refs/heads/master | 2021-04-12T10:04:05.994491 | 2017-02-27T15:03:44 | 2018-03-25T16:43:56 | 126,752,137 | 1 | 1 | Apache-2.0 | 2018-03-26T00:18:50 | 2018-03-26T00:18:49 | null | UTF-8 | Java | false | false | 4,895 | java | // Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.openqa.grid.internal.cli;
import com.beust.jcommander.Parameter;
import org.openqa.grid.internal.utils.configuration.StandaloneConfiguration;
public abstract class CommonCliOptions {
@Parameter(
names = {"--version", "-version"},
description = "Displays the version and exits."
)
// initially defaults to false from boolean primitive type
public Boolean version = false;
@Parameter(
names = {"--help", "-help", "-h"},
help = true,
hidden = true,
description = "Displays this help."
)
// Initially defaults to false from boolean primitive type
public Boolean help = false;
/**
* Enable {@code LogLevel.FINE} log messages. Default {@code false}.
*/
@Parameter(
names = {"--debug", "-debug"},
description = "<Boolean> : enables LogLevel.FINE."
)
private Boolean debug = false;
/**
* Filename to use for logging. Defaults to {@code null}.
*/
@Parameter(
names = "-log",
description = "<String> filename : the filename to use for logging. If omitted, will log to STDOUT"
)
private String log;
/**
* Server role. Default determined by configuration type.
*/
@Parameter(
names = "-role",
description = "<String> options are [hub], [node], or [standalone]."
)
private String role;
/**
* Port to bind to. Default determined by configuration type.
*/
@Parameter(
names = {"-port"},
description = "<Integer> : the port number the server will use."
)
private Integer port;
/**
* Client timeout. Default 1800 sec.
*/
@Parameter(
names = {"-timeout", "-sessionTimeout"},
description = "<Integer> in seconds : Specifies the timeout before the server automatically kills a session that hasn't had any activity in the last X seconds. The test slot will then be released for another test to use. This is typically used to take care of client crashes. For grid hub/node roles, cleanUpCycle must also be set."
)
private Integer timeout;
/**
* Browser timeout. Default 0 (indefinite wait).
*/
@Parameter(
names = "-browserTimeout",
description = "<Integer> in seconds : number of seconds a browser session is allowed to hang while a WebDriver command is running (example: driver.get(url)). If the timeout is reached while a WebDriver command is still processing, the session will quit. Minimum value is 60. An unspecified, zero, or negative value means wait indefinitely."
)
private Integer browserTimeout;
@Parameter(
names = {"-avoidProxy"},
description = "DO NOT USE: Hack to allow selenium 3.0 server run in SauceLabs",
hidden = true
)
// initially defaults to false from boolean primitive type
private Boolean avoidProxy;
/**
* Max threads for Jetty. Defaults to {@code null}.
*/
@Parameter(
names = {"-jettyThreads", "-jettyMaxThreads"},
description = "<Integer> : max number of threads for Jetty. An unspecified, zero, or negative value means the Jetty default value (200) will be used."
)
private Integer jettyMaxThreads;
@Parameter(
names = "-browserSideLog",
description = "DO NOT USE: Provided for compatibility with 2.0",
hidden = true
)
// initially defaults to false from boolean primitive type
private Boolean browserSideLog = false;
@Parameter(
names = "-captureLogsOnQuit",
description = "DO NOT USE: Provided for compatibility with 2.0",
hidden = true
)
// initially defaults to false from boolean primitive type
private Boolean captureLogsOnQuit = false;
void fillCommonConfiguration(StandaloneConfiguration configuration) {
if (debug != null) {
configuration.debug = debug;
}
if (log != null) {
configuration.log = log;
}
if (port != null) {
configuration.port = port;
}
if (timeout != null) {
configuration.timeout = timeout;
}
if (browserTimeout != null) {
configuration.browserTimeout = browserTimeout;
}
}
abstract public StandaloneConfiguration toConfiguration();
}
| [
"barancev@gmail.com"
] | barancev@gmail.com |
8c8407c015a95f48b5ae59ea309ec1e930950104 | dae9579afd4889f3ef4f21db740105852f4d8c70 | /app/src/main/java/com/example/bilge/recyclerviewkullanm/Product.java | 20dce43ce0b302fafdc6549a96b4aa75d4f341b7 | [] | no_license | blgylmz/RecyclerViewKullanm | 215f088c05bbe2e008cd7f88d72c2326109a579e | 1ae765b5e72a39e57e0635ca2a2f3b0e6913b41e | refs/heads/master | 2020-04-30T23:02:41.569011 | 2019-03-22T12:15:36 | 2019-03-22T12:15:36 | 177,134,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,805 | java | package com.example.bilge.recyclerviewkullanm;
import java.util.ArrayList;
public class Product {
private String productName;
private String productDescription;
private int imageID;
public Product(){
}
public Product(int imageID, String productName,String productDescription){
this.imageID=imageID;
this.productDescription=productDescription;
this.productName=productName;
}
public int getImageID() {
return imageID;
}
public void setImageID(int imageID) {
this.imageID = imageID;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductDescription() {
return productDescription;
}
public void setProductDescription(String productDescription) {
this.productDescription = productDescription;
}
public static ArrayList<Product> getData(){
ArrayList<Product> productList = new ArrayList<Product>();
int productImages[] ={R.drawable.bloggr, R.drawable.deviantart,R.drawable.digg,R.drawable.email,R.drawable.facebook,R.drawable.google_plus,R.drawable.instagram,R.drawable.linkedin,R.drawable.twitter,R.drawable.youtube,R.drawable.pinterest,R.drawable.share};
String[] productNames = {"Blogger","Devinart","Digg","Email","Facebook","Google Plus","İnstagram","Linkedin","Twitter","Youtube","Pinterest", "Share"};
for (int i=0;i<productImages.length;i++){
Product temp = new Product();
temp.setImageID(productImages[i]);
temp.setProductName(productNames[i]);
temp.setProductDescription("Sosyal Medya");
productList.add(temp);
}
return productList;
}
}
| [
"bilgeyilmaz22@gmail.com"
] | bilgeyilmaz22@gmail.com |
a1e5d532d9706e637c347f0b792b5b1e61bbf679 | 579682524c8a8fb0cb94a949f7f9281b29237e5a | /zgksystem-web-war/src/main/java/cn/thinkjoy/zgk/zgksystem/controller/DataDictionaryController.java | 46358e4043a791b4651b082b5973d61029efa294 | [] | no_license | Wandering/zgk_system | b93c355c1d14f35aaeddb5caed845c055ba89edf | a2e72e36516f6d537f3ad1f4dacefd9dbae92429 | refs/heads/master | 2020-12-31T07:54:30.505375 | 2016-05-16T03:16:03 | 2016-05-16T03:16:03 | 86,541,113 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,932 | java | package cn.thinkjoy.zgk.zgksystem.controller;
import cn.thinkjoy.common.exception.BizException;
import cn.thinkjoy.zgk.zgksystem.common.ERRORCODE;
import cn.thinkjoy.zgk.zgksystem.domain.*;
import cn.thinkjoy.zgk.zgksystem.service.dataDictionary.IDataDictionaryService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* Created by yhwang on 15/10/19.
*/
@Controller
@RequestMapping("/system/dataDictionary")
public class DataDictionaryController {
@Autowired
private IDataDictionaryService iDataDictionaryService;
/**
* 按照市ID获取市下的所
* @param request
* @return
*/
@RequestMapping(value = "findAreaList",method = RequestMethod.GET)
@ResponseBody
public List<Area> findAreaList(HttpServletRequest request){
List<Area> areas = iDataDictionaryService.findAreaList();
return areas;
}
@RequestMapping(value = "findProvinceList",method = RequestMethod.GET)
@ResponseBody
public List<Province> findProvinceList(){
return iDataDictionaryService.findProvinceList();
}
@RequestMapping(value = "findCityList",method = RequestMethod.GET)
@ResponseBody
public List<City> findCityList(HttpServletRequest request){
String provinceId = request.getParameter("provinceId");
if(StringUtils.isBlank(provinceId)){
throw new BizException(ERRORCODE.PARAM_ISNULL.getCode(),ERRORCODE.PARAM_ISNULL.getMessage());
}
return iDataDictionaryService.findCityList(Long.valueOf(provinceId));
}
@RequestMapping(value = "findCountyList",method = RequestMethod.GET)
@ResponseBody
public List<County> findCountyList(HttpServletRequest request){
String cityId = request.getParameter("cityId");
if(StringUtils.isBlank(cityId)){
throw new BizException(ERRORCODE.PARAM_ISNULL.getCode(),ERRORCODE.PARAM_ISNULL.getMessage());
}
return iDataDictionaryService.findCountyList(Long.valueOf(cityId));
}
/**
* 根据区域id获取学校列表
* @param request
* @return
*/
@RequestMapping(value = "findSchoolList",method = RequestMethod.GET)
@ResponseBody
public List<School> findSchoolList(HttpServletRequest request){
String areaId = request.getParameter("areaId");
if(StringUtils.isBlank(areaId)){
throw new BizException(ERRORCODE.PARAM_ISNULL.getCode(),ERRORCODE.PARAM_ISNULL.getMessage());
}
return iDataDictionaryService.findSchoolList(Long.valueOf(areaId));
}
}
| [
"hzuo@thinkjoy.cn"
] | hzuo@thinkjoy.cn |
8e0764d51f03b4182a2770fc255671b8b8e496de | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/19/19_f3d0f48c5902a9c9f5c2ec08519c2eb1ee40a58f/CCNLibrary/19_f3d0f48c5902a9c9f5c2ec08519c2eb1ee40a58f_CCNLibrary_t.java | 8d41d2583e563cfd85fa2d712245a3465814e603 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 28,362 | java | package com.parc.ccn.library;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.InvalidParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Security;
import java.security.SignatureException;
import java.util.ArrayList;
import java.util.Random;
import javax.xml.stream.XMLStreamException;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import com.parc.ccn.CCNBase;
import com.parc.ccn.Library;
import com.parc.ccn.config.ConfigurationException;
import com.parc.ccn.data.ContentName;
import com.parc.ccn.data.ContentObject;
import com.parc.ccn.data.MalformedContentNameStringException;
import com.parc.ccn.data.content.Collection;
import com.parc.ccn.data.content.Link;
import com.parc.ccn.data.content.LinkReference;
import com.parc.ccn.data.query.BloomFilter;
import com.parc.ccn.data.query.ExcludeComponent;
import com.parc.ccn.data.query.ExcludeElement;
import com.parc.ccn.data.query.ExcludeFilter;
import com.parc.ccn.data.query.Interest;
import com.parc.ccn.data.security.KeyLocator;
import com.parc.ccn.data.security.PublisherPublicKeyDigest;
import com.parc.ccn.data.security.SignedInfo.ContentType;
import com.parc.ccn.library.io.repo.RepositoryOutputStream;
import com.parc.ccn.library.profiles.VersioningProfile;
import com.parc.ccn.network.CCNNetworkManager;
import com.parc.ccn.security.keys.KeyManager;
/**
* An implementation of the basic CCN library.
* rides on top of the CCNBase low-level interface. It uses
* CCNNetworkManager to interface with a "real" virtual CCN,
* and KeyManager to interface with the user's collection of
* signing and verification keys.
*
* Need to expand get-side interface to allow querier better
* access to signing information and trust path building.
*
* @author smetters,rasmussen
*
* * <META> tag under which to store metadata (either on name or on version)
* <V> tag under which to put versions
* n/<V>/<number> -> points to header
* <B> tag under which to put actual fragments
* n/<V>/<number>/<B>/<number> -> fragments
* n/<latest>/1/2/... has pointer to latest version
* -- use latest to get header of latest version, otherwise get via <v>/<n>
* configuration parameters:
* blocksize -- size of chunks to fragment into
*
* get always reconstructs fragments and traverses links
* can getLink to get link info
*
*/
public class CCNLibrary extends CCNBase {
public static byte[] CCN_reserved_markers = { (byte)0xC0, (byte)0xC1, (byte)0xF5,
(byte)0xF6, (byte)0xF7, (byte)0xF8, (byte)0xF9, (byte)0xFA, (byte)0xFB, (byte)0xFC,
(byte)0xFD, (byte)0xFE};
static {
Security.addProvider(new BouncyCastleProvider());
}
protected static CCNLibrary _library = null;
/**
* Do we want to do this this way, or everything static?
*/
protected KeyManager _userKeyManager = null;
/**
* For nonce generation
*/
protected static Random _random = new Random();
public static CCNLibrary open() throws ConfigurationException, IOException {
synchronized (CCNLibrary.class) {
try {
return new CCNLibrary();
} catch (ConfigurationException e) {
Library.logger().severe("Configuration exception initializing CCN library: " + e.getMessage());
throw e;
} catch (IOException e) {
Library.logger().severe("IO exception initializing CCN library: " + e.getMessage());
throw e;
}
}
}
public static CCNLibrary getLibrary() {
if (null != _library)
return _library;
try {
return createCCNLibrary();
} catch (ConfigurationException e) {
Library.logger().warning("Configuration exception attempting to create library: " + e.getMessage());
Library.warningStackTrace(e);
throw new RuntimeException("Error in system configuration. Cannot create library.",e);
} catch (IOException e) {
Library.logger().warning("IO exception attempting to create library: " + e.getMessage());
Library.warningStackTrace(e);
throw new RuntimeException("Error in system IO. Cannot create library.",e);
}
}
protected static synchronized CCNLibrary
createCCNLibrary() throws ConfigurationException, IOException {
if (null == _library) {
_library = new CCNLibrary();
}
return _library;
}
protected CCNLibrary(KeyManager keyManager) {
_userKeyManager = keyManager;
// force initialization of network manager
try {
_networkManager = new CCNNetworkManager();
} catch (IOException ex){
Library.logger().warning("IOException instantiating network manager: " + ex.getMessage());
ex.printStackTrace();
_networkManager = null;
}
}
protected CCNLibrary() throws ConfigurationException, IOException {
this(KeyManager.getDefaultKeyManager());
}
/*
* For testing only
*/
protected CCNLibrary(boolean useNetwork) {}
public void setKeyManager(KeyManager keyManager) {
if (null == keyManager) {
Library.logger().warning("StandardCCNLibrary::setKeyManager: Key manager cannot be null!");
throw new IllegalArgumentException("Key manager cannot be null!");
}
_userKeyManager = keyManager;
}
public KeyManager keyManager() { return _userKeyManager; }
public PublisherPublicKeyDigest getDefaultPublisher() {
return keyManager().getDefaultKeyID();
}
/**
* DKS -- TODO -- collection and link functions move to collection and link, respectively
* @throws IOException
* @throws NoSuchAlgorithmException
* @throws SignatureException
* @throws InvalidKeyException
*/
public Link put(ContentName name, LinkReference target) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, IOException {
return put(name, target, null, null, null);
}
public Link put(
ContentName name,
LinkReference target,
PublisherPublicKeyDigest publisher, KeyLocator locator,
PrivateKey signingKey) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, IOException {
if (null == signingKey)
signingKey = keyManager().getDefaultSigningKey();
if (null == locator)
locator = keyManager().getKeyLocator(signingKey);
if (null == publisher) {
publisher = keyManager().getPublisherKeyID(signingKey);
}
try {
Link link = new Link(VersioningProfile.versionName(name), target,
publisher, locator, signingKey);
put(link);
return link;
} catch (XMLStreamException e) {
Library.logger().warning("Cannot canonicalize a standard container!");
Library.warningStackTrace(e);
throw new IOException("Cannot canonicalize a standard container!");
}
}
/**
* The following 3 methods create a Collection with the argument references,
* put it, and return it. Note that fragmentation is not handled.
*
* @param name
* @param references
* @return
* @throws SignatureException
* @throws IOException
*/
public Collection put(ContentName name, LinkReference [] references) throws SignatureException, IOException {
return put(name, references, getDefaultPublisher());
}
public Collection put(ContentName name, LinkReference [] references, PublisherPublicKeyDigest publisher)
throws SignatureException, IOException {
try {
return put(name, references, publisher, null, null);
} catch (InvalidKeyException e) {
Library.logger().warning("Default key invalid.");
Library.warningStackTrace(e);
throw new SignatureException(e);
} catch (NoSuchAlgorithmException e) {
Library.logger().warning("Default key has invalid algorithm.");
Library.warningStackTrace(e);
throw new SignatureException(e);
}
}
public Collection put(
ContentName name,
LinkReference[] references,
PublisherPublicKeyDigest publisher, KeyLocator locator,
PrivateKey signingKey) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, IOException {
if (null == signingKey)
signingKey = keyManager().getDefaultSigningKey();
if (null == locator)
locator = keyManager().getKeyLocator(signingKey);
if (null == publisher) {
publisher = keyManager().getPublisherKeyID(signingKey);
}
try {
Collection collection = new Collection(VersioningProfile.versionName(name), references,
publisher, locator, signingKey);
put(collection);
return collection;
} catch (XMLStreamException e) {
Library.logger().warning("Cannot canonicalize a standard container!");
Library.warningStackTrace(e);
throw new IOException("Cannot canonicalize a standard container!");
}
}
public Collection put(
ContentName name,
ContentName[] references) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, IOException {
return put(name, references, null, null, null);
}
public Collection put(
ContentName name,
ContentName[] references,
PublisherPublicKeyDigest publisher) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, IOException {
return put(name, references, publisher, null, null);
}
public Collection put(
ContentName name,
ContentName[] references,
PublisherPublicKeyDigest publisher, KeyLocator locator,
PrivateKey signingKey) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, IOException {
LinkReference[] lrs = new LinkReference[references.length];
for (int i = 0; i < lrs.length; i++)
lrs[i] = new LinkReference(references[i]);
return put(name, lrs, publisher, locator, signingKey);
}
/**
*
* @param name - ContentName
* @param timeout - milliseconds
* @return
* @throws IOException
* @throws XMLStreamException
*/
public Collection getCollection(ContentName name, long timeout) throws IOException, XMLStreamException {
ContentObject co = getLatestVersion(name, null, timeout);
if (null == co)
return null;
if (co.signedInfo().getType() != ContentType.DATA)
throw new IOException("Content is not data, so can't be a collection.");
Collection collection = Collection.contentToCollection(co);
return collection;
}
/**
* Use the same publisherID that we used originally.
* @throws IOException
* @throws SignatureException
* @throws XMLStreamException
* @throws InvalidKeyException
*/
public Collection createCollection(
ContentName name,
ContentName [] references, PublisherPublicKeyDigest publisher, KeyLocator locator,
PrivateKey signingKey) throws IOException, SignatureException,
XMLStreamException, InvalidKeyException {
LinkReference[] lrs = new LinkReference[references.length];
for (int i = 0; i < references.length; i++) {
lrs[i] = new LinkReference(references[i]);
}
return createCollection(name, lrs, publisher, locator, signingKey);
}
public Collection createCollection(
ContentName name,
LinkReference [] references, PublisherPublicKeyDigest publisher, KeyLocator locator,
PrivateKey signingKey) throws IOException, SignatureException,
XMLStreamException, InvalidKeyException {
if (null == signingKey)
signingKey = keyManager().getDefaultSigningKey();
if (null == locator)
locator = keyManager().getKeyLocator(signingKey);
if (null == publisher) {
publisher = keyManager().getPublisherKeyID(signingKey);
}
return new Collection(name, references, publisher, locator, signingKey);
}
public Collection addToCollection(
Collection collection,
ContentName [] references) throws IOException, SignatureException,
XMLStreamException, InvalidKeyException {
ArrayList<LinkReference> contents = collection.contents();
for (ContentName reference : references)
contents.add(new LinkReference(reference));
return updateCollection(collection, contents, null, null, null);
}
public ContentObject removeFromCollection(
Collection collection,
ContentName [] references) throws IOException, SignatureException,
XMLStreamException, InvalidKeyException {
ArrayList<LinkReference> contents = collection.contents();
for (ContentName reference : references)
contents.remove(new LinkReference(reference));
return updateCollection(collection, contents, null, null, null);
}
public ContentObject updateCollection(
Collection collection,
ContentName [] referencesToAdd,
ContentName [] referencesToRemove) throws IOException, SignatureException,
XMLStreamException, InvalidKeyException {
ArrayList<LinkReference> contents = collection.contents();
for (ContentName reference : referencesToAdd)
contents.add(new LinkReference(reference));
for (ContentName reference : referencesToRemove)
contents.remove(new LinkReference(reference));
return updateCollection(collection, contents, null, null, null);
}
/**
* Create a Collection with the next version name and the input
* references and put it. Note that this can't handle fragmentation.
*
* @param oldCollection
* @param references
* @return
* @throws XMLStreamException
* @throws IOException
* @throws SignatureException
* @throws InvalidKeyException
*/
private Collection updateCollection(Collection oldCollection, ArrayList<LinkReference> references,
PublisherPublicKeyDigest publisher, KeyLocator locator,
PrivateKey signingKey) throws XMLStreamException, IOException,
InvalidKeyException, SignatureException {
LinkReference[] newReferences = new LinkReference[references.size()];
references.toArray(newReferences);
Collection updatedCollection = createCollection(VersioningProfile.versionName(oldCollection.name()),
newReferences, publisher, locator, signingKey);
put(updatedCollection);
return updatedCollection;
}
public Link createLink(
ContentName name,
ContentName linkName, PublisherPublicKeyDigest publisher, KeyLocator locator,
PrivateKey signingKey) throws IOException, SignatureException,
XMLStreamException, InvalidKeyException {
if (null == signingKey)
signingKey = keyManager().getDefaultSigningKey();
if (null == locator)
locator = keyManager().getKeyLocator(signingKey);
if (null == publisher) {
publisher = keyManager().getPublisherKeyID(signingKey);
}
return new Link(name, linkName, publisher, locator, signingKey);
}
/**
* Return the link itself, not the content
* pointed to by a link.
* @param name the identifier for the link to work on
* @return returns null if not a link, or name refers to more than one object
* @throws IOException
* @throws SignatureException
* @throws IOException
*/
public Link getLink(ContentName name, long timeout) throws IOException {
ContentObject co = getLatestVersion(name, null, timeout);
if (co.signedInfo().getType() != ContentType.LINK)
throw new IOException("Content is not a link reference");
Link reference = new Link();
try {
reference.decode(co.content());
} catch (XMLStreamException e) {
// Shouldn't happen
e.printStackTrace();
}
return reference;
}
/**
* Turn ContentObject of type link into a LinkReference
* @param co ContentObject
* @return
* @throws IOException
*/
public Link decodeLinkReference(ContentObject co) throws IOException {
if (co.signedInfo().getType() != ContentType.LINK)
throw new IOException("Content is not a collection");
Link reference = new Link();
try {
reference.decode(co.content());
} catch (XMLStreamException e) {
// Shouldn't happen
e.printStackTrace();
}
return reference;
}
/**
* Deference links and collections
* DKS TODO -- should it dereference collections?
* @param content
* @param timeout
* @return
* @throws IOException
* @throws XMLStreamException
*/
public ArrayList<ContentObject> dereference(ContentObject content, long timeout) throws IOException, XMLStreamException {
ArrayList<ContentObject> result = new ArrayList<ContentObject>();
if (null == content)
return null;
if (content.signedInfo().getType() == ContentType.LINK) {
Link link = Link.contentToLinkReference(content);
ContentObject linkCo = dereferenceLink(link, content.signedInfo().getPublisherKeyID(), timeout);
if (linkCo == null) {
return null;
}
result.add(linkCo);
} else if (content.signedInfo().getType() == ContentType.DATA) {
try {
Collection collection = Collection.contentToCollection(content);
if (null != collection) {
ArrayList<LinkReference> al = collection.contents();
for (LinkReference lr : al) {
ContentObject linkCo = dereferenceLink(lr, content.signedInfo().getPublisherKeyID(), timeout);
if (linkCo != null)
result.add(linkCo);
}
if (result.size() == 0)
return null;
} else { // else, not a collection
result.add(content);
}
} catch (XMLStreamException xe) {
// not a collection
result.add(content);
}
} else {
result.add(content);
}
return result;
}
/**
* Try to get the content referenced by the link. If it doesn't exist directly,
* try to get the latest version below the name.
*
* @param reference
* @param publisher
* @param timeout
* @return
* @throws IOException
*/
private ContentObject dereferenceLink(LinkReference reference, PublisherPublicKeyDigest publisher, long timeout) throws IOException {
ContentObject linkCo = get(reference.targetName(), timeout);
if (linkCo == null)
linkCo = getLatestVersion(reference.targetName(), publisher, timeout);
return linkCo;
}
private ContentObject dereferenceLink(Link reference, PublisherPublicKeyDigest publisher, long timeout) throws IOException {
ContentObject linkCo = get(reference.getTargetName(), timeout);
if (linkCo == null)
linkCo = getLatestVersion(reference.getTargetName(), publisher, timeout);
return linkCo;
}
/**
* Things are not as simple as this. Most things
* are fragmented. Maybe make this a simple interface
* that puts them back together and returns a byte []?
* DKS TODO -- doesn't use publisher
* @throws IOException
*/
public ContentObject getLatestVersion(ContentName name, PublisherPublicKeyDigest publisher, long timeout) throws IOException {
if (VersioningProfile.isVersioned(name)) {
return getVersionInternal(name, timeout);
} else {
ContentName firstVersionName = VersioningProfile.versionName(name, VersioningProfile.baseVersion());
return getVersionInternal(firstVersionName, timeout);
}
}
final byte OO = (byte) 0x00;
final byte FF = (byte) 0xFF;
private ContentObject getVersionInternal(ContentName name, long timeout) throws InvalidParameterException, IOException {
ContentName parent = VersioningProfile.versionRoot(name);
byte [] version;
if (name.count() > parent.count())
version = name.component(parent.count());
else
// For getLatest to work we need a final component to get the latest of...
version = VersioningProfile.FIRST_VERSION_MARKER;
name = ContentName.fromNative(parent, version);
int versionComponent = name.count() - 1;
// initially exclude name components just before the first version
byte [] start = new byte [] { VersioningProfile.VERSION_MARKER, OO, FF, FF, FF, FF, FF };
while (true) {
ContentObject co = getLatest(name, acceptVersions(start), timeout);
if (co == null)
return null;
if (VersioningProfile.isVersionOf(co.name(), parent))
// we got a valid version!
return co;
start = co.fullName().component(versionComponent);
}
}
/**
* Builds an Exclude filter that excludes components before or @ start, and components after
* the last valid version.
* @param start
* @return An exclude filter.
* @throws InvalidParameterException
*/
protected ExcludeFilter acceptVersions(byte [] start) {
ArrayList<ExcludeElement> ees;
ees = new ArrayList<ExcludeElement>();
ees.add(BloomFilter.matchEverything());
ees.add(new ExcludeComponent(start));
ees.add(new ExcludeComponent(new byte [] {
VersioningProfile.VERSION_MARKER+1, OO, OO, OO, OO, OO, OO } ));
ees.add(BloomFilter.matchEverything());
ExcludeFilter ef = new ExcludeFilter(ees);
return ef;
}
public ContentObject get(ContentName name, long timeout) throws IOException {
Interest interest = new Interest(name);
return get(interest, timeout);
}
/**
* Return data the specified number of levels below us in the
* hierarchy
*
* @param name
* @param level
* @param timeout
* @return
* @throws IOException
*/
public ContentObject getLower(ContentName name, int level, long timeout) throws IOException {
Interest interest = new Interest(name);
interest.additionalNameComponents(level);
return get(interest, timeout);
}
/**
* Return data the specified number of levels below us in the
* hierarchy, with order preference leftmost.
* DKS -- this might need to move to Interest.
* @param name
* @param level
* @param timeout
* @return
* @throws IOException
*/
public ContentObject getLeftmostLower(ContentName name, int level, long timeout) throws IOException {
Interest interest = new Interest(name);
interest.additionalNameComponents(level);
interest.orderPreference(Interest.ORDER_PREFERENCE_ORDER_NAME | Interest.ORDER_PREFERENCE_LEFT);
return get(interest, timeout);
}
/**
* Enumerate matches below query name in the hierarchy
* TODO: maybe filter out fragments, possibly other metadata.
* TODO: add in communication layer to talk just to
* local repositories for v 2.0 protocol.
* @param query
* @param timeout - microseconds
* @return
* @throws IOException
*/
public ArrayList<ContentObject> enumerate(Interest query, long timeout) throws IOException {
ArrayList<ContentObject> result = new ArrayList<ContentObject>();
Integer prefixCount = query.nameComponentCount() == null ? query.name().components().size()
: query.nameComponentCount();
// This won't work without a correct order preference
query.orderPreference(Interest.ORDER_PREFERENCE_ORDER_NAME | Interest.ORDER_PREFERENCE_LEFT);
while (true) {
ContentObject co = null;
co = get(query, timeout == NO_TIMEOUT ? 5000 : timeout);
if (co == null)
break;
Library.logger().info("enumerate: retrieved " + co.name() +
" digest: " + ContentName.componentPrintURI(co.contentDigest()) + " on query: " + query.name() + " prefix count: " + prefixCount);
result.add(co);
query = Interest.next(co, prefixCount);
}
Library.logger().info("enumerate: retrieved " + result.size() + " objects.");
return result;
}
/**
* Approaches to read and write content. Low-level CCNBase returns
* a specific piece of content from the repository (e.g.
* if you ask for a fragment, you get a fragment). Library
* customers want the actual content, independent of
* fragmentation. Can implement this in a variety of ways;
* could verify fragments and reconstruct whole content
* and return it all at once. Could (better) implement
* file-like API -- open opens the header for a piece of
* content, read verifies the necessary fragments to return
* that much data and reads the corresponding content.
* Open read/write or append does?
*
* DKS: TODO -- state-based put() analogous to write()s in
* blocks; also state-based read() that verifies. Start
* with state-based read.
*/
public RepositoryOutputStream repoOpen(ContentName name,
KeyLocator locator, PublisherPublicKeyDigest publisher)
throws IOException, XMLStreamException {
return new RepositoryOutputStream(name, locator, publisher, this);
}
/**
* Medium level interface for retrieving pieces of a file
*
* getNext - get next content after specified content
*
* @param name - ContentName for base of get
* @param prefixCount - next follows components of the name
* through this count.
* @param omissions - ExcludeFilter
* @param timeout - milliseconds
* @return
* @throws MalformedContentNameStringException
* @throws IOException
* @throws InvalidParameterException
*/
public ContentObject getNext(ContentName name, byte[][] omissions, long timeout)
throws IOException {
return get(Interest.next(name, omissions, null), timeout);
}
public ContentObject getNext(ContentName name, long timeout)
throws IOException, InvalidParameterException {
return getNext(name, null, timeout);
}
public ContentObject getNext(ContentName name, int prefixCount, long timeout)
throws IOException, InvalidParameterException {
return get(Interest.next(name, prefixCount), timeout);
}
public ContentObject getNext(ContentObject content, int prefixCount, byte[][] omissions, long timeout)
throws IOException {
return getNext(contentObjectToContentName(content, prefixCount), omissions, timeout);
}
/**
* Get last content that follows name in similar manner to
* getNext
*
* @param name
* @param omissions
* @param timeout
* @return
* @throws MalformedContentNameStringException
* @throws IOException
* @throws InvalidParameterException
*/
public ContentObject getLatest(ContentName name, ExcludeFilter exclude, long timeout)
throws IOException, InvalidParameterException {
return get(Interest.last(name, exclude), timeout);
}
public ContentObject getLatest(ContentName name, long timeout) throws InvalidParameterException,
IOException {
return getLatest(name, null, timeout);
}
public ContentObject getLatest(ContentName name, int prefixCount, long timeout) throws InvalidParameterException,
IOException {
return get(Interest.last(name, prefixCount), timeout);
}
public ContentObject getLatest(ContentObject content, int prefixCount, long timeout) throws InvalidParameterException,
IOException {
return getLatest(contentObjectToContentName(content, prefixCount), null, timeout);
}
/**
*
* @param name
* @param omissions
* @param timeout
* @return
* @throws InvalidParameterException
* @throws MalformedContentNameStringException
* @throws IOException
*/
public ContentObject getExcept(ContentName name, byte[][] omissions, long timeout) throws InvalidParameterException, MalformedContentNameStringException,
IOException {
return get(Interest.exclude(name, omissions), timeout);
}
private ContentName contentObjectToContentName(ContentObject content, int prefixCount) {
ContentName cocn = content.name().clone();
cocn.components().add(content.contentDigest());
return new ContentName(prefixCount, cocn.components());
}
/**
* Shutdown the library and it's associated resources
*/
public void close() {
if (null != _networkManager)
_networkManager.shutdown();
_networkManager = null;
}
public static byte[] nonce() {
byte [] nonce = new byte[32];
boolean startsWithReserved;
while (true) {
startsWithReserved = false;
_random.nextBytes(nonce);
for (byte b: CCN_reserved_markers) {
if (b == nonce[0]) {
startsWithReserved = true;
break;
}
}
if (!startsWithReserved)
break;
}
return nonce;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
c76fcfc607478e5ee000f43991dfb1f668d66a53 | 814d056bfd5ff6807c0bc21f09dc814fe4296f72 | /im-common/src/main/java/com/vdegree/february/im/common/utils/agora/media/Packable.java | e1f86f9a9056e657c397553133c2f19f352761c8 | [] | no_license | pujie147/websocketProxyService | 1a95815bee7440075837da4dfc8727d93245316d | 1cf30baba46bea1fda6a8035281e6fbbc90cac7a | refs/heads/main | 2023-03-30T19:57:30.713078 | 2021-04-07T07:35:04 | 2021-04-07T07:35:04 | 351,782,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 162 | java | package com.vdegree.february.im.common.utils.agora.media;
/**
* Created by Li on 10/1/2016.
*/
public interface Packable {
ByteBuf marshal(ByteBuf out);
}
| [
"pyg124@live.com"
] | pyg124@live.com |
556a69f84f529a5d8bae979d1410beb1821d99f7 | d2bc9704a73ac25e1bd7e9924cf922d2ec136a3c | /src/main/java/com/gildedrose/shopapi/Application.java | 384fb042b6f056fd0e45960286dfad6ca05f44bc | [] | no_license | goldieweiler2/gildedrose | e8cdc54c1a66a74789924e66e09922a04cf93e65 | 20db370d0db0f39ec31be7a27db09883e5ee3c6c | refs/heads/master | 2020-05-03T17:54:48.136974 | 2019-03-31T23:41:20 | 2019-03-31T23:41:20 | 178,752,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.gildedrose.shopapi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
} | [
"mbennett@xmatters.com"
] | mbennett@xmatters.com |
d076b4ad60d917eafdc8afc9d3ac1b06a157a4ff | 8ab456b4c94b5f4b37bf89612e99f7ef7e9a4e97 | /im-chat/src/main/java/pers/kinson/im/chat/logic/search/message/res/ResSearchFriends.java | 615441ee37d7358764fa445ccf10259c46ad37a1 | [] | no_license | zillachan/im | 5ae775d5e322457692566270f6d7036f0bd9e8af | 7a61cb0f16392dfe377fac06f74efa0ca9297c50 | refs/heads/master | 2023-03-16T14:56:55.979818 | 2021-03-10T12:59:11 | 2021-03-10T12:59:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,233 | java | package pers.kinson.im.chat.logic.search.message.res;
import java.util.ArrayList;
import java.util.List;
import pers.kinson.im.chat.logic.search.message.vo.RecommendFriendItem;
import pers.kinson.im.chat.net.IoSession;
import pers.kinson.im.chat.net.message.AbstractPacket;
import pers.kinson.im.chat.net.message.PacketType;
import io.netty.buffer.ByteBuf;
public class ResSearchFriends extends AbstractPacket {
private List<RecommendFriendItem> friends;
@Override
public PacketType getPacketType() {
return PacketType.ResSearchFriends;
}
@Override
public void writeBody(ByteBuf buf) {
buf.writeInt(friends.size());
for (RecommendFriendItem item : friends) {
item.writeBody(buf);
}
}
@Override
public void readBody(ByteBuf buf) {
int size = buf.readInt();
this.friends = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
RecommendFriendItem item = new RecommendFriendItem();
item.readBody(buf);
friends.add(item);
}
}
public List<RecommendFriendItem> getFriends() {
return friends;
}
public void setFriends(List<RecommendFriendItem> friends) {
this.friends = friends;
}
@Override
public void execPacket(IoSession session) {
// TODO Auto-generated method stub
}
}
| [
"475139136@qq.com"
] | 475139136@qq.com |
05b01864dae2e2503d48ed46a7aa5caa18dcc6f9 | e3170f21bea849ca7436da5363381d0cf978b3af | /src/youzheng/algorithm/beakjoon/beakjoon1/beakjoon_1068.java | 7aa86c790a7f866c5f2c7ecd177d1df31e841e30 | [] | no_license | yangfriendship/algorithmJava | ac698d82a4ab09a5172cca4719cbe32c3b31ff2c | a0bda01ba4e5955262762c53d381ecea34ad4282 | refs/heads/master | 2023-06-14T23:22:29.436105 | 2021-07-15T07:46:11 | 2021-07-15T07:46:11 | 309,068,333 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | package youzheng.algorithm.beakjoon.beakjoon1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class beakjoon_1068 {
static List<List<Integer>> tree = new ArrayList<>();
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
StringTokenizer st = new StringTokenizer(br.readLine());
List<Integer> zeroIndex = new ArrayList<>();
int target = Integer.parseInt(br.readLine());
if(target==0){
System.out.println(0);
return;
}
st.nextToken();
zeroIndex.add(-1);
tree.add(zeroIndex);
for (int i = 1; i < n; i++) {
List<Integer> child = new ArrayList<>();
int parent = Integer.parseInt(st.nextToken());
child.add(parent);
tree.add(child);
tree.get(parent).add(i);
}
Integer targetParent = tree.get(target).get(0);
Integer remove = tree.get(targetParent).remove(target);
order(tree,0);
System.out.println(sum);
}// main
static int sum = 0;
public static void order(List<List<Integer>> tree, int r){
List<Integer> leaf = tree.get(r);
if(leaf.size()==1){
sum ++;
return;
}
for (int i = 1; i < leaf.size(); i++) {
if(!leaf.isEmpty()){
order(tree,leaf.get(i));
}
}
}
}
| [
"yangfriendship@naver.com"
] | yangfriendship@naver.com |
bff5d1eeb94e105accb599086b3cb7de5c96b5fb | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /newEvaluatedBugs/Jsoup_5_buggy/mutated/344/Node.java | 34f8e07685ddea9c1597bc30c2185c4fbd0057d7 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,013 | java | package org.jsoup.nodes;
import org.jsoup.SerializationException;
import org.jsoup.helper.StringUtil;
import org.jsoup.helper.Validate;
import org.jsoup.parser.Parser;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
The base, abstract Node model. Elements, Documents, Comments etc are all Node instances.
@author Jonathan Hedley, jonathan@hedley.net */
public abstract class Node implements Cloneable {
private static final List<Node> EMPTY_NODES = Collections.emptyList();
Node parentNode;
List<Node> childNodes;
Attributes attributes;
String baseUri;
int siblingIndex;
/**
Create a new Node.
@param baseUri base URI
@param attributes attributes (not null, but may be empty)
*/
protected Node(String baseUri, Attributes attributes) {
Validate.notNull(baseUri);
Validate.notNull(attributes);
childNodes = EMPTY_NODES;
this.baseUri = baseUri.trim();
this.attributes = attributes;
}
protected Node(String baseUri) {
this(baseUri, new Attributes());
}
/**
* Default constructor. Doesn't setup base uri, children, or attributes; use with caution.
*/
protected Node() {
childNodes = EMPTY_NODES;
attributes = null;
}
/**
Get the node name of this node. Use for debugging purposes and not logic switching (for that, use instanceof).
@return node name
*/
public abstract String nodeName();
/**
* Get an attribute's value by its key. <b>Case insensitive</b>
* <p>
* To get an absolute URL from an attribute that may be a relative URL, prefix the key with <code><b>abs</b></code>,
* which is a shortcut to the {@link #absUrl} method.
* </p>
* E.g.:
* <blockquote><code>String url = a.attr("abs:href");</code></blockquote>
*
* @param attributeKey The attribute key.
* @return The attribute, or empty string if not present (to avoid nulls).
* @see #attributes()
* @see #hasAttr(String)
* @see #absUrl(String)
*/
public String attr(String attributeKey) {
Validate.notNull(attributeKey);
String val = attributes.getIgnoreCase(attributeKey);
if (val.length() > 0)
return val;
else if (attributeKey.toLowerCase().startsWith("abs:"))
return absUrl(attributeKey.substring("abs:".length()));
else return "";
}
/**
* Get all of the element's attributes.
* @return attributes (which implements iterable, in same order as presented in original HTML).
*/
public Attributes attributes() {
return attributes;
}
/**
* Set an attribute (key=value). If the attribute already exists, it is replaced.
* @param attributeKey The attribute key.
* @param attributeValue The attribute value.
* @return this (for chaining)
*/
public Node attr(String attributeKey, String attributeValue) {
attributes.put(attributeKey, attributeValue);
return this;
}
/**
* Test if this element has an attribute. <b>Case insensitive</b>
* @param attributeKey The attribute key to check.
* @return true if the attribute exists, false if not.
*/
public boolean hasAttr(String attributeKey) {
Validate.notNull(attributeKey);
if (attributeKey.startsWith("abs:")) {
String key = attributeKey.substring("abs:".length());
if (attributes.hasKeyIgnoreCase(key) && !absUrl(key).equals(""))
return true;
}
ensureChildNodes();
return attributes.hasKeyIgnoreCase(attributeKey);
}
/**
* Remove an attribute from this element.
* @param attributeKey The attribute to remove.
* @return this (for chaining)
*/
public Node removeAttr(String attributeKey) {
Validate.notNull(attributeKey);
attributes.removeIgnoreCase(attributeKey);
return this;
}
/**
Get the base URI of this node.
@return base URI
*/
public String baseUri() {
return baseUri;
}
/**
Update the base URI of this node and all of its descendants.
@param baseUri base URI to set
*/
public void setBaseUri(final String baseUri) {
Validate.notNull(baseUri);
traverse(new NodeVisitor() {
public void head(Node node, int depth) {
node.baseUri = baseUri;
}
public void tail(Node node, int depth) {
}
});
}
/**
* Get an absolute URL from a URL attribute that may be relative (i.e. an <code><a href></code> or
* <code><img src></code>).
* <p>
* E.g.: <code>String absUrl = linkEl.absUrl("href");</code>
* </p>
* <p>
* If the attribute value is already absolute (i.e. it starts with a protocol, like
* <code>http://</code> or <code>https://</code> etc), and it successfully parses as a URL, the attribute is
* returned directly. Otherwise, it is treated as a URL relative to the element's {@link #baseUri}, and made
* absolute using that.
* </p>
* <p>
* As an alternate, you can use the {@link #attr} method with the <code>abs:</code> prefix, e.g.:
* <code>String absUrl = linkEl.attr("abs:href");</code>
* </p>
*
* @param attributeKey The attribute key
* @return An absolute URL if one could be made, or an empty string (not null) if the attribute was missing or
* could not be made successfully into a URL.
* @see #attr
* @see java.net.URL#URL(java.net.URL, String)
*/
public String absUrl(String attributeKey) {
Validate.notEmpty(attributeKey);
if (!hasAttr(attributeKey)) {
return ""; // nothing to make absolute with
} else {
return StringUtil.resolve(baseUri, attr(attributeKey));
}
}
/**
Get a child node by its 0-based index.
@param index index of child node
@return the child node at this index. Throws a {@code IndexOutOfBoundsException} if the index is out of bounds.
*/
public Node childNode(int index) {
return childNodes.get(index);
}
/**
Get this node's children. Presented as an unmodifiable list: new children can not be added, but the child nodes
themselves can be manipulated.
@return list of children. If no children, returns an empty list.
*/
public List<Node> childNodes() {
return Collections.unmodifiableList(childNodes);
}
/**
* Returns a deep copy of this node's children. Changes made to these nodes will not be reflected in the original
* nodes
* @return a deep copy of this node's children
*/
public List<Node> childNodesCopy() {
List<Node> children = new ArrayList<Node>(childNodes.size());
for (Node node : childNodes) {
children.add(node.clone());
}
return children;
}
/**
* Get the number of child nodes that this node holds.
* @return the number of child nodes that this node holds.
*/
public final int childNodeSize() {
return childNodes.size();
}
protected Node[] childNodesAsArray() {
return childNodes.toArray(new Node[childNodeSize()]);
}
/**
Gets this node's parent node.
@return parent node; or null if no parent.
*/
public Node parent() {
return parentNode;
}
/**
Gets this node's parent node. Not overridable by extending classes, so useful if you really just need the Node type.
@return parent node; or null if no parent.
*/
public final Node parentNode() {
return parentNode;
}
/**
* Get this node's root node; that is, its topmost ancestor. If this node is the top ancestor, returns {@code this}.
* @return topmost ancestor.
*/
public Node root() {
Node node = this;
while (node.parentNode != null)
node = node.parentNode;
return node;
}
/**
* Gets the Document associated with this Node.
* @return the Document associated with this Node, or null if there is no such Document.
*/
public Document ownerDocument() {
Node root = root();
return (root instanceof Document) ? (Document) root : null;
}
/**
* Remove (delete) this node from the DOM tree. If this node has children, they are also removed.
*/
public void remove() {
Validate.notNull(parentNode);
parentNode.removeChild(this);
}
/**
* Insert the specified HTML into the DOM before this node (i.e. as a preceding sibling).
* @param html HTML to add before this node
* @return this node, for chaining
* @see #after(String)
*/
public Node before(String html) {
addSiblingHtml(siblingIndex, html);
return this;
}
/**
* Insert the specified node into the DOM before this node (i.e. as a preceding sibling).
* @param node to add before this node
* @return this node, for chaining
* @see #after(Node)
*/
public Node before(Node node) {
Validate.notNull(node);
Validate.notNull(parentNode);
parentNode.addChildren(siblingIndex, node);
return this;
}
/**
* Insert the specified HTML into the DOM after this node (i.e. as a following sibling).
* @param html HTML to add after this node
* @return this node, for chaining
* @see #before(String)
*/
public Node after(String html) {
addSiblingHtml(siblingIndex + 1, html);
return this;
}
/**
* Insert the specified node into the DOM after this node (i.e. as a following sibling).
* @param node to add after this node
* @return this node, for chaining
* @see #before(Node)
*/
public Node after(Node node) {
Validate.notNull(node);
Validate.notNull(parentNode);
parentNode.addChildren(siblingIndex + 1, node);
return this;
}
private void addSiblingHtml(int index, String html) {
Validate.notNull(html);
Validate.notNull(parentNode);
Element context = parent() instanceof Element ? (Element) parent() : null;
List<Node> nodes = Parser.parseFragment(html, context, baseUri());
parentNode.addChildren(index, nodes.toArray(new Node[nodes.size()]));
}
/**
Wrap the supplied HTML around this node.
@param html HTML to wrap around this element, e.g. {@code <div class="head"></div>}. Can be arbitrarily deep.
@return this node, for chaining.
*/
public Node wrap(String html) {
Validate.notEmpty(html);
Element context = parent() instanceof Element ? (Element) parent() : null;
List<Node> wrapChildren = Parser.parseFragment(html, context, baseUri());
Node wrapNode = wrapChildren.get(0);
if (wrapNode == null || !(wrapNode instanceof Element)) // nothing to wrap with; noop
return null;
Element wrap = (Element) wrapNode;
Element deepest = getDeepChild(wrap);
parentNode.replaceChild(this, wrap);
deepest.addChildren(this);
// remainder (unbalanced wrap, like <div></div><p></p> -- The <p> is remainder
if (wrapChildren.size() > 0) {
for (int i = 0; i < wrapChildren.size(); i++) {
Node remainder = wrapChildren.get(i);
remainder.parentNode.removeChild(remainder);
wrap.appendChild(remainder);
}
}
return this;
}
/**
* Removes this node from the DOM, and moves its children up into the node's parent. This has the effect of dropping
* the node but keeping its children.
* <p>
* For example, with the input html:
* </p>
* <p>{@code <div>One <span>Two <b>Three</b></span></div>}</p>
* Calling {@code element.unwrap()} on the {@code span} element will result in the html:
* <p>{@code <div>One Two <b>Three</b></div>}</p>
* and the {@code "Two "} {@link TextNode} being returned.
*
* @return the first child of this node, after the node has been unwrapped. Null if the node had no children.
* @see #remove()
* @see #wrap(String)
*/
public Node unwrap() {
Validate.notNull(parentNode);
Node firstChild = childNodes.size() > 0 ? childNodes.get(0) : null;
parentNode.addChildren(siblingIndex, this.childNodesAsArray());
this.remove();
return firstChild;
}
private Element getDeepChild(Element el) {
List<Element> children = el.children();
if (children.size() > 0)
return getDeepChild(children.get(0));
else
return el;
}
/**
* Replace this node in the DOM with the supplied node.
* @param in the node that will will replace the existing node.
*/
public void replaceWith(Node in) {
Validate.notNull(in);
Validate.notNull(parentNode);
parentNode.replaceChild(this, in);
}
protected void setParentNode(Node parentNode) {
if (this.parentNode != null)
this.parentNode.removeChild(this);
this.parentNode = parentNode;
}
protected void replaceChild(Node out, Node in) {
Validate.isTrue(out.parentNode == this);
Validate.notNull(in);
if (in.parentNode != null)
in.parentNode.removeChild(in);
final int index = out.siblingIndex;
childNodes.set(index, in);
in.parentNode = this;
in.setSiblingIndex(index);
out.parentNode = null;
}
protected void removeChild(Node out) {
Validate.isTrue(out.parentNode == this);
final int index = out.siblingIndex;
childNodes.remove(index);
reindexChildren(index);
out.parentNode = null;
}
protected void addChildren(Node... children) {
//most used. short circuit addChildren(int), which hits reindex children and array copy
for (Node child: children) {
reparentChild(child);
ensureChildNodes();
childNodes.add(child);
child.setSiblingIndex(childNodes.size()-1);
}
}
protected void addChildren(int index, Node... children) {
Validate.noNullElements(children);
ensureChildNodes();
for (int i = children.length - 1; i >= 0; i--) {
Node in = children[i];
reparentChild(in);
childNodes.add(index, in);
reindexChildren(index);
}
}
protected void ensureChildNodes() {
if (childNodes == EMPTY_NODES) {
childNodes = new ArrayList<Node>(4);
}
}
protected void reparentChild(Node child) {
if (child.parentNode != null)
child.parentNode.removeChild(child);
child.setParentNode(this);
}
private void reindexChildren(int start) {
for (int i = start; i < childNodes.size(); i++) {
childNodes.get(i).setSiblingIndex(i);
}
}
/**
Retrieves this node's sibling nodes. Similar to {@link #childNodes() node.parent.childNodes()}, but does not
include this node (a node is not a sibling of itself).
@return node siblings. If the node has no parent, returns an empty list.
*/
public List<Node> siblingNodes() {
if (parentNode == null)
return Collections.emptyList();
List<Node> nodes = parentNode.childNodes;
List<Node> siblings = new ArrayList<Node>(nodes.size() - 1);
for (Node node: nodes)
if (node != this)
siblings.add(node);
return siblings;
}
/**
Get this node's next sibling.
@return next sibling, or null if this is the last sibling
*/
public Node nextSibling() {
if (parentNode == null)
return null; // root
final List<Node> siblings = parentNode.childNodes;
final int index = siblingIndex+1;
if (siblings.size() > index)
return siblings.get(index);
else
return null;
}
/**
Get this node's previous sibling.
@return the previous sibling, or null if this is the first sibling
*/
public Node previousSibling() {
if (parentNode == null)
return null; // root
if (siblingIndex > 0)
return parentNode.childNodes.get(siblingIndex-1);
else
return null;
}
/**
* Get the list index of this node in its node sibling list. I.e. if this is the first node
* sibling, returns 0.
* @return position in node sibling list
* @see org.jsoup.nodes.Element#elementSiblingIndex()
*/
public int siblingIndex() {
return siblingIndex;
}
protected void setSiblingIndex(int siblingIndex) {
this.siblingIndex = siblingIndex;
}
/**
* Perform a depth-first traversal through this node and its descendants.
* @param nodeVisitor the visitor callbacks to perform on each node
* @return this node, for chaining
*/
public Node traverse(NodeVisitor nodeVisitor) {
Validate.notNull(nodeVisitor);
NodeTraversor traversor = new NodeTraversor(nodeVisitor);
traversor.traverse(this);
return this;
}
/**
Get the outer HTML of this node.
@return HTML
*/
public String outerHtml() {
StringBuilder accum = new StringBuilder(128);
outerHtml(accum);
return accum.toString();
}
protected void outerHtml(Appendable accum) {
new NodeTraversor(new OuterHtmlVisitor(accum, getOutputSettings())).traverse(this);
}
// if this node has no document (or parent), retrieve the default output settings
Document.OutputSettings getOutputSettings() {
Document owner = ownerDocument();
return owner != null ? owner.outputSettings() : (new Document("")).outputSettings();
}
/**
Get the outer HTML of this node.
@param accum accumulator to place HTML into
@throws IOException if appending to the given accumulator fails.
*/
abstract void outerHtmlHead(Appendable accum, int depth, Document.OutputSettings out) throws IOException;
abstract void outerHtmlTail(Appendable accum, int depth, Document.OutputSettings out) throws IOException;
/**
* Write this node and its children to the given {@link Appendable}.
*
* @param appendable the {@link Appendable} to write to.
* @return the supplied {@link Appendable}, for chaining.
*/
public <T extends Appendable> T html(T appendable) {
outerHtml(appendable);
return appendable;
}
public String toString() {
return outerHtml();
}
protected void indent(Appendable accum, int depth, Document.OutputSettings out) throws IOException {
accum.append("\n").append(StringUtil.padding(depth * out.indentAmount()));
}
/**
* Check if this node is the same instance of another (object identity test).
* @param o other object to compare to
* @return true if the content of this node is the same as the other
* @see Node#hasSameValue(Object) to compare nodes by their value
*/
@Override
public boolean equals(Object o) {
// implemented just so that javadoc is clear this is an identity test
return this == o;
}
/**
* Check if this node is has the same content as another node. A node is considered the same if its name, attributes and content match the
* other node; particularly its position in the tree does not influence its similarity.
* @param o other object to compare to
* @return true if the content of this node is the same as the other
*/
public boolean hasSameValue(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return this.outerHtml().equals(((Node) o).outerHtml());
}
/**
* Create a stand-alone, deep copy of this node, and all of its children. The cloned node will have no siblings or
* parent node. As a stand-alone object, any changes made to the clone or any of its children will not impact the
* original node.
* <p>
* The cloned node may be adopted into another Document or node structure using {@link Element#appendChild(Node)}.
* @return stand-alone cloned node
*/
@Override
public Node clone() {
Node thisClone = doClone(null); // splits for orphan
// Queue up nodes that need their children cloned (BFS).
LinkedList<Node> nodesToProcess = new LinkedList<Node>();
nodesToProcess.add(thisClone);
while (!nodesToProcess.isEmpty()) {
Node currParent = nodesToProcess.remove();
for (int i = 0; i < currParent.childNodes.size(); i++) {
Node childClone = currParent.childNodes.get(i).doClone(currParent);
currParent.childNodes.set(i, childClone);
nodesToProcess.add(childClone);
}
}
return thisClone;
}
/*
* Return a clone of the node using the given parent (which can be null).
* Not a deep copy of children.
*/
protected Node doClone(Node parent) {
Node clone;
try {
clone = (Node) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
clone.parentNode = parent; // can be null, to create an orphan split
clone.siblingIndex = parent == null ? 0 : siblingIndex;
clone.attributes = attributes != null ? attributes.clone() : null;
clone.baseUri = baseUri;
clone.childNodes = new ArrayList<Node>(childNodes.size());
for (Node child: childNodes)
clone.childNodes.add(child);
return clone;
}
private static class OuterHtmlVisitor implements NodeVisitor {
private Appendable accum;
private Document.OutputSettings out;
OuterHtmlVisitor(Appendable accum, Document.OutputSettings out) {
this.accum = accum;
this.out = out;
}
public void head(Node node, int depth) {
try {
node.outerHtmlHead(accum, depth, out);
} catch (IOException exception) {
throw new SerializationException(exception);
}
}
public void tail(Node node, int depth) {
if (!node.nodeName().equals("#text")) { // saves a void hit.
try {
node.outerHtmlTail(accum, depth, out);
} catch (IOException exception) {
throw new SerializationException(exception);
}
}
}
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
9c5e9149f2edc3b38708cadb5c8e43c8f70f6327 | d5a26f2e8b90a1c7ccb133c72b653473278a2cbb | /HuLianWangYiLiao_Admin/.svn/pristine/5e/5e4fc878b8112399f81332e05a7823c6ac25d26d.svn-base | cc195c1b181e949b172c28748ff59f79ded45bbe | [] | no_license | songzonghe/platform | 7e01bdffc6c15d609edfd3817e03de23b18ce427 | c8c6891f2a775bb3402fa5ab36b3e39b7306ec71 | refs/heads/master | 2022-12-14T18:04:02.180112 | 2020-09-17T09:41:54 | 2020-09-17T09:41:54 | 296,255,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,164 | package com.servicesAdmin.util.drug.drugClass;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.dao.interfaceDAO.GYDAO;
import com.util.SysFinal;
import com.util.UtilSql;
import com.util.UtilValiDate;
/**
* 药品分类表 service 实现类
* 操作人: 曾晓
*/
@Service("utilDrugClassServiceImp")
public class UtilDrugClassServiceImp implements UtilDrugClassService {
@Resource
private GYDAO gyDAOimp;// dao操作类
/************************系统生成方法开始******************************/
/**
*获取药品分类表查询sql
*/
private void getSQL(Map<String, String> mapStr,StringBuffer sql,Map<String, Object> mapSQLParameter) throws Exception {
sql.append("select t.class_id,t.hospital_id,t.class_name,t.class_sort,t.gxsj,t.bz,t.lrsj,t.zt,t.lrzh");
sql.append(" from util_drug_class t where t.hospital_id=:hospital_id");
mapSQLParameter.put("hospital_id", mapStr.get("login_hospital_id"));
if (UtilValiDate.isEmpty(mapStr.get("class_id"))) {
sql.append(" and t.class_id=:class_id ");
mapSQLParameter.put("class_id", mapStr.get("class_id"));
}else {
if (UtilValiDate.isEmpty(mapStr.get("hospital_id"))) {
sql.append(" and t.hospital_id = :hospital_id");
mapSQLParameter.put("hospital_id", mapStr.get("hospital_id") );
}
if (UtilValiDate.isEmpty(mapStr.get("class_name"))) {
sql.append(" and t.class_name like :class_name");
mapSQLParameter.put("class_name", "%" + mapStr.get("class_name") + "%");
}
}
}
/**
*获取药品分类表信息列表
*/
public List<Map<String, Object>> tBody(Map<String, String> mapStr)throws Exception{
StringBuffer sql = new StringBuffer(); Map<String, Object> mapSQLParameter = new HashMap<String, Object>();
this.getSQL(mapStr, sql, mapSQLParameter);
if (!UtilValiDate.isEmpty(mapStr.get(SysFinal.ISSORT_KEY))){ //由于从菜单进入没有带入参数,这里给入判断进行开启排序
mapStr.put(SysFinal.ISSORT_KEY,"y");
}
List<Map<String, Object>> list_Map = this.gyDAOimp.findSqlPageList(sql, mapSQLParameter,mapStr);
list_Map.add(this.gyDAOimp.findSqlCount(sql, mapSQLParameter));
return list_Map;
}
/**
*获取一条药品分类表信息
*/
public Map<String, Object> find_Map(Map<String, String> mapStr)throws Exception{
StringBuffer sql = new StringBuffer(); Map<String, Object> mapSQLParameter = new HashMap<String, Object>();
this.getSQL(mapStr, sql, mapSQLParameter);
return this.gyDAOimp.findSqlMap(sql, mapSQLParameter);
}
/**
*新增操作
*/
public Map<String, Object> add_Data(Map<String, String> mapStr) throws Exception{
StringBuffer sql = new StringBuffer(); Map<String, Object> mapSQLParameter = new HashMap<String, Object>();
sql.append("insert into util_drug_class");
sql.append("( hospital_id,class_name,class_sort");
sql.append(UtilSql.getFieldInsertKey());
sql.append("values( :hospital_id,:class_name,:class_sort");
sql.append(UtilSql.getFieldInsertVal());
mapSQLParameter.put("hospital_id", mapStr.get("login_hospital_id"));
mapSQLParameter.put("class_name", mapStr.get("class_name"));
mapSQLParameter.put("class_sort", mapStr.get("class_sort"));
UtilSql.setMapVal(mapSQLParameter, mapStr);
mapStr.put("class_id", this.gyDAOimp.exeSqlGetId(sql, mapSQLParameter));
return this.find_Map(mapStr);
}
/**
*修改药品分类表操作
*/
public Map<String, Object> update_Data(Map<String, String> mapStr) throws Exception{
mapStr.put("gxsj", UtilSql.getGXSJ());
StringBuffer sql = new StringBuffer(); Map<String, Object> mapSQLParameter = new HashMap<String, Object>();
sql.append("update util_drug_class set gxsj=:gxsj");
if(null!=mapStr.get("class_name")){
sql.append(",class_name=:class_name");
mapSQLParameter.put("class_name", mapStr.get("class_name"));
}
if(null!=mapStr.get("class_sort")){
sql.append(",class_sort=:class_sort");
mapSQLParameter.put("class_sort", mapStr.get("class_sort"));
}
if(null!=mapStr.get("bz")){
sql.append(",bz=:bz");
mapSQLParameter.put("bz", mapStr.get("bz"));
}
if(null!=mapStr.get("edit_zt")){
sql.append(",zt=:edit_zt");
mapSQLParameter.put("edit_zt", mapStr.get("edit_zt"));
}
sql.append(" where class_id=:class_id");
mapSQLParameter.put("class_id", mapStr.get("class_id"));
mapSQLParameter.put("gxsj", mapStr.get("gxsj"));
this.gyDAOimp.exeSqlBool(sql, mapSQLParameter);
return this.find_Map(mapStr);
}
/**
*删除药品分类表操作
*/
public void delete_Data(Map<String, String> mapStr) throws Exception{
StringBuffer sql = new StringBuffer(); Map<String, Object> mapSQLParameter = new HashMap<String, Object>();
sql.append("delete from util_drug_class where class_id=:class_id");
mapSQLParameter.put("class_id", mapStr.get("id"));
this.gyDAOimp.exeSqlBool(sql, mapSQLParameter);
sql.delete(0, sql.length());
sql.append("delete from util_drug where class_id=:class_id");
this.gyDAOimp.exeSqlBool(sql, mapSQLParameter);
}
/************************系统生成方法完毕******************************/
} | [
"m13760848162_1@163.com"
] | m13760848162_1@163.com | |
4235f226ae8ad6b9944ba6203173321f9c66be83 | 474fb325e5a31924fa5d72e0582ed4a4eeb75bb5 | /Design Patterns/SWE6853 Design Patterns/BackboneAmerica/src/DesignPatterns/Services/BusinessPlanning/BusinessPlanReview.java | 0e0f7ffc074168b5715aabf811897be98d2698db | [] | no_license | lrdavis702/Programming-Files | 611f728a7b629a7776c0b4b4dd608d5d10bf5733 | cf9553ec089903bf7641adb6e11c7515c95bdc1c | refs/heads/main | 2023-06-30T20:38:36.207692 | 2021-08-07T05:32:16 | 2021-08-07T05:32:16 | 369,027,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 821 | java | // Concrete subclass for BBAServices
package DesignPatterns.Services.BusinessPlanning;
import DesignPatterns.Services.BBAService;
public class BusinessPlanReview extends BBAService {
public BusinessPlanReview(){
name = "Business Plan Review";
description =
"|If you already have your business plan written, |\n"+
"|allow us to save you some money. We’ll thoroughly review|\n"+
"|your business plan. Our reviews include a markup of your|\n"+
"|document and recommendations to increase your chances of|\n"+
"|obtaining funding. |\n";
sessions = 4;
price = 599;
addons.add("Investor-Ready Audit");
addons.add("Money Back Guarantee");
}
} | [
"78571479+lrdavis702@users.noreply.github.com"
] | 78571479+lrdavis702@users.noreply.github.com |
ceaa4a5afb8c0689de13a6a23b5c6a6f0cf6d236 | 91eeea43a933f374dba67f458a62a4b59821fc7d | /src/test/java/ru/neustupov/votingforrestaurants/web/menu/AdminMenuRestControllerTest.java | 6c2a446da3d81a023b39581d5226f5da1577626b | [] | no_license | neustupov/votingForRestaurants | f9ff84d0eb568fc5d356ba581eb5407eb7d5c7f0 | 4251e2568145594de60bc9b0b19c481f0862a669 | refs/heads/master | 2018-11-11T12:21:57.966398 | 2018-10-23T14:58:20 | 2018-10-23T14:58:20 | 113,659,557 | 0 | 0 | null | 2018-08-22T15:00:07 | 2017-12-09T10:01:34 | Java | UTF-8 | Java | false | false | 4,972 | java | package ru.neustupov.votingforrestaurants.web.menu;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.ResultActions;
import ru.neustupov.votingforrestaurants.TestUtil;
import ru.neustupov.votingforrestaurants.model.Menu;
import ru.neustupov.votingforrestaurants.service.MenuService;
import ru.neustupov.votingforrestaurants.web.AbstractControllerTest;
import ru.neustupov.votingforrestaurants.web.json.JsonUtil;
import java.sql.Date;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static ru.neustupov.votingforrestaurants.MenuTestData.*;
import static ru.neustupov.votingforrestaurants.RestaurantTestData.RUSSIA_ID;
import static ru.neustupov.votingforrestaurants.TestUtil.userHttpBasic;
import static ru.neustupov.votingforrestaurants.UserTestData.ADMIN;
import static ru.neustupov.votingforrestaurants.UserTestData.USER;
class AdminMenuRestControllerTest extends AbstractControllerTest {
private static final String REST_URL = AdminMenuRestController.REST_URL + '/';
@Autowired
private MenuService menuService;
@Test
void testGet() throws Exception {
mockMvc.perform(get(REST_URL + RUSSIA_MENU_ID1)
.with(userHttpBasic(ADMIN))
.param("restId", "100002"))
.andExpect(status().isOk())
.andDo(print())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(contentJson(RUSSIA_MENU1));
}
@Test
void testDelete() throws Exception {
mockMvc.perform(delete(REST_URL + RUSSIA_MENU_ID1)
.with(userHttpBasic(ADMIN))
.param("restId", "100002"))
.andDo(print())
.andExpect(status().isNoContent());
assertMatch(menuService.getAll(RUSSIA_ID), RUSSIA_MENU2, MENU_TODAYS_WITH_MEALS);
}
@Test
void testCreate() throws Exception {
Menu expected = new Menu(getCreated());
ResultActions action = mockMvc.perform(post(REST_URL)
.with(userHttpBasic(ADMIN))
.param("restId", "100002")
.contentType(MediaType.APPLICATION_JSON)
.content(JsonUtil.writeValue(expected)))
.andExpect(status().isCreated());
Menu returned = TestUtil.readFromJson(action, Menu.class);
expected.setId(returned.getId());
assertMatch(returned, expected);
assertMatch(menuService.getAll(RUSSIA_ID), RUSSIA_MENU1, RUSSIA_MENU2, MENU_TODAYS_WITH_MEALS, expected);
}
@Test
void testGetAll() throws Exception {
TestUtil.print(mockMvc.perform(get(REST_URL)
.with(userHttpBasic(ADMIN))
.param("restId", "100002"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(contentJson(RUSSIA_MENU1, RUSSIA_MENU2, MENU_TODAYS_WITH_MEALS)));
}
@Test
void testUpdate() throws Exception {
Menu updated = new Menu(getCreated());
updated.setId(100007);
updated.setAddDate(Date.valueOf("2017-06-01"));
mockMvc.perform(put(REST_URL + RUSSIA_MENU_ID1)
.with(userHttpBasic(ADMIN))
.param("restId", "100002")
.contentType(MediaType.APPLICATION_JSON)
.content(JsonUtil.writeValue(updated)))
.andExpect(status().isOk());
assertMatch(menuService.get(100007, RUSSIA_ID), updated);
}
@Test
void testGetUnauth() throws Exception {
mockMvc.perform(get(REST_URL))
.andExpect(status().isUnauthorized());
}
@Test
void testGetForbidden() throws Exception {
mockMvc.perform(get(REST_URL)
.with(userHttpBasic(USER)))
.andExpect(status().isForbidden());
}
@Test
void testGetNotFound() throws Exception {
mockMvc.perform(get(REST_URL + 1)
.param("restId", "100002")
.with(userHttpBasic(ADMIN)))
.andExpect(status().isUnprocessableEntity())
.andDo(print());
}
@Test
void testDeleteNotFound() throws Exception {
mockMvc.perform(delete(REST_URL + 1)
.param("restId", "100002")
.with(userHttpBasic(ADMIN)))
.andExpect(status().isUnprocessableEntity())
.andDo(print());
}
}
| [
"neustupov@yandex.ru"
] | neustupov@yandex.ru |
1ba9e6cb60d99afa69900aca214b44d28adf062d | 8f3633a215fc69bb7402c13b57f48e8b21fc1829 | /ch13Interfaces/src/com/coderbd/interfaces/other/Dog.java | 49bf5a9077e8d002fff408cf1a8e3c274108385e | [] | no_license | springapidev/Java-8 | 44c167c2ef607de135b83de44c42943a317870f0 | 6801f2f003631c10fcb39c899443ec5b6cc11752 | refs/heads/master | 2021-06-06T12:25:16.111508 | 2020-02-23T08:51:28 | 2020-02-23T08:51:28 | 145,200,749 | 10 | 11 | null | null | null | null | UTF-8 | Java | false | false | 629 | java | package com.coderbd.interfaces.other;
public class Dog implements Animal, Animal2 {
@Override
public void bark() {
System.out.println("::::Bark::::");
}
@Override
public void bite() {
System.out.println("::::bite::::");
}
@Override
public void eat() {
System.out.println("::::eat::::");
}
@Override
public void sleep() {
System.out.println("::::sleep::::");
}
@Override
public void run() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"springapidev@gmail.com"
] | springapidev@gmail.com |
b3a7da38c9739171c64b06645bd4ee86cd1d06a6 | c452312afd680fd62a5dcd00d9d0279b4160ea84 | /src/main/java/com/read/javaFile/Attachment.java | ad9c9c721a07f9afa96dd9bfd792e04cdc9432f1 | [] | no_license | yangyang2022/demo1 | 102aa9adb6e782b54387342a75b3523bed030606 | 7c060ae233b0ddc5f9619be2d006783d314e4159 | refs/heads/master | 2021-01-09T20:30:04.941971 | 2017-02-08T05:14:47 | 2017-02-08T05:14:47 | 81,290,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package com.read.javaFile;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousServerSocketChannel;
import java.nio.channels.AsynchronousSocketChannel;
/**
* Created by syy on 2017/1/18.
*/
public class Attachment {
public AsynchronousServerSocketChannel channelServer;
public AsynchronousSocketChannel channelClient;
public boolean isReadMode;
public ByteBuffer buffer;
public SocketAddress clientAddr;
}
| [
"yangyanghdu@qq.com"
] | yangyanghdu@qq.com |
150556724ba39fa3076be4a97c4d49bb640af719 | de7d9f5e48c464178be50c48e60075b7ead3a013 | /src/main/java/me/dakbutfly/sample/HomeController.java | d6cb3e51f793dd6275ebebb881726385931e1c6c | [] | no_license | rkdgusrnrlrl/gradle-springMVC | a3530abb6af91b864e4d73d7da8112f1b15ec936 | 7591b3aec19fd7f26187e35a9cc10a5097f777ae | refs/heads/master | 2021-01-20T20:52:58.131437 | 2016-06-04T00:40:54 | 2016-06-04T00:40:54 | 60,324,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package me.dakbutfly.sample;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class HomeController {
@RequestMapping(value="/", method = RequestMethod.GET)
public String printWelcome(ModelMap model) {
model.addAttribute("message", "Spring 4 MVC Hello Gradle World!!! This is a Thymeleaf template ");
return "home";
}
} | [
"rkdgusrnrlrl@gmail.com"
] | rkdgusrnrlrl@gmail.com |
abe4d9b89b7e5143d5b7b363a8e313f8b1127efc | 7fd05e03b72c9b7167546d2add71c7afc6d1c347 | /library/src/main/java/com/coolerfall/widget/lunar/LunarView.java | 43fd7a2797cd97154f951954bf4ebf06b2aa4452 | [
"Apache-2.0"
] | permissive | aer874475222/Android-LunarView | 105164bdbf6c394ffc74503e7c9cf63984f9d4ec | 6dc0f42598e9e6cf8eab3bc8591f46d71418c518 | refs/heads/master | 2021-01-18T07:14:56.488294 | 2016-07-11T03:09:53 | 2016-07-11T03:09:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,823 | java | package com.coolerfall.widget.lunar;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import java.util.Calendar;
/**
* This class is a calendar widget for displaying and selecting dates.
*
* @author Vincent Cheung (coolingfall@gmail.com)
*/
public class LunarView extends LinearLayout {
private int mSolarTextColor = 0xff454545;
private int mLunarTextColor = Color.GRAY;
private int mHightlistColor = 0xff03a9f4;
private int mUncheckableColor = 0xffb0b0b0;
private int mMonthBackgroundColor = 0xfffafafa;
private int mWeekLabelBackgroundColor = 0xfffafafa;
private int checkedDayBackgroundColor = 0xffeaeaea;
private Drawable mTodayBackground;
private boolean mShouldPickOnMonthChange = true;
private ViewPager mPager;
private MonthPagerAdapter mAdapter;
private WeekLabelView mWeekLabelView;
private OnDatePickListener mOnDatePickListener;
private boolean mIsChangedByUser;
public LunarView(Context context) {
this(context, null);
}
public LunarView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public LunarView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int measureWidth = MeasureSpec.getSize(widthMeasureSpec);
for (int i = 0; i < getChildCount(); i++) {
final View child = getChildAt(i);
int childWidthMeasureSpec =
MeasureSpec.makeMeasureSpec(measureWidth, MeasureSpec.EXACTLY);
int childHeightMeasureSpec =
MeasureSpec.makeMeasureSpec(measureWidth, MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
int measureHeight = (int) (measureWidth * 6f / 7f) + mWeekLabelView.getMeasuredHeight();
setMeasuredDimension(measureWidth, measureHeight);
}
/* init lunar view */
private void init(AttributeSet attrs) {
/* get custom attrs */
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.LunarView);
mMonthBackgroundColor =
a.getColor(R.styleable.LunarView_monthBackgroundColor, mMonthBackgroundColor);
mWeekLabelBackgroundColor =
a.getColor(R.styleable.LunarView_monthBackgroundColor, mWeekLabelBackgroundColor);
mSolarTextColor = a.getColor(R.styleable.LunarView_solarTextColor, mSolarTextColor);
mLunarTextColor = a.getColor(R.styleable.LunarView_lunarTextColor, mLunarTextColor);
mHightlistColor = a.getColor(R.styleable.LunarView_highlightColor, mHightlistColor);
mUncheckableColor = a.getColor(R.styleable.LunarView_uncheckableColor, mUncheckableColor);
mTodayBackground = a.getDrawable(R.styleable.LunarView_todayBackground);
checkedDayBackgroundColor =
a.getColor(R.styleable.LunarView_checkedDayBackgroundColor, checkedDayBackgroundColor);
mShouldPickOnMonthChange =
a.getBoolean(R.styleable.LunarView_shouldPickOnMonthChange, mShouldPickOnMonthChange);
a.recycle();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
/* if we're on good Android versions, turn off clipping for cool effects */
setClipToPadding(false);
setClipChildren(false);
} else {
/* old Android does not like _not_ clipping view pagers, we need to clip */
setClipChildren(true);
setClipToPadding(true);
}
/* set the orientation to vertical */
setOrientation(VERTICAL);
mWeekLabelView = new WeekLabelView(getContext());
mWeekLabelView.setBackgroundColor(mWeekLabelBackgroundColor);
addView(mWeekLabelView);
mPager = new ViewPager(getContext());
mPager.setOffscreenPageLimit(1);
addView(mPager);
mAdapter = new MonthPagerAdapter(getContext(), this);
mPager.setAdapter(mAdapter);
mPager.addOnPageChangeListener(mPageListener);
mPager.setCurrentItem(mAdapter.getIndexOfCurrentMonth());
mPager.setPageTransformer(false, new ViewPager.PageTransformer() {
@Override
public void transformPage(View page, float position) {
page.setAlpha(1 - Math.abs(position));
}
});
}
/* page change listener */
private ViewPager.OnPageChangeListener mPageListener = new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (mIsChangedByUser) {
mIsChangedByUser = false;
return;
}
mAdapter.resetSelectedDay(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
};
/* get color with given color resource id */
private int getColor(@ColorRes int resId) {
return ContextCompat.getColor(getContext(), resId);
}
/* get color with given drawable resource id */
private Drawable getDrawable(@DrawableRes int resId) {
return ContextCompat.getDrawable(getContext(), resId);
}
/**
* Interface definition for a callback to be invoked when date picked.
*/
public interface OnDatePickListener {
/**
* Invoked when date picked.
*
* @param view {@link LunarView}
* @param monthDay {@link MonthDay}
*/
void onDatePick(LunarView view, MonthDay monthDay);
}
/**
* Get the color of month view background.
*
* @return color of month background
*/
protected int getMonthBackgroundColor() {
return mMonthBackgroundColor;
}
/**
* Get the text color of solar day.
*
* @return text color of solar day
*/
protected int getSolarTextColor() {
return mSolarTextColor;
}
/**
* Get the text color of lunar day.
*
* @return text color of lunar day
*/
protected int getLunarTextColor() {
return mLunarTextColor;
}
/**
* Get the highlight color.
*
* @return thighlight color
*/
protected int getHightlightColor() {
return mHightlistColor;
}
/**
* Get the color of uncheckable day.
*
* @return uncheckable color
*/
protected int getUnCheckableColor() {
return mUncheckableColor;
}
/**
* Get the background of today.
*
* @return background drawable
*/
protected Drawable getTodayBackground() {
return mTodayBackground;
}
/**
* Get the color of checked day.
*
* @return color of checked day
*/
int getCheckedDayBackgroundColor() {
return checkedDayBackgroundColor;
}
/**
* Auto pick date when month changed or not.
*
* @return true or false
*/
protected boolean getShouldPickOnMonthChange() {
return mShouldPickOnMonthChange;
}
/**
* Set the text color of solar day.
*
* @param color color
*/
public void setSolarTextColor(@ColorInt int color) {
mSolarTextColor = color;
}
/**
* Set the text color resource of solar day.
*
* @param resId resource id
*/
public void setSolarTextColorRes(@ColorRes int resId) {
mSolarTextColor = getColor(resId);
}
/**
* Set the text color of lunar day.
*
* @param color color
*/
public void setLunarTextColor(@ColorInt int color) {
mLunarTextColor = color;
}
/**
* Set the text color resource of lunar day.
*
* @param resId resource id
*/
public void setLunarTextColorRes(@ColorRes int resId) {
mLunarTextColor = getColor(resId);
}
/**
* Set the highlight color.
*
* @param color color
*/
public void setHighlightColor(@ColorInt int color) {
mHightlistColor = color;
}
/**
* Set the highlight color resource.
*
* @param resId resource id
*/
public void setHighlightColorRes(@ColorRes int resId) {
mHightlistColor = getColor(resId);
}
/**
* Set the text color resource of uncheckable day.
*
* @param resId resource id
*/
public void setUncheckableColorRes(@ColorRes int resId) {
mUncheckableColor = getColor(resId);
}
/**
* Set the text color of uncheckable day.
*
* @param color color
*/
public void setUncheckableColor(@ColorInt int color) {
mUncheckableColor = color;
}
/**
* Set the background drawable of today.
*
* @param resId drawable resource id
*/
public void setTodayBackground(@DrawableRes int resId) {
mTodayBackground = getDrawable(resId);
}
/**
* Set on date click listener. This listener will be invoked
* when a day in month was picked.
*
* @param l date pick listner
*/
public void setOnDatePickListener(OnDatePickListener l) {
mOnDatePickListener = l;
}
/**
* Dispatch date pick listener. This will be invoked be {@link MonthView}
*
* @param monthDay month day
*/
protected void dispatchDateClickListener(MonthDay monthDay) {
if (mOnDatePickListener != null) {
mOnDatePickListener.onDatePick(this, monthDay);
}
}
/* show the month page with specified pager position and selected day */
private void showMonth(int position, int selectedDay) {
mIsChangedByUser = true;
mAdapter.setSelectedDay(position, selectedDay);
mPager.setCurrentItem(position, true);
}
/**
* Show previous month page with selected day.
*
* @param selectedDay selected day
*/
protected void showPrevMonth(int selectedDay) {
int position = mPager.getCurrentItem() - 1;
showMonth(position, selectedDay);
}
/**
* Show next month page with selected day.
*
* @param selectedDay selected day
*/
protected void showNextMonth(int selectedDay) {
int position = mPager.getCurrentItem() + 1;
showMonth(position, selectedDay);
}
/**
* Show previous month view.
*/
public void showPrevMonth() {
showPrevMonth(1);
}
/**
* Show next month view.
*/
public void showNextMonth() {
showNextMonth(1);
}
/**
* Go to the month with specified year and month.
*
* @param year the specified year
* @param month the specified month
*/
public void goToMonth(int year, int month) {
showMonth(mAdapter.getIndexOfMonth(year, month), 1);
}
/**
* Go to the month with specified year, month and day.
*
* @param year the specified year
* @param month the specified month
* @param day the specified day
*/
public void goToMonthDay(int year, int month, int day) {
showMonth(mAdapter.getIndexOfMonth(year, month), day);
}
/**
* Go back to the month of today.
*/
public void backToToday() {
Calendar today = Calendar.getInstance();
today.setTimeInMillis(System.currentTimeMillis());
showMonth(mAdapter.getIndexOfCurrentMonth(), today.get(Calendar.DAY_OF_MONTH));
}
/**
* Set the range of date.
*
* @param minYear min year
* @param maxYear max year
*/
public void setDateRange(int minYear, int maxYear) {
Month min = new Month(minYear, 0, 1);
Month max = new Month(maxYear, 11, 1);
mAdapter.setDateRange(min, max);
}
}
| [
"coolingfall@gmail.com"
] | coolingfall@gmail.com |
05dc1fa85c6dcd705ccaff6bb9c9cd40d55a0bf9 | bfa9c6fc9d0ba7444a4458e1831415cb64249383 | /app/src/main/java/net/wasnot/music/simplemusicplayer/TabFragment.java | b251f5c6e279164e8994226d34ebbcceafb64652 | [
"Apache-2.0"
] | permissive | wasnot/SimpleMusicPlayer | 2e439fae00968c187296f88887aaf48b683d29e8 | 2fd3c5df336843e8938c012c0c99e7a2e69c7363 | refs/heads/master | 2021-01-11T05:07:53.203069 | 2014-04-08T10:25:32 | 2014-04-08T10:25:32 | 18,553,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,195 | java | package net.wasnot.music.simplemusicplayer;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTabHost;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TabHost;
import net.wasnot.music.simplemusicplayer.list.AudioSelector;
import net.wasnot.music.simplemusicplayer.list.MusicListFragment;
/**
* A simple {@link android.support.v4.app.Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link TabFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
*/
public class TabFragment extends Fragment {
private OnFragmentInteractionListener mListener;
public TabFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_tab, container, false);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Context con = getActivity();
FragmentTabHost host = (FragmentTabHost) getActivity().findViewById(android.R.id.tabhost);
host.setup(getActivity(), getFragmentManager(), R.id.content);
// TabHost.TabSpec tabSpec1 = host.newTabSpec("tab1");
// Button button1 = new Button(this);
// button1.setBackgroundResource(R.drawable.abc_ic_go);
// tabSpec1.setIndicator(button1);
// Bundle bundle1 = new Bundle();
// bundle1.putString("name", "Tab1");
// host.addTab(tabSpec1, SampleFragment.class, bundle1);
TabHost.TabSpec tabSpec1 = host.newTabSpec("tab1");
// Button button1 = new Button(con);
// button1.setBackgroundResource(R.drawable.abc_ic_go);
// tabSpec1.setIndicator(button1);
tabSpec1.setIndicator("playlist");
host.addTab(tabSpec1, MusicListFragment.class, makeArguments(AudioSelector.CATEGORY_PLAYLIST));
TabHost.TabSpec tabSpec2 = host.newTabSpec("tab2");
// Button button2 = new Button(con);
//// button2.setBackgroundResource(R.drawable.abc_ic_search);
// tabSpec2.setIndicator(button2);
tabSpec2.setIndicator("artist");
host.addTab(tabSpec2, MusicListFragment.class, makeArguments(AudioSelector.CATEGORY_ARTIST));
TabHost.TabSpec tabSpec3 = host.newTabSpec("tab3");
// Button button3 = new Button(con);
//// button3.setBackgroundResource(R.drawable.ic_drawer);
// tabSpec3.setIndicator(button3);
tabSpec3.setIndicator("songs");
host.addTab(tabSpec3, MusicListFragment.class, makeArguments(AudioSelector.CATEGORY_SONGS));
TabHost.TabSpec tabSpec4 = host.newTabSpec("tab4");
// Button button4 = new Button(con);
// button4.setBackgroundResource(R.drawable.abc_ic_search);
// tabSpec4.setIndicator(button4);
tabSpec4.setIndicator("album");
host.addTab(tabSpec4, MusicListFragment.class, makeArguments(AudioSelector.CATEGORY_ALBUM));
TabHost.TabSpec tabSpec5 = host.newTabSpec("tab5");
// Button button5 = new Button(con);
// button5.setBackgroundResource(R.drawable.ic_drawer);
// tabSpec5.setIndicator(button5);
tabSpec5.setIndicator("genre");
host.addTab(tabSpec5, MusicListFragment.class, makeArguments(AudioSelector.CATEGORY_GENRE));
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// try {
// mListener = (OnFragmentInteractionListener) activity;
// } catch (ClassCastException e) {
// throw new ClassCastException(activity.toString()
// + " must implement OnFragmentInteractionListener");
// }
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
public void onFragmentInteraction(Uri uri);
}
private Bundle makeArguments(int category) {
// int category = AudioSelector.CATEGORY_SONGS;
String title = getString(R.string.music_page_title_songs);
String uri;
switch (category) {
case AudioSelector.CATEGORY_SONGS:
default:
uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI.toString();
break;
case AudioSelector.CATEGORY_ALBUM:
uri = MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI.toString();
break;
case AudioSelector.CATEGORY_ARTIST:
uri = MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI.toString();
break;
case AudioSelector.CATEGORY_PLAYLIST:
uri = MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI.toString();
break;
case AudioSelector.CATEGORY_GENRE:
uri = MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI.toString();
break;
}
Bundle args = new Bundle();
args.putInt(MusicListFragment.ARG_CATEGORY, category);
args.putString(MusicListFragment.ARG_TITLE, title);
args.putString(MusicListFragment.ARG_URI, uri);
return args;
}
}
| [
"a.aid@freebit.net"
] | a.aid@freebit.net |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.