blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ed070b8a192a530e32e8616aea730fc863d146a9 | 5dd2c6cc9d93b019b60be7e4c180f295fca78122 | /11. JSP/SamplesZZchal0803/src/dao/BbsDao.java | 18d7f2b69b30c2d01af490fcd365da2ed379854c | [] | no_license | d4ntsky/Basic | 1583002720f533061020f3e84ab308286fe5f164 | 29ae4e28baa10227dd9b840d0b287ee86fd32dbe | refs/heads/main | 2022-12-31T14:33:01.253431 | 2020-10-23T02:44:07 | 2020-10-23T02:44:07 | 305,349,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,273 | java | package dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import db.DBClose;
import db.DBConnection;
import dto.BbsDto;
public class BbsDao {
private static BbsDao dao = new BbsDao();
private BbsDao() {
}
public static BbsDao getInstance() {
return dao;
}
public List<BbsDto> getBbsList() {
String sql = " SELECT SEQ, ID, REF, STEP, DEPTH, "
+ " TITLE, CONTENT, WDATE, "
+ " DEL, READCOUNT "
+ " FROM BBS "
+ " ORDER BY REF DESC, STEP ASC ";
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
List<BbsDto> list = new ArrayList<BbsDto>();
try {
conn = DBConnection.getConnection();
System.out.println("1/6 getBbsList success");
psmt = conn.prepareStatement(sql);
System.out.println("2/6 getBbsList success");
rs = psmt.executeQuery();
System.out.println("3/6 getBbsList success");
while(rs.next()) {
int i = 1;
BbsDto dto = new BbsDto(rs.getInt(i++),
rs.getString(i++),
rs.getInt(i++),
rs.getInt(i++),
rs.getInt(i++),
rs.getString(i++),
rs.getString(i++),
rs.getString(i++),
rs.getInt(i++),
rs.getInt(i++));
list.add(dto);
}
System.out.println("4/6 getBbsList success");
} catch (Exception e) {
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, rs);
}
return list;
}
public boolean writeBbs(BbsDto dto) {
String sql = " INSERT INTO BBS "
+ " (SEQ, ID, REF, STEP, DEPTH, "
+ " TITLE, CONTENT, WDATE, "
+ " DEL, READCOUNT) "
+ " VALUES( SEQ_BBS.NEXTVAL, ?, "
+ " (SELECT NVL(MAX(REF), 0)+1 FROM BBS), 0, 0, "
+ " ?, ?, SYSDATE, "
+ " 0, 0) ";
Connection conn = null;
PreparedStatement psmt = null;
int count = 0;
try {
conn = DBConnection.getConnection();
System.out.println("1/6 writeBbs success");
psmt = conn.prepareStatement(sql);
psmt.setString(1, dto.getId());
psmt.setString(2, dto.getTitle());
psmt.setString(3, dto.getContent());
System.out.println("2/6 writeBbs success");
count = psmt.executeUpdate();
System.out.println("3/6 writeBbs success");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, null);
}
return count>0?true:false;
}
public BbsDto getBbs(int seq) {
String sql = " SELECT SEQ, ID, REF, STEP, DEPTH, "
+ " TITLE, CONTENT, WDATE,"
+ " DEL, READCOUNT "
+ " FROM BBS "
+ " WHERE SEQ=? ";
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
BbsDto dto = null;
try {
conn = DBConnection.getConnection();
System.out.println("1/6 getBbs success");
psmt = conn.prepareStatement(sql);
System.out.println("2/6 getBbs success");
psmt.setInt(1, seq);
rs = psmt.executeQuery();
System.out.println("3/6 getBbs success");
if(rs.next()) {
int i = 1;
dto = new BbsDto(rs.getInt(i++),
rs.getString(i++),
rs.getInt(i++),
rs.getInt(i++),
rs.getInt(i++),
rs.getString(i++),
rs.getString(i++),
rs.getString(i++),
rs.getInt(i++),
rs.getInt(i++));
}
System.out.println("4/6 getBbs success");
} catch (Exception e) {
System.out.println("getBbs fail");
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, rs);
}
return dto;
}
public void readcount(int seq) {
String sql = " UPDATE BBS "
+ " SET READCOUNT=READCOUNT+1 "
+ " WHERE SEQ=? ";
Connection conn = null;
PreparedStatement psmt = null;
try {
conn = DBConnection.getConnection();
System.out.println("1/6 readcount success");
psmt = conn.prepareStatement(sql);
psmt.setInt(1, seq);
System.out.println("2/6 readcount success");
psmt.executeUpdate();
System.out.println("3/6 readcount success");
} catch (Exception e) {
System.out.println("readcount fail");
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, null);
}
}
public boolean answer(int seq, BbsDto bbs) {
// update
String sql1 = " UPDATE BBS "
+ " SET STEP=STEP+1 "
+ " WHERE REF=(SELECT REF FROM BBS WHERE SEQ=? ) "
+ " AND STEP>(SELECT STEP FROM BBS WHERE SEQ=? ) ";
// insert
String sql2 = " INSERT INTO BBS "
+ " (SEQ, ID, "
+ " REF, STEP, DEPTH, "
+ " TITLE, CONTENT, WDATE, DEL, READCOUNT) "
+ " VALUES(SEQ_BBS.NEXTVAL, ?, "
+ " (SELECT REF FROM BBS WHERE SEQ=?), "
+ " (SELECT STEP FROM BBS WHERE SEQ=?) + 1, "
+ " (SELECT DEPTH FROM BBS WHERE SEQ=?) + 1, "
+ " ?, ?, SYSDATE, 0, 0) ";
Connection conn = null;
PreparedStatement psmt = null;
int count = 0;
try {
conn = DBConnection.getConnection();
conn.setAutoCommit(false);
System.out.println("1/6 answer success");
// update
psmt = conn.prepareStatement(sql1);
psmt.setInt(1, seq);
psmt.setInt(2, seq);
System.out.println("2/6 answer success");
count = psmt.executeUpdate();
System.out.println("3/6 answer success");
// psmt 초기화
psmt.clearParameters();
// insert
psmt = conn.prepareStatement(sql2);
psmt.setString(1, bbs.getId());
psmt.setInt(2, seq);
psmt.setInt(3, seq);
psmt.setInt(4, seq);
psmt.setString(5, bbs.getTitle());
psmt.setString(6, bbs.getContent());
System.out.println("4/6 answer success");
count = psmt.executeUpdate();
System.out.println("5/6 answer success");
conn.commit();
} catch (Exception e) {
e.printStackTrace();
try {
conn.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
}
} finally {
try {
conn.setAutoCommit(true);
} catch (SQLException e) {
e.printStackTrace();
}
DBClose.close(psmt, conn, null);
System.out.println("6/6 answer success");
}
return count>0?true:false;
}
public boolean deleteBbs(int seq) {
String sql = " UPDATE BBS "
+ " SET DEL=1 "
+ " WHERE SEQ=? ";
Connection conn = null;
PreparedStatement psmt = null;
int count = 0;
try {
conn = DBConnection.getConnection();
System.out.println("1/6 S deleteBbs");
psmt = conn.prepareStatement(sql);
psmt.setInt(1, seq);
System.out.println("2/6 S deleteBbs");
count = psmt.executeUpdate();
System.out.println("3/6 S deleteBbs");
} catch (Exception e) {
System.out.println("fail deleteBbs");
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, null);
}
return count>0?true:false;
}
public List<BbsDto> getBbsList(String choice, String searchWord) {
String sql = " SELECT SEQ, ID, REF, STEP, DEPTH, "
+ " TITLE, CONTENT, WDATE, "
+ " DEL, READCOUNT "
+ " FROM BBS ";
String sqlWord = "";
if(choice.equals("title")) {
sqlWord = " WHERE TITLE LIKE '%" + searchWord.trim() + "%' AND DEL=0 ";
}else if(choice.equals("writer")) {
sqlWord = " WHERE ID='" + searchWord.trim() + "'";
}else if(choice.equals("content")) {
sqlWord = " WHERE CONTENT LIKE '%" + searchWord.trim() + "%' ";
}
sql = sql + sqlWord;
sql += " ORDER BY REF DESC, STEP ASC ";
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
List<BbsDto> list = new ArrayList<BbsDto>();
try {
conn = DBConnection.getConnection();
System.out.println("1/6 getBbsList success");
psmt = conn.prepareStatement(sql);
System.out.println("2/6 getBbsList success");
rs = psmt.executeQuery();
System.out.println("3/6 getBbsList success");
while(rs.next()) {
int i = 1;
BbsDto dto = new BbsDto(rs.getInt(i++),
rs.getString(i++),
rs.getInt(i++),
rs.getInt(i++),
rs.getInt(i++),
rs.getString(i++),
rs.getString(i++),
rs.getString(i++),
rs.getInt(i++),
rs.getInt(i++));
list.add(dto);
}
System.out.println("4/6 getBbsList success");
} catch (Exception e) {
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, rs);
}
return list;
}
public boolean updateBbs(int seq, String title, String content) {
String sql = " UPDATE BBS SET "
+ " TITLE=?, CONTENT=? "
+ " WHERE SEQ=? ";
Connection conn = null;
PreparedStatement psmt = null;
int count = 0;
try {
conn = DBConnection.getConnection();
System.out.println("1/6 S updateBbs");
psmt = conn.prepareStatement(sql);
psmt.setString(1, title);
psmt.setString(2, content);
psmt.setInt(3, seq);
System.out.println("2/6 S updateBbs");
count = psmt.executeUpdate();
System.out.println("3/6 S updateBbs");
} catch (Exception e) {
e.printStackTrace();
} finally{
DBClose.close(psmt, conn, null);
System.out.println("5/6 S updateBbs");
}
return count>0?true:false;
}
// 글의 모든 갯수
/*
public int getAllBbs() {
String sql = " SELECT COUNT(*) FROM BBS ";
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
int len = 0;
try {
conn = DBConnection.getConnection();
psmt = conn.prepareStatement(sql);
rs = psmt.executeQuery();
if(rs.next()) {
len = rs.getInt(1);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, rs);
}
return len;
}
*/
public int getAllBbs(String choice, String searchWord) {
String sql = " SELECT COUNT(*) FROM BBS ";
String sqlWord = "";
if(choice.equals("title")) {
sqlWord = " WHERE TITLE LIKE '%" + searchWord.trim() + "%' ";
}else if(choice.equals("writer") && !searchWord.equals("")) {
sqlWord = " WHERE ID='" + searchWord.trim() + "'";
}else if(choice.equals("content")) {
sqlWord = " WHERE CONTENT LIKE '%" + searchWord.trim() + "%' ";
}
sql += sqlWord;
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
int len = 0;
try {
conn = DBConnection.getConnection();
psmt = conn.prepareStatement(sql);
rs = psmt.executeQuery();
if(rs.next()) {
len = rs.getInt(1);
}
} catch (Exception e) {
System.out.println("getAllBbs fail");
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, rs);
}
return len;
}
public List<BbsDto> getBbsPagingList(String choice, String searchWord, int page) {
/*
1. row 번호
2. 검색
3. 정렬
4. 범위 1 ~ 10
*/
String sql = " SELECT SEQ, ID, REF, STEP, DEPTH, "
+ " TITLE, CONTENT, WDATE, "
+ " DEL, READCOUNT "
+ " FROM ";
sql += "(SELECT ROW_NUMBER()OVER(ORDER BY REF DESC, STEP ASC) AS RNUM, " +
" SEQ, ID, REF, STEP, DEPTH, TITLE, CONTENT, WDATE, DEL, READCOUNT " +
" FROM BBS ";
String sqlWord = "";
if(choice.equals("title")) {
sqlWord = " WHERE TITLE LIKE '%" + searchWord.trim() + "%' AND DEL=0 ";
}else if(choice.equals("writer")) {
sqlWord = " WHERE ID='" + searchWord.trim() + "'";
}else if(choice.equals("content")) {
sqlWord = " WHERE CONTENT LIKE '%" + searchWord.trim() + "%' ";
}
sql = sql + sqlWord;
sql += " ORDER BY REF DESC, STEP ASC) ";
sql += " WHERE RNUM >= ? AND RNUM <= ? ";
int start, end;
start = 1 + 10 * page; // 시작 글의 번호
end = 10 + 10 * page; // 끝 글의 번호
/*
String sql = " SELECT SEQ, ID, REF, STEP, DEPTH, "
+ " TITLE, CONTENT, WDATE, "
+ " DEL, READCOUNT "
+ " FROM BBS ";
String sqlWord = "";
if(choice.equals("title")) {
sqlWord = " WHERE TITLE LIKE '%" + searchWord.trim() + "%' AND DEL=0 ";
}else if(choice.equals("writer")) {
sqlWord = " WHERE ID='" + searchWord.trim() + "'";
}else if(choice.equals("content")) {
sqlWord = " WHERE CONTENT LIKE '%" + searchWord.trim() + "%' ";
}
sql = sql + sqlWord;
sql += " ORDER BY REF DESC, STEP ASC ";
*/
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
List<BbsDto> list = new ArrayList<BbsDto>();
try {
conn = DBConnection.getConnection();
System.out.println("1/6 getBbsList success");
psmt = conn.prepareStatement(sql);
psmt.setInt(1, start);
psmt.setInt(2, end);
System.out.println("2/6 getBbsList success");
rs = psmt.executeQuery();
System.out.println("3/6 getBbsList success");
while(rs.next()) {
int i = 1;
BbsDto dto = new BbsDto(rs.getInt(i++),
rs.getString(i++),
rs.getInt(i++),
rs.getInt(i++),
rs.getInt(i++),
rs.getString(i++),
rs.getString(i++),
rs.getString(i++),
rs.getInt(i++),
rs.getInt(i++));
list.add(dto);
}
System.out.println("4/6 getBbsList success");
} catch (Exception e) {
e.printStackTrace();
} finally {
DBClose.close(psmt, conn, rs);
}
return list;
}
}
| [
"d4ntsky@gmail.com"
] | d4ntsky@gmail.com |
574a0075593c839425606f737b58e2b34e8fafa9 | d25429a243835f1ab8647d5c0ecaf43c8303e46e | /src/com/dreamers/model/BanglaWord.java | c276b3c5241d134f61ef11bb737909ddc7b586df | [] | no_license | arafat055/EasyDictionary | 3c752fb5622330d2ba7713a7981a331a0a0cc483 | a94b0cf594e12d2bf9183c3ff4573f1aeec1b815 | refs/heads/master | 2021-01-10T13:54:42.192020 | 2015-10-21T03:48:54 | 2015-10-21T03:48:54 | 44,667,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package com.dreamers.model;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
@Table(name = "bangla_word")
public class BanglaWord extends Model {
@Column (name="code")
public int code;
@Column (name="bng_word")
public String banglaWord;
@Column (name="phonetic")
public String phonetic;
@Column (name="synonym")
public String synonym;
@Column (name="antonym")
public String antonym;
@Column (name="pronunciation")
public String pronunciation;
public BanglaWord()
{
super();
}
public BanglaWord(int id,String bng, String phon)
{
super();
code=id;
banglaWord=bng;
phonetic=phon;
}
public BanglaWord(int id,String bng, String phon,String synonym,String antonym,String pronunciation)
{
super();
code=id;
banglaWord=bng;
phonetic=phon;
this.synonym=synonym;
this.antonym=antonym;
this.pronunciation=pronunciation;
}
}
| [
"mazharul0904055@yahoo.com"
] | mazharul0904055@yahoo.com |
712c0f8dd8c29e4db08def2b75add7d27f93026b | 1c2ad321a1c12ff8a648dd7667405be991007a47 | /src/main/java/com/prefab/sales/production/CustomizedElement.java | 3776f2e40b6d5c42d30db2e67c36a17d61d717c2 | [] | no_license | mnpositiveengineer/prefab | 4b867b3c5a4fed5c99b1d70a80281214df02f2c0 | 4e87350e853f14c2e6508bdcdbb8dfd3358c7c57 | refs/heads/master | 2023-03-01T00:10:30.770619 | 2021-02-15T22:11:08 | 2021-02-15T22:11:08 | 267,918,616 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,028 | java | package com.prefab.sales.production;
import com.prefab.sales.production.interfaces.CalculateElement;
public class CustomizedElement extends StandardElement {
private float volume;
private float area;
private float weight;
private float frameworkArea;
private float steelWeight;
private float tensionWeight;
private float volumeOfConsoles;
private float volumeOfCutouts;
public CustomizedElement(String name, int amount, String typeOfElement) {
super(name, amount, typeOfElement);
}
public float getVolume() {
return volume;
}
public void setVolume(float volume) {
this.volume = volume;
}
public float getArea() {
return area;
}
public void setArea(float area) {
this.area = area;
}
public float getWeight() {
return weight;
}
public void setWeight(float weight) {
this.weight = weight;
}
public float getFrameworkArea() {
return frameworkArea;
}
public void setFrameworkArea(float frameworkArea) {
this.frameworkArea = frameworkArea;
}
public float getSteelWeight() {
return steelWeight;
}
public void setSteelWeight(float steelWeight) {
this.steelWeight = steelWeight;
}
public float getTensionWeight() {
return tensionWeight;
}
public void setTensionWeight(float tensionWeight) {
this.tensionWeight = tensionWeight;
}
public float getVolumeOfConsoles() {
return volumeOfConsoles;
}
public void setVolumeOfConsoles(float volumeOfConsoles) {
this.volumeOfConsoles = volumeOfConsoles;
}
public float getVolumeOfCutouts() {
return volumeOfCutouts;
}
public void setVolumeOfCutouts(float volumeOfCutouts) {
this.volumeOfCutouts = volumeOfCutouts;
}
public CalculateElement calculate(){
return new CustomizedCalculateElementCalculator(this);
}
public class CustomizedCalculateElementCalculator extends Calculator {
private CustomizedElement element;
public CustomizedCalculateElementCalculator(CustomizedElement element) {
super(element);
this.element = element;
}
@Override
public float calculateVolume() {
return element.getVolume() + element.getVolumeOfConsoles() - element.getVolumeOfCutouts();
}
@Override
public float calculateArea() {
return element.getArea();
}
@Override
public float calculateWeight() {
return element.getWeight();
}
@Override
public float calculateSteelWeight() {
return element.getSteelWeight();
}
@Override
public float calculateTensionWeight() {
return element.getTensionWeight();
}
@Override
public float calculateFrameworkArea() {
return element.getFrameworkArea();
}
}
}
| [
"mnpositiveengineer@gmail.com"
] | mnpositiveengineer@gmail.com |
2498f07dcabb215880840079c6d269709d50968e | 4607d2977064dec2f99df8aead6addbc354f77b4 | /src/com/rj/design/study/flyweight/eg3/FlyweightFactory.java | b927c9c1296f58d54abef1eb250eb6042c21b438 | [] | no_license | RJDove/designPattren | 1d96180508427900c9c46e94699be0f91e394f6f | be0d2175cba04b6c8714fdb1e7490055234c8fce | refs/heads/master | 2020-05-03T23:11:21.620277 | 2020-04-21T00:46:56 | 2020-04-21T00:46:56 | 178,859,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 834 | java | package com.rj.design.study.flyweight.eg3;
import java.util.HashMap;
import java.util.Map;
/**
* 享元工厂,通常实现成为单例
* @author renjin
* @date 2020/1/10
*/
public class FlyweightFactory {
private static FlyweightFactory factory = new FlyweightFactory();
private FlyweightFactory() {
}
public static FlyweightFactory getInstance() {
return factory;
}
/**
* 缓存多个Flyweight对象
*/
private Map<String, Flyweight> fsMap = new HashMap<>();
/**
* 获取key对应的享元对象
* @param key
* @return
*/
public Flyweight getFlyweight(String key) {
Flyweight f = fsMap.get(key);
if (f == null) {
f = new AuthorizationFlyweight(key);
fsMap.put(key, f);
}
return f;
}
}
| [
"983682550@qq.com"
] | 983682550@qq.com |
fceca5a40c6c4a98e8eb4ed7d147b785a36c5dba | eb66b61334293c4ad149ed9a69361a3e3505f223 | /easy/Count and Say.java | fe8cef1f92d402562784facc1026663f20d583b9 | [] | no_license | hojason117/LeetCode | a32c4eb32bb59defe5523cc205a3f33f2bef68e6 | 3383527c291d9b72aa44c9c7f5dfd410e59bfcf9 | refs/heads/master | 2021-01-09T05:34:33.433263 | 2019-05-05T19:32:17 | 2019-05-05T19:32:17 | 80,792,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | class Solution {
public String countAndSay(int n) {
String result = "1";
for(int i = 1; i < n; i++) {
StringBuilder sb = new StringBuilder();
char current = result.charAt(0);
int count = 1;
for(int j = 1; j < result.length(); j++) {
if(result.charAt(j) != current) {
sb.append(String.format("%d%c", count, current));
current = result.charAt(j);
count = 1;
}
else
count++;
}
sb.append(String.format("%d%c", count, current));
result = sb.toString();
}
return result;
}
}
| [
"hojason117@gmail.com"
] | hojason117@gmail.com |
6819be9065bad300e3b3e5dded32fd456a5b1323 | 84a4627f398b9329fd1a5587fc71ac4d8588fe4a | /backend/src/main/java/nl/rickslot/app/service/AccountService.java | 9d654b3429da7e2476aa562b9e8b5216af248219 | [] | no_license | RickSlot/MyPortfolioApp | deb5b464185e43d5b04f88e7a580dfa698cfc2d7 | ec8717eacc601db37042298a4a44dbfaa1207ef7 | refs/heads/master | 2016-08-07T15:57:18.251547 | 2014-03-26T14:19:34 | 2014-03-26T14:19:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package nl.rickslot.app.service;
import nl.rickslot.app.model.Account;
import org.springframework.web.servlet.ModelAndView;
/**
* @author Rick Slot
*/
public interface AccountService {
/**
* Saves an account
* @param account
* @return true if saved, false if not
*/
boolean save(Account account);
/**
* Finds an account by its username
* @param username username of the account
* @return the account that is found
*/
Account findByUsername(String username);
/**
* Creates the view that is needed to show the account page properly
* @param username the username of the account
* @return ModelAndView object with all necessary objects
*/
ModelAndView createViewForAccount(String username);
/**
* Edits an account
* @param account the account that is edited
* @return true if edited, false otherwise
*/
boolean edit(Account account);
}
| [
"rick.slot@trifork.nl"
] | rick.slot@trifork.nl |
8fc39fa70d5512ceb04c278ab4017fe360050553 | 75a3620b5273ef4cdcd841a7293782a51b92900f | /src/org/apache/hadoop/fs/swift/SwiftFileSystem.java | 6c4d2219e65a87d37003e245465587f6909a67d0 | [] | no_license | azachos/hadoop-fs-swift | cf249c61388080f99a7d7b553791889b476f934e | dc46b2b18b7ead33d6c74a8266e0b7eb792a1bdd | refs/heads/master | 2021-06-11T17:09:57.926662 | 2012-11-09T18:46:26 | 2012-11-09T18:46:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,921 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.fs.swift;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.URI;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.SimpleTimeZone;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.BufferedFSInputStream;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FSInputStream;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.s3.S3Exception;
import org.apache.hadoop.io.retry.RetryPolicies;
import org.apache.hadoop.io.retry.RetryPolicy;
import org.apache.hadoop.io.retry.RetryProxy;
import org.apache.hadoop.util.Progressable;
import com.rackspacecloud.client.cloudfiles.FilesClient;
import com.rackspacecloud.client.cloudfiles.FilesContainer;
import com.rackspacecloud.client.cloudfiles.FilesContainerMetaData;
import com.rackspacecloud.client.cloudfiles.FilesObject;
import com.rackspacecloud.client.cloudfiles.FilesObjectMetaData;
/**
* @author Constantine Peresypkin
*
* <p>
* A distributed implementation of {@link FileSystem}
* for reading and writing files on
* <a href="http://swift.openstack.org/">Openstack Swift</a>.
* </p>
*/
public class SwiftFileSystem extends FileSystem {
private class SwiftFsInputStream extends FSInputStream {
private InputStream in;
private long pos = 0;
private String objName;
private String container;
public SwiftFsInputStream(InputStream in, String container, String objName) {
this.in = in;
this.objName = objName;
this.container = container;
System.out.println("create inputstream: " + container + "/" + objName); //debug
}
public void close() throws IOException {
in.close();
}
@Override
public long getPos() throws IOException {
return pos;
}
@Override
public int read() throws IOException {
System.out.println("reading from inputstream"); //debug
int result = in.read();
if (result != -1) {
pos++;
}
return result;
}
public synchronized int read(byte[] b, int off, int len)
throws IOException {
System.out.println("reading from inputstream"); //debug
int result = in.read(b, off, len);
if (result > 0) {
pos += result;
}
return result;
}
@Override
public void seek(long pos) throws IOException {
System.out.println("seeking to " + pos + " (bytes) in " + container + "/" + objName); //debug
try {
in.close();
in = client.getObjectAsStream(container, objName, pos);
this.pos = pos;
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean seekToNewSource(long targetPos) throws IOException {
return false;
}
}
private class SwiftFsOutputStream extends OutputStream {
private PipedOutputStream toPipe;
private PipedInputStream fromPipe;
private SwiftProgress callback;
private long pos = 0;
private Thread thread;
private long segment;
private String container;
private String objName;
private int bufferSize;
private HashMap<String,String> metaData;
public SwiftFsOutputStream(final ISwiftFilesClient client, final String container,
final String objName, int bufferSize, Progressable progress, HashMap<String,String> metaData) throws IOException {
this.callback = new SwiftProgress(progress);
this.segment = 0;
this.container = container;
this.objName = objName;
this.bufferSize = bufferSize;
this.metaData = metaData;
System.out.println("create outputstream: " + container + "/" + objName + " with buffer: " + bufferSize); //debug
startOutputThread();
}
private void startOutputThread() throws IOException {
this.toPipe = new PipedOutputStream();
this.fromPipe = new PipedInputStream(toPipe, bufferSize);
this.thread = new Thread() {
public void run(){
try {
client.storeStreamedObject(container, fromPipe, "binary/octet-stream", objName, metaData);
} catch (Exception e) {
e.printStackTrace();
}
}
};
thread.start();
}
private boolean switchObjectStream(int offset) throws IOException {
try {
if (pos + offset > MAX_SWIFT_FILE_SIZE) {
toPipe.flush();
toPipe.close();
thread.join();
segment++;
pos = 0;
return true;
}
} catch (InterruptedException e) {
e.printStackTrace();
}
return false;
}
@Override
public synchronized void close() {
try {
System.out.println("closing outputstream"); //debug
toPipe.flush();
toPipe.close();
thread.join();
//client.createManifestObject(container, "binary/octet-stream", objName, container + "/" + objName, new HashMap<String, String>());
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Override
public synchronized void flush() {
try {
toPipe.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public synchronized void write(byte[] b) throws IOException {
//if(switchObjectStream(b.length))
// startOutputThread();
toPipe.write(b);
pos += b.length;
callback.progress(pos);
}
@Override
public synchronized void write(byte[] b, int off, int len) {
try {
//if(switchObjectStream(len))
// startOutputThread();
toPipe.write(b, off, len);
pos += len;
callback.progress(pos);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public synchronized void write(int b) throws IOException {
//if(switchObjectStream(1))
// startOutputThread();
toPipe.write(b);
pos++;
callback.progress(pos);
}
}
private static final long MAX_SWIFT_FILE_SIZE = 5 * 1024 * 1024 * 1024L;
private static final int LARGE_OBJECT_SUFFIX_COUNT = 8;
private static final String LARGE_OBJECT_SUFFIX_FORMAT = "/%03d";
private static long[] LARGE_OBJECT_SUFFIX_BUCKET;
private static final String FOLDER_MIME_TYPE = "application/directory";
private static final String SWIFT_USER = "swift";
private static final String SWIFT_GROUP = "system";
private static final String HADOOP_GROUP = "hadoop";
private static final String DEFAULT_DIR_PERM = "700";
private static final String DEFAULT_FILE_PERM = "644";
protected static final SimpleDateFormat rfc822DateParser = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
static {
rfc822DateParser.setTimeZone(new SimpleTimeZone(0, "GMT"));
LARGE_OBJECT_SUFFIX_BUCKET = new long[LARGE_OBJECT_SUFFIX_COUNT];
LARGE_OBJECT_SUFFIX_BUCKET[0] = 1L << LARGE_OBJECT_SUFFIX_COUNT;
for(int i = 1; i < LARGE_OBJECT_SUFFIX_COUNT; ++i) {
LARGE_OBJECT_SUFFIX_BUCKET[i] = LARGE_OBJECT_SUFFIX_BUCKET[i-1]
+ (1L << (LARGE_OBJECT_SUFFIX_COUNT - i)) * (1L << ((LARGE_OBJECT_SUFFIX_COUNT + 1) * i));
}
}
private String getLargeObjectSuffix(long index) {
for (int i = 0; i < LARGE_OBJECT_SUFFIX_COUNT; ++i) {
if (index < LARGE_OBJECT_SUFFIX_BUCKET[i]) {
StringBuilder sb = new StringBuilder();
for (int j = 1; j <= (i+1); ++j) {
sb.insert(0, String.format(LARGE_OBJECT_SUFFIX_FORMAT, index % (1L << (LARGE_OBJECT_SUFFIX_COUNT + 1))));
index /= (1L << (LARGE_OBJECT_SUFFIX_COUNT + 1));
}
return sb.toString();
}
}
return null;
}
private long getLargeObjectIndex(String suffix) {
String[] suffixes = suffix.split("/");
long result = 0L;
int j = 0;
for (int i = suffixes.length - 1; i >= 0; --i) {
result += Integer.parseInt(suffixes[i]) * (1L << ((LARGE_OBJECT_SUFFIX_COUNT + 1) * j));
j++;
}
return result;
}
private static ISwiftFilesClient createDefaultClient(URI uri, Configuration conf) {
FilesClientWrapper client = createSwiftClient(uri, conf);
RetryPolicy basePolicy = RetryPolicies.retryUpToMaximumCountWithFixedSleep(
conf.getInt("fs.swift.maxRetries", 4),
conf.getLong("fs.swift.sleepTimeSeconds", 10), TimeUnit.SECONDS);
Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
new HashMap<Class<? extends Exception>, RetryPolicy>();
exceptionToPolicyMap.put(IOException.class, basePolicy);
exceptionToPolicyMap.put(S3Exception.class, basePolicy);
RetryPolicy methodPolicy = RetryPolicies.retryByException(
RetryPolicies.TRY_ONCE_THEN_FAIL, exceptionToPolicyMap);
Map<String, RetryPolicy> methodNameToPolicyMap =
new HashMap<String, RetryPolicy>();
methodNameToPolicyMap.put("storeStreamedObject", methodPolicy);
return (ISwiftFilesClient)
RetryProxy.create(ISwiftFilesClient.class, client,
methodNameToPolicyMap);
}
private static FilesClientWrapper createSwiftClient(URI uri, Configuration conf) {
String scheme = uri.getScheme();
String userNameProperty = String.format("fs.%s.userName", scheme);
String userSecretProperty = String.format("fs.%s.userPassword", scheme);
String userName = conf.get(userNameProperty);
String userSecret = conf.get(userSecretProperty);
if (userName == null && userSecret == null) {
throw new IllegalArgumentException("Swift " +
"User Name and Password " +
"must be specified as the " +
"username or password " +
"(respectively) of a " + scheme +
" URL, or by setting the " +
userNameProperty + " or " +
userSecretProperty +
" properties (respectively).");
} else if (userName == null) {
throw new IllegalArgumentException("Swift " +
"User Name must be specified " +
"as the username of a " + scheme +
" URL, or by setting the " +
userNameProperty + " property.");
} else if (userSecret == null) {
throw new IllegalArgumentException("Swift " +
"User Password must be " +
"specified as the password of a " +
scheme + " URL, or by setting the " +
userSecretProperty +
" property.");
}
String authUrlProperty = String.format("fs.%s.authUrl", scheme);
String accountNameProperty = String.format("fs.%s.accountName", scheme);
String authUrl = conf.get(authUrlProperty);
String account = conf.get(accountNameProperty);
if (authUrl == null) {
throw new IllegalArgumentException(
"Swift Auth Url must be specified by setting the " +
authUrlProperty +
" property.");
}
String timeoutProperty = String.format("fs.%s.connectionTimeout", scheme);
String connectionTimeOut = conf.get(timeoutProperty);
if (connectionTimeOut == null) {
throw new IllegalArgumentException(
"Swift Connection Timeout (in ms) " +
"must be specified by setting the " +
timeoutProperty +
" property (0 means indefinite timeout).");
}
return new FilesClientWrapper(new FilesClient(userName, userSecret, authUrl, account, Integer.parseInt(connectionTimeOut)));
}
public static Date parseRfc822Date(String dateString) throws ParseException {
synchronized (rfc822DateParser) {
return rfc822DateParser.parse(dateString);
}
}
private ISwiftFilesClient client;
private Path workingDir;
private URI uri;
@Override
public FSDataOutputStream append(Path f, int bufferSize,
Progressable progress) throws IOException {
throw new IOException("Not supported");
}
@Override
public FSDataOutputStream create(Path f, FsPermission permission,
boolean overwrite, int bufferSize, short replication,
long blockSize, Progressable progress) throws IOException {
SwiftPath absolutePath = makeAbsolute(f);
FileStatus stat = null;
try {
if ((stat = getFileStatus(absolutePath)) != null) {
if (!overwrite)
throw new IOException("create: "+ absolutePath +": File already exists");
if (stat.isDir())
throw new IOException("create: "+ absolutePath +": Is a directory");
}
} catch (FileNotFoundException e) {
// it's ok
}
if (absolutePath.isContainer()) {
throw new IOException("create: "+ absolutePath +": Is a directory");
}
HashMap<String, String> metaData = makeMetadata(System.getProperty("user.name"), HADOOP_GROUP, "" + permission.toShort(), Short.toString(replication), Long.toString(blockSize));
System.out.println("create: " + absolutePath); //debug
return new FSDataOutputStream(
new SwiftFsOutputStream(client, absolutePath.getContainer(),
absolutePath.getObject(), bufferSize, progress, metaData),
statistics);
}
private void createParent(Path path) throws IOException {
Path parent = path.getParent();
if (parent != null) {
SwiftPath absolutePath = makeAbsolute(parent);
if (absolutePath.getContainer().length() > 0) {
mkdirs(absolutePath);
}
}
}
@Override
@Deprecated
public boolean delete(Path path) throws IOException {
return delete(path, true);
}
@Override
public boolean delete(Path f, boolean recursive) throws IOException {
FileStatus status;
try {
status = getFileStatus(f);
} catch (FileNotFoundException e) {
return false;
}
SwiftPath absolutePath = makeAbsolute(f);
if (status.isDir()) {
FileStatus[] contents = listStatus(f);
if (!recursive && contents.length > 0) {
throw new IOException("delete: " + f + ": Directory is not empty");
}
for (FileStatus p : contents) {
if (!delete(p.getPath(), recursive)) {
return false;
}
}
}
if (absolutePath.isContainer()) {
return client.deleteContainer(absolutePath.getContainer());
}
if (client.deleteObject(absolutePath.getContainer(), absolutePath.getObject())) {
createParent(absolutePath);
return true;
}
return false;
}
@Override
public FileStatus getFileStatus(Path f) throws IOException {
SwiftPath absolutePath = makeAbsolute(f);
String container = absolutePath.getContainer();
String objName = absolutePath.getObject();
FilesObjectMetaData objectMeta = client.getObjectMetaData(container, objName);
FilesContainerMetaData containerMeta = client.getContainerMetaData(container);
if (container.length() == 0) { // root always exists
return newContainer(containerMeta, absolutePath);
}
try {
if (objectMeta != null) {
if (FOLDER_MIME_TYPE.equals(objectMeta.getMimeType())) {
System.out.println("opened folder: " + absolutePath); //debug
return newDirectory(objectMeta, absolutePath);
}
System.out.println("opened file: " + absolutePath); //debug
return newFile(objectMeta, absolutePath);
} else if(containerMeta != null && objName == null) {
System.out.println("opened container: " + absolutePath); //debug
return newContainer(containerMeta, absolutePath);
} else {
List<FilesObject> objList = client.listObjectsStartingWith(container, objName, 1, new Character('/'));
if (objList != null && objList.size() > 0) {
System.out.println("opened unknown: " + absolutePath); //debug
return newDirectory(new FilesObjectMetaData("application/directory","0","0","Thu, 01 Jan 1970 00:00:00 GMT"), absolutePath);
}
}
} catch (Exception e) {
e.printStackTrace();
}
throw new FileNotFoundException("stat: "+ absolutePath +
": No such file or directory");
}
@Override
public URI getUri() {
return uri;
}
@Override
public Path getWorkingDirectory() {
return workingDir;
}
public SwiftFileSystem() {
}
@Override
public void initialize(URI uri, Configuration conf) throws IOException {
super.initialize(uri, conf);
if (client == null) {
client = createDefaultClient(uri, conf);
}
setConf(conf);
this.uri = URI.create(uri.getScheme() + "://" + uri.getAuthority());
this.workingDir =
new Path("/user", System.getProperty("user.name")).makeQualified(this);
}
@Override
public FileStatus[] listStatus(Path f) throws IOException {
SwiftPath absolutePath = makeAbsolute(f);
FileStatus stat = getFileStatus(absolutePath);
if (stat != null && ! stat.isDir()) {
return new FileStatus[] { stat };
}
String container = absolutePath.getContainer();
//List<FileStatus> statList = new ArrayList<FileStatus>();
Set<FileStatus> statList = new TreeSet<FileStatus>();
if (container.length() == 0) { // we are listing root dir
List<FilesContainer> containerList = client.listContainers();
for (FilesContainer cont : containerList) {
statList.add(getFileStatus(new Path("/" + cont.getName())));
}
return statList.toArray(new FileStatus[0]);
}
String objName = absolutePath.getObject();
List<FilesObject> objList = client.listObjectsStartingWith(container,
(objName == null) ? null : objName + "/", -1, new Character('/'));
for (FilesObject obj : objList) {
String name = obj.getName();
System.out.println("list: /" + container + "/" + name);
if (name.lastIndexOf('/') == name.length() - 1)
name = name.substring(0, name.length() - 1);
statList.add(getFileStatus(new Path("/" + container, name)));
}
if (stat == null && statList.size() == 0) {
throw new FileNotFoundException("list: "+ absolutePath +
": No such file or directory");
}
return statList.toArray(new FileStatus[0]);
}
private SwiftPath makeAbsolute(Path path) {
if (path.isAbsolute()) {
return new SwiftPath(path.toUri());
}
return new SwiftPath((new Path(workingDir, path)).toUri());
}
@Override
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
SwiftPath absolutePath = makeAbsolute(f);
System.out.println("making directory: " + absolutePath); //debug
HashMap<String,String> metaData = makeMetadata(System.getProperty("user.name"), HADOOP_GROUP, "" + permission.toShort(), "0", "" + getBytes(Long.parseLong(this.getConf().get("fs.swift.blockSize"))));
if (absolutePath.isContainer()) {
return client.createContainer(absolutePath.getContainer(), metaData);
} else {
client.createContainer(absolutePath.getContainer(), metaData); // ignore exit value, container may exist
return client.createFullPath(absolutePath.getContainer(), absolutePath.getObject(), metaData);
}
}
@Override
public void setPermission(Path p, FsPermission permission
) throws IOException {
SwiftPath absolutePath = makeAbsolute(p);
Configuration conf = this.getConf();
String objName = absolutePath.getObject();
String container = absolutePath.getContainer();
try {
if(objName == null) {
FilesContainerMetaData metadata = client.getContainerMetaData(container);
Map<String,String> rawMetadata = new HashMap<String,String>();
if(metadata != null) {
rawMetadata = metadata.getMetaData();
} else {
rawMetadata = makeMetadata(SWIFT_USER, SWIFT_GROUP, DEFAULT_DIR_PERM, "0", "" + getBytes(Long.parseLong(conf.get("fs.swift.blockSize"))));
}
rawMetadata.put("Permissions", "" + permission.toShort());
client.updateContainerMetadata(container, rawMetadata);
} else {
FilesObjectMetaData metadata = client.getObjectMetaData(container, objName);
Map<String,String> rawMetadata = new HashMap<String,String>();
if(metadata != null) {
rawMetadata = metadata.getMetaData();
} else {
rawMetadata = makeMetadata(SWIFT_USER, SWIFT_GROUP, DEFAULT_FILE_PERM, conf.get("fs.swift.replication"), "" + getBytes(Long.parseLong(conf.get("fs.swift.blockSize"))));
}
rawMetadata.put("Permissions", "" + permission.toShort());
client.updateObjectMetadata(container, objName, rawMetadata);
}
System.out.println("setting permissions: " + absolutePath);
} catch(Exception e) {
e.printStackTrace();
}
}
@Override
public void setOwner(Path p, String username, String groupname
) throws IOException {
SwiftPath absolutePath = makeAbsolute(p);
Configuration conf = this.getConf();
String objName = absolutePath.getObject();
String container = absolutePath.getContainer();
try {
if(objName == null) {
FilesContainerMetaData metadata = client.getContainerMetaData(container);
Map<String,String> rawMetadata;
if(metadata != null) {
rawMetadata = metadata.getMetaData();
} else {
rawMetadata = makeMetadata(SWIFT_USER, SWIFT_GROUP, DEFAULT_DIR_PERM, "0", "" + getBytes(Long.parseLong(conf.get("fs.swift.blockSize"))));
}
if(username != null)
rawMetadata.put("User", username);
if(groupname != null)
rawMetadata.put("Group", groupname);
client.updateContainerMetadata(container, rawMetadata);
} else {
FilesObjectMetaData metadata = client.getObjectMetaData(container, objName);
Map<String,String> rawMetadata;
if(metadata != null) {
rawMetadata = metadata.getMetaData();
} else {
rawMetadata = makeMetadata(SWIFT_USER, SWIFT_GROUP, DEFAULT_FILE_PERM, conf.get("fs.swift.replication"), "" + getBytes(Long.parseLong(conf.get("fs.swift.blockSize"))));
}
if(username != null)
rawMetadata.put("User", username);
if(groupname != null)
rawMetadata.put("Group", groupname);
client.updateObjectMetadata(container, objName, rawMetadata);
}
System.out.println("setting owner: " + absolutePath); //debug;
} catch(Exception e) {
e.printStackTrace();
}
}
@Override
public boolean setReplication(Path src, short replication
) throws IOException {
Configuration conf = this.getConf();
SwiftPath absolutePath = makeAbsolute(src);
String objName = absolutePath.getObject();
String container = absolutePath.getContainer();
try {
if(objName == null) {
FilesContainerMetaData metadata = client.getContainerMetaData(container);
Map<String,String> rawMetadata = new HashMap<String,String>();
if(metadata != null) {
rawMetadata = metadata.getMetaData();
} else {
rawMetadata = makeMetadata(SWIFT_USER, SWIFT_GROUP, DEFAULT_DIR_PERM, "0", "" + getBytes(Long.parseLong(conf.get("fs.swift.blockSize"))));
}
rawMetadata.put("Replication", "" + replication);
if(client.updateContainerMetadata(container, rawMetadata))
return true;
} else {
FilesObjectMetaData metadata = client.getObjectMetaData(container, objName);
Map<String,String> rawMetadata = new HashMap<String,String>();
if(metadata != null) {
rawMetadata = metadata.getMetaData();
} else {
rawMetadata = makeMetadata(SWIFT_USER, SWIFT_GROUP, DEFAULT_FILE_PERM, conf.get("fs.swift.replication"), "" + getBytes(Long.parseLong(conf.get("fs.swift.blockSize"))));
}
rawMetadata.put("Replication", "" + replication);
if(client.updateObjectMetadata(container, objName, rawMetadata))
return true;
}
System.out.println("setting replication: " + absolutePath); //debug
} catch(Exception e) {
e.printStackTrace();
}
return false;
}
private HashMap<String, String> makeMetadata(String user, String group, String permissions, String replication, String blockSize) {
HashMap<String,String> metaData = new HashMap<String,String>();
metaData.put("User", user);
metaData.put("Group", group);
metaData.put("Permissions", permissions);
metaData.put("Replication", replication);
metaData.put("Blocksize", blockSize);
return metaData;
}
private Long getBytes(Long size) {
return size * 1024 * 1024;
}
private FileStatus newDirectory(FilesObjectMetaData meta, Path path) {
Configuration conf = this.getConf();
Date parsedDate = new Date();
parsedDate.setTime(0);
long parsedLength = 0L;
String user = SWIFT_USER;
String group = SWIFT_GROUP;
String permissions = DEFAULT_DIR_PERM;
long blockSize = Long.parseLong(conf.get("fs.swift.blockSize"));
try {
if(meta != null) {
parsedDate = parseRfc822Date(meta.getLastModified());
Map<String,String> extraMeta = meta.getMetaData();
if(extraMeta.containsKey("User"))
user = extraMeta.get("User");
if(extraMeta.containsKey("Group"))
group = extraMeta.get("Group");
if(extraMeta.containsKey("Permissions"))
permissions = extraMeta.get("Permissions");
if(extraMeta.containsKey("Blocksize"))
blockSize = Long.parseLong(extraMeta.get("Blocksize"));
}
return new FileStatus(parsedLength, true, 0, getBytes(blockSize),
parsedDate.getTime(), parsedDate.getTime(), new FsPermission(new Short(permissions)), user, group,
path.makeQualified(this));
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private FileStatus newContainer(FilesContainerMetaData meta, Path path) {
Configuration conf = this.getConf();
Date parsedDate = new Date();
parsedDate.setTime(0);
long parsedLength = 0L;
String user = SWIFT_USER;
String group = SWIFT_GROUP;
String permissions = DEFAULT_DIR_PERM;
long blockSize = Long.parseLong(conf.get("fs.swift.blockSize"));
try {
if(meta != null) {
parsedDate.setTime(Long.parseLong(meta.getLastModified().substring(0, meta.getLastModified().indexOf(".")) + "000"));
Map<String,String> extraMeta = meta.getMetaData();
if(extraMeta.containsKey("User"))
user = extraMeta.get("User");
if(extraMeta.containsKey("Group"))
group = extraMeta.get("Group");
if(extraMeta.containsKey("Permissions"))
permissions = extraMeta.get("Permissions");
if(extraMeta.containsKey("Blocksize"))
blockSize = Long.parseLong(extraMeta.get("Blocksize"));
}
return new FileStatus(parsedLength, true, 0, getBytes(blockSize),
parsedDate.getTime(), parsedDate.getTime(), new FsPermission(new Short(permissions)), user, group,
path.makeQualified(this));
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private FileStatus newFile(FilesObjectMetaData meta, Path path) {
Configuration conf = this.getConf();
Date parsedDate = new Date();
parsedDate.setTime(0);
long parsedLength = 0L;
String user = SWIFT_USER;
String group = SWIFT_GROUP;
String permissions = DEFAULT_FILE_PERM;
int replication = Integer.parseInt(conf.get("fs.swift.replication"));
long blockSize = Long.parseLong(conf.get("fs.swift.blockSize"));
try {
if(meta != null) {
parsedDate = parseRfc822Date(meta.getLastModified());
parsedLength = Long.parseLong(meta.getContentLength());
Map<String,String> extraMeta = meta.getMetaData();
if(extraMeta.containsKey("User"))
user = extraMeta.get("User");
if(extraMeta.containsKey("Group"))
group = extraMeta.get("Group");
if(extraMeta.containsKey("Permissions"))
permissions = extraMeta.get("Permissions");
if(extraMeta.containsKey("Blocksize"))
blockSize = Long.parseLong(extraMeta.get("Blocksize"));
if(extraMeta.containsKey("Replication"))
blockSize = Long.parseLong(extraMeta.get("Replication"));
}
if(blockSize > parsedLength) {
blockSize = parsedLength;
}
return new FileStatus(parsedLength, false, replication, getBytes(blockSize),
parsedDate.getTime(), parsedDate.getTime(), new FsPermission(new Short(permissions)), user, group,
path.makeQualified(this));
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
FileStatus stat = getFileStatus(f);
if (stat == null) {
throw new FileNotFoundException(f.toString());
}
if (stat.isDir()) {
throw new IOException("open: "+ f +": Is a directory");
}
System.out.println("opening: " + f); //debug
SwiftPath absolutePath = makeAbsolute(f);
String container = absolutePath.getContainer();
String objName = absolutePath.getObject();
return new FSDataInputStream(new BufferedFSInputStream(
new SwiftFsInputStream(client.getObjectAsStream(container, objName), container, objName), bufferSize));
}
@Override
public boolean rename(Path src, Path dst) throws IOException {
SwiftPath srcAbsolute = makeAbsolute(src);
SwiftPath dstAbsolute = makeAbsolute(dst);
if (srcAbsolute.getContainer().length() == 0) {
return false; // renaming root
}
try {
if (getFileStatus(dstAbsolute).isDir()) {
dstAbsolute = new SwiftPath((new Path (dstAbsolute, srcAbsolute.getName())).toUri());
} else {
return false; // overwrite existing file
}
} catch (FileNotFoundException e) {
try {
if (!getFileStatus(dstAbsolute.getParent()).isDir()) {
return false; // parent dst is a file
}
} catch (FileNotFoundException ex) {
return false; // parent dst does not exist
}
}
try {
if (getFileStatus(srcAbsolute).isDir()) {
if (srcAbsolute.getContainer().length() == 0) {
List<FilesContainer> fullList = client.listContainers();
for (FilesContainer container : fullList) {
List<FilesObject> list = client.listObjectsStartingWith(container.getName(), null, -1, null);
for (FilesObject fobj : list) {
client.copyObject(container.getName(), fobj.getName(),
dstAbsolute.getContainer(), dstAbsolute.getObject() + fobj.getName());
client.deleteObject(container.getName(), fobj.getName());
}
}
} else {
List<FilesObject> list = client.listObjectsStartingWith(srcAbsolute.getContainer(), srcAbsolute.getObject(), -1, null);
for (FilesObject fobj : list) {
client.copyObject(srcAbsolute.getContainer(), fobj.getName(),
dstAbsolute.getContainer(), dstAbsolute.getObject() + fobj.getName());
client.deleteObject(srcAbsolute.getContainer(), fobj.getName());
}
}
} else {
if (dstAbsolute.getObject() == null)
return false; // tried to rename object to container
client.copyObject(srcAbsolute.getContainer(), srcAbsolute.getObject(),
dstAbsolute.getContainer(), dstAbsolute.getObject());
client.deleteObject(srcAbsolute.getContainer(), srcAbsolute.getObject());
}
createParent(src);
return true;
} catch (FileNotFoundException e) {
// Source file does not exist;
return false;
}
}
@Override
public void setWorkingDirectory(Path newDir) {
this.workingDir = newDir;
}
}
| [
"Devon@Devon-PC.(none)"
] | Devon@Devon-PC.(none) |
c7ce57aa7dc7f698d35c23272fbd73e3ac96e072 | 1b91d45c57be8015da1c5c71f8a75abc9f306731 | /TripAdvisorKMS/src/java/Registration.java | 1ca0a748fe21aa70c6480c78d7e5b5ac06a5dcbe | [] | no_license | AdelineShen/TripAdvisor | 9925a8db400e19f8eff3843f16642c9989fd22c7 | 66aeee2cbee6efa6a1066f85c1fac194a77d33a6 | refs/heads/master | 2020-04-05T10:30:02.028500 | 2018-11-11T20:24:48 | 2018-11-11T20:24:48 | 156,801,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,484 | 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.
*/
import javax.inject.Named;
import javax.enterprise.context.Dependent;
import java.sql.*;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
/**
*
* @author shenm9730
*/
@Named(value = "registration")
@Dependent
@ManagedBean
@RequestScoped
public class Registration {
private String id="";
private String password ="";
private String tag="";
public String register()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
}
catch (Exception e)
{
return ("Internal Error! Please try again later.");
}
Connection conn=null;
Statement stat=null;
ResultSet rs=null;
try
{
final String db_url="jdbc:mysql://mis-sql.uhcl.edu/shenm9730";
conn=DriverManager.getConnection(db_url,"shenm9730","1636900");
stat=conn.createStatement();
rs=stat.executeQuery("Select * from profile where ID='"+id+"'");
if(rs.next())
{
return("User ID taken. Account creation failed");
}
else
{
int r=stat.executeUpdate("Insert into profile values('"+id+"','"+password+"','"+tag+"','regular')");
return("The new traveler account is created!");
}
}
catch(SQLException e)
{
e.printStackTrace();
return("Account creation failed!");
}
finally
{
try
{
conn.close();
stat.close();
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
665e0f040ad269323178e38a2d06b1994ee8c800 | 38d2ca1f02b867248aeff52f539b147979f3b4c5 | /FoodOrderDelivery/src/test/java/runner/TestRunner.java | e802be04864c81029d827d44be7df521524a8e55 | [] | no_license | rahulchauhan29/FoodOrderDelivery | c3ebbfbff803c477664fcf7faf86b364d097847c | b07e77c6e271ac263fc6b8bd3ca1bb1f378fce56 | refs/heads/main | 2023-05-24T04:33:58.194349 | 2021-06-22T11:15:55 | 2021-06-22T11:15:55 | 379,238,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package runner;
import java.io.File;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import manager.FileReaderManager;
@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources/feature", glue = { "stepDef" }, plugin = {
"com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html" }, tags = "@clearCart", monochrome = true, dryRun = false)
public class TestRunner {
@AfterClass
public static void writeExtentReport() {
Reporter.loadXMLConfig(new File(FileReaderManager.getInstance().getConfigReader().getReportConfigPath()));
}
}
| [
"rahul@LAPTOP-NBK9NGFB"
] | rahul@LAPTOP-NBK9NGFB |
3455b2c6e48d43d199f401851547526949061412 | ee7f22b40aca2dfe75e78370a64c82ab8d33c827 | /micro1/src/main/java/com/everis/micro/Micro1Application.java | 8b15332b01cfcefb45abb3192e98aeaa9e0069a3 | [] | no_license | jgil/spring-cloud-playground | 1a33e40573cdd6d67d1b44e8586de92eb47650c7 | 26d27ec0c358352b1cf1daccc81b89708cd95204 | refs/heads/master | 2021-09-04T02:31:05.037982 | 2018-01-14T18:08:47 | 2018-01-14T18:08:47 | 110,580,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package com.everis.micro;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableDiscoveryClient
@EnableEurekaClient
public class Micro1Application {
public static void main(String[] args) {
SpringApplication.run(Micro1Application.class, args);
}
}
| [
"jordigilnieto@gmail.com"
] | jordigilnieto@gmail.com |
91d7e28236fb2e64536fbea1e7f0bea802703c3c | 0ed70ec2d818d4ba8f9bd75d78bc452ebbab37ea | /eBayRPS/src/main/java/com/jinbal/ebayrps/Main.java | 71ae5c636269bc92b06db68f4442362c84bec249 | [] | no_license | jinbal/codingtests | c0202cf1ffc28eb81f4199a0072336afa674b68a | bc8f0c7c45be7ae7843bacc19154546eaeb4bb7b | refs/heads/master | 2020-12-03T10:30:22.669731 | 2015-04-28T15:24:01 | 2015-04-28T15:24:01 | 16,124,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | java | package com.jinbal.ebayrps;
import com.jinbal.ebayrps.gamecontrol.GameEngine;
import com.jinbal.ebayrps.gamejudging.rounds.TwoPlayerRoundJudgingStrategy;
import com.jinbal.ebayrps.gamejudging.weapons.ModuloArithmeticWeaponJudge;
import com.jinbal.ebayrps.ui.ScannerGameUI;
public class Main {
public static void main(String[] args) {
GameEngine gameEngine = new GameEngine(
new TwoPlayerRoundJudgingStrategy(new ModuloArithmeticWeaponJudge()),
new ScannerGameUI());
gameEngine.start();
}
}
| [
"jinbal@hotmail.com"
] | jinbal@hotmail.com |
2d97ed48507df97aa1ae5696b067b93e9863742b | 181302282dc582500fb9c241fdf34f131c0506aa | /src/main/java/oit/is/z0614/kaizi/janken/controller/Lec02Controller.java | 25fce7978932888612ac01bf96f1ad84ac6d7868 | [] | no_license | ryota6869/janken | 69e6212d0686841527bc419a13ada8b73e7fd464 | eea03b2eb3cbb64fc16291555242ffa6e8d6d7a6 | refs/heads/main | 2023-08-26T12:47:35.720034 | 2021-11-08T13:53:14 | 2021-11-08T13:53:14 | 411,158,912 | 0 | 0 | null | 2021-11-08T13:53:15 | 2021-09-28T06:13:03 | Java | UTF-8 | Java | false | false | 3,821 | java | package oit.is.z0614.kaizi.janken.controller;
import java.security.Principal;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import oit.is.z0614.kaizi.janken.model.Entry;
import oit.is.z0614.kaizi.janken.model.Janken;
import oit.is.z0614.kaizi.janken.model.Match;
import oit.is.z0614.kaizi.janken.model.MatchMapper;
import oit.is.z0614.kaizi.janken.model.User;
import oit.is.z0614.kaizi.janken.model.UserMappaer;
import oit.is.z0614.kaizi.janken.service.AsyncKekka;
import oit.is.z0614.kaizi.janken.model.MatchInfo;
import oit.is.z0614.kaizi.janken.model.MatchInfoMapper;
@Controller
public class Lec02Controller {
@Autowired
private Entry entry;
@Autowired
UserMappaer userMappaer;
@Autowired
MatchMapper matchMapper;
@Autowired
MatchInfoMapper matchInfoMapper;
@Autowired
private AsyncKekka acKekka;
@GetMapping("/lec02")
public String lec02(Principal principal, ModelMap model) {
String loginUser = principal.getName();
this.entry.addUser(loginUser);
ArrayList<User> users = userMappaer.selectAllUsers();
model.addAttribute("users", users);
ArrayList<Match> matchs = matchMapper.selectAllMatches();
ArrayList<MatchInfo> mInfos = matchInfoMapper.selectTrueMatchinfo();
model.addAttribute("mInfos", mInfos);
model.addAttribute("matchs", matchs);
model.addAttribute("entry", this.entry);
model.addAttribute("loginUser", loginUser);
return "lec02.html";
}
@GetMapping("/lec02janken")
@Transactional
public String jankenResalut(@RequestParam String hand, ModelMap model) {
Janken janken = new Janken(hand);
model.addAttribute("janken", janken);
model.addAttribute("entry", this.entry);
ArrayList<User> users = userMappaer.selectAllUsers();
model.addAttribute("users", users);
ArrayList<Match> matchs = matchMapper.selectAllMatches();
model.addAttribute("matchs", matchs);
return "lec02.html";
}
@GetMapping("/match")
@Transactional
public String match(@RequestParam Integer id, Principal prin, ModelMap model){
User user = userMappaer.selectByid(id);
model.addAttribute("login_user", prin.getName());
model.addAttribute("user", user);
return "match.html";
}
@GetMapping("/wait")
@Transactional
public String wait(@RequestParam Integer id, @RequestParam String hand, Principal prin, ModelMap model) {
MatchInfo mInfo = new MatchInfo();
ArrayList<MatchInfo> mInfos = matchInfoMapper.selectTrueMatchinfo();
Match match = new Match();
boolean matchingFlag = false;
model.addAttribute("login_user", prin.getName());
User player = userMappaer.selectByName(prin.getName());
User othUser = userMappaer.selectByid(id);
for (MatchInfo mi : mInfos) {
if (mi.getUser1() == othUser.getId() && mi.getUser2() == player.getId()) {
match.setAllData(player, othUser, hand, mi.getUser1Hand());
matchMapper.insertMatch(match);
matchingFlag = true;
matchInfoMapper.updateFalseIsactive(mi);
break;
}
}
if (matchingFlag == false) {
mInfo.setAllData(player, othUser, hand);
matchInfoMapper.insertMatchInfo(mInfo);
}
return "wait.html";
}
@GetMapping("/result")
public SseEmitter showResult() {
final SseEmitter sseEmitter = new SseEmitter();
this.acKekka.asnyShowMatchResult(sseEmitter);
return sseEmitter;
}
}
| [
"e1b19056@oit.ac.jp"
] | e1b19056@oit.ac.jp |
b031876fd1b3eef9bad23958a41b0d4af4cd337d | 23ac40cd067845af6670c7602729626f084268cb | /app/src/main/java/com/supertask/Util.java | 8bd636b6316c0f7321504f1a992072f30c3cd0b5 | [] | no_license | todipratik/SuperTask | 7903c24ba475bec4560bad859794622d9f0f0336 | 52f9ab0f3d2af27c2a8e37cd0c65ddb27d8c82f0 | refs/heads/master | 2021-01-10T02:44:27.598110 | 2015-10-24T10:40:09 | 2015-10-24T10:40:09 | 44,538,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,127 | java | package com.supertask;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Environment;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;
/**
* Created by pratik on 18/10/15.
*/
public class Util {
private static final String PREF_NAME = "SuperTaskSettings";
public static final String KEY_CHOICE_SET = "choice_set";
public static final String KEY_SHIRT_PATH = "shirt_path";
public static final String KEY_PANT_PATH = "pant_path";
public static final String KEY_BOOKMARKED = "bookmarked";
public static final String KEY_SHIRT_PRESENT = "shirt_present";
public static final String KEY_PANT_PRESENT = "pant_present";
public static File getPathToStorage(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
}
public static String getFileNameForShirt() {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "shirt_" + timeStamp + "_";
return imageFileName;
}
public static String getFileNameForPant() {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "pant_" + timeStamp + "_";
return imageFileName;
}
public static SharedPreferences getSharedPrefsObject(Context context) {
return context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
public static List<String> getAllShirtPaths(Context context) {
File file = getPathToStorage(context);
File[] allFiles = file.listFiles();
List<String> pathOfImageFiles = new ArrayList<>();
long index = 0;
while (index < allFiles.length) {
File f = allFiles[((int) index)];
if (f.length() > 0) {
String path = f.getAbsolutePath();
if (f.getName().startsWith("shirt"))
pathOfImageFiles.add(path);
}
index++;
}
return pathOfImageFiles;
}
public static List<String> getAllPantPaths(Context context) {
File file = getPathToStorage(context);
File[] allFiles = file.listFiles();
List<String> pathOfImageFiles = new ArrayList<>();
long index = 0;
while (index < allFiles.length) {
File f = allFiles[((int) index)];
if (f.length() > 0) {
String path = f.getAbsolutePath();
if (f.getName().startsWith("pant"))
pathOfImageFiles.add(path);
}
index++;
}
return pathOfImageFiles;
}
public static void setShirtForToday(Context context) {
List<String> shirts = getAllShirtPaths(context);
if (shirts.size() == 0)
return;
String shirtPath = "";
SharedPreferences sharedPreferences = getSharedPrefsObject(context);
SharedPreferences.Editor editor = sharedPreferences.edit();
Integer randomNumber = randomNumber(0, shirts.size() - 1);
shirtPath = shirts.get(randomNumber);
editor.putBoolean(KEY_SHIRT_PRESENT, true);
editor.putString(KEY_SHIRT_PATH, shirtPath);
editor.commit();
return;
}
public static void setPantForToday(Context context) {
List<String> pants = getAllPantPaths(context);
if (pants.size() == 0)
return;
String pantPath = "";
SharedPreferences sharedPreferences = getSharedPrefsObject(context);
SharedPreferences.Editor editor = sharedPreferences.edit();
Integer randomNumber = randomNumber(0, pants.size() - 1);
pantPath = pants.get(randomNumber);
editor.putBoolean(KEY_PANT_PRESENT, true);
editor.putString(KEY_PANT_PATH, pantPath);
editor.commit();
return;
}
public static void setImageChoiceForToday(Context context) {
List<String> shirts = getAllShirtPaths(context);
List<String> pants = getAllPantPaths(context);
if (shirts.size() == 0 && pants.size() == 0) {
return;
}
String shirtPath = "";
String pantPath = "";
SharedPreferences sharedPreferences = getSharedPrefsObject(context);
SharedPreferences.Editor editor = sharedPreferences.edit();
if (shirts.size() > 0) {
Integer randomNumber = randomNumber(0, shirts.size() - 1);
shirtPath = shirts.get(randomNumber);
editor.putBoolean(KEY_CHOICE_SET, true);
editor.putBoolean(KEY_SHIRT_PRESENT, true);
editor.putString(KEY_SHIRT_PATH, shirtPath);
}
if (pants.size() > 0) {
Integer randomNumber = randomNumber(0, pants.size() - 1);
pantPath = pants.get(randomNumber);
editor.putBoolean(KEY_CHOICE_SET, true);
editor.putBoolean(KEY_PANT_PRESENT, true);
editor.putString(KEY_PANT_PATH, pantPath);
}
Boolean bookmarked;
if (!shirtPath.equals("") && !pantPath.equals("")) {
Bookmark bookmark = new Bookmark(shirtPath, pantPath);
BookmarkDbHelper bookmarkDbHelper = new BookmarkDbHelper(context);
Integer id = bookmarkDbHelper.getIdOfBookmark(bookmark);
bookmarked = id > 0 ? true : false;
} else {
bookmarked = false;
}
editor.putBoolean(KEY_BOOKMARKED, bookmarked);
editor.commit();
}
private static Integer randomNumber(Integer minimum, Integer maximum) {
Random random = new Random();
Integer integer = random.nextInt(maximum - minimum + 1) + minimum;
return integer;
}
public static void setAlarm(Context context) {
AlarmManager alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, AlarmReceiver.class);
intent.setAction(AlarmReceiver.ACTION_FOR_ALARM_PENDING_INTENT);
PendingIntent alarmIntent = PendingIntent.getBroadcast(context, 1234, intent, 0);
// Set the alarm to start at approximately 1:00 AM next day
Calendar calendar = Calendar.getInstance();
// set to tomorrow
calendar.add(Calendar.DAY_OF_YEAR, 1);
// set time for tomorrow
calendar.set(Calendar.HOUR_OF_DAY, 1);
calendar.set(Calendar.MINUTE, 0);
alarmMgr.setInexactRepeating(AlarmManager.RTC, calendar.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, alarmIntent);
return;
}
public static Boolean isAlarmSet(Context context) {
Intent intent = new Intent(context, AlarmReceiver.class);
intent.setAction(AlarmReceiver.ACTION_FOR_ALARM_PENDING_INTENT);
Boolean isSet = (PendingIntent.getBroadcast(context, 1234, intent, PendingIntent.FLAG_NO_CREATE) != null);
return isSet;
}
} | [
"ptodi.y12@lnmiit.ac.in"
] | ptodi.y12@lnmiit.ac.in |
ade97ece7bdba219ddf879f54cb42d0a5e4cdd05 | 12ed5ae2cd2623544955b64b3ee0fdf2caeead89 | /models/ModelFire.java | b51830443240a435b338494dd15dfcce6aa8044a | [] | no_license | 999134/scapecraft-1.7.2 | 8121e4a5c7e9e097008441fd8bdc3ad03c4b5be3 | 7404bb09e6ab63c449f30296f73b0f7aeb1f8b69 | refs/heads/master | 2020-04-06T07:01:57.239313 | 2014-06-17T22:31:38 | 2014-06-17T22:31:38 | 20,941,502 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,930 | java | package models;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelFire extends ModelBase
{
//fields
ModelRenderer Shape2;
ModelRenderer Shape1;
ModelRenderer Shape4;
ModelRenderer Shape5;
ModelRenderer Shape6;
ModelRenderer Shape7;
ModelRenderer Shape3;
public ModelFire()
{
textureWidth = 64;
textureHeight = 32;
Shape2 = new ModelRenderer(this, 0, 0);
Shape2.addBox(0F, 0F, 0F, 16, 0, 16);
Shape2.setRotationPoint(-8F, 23.9F, -8F);
Shape2.setTextureSize(64, 32);
Shape2.mirror = true;
setRotation(Shape2, 0F, 0F, 0F);
Shape1 = new ModelRenderer(this, 56, 21);
Shape1.addBox(0F, 0F, 0F, 2, 9, 2);
Shape1.setRotationPoint(-1F, 16F, -1F);
Shape1.setTextureSize(64, 32);
Shape1.mirror = true;
setRotation(Shape1, -0.3490659F, 0F, 0.3490659F);
Shape4 = new ModelRenderer(this, 48, 21);
Shape4.addBox(0F, 0F, 0F, 2, 9, 2);
Shape4.setRotationPoint(0F, 18F, -1F);
Shape4.setTextureSize(64, 32);
Shape4.mirror = true;
setRotation(Shape4, 0.3490659F, 0F, -0.3490659F);
Shape5 = new ModelRenderer(this, 40, 21);
Shape5.addBox(0F, 0F, 0F, 2, 9, 2);
Shape5.setRotationPoint(-1F, 18F, -1F);
Shape5.setTextureSize(64, 32);
Shape5.mirror = true;
setRotation(Shape5, 0.3862445F, 0F, 0.7291139F);
Shape6 = new ModelRenderer(this, 32, 21);
Shape6.addBox(0F, 0F, 0F, 2, 9, 2);
Shape6.setRotationPoint(0F, 17F, -1F);
Shape6.setTextureSize(64, 32);
Shape6.mirror = true;
setRotation(Shape6, -0.4688636F, 0F, -0.2003514F);
Shape7 = new ModelRenderer(this, 16, 16);
Shape7.addBox(0F, 0F, 0F, 8, 16, 0);
Shape7.setRotationPoint(-4F, 5F, 0F);
Shape7.setTextureSize(64, 32);
Shape7.mirror = true;
setRotation(Shape7, 0F, 0F, 0F);
Shape3 = new ModelRenderer(this, 0, 16);
Shape3.addBox(0F, 0F, 0F, 8, 16, 0);
Shape3.setRotationPoint(0F, 5F, 4F);
Shape3.setTextureSize(64, 32);
Shape3.mirror = true;
setRotation(Shape3, 0F, 1.570796F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Shape2.render(f5);
Shape1.render(f5);
Shape4.render(f5);
Shape5.render(f5);
Shape6.render(f5);
Shape7.render(f5);
Shape3.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity ent)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, ent);
}
}
| [
"diamondalex@googlemail.com"
] | diamondalex@googlemail.com |
6e3c531a1a98b60c4009eba8d4de22f4dc42de46 | cdf40e03365b58fb38dc1657e330a8110f81efda | /src/main/java/com/simply/zuozuo/timer/Tctc.java | f6ae51add7c29584add369a6473003f710e09706 | [] | no_license | FrankZuozuo/zuozuo | 0ce793f4629fd0ed77fcedcc5b756eaec9ad2115 | 1cc1c8d20a4b7ed6ea28cbf8ca64f20322f8d77d | refs/heads/master | 2020-03-10T12:13:20.618289 | 2018-08-06T05:52:13 | 2018-08-06T05:52:13 | 129,367,485 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | java | package com.simply.zuozuo.timer;
/*
* # Copyright (c) 2010-2018 Online zuozuo
* # Copyright (c) 2018 Online zuozuo
* # @email : m15197447018@gmail.com
*/
/**
* @author Created by 谭健 on 2018/7/18 0018. 星期三. 13:17.
* © All Rights Reserved.
*/
public class Tctc {
public static void main(String[] args) {
long l = System.currentTimeMillis();
long x = 0;
while (true){
if (l+1000<= System.currentTimeMillis()) break;
else x++;
}
System.out.println(x*2);
}
}
| [
"="
] | = |
cac04f7b14baa62429a3e16c42011f8a9201444c | 630aede43c73b351018db7fe802b8d0bdb1ea9f8 | /cop5556sp18/Parser.java | f303edc20c17d369cd1b73c6c5c1d8002c1fb0bd | [] | no_license | fang08/Image-Processing-Compiler | ce366fd8a6791bc4c1ab2ee7ef27fb4b8758b47d | 03fe408b560781519cea7edce218e10cd84e5106 | refs/heads/master | 2020-03-18T07:02:15.851974 | 2018-05-22T15:02:49 | 2018-05-22T15:02:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,399 | java | package cop5556sp18;
import cop5556sp18.Scanner.Token;
import cop5556sp18.Scanner.Kind;
import static cop5556sp18.Scanner.Kind.*;
import java.util.List;
import cop5556sp18.AST.*;
import java.util.ArrayList;
public class Parser {
@SuppressWarnings("serial")
public static class SyntaxException extends Exception {
Token t;
public SyntaxException(Token t, String message) {
super(message);
this.t = t;
}
}
Scanner scanner;
Token t;
Parser(Scanner scanner) {
this.scanner = scanner;
t = scanner.nextToken();
}
public Program parse() throws SyntaxException {
Program p = program();
matchEOF();
return p;
}
/*
* Program ::= Identifier Block
*/
public Program program() throws SyntaxException {
Token first = t;
Token progName = t;
match(IDENTIFIER);
Block b = block();
return new Program(first, progName, b);
}
/*
* Block ::= { ( (Declaration | Statement) ; )* }
*/
Kind[] firstDec = {KW_int, KW_boolean, KW_image, KW_float, KW_filename};
Kind[] firstStatement = {KW_input, KW_write, KW_while, KW_if, KW_show, KW_sleep, IDENTIFIER, KW_red, KW_blue,
KW_green, KW_alpha}; /* TODO correct this */
Kind[] predefinedName = {KW_Z, KW_default_width, KW_default_height};
Kind[] functionName = {KW_sin, KW_cos, KW_atan, KW_abs, KW_log, KW_cart_x, KW_cart_y, KW_polar_a, KW_polar_r,
KW_int, KW_float, KW_width, KW_height, KW_red, KW_blue, KW_green, KW_alpha};
public Block block() throws SyntaxException {
Token first = t;
match(LBRACE);
ArrayList<ASTNode> decsOrStatements = new ArrayList<ASTNode>();
while (isKind(firstDec)|isKind(firstStatement)) {
if (isKind(firstDec)) {
decsOrStatements.add(declaration());
} else if (isKind(firstStatement)) {
decsOrStatements.add(statement());
}
match(SEMI);
}
match(RBRACE);
return new Block(first, decsOrStatements);
}
/*
* Declaration ::= Type IDENTIFIER | image IDENTIFIER [ Expression , Expression ]
*/
public Declaration declaration() throws SyntaxException {
//TODO
//throw new UnsupportedOperationException();
Token first = t;
Token type = t;
Token name = null;
Expression width = null;
Expression height = null;
if (isKind(KW_int, KW_float, KW_boolean, KW_filename)) {
consume();
name = t;
match(IDENTIFIER);
}
else if (isKind(KW_image)) {
consume();
name = t;
match(IDENTIFIER);
if (isKind(LSQUARE)) {
consume();
width = expression();
match(COMMA);
height = expression();
match(RSQUARE);
}
}
else throw new SyntaxException(t,"Unexpected kind " + t.kind + " in Declaration.");
return new Declaration(first, type, name, width, height);
}
/*
* Statement ::= StatementInput | StatementWrite | StatementAssignment
* | StatementWhile | StatementIf | StatementShow | StatementSleep
*/
public Statement statement() throws SyntaxException {
//TODO
//throw new UnsupportedOperationException();
Statement s = null;
switch(t.kind) {
case KW_input:
s = statementInput(); break;
case KW_write:
s = statementWrite(); break;
case IDENTIFIER: case KW_red: case KW_blue: case KW_green: case KW_alpha:
s = statementAssignment(); break;
case KW_while:
s = statementWhile(); break;
case KW_if:
s = statementIf(); break;
case KW_show:
s = statementShow(); break;
case KW_sleep:
s = statementSleep(); break;
default:
throw new SyntaxException(t,"Unexpected kind " + t.kind + " in Statement.");
}
return s;
}
/*
* StatementInput ::= input IDENTIFIER from @ Expression
*/
public StatementInput statementInput() throws SyntaxException {
Token first = t;
match(KW_input);
Token destName = t;
match(IDENTIFIER);
match(KW_from);
match(OP_AT);
Expression e = expression();
return new StatementInput(first, destName, e);
}
/*
* StatementWrite ::= write IDENTIFIER to IDENTIFIER
*/
public StatementWrite statementWrite() throws SyntaxException {
Token first = t;
match(KW_write);
Token sourceName = t;
match(IDENTIFIER);
match(KW_to);
Token destName = t;
match(IDENTIFIER);
return new StatementWrite(first, sourceName, destName);
}
/*
* StatementAssignment ::= LHS := Expression
*/
public StatementAssign statementAssignment() throws SyntaxException {
Token first = t;
LHS l = null;
Expression e = null;
if (isKind(IDENTIFIER, KW_red, KW_blue, KW_green, KW_alpha)) {
l = lhs();
match(OP_ASSIGN);
e = expression();
}
else throw new SyntaxException(t,"Unexpected kind " + t.kind + " in StatementAssignment.");
return new StatementAssign(first, l, e);
}
/*
* StatementWhile ::= while (Expression ) Block
*/
public StatementWhile statementWhile() throws SyntaxException {
Token first = t;
match(KW_while);
match(LPAREN);
Expression guard = expression();
match(RPAREN);
Block b = block();
return new StatementWhile(first, guard, b);
}
/*
* StatementIf ::= if ( Expression ) Block
*/
public StatementIf statementIf() throws SyntaxException {
Token first = t;
match(KW_if);
match(LPAREN);
Expression guard = expression();
match(RPAREN);
Block b = block();
return new StatementIf(first, guard, b);
}
/*
* StatementShow ::= show Expression
*/
public StatementShow statementShow() throws SyntaxException {
Token first = t;
match(KW_show);
Expression e = expression();
return new StatementShow(first, e);
}
/*
* StatementSleep ::= sleep Expression
*/
public StatementSleep statementSleep() throws SyntaxException {
Token first = t;
match(KW_sleep);
Expression duration = expression();
return new StatementSleep(first, duration);
}
/*
* LHS ::= IDENTIFIER | IDENTIFIER PixelSelector | Color ( IDENTIFIER PixelSelector )
*/
public LHS lhs() throws SyntaxException {
LHS l = null;
Token first = t;
if (isKind(KW_red, KW_blue, KW_green, KW_alpha)) {
Token color = t;
consume();
match(LPAREN);
Token name = t;
match(IDENTIFIER);
PixelSelector pixel = pixelSelector();
match(RPAREN);
l = new LHSSample(first, name, pixel, color);
}
else if (isKind(IDENTIFIER)) {
Token name = t;
consume();
l = new LHSIdent(first, name);
if (isKind(LSQUARE)) {
PixelSelector p = pixelSelector();
l = new LHSPixel(first, name, p);
}
}
else throw new SyntaxException(t,"Unexpected kind " + t.kind + " in LHS.");
return l;
}
/*
* Expression ::= OrExpression ? Expression : Expression
* | OrExpression
*/
public Expression expression() throws SyntaxException {
Token first = t;
Expression guard = orExpression();
Expression trueE = null;
Expression falseE = null;
if (isKind(OP_QUESTION)) {
consume();
trueE = expression();
match(OP_COLON);
falseE = expression();
return new ExpressionConditional(first, guard, trueE, falseE);
}
return guard;
}
/*
* OrExpression ::= AndExpression ( | AndExpression ) *
*/
public Expression orExpression() throws SyntaxException {
Token first = t;
Expression e0 = andExpression();
while (isKind(OP_OR)) {
Token op = t;
consume();
Expression e1 = andExpression();
e0 = new ExpressionBinary(first, e0, op, e1);
}
return e0;
}
/*
* AndExpression ::= EqExpression ( & EqExpression )*
*/
public Expression andExpression() throws SyntaxException {
Token first = t;
Expression e0 = eqExpression();
while (isKind(OP_AND)) {
Token op = t;
consume();
Expression e1 = eqExpression();
e0 = new ExpressionBinary(first, e0, op, e1);
}
return e0;
}
/*
* EqExpression ::= RelExpression ( (== | != ) RelExpression )*
*/
public Expression eqExpression() throws SyntaxException {
Token first = t;
Expression e0 = relExpression();
while (isKind(OP_EQ, OP_NEQ)) {
Token op = t;
consume();
Expression e1 = relExpression();
e0 = new ExpressionBinary(first, e0, op, e1);
}
return e0;
}
/*
* RelExpression ::= AddExpression ( (< | > | <= | >= ) AddExpression)*
*/
public Expression relExpression() throws SyntaxException {
Token first = t;
Expression e0 = addExpression();
while (isKind(OP_GE, OP_LE, OP_GT, OP_LT)) {
Token op = t;
consume();
Expression e1 = addExpression();
e0 = new ExpressionBinary(first, e0, op, e1);
}
return e0;
}
/*
* AddExpression ::= MultExpression ( ( + | - ) MultExpression )*
*/
public Expression addExpression() throws SyntaxException {
Token first = t;
Expression e0 = multExpression();
while (isKind(OP_PLUS, OP_MINUS)) {
Token op = t;
consume();
Expression e1 = multExpression();
e0 = new ExpressionBinary(first, e0, op, e1);
}
return e0;
}
/*
* MultExpression := PowerExpression ( ( * | / | % ) PowerExpression )*
*/
public Expression multExpression() throws SyntaxException {
Token first = t;
Expression e0 = powerExpression();
while (isKind(OP_TIMES, OP_DIV, OP_MOD)) {
Token op = t;
consume();
Expression e1 = powerExpression();
e0 = new ExpressionBinary(first, e0, op, e1);
}
return e0;
}
/*
* PowerExpression := UnaryExpression (** PowerExpression | ε)
*/
public Expression powerExpression() throws SyntaxException {
Token first = t;
Expression e0 = unaryExpression();
if (isKind(OP_POWER)) {
Token op = t;
consume();
return new ExpressionBinary(first, e0, op, powerExpression());
}
return e0;
}
/*
* UnaryExpression ::= + UnaryExpression | - UnaryExpression | UnaryExpressionNotPlusMinus
*/
public Expression unaryExpression() throws SyntaxException {
Token first = t;
if (isKind(OP_PLUS, OP_MINUS)) {
Token op = t;
consume();
return new ExpressionUnary(first, op, unaryExpression());
}
else
return unaryExpressionNotPlusMinus();
}
/*
* UnaryExpressionNotPlusMinus ::= ! UnaryExpression | Primary
*/
public Expression unaryExpressionNotPlusMinus() throws SyntaxException {
Token first = t;
if (isKind(OP_EXCLAMATION)) {
Token op = t;
consume();
return new ExpressionUnary(first, op, unaryExpression());
}
else
return primary();
}
/*
* Primary ::= INTEGER_LITERAL | BOOLEAN_LITERAL | FLOAT_LITERAL |
* ( Expression ) | FunctionApplication | IDENTIFIER | PixelExpression |
* PredefinedName | PixelConstructor
*/
public Expression primary() throws SyntaxException {
System.out.println(t.toString());
Token first = t;
if (isKind(INTEGER_LITERAL)) {
Token i = t;
consume();
return new ExpressionIntegerLiteral(first, i);
}
else if (isKind(BOOLEAN_LITERAL)) {
Token b = t;
consume();
return new ExpressionBooleanLiteral(first, b);
}
else if (isKind(FLOAT_LITERAL)) {
Token f = t;
consume();
return new ExpressionFloatLiteral(first, f);
}
else if (isKind(LPAREN)) {
consume();
Expression e = expression();
match(RPAREN);
return e;
}
else if (isKind(functionName)) {
Expression fa = functionApp();
return fa;
}
else if (isKind(IDENTIFIER)) {
if (scanner.peek().kind == LSQUARE) {
ExpressionPixel p = pixelExpression();
return p;
}
else {
Token id = t;
consume();
return new ExpressionIdent(first, id);
}
}
else if (isKind(predefinedName)) {
Token p = t;
consume();
return new ExpressionPredefinedName(first, p);
}
else if (isKind(LPIXEL)) {
ExpressionPixelConstructor pc = pixelConstructor();
return pc;
}
else throw new SyntaxException(t,"Unexpected kind " + t.kind + " in primary.");
}
/*
* FunctionApplication ::= FunctionName ( Expression ) | FunctionName [ Expression , Expression ]
*/
public Expression functionApp() throws SyntaxException {
Token first = t;
if (isKind(functionName)) {
Token name = t;
consume();
if (isKind(LPAREN)) {
consume();
Expression e = expression();
match(RPAREN);
return new ExpressionFunctionAppWithExpressionArg(first, name, e);
}
else if (isKind(LSQUARE)) {
consume();
Expression e0 = expression();
match(COMMA);
Expression e1 = expression();
match(RSQUARE);
return new ExpressionFunctionAppWithPixel(first, name, e0, e1);
}
else throw new SyntaxException(t,"Incomplete FunctionApplication.");
}
else throw new SyntaxException(t,"Unexpected kind " + t.kind + " in FunctionApplication.");
}
/*
* PixelConstructor ::= << Expression , Expression , Expression , Expression >>
*/
public ExpressionPixelConstructor pixelConstructor() throws SyntaxException {
Token first = t;
match(LPIXEL);
Expression alpha = expression();
match(COMMA);
Expression red = expression();
match(COMMA);
Expression green = expression();
match(COMMA);
Expression blue = expression();
match(RPIXEL);
return new ExpressionPixelConstructor(first, alpha, red, green, blue);
}
/*
* PixelExpression ::= IDENTIFIER PixelSelector
*/
public ExpressionPixel pixelExpression() throws SyntaxException {
Token first = t;
Token name = t;
match(IDENTIFIER);
PixelSelector ps = pixelSelector();
return new ExpressionPixel(first, name, ps);
}
/*
* PixelSelector ::= [ Expression , Expression ]
*/
public PixelSelector pixelSelector() throws SyntaxException {
Token first = t;
match(LSQUARE);
Expression ex = expression();
match(COMMA);
Expression ey = expression();
match(RSQUARE);
return new PixelSelector(first, ex, ey);
}
protected boolean isKind(Kind kind) {
return t.kind == kind;
}
protected boolean isKind(Kind... kinds) {
for (Kind k : kinds) {
if (k == t.kind)
return true;
}
return false;
}
/**
* Precondition: kind != EOF
*
* @param kind
* @return
* @throws SyntaxException
*/
private Token match(Kind kind) throws SyntaxException {
Token tmp = t;
if (isKind(kind)) {
consume();
return tmp;
}
throw new SyntaxException(t,"Expected " + kind + " but got " + t.kind + " at " + t.toString()); //TODO give a better error message!
}
private Token consume() throws SyntaxException {
Token tmp = t;
if (isKind(EOF)) {
throw new SyntaxException(t,"Unexpected EOF!"); //TODO give a better error message!
//Note that EOF should be matched by the matchEOF method which is called only in parse().
//Anywhere else is an error. */
}
t = scanner.nextToken();
return tmp;
}
/**
* Only for check at end of program. Does not "consume" EOF so no attempt to get
* nonexistent next Token.
*
* @return
* @throws SyntaxException
*/
private Token matchEOF() throws SyntaxException {
if (isKind(EOF)) {
return t;
}
throw new SyntaxException(t,"Expecting EOF!"); //TODO give a better error message!
}
} | [
"fangyao0818@gmail.com"
] | fangyao0818@gmail.com |
689c573b03f1792a8b48a518463633ef48d6fffa | 2a14c64166693dca11aa755ba59ebed1db0e7042 | /Lingo_v0.01/src/lingo/main/LingoGame.java | 7aa1e5ccb7bf4bc028884d5550c218710ff85ae2 | [] | no_license | alexanderbenerink/Quiz-App | 27afa8b33a8468f04c1ca3a4e3daedf6b96e61f4 | f7799b58781e214a1f8048c011ec00845d197efa | refs/heads/master | 2020-04-21T07:21:21.410464 | 2019-04-04T11:53:22 | 2019-04-04T11:53:22 | 169,390,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package lingo.main;
import java.awt.Dimension;
import lingo.test.LingoTest;
import lingo.view.LingoFrame;
/**
* Lingo Game
*
* @author Emile
* @version v0.01
*/
public class LingoGame {
/**
* Main. De applicatie begint hier.
*
* @param args
*/
public static void main( String[] args ) {
LingoFrame lingoFrame = new LingoFrame();
lingoFrame.setTitle( "Lingo Game v0.01" );
lingoFrame.setMinimumSize( new Dimension( 500, 500 ) );
lingoFrame.setVisible( true );
// lingoTest = new LingoTest();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
bb675f9eac0175bfb3ccd13818a2bfe221d71172 | 22e9549640d475e8b9bd74ab73e73b17204cd1a4 | /src/codility/CountIndexPairsWithEqualElementsArray.java | 4d268e5f8f193b1fbaae51388dd56f56ea5bf89b | [] | no_license | shikha-agrawal2/dArray | 471dbc4a801f5de34797a824c3757ffdeac43523 | 6a60336ac76c361394656a53678db64258325b58 | refs/heads/master | 2021-07-13T04:11:26.933858 | 2021-06-28T14:38:09 | 2021-06-28T14:38:09 | 180,308,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,837 | java | package codility;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
//https://www.geeksforgeeks.org/count-index-pairs-equal-elements-array/
public class CountIndexPairsWithEqualElementsArray {
public static void main(String[] args) {
int arr[] = new int[]{1, 2, 3, 1};
System.out.println(solution(arr));
}
public static int solution(int[] A) {
HashMap<Integer, Integer> hm = new HashMap<>();
int length = A.length;
for (int i = 0; i < length; i++) {
if (hm.containsKey(A[i]))
hm.put(A[i], hm.get(A[i]) + 1);
else
hm.put(A[i], 1);
}
int result = 0;
for (Map.Entry<Integer, Integer> it : hm.entrySet()) {
int count = it.getValue();
result += (count * (count - 1)) / 2;
}
return result;
}
}
// constructor(props) {
// super(props);
// this.state = {
// count: 100,
// liked: false
// };
// this.btnClicked = this.btnClicked.bind(this);
// }
// btnClicked(e) {
// if(this.state.liked){
// this.setState({
// count:this.state.count-1,
// liked:false
// });
// }else{
// this.setState({
// count:this.state.count+1,
// liked:true
// });
// }
// }
// render() {
// let likeButtonClasses = "like-button"+(this.state.liked?"liked":"");
// let like = "Like|";
// return (
// <button onClick={this.btnClicked} className={likeButtonClasses}>
// {like}{this.state.count}
// </button>
// )
// }
| [
"shikha.agrawal79@gmail.com"
] | shikha.agrawal79@gmail.com |
197ee281ee44c40e2bf748038a98bcbab8ec9a85 | 1fb415477575d84e94627b7fcfaef151f7f15751 | /ABC201/C.java | ebafa94a01c293a7d3edb43add04fc29662c196f | [] | no_license | satake0916/AtCoder | a08d02678f6c70829745a36d1924d73a9c7c3ec0 | e1c13a25df640d4ce34884d06297e1850e0087d6 | refs/heads/master | 2023-08-07T16:11:36.780477 | 2023-08-07T13:45:08 | 2023-08-07T13:45:08 | 181,307,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception{
Scanner sc = new Scanner(System.in);
String s = sc.next();
sc.close();
int ans = 0;
for(int i = 0; i < 10000; i++){
boolean[] f = new boolean[10];
for(int a = 0; a < 10; a++) f[a] = false;
if(i < 1000) f[0] = true;
int temp = i;
while(temp != 0){
f[temp%10] = true;
temp /= 10;
}
if(isOK(s,f)) ans++;
}
System.out.println(ans);
}
private static boolean isOK(String s, boolean[] f){
for(int i = 0; i < 10; i++){
if(s.charAt(i) == 'o' && f[i] == false) return false;
if(s.charAt(i) == 'x' && f[i] == true) return false;
}
return true;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
d2f7b16b5745d0e9f156fe298440a8d545b3d1d9 | 0727e648eb765b6ab86f9196f0f0c45bf4f482e7 | /MyProject/src/ch10/BadInputException.java | ff0a7cacc6ae94c9752875a659c22d1b44c428ef | [] | no_license | Ellie-Jung/Java-Study | 16d4ebf5dd823d9bcd141c3f0201c796f252c96d | d41065e6b94566fec2d369567097bd1b2745ec1a | refs/heads/master | 2023-09-05T10:38:14.395318 | 2021-11-13T10:44:15 | 2021-11-13T10:44:15 | 365,295,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 137 | java | package ch10;
public class BadInputException extends Exception {
public BadInputException(String message) {
super(message);
}
}
| [
"jssoyeon@gmail.com"
] | jssoyeon@gmail.com |
1fa9cdb471e9c1de9a890288aa1b15ee50d2e4a6 | 478569bcb0d61942ec384797dc3de1a7d2e6f221 | /src/main/java/eu/dowsing/kolla/app/music/MusicView.java | 212dcfd4004afda91bf05f72a4fe6334abaf403f | [
"Apache-2.0"
] | permissive | N0rp/Snabb | 351ef3d9e810995809fce5ce4d8ff8a8c9b885fa | 17723524e3574af773f326591f36cf21f4303c7f | refs/heads/master | 2021-01-10T18:45:34.743399 | 2014-03-03T21:50:41 | 2014-03-03T21:50:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java | package eu.dowsing.kolla.app.music;
import javafx.scene.layout.Pane;
public class MusicView extends Pane {
}
| [
"assembla2.20.lumiken@spamgourmet.com"
] | assembla2.20.lumiken@spamgourmet.com |
b3963a8db550549aa7ae5fb4e323c940b1e4fd23 | bf52a2b74163b8046a2db18f44454c4268c340a4 | /src/main/java/com/basho/riak/pbc/RiakConnection.java | 33816650a76d48d24a0e0ca5ef89b4c89744a0fa | [] | no_license | trifork/riak-java-client | 7c55837ecfb212db3a71fb565a1285aca9304f1a | ee2b93c21237a7ab0c26c9e83de797957f71cd85 | refs/heads/master | 2021-01-20T22:47:32.078198 | 2011-09-14T08:12:14 | 2011-09-14T08:12:14 | 1,426,033 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,880 | java | /**
* This file is part of riak-java-pb-client
*
* Copyright (c) 2010 by Trifork
*
* 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.basho.riak.pbc;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Timer;
import java.util.TimerTask;
import com.basho.riak.pbc.RPB.RpbErrorResp;
import com.google.protobuf.MessageLite;
class RiakConnection {
static final int DEFAULT_RIAK_PB_PORT = 8087;
private Socket sock;
private DataOutputStream dout;
private DataInputStream din;
public RiakConnection(String host) throws IOException {
this(host, DEFAULT_RIAK_PB_PORT);
}
public RiakConnection(String host, int port) throws IOException {
this(InetAddress.getByName(host), port);
}
public RiakConnection(InetAddress addr, int port) throws IOException {
sock = new Socket(addr, port);
sock.setSendBufferSize(1024 * 200);
dout = new DataOutputStream(new BufferedOutputStream(sock
.getOutputStream(), 1024 * 200));
din = new DataInputStream(
new BufferedInputStream(sock.getInputStream(), 1024 * 200));
}
///////////////////////
void send(int code, MessageLite req) throws IOException {
int len = req.getSerializedSize();
dout.writeInt(len + 1);
dout.write(code);
req.writeTo(dout);
dout.flush();
}
void send(int code) throws IOException {
dout.writeInt(1);
dout.write(code);
dout.flush();
}
byte[] receive(int code) throws IOException {
int len = din.readInt();
int get_code = din.read();
if (code == RiakClient.MSG_ErrorResp) {
RpbErrorResp err = com.basho.riak.pbc.RPB.RpbErrorResp.parseFrom(din);
throw new RiakError(err);
}
byte[] data = null;
if (len > 1) {
data = new byte[len - 1];
din.readFully(data);
}
if (code != get_code) {
throw new IOException("bad message code");
}
return data;
}
void receive_code(int code) throws IOException, RiakError {
int len = din.readInt();
int get_code = din.read();
if (code == RiakClient.MSG_ErrorResp) {
RpbErrorResp err = com.basho.riak.pbc.RPB.RpbErrorResp.parseFrom(din);
throw new RiakError(err);
}
if (len != 1 || code != get_code) {
throw new IOException("bad message code");
}
}
static Timer timer = new Timer();
TimerTask idle_timeout;
public void beginIdle() {
idle_timeout = new TimerTask() {
@Override
public void run() {
RiakConnection.this.timer_fired(this);
}
};
timer.schedule(idle_timeout, 1000);
}
synchronized void timer_fired(TimerTask fired_timer) {
if (idle_timeout != fired_timer) {
// if it is not our current timer, then ignore
return;
}
close();
}
void close() {
if (isClosed())
return;
try {
sock.close();
din = null;
dout = null;
sock = null;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
synchronized boolean endIdleAndCheckValid() {
TimerTask tt = idle_timeout;
if (tt != null) { tt.cancel(); }
idle_timeout = null;
if (isClosed()) {
return false;
} else {
return true;
}
}
public DataOutputStream getOutputStream() {
return dout;
}
public boolean isClosed() {
return sock == null || sock.isClosed();
}
}
| [
"andy@basho.com"
] | andy@basho.com |
490481790c422d3a0eb0aee5077dbc2e2e777786 | 12805c0e3f8aa4300bf5149520e9df47e5c36946 | /ticket-to-ride/src/main/java/org/tsystems/javaschool/model/dto/section/SectionDto.java | bc99874bab80253a2484cc81ad84890fa9e8c235 | [
"Apache-2.0"
] | permissive | ktrof/T-Systems-Java-School-Task | ca9ab7489eb13b1dadb999baf3d86ecfe24245e4 | 961af23651576e3086fd30823024704c447264d1 | refs/heads/master | 2023-01-08T20:38:36.899219 | 2020-11-14T06:52:00 | 2020-11-14T06:52:00 | 292,609,612 | 0 | 0 | Apache-2.0 | 2020-11-14T06:52:02 | 2020-09-03T15:31:56 | Java | UTF-8 | Java | false | false | 972 | java | package org.tsystems.javaschool.model.dto.section;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.tsystems.javaschool.constraint.ValidateFields;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ValidateFields(
equality = false,
first = "stationDtoTo",
second = "stationDtoFrom",
message = "Departure and destination stations must not match"
)
public class SectionDto implements Serializable {
private int id;
@NotNull(message = "Set departure station")
private String stationDtoFrom;
@NotNull(message = "Set destination station")
private String stationDtoTo;
@Min(value = 1, message = "Distance between two stations can not less then 1")
private double length;
}
| [
"ktrof18@gmail.com"
] | ktrof18@gmail.com |
4d9b5feb5e9e80f7d59389e6b200f7d0adb525e3 | ab0ec5f98b62a5cfdd253aa6a89a3ac90c5f169f | /app/src/main/java/ru/anpalmak/nailfiffing/MultiBoxTracker.java | c1aa131c6c49908a9dba8faeaeb8e2a781a90ba3 | [] | no_license | anpalmak2003/nail_fitting | 121783d169697420e97f2cedbbbd37a8071e6e94 | a002f6966d113350601a238b785f45b4af180967 | refs/heads/main | 2023-04-01T02:00:48.952576 | 2021-04-02T10:20:47 | 2021-04-02T10:20:47 | 348,440,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,780 | java | package ru.anpalmak.nailfiffing;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Join;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import android.text.TextUtils;
import android.util.Pair;
import android.util.TypedValue;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import ru.anpalmak.nailfiffing.BorderedText;
import ru.anpalmak.nailfiffing.ImageUtils;
import ru.anpalmak.nailfiffing.Logger;
import ru.anpalmak.nailfiffing.Detector.Recognition;
/** A tracker that handles non-max suppression and matches existing objects to new detections. */
public class MultiBoxTracker {
private static final float TEXT_SIZE_DIP = 18;
private static final float MIN_SIZE = 16.0f;
private static final int[] COLORS = {
Color.BLUE,
Color.RED,
Color.GREEN,
Color.YELLOW,
Color.CYAN,
Color.MAGENTA,
Color.WHITE,
Color.parseColor("#55FF55"),
Color.parseColor("#FFA500"),
Color.parseColor("#FF8888"),
Color.parseColor("#AAAAFF"),
Color.parseColor("#FFFFAA"),
Color.parseColor("#55AAAA"),
Color.parseColor("#AA33AA"),
Color.parseColor("#0D0068")
};
final List<Pair<Float, RectF>> screenRects = new LinkedList<Pair<Float, RectF>>();
private final Logger logger = new Logger();
private final Queue<Integer> availableColors = new LinkedList<Integer>();
private final List<TrackedRecognition> trackedObjects = new LinkedList<TrackedRecognition>();
private final Paint boxPaint = new Paint();
private final float textSizePx;
private final BorderedText borderedText;
private Matrix frameToCanvasMatrix;
private int frameWidth;
private int frameHeight;
private int sensorOrientation;
public MultiBoxTracker(final Context context) {
for (final int color : COLORS) {
availableColors.add(color);
}
boxPaint.setColor(Color.RED);
boxPaint.setStyle(Style.STROKE);
boxPaint.setStrokeWidth(10.0f);
boxPaint.setStrokeCap(Cap.ROUND);
boxPaint.setStrokeJoin(Join.ROUND);
boxPaint.setStrokeMiter(100);
textSizePx =
TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, TEXT_SIZE_DIP, context.getResources().getDisplayMetrics());
borderedText = new BorderedText(textSizePx);
}
public synchronized void setFrameConfiguration(
final int width, final int height, final int sensorOrientation) {
frameWidth = width;
frameHeight = height;
this.sensorOrientation = sensorOrientation;
}
public synchronized void drawDebug(final Canvas canvas) {
final Paint textPaint = new Paint();
textPaint.setColor(Color.WHITE);
textPaint.setTextSize(60.0f);
final Paint boxPaint = new Paint();
boxPaint.setColor(Color.RED);
boxPaint.setAlpha(200);
boxPaint.setStyle(Style.STROKE);
for (final Pair<Float, RectF> detection : screenRects) {
final RectF rect = detection.second;
canvas.drawRect(rect, boxPaint);
canvas.drawText("" + detection.first, rect.left, rect.top, textPaint);
borderedText.drawText(canvas, rect.centerX(), rect.centerY(), "" + detection.first);
}
}
public synchronized void trackResults(final List<Recognition> results, final long timestamp) {
logger.i("Processing %d results from %d", results.size(), timestamp);
processResults(results);
}
private Matrix getFrameToCanvasMatrix() {
return frameToCanvasMatrix;
}
public synchronized void draw(final Canvas canvas) {
final boolean rotated = sensorOrientation % 180 == 90;
final float multiplier =
Math.min(
canvas.getHeight() / (float) (rotated ? frameWidth : frameHeight),
canvas.getWidth() / (float) (rotated ? frameHeight : frameWidth));
frameToCanvasMatrix =
ImageUtils.getTransformationMatrix(
frameWidth,
frameHeight,
(int) (multiplier * (rotated ? frameHeight : frameWidth)),
(int) (multiplier * (rotated ? frameWidth : frameHeight)),
sensorOrientation,
false);
for (final TrackedRecognition recognition : trackedObjects) {
final RectF trackedPos = new RectF(recognition.location);
getFrameToCanvasMatrix().mapRect(trackedPos);
boxPaint.setColor(recognition.color);
float cornerSize = Math.min(trackedPos.width(), trackedPos.height()) / 8.0f;
canvas.drawRoundRect(trackedPos, cornerSize, cornerSize, boxPaint);
final String labelString =
!TextUtils.isEmpty(recognition.title)
? String.format("%s %.2f", recognition.title, (100 * recognition.detectionConfidence))
: String.format("%.2f", (100 * recognition.detectionConfidence));
// borderedText.drawText(canvas, trackedPos.left + cornerSize, trackedPos.top,
// labelString);
borderedText.drawText(
canvas, trackedPos.left + cornerSize, trackedPos.top, labelString + "%", boxPaint);
}
}
private void processResults(final List<Recognition> results) {
final List<Pair<Float, Recognition>> rectsToTrack = new LinkedList<Pair<Float, Recognition>>();
screenRects.clear();
final Matrix rgbFrameToScreen = new Matrix(getFrameToCanvasMatrix());
for (final Recognition result : results) {
if (result.getLocation() == null) {
continue;
}
final RectF detectionFrameRect = new RectF(result.getLocation());
final RectF detectionScreenRect = new RectF();
rgbFrameToScreen.mapRect(detectionScreenRect, detectionFrameRect);
logger.v(
"Result! Frame: " + result.getLocation() + " mapped to screen:" + detectionScreenRect);
screenRects.add(new Pair<Float, RectF>(result.getConfidence(), detectionScreenRect));
if (detectionFrameRect.width() < MIN_SIZE || detectionFrameRect.height() < MIN_SIZE) {
logger.w("Degenerate rectangle! " + detectionFrameRect);
continue;
}
rectsToTrack.add(new Pair<Float, Recognition>(result.getConfidence(), result));
}
trackedObjects.clear();
if (rectsToTrack.isEmpty()) {
logger.v("Nothing to track, aborting.");
return;
}
for (final Pair<Float, Recognition> potential : rectsToTrack) {
final TrackedRecognition trackedRecognition = new TrackedRecognition();
trackedRecognition.detectionConfidence = potential.first;
trackedRecognition.location = new RectF(potential.second.getLocation());
trackedRecognition.title = potential.second.getTitle();
trackedRecognition.color = COLORS[trackedObjects.size()];
trackedObjects.add(trackedRecognition);
if (trackedObjects.size() >= COLORS.length) {
break;
}
}
}
private static class TrackedRecognition {
RectF location;
float detectionConfidence;
int color;
String title;
}
} | [
"73543260+anpalmak1@users.noreply.github.com"
] | 73543260+anpalmak1@users.noreply.github.com |
8fee99f02371e46ed35fbea82ca38bb01035ffb2 | 72e1155831bd0e2176c0eb409e6faea4a3d56c90 | /EsbTool/src/main/java/com/service/login/Initliza.java | 3c0e010a6f7361ad351475bdb7dd22a3138d36fa | [] | no_license | bjx20161026/tool | aab9aca37541718dcee0962529fca52f7adbeb86 | 8d970857a4f4f71d57848d59a313dd42f32bc3bb | refs/heads/master | 2021-01-19T15:55:51.439647 | 2018-09-14T14:51:34 | 2018-09-14T14:51:34 | 88,237,710 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package com.service.login;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import util.timedTask.Shedual;
public class Initliza implements ServletContextListener {
@Override
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
// TODO Auto-generated method stub
Shedual shedual = new Shedual();
shedual.init();
}
}
| [
"bjx@DESKTOP-3P86OFS"
] | bjx@DESKTOP-3P86OFS |
94155ffbad404b4819d710b50e55ef3b6938f8bb | d68bbfbd166073f24dc86db3b5c604e7ea639543 | /src/main/java/rs/ac/uns/ftn/sep/kp/dto/InitializePaymentResponse.java | 43fff578df83aa09065aa03218dc2ed8cbb5e578 | [] | no_license | pavle-j4nk/SEP-KP | 7391028a38ec4ae214ea246ada6bfec25631ee46 | 610b2ac75496e2278e698afa6493b3114763b0c9 | refs/heads/master | 2023-01-11T23:24:52.733529 | 2019-12-26T07:35:46 | 2019-12-26T07:35:46 | 230,218,063 | 0 | 0 | null | 2023-01-05T03:41:25 | 2019-12-26T07:35:14 | Java | UTF-8 | Java | false | false | 300 | java | package rs.ac.uns.ftn.sep.kp.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InitializePaymentResponse {
private Long paymentId;
private String redirect;
}
| [
"pavle.gp@gmail.com"
] | pavle.gp@gmail.com |
dffc3b6c41c8e673fd0f5e449f87f43fb4bad217 | 0c1bfadbe115b0a1bf85e9788760289d63de4946 | /dailypractice/src/main/java/com/daily/pratice/concept/multithreading/ThreadImplements.java | 0fd7312584481593cc3309d1bca0451834bb5de7 | [] | no_license | sudamini/java-source-files | 364917c0d823434c653d59644ed5c3d3e0d685fc | e8a8221bc85273815d356fc374fd7d4e5f5ed47c | refs/heads/master | 2021-10-19T06:24:19.421438 | 2019-02-18T16:44:05 | 2019-02-18T16:44:05 | 167,198,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | package com.daily.pratice.concept.multithreading;
/**
* This class creates a thread by using an instance of Runnable interface.
* 1. Create an instance of Runnable interface.
* 2. Pass this instance to the constructor of thread class.
* 3. Call start() method on the thread.
*
* Can also be created using Lambda expressions because Runnable interface is a functional interface.
*/
public class ThreadImplements implements Runnable {
public static void main ( String[] args ) {
// old way
ThreadImplements impl = new ThreadImplements();
Thread thread1 = new Thread(impl);
thread1.start();
//lambda way
Runnable runnable = ()->{System.out.println ("Run Lambda Run" + Thread.currentThread().getName());};
Thread thread = new Thread(runnable);
thread.start();
}
@Override
public void run() {
System.out.println ("Run Old Man Run" +Thread.currentThread().getName() );
}
}
| [
"sudamini.js@gmail.com"
] | sudamini.js@gmail.com |
a619a9389ba18297eb00e42fd293d7d22608c330 | 8cc6c212f542eafd1e00ce68e1883c02416d2872 | /src/web/JS/com/neuedu/dao/UserDao.java | 0ea24eb101da12fcc8758a512cb9a85267cc2279 | [] | no_license | icewinger/JY3-EE | 8cf9baf7ec180beb7d2b1d484a2d1df454670856 | 0b1398b1c1db2aaf6df5b2db083417c1041cb704 | refs/heads/master | 2022-12-22T23:15:05.884490 | 2019-06-24T13:49:17 | 2019-06-24T13:49:17 | 187,601,469 | 0 | 0 | null | 2022-12-16T09:42:21 | 2019-05-20T08:38:56 | Java | UTF-8 | Java | false | false | 203 | java | package com.neuedu.dao;
import com.neuedu.pojo.User;
public interface UserDao {
public void addOneUser(User user);
public boolean login(User user);
public boolean check(String str);
}
| [
"49012342+icewinger@users.noreply.github.com"
] | 49012342+icewinger@users.noreply.github.com |
f69a759e022c9b7172c7c000671f4a1edb35ae06 | 035f1947b550361c7404db393f75f49c9a5d845c | /src/main/java/pl/central/marketX/wineshopX/MarketXWineShop.java | 48b1997480abc6763783ce0e1493905fdc547dd4 | [] | no_license | SebastianW1991/MerchantSimulatorGame | c6b077132e3d18451993db890183106f575f8d13 | 799bd23a861cc1c802a7e787a74451751b185811 | refs/heads/master | 2021-04-14T08:02:15.708615 | 2020-05-13T13:58:50 | 2020-05-13T13:58:50 | 249,217,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,429 | java | package pl.central.marketX.wineshopX;
import pl.central.ActionStateContext;
import pl.central.marketX.MarketX;
import pl.central.OutskirtsX;
import pl.central.PlayerActionState;
import pl.central.marketX.horseshopX.MarketXHorseShopOldMule;
import static pl.central.Main.getUserInput;
public class MarketXWineShop implements PlayerActionState {
@Override
public void action(ActionStateContext ctx)
{
System.out.println("You can:\n" +
"[a] Buy barrel of fresh red dry wine for 20 guldens\n" +
"[b] Buy barrel of 1 year old red dry wine for 40 guldens\n" +
"[c] Buy barrel of 10 years old red dry wine for 120 guldens\n" +
"[d] Return to the market");
String playerChoice = getUserInput();
ActionStateContext stateContext = new ActionStateContext();
switch (playerChoice)
{
case "a":
stateContext.setState(new MarketXWineRedDryFresh());
stateContext.action();
case "b" :
stateContext.setState(new MarketXWineRedDryYearOld());
stateContext.action();
case "c":
stateContext.setState(new MarketXWineRedDryTenYearsOld());
stateContext.action();
case "d":
stateContext.setState(new MarketX());
stateContext.action();
}
}
} | [
"sebastianw1991@gmail.com"
] | sebastianw1991@gmail.com |
1c1a80bc7e29e76fe684a74c9163b654f644868c | 0f730ccdc5fe26b5932e5e41a768859761aa7dda | /app/src/main/java/br/com/dactus/octusapp/Cliente.java | 86445257eca4ce881a9a13f730e8a1fa9da917f7 | [] | no_license | KevinMantovani/octus | 0dd127e2cee0b1d58baef34d936d57f776c6d513 | f1c893470716025d45d704c4772bdd636e18a311 | refs/heads/master | 2020-06-08T20:20:44.884315 | 2019-06-23T03:35:21 | 2019-06-23T03:35:21 | 193,300,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package br.com.dactus.octusapp;
import java.io.Serializable;
public class Cliente implements Serializable {
private Integer id;
private String nome;
//METÓDO GETTERS E SETTERS DOS ATRIBUTOS
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpfCnpj() {
return cpfCnpj;
}
public void setCpfCnpj(String cpfCnpj) {
this.cpfCnpj = cpfCnpj;
}
private String cpfCnpj;
@Override
public String toString(){
return nome;
}
}
| [
"kevinmantovani1@gmail.com"
] | kevinmantovani1@gmail.com |
685bbf83c56342b1f67d56baa73b3f256a22b5c7 | 398721d2c05ff6e00819b922345e71bb65836d03 | /app/src/main/java/org/codedoesgood/mercury/onboarding/model/CreateUserContent.java | f66ffd7b041a3b0559151cee5d97b311a2751a2b | [] | no_license | CodeDoesGood/Mercury-Android | 95f4a792368388f98871d5750181415a0db69431 | da9edf5a788dc72991aab4f47b35f3621eec08ba | refs/heads/dev | 2021-01-01T16:01:41.183682 | 2017-09-19T03:25:29 | 2017-09-19T03:25:29 | 97,757,497 | 1 | 0 | null | 2017-09-19T03:25:30 | 2017-07-19T20:17:36 | Java | UTF-8 | Java | false | false | 2,126 | java | package org.codedoesgood.mercury.onboarding.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Represents the <b>volunteer</b> JSON object within the {@link CreateUserPayload}
*/
public class CreateUserContent {
@SerializedName("username")
@Expose
private String username;
@SerializedName("password")
@Expose
private String password;
@SerializedName("name")
@Expose
private String name;
@SerializedName("email_address")
@Expose
private String email;
@SerializedName("data_entry_user_id")
@Expose
private String entryID;
/**
* Builder to set the "username" property
* @param newUsername Registration username
* @return Returns the {@code CreateUserContent} object
*/
public CreateUserContent setUsername(String newUsername) {
this.username = newUsername;
this.entryID = newUsername;
return this;
}
/**
* Builder to set the "password" property
* @param newPassword Registration password
* @return Returns the {@code CreateUserContent} object
*/
public CreateUserContent setPassword(String newPassword) {
this.password = newPassword;
return this;
}
/**
* Builder to set the "email" property
* @param newEmail Registration email address
* @return Returns the {@code CreateUserContent} object
*/
public CreateUserContent setEmail(String newEmail) {
this.email = newEmail;
return this;
}
/**
* Builder to set the "name" property
* @param newName Registration user's first and last name
* @return Returns the {@code CreateUserContent} object
*/
public CreateUserContent setName(String newName) {
this.name = newName;
return this;
}
/**
* Utilizes the {@code CreateUserContent} object to create the
* {@code CreateUserPayload} object
* @return Returns {@link CreateUserPayload}
*/
public CreateUserPayload buildPayload() {
return new CreateUserPayload(this);
}
}
| [
"brandonpas22@gmail.com"
] | brandonpas22@gmail.com |
98d81bdf87c79f91ef078c3dd236162a1cd16846 | 0ed20fe0fc9e1cd76034d5698c4f7dcf42c47a60 | /_FDM/ProjectOneDayShoppingCart/src/main/java/com/fdmgroup/Entity/CartRecord.java | c9a442defd31cdb3eee29159750b84dc53f65438 | [] | no_license | Kamurai/EclipseRepository | 61371f858ff82dfdfc70c3de16fd3322222759ed | 4af50d1f63a76faf3e04a15129c0ed098fc6c545 | refs/heads/master | 2022-12-22T13:05:13.965919 | 2020-11-05T03:42:09 | 2020-11-05T03:42:09 | 101,127,637 | 0 | 0 | null | 2022-12-16T13:43:14 | 2017-08-23T02:18:08 | Java | UTF-8 | Java | false | false | 2,021 | java | package com.fdmgroup.Entity;
import java.math.BigDecimal;
import com.fdmgroup.Utility.Constant;
public class CartRecord
{
int id;
int cartId;
Item item;
int quantityRequested;
//bean constructor
public CartRecord()
{
this.id = Constant.invalidId();
this.cartId = Constant.invalidId();
this.item = new Item();
this.quantityRequested = Constant.minimumAmount();
}
//new constructor
public CartRecord(int cartId, Item item, int quantityRequested)
{
this.id = Constant.invalidId();
this.cartId = restrictCartId(cartId);
this.item = item;
this.quantityRequested = restrictQuantityRequested(quantityRequested);
}
//existing constructor
public CartRecord(int id, int cartId, Item item, int quantityRequested)
{
this.id = restrictId(id);
this.cartId = restrictCartId(cartId);
this.item = item;
this.quantityRequested = restrictQuantityRequested(quantityRequested);
}
public int restrictId(int id)
{
int result = id;
if(result < Constant.invalidId())
result = Constant.invalidId();
return result;
}
public int restrictCartId(int cartId)
{
int result = cartId;
if(result < Constant.invalidId())
result = Constant.invalidId();
return result;
}
public int restrictQuantityRequested(int quantityRequested)
{
int result = quantityRequested;
if(result < Constant.minimumAmount())
result = Constant.minimumAmount();
return result;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getCartId() {
return cartId;
}
public void setCartId(int cartId) {
this.cartId = cartId;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
public int getQuantityRequested() {
return quantityRequested;
}
public void setQuantityRequested(int quantityRequested) {
this.quantityRequested = quantityRequested;
}
}
| [
"christopher.kemerait@fdmgroup.com"
] | christopher.kemerait@fdmgroup.com |
7d900cabe5d00d3603cb1241fdfbd6cae75e3626 | c682a544d3aad442bcbd782a05fe5507d96c2c4d | /src/heejin/server/service/MusicService.java | 1cffc6c4c1aa681e662328f9f7d1a5b8e0bbff8d | [] | no_license | hjhome2000/term_musicplayer | 667690eb3cd2310c93cf5b36860bd24a5d26d1c9 | ee69269ddd2d0a782070b5ef484fe3a8d736ef00 | refs/heads/master | 2021-01-01T17:27:34.578725 | 2012-11-09T15:53:07 | 2012-11-09T15:53:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package heejin.server.service;
import heejin.server.model.Music;
import java.util.List;
public interface MusicService {
public List<Music> findMusic(Music condition);
public void close();
public Music getMusic(String hash);
}
| [
"hjhome2000@gmail.com"
] | hjhome2000@gmail.com |
d484ae27764eaa6bc9ee63b4c604849f29832120 | bd2eca64a94cf766076b87ca6398180d6cc731d7 | /app/src/main/java/com/lz/nfc/utils/SSvrCMD.java | e66ee67eb10e85d7ec0602d578022cbea8484c63 | [] | no_license | jlvsjp/android_id | 854ef952b46366c81a833ab3c0ac21c07751fe61 | ef2188fafd68a36d30c242976b5b32d162aeb855 | refs/heads/master | 2021-01-01T17:38:03.721733 | 2016-06-07T02:19:59 | 2016-06-07T02:19:59 | 98,113,438 | 3 | 0 | null | 2017-07-23T17:17:05 | 2017-07-23T17:17:05 | null | UTF-8 | Java | false | false | 2,425 | java | package com.lz.nfc.utils;
/**
* Created by Administrator on 2016/5/11.
*/
public class SSvrCMD {
/**
* 服务端向客户端发送指令
*/
public static final byte SVR_CMDTYPE_SENDCDM = (byte) 0x00;
/**
* 服务端向客户端发送数据
*/
public static final byte SVR_CMDTYPE_SENDDATA = (byte) 0x01;
/**
* 内部认证
*/
public static final byte SVR_CMD_INCERT = (byte) 0x01;
/**
* 外部认证
*/
public static final byte SVR_CMD_OUTCERT = (byte) 0x02;
/**
* 读照片信息
*/
public static final byte SVR_CMD_MSG_ACK = (byte) 0x03;
/**
* 读照片信息确认1
*/
public static final byte SVR_CMD_RDPHOTO_ACK1 = (byte) 0x24;
/**
* 读照片信息确认2
*/
public static final byte SVR_CMD_RDPHOTO_ACK2 = (byte) 0x25;
/**
* 读指纹信息确认1
*/
public static final byte SVR_CMD_RDFINGERPRINT_ACK1 = (byte) 0x28;
/**
* 读指纹信息确认2
*/
public static final byte SVR_CMD_RDFINGERPRINT_ACK2 = (byte) 0x29;
public static final byte SVR_CMD_SENDDATA = (byte) 0x20;
/**
* 回应启动读卡指令
*/
public static final byte CLT_CMD_STARTRDCARD_ACK = (byte) 0x11;
/**
* 回应内部认证
*/
public static final byte CLT_CMD_INAUTH_ACK = (byte) 0x12;
/**
* 回应外部认证
*/
public static final byte CLT_CMD_OUTAUTH_ACK = (byte) 0x13;
/**
* 上传第一包照片信息
*/
public static final byte CLT_CMD_SENDPHOTO1 = (byte) 0x24;
/**
* 上传第二包照片信息
*/
public static final byte CLT_CMD_SENDPHOTO2 = (byte) 0x25;
/**
* 上传第一包指纹信息
*/
public static final byte CLT_CMD_SENDFINGERPRINT1 = (byte) 0x28;
/**
* 上传第二包指纹信息
*/
public static final byte CLT_CMD_SENDFINGERPRINT2 = (byte) 0x29;
/**
* 接收文字信息回应
*/
public static final byte CLT_CMD_DATA_ACK1 = (byte) 0x41;
/**
* 接收图片第一包信息回应
*/
public static final byte CLT_CMD_DATA_ACK2 = (byte) 0x42;
/**
* 接收图片第二包信息回应
*/
public static final byte CTL_CMD_DATA_ACK3 = (byte) 0x43;
/**
* 第二次认证
*/
public static final byte CLT_CMD_SECNED_ACK = (byte) 0x21;
}
| [
"mhpmii@126.com"
] | mhpmii@126.com |
49719be4a8741059e78a66ca510e55776ab1d6bf | 3e6e5e35557ac5c5571081b79996edcfea12adfd | /workspaceSao/SAO/src/com/movemini/simpleajaxservlet/interprete/IdiomasAplicablesTable.java | fe039eef68d3e706d26645d1c908f11c3ee9ee3e | [] | no_license | fengluandll/freedom | 082464ddd35fea980d1d72aa3ff96522c20caa8b | 53f40b77b0f03f4be5a2764391972b5f320c7f90 | refs/heads/master | 2022-01-08T23:45:01.978793 | 2019-06-07T18:23:19 | 2019-06-07T18:23:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,262 | java | package com.movemini.simpleajaxservlet.interprete;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import javax.servlet.ServletRequest;
import com.movemini.data.ConnectionWrapper;
import com.movemini.data.DataArray;
import com.movemini.data.Record;
import com.movemini.simpleflexgrid.HTMLTable;
import com.movemini.simpleflexgrid.HTMLTableColumn;
public class IdiomasAplicablesTable {
private ServletRequest request;
public IdiomasAplicablesTable(ServletRequest request) {
this.request = request;
}
public String getHtml() {
String id_interprete = request.getParameter("id_interprete");
/*if(poId == null || poId.equals("") || poId.equals("0")) {
return "";
}*/
//Record head = POHeader.getHeader(poId);
ArrayList<Record> records = DataArray.getArrayList("interprete_idiomas_applic_select_pr", id_interprete);
StringBuilder sb = new StringBuilder();
ArrayList<HTMLTableColumn> columns = new ArrayList<HTMLTableColumn>();
columns.add(new HTMLTableColumn("Agregar", "id_idioma", "center", "link", "onclick='agregarIdioma(id_idioma)'", "<i class=\"fa fa-plus fa-2x\"></i>"));
columns.add(new HTMLTableColumn("Idioma", "idioma", "left", "label", "")); //"onkeyup='updateSede(KEY, this)'"
// columns.add(new HTMLTableColumn("Ver Fechas", "id", "center", "link", "onclick='selectSede(id)'", "<i class=\"fa fa-calendar fa-2x\"></i>"));
//columns.add(new HTMLTableColumn("Borrar Sede", "id", "center", "link", "onclick='if(confirm('Seguro?')){deleteSede(id);}'", "<i class=\"fa fa-close fa-2x\"></i>"));
String tableWidth = "100%";
String additionalAttributes = "class=\"table table-bordered\"";
sb.append(HTMLTable.getHtml(records, columns, tableWidth, additionalAttributes));
/*
sb.append("<br><br><br><table width='80%'>");
sb.append("<tr>");
sb.append("<td>");
//sb.append("Observaciones Generales:<br><br><textarea rows='3' cols='50' onChange='updatePOComment(this)'>" + head.getString("RECEIPT_COMMENT") + "</textarea>");
sb.append("</td>");
sb.append("</tr>");
sb.append("</table>");
*/
return sb.toString();
}
}
| [
"jargumedoq@gmail.com"
] | jargumedoq@gmail.com |
e9ab1a607557298a9920d76222a31805ad9a3cfd | 8234b1fab8952e3164618de9937ccb25ae6ba849 | /broker/src/main/java/com/msgs/Constants.java | d25c993c676d647918bea7b0a925574b3681c356 | [] | no_license | SundyHu/netty-push | 39097a662c5056ea44f4fd2867fdb73f108f813a | e22056520c288282e2a98f159135cbaff7c6d868 | refs/heads/master | 2021-01-15T12:02:18.982106 | 2017-07-31T05:44:22 | 2017-07-31T05:44:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 268 | java | package com.msgs;
public class Constants {
private static String clientId;
public static String getClientId() {
return clientId;
}
public static void setClientId(String clientId) {
Constants.clientId = clientId;
}
}
| [
"498563079@qq.com"
] | 498563079@qq.com |
591cab58eb38a4e93cb9fde0758a2dcffc065506 | e295675997c6341ea1a064546ab2b45d1b2de8bd | /src/main/java/domain/Directory.java | f19bdddff5f6c7bc32c0dc1aedb9e7b9412074a6 | [] | no_license | Ezefalcon/mulesoft-exam | 761acf17b8d32a9727abbb92bf8e5d158683d951 | d9d77aedcc7317ff233c1925bd90e4dcf8440a8c | refs/heads/master | 2023-02-25T01:10:30.318869 | 2021-01-26T01:11:23 | 2021-01-26T01:11:23 | 332,931,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,278 | java | package domain;
import java.util.*;
import java.util.stream.Collectors;
public class Directory extends FileSystem {
private List<FileSystem> directories;
public Directory(String name) {
this.directories = new ArrayList<>();
this.name = name;
this.path = name;
}
@Override
public List<String> getFilesAndDirectoriesRecursively() {
List<String> filesPath = new ArrayList<>();
filesPath.add(getPath());
// Horrible way to add Directories after Files
List<Directory> laterAdd = new ArrayList<>();
for(FileSystem fileSystem: directories) {
if(fileSystem.isDirectory()) {
laterAdd.add((Directory) fileSystem);
} else {
filesPath.addAll(fileSystem.getFilesAndDirectoriesRecursively());
}
}
for (Directory directory : laterAdd) {
filesPath.addAll(directory.getFilesAndDirectoriesRecursively());
}
return filesPath;
}
public List<String> getFilesAndDirectories() {
return this.directories.stream()
.map(FileSystem::getName)
.collect(Collectors.toList());
}
public void add(FileSystem fileSystem) {
fileSystem.setParent(this);
directories.add(fileSystem);
}
@Override
boolean isDirectory() {
return true;
}
protected String getPath(String path) {
if(hasParent()) {
path = parent.getPath(parent.name + "/" + path);
}
return path;
}
public String getPath() {
return getPath(this.name);
}
private boolean hasParent() {
return Objects.nonNull(this.parent);
}
public Optional<Directory> getDirectory(String dirname) {
return this.directories.stream()
.filter(dir -> dir.isDirectory() && dir.name.equals(dirname))
.map(Directory.class::cast)
.findFirst();
}
public boolean hasDirectory(String dirName) {
return this.getDirectory(dirName).isPresent();
}
public boolean hasFile(String fileName) {
return this.directories.stream()
.anyMatch(dir -> !dir.isDirectory() && dir.name.equals(fileName));
}
}
| [
"exzequielfalcon@gmail.com"
] | exzequielfalcon@gmail.com |
c85b95987669f1246afbc79f028a7dd4f3b6a733 | 87ac5172190b36c60e7d139a3c68aaf809cd70ef | /DWITTraining/InfiniteForLoopDemo.java | 3c60118eb0b4bd703bfa48dda000a167994b99f2 | [] | no_license | sandeeppokharel/DWITTraining | 2dd84c18bca6c359d977b046c41f125abf1d73d9 | ea7b9ac21f381ee3e82d334dc881dd139a944559 | refs/heads/master | 2020-04-28T08:12:31.660790 | 2019-03-19T02:18:12 | 2019-03-19T02:18:12 | 175,118,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 274 | java | public class InfiniteForLoopDemo{
public static void main(String[]args){
for(;;){
System.out.println("calling loop infinitely");
}
}
}
/*
public static void main(String[]args){
for(;true;){
System.out.println("calling loop infinitely");
}
}
*/ | [
"noreply@github.com"
] | noreply@github.com |
3aa59740b62dd096af3f1f83240951c264d68633 | b7a8b1357129b1f138e85d5312b18483ff9f5a1a | /src/main/java/com/handy/aws/functions/InventoryFindFunction_M5_L2.java | 8e6a73cd4a94ec7ecc993a4d5fa0222fbc4556fc | [] | no_license | monsonhaefel/handy | 0ae81ec55cea7952a523054ef4d14351d01fa6af | cad83e7cec6dbe8412e1a0e264115b0e98f0e1ff | refs/heads/master | 2020-04-11T22:17:24.534040 | 2018-12-26T13:43:24 | 2018-12-26T13:43:24 | 162,131,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,218 | java | package com.handy.aws.functions;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.handy.aws.domain.Product;
import com.handy.aws.data_access.Inventory_TestData;
import com.handy.aws.functions.RequestClass;
import com.handy.aws.functions.ResponseClass;
public class InventoryFindFunction_M5_L2 extends Inventory_TestData implements RequestHandler<RequestClass, ResponseClass>{
@Override
public ResponseClass handleRequest(RequestClass request, Context context){
String ids = (String)request.queryStringParameters.getOrDefault("id", "-1");
Integer idi = Integer.parseInt(ids);
Product product = getProductById(idi, context);
if(product != null){
ResponseClass response = new ResponseClass();
response.setBody("Product Selected is: " + product.toString());
return response;
}else {
ResponseClass response = new ResponseClass();
response.setBody("Error. Id submitted was : " + idi);
return response;
}
}
}
| [
"johnsnow@richards-imac.lan"
] | johnsnow@richards-imac.lan |
35eda7ef345ad2d9ab46ba8eddd732c8e16040f0 | 1aef4669e891333de303db570c7a690c122eb7dd | /src/main/java/com/alipay/api/domain/CardTypeVO.java | 22009857ab31b3945d6be03586972c44fee5994b | [
"Apache-2.0"
] | permissive | fossabot/alipay-sdk-java-all | b5d9698b846fa23665929d23a8c98baf9eb3a3c2 | 3972bc64e041eeef98e95d6fcd62cd7e6bf56964 | refs/heads/master | 2020-09-20T22:08:01.292795 | 2019-11-28T08:12:26 | 2019-11-28T08:12:26 | 224,602,331 | 0 | 0 | Apache-2.0 | 2019-11-28T08:12:26 | 2019-11-28T08:12:25 | null | UTF-8 | Java | false | false | 1,078 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 卡类型对象
*
* @author auto create
* @since 1.0, 2015-09-22 11:04:47
*/
public class CardTypeVO extends AlipayObject {
private static final long serialVersionUID = 6636519379485219217L;
/**
* 卡类型标识符,取值范围如下:
DC("借记卡")
CC("贷记卡")
SCC("准贷记卡")
DCC("存贷合一卡")
PC("预付卡")
STPB("标准存折")
STFA("标准对公账户")
NSTFA("非标准对公账户")
*/
@ApiField("card_type")
private String cardType;
/**
* 卡类型描述,参考cardType的描述字段中括号里的值。
*/
@ApiField("description")
private String description;
public String getCardType() {
return this.cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
3b32c6cfc8a32fb0b806208263d862d2fb543da3 | 4ff458e5a3e9be707b000847d449e57ab1379a83 | /evidenceplatform/evidenceplatform-domain/src/main/java/com/beiming/evidenceplatform/domain/dto/responsedto/BankTestResponseDTO.java | 90485e3cfbccaebf6aa58fbee21eab4d0c80fbf1 | [] | no_license | cat1004/ODR_TOOLS | 7776ab4f5f0e8e201fe396069d8138eb6fa2d49c | 18767c053e0c41b6d5a998811c66dfe2d6e5d98e | refs/heads/master | 2020-04-12T18:14:33.082352 | 2018-12-20T03:02:09 | 2018-12-20T03:02:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package com.beiming.evidenceplatform.domain.dto.responsedto;
import lombok.Data;
@Data
public class BankTestResponseDTO {
public String bankName;
}
| [
"842539170@qq.com"
] | 842539170@qq.com |
24cad37953610e2acf9966b3a770742ee0334a9e | 7ce8de391c8527d8268cc4c55a34c4ee3303ba17 | /app/src/main/java/com/shout/shoutapplication/Utils/RealPathUtil.java | c1c4761857b0aec757a341f5f415cb7c525a42e5 | [] | no_license | capternal/Shout | 37c443543df59029ca821dbc7e6d939ac1bd3e7e | 350e3861d53c2652a853675c81dfdfed2ce59939 | refs/heads/master | 2021-01-11T00:53:57.595834 | 2016-11-09T15:51:47 | 2016-11-09T15:51:47 | 70,475,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,311 | java | package com.shout.shoutapplication.Utils;
import android.annotation.SuppressLint;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.support.v4.content.CursorLoader;
public class RealPathUtil {
@SuppressLint("NewApi")
public static String getRealPathFromURI_API19(Context context, Uri uri) {
String filePath = "";
String wholeID = DocumentsContract.getDocumentId(uri);
// Split at colon, use second item in the array
String id = wholeID.split(":")[1];
String[] column = {MediaStore.Images.Media.DATA};
// where id is equal to
String sel = MediaStore.Images.Media._ID + "=?";
Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
column, sel, new String[]{id}, null);
int columnIndex = cursor.getColumnIndex(column[0]);
if (cursor.moveToFirst()) {
filePath = cursor.getString(columnIndex);
}
cursor.close();
return filePath;
}
@SuppressLint("NewApi")
public static String getRealPathFromURI_API11to18(Context context, Uri contentUri) {
String[] proj = {MediaStore.Images.Media.DATA};
String result = null;
CursorLoader cursorLoader = new CursorLoader(
context,
contentUri, proj, null, null, null);
Cursor cursor = cursorLoader.loadInBackground();
if (cursor != null) {
int column_index =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
result = cursor.getString(column_index);
}
return result;
}
public static String getRealPathFromURI_BelowAPI11(Context context, Uri contentUri) {
String[] proj = {MediaStore.Images.Media.DATA};
Cursor cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
int column_index
= cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
} | [
"capternal@gmail.com"
] | capternal@gmail.com |
8e6064e5c9b35e2c2d8c5e78ce01c98dd8a6d505 | 03b126d8342a88de14cda47ff7358cad2f5ceb7d | /tiger-proxy-core/src/main/java/org/tiger/proxy/packet/BinaryPacket.java | 8ead086290574d3c089db9200ba01f902aa6c08b | [] | no_license | kluyuyu/tiger-proxy | a1387911bf63d521a1840116b4c514e528b657e1 | a5e7d73930c8da144727d38b2ec30897a3d820f6 | refs/heads/master | 2021-01-19T10:08:29.657302 | 2017-08-22T14:24:50 | 2017-08-22T14:24:50 | 87,829,541 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,178 | java | package org.tiger.proxy.packet;
import io.netty.buffer.ByteBuf;
import org.tiger.proxy.utils.BioStreamUtil;
import org.tiger.proxy.utils.MySqlByteBufUtil;
import java.io.IOException;
import java.io.InputStream;
/**
* Created by liufish on 16/7/14.
*/
public class BinaryPacket {
/**
* body长度
*/
public int packetLength;
/**
* 包序列
*/
public int packetId;
/**
* 内容存储
*/
public byte[] body;
public BinaryPacket(int packetLength,int packetId,byte[] body){
this.packetLength = packetLength;
this.packetId = packetId;
this.body = body;
}
public BinaryPacket(InputStream inputStream) throws IOException{
this.packetLength = BioStreamUtil.read3(inputStream);
this.packetId = BioStreamUtil.read(inputStream);
byte [] data = new byte[packetLength];
BioStreamUtil.read(inputStream,data,0,data.length);
this.body = data;
}
public ByteBuf writeBuffer(ByteBuf buffer){
MySqlByteBufUtil.write3(buffer, packetLength);
buffer.writeByte(packetId);
buffer.writeBytes(body);
return buffer;
}
}
| [
"123456789@"
] | 123456789@ |
4b0059afe70d88c98a0023de3b4b6dd548087be0 | 4d1c424d8c33c246e09597a9f666c4366f257ab2 | /cardservice/src/main/java/com/card/cardservice/config/CardsServiceConfig.java | 3560fce3ff2ad2b98f7242b4cad31a74bb246b90 | [] | no_license | RodrigueMedor/eurika-server-load-balancing | c22a0a5fa8db09d4abb4640a0bc6f02f667ef043 | 3b1d58924ff1b2afd6d0f97ec4390f29622fdf92 | refs/heads/main | 2023-08-22T04:38:00.504483 | 2021-10-20T15:56:11 | 2021-10-20T15:56:11 | 416,835,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package com.card.cardservice.config;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.List;
import java.util.Map;
@Configuration
@ConfigurationProperties(prefix = "cards")
@Getter @Setter @ToString
public class CardsServiceConfig {
private String msg;
private String buildVersion;
private Map<String, String> mailDetails;
private List<String> activeBranches;
}
| [
"rmedor@nexient.com"
] | rmedor@nexient.com |
2fddcf5d28e8e7d1c9e97f6056c3ffbb29048151 | 51934a954934c21cae6a8482a6f5e6c3b3bd5c5a | /output/d35c0b82eddd4f88b166f300d8c27976.java | ab5394f8527c10d9f17fa8d2f4d0f811b4420930 | [
"MIT",
"Apache-2.0"
] | permissive | comprakt/comprakt-fuzz-tests | e8c954d94b4f4615c856fd3108010011610a5f73 | c0082d105d7c54ad31ab4ea461c3b8319358eaaa | refs/heads/master | 2021-09-25T15:29:58.589346 | 2018-10-23T17:33:46 | 2018-10-23T17:33:46 | 154,370,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,806 | java | class rG {
}
class T {
public void ACcaBj () throws M7z4Lul8fcxR {
{
return;
return;
int iPblFC;
;
void[][][] Xq6zAl;
int BVteFR9VImUk;
!540971932.il();
-this[ !this.NSyM0e];
void[] Wl7Zrx1LA;
;
}
{
;
int Ez;
while ( false[ new V5Cl().NVq5AO8si()]) ;
boolean gc;
aYoIvSmtcI m3dYz;
if ( this[ Vi7bKr1JAy().qLUD()]) {
boolean[] wqZCZgIXRa3;
}
while ( new int[ !true.fPmnQb52cObBg()][ JIllk().WC5nPK()]) ;
while ( new Nj2zzI6Vi[ false[ new Ai().puXG]].PA6C()) if ( this.eM3Wc()) while ( !false.LlcJ) new tI2GKiKN0uqg()[ !-this.qmWyz17hxKSL()];
boolean[][][][] zLhFJ;
X9v0rwUmWaSTD zGfqO5yo_OHnW;
;
{
int G91XO;
}
;
int[] q;
boolean[][][][] pP4U04nJ2k;
}
---this.JpvQnnr;
int T_8C6EzGEjc = null.JTZJOVso8J6CI() = ---null[ -!-false.gm1jEdRYblSr3g];
;
int[][] gUb5JD5;
VZT9M2n p9 = uTXDzxbKhDX().FLadG();
void[] cNgofT9aD;
return;
;
void KtYOFVAl2ZeMt = !--!288.T49_ljPD();
void Lhxx8kpP = !!new int[ new o7lQ2VXDM().bsB2O].kUPf;
int D;
}
public void[] JQHL1e;
public int _wI5IM2L;
public int UJblWMzDuH1cr;
public static void zOn4S (String[] HOwnqisn9) throws fEc11VaU3MeC {
void lh6 = -new int[ true[ false.zrk()]].o3bRlIq = new void[ 56.SgXtAFDuSET()][ -!-1711.TpfiqBTlJ4E];
boolean[] Wx_p = false.PvgMWzdLEAC() = !-new GqASY().hc;
void[][][] QXyXd = !!---null.jMSOhmZrUFL = -!!!true.AGjy7r();
while ( null.R_BCtzXEPR2f) ;
void[] kau3r5lhLSmUn = a1C8LQ3k_V40.Y1AIxSU6T = new void[ 872657[ true.KQaZB]][ ( 439912954[ --Qh3nTYp().bXhyLMc71]).Gs5US];
void[] K6e = !-!--false[ this[ !false[ !!-( ( 223971[ this[ -null[ new bKHpGfg()[ !CyN_R9N().MPY]]]])[ !!92138.nV43rqq()])[ this[ !ZxTQ2vwn.PYro_wbaXTJ()]]]]];
if ( null[ new g0l().f()]) ;
int X5EFGhb0KU;
;
{
int[][] mXLaHp7YaiASi;
boolean[][][][] jsYGD;
boolean[][] M2LcwRYSOiGhO;
void[] DoN4sp;
;
int gWG;
;
while ( false[ !-this.P7xQpbPzwU]) return;
;
boolean ulWHq;
return;
;
boolean eLmA9G9R4;
while ( ---new int[ !!F6xrOSKbsj().I].mmw2CXV64cLv) {
void m;
}
}
return ( -new Jt4U().KRe8()).ZcLl;
int Z3jzlTnMVmqIc = ( new Ei83zXu5UWnF().A).U();
D[][] pZTKQ;
false[ !!false.QHOGOJH0y()];
void[] PJgKN2pcD61Ua;
;
boolean[] y4w94HPyX4 = !!--!--yuWvP().V7yXuKkis9 = !-false.J3();
boolean[][][] gOkQB6ufzeUj40;
}
public void[] OBR03alOi9;
public static void jX (String[] Sh30svUCBN6h) {
void M;
int XStaFaNY7hJlq;
void dWc1c = !this.W3f() = ( false.o2mF7wwwiHwZ())[ new vQCWdZ0F().FeqKfyC8hx];
K9Eho2bWFpHSO Fv;
while ( null[ !!-this.CIk1G]) while ( 3835[ !!S[ ( --hR1N.RWdfNXtzl).CxC1P()]]) !!-true.H();
while ( -----this[ F4jV8daVj.rsZdzn4U8OF]) {
int LCAUoUT;
}
{
int[] YFvQjbMY;
;
boolean Txw1jFPd93E;
;
void GTZdicFh;
if ( !!!new DXHAK().TY7XZGdOe8R74) while ( null.rBiZlDH8) return;
}
while ( true[ -!vIm5mf()[ false.WZRtMIcIJJ_GA()]]) while ( Z7WrK92DueV2.HEgqctOLgKNA) while ( !null.weLAgQA()) {
tD9[] N469qdgqtYc;
}
wcR4I0 gFcA0Ehc9VpD34;
if ( !!!!-new int[ -!new boolean[ !true[ !null.LKvkm]].MoI].qRjae) while ( new JIppLlB7vhURE().TiL()) return;else return;
boolean[][][] VduIg4g2F = this.fWr;
}
public n1VQe MjYc2uQn;
public void Xe6k9BjJKCY1eZ () {
if ( --ZT.AOWR5jp) if ( -false.h()) {
int xu5cUzjf;
}
if ( ( !--false.urIWYj5T()).PaxUP5j) if ( --null.cP7NchSC) while ( null.OrF4PZkND1N5()) {
void m3FfBAEe;
}
int[][][] j = !-new ZP[ --!this[ !--this.QSj0jgL()]].LHAiS0ME_g() = null[ -false.zR];
{
{
null[ null[ 0157376.x_n7()]];
}
void[] _Rm;
;
!r9nEf()[ 8.eXZ];
void S;
EufLgVOvtN[][][] Lk0rlrmwq3U;
return;
gU7w.D0;
if ( false.ekMa()) return;
KxBruL Gl;
int[][] cib;
int[] utSgYYdNsQSJ;
MluuJUnGuFrh8[][] QVlQbwSp6HkBem;
;
void LobPboLrVE8JkN;
while ( !!( -!new VITwmX().AhBC7)[ --new kXi()[ !l1W6C96_Uf()[ !!ZUbIXGguQ9_()[ !false[ null.qXtnZh]]]]]) if ( new MT().iJcf082XT()) ;
return;
}
}
public boolean[] XGAVmxNHDs1G () {
{
QnxmTOJbSw0Zx VUv;
CaBa().NV0aHpIU0Klez();
void[] JhdtTsQfPtK;
boolean p85clSKbb8;
boolean[][] E6VtGBZOeCB;
rlUbixZUZpf().SyL7();
;
}
}
public static void XJYCVyecM (String[] BT1Pvq) {
if ( -!true.EM) this.jpBa738VHwrd();else return;
while ( nIVzP.zCAMg2B) while ( fEXfMVs7NAPQ[ vlQR1()[ 32539045[ sved().sI()]]]) if ( _().pi6AK5saTbx) while ( -!new int[ true.mrXhCFfxdb].biCVkeHQOgT()) return;
return -OsZUKrr_e()[ -!!F58C_jVF6dd.FHXnfI];
void[] FSG2UOcN_1;
if ( ( null.wvNh5f4).c7F3Jc6eMGBQMN) ;else {
if ( ---1980.LwUF1BPhVRNrh()) if ( null.jbz()) return;
}
lVRk1.NpvN6oftULari();
if ( null.BxU9l9OsVGWu()) ;
;
xCKp.dxrGBFT7CGVf();
return;
boolean[][] rzQRsyXH_S1LXa = !new int[ true.wn0LNc].YTDvv9() = new boolean[ -new iuNiewGU2Esob6()[ SZ3VZvaeLq.nDgXTit]].Dyv();
int[][] rxpMJ;
return LRm765DmjveUT().XvaF67ZUR();
while ( -!false[ !!49477047.K]) return;
if ( false.PpVy) return;
}
}
class a4Rv0xr7_Qu {
}
class i1_uZH2 {
public void[] oHEKS3X (qOsTmVtAfUkMlz[][][] X, F9GdRp63ht[] wAnR1vJruK7eo, boolean[] mc3YaBWS3z07jc) {
if ( -null.P()) if ( true[ ( --09.CABY).RcxK8YLh4kQg5]) !!this.TSLgbgCU1();
}
public static void jRN1pneup66 (String[] Rs4gHjRg) {
;
;
void TjAGMAHOumB = J65UUmY()[ -new XwBZvMJLj1m()[ new boolean[ false.Z6P()].h2jRt5uNQF1CM()]] = new RoHmEtCH().IVE68VulsAh;
{
int Ly4pcRcqN;
!-!!yTInUX()[ 60125.deMZjTgLgQm()];
{
return;
}
int yAdK;
void[] tMzeLpn;
void[][] q0fyzv_;
}
boolean[][] hExkpJaB;
M5y4pGB j9RZGVNEjgtW = true.r2iRFS0W_iD;
int[][][][] _OKHfcmps5MY;
Vw_lf W = fcIP9.OK0sRSdlb() = !true.rv8r1J;
eohfz6A2H[] yyr1 = ( !true[ !null.bRf7FO6()]).AbBTjNuaaCq();
}
public int Fgjt2qhTN (boolean[][] EjUI7mPY, void[] ILpOZdMje, boolean ZxQ, boolean[] wW1WHkv, int[][] k3W, boolean ZCkNQqEruG) {
while ( new NcPB().BEg3atH()) while ( !-this[ --this.nYpJP2DvHRAb_]) ;
while ( 2.P2I()) if ( 91.Z69zWD_9PUzviB) while ( ( new void[ !-null[ -this.T0HHihUuL]].L5xIMZR())[ !-new ZYdI4().IGtxTk2aI]) true.A4Le;
if ( --565503119.y22kBC7nKtJ7qW()) if ( !!-!!Q368VlNFOuq()[ -x3Qs()[ -new void[ !2861294.KJbOLAcdTlDGgJ].GSQRQZ()]]) return;else {
void HP;
}
new qrFSUqyMtv()[ !026073578.fAletp5jFq()];
;
gnds7F[][] QHxgsE6VpRV;
int Nvf2VkIPjz;
void[][][] PFYrrIG5SVR_;
false[ tWW.q1kMR];
{
-this[ YQVZdlM6[ -!RCpteHJK().xbysQ()]];
return;
boolean[] gs;
int[] Gt1JBvOC;
while ( --!this[ -97.H()]) while ( new PQ[ new QTv2zmb1dC().qZMz4i][ !!false.nb8CAp_pYCQ5]) new boolean[ !WDfgMdm8Qd7NG[ new int[ false.iIuCb].fSUAf()]].hcJoLZa51W();
int Th;
while ( qPqZQJ.LSvzPS) while ( !!-false.mMEVHiovk) {
while ( YO5.HV85mSCuwT) {
if ( --null.qOzcW8S7y4s8) if ( g0pf7EWmPZbS().CiysotI2aUJ()) while ( -!UKc().rYJm2rBzGVf()) -null.VV1KCzpM8pI;
}
}
while ( !( !false[ -!--new sZJvhtvesPTU7U()[ ( true.O).Gdy0GK()]]).O4yz7tr) {
nm[] U1ed5_wcp;
}
!!!-!--V3Cd9().ZPpYY6iXe3i__w;
if ( new boolean[ xsV3[ -( new pC().Jg_WH7AKwg3())[ new IeDSF[ true.K6g9ydHP()][ -!new void[ !!!new CQtbcxWN().WEE1jNG6()].O67BY6h()]]]][ -( !-( -3.zmk).kcT6).hQNf()]) ;
;
false.WOvMDiwgL0WT();
}
}
public boolean[] PQvUre9tNtwAj () throws h6D42D {
boolean TKmQvzU;
{
if ( !g0OPLUN[ dQvndcmDdbm().ZUt()]) return;
boolean[] Ca;
void q8M;
;
return;
{
return;
}
int[] I0GhxU8Np18;
JLY3jLp_DU4C CZrylz;
void ZfeCU9efEM;
;
boolean[] ocSkhRiU4qH;
p78tTe85oGX X3UJZ1qT;
void[] SNLfLJXDD7s;
boolean a39OP0cQq;
;
t aVAsKbl6x;
boolean[] MuNFkfLL2zrR;
}
!!!!!true.z5C0cRIN();
if ( !new int[ !244.u3x7KJA46ye()].pO8_805iAnth()) if ( -!null.PI13PEhI5ob8J) ;else {
{
int[] UFP_EB_FExE;
}
}
}
public static void prUjRCGxtC (String[] RCm3is87AqCea) {
while ( null[ !-true.a6()]) if ( null[ !false.evWry0TiQ2Z5y()]) while ( --this.Rmy) while ( -null[ this.mq_kUtZzIs]) while ( HoRE_m6v().aWxz) ;
aUM03QW2GeMVs[] sLEvXGX = Y65QrSffO39().Dwm4N1;
if ( -( !--new void[ tt().hyw43__Gf9HtI()][ OXMOGWeGo().hOXeoalLQz]).kZl_a0CB7mV()) !UNDDI_KX5O.KLa();else true[ null.KgfWse2ZMOIU()];
if ( -null[ null.IYgpA7]) while ( !this.C3PWQUTlGs()) ;else if ( -false.EVWK) return;
OVVJ qHS = !null[ -!false.HUaCa40y2MQ()] = null[ null.rbZ_T2bKj0uXcR()];
return;
-this[ -this[ !-2962303[ ( !-!false[ true.PyeH2])[ !false.nPU]]]];
boolean[][] UKFDX0dFvW1sv;
if ( new dwde8p().grhfW5SV0dyv) {
;
}else return;
void[][] HZmjrvJhJSf;
( ( this.Dz())[ --HgOZ_vlPu4ubk().Lq5imh()])[ !this.SURRsli];
int xFeYZ = new Q31ozTq9ZnK()[ null.yEJtaO()];
!false.HlsTqXC2();
int[][] UZ = 104736.gtLWF;
if ( null.B) {
while ( --null.nxyu6Vlh8jQ()) while ( false.UNIXc0()) ;
}
}
public boolean TKKTvQzPq (boolean[][] cWbR1IpnEPU, boolean[] K1, void Vdr3L0vlMmw) throws SVfBcSB1S9WE {
while ( new B5().Ak()) while ( --9427161.L0) if ( this[ true.qE67HQZ()]) {
HL[] NgsxkUeDYJd;
}
void I = !false.uLQi;
;
int[] KSsrj = !null.fAMI2YBV();
void hiQiaW;
return;
void P7jTWuMyJxqKs = 0424.HaOrQ() = -this.DUofeEG9x();
void[] VKZYR8R;
return;
void[] P3t3CMc;
return new Rq().Oq();
boolean T8r7U;
while ( ( -!new k3rFRI0usS().v0Pz()).VXz9erc) if ( 39[ ---!-new jyh2()[ ( !!VyquGN()[ this[ !435.tewNMt__K3pS]]).c()]]) if ( !new D9Jz4NEHyWx1().N6Iee9) return;
}
public static void GLJ4ken (String[] SmYF) throws jRNw {
int[][][] cqo = -!IfmTv0().IF5D() = ---( ( !!this.XPtT7sK2OsS).q6P9tmXPWw).x_WNxzp();
HT1_tvS JojJRuCQE8kqR = false[ ( new WmfZ8c[ !-!pMhFsM8P()[ AImprV3X_9taG()[ msoGZNNG7.hcm]]][ -!096.GEAknx9Rq]).iSBPSXoEQC4] = null.L2SsNcs3jfe();
if ( !null.QKfSdXlSe) while ( !QSg_fKoiln0.XbZzuYfLn) -!AcALC7().eN0Zk54JXJm();else -new eIvtvk8q().m7XDYtzQ();
{
void D348WiEfR;
void[] UGBqh;
while ( -new void[ null[ 63758344.lkBBhwK()]].fiTeDSa) return;
rne6hYR9[][][] rylKU0CfguH;
if ( new c9[ 037.Qut3HgH8OUXt].H9xjVl7()) return;
y X;
if ( !!( --!-true.OBQPJg8).RW7ZO7kk3fjdu5) --283783.wbuCi7rONSjTQ2();
boolean jEUtQ9Ur8SQpz;
while ( !-!new void[ -null.OL29iV()].o) ;
pPqbsp MDNGDSErQESb;
;
bJjDu0T cX;
}
}
public Om aj749uoab1oj;
public int W (int UW1238uQ5wMLC) throws wrWsVX8pQyp {
boolean mYc = !( --true.OlmgUUmGd)[ null.an_2_lz8In6K()] = ( 9.y0Dwaa0u)[ !YLNGQgzdNO.CbTGg];
--!!new s6fS().nP();
!dZPfQu[ 735050[ new int[ UZNaKFC.yelBIK()].BUIm0LR2]];
!-new void[ r4IQTpIpm7H()[ MTgrqCh1().xF813VfcButib]][ !!LkGnP1SIi0AM.hx];
void[] f0C1c = Ut8MvOVl41rKJ._IC();
{
int[][][][] p9O5zcT;
;
int Z57fjiYrjw;
int[][][] qdmgPXeFTX1_;
int[][] d8ICS_vnx4Lp;
PHa37wwbesVWlD[][] Y7_7vJcNBC;
void Zi0Sgroqi8le;
}
int[] Ci1gRYaZxh = true[ !-( !true.a7Vtm())[ new njTDmjid[ dLxbF9eN.w6AJt()].V]];
Jfex[][][] RyBRsL;
while ( new __fwVYhOt[ !null.pBW4b()].crWWGnDTZP()) return;
if ( -!null.DOWGCSZC38ADQ()) if ( -new _yVn().QhOlLWe6R) if ( ( !null[ --new hnE[ ( false._VnOoDOC3QJg()).oMt4YvvYJUWyrE][ !null.R()]]).v5wPM) return;
boolean[] SQNIE = --this[ -!lPQbJJxX7[ true.zzlooLR]];
boolean L9mxX4JWH;
if ( new boolean[ true.uUr()][ --!new ZcfjMe[ !!new _x5V9xQgfEFjs().KyXCzx0avi7hPg].dn3stUD]) ;else if ( AkmIwwhg[ !zO()[ null.s9G()]]) -new wZ6oAgDGQHAbT()[ false[ !true.oT7L5Kw]];
{
void[] wf2O_XHkNavQ;
boolean mul;
while ( ( !-!!4754[ !-( ---true.mBr9ZxjgBbL).YB]).gF1qPBZ1oM) null.AivfxDFW7();
!!55.Gx4Wm();
int[][][][] dwJ2sD;
int[][] asXmzAAIEt;
int[][][][] cjk;
EnrmwFq9ARS3[][][][] l45JlVk;
-false.IqE();
boolean lKZg6sD;
int TGIrDKQioYb4f;
;
return;
int[][] lcyR298f5M8J;
while ( QNAwoZqa6FyQ()[ ( false.spVcVfkACvAi).hZvSnF5Q3()]) ;
void[] _epr;
}
return true[ !!true.SzrVopyn_UY4dh];
boolean N81i5PQ;
while ( !true.t3Zf) {
boolean VN71lEbCV;
}
boolean[][] eqSKN_d1wR;
boolean[] yneZqUC = -new NxYvTpa().udqEwjjUsQM;
}
public static void r (String[] uBzVFyBWMMP) {
int ttj41OjDbr;
int mZ_UyK2BSbLfG = false.g() = -MYqXHlScvpa().AMygdxyIp();
}
public int ljGC;
}
| [
"hello@philkrones.com"
] | hello@philkrones.com |
85a2520631fa34b28bccf241cf8b8ca342c63cb0 | a473a6cb6900276b9f5f80acccf3cdde4f306281 | /src/test/java/org/tw/spike/rest/FuClient.java | 074c316c06f9ffc276fab1dd92828e7d336efe6d | [] | no_license | sohamghosh/sample-rest-app | 0571fde8f0b8cde774cb4887708660c2a2981434 | c583eb6a102b7d67986930d8c8ee5146a5301e48 | refs/heads/master | 2020-04-27T08:16:00.070920 | 2013-12-29T11:55:53 | 2013-12-29T11:55:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package org.tw.spike.rest;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
public class FuClient {
public static void main(String[] args) {
String url = "http://localhost:9090/restapp/fu/post";
try {
Client client = com.sun.jersey.api.client.Client.create();
WebResource webResource = client.resource(url);
String input = "{\"name\":\"Jane Doe\",\"city\":\"This City\"}";
ClientResponse response = webResource.type("application/json")
.post(ClientResponse.class, input);
if (response.getStatus() > 299) {
throw new RuntimeException("Failed : HTTP error code : "
+ response.getStatus());
}
String output = response.getEntity(String.class);
System.out.println("Output from Server: \n" + output + "");
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"soham@insoham.home"
] | soham@insoham.home |
2e1798cced8c56580f0a54c49d8b85a4fadee282 | ce7dc56b7dd9903b937c788220bceb5c5ac0c63c | /model-mapper/src/main/java/com/github/marceloleite2604/tutorials/modelmapper/model/ThymeleafModelAttributeNames.java | 533ef06f22a8b11e2c4ff19e6f3528871435f65b | [] | no_license | MarceloLeite2604/tutorials | 92e11760c67b6808cd214088ae019a1f30c75386 | 9120f91223ccd8acca6e974fea9695bb3c83429f | refs/heads/master | 2021-07-13T13:10:06.331387 | 2021-04-01T04:09:03 | 2021-04-01T04:09:03 | 102,534,758 | 3 | 0 | null | 2020-07-01T20:22:46 | 2017-09-05T22:14:03 | Java | UTF-8 | Java | false | false | 867 | java | package com.github.marceloleite2604.tutorials.modelmapper.model;
public final class ThymeleafModelAttributeNames {
public static final String DETAILED_ERROR_MESSAGE = "detailedErrorMessage";
public static final String DETAILED_INFORMATION_MESSAGE = "detailedInformationMessage";
public static final String ERROR_MESSAGE = "errorMessage";
public static final String INFORMATION_MESSAGE = "informationMessage";
public static final String USER = "user";
public static final String USERS = "users";
public static final String GAMES = "games";
public static final String GAME = "game";
public static final String LIBRARY = "library";
public static final String REDIRECT_PATH = "redirectPath";
public static final String LIBRARIES = "libraries";
private ThymeleafModelAttributeNames() {
// Private constructor to avoid object instantiation.
}
}
| [
"marceloleite2604@gmail.com"
] | marceloleite2604@gmail.com |
02a7cd20fd584e2b64e58fa18897a22544911b1c | c103a13431e1f2f5184b5691e1ecd165715bf5ae | /wemall-wx-api/src/main/java/com/jungle/wemall/wx/controller/WxHomeController.java | 4639df41991035d1732e49c8483d7dac05274f7a | [] | no_license | Junglexyz/wemall | 91dc68e6af65fe4f4951c2fe91f8013af0cf32fb | 9c1fb321df0045ee6540977b732c6bc07720c87f | refs/heads/master | 2022-06-23T14:47:54.000877 | 2020-11-05T14:25:44 | 2020-11-05T14:25:44 | 241,628,790 | 0 | 0 | null | 2022-06-21T02:51:48 | 2020-02-19T13:29:15 | Java | UTF-8 | Java | false | false | 1,619 | java | package com.jungle.wemall.wx.controller;
import com.jungle.wemall.common.util.ResponseUtil;
import com.jungle.wemall.db.pojo.WemallAd;
import com.jungle.wemall.db.pojo.WemallCategory;
import com.jungle.wemall.db.pojo.WemallGoods;
import com.jungle.wemall.db.service.WemallAdService;
import com.jungle.wemall.db.service.WemallCategoryService;
import com.jungle.wemall.db.service.WemallGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description: 微信小程序首页
* @author: jungle
* @date: 2020-02-29 12:29
*/
@RestController
@RequestMapping("/wx/home")
public class WxHomeController {
@Autowired
private WemallAdService wemallAdService;
@Autowired
private WemallGoodsService wemallGoodsService;
@Autowired
private WemallCategoryService wemallCategoryService;
@PostMapping("/index")
public Object index(){
List<WemallAd> listAd = wemallAdService.listAd();
List<WemallGoods> listSpecialGooods = wemallGoodsService.selectSpecial();
List<WemallCategory> listWemallCategory = wemallCategoryService.getCategoryByPid();
Map<String, Object> data = new HashMap<>();
data.put("listAd", listAd);
data.put("listSpecialGoods", listSpecialGooods);
data.put("listCategory", listWemallCategory);
return ResponseUtil.ok(data);
}
}
| [
"18789197915@163.com"
] | 18789197915@163.com |
c21259a5252f5b0c12f40445cad69e9fb1f268d6 | 5c9a709da15d0de5a4e5e7df609f4c09f4eb55eb | /src/main/java/org/seasar/s2jdbcmock/meta/MockPropertyMetaFactory.java | 9c2f668ac8ac58c4770be5f4c3069d4e839b3a3a | [] | no_license | takezoe/s2jdbc-mock | 447ef5b451c7a5ed440c0db3d64fd2a0248c4a55 | 3034c128af31c79354a3a27c8969a8f156d33ce0 | refs/heads/master | 2021-05-16T02:58:24.843749 | 2013-03-20T06:41:04 | 2013-03-20T06:41:04 | 8,885,998 | 0 | 0 | null | 2020-10-13T01:39:46 | 2013-03-19T18:31:25 | Java | UTF-8 | Java | false | false | 1,630 | java | package org.seasar.s2jdbcmock.meta;
import javax.persistence.GeneratedValue;
import org.seasar.extension.jdbc.ColumnMetaFactory;
import org.seasar.extension.jdbc.EntityMeta;
import org.seasar.extension.jdbc.PropertyMeta;
import org.seasar.extension.jdbc.meta.PropertyMetaFactoryImpl;
import org.seasar.framework.container.SingletonS2Container;
import org.seasar.framework.convention.PersistenceConvention;
import org.seasar.s2jdbcmock.id.MockIdentityIdGenerator;
import org.seasar.s2jdbcmock.id.MockPreAllocateIdGenerator;
public class MockPropertyMetaFactory extends PropertyMetaFactoryImpl {
public MockPropertyMetaFactory(){
setPersistenceConvention(SingletonS2Container.getComponent(PersistenceConvention.class));
setColumnMetaFactory(SingletonS2Container.getComponent(ColumnMetaFactory.class));
}
@Override
protected void doIdentityIdGenerator(PropertyMeta propertyMeta,
EntityMeta entityMeta) {
propertyMeta.setIdentityIdGenerator(new MockIdentityIdGenerator(entityMeta, propertyMeta));
}
@Override
protected boolean doSequenceIdGenerator(PropertyMeta propertyMeta,
GeneratedValue generatedValue, EntityMeta entityMeta) {
propertyMeta.setSequenceIdGenerator(new MockPreAllocateIdGenerator(entityMeta,
propertyMeta, 1));
return true;
}
@Override
protected boolean doTableIdGenerator(PropertyMeta propertyMeta,
GeneratedValue generatedValue, EntityMeta entityMeta) {
propertyMeta.setTableIdGenerator(new MockPreAllocateIdGenerator(entityMeta,
propertyMeta, 1));
return true;
}
}
| [
"takezoe@gmail.com"
] | takezoe@gmail.com |
885cce70d5199d9e407602aa9e15b418ff8a7b69 | 581d5fd1ff55fef7318f0ceb599dafba8d8a6661 | /SaveNotesApp-master/app/src/androidTest/java/com/apssdc/savenotes/ExampleInstrumentedTest.java | 4d89e46c0cd22d391ac19caf2d9ddfcfa16fd0df | [] | no_license | pallavi1501/notesapp | 8a0d56367fc37080ef380bfef1c81e5c213ef0da | 7ffc582bc825fb74771cef3b239ef143c3860a4a | refs/heads/master | 2023-06-05T21:55:36.992729 | 2021-06-27T14:16:16 | 2021-06-27T14:16:16 | 380,756,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package com.apssdc.savenotes;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.apssdc.savenotes", appContext.getPackageName());
}
} | [
"reddym36@gmail.com"
] | reddym36@gmail.com |
a2518de67c621a59b7afb1fc0dc282166cfa331b | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-cloudformation/src/main/java/com/amazonaws/services/cloudformation/model/DescribeStackResourceDriftsResult.java | f495f75090d64450e6ecfa65f68365d307269915 | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 16,356 | java | /*
* Copyright 2015-2020 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.cloudformation.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResourceDrifts"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeStackResourceDriftsResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* <p>
* Drift information for the resources that have been checked for drift in the specified stack. This includes actual
* and expected configuration values for resources where AWS CloudFormation detects drift.
* </p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has been
* checked for drift. Resources that have not yet been checked for drift are not included. Resources that do not
* currently support drift detection are not checked, and so not included. For a list of resources that support
* drift detection, see <a
* href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
* </p>
*/
private com.amazonaws.internal.SdkInternalList<StackResourceDrift> stackResourceDrifts;
/**
* <p>
* If the request doesn't return all of the remaining results, <code>NextToken</code> is set to a token. To retrieve
* the next set of results, call <code>DescribeStackResourceDrifts</code> again and assign that token to the request
* object's <code>NextToken</code> parameter. If the request returns all results, <code>NextToken</code> is set to
* <code>null</code>.
* </p>
*/
private String nextToken;
/**
* <p>
* Drift information for the resources that have been checked for drift in the specified stack. This includes actual
* and expected configuration values for resources where AWS CloudFormation detects drift.
* </p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has been
* checked for drift. Resources that have not yet been checked for drift are not included. Resources that do not
* currently support drift detection are not checked, and so not included. For a list of resources that support
* drift detection, see <a
* href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
* </p>
*
* @return Drift information for the resources that have been checked for drift in the specified stack. This
* includes actual and expected configuration values for resources where AWS CloudFormation detects
* drift.</p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has
* been checked for drift. Resources that have not yet been checked for drift are not included. Resources
* that do not currently support drift detection are not checked, and so not included. For a list of
* resources that support drift detection, see <a href=
* "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
*/
public java.util.List<StackResourceDrift> getStackResourceDrifts() {
if (stackResourceDrifts == null) {
stackResourceDrifts = new com.amazonaws.internal.SdkInternalList<StackResourceDrift>();
}
return stackResourceDrifts;
}
/**
* <p>
* Drift information for the resources that have been checked for drift in the specified stack. This includes actual
* and expected configuration values for resources where AWS CloudFormation detects drift.
* </p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has been
* checked for drift. Resources that have not yet been checked for drift are not included. Resources that do not
* currently support drift detection are not checked, and so not included. For a list of resources that support
* drift detection, see <a
* href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
* </p>
*
* @param stackResourceDrifts
* Drift information for the resources that have been checked for drift in the specified stack. This includes
* actual and expected configuration values for resources where AWS CloudFormation detects drift.</p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has been
* checked for drift. Resources that have not yet been checked for drift are not included. Resources that do
* not currently support drift detection are not checked, and so not included. For a list of resources that
* support drift detection, see <a href=
* "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
*/
public void setStackResourceDrifts(java.util.Collection<StackResourceDrift> stackResourceDrifts) {
if (stackResourceDrifts == null) {
this.stackResourceDrifts = null;
return;
}
this.stackResourceDrifts = new com.amazonaws.internal.SdkInternalList<StackResourceDrift>(stackResourceDrifts);
}
/**
* <p>
* Drift information for the resources that have been checked for drift in the specified stack. This includes actual
* and expected configuration values for resources where AWS CloudFormation detects drift.
* </p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has been
* checked for drift. Resources that have not yet been checked for drift are not included. Resources that do not
* currently support drift detection are not checked, and so not included. For a list of resources that support
* drift detection, see <a
* href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setStackResourceDrifts(java.util.Collection)} or {@link #withStackResourceDrifts(java.util.Collection)}
* if you want to override the existing values.
* </p>
*
* @param stackResourceDrifts
* Drift information for the resources that have been checked for drift in the specified stack. This includes
* actual and expected configuration values for resources where AWS CloudFormation detects drift.</p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has been
* checked for drift. Resources that have not yet been checked for drift are not included. Resources that do
* not currently support drift detection are not checked, and so not included. For a list of resources that
* support drift detection, see <a href=
* "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DescribeStackResourceDriftsResult withStackResourceDrifts(StackResourceDrift... stackResourceDrifts) {
if (this.stackResourceDrifts == null) {
setStackResourceDrifts(new com.amazonaws.internal.SdkInternalList<StackResourceDrift>(stackResourceDrifts.length));
}
for (StackResourceDrift ele : stackResourceDrifts) {
this.stackResourceDrifts.add(ele);
}
return this;
}
/**
* <p>
* Drift information for the resources that have been checked for drift in the specified stack. This includes actual
* and expected configuration values for resources where AWS CloudFormation detects drift.
* </p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has been
* checked for drift. Resources that have not yet been checked for drift are not included. Resources that do not
* currently support drift detection are not checked, and so not included. For a list of resources that support
* drift detection, see <a
* href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
* </p>
*
* @param stackResourceDrifts
* Drift information for the resources that have been checked for drift in the specified stack. This includes
* actual and expected configuration values for resources where AWS CloudFormation detects drift.</p>
* <p>
* For a given stack, there will be one <code>StackResourceDrift</code> for each stack resource that has been
* checked for drift. Resources that have not yet been checked for drift are not included. Resources that do
* not currently support drift detection are not checked, and so not included. For a list of resources that
* support drift detection, see <a href=
* "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html"
* >Resources that Support Drift Detection</a>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DescribeStackResourceDriftsResult withStackResourceDrifts(java.util.Collection<StackResourceDrift> stackResourceDrifts) {
setStackResourceDrifts(stackResourceDrifts);
return this;
}
/**
* <p>
* If the request doesn't return all of the remaining results, <code>NextToken</code> is set to a token. To retrieve
* the next set of results, call <code>DescribeStackResourceDrifts</code> again and assign that token to the request
* object's <code>NextToken</code> parameter. If the request returns all results, <code>NextToken</code> is set to
* <code>null</code>.
* </p>
*
* @param nextToken
* If the request doesn't return all of the remaining results, <code>NextToken</code> is set to a token. To
* retrieve the next set of results, call <code>DescribeStackResourceDrifts</code> again and assign that
* token to the request object's <code>NextToken</code> parameter. If the request returns all results,
* <code>NextToken</code> is set to <code>null</code>.
*/
public void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
/**
* <p>
* If the request doesn't return all of the remaining results, <code>NextToken</code> is set to a token. To retrieve
* the next set of results, call <code>DescribeStackResourceDrifts</code> again and assign that token to the request
* object's <code>NextToken</code> parameter. If the request returns all results, <code>NextToken</code> is set to
* <code>null</code>.
* </p>
*
* @return If the request doesn't return all of the remaining results, <code>NextToken</code> is set to a token. To
* retrieve the next set of results, call <code>DescribeStackResourceDrifts</code> again and assign that
* token to the request object's <code>NextToken</code> parameter. If the request returns all results,
* <code>NextToken</code> is set to <code>null</code>.
*/
public String getNextToken() {
return this.nextToken;
}
/**
* <p>
* If the request doesn't return all of the remaining results, <code>NextToken</code> is set to a token. To retrieve
* the next set of results, call <code>DescribeStackResourceDrifts</code> again and assign that token to the request
* object's <code>NextToken</code> parameter. If the request returns all results, <code>NextToken</code> is set to
* <code>null</code>.
* </p>
*
* @param nextToken
* If the request doesn't return all of the remaining results, <code>NextToken</code> is set to a token. To
* retrieve the next set of results, call <code>DescribeStackResourceDrifts</code> again and assign that
* token to the request object's <code>NextToken</code> parameter. If the request returns all results,
* <code>NextToken</code> is set to <code>null</code>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DescribeStackResourceDriftsResult withNextToken(String nextToken) {
setNextToken(nextToken);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getStackResourceDrifts() != null)
sb.append("StackResourceDrifts: ").append(getStackResourceDrifts()).append(",");
if (getNextToken() != null)
sb.append("NextToken: ").append(getNextToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DescribeStackResourceDriftsResult == false)
return false;
DescribeStackResourceDriftsResult other = (DescribeStackResourceDriftsResult) obj;
if (other.getStackResourceDrifts() == null ^ this.getStackResourceDrifts() == null)
return false;
if (other.getStackResourceDrifts() != null && other.getStackResourceDrifts().equals(this.getStackResourceDrifts()) == false)
return false;
if (other.getNextToken() == null ^ this.getNextToken() == null)
return false;
if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getStackResourceDrifts() == null) ? 0 : getStackResourceDrifts().hashCode());
hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
return hashCode;
}
@Override
public DescribeStackResourceDriftsResult clone() {
try {
return (DescribeStackResourceDriftsResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
853d328955b5459c047027ad59ca106ce550e592 | 786f338203631c7557fab24ab02f0fd3c1c2597e | /floj-core/src/main/java/org/floj/core/MessageSerializer.java | 7f09ef380f9ccf7f02e37e1d099a012c6cab0eaa | [
"Apache-2.0"
] | permissive | floj-org/floj | 818aaa7946742a5312b375fda2603b45ed659582 | f9397e1ad83ebb950e7bc869aa2910ffd3018bb5 | refs/heads/master | 2020-03-23T00:29:36.655039 | 2018-07-18T17:57:47 | 2018-07-18T17:57:47 | 140,866,820 | 1 | 2 | Apache-2.0 | 2018-07-18T17:57:48 | 2018-07-13T15:57:24 | Java | UTF-8 | Java | false | false | 7,188 | java | /*
* Copyright 2011 Google Inc.
* Copyright 2014 Andreas Schildbach
* Copyright 2018 DeSoto Inc
* Copyright 2015 Ross Nicoll
*
* 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.floj.core;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
/**
* Generic interface for classes which serialize/deserialize messages. Implementing
* classes should be immutable.
*/
public abstract class MessageSerializer {
/**
* Reads a message from the given ByteBuffer and returns it.
*/
public abstract Message deserialize(ByteBuffer in) throws ProtocolException, IOException, UnsupportedOperationException;
/**
* Deserializes only the header in case packet meta data is needed before decoding
* the payload. This method assumes you have already called seekPastMagicBytes()
*/
public abstract FLOSerializer.FLOPacketHeader deserializeHeader(ByteBuffer in) throws ProtocolException, IOException, UnsupportedOperationException;
/**
* Deserialize payload only. You must provide a header, typically obtained by calling
* {@link FLOSerializer#deserializeHeader}.
*/
public abstract Message deserializePayload(FLOSerializer.FLOPacketHeader header, ByteBuffer in) throws ProtocolException, BufferUnderflowException, UnsupportedOperationException;
/**
* Whether the serializer will produce cached mode Messages
*/
public abstract boolean isParseRetainMode();
/**
* Make an address message from the payload. Extension point for alternative
* serialization format support.
*/
public abstract AddressMessage makeAddressMessage(byte[] payloadBytes, int length) throws ProtocolException, UnsupportedOperationException;
/**
* Make an alert message from the payload. Extension point for alternative
* serialization format support.
*/
public abstract Message makeAlertMessage(byte[] payloadBytes) throws ProtocolException, UnsupportedOperationException;
/**
* Make a block from the payload, using an offset of zero and the payload
* length as block length.
*/
public final Block makeBlock(byte[] payloadBytes) throws ProtocolException {
return makeBlock(payloadBytes, 0, payloadBytes.length);
}
/**
* Make a block from the payload, using an offset of zero and the provided
* length as block length.
*/
public final Block makeBlock(byte[] payloadBytes, int length) throws ProtocolException {
return makeBlock(payloadBytes, 0, length);
}
/**
* Make a block from the payload, using an offset of zero and the provided
* length as block length. Extension point for alternative
* serialization format support.
*/
public abstract Block makeBlock(final byte[] payloadBytes, final int offset, final int length) throws ProtocolException, UnsupportedOperationException;
/**
* Make an filter message from the payload. Extension point for alternative
* serialization format support.
*/
public abstract Message makeBloomFilter(byte[] payloadBytes) throws ProtocolException, UnsupportedOperationException;
/**
* Make a filtered block from the payload. Extension point for alternative
* serialization format support.
*/
public abstract FilteredBlock makeFilteredBlock(byte[] payloadBytes) throws ProtocolException, UnsupportedOperationException;
/**
* Make an inventory message from the payload. Extension point for alternative
* serialization format support.
*/
public abstract InventoryMessage makeInventoryMessage(byte[] payloadBytes, int length) throws ProtocolException, UnsupportedOperationException;
/**
* Make a transaction from the payload. Extension point for alternative
* serialization format support.
*
* @throws UnsupportedOperationException if this serializer/deserializer
* does not support deserialization. This can occur either because it's a dummy
* serializer (i.e. for messages with no network parameters), or because
* it does not support deserializing transactions.
*/
public abstract Transaction makeTransaction(byte[] payloadBytes, int offset, int length, byte[] hash) throws ProtocolException, UnsupportedOperationException;
/**
* Make a transaction from the payload. Extension point for alternative
* serialization format support.
*
* @throws UnsupportedOperationException if this serializer/deserializer
* does not support deserialization. This can occur either because it's a dummy
* serializer (i.e. for messages with no network parameters), or because
* it does not support deserializing transactions.
*/
public final Transaction makeTransaction(byte[] payloadBytes) throws ProtocolException, UnsupportedOperationException {
return makeTransaction(payloadBytes, 0);
}
/**
* Make a transaction from the payload. Extension point for alternative
* serialization format support.
*
* @throws UnsupportedOperationException if this serializer/deserializer
* does not support deserialization. This can occur either because it's a dummy
* serializer (i.e. for messages with no network parameters), or because
* it does not support deserializing transactions.
*/
public final Transaction makeTransaction(byte[] payloadBytes, int offset) throws ProtocolException {
return makeTransaction(payloadBytes, offset, payloadBytes.length, null);
}
public abstract void seekPastMagicBytes(ByteBuffer in) throws BufferUnderflowException;
/**
* Writes message to to the output stream.
*
* @throws UnsupportedOperationException if this serializer/deserializer
* does not support serialization. This can occur either because it's a dummy
* serializer (i.e. for messages with no network parameters), or because
* it does not support serializing the given message.
*/
public abstract void serialize(String name, byte[] message, OutputStream out) throws IOException, UnsupportedOperationException;
/**
* Writes message to to the output stream.
*
* @throws UnsupportedOperationException if this serializer/deserializer
* does not support serialization. This can occur either because it's a dummy
* serializer (i.e. for messages with no network parameters), or because
* it does not support serializing the given message.
*/
public abstract void serialize(Message message, OutputStream out) throws IOException, UnsupportedOperationException;
}
| [
"ray_engelking@hotmail.com"
] | ray_engelking@hotmail.com |
ce17e6204e2b2fb8bfec8f379ea998b3fcb88dd2 | b6caa29673194ece2652030a384e65a07bc74f66 | /ActivityDialog/app/src/test/java/com/mrdiaz/activitydialog/ExampleUnitTest.java | 16a6460e4872fc3ce5a23784485c677187ee392e | [] | no_license | ManuelRamallo/androidStudioMiguel | 6ea3cb61c9050ccea697fa542faa5252e357241a | 455e0cdecf73a578073e098d9004a33ca2a3007b | refs/heads/master | 2021-05-12T00:03:51.518682 | 2018-02-23T12:17:09 | 2018-02-23T12:17:09 | 117,524,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.mrdiaz.activitydialog;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"mramallodiaz96@gmail.com"
] | mramallodiaz96@gmail.com |
18cc1c110a91dc3957459ac9674b389a0ba13bf0 | b36240549b59ada0fdb1d91b113c2933d5248922 | /src/com/chan/academy/study/test/Test_GBB.java | 2972b8c6a02a0043a58c95922b53297369a1d902 | [] | no_license | ChoiBitChan/BChan | 85ccd94f3e39d3741005a16ca007dd9a0269d60a | 00b48123dc698ffbcc3ad82ae624bc820f578fca | refs/heads/master | 2020-06-30T15:40:58.379932 | 2016-12-09T12:28:20 | 2016-12-09T12:28:20 | 74,360,130 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 2,273 | java | package com.chan.academy.study.test;
import java.util.Scanner;
public class Test_GBB {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("[1.가위] [2.바위] [3.보] 중에 입력해주세요.");
// 1.가위 2.바위 3.보
// System.out.println(me);
//left ~ right -> right-left+1
int i=0;
int result = 0;
for(i=0;i<5;i++){
int me = sc.nextInt();
int com = (int) (Math.random() * 3) + 1;
System.out.println(i+1+"번째 대결\n");
if (me == 1){
System.out.println("당신은 가위를 냈습니다.");
if(com == 3){
System.out.println("컴퓨터는 보를 냈습니다.");
System.out.println("이겼습니다");
result++;
} else if(com == 2){
System.out.println("컴퓨터는 바위를 냈습니다.");
System.out.println("졌습니다");
} else if(com == 1){
System.out.println("컴퓨터는 가위를 냈습니다.");
System.out.println("비겼습니다");
}
} else if (me == 2){
System.out.println("당신은 바위를 냈습니다.");
if(com == 1){
System.out.println("컴퓨터는 가위를 냈습니다.");
System.out.println("이겼습니다");
result++;
} else if(com == 3){
System.out.println("컴퓨터는 보를 냈습니다.");
System.out.println("졌습니다");
} else if(com == 2){
System.out.println("컴퓨터는 바위를 냈습니다.");
System.out.println("비겼습니다");
}
} else if (me == 3){
System.out.println("당신은 보를 냈습니다.");
if(com == 2){
System.out.println("컴퓨터는 바위를 냈습니다.");
System.out.println("이겼습니다");
result++;
} else if(com == 1){
System.out.println("컴퓨터는 가위를 냈습니다.");
System.out.println("졌습니다");
} else if(com == 3){
System.out.println("컴퓨터는 보를 냈습니다.");
System.out.println("비겼습니다");
}
} else {
System.out.println("입력값 오류");
}
}
System.out.println("\n총 "+result+"번 이겼습니다.");
System.out.println("승률은 "+(100/5)*result+"% 입니다.");
}
}
| [
"lucete1104@gmail.com"
] | lucete1104@gmail.com |
5ed51a321e2661a7bb1ad3d929184e0cf4d00682 | 3185f7e0bc58662920ac47a1772f433205c7bbca | /panel form/ScheduleCreate.java | 85283c34ff4ab234c0ffa1837f51e161e71b3c26 | [] | no_license | jin123hui/Group-3.1-Bus-Ticketing-System | 19e5a8a2efda19334a8d54803eb75f8496b330ec | 079b18a2498570bf89e531c0924d0c72b3b66507 | refs/heads/master | 2020-07-17T09:39:49.635112 | 2016-12-25T15:08:34 | 2016-12-25T15:08:34 | 73,932,646 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,437 | 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 ui;
import java.util.Date;
/**
*
* @author JianHow
*/
public class ScheduleCreate extends javax.swing.JPanel {
/**
* Creates new form ScheduleCreate
*/
public ScheduleCreate() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
scheduleIDField = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
departureDate = new com.toedter.calendar.JDateChooser();
jLabel4 = new javax.swing.JLabel();
jComboBox2 = new javax.swing.JComboBox();
jPanel2 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
driverList1 = new javax.swing.JTable();
jPanel3 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
busList1 = new javax.swing.JTable();
next = new javax.swing.JButton();
cancel = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
jTextPane1 = new javax.swing.JTextPane();
setMaximumSize(new java.awt.Dimension(671, 472));
setMinimumSize(new java.awt.Dimension(671, 472));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true), "Schedule Info", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Fax", 1, 18))); // NOI18N
jLabel1.setFont(new java.awt.Font("Lucida Fax", 1, 14)); // NOI18N
jLabel1.setText("Schedule ID :");
scheduleIDField.setEditable(false);
scheduleIDField.setFont(new java.awt.Font("Lucida Fax", 0, 13)); // NOI18N
jLabel2.setFont(new java.awt.Font("Lucida Fax", 1, 14)); // NOI18N
jLabel2.setText("Destination :");
jComboBox1.setFont(new java.awt.Font("Lucida Fax", 0, 13)); // NOI18N
jLabel3.setFont(new java.awt.Font("Lucida Fax", 1, 14)); // NOI18N
jLabel3.setText("Departure Date : ");
departureDate.setDateFormatString("dd/MM/yyyy");
departureDate.setMinSelectableDate(new Date());
jLabel4.setFont(new java.awt.Font("Lucida Fax", 1, 14)); // NOI18N
jLabel4.setText("Departure Time : ");
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "8:00:00", "10:00:00", "12:00:00", "14:00:00", "16:00:00", "18:00:00", "20:00:00", "22:00:00" }));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3))
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scheduleIDField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(departureDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(48, 48, 48))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(scheduleIDField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(departureDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(43, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true), "Driver Info", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Fax", 1, 18))); // NOI18N
driverList1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"No", "Driver ID", "Driver Name"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane2.setViewportView(driverList1);
if (driverList1.getColumnModel().getColumnCount() > 0) {
driverList1.getColumnModel().getColumn(0).setResizable(false);
driverList1.getColumnModel().getColumn(1).setResizable(false);
driverList1.getColumnModel().getColumn(2).setResizable(false);
}
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
.addContainerGap())
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true), "Bus Info", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Fax", 1, 18))); // NOI18N
busList1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"No", "Bus ID", "Plate No", "Capacity"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(busList1);
if (busList1.getColumnModel().getColumnCount() > 0) {
busList1.getColumnModel().getColumn(0).setResizable(false);
busList1.getColumnModel().getColumn(1).setResizable(false);
busList1.getColumnModel().getColumn(2).setResizable(false);
busList1.getColumnModel().getColumn(3).setResizable(false);
}
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 285, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addContainerGap())
);
next.setFont(new java.awt.Font("Lucida Fax", 1, 13)); // NOI18N
next.setText("Next");
cancel.setFont(new java.awt.Font("Lucida Fax", 1, 13)); // NOI18N
cancel.setText("Cancel");
jTextPane1.setEditable(false);
jTextPane1.setBackground(new java.awt.Color(240, 240, 240));
jScrollPane3.setViewportView(jTextPane1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(362, 362, 362)
.addComponent(cancel)
.addGap(51, 51, 51)
.addComponent(next, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(24, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancel)
.addComponent(next))
.addGap(30, 30, 30))
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTable busList1;
private javax.swing.JButton cancel;
private com.toedter.calendar.JDateChooser departureDate;
private javax.swing.JTable driverList1;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JComboBox jComboBox2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTextPane jTextPane1;
private javax.swing.JButton next;
private javax.swing.JTextField scheduleIDField;
// End of variables declaration//GEN-END:variables
}
| [
"jinhui96@hotmail.com"
] | jinhui96@hotmail.com |
726cbbd8b6605b5b6040b44f2b829ca884605c45 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-imagebuilder/src/main/java/com/amazonaws/services/imagebuilder/model/transform/ComponentVersionJsonUnmarshaller.java | 62528103f8049507d03ee508c201fc288c668636 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 4,722 | java | /*
* Copyright 2017-2022 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.imagebuilder.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.imagebuilder.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* ComponentVersion JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ComponentVersionJsonUnmarshaller implements Unmarshaller<ComponentVersion, JsonUnmarshallerContext> {
public ComponentVersion unmarshall(JsonUnmarshallerContext context) throws Exception {
ComponentVersion componentVersion = new ComponentVersion();
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 null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("arn", targetDepth)) {
context.nextToken();
componentVersion.setArn(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("name", targetDepth)) {
context.nextToken();
componentVersion.setName(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("version", targetDepth)) {
context.nextToken();
componentVersion.setVersion(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("description", targetDepth)) {
context.nextToken();
componentVersion.setDescription(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("platform", targetDepth)) {
context.nextToken();
componentVersion.setPlatform(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("supportedOsVersions", targetDepth)) {
context.nextToken();
componentVersion.setSupportedOsVersions(new ListUnmarshaller<String>(context.getUnmarshaller(String.class))
.unmarshall(context));
}
if (context.testExpression("type", targetDepth)) {
context.nextToken();
componentVersion.setType(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("owner", targetDepth)) {
context.nextToken();
componentVersion.setOwner(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("dateCreated", targetDepth)) {
context.nextToken();
componentVersion.setDateCreated(context.getUnmarshaller(String.class).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 componentVersion;
}
private static ComponentVersionJsonUnmarshaller instance;
public static ComponentVersionJsonUnmarshaller getInstance() {
if (instance == null)
instance = new ComponentVersionJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
88ccfda7e499a6a1dd845c33f51421525c5c4165 | 5f78f69e4bd2ccd7a9165df7962b890234425ddf | /FilsPilota/src/com/company/UsoThreads.java | c7a4f6d335ca53d39ad2b0b65c006c405e4fe03a | [] | no_license | tito-berny/IntelliJ-IDEA-Projectes | 270cd8ef56a83ec19332cf7c7629133bd11f2e4e | ead8a832f7f6ac709acc952a5083a5495bf50119 | refs/heads/master | 2018-09-20T04:22:45.357882 | 2018-06-12T19:17:31 | 2018-06-12T19:17:31 | 105,168,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,027 | java | package com.company;
import java.awt.geom.*;
import javax.swing.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Crea un nuevo marco
JFrame marco=new MarcoRebote();
//Asigna la ventana
marco.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Inicializa la ventana
marco.setVisible(true);
}
}
//Movimiento de la pelota-----------------------------------------------------------------------------------------
class Pelota{
// Mueve la pelota invirtiendo posici�n si choca con l�mites
public void mueve_pelota(Rectangle2D limites){
x+=dx;
y+=dy;
if(x<limites.getMinX()){
x=limites.getMinX();
dx=-dx;
}
if(x + TAMX>=limites.getMaxX()){
x=limites.getMaxX() - TAMX;
dx=-dx;
}
if(y<limites.getMinY()){
y=limites.getMinY();
dy=-dy;
}
if(y + TAMY>=limites.getMaxY()){
y=limites.getMaxY()-TAMY;
dy=-dy;
}
}
//Forma de la pelota en su posicion inicial
public Ellipse2D getShape(){
return new Ellipse2D.Double(x,y,TAMX,TAMY);
}
private static final int TAMX=15;
private static final int TAMY=15;
private double x=0;
private double y=0;
private double dx=1;
private double dy=1;
}
// Lamina que dibuja las pelotas----------------------------------------------------------------------
class LaminaPelota extends JPanel{
//A�adimos pelota a la l�mina
public void add(Pelota b){
pelotas.add(b);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2=(Graphics2D)g;
for(Pelota b: pelotas){
g2.fill(b.getShape());
}
}
private ArrayList<Pelota> pelotas=new ArrayList<Pelota>();
}
class Pelotahilos implements Runnable{
//CONSTRUCTOR
public Pelotahilos (Pelota unaPelota, Component unComponent){
pelota = unaPelota;
componente = unComponent;
}
private Pelota pelota;
private Component componente;
//METODO RUN
@Override
public void run() {
//Thread.interrupted debuelve un boolean si esta o no interrumpido el hilo
System.out.println("Stode del hilo al comnzar " + Thread.interrupted());
//Bucle para el movimiento de la pelota sera infinito
//TODO SI EL HILO NO ESTA INTERRUMPIDO
while (!Thread.currentThread().isInterrupted()){
pelota.mueve_pelota(componente.getBounds());
//Necesitamos usar try catch para sleep
try {
Thread.sleep(4);
} catch (InterruptedException e) {
//e.printStackTrace();
//TODO IMPORTANTE DETIENE EL HILO en un catch por el sleep
//Cuando salta la exepcion al no poder detener un hilo bloqueado por sleep
//En la exepcion interrumpimos el hilo
Thread.currentThread().interrupt();
//System.out.println("Hilo bloqueado imposible su interrupcion");
}
componente.paint(componente.getGraphics());
}
System.out.println("Stado del hilo al finaizar " + Thread.interrupted());
}
}
//Marco con lamina y botones------------------------------------------------------------------------------
class MarcoRebote extends JFrame{
private LaminaPelota lamina;
//Declaramos variables t y botones para que sea accesibe desde cualquier metodo todos los hilos
private static Thread t1,t2,t3;
public static JButton arranca1, arranca2,arranca3, detener1, detener2, detener3;
public MarcoRebote(){
setBounds(600,300,600,350);
setTitle ("Rebotes");
lamina=new LaminaPelota();
add(lamina, BorderLayout.CENTER);
JPanel laminaBotones=new JPanel();
//-------------------------BOTONES PARA INICIAR CADA HILO-------------------------
//BOTON1
arranca1= new JButton("hilo1");
arranca1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
comienza_el_juego(e);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
});
laminaBotones.add(arranca1);
//BOTON2
arranca2= new JButton("hilo2");
arranca2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
comienza_el_juego(e);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
});
laminaBotones.add(arranca2);
//BOTON3
arranca3= new JButton("hilo3");
arranca3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
comienza_el_juego(e);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
});
laminaBotones.add(arranca3);
//-------------------------BOTONES PARA DETENER CADA HILO-------------------------
//BOTON DETENER 1
detener1= new JButton("detener1");
detener1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
detener(e);
}
});
laminaBotones.add(detener1);
//BOTON DETENER 2
detener2= new JButton("detener2");
detener2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
detener(e);
}
});
laminaBotones.add(detener2);
//BOTON DETENER 3
detener3= new JButton("detener3");
detener3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
detener(e);
}
});
laminaBotones.add(detener3);
add(laminaBotones, BorderLayout.SOUTH);
}
//Ponemos botones
public void ponerBoton(Container c, String titulo, ActionListener oyente){
JButton boton=new JButton(titulo);
c.add(boton);
boton.addActionListener(oyente);
}
//Añade pelota y la bota 1000 veces
public void comienza_el_juego (ActionEvent e) throws InterruptedException {
Pelota pelota=new Pelota();
lamina.add(pelota);
//Instanciamos la clase
Runnable r = new Pelotahilos(pelota,lamina);
//Thread t = new Thread(r);
//Dependiendo de que boton hemos pulsado se inicia un hilo o otro
if (e.getSource().equals(arranca1)){
t1 = new Thread(r);
t1.start();
}else if (e.getSource().equals(arranca2)){
t2 = new Thread(r);
t2.start();
}else if (e.getSource().equals(arranca3)){
t3 = new Thread(r);
t3.start();
}
}
/**
* Detiene un hilo cuando le damos al boton detener
*/
public void detener(ActionEvent e){
//Dependiendo de que boton de detener pulsemos detienee un hilo o otro
if(e.getSource().equals(detener1)){
//Interrumpimos el hilo en ejecucion
t1.interrupt();
}else if(e.getSource().equals(detener2)){
t2.interrupt();
}else if(e.getSource().equals(detener3)){
t3.interrupt();
}
//Detiene el hilo pero esta obsoleto
//t.stop();
}
}
| [
"berny_tito@hotmail.com"
] | berny_tito@hotmail.com |
536c88c16edc3a721fe4e883dbb4a27c644ca1bc | 68bffe1a67331fcb82cd151ab83ef57af8c34f7f | /src/main/java/com/alibaba/fastjson/serializer/FloatCodec.java | 4d84cf6b36e539c066eb6cccc709617e9c919cbe | [
"Apache-2.0"
] | permissive | zhanjindong/fastjson-1.1.41 | 5dfaaf352761c292dfe610e015520d54f958dd0c | 23ddd0d806b80f83e53d0a24990dd91435442ba7 | refs/heads/master | 2021-01-10T18:38:27.833125 | 2014-10-21T11:30:35 | 2014-10-21T11:30:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,315 | java | /*
* Copyright 1999-2101 Alibaba Group.
*
* 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.alibaba.fastjson.serializer;
import java.io.IOException;
import java.lang.reflect.Type;
import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.JSONLexer;
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import com.alibaba.fastjson.util.TypeUtils;
/**
* @author wenshao<szujobs@hotmail.com>
*/
public class FloatCodec implements ObjectSerializer, ObjectDeserializer {
public static FloatCodec instance = new FloatCodec();
public void write(JSONSerializer serializer, FieldSerializer parentFieldSerializer, Object object, Object fieldName, Type fieldType) throws IOException {
SerializeWriter out = serializer.getWriter();
if (object == null) {
if (serializer.isEnabled(SerializerFeature.WriteNullNumberAsZero)) {
out.write('0');
} else {
out.writeNull();
}
return;
}
float floatValue = ((Float) object).floatValue();
if (Float.isNaN(floatValue)) {
out.writeNull();
} else if (Float.isInfinite(floatValue)) {
out.writeNull();
} else {
String floatText= Float.toString(floatValue);
if (floatText.endsWith(".0")) {
floatText = floatText.substring(0, floatText.length() - 2);
}
out.write(floatText);
if (serializer.isEnabled(SerializerFeature.WriteClassName)) {
out.write('F');
}
}
}
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
return (T) deserialze(parser);
}
@SuppressWarnings("unchecked")
public static <T> T deserialze(DefaultJSONParser parser) {
final JSONLexer lexer = parser.getLexer();
if (lexer.token() == JSONToken.LITERAL_INT) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
return (T) Float.valueOf(Float.parseFloat(val));
}
if (lexer.token() == JSONToken.LITERAL_FLOAT) {
float val = lexer.floatValue();
lexer.nextToken(JSONToken.COMMA);
return (T) Float.valueOf(val);
}
Object value = parser.parse();
if (value == null) {
return null;
}
return (T) TypeUtils.castToFloat(value);
}
public int getFastMatchToken() {
return JSONToken.LITERAL_INT;
}
}
| [
"zhanjindong1989@qq.com"
] | zhanjindong1989@qq.com |
2a84c0c4e5c961af616f68a77eff1133c2a46cd1 | 21b94610ab6c20afa3a9fc811d1fb049f0dab8d2 | /poc-d-accountquery/src/main/java/com/citibanamex/bne/poc-d-accountquery/errorhandling/ErrorResolver.java | a38e5931ba0ffcbb489dc81428e34fb55095a31c | [] | no_license | EduardoPazSC/bancaDelFuturo | df17da04511b1de263207da062929884b134464a | 52770f1dc2a184e79fea70dc942cb4e9e791a218 | refs/heads/master | 2021-04-09T13:24:43.595631 | 2018-03-17T01:34:44 | 2018-03-17T01:34:44 | 125,583,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,612 | java | package com.citibanamex.bne.poc-d-accountquery.errorhandling;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import com.citibanamex.bne.poc-d-accountquery.errorhandling.exception.MicroserviceClientException;
@ControllerAdvice
public class ErrorResolver {
private final Logger logger = LoggerFactory.getLogger(ErrorResolver.class);
public static final String HTTPMESSAGENOTREADABLEEXCEPTION_ERROR_CODE = "BNEE-430";
public static final String METHODARGUMENTNOTVALIDEXCEPTION_ERROR_CODE = "BNEE-431";
public static final String CONSTRAINTVIOLATIONEXCEPTION_ERROR_CODE = "BNEE-432";
public static final String EXCEPTION_ERROR_CODE = "BNEE-500";
public static final String MICROSERVICE_CLIENT_ERROR_CODE = "BNEE-530";
public static final String GENERIC_ERROR_DESC = "Something went wrong! Further details may be available in logs.";
public static final String GENERIC_FAILURE_DESC = "See error description at the corresponding catalog.";
@ExceptionHandler(HttpMessageNotReadableException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public @ResponseBody ErrorResponse resolveHttpMessageNotReadableException(HttpServletRequest req, HttpMessageNotReadableException e) {
logger.error(e.getMessage(), e);
ErrorResponse errorResponse = new ErrorResponse();
String message = e.getMessage();
int index = message.indexOf(':');
message = (index != -1) ? message.substring(0, index) : GENERIC_ERROR_DESC;
errorResponse.setType(ErrorType.INVALID.name());
errorResponse.setCode(HTTPMESSAGENOTREADABLEEXCEPTION_ERROR_CODE);
errorResponse.setDetails(message);
return errorResponse;
}
@ExceptionHandler(ConstraintViolationException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public @ResponseBody ErrorResponse resolveConstraintViolation(HttpServletRequest req, ConstraintViolationException e){
logger.debug(e.getMessage(), e);
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setType(ErrorType.INVALID.name());
errorResponse.setCode(CONSTRAINTVIOLATIONEXCEPTION_ERROR_CODE);
Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
int i=1;
StringBuilder messaggeBuilder = new StringBuilder();
for (ConstraintViolation<?> violation : violations ) {
String description = "Test: "+violation.getConstraintDescriptor().getAttributes().toString();
logger.debug(description);
if(i<violations.size()){
messaggeBuilder.append(violation.getMessage() + ",");
}else{
messaggeBuilder.append(violation.getMessage());
}
i++;
}
errorResponse.setDetails(messaggeBuilder.toString());
return errorResponse;
}
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public @ResponseBody ErrorResponse resolveMethodArgumentNotValidException(HttpServletRequest req, MethodArgumentNotValidException e) {
logger.error(e.getMessage(), e);
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setType(ErrorType.INVALID.name());
errorResponse.setCode(METHODARGUMENTNOTVALIDEXCEPTION_ERROR_CODE);
Map<String, List<String>> groupedErrors = new HashMap<>();
List<String> fields = new ArrayList<>();
List<FieldError> fieldErrors = e.getBindingResult().getFieldErrors();
for (FieldError fieldError : fieldErrors) {
String message = fieldError.getDefaultMessage();
String field = fieldError.getField();
List<String> fieldsByMessage = groupedErrors.get(message);
if (fieldsByMessage == null) {
fieldsByMessage = new ArrayList<>();
groupedErrors.put(message, fieldsByMessage);
}
fieldsByMessage.add(field);
fields.add(field);
}
if (!groupedErrors.isEmpty()) {
errorResponse.setDetails(groupedErrors.toString());
}
errorResponse.setLocation(fields.toString());
return errorResponse;
}
@ExceptionHandler(MicroserviceClientException.class)
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public ErrorResponse resolveBadRequestFeignException(HttpServletRequest req, MicroserviceClientException e) {
logger.error(e.getMessage(), e);
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setType(ErrorType.ERROR.name());
errorResponse.setCode(ErrorResolver.MICROSERVICE_CLIENT_ERROR_CODE);
errorResponse.setDetails(GENERIC_ERROR_DESC);
return errorResponse;
}
@ExceptionHandler(Exception.class)
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ErrorResponse resolveException(HttpServletRequest req, Exception e) {
logger.error(e.getMessage(), e);
ErrorResponse errorResponse = new ErrorResponse();
errorResponse.setType(ErrorType.FATAL.name());
errorResponse.setCode(EXCEPTION_ERROR_CODE);
errorResponse.setDetails(GENERIC_ERROR_DESC);
return errorResponse;
}
}
| [
"eduardopaztellez@gmail.com"
] | eduardopaztellez@gmail.com |
8a196805898ab13452cc717757db3a3c863c0f7f | 96d1336c0086a2acc53ed41eca5604d66962d13a | /src/com/interview/hackerrank/basicPractice/CompareString.java | 32a1ba2e2c0c49b04c28065ed39130a3adf08d65 | [
"Apache-2.0"
] | permissive | prdp89/interview | 990e052d6bba5d2555a7b549d5bb5a12a92121ef | 04424ec1f13b0d1555382090d35c394b99a3a24b | refs/heads/master | 2022-12-27T16:44:41.690209 | 2020-09-30T13:21:44 | 2020-09-30T13:21:44 | 109,804,931 | 1 | 1 | null | 2017-11-07T08:05:26 | 2017-11-07T08:05:25 | null | UTF-8 | Java | false | false | 825 | java | package com.interview.hackerrank.basicPractice;
import java.util.Arrays;
import java.util.Scanner;
public class CompareString {
private static void solve() {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-- > 0) {
String s1 = scanner.next();
String s2 = scanner.next();
char[] c1 = s1.toCharArray();
char[] c2 = s2.toCharArray();
Arrays.sort(c1);
Arrays.sort(c2);
String s3 = new String(c1);
String s4 = new String(c2);
if (s3.equals(s4)) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
public static void main( String[] args ) {
solve();
}
}
| [
"pardeepsharma.dev@gmail.com"
] | pardeepsharma.dev@gmail.com |
496dfd52d0419130af111c53571fe6d940154e01 | f705ebdebebbfa681292e2d6b38c896503a255bb | /src/main/java/com/demo/bookstore/config/JwtAuthenticationEntryPoint.java | 2d3bec62336ba8bc99323d3b35490227029495d6 | [] | no_license | Deepongpat/Bookstore | e8ed99ce80cf31f56c1ec83556949e557bb2bda2 | 344fd94c90994a7673d94853549f4a007a17c489 | refs/heads/master | 2020-08-08T04:05:10.480231 | 2019-10-15T00:22:32 | 2019-10-15T00:22:32 | 213,706,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.demo.bookstore.config;
import java.io.IOException;
import java.io.Serializable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
@Component
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint, Serializable {
private static final long serialVersionUID = -7858869558953243875L;
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
}
}
| [
"whpongpat@gmail.com"
] | whpongpat@gmail.com |
dd9f8be0f3c72944733451b3f94b433dae10dd84 | 375ea1ee86b42b12acd3f6bf8c11fd7c4fa5650e | /neso-sample/src/main/java/org/neso/sample/chapter5/externe/Account.java | 0a29429a1d174a74b77d69bb4e4efdd08e6f6ef2 | [
"MIT"
] | permissive | kim-cci/neso | 2626b3b10642152e703edabcd6ebdfdd28303c7d | b48a473fc1cbe4eb0ddb6f18294f2713570bc42f | refs/heads/master | 2021-07-05T02:44:03.219423 | 2020-12-07T16:11:05 | 2020-12-07T16:11:05 | 241,273,240 | 0 | 2 | null | 2021-06-07T18:41:21 | 2020-02-18T04:36:38 | Java | UTF-8 | Java | false | false | 145 | java | package org.neso.sample.chapter5.externe;
import lombok.Data;
@Data
public class Account {
private String ownerName;
private int balance;
}
| [
"jronin@daum.net"
] | jronin@daum.net |
19167380718ca4a8570a7f9b3d2238d988a3a63f | 41738b1d2d552e04e3f0dd6dbc6297732eee7271 | /src/test/java/ru/job4j/collection/SimpleLinkedListTest.java | 056c91476f7c70f98fcb9d79f632a5c46d65f760 | [] | no_license | fedorovse/job4j_design | 128acf958e793f786d6b62fca95d0fb3b8f7a27f | 0088c24aba2ba993af0fc5acefaafd708ca78411 | refs/heads/master | 2023-08-24T10:24:01.332769 | 2023-08-15T12:50:02 | 2023-08-15T12:50:02 | 263,678,994 | 0 | 0 | null | 2020-10-13T21:58:24 | 2020-05-13T16:05:30 | Java | UTF-8 | Java | false | false | 3,487 | java | package ru.job4j.collection;
import org.hamcrest.core.Is;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.NoSuchElementException;
public class SimpleLinkedListTest {
@Test
public void whenAddAndGet() {
LinkedList<Integer> list = new SimpleLinkedList<>();
list.add(1);
list.add(2);
list.add(3);
list.add(4);
assertThat(list.get(0), Is.is(1));
assertThat(list.get(1), Is.is(2));
assertThat(list.get(2), Is.is(3));
assertThat(list.get(3), Is.is(4));
}
@Test(expected = IndexOutOfBoundsException.class)
public void whenGetFromOutOfBoundThenExceptionThrown() {
LinkedList<Integer> list = new SimpleLinkedList<>();
list.add(1);
list.add(2);
list.get(2);
}
@Test
public void whenAddIterHasNextTrue() {
LinkedList<Integer> list = new SimpleLinkedList<>();
list.add(1);
Iterator<Integer> it = list.iterator();
assertThat(it.hasNext(), Is.is(true));
}
@Test
public void whenAddIterNextOne() {
LinkedList<Integer> list = new SimpleLinkedList<>();
list.add(1);
Iterator<Integer> it = list.iterator();
assertThat(it.next(), Is.is(1));
}
@Test
public void whenEmptyIterHashNextFalse() {
LinkedList<Integer> list = new SimpleLinkedList<>();
Iterator<Integer> it = list.iterator();
assertThat(it.hasNext(), Is.is(false));
}
@Test(expected = NoSuchElementException.class)
public void whenEmptyIterNextThenNoSuchElementException() {
LinkedList<Integer> list = new SimpleLinkedList<>();
Iterator<Integer> it = list.iterator();
it.next();
}
@Test(expected = ConcurrentModificationException.class)
public void whenIterAndModificationThenConcurrentModificationException() {
LinkedList<Integer> list = new SimpleLinkedList<>();
Iterator<Integer> it = list.iterator();
list.add(2);
it.next();
}
@Test
public void whenAddIterMultiHasNextTrue() {
LinkedList<Integer> list = new SimpleLinkedList<>();
list.add(1);
Iterator<Integer> it = list.iterator();
assertThat(it.hasNext(), Is.is(true));
assertThat(it.hasNext(), Is.is(true));
}
@Test
public void whenAddIterNextOneNextTwo() {
LinkedList<Integer> list = new SimpleLinkedList<>();
list.add(1);
list.add(2);
Iterator<Integer> it = list.iterator();
assertThat(it.next(), Is.is(1));
assertThat(it.next(), Is.is(2));
}
@Test
public void whenGetIteratorTwiceThenEveryFromBegin() {
LinkedList<Integer> list = new SimpleLinkedList<>();
list.add(1);
list.add(2);
Iterator<Integer> first = list.iterator();
assertThat(first.hasNext(), Is.is(true));
assertThat(first.next(), Is.is(1));
assertThat(first.hasNext(), Is.is(true));
assertThat(first.next(), Is.is(2));
assertThat(first.hasNext(), Is.is(false));
Iterator<Integer> second = list.iterator();
assertThat(second.hasNext(), Is.is(true));
assertThat(second.next(), Is.is(1));
assertThat(second.hasNext(), Is.is(true));
assertThat(second.next(), Is.is(2));
assertThat(second.hasNext(), Is.is(false));
}
} | [
"ingor-ru@mail.ru"
] | ingor-ru@mail.ru |
e42c3ee0d1dd0b1ff552ac34d092f45d552347d6 | 74bb1b461421d5309fd81f4cb4ac1256bc331d45 | /src/main/comuns/lovera/comuns/recursos/Imagens.java | 579ec96c7e052ce9fc66bba1793e2093ff2092c9 | [] | no_license | LoveraSantiago/imagem | babdab428968155135eb596f4660c678b71f302c | 6c4e27b7d97846a59ee269907df20a51d862a14a | refs/heads/master | 2021-01-10T16:54:17.207048 | 2016-04-07T22:30:26 | 2016-04-07T22:30:26 | 52,724,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package lovera.comuns.recursos;
public enum Imagens {
LETRA_J("j.png"),
LINHA_DESCENDO("Linha135Graus.png"),
LINHA_HORIZONTAL("LinhaHorizontal.png"),
LINHA_SUBINDO("Linha45Graus.png"),
LINHA_VERTICAL("LinhaVertical.png"),
REDACAO_PNG("redacao.png");
private static final String RAIZ = "C:/Users/santi_000/Desktop/Proces_Imagens/Imagens/originais/";
private String endereco;
private Imagens(String endereco){
this.endereco = endereco;
}
public String getEndereco(){
return RAIZ + this.endereco;
}
}
| [
"santiago.lovera@gmail.com"
] | santiago.lovera@gmail.com |
55fd6450129cb7d00e71f158bdaf5d745e8bf290 | cb15d41e0512fb326361122ed3ab244f410e323d | /Product of two numbers/Main.java | 2f94633726854aef1d9289730748494e850bd03e | [] | no_license | keshavasai/Playground | dab9525635a6cf979cf9a782c80df27a42e45baa | 46c0ba9ba7d5e8e47d1c70c0337a2728bab8190e | refs/heads/master | 2020-04-26T19:13:20.914886 | 2019-06-22T12:45:25 | 2019-06-22T12:45:25 | 173,767,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | import java.util.Scanner;
class Main{
public static void main (String[] args) {
// Type your code here
Scanner sc=new Scanner(System.in);
int num1=sc.nextInt();
int num2=sc.nextInt();
int mul=num1*num2;
System.out.println(mul);
}
} | [
"48214962+keshavasai@users.noreply.github.com"
] | 48214962+keshavasai@users.noreply.github.com |
0d0a3f0cd6eb3c8f6d12d6571be64fe4d1893e16 | 355cbbcdaa9a72bcd05db2f1450cb7ecae35a4a5 | /pglp_9.9/src/main/java/fr/uvsq/pglp_9/Groupes.java | e8779e37f5a6755a32f86ce5de7b867e9c8992f0 | [] | no_license | uvsq21806299/pglp_9.9 | f0299db6cab0f7834b5a3631e1521be10e05d09f | a2dcde2a519c4916d8b0b19f699a7a9dfdc80bcc | refs/heads/master | 2022-12-25T12:29:21.747642 | 2020-05-24T20:20:55 | 2020-05-24T20:20:55 | 263,857,806 | 0 | 0 | null | 2020-10-13T21:59:28 | 2020-05-14T08:26:41 | Java | UTF-8 | Java | false | false | 2,139 | 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 fr.uvsq.pglp_9;
import java.util.List;
import java.util.UUID;
/**
*
* @author andri
*/
public class Groupes implements Command{
static List<String> group;
static String groupName;
static String uuid = UUID.randomUUID().toString();
public static void init(List<String> valeur){
group = valeur;
}
@Override
public void execute() {
groupName = group.get(0);
FormesDAO groupDAO = new FormesDAO();
groupDAO.insertGroup(groupName, uuid);
DerbyDAOFactory derby = new DerbyDAOFactory();
for(int i=1; i<= group.size()-1; i++){
String elementForSearchInDerbyDB = group.get(i);
try{
Cercle cercle = (Cercle) derby.getCercleDAO().find(elementForSearchInDerbyDB);
if(cercle != null){
groupDAO.insert(cercle);
}
}catch(Exception ex){
}
try{
Carre carre = (Carre) derby.getCarreDAO().find(elementForSearchInDerbyDB);
if(carre != null){
groupDAO.insert(carre);
}
}catch(Exception ex){
}
try{
Rectangle rectangle = (Rectangle) derby.getRectangleDAO().find(elementForSearchInDerbyDB);
if(rectangle != null){
groupDAO.insert(rectangle);
}
}catch(Exception ex){
}
try{
Triangle triangle = (Triangle) derby.getTriangleDAO().find(elementForSearchInDerbyDB);
if(triangle != null){
groupDAO.insert(triangle);
}
}catch(Exception ex){
}
}
System.out.println(" Creee groupe ");
}
}
| [
"andritsalamaramaroson@gmail.com"
] | andritsalamaramaroson@gmail.com |
84e0b2b09af4000f7d23bccd3f115ec904a57bf8 | 83bef99beaf4c4d1d0215710273e88ea86941994 | /app/src/main/java/com/epam/popcornapp/inject/modules/ConfigModule.java | 0fac058ee5e3691b5de2de634ada3043e8a332c3 | [] | no_license | spriteololo/Popcorn | 5dc8560921d8f0d591d30c930914b084c53ac84f | 31619fdecd4652cb20e479705ef7dfd2cde3e1a7 | refs/heads/master | 2020-03-21T18:27:42.073461 | 2018-06-27T15:21:07 | 2018-06-27T15:21:07 | 138,889,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.epam.popcornapp.inject.modules;
import com.epam.popcornapp.inject.ConfigInterface;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import retrofit2.Retrofit;
@Module
public class ConfigModule {
@Provides
@Singleton
ConfigInterface provideConfigInterface(final Retrofit retrofit) {
return retrofit.create(ConfigInterface.class);
}
} | [
"dzmitry_khilkovich@epam.com"
] | dzmitry_khilkovich@epam.com |
5674dc923a9289e978997ed79e7c2ee3fd9da0ac | 06dd552118a98b0ba1de4ed3b4c9fbc24ed832bb | /OnlineShoppingMerchandise/src/main/java/com/atmecs/shopping/helper/PerformUtilityMethods.java | d793d64712b6b6e25bf38c8ae055b6a973118edf | [] | no_license | SandhiyaMunisamy/HeatClinicApplication | 76de71d40dff61d072c7584628310736c544c094 | 02f6cf4cc100c30a184e4521bd1d4589f8292e8f | refs/heads/master | 2022-07-07T13:54:41.316734 | 2019-08-28T14:12:26 | 2019-08-28T14:12:26 | 200,870,558 | 0 | 0 | null | 2022-06-29T17:36:30 | 2019-08-06T14:43:57 | HTML | UTF-8 | Java | false | false | 2,475 | java | package com.atmecs.shopping.helper;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import com.atmecs.shopping.constants.UtilityMethods;
import com.atmecs.shopping.logger.LogReportFile;
import com.atmecs.shopping.testsuite.TestBase;
/**
*
* @author Sandhiya.Munisamy
*
*/
public class PerformUtilityMethods extends TestBase{
/**
* ClickElement with xpath
*
* @param driver
* @param xpath
*/
LogReportFile log = new LogReportFile();
public static void ClickElement(WebDriver driver, final String xpath) {
UtilityMethods.ignoreClickInterceptAndClickOnElement(driver, OR.getProperty(xpath));
}
/**
* SendElement with id and name
*
* @param driver
* @param id
* @param name
*/
public static void SendElement(WebDriver driver, final String id, final String name) {
UtilityMethods.ignoreClickInterceptAndSendOnElement(driver, OR.getProperty(id),name );
}
/**
* SendElement with name and value
*
* @param driver
* @param name
* @param value
*/
public static void SendElementName(WebDriver driver, final String name, final String value) {
UtilityMethods.ignoreNameInterceptAndSendOnElement(driver, OR.getProperty(name),value );
}
/**
* SendElement with xpath and value
* @param driver
* @param xpath
* @param value
*/
public static void SendElementXpath(WebDriver driver,final String xpath,final String value ) {
UtilityMethods.ignorexpathInterceptAndSendOnElement(driver, OR.getProperty(xpath),OR.getProperty(value) );
}
/**
* SendElement with xpath and enter
* @param driver
* @param xpath
* @param enter
*/
public static void SendEnter(WebDriver driver,final String xpath,final Keys enter ) {
UtilityMethods.ignoreKeysInterceptAndSendOnElement(driver, OR.getProperty(xpath), enter);
}
public String click(WebDriver driver,final String xpath) {
return driver.findElement(By.xpath(OR.getProperty(xpath))).getText();
}
public void dropDown(WebDriver driver,String xpath,String SelectDropdown,int count) {
Select dropDown = new Select(driver.findElement(By.xpath(xpath)));
dropDown.selectByVisibleText(SelectDropdown);
List<WebElement> listDropdown = dropDown.getOptions();
int Count = listDropdown.size();
log.info("Total Number of item count in dropdown list = " + Count);
}
}
| [
"sandhiya.munisamy@atmecs.com"
] | sandhiya.munisamy@atmecs.com |
2affaa85f964735295c2b2b6720c41fc73ed6391 | 573b9c497f644aeefd5c05def17315f497bd9536 | /src/main/java/com/alipay/api/domain/AlipayCommerceTransportOfflinepayUserblacklistQueryModel.java | 2430a136ba5875f18b2e3c0cb78f9cfa949f5b18 | [
"Apache-2.0"
] | permissive | zzzyw-work/alipay-sdk-java-all | 44d72874f95cd70ca42083b927a31a277694b672 | 294cc314cd40f5446a0f7f10acbb5e9740c9cce4 | refs/heads/master | 2022-04-15T21:17:33.204840 | 2020-04-14T12:17:20 | 2020-04-14T12:17:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 脱机交易黑名单列表
*
* @author auto create
* @since 1.0, 2016-07-01 22:05:43
*/
public class AlipayCommerceTransportOfflinepayUserblacklistQueryModel extends AlipayObject {
private static final long serialVersionUID = 7628169892938855266L;
/**
* 用户黑名单分页ID,1开始
*/
@ApiField("page_index")
private Long pageIndex;
/**
* 脱机交易用户黑名单分页页大小,最大页大小不超过1000
*/
@ApiField("page_size")
private Long pageSize;
public Long getPageIndex() {
return this.pageIndex;
}
public void setPageIndex(Long pageIndex) {
this.pageIndex = pageIndex;
}
public Long getPageSize() {
return this.pageSize;
}
public void setPageSize(Long pageSize) {
this.pageSize = pageSize;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
cc5647226d4daa6c30aa59239bc2235532984014 | 85e2da568de7da972a261e2712098f4309c47ec3 | /app/src/main/java/com/edemartini/marcianito/MainActivity.java | 1c9dfb9049bc1ba9d6944d803a44aa2ce36b9ab3 | [] | no_license | edemartini/Marcianito | b15fccae1a356ae7f340c9533f78283ce040177b | da1e553d5e43cd71ab930890b90b5fedb775ed56 | refs/heads/master | 2022-12-22T11:48:01.057816 | 2020-09-28T03:41:50 | 2020-09-28T03:41:50 | 299,179,188 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package com.edemartini.marcianito;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
} | [
"60859822+edemartini@users.noreply.github.com"
] | 60859822+edemartini@users.noreply.github.com |
639c0ab3eabe7b3113281a882a3daba92a0f58f6 | e6450687e1665c2c6c4331826e6c57b87931530c | /src/main/java/Singleton/Singleton.java | 399140aea75206a765ad45dcae34eeb5b75f5971 | [] | no_license | rainofflower/design-patterns | 06b38f2a1c9eae4f833362370f1c721aeacebc38 | 43d5fd8507c592d201ff2e531c0c185c42fcd652 | refs/heads/master | 2023-01-05T17:15:44.216787 | 2020-03-26T08:48:39 | 2020-03-26T08:48:39 | 112,441,343 | 0 | 0 | null | 2020-10-13T06:42:45 | 2017-11-29T07:23:23 | Java | UTF-8 | Java | false | false | 261 | java | package Singleton;
public class Singleton {
private Singleton(){
}
private static class SingletonHolder{
static Singleton instance = new Singleton();
}
public static Singleton getInstance(){
return SingletonHolder.instance;
}
}
| [
"Administrator@RUCWYSVGU0YS8EH"
] | Administrator@RUCWYSVGU0YS8EH |
14b044953f36d086b0a66ab550856bf17ac027b3 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/7/7_b15c2cc00edef4685142d4822332174a16f98d9c/ComputerActivity/7_b15c2cc00edef4685142d4822332174a16f98d9c_ComputerActivity_s.java | 2340db657e9f81711224ce26a261c00123e64b7e | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,821 | java | package spang.mobile;
import keyboard.KeyboardNetworkedActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
public class ComputerActivity extends NetworkedActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_computer);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_computer, menu);
return true;
}
@Override
protected void onNetworkServiceConnected() {
//TODO remove testing code!.
SpangTouchView view = new SpangTouchView(this, this.getNetworkService());
setContentView(view);
view.setFocusableInTouchMode(true);
view.requestFocus();
}
@Override
protected void onNetworkSerivceDissconnected() {
Toast.makeText(this,"Dissconnected!", Toast.LENGTH_SHORT).show();
}
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.Keyboard:
this.onShowKeyboard(item);
case R.id.shortcuts:
this.goToShortcuts(item);
default:
return super.onOptionsItemSelected(item);
}
}
public void goToShortcuts(MenuItem item){
Intent intent = new Intent(this, ShortcutActivity.class);
startActivity(intent);
}
public void onShowKeyboard(MenuItem item) {
Intent intent = new Intent(this, KeyboardNetworkedActivity.class);
this.startActivity(intent);
}
@Override
protected void onMessageRecived(Object message) {
//Don't rly care tbh :O
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
e6d26bc3a01775997843457dea2e4bccd76bb6d1 | 0b39e2b3cfaf5b4ae29cfada18726502ce9622eb | /Products/java/com/niit/Products/pojos/User.java | 8eadfc1f10ca49eff5629847196906fd7afa2712 | [] | no_license | sabitha157/products | 216c156d296048c2e8c9be626ef60db543d45a5a | 34441a35c265c326c50946de57544b8067bd5e58 | refs/heads/master | 2021-05-06T16:43:37.472374 | 2018-02-03T14:36:05 | 2018-02-03T14:36:05 | 113,837,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,146 | java | package com.niit.Products.pojos;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private int id;
@NotBlank(message = "Username shouldnot be empty")
private String username;
@Size(min = 10, message = "DOB should be of length 10")
private String dob;
private String email;
private String password;
@Size(min = 10, message = "Contact should be of length 10")
private String contact;
private String gender;
public String role;
public boolean enabled;
@OneToMany(fetch = FetchType.LAZY,cascade = CascadeType.ALL)
private List<Address> address;
public List<Address> getAddress() {
return address;
}
public void setAddress(List<Address> address) {
this.address = address;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = contact;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
| [
"="
] | = |
4373882fa62cf956db86f786b8df3034dabdac9a | 96176ca7a04a25118d5d98f9743f5992e8090aae | /HibernateChat/src/main/java/ChatAdminAndUser/Hibernate/App.java | 82bb2d536abd872bcab4944cf471cae31022de10 | [] | no_license | Arganon/Java | 86924016cbca56e47bbb3fba0f83cd89f31f64b2 | d6f35a5f0f1e5cd5b6861f36885efd1ff11acb88 | refs/heads/master | 2021-01-13T03:07:10.385452 | 2017-09-05T16:53:42 | 2017-09-05T16:53:42 | 77,444,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,811 | java | package ChatAdminAndUser.Hibernate;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import org.hibernate.SessionFactory;
import ChatAdminAndUser.Hibernate.entity.BadUser;
import ChatAdminAndUser.Hibernate.entity.Permission;
import ChatAdminAndUser.Hibernate.entity.Role;
import ChatAdminAndUser.Hibernate.entity.User;
public class App {
public static void main( String[] args ) {
SessionFactory sessionFactory = (SessionFactory) Persistence.createEntityManagerFactory("initentitymanager");
EntityManager entityManager = sessionFactory.createEntityManager();
entityManager.getTransaction().begin();
Role memberRole = new Role();
memberRole.setName("member");
Role adminRole = new Role();
adminRole.setName("admin");
Permission readPermission = new Permission();
readPermission.setName("read");
Permission writePermission = new Permission();
writePermission.setName("write");
Permission banPermission = new Permission();
banPermission.setName("ban");
Permission deletePermission = new Permission();
deletePermission.setName("delete");
List<Permission> memberPermissions = new ArrayList<Permission>();
memberPermissions.add(readPermission);
memberPermissions.add(writePermission);
List<Permission> adminPermissions = new ArrayList<Permission>();
adminPermissions.add(readPermission);
adminPermissions.add(writePermission);
adminPermissions.add(banPermission);
adminPermissions.add(deletePermission);
memberRole.setPermissions(memberPermissions);
adminRole.setPermissions(adminPermissions);
User user = new User();
user.setName("John");
user.setLogin("john");
user.setPassword("123");
user.setRole(adminRole);
BadUser badUser = new BadUser();
badUser.setName("Bad");
badUser.setLogin("bad");
badUser.setPassword("123");
badUser.setDebt("123");
badUser.setRole(adminRole);
entityManager.persist(readPermission);
entityManager.persist(writePermission);
entityManager.persist(banPermission);
entityManager.persist(deletePermission);
entityManager.persist(memberRole);
entityManager.persist(adminRole);
entityManager.persist(user);
entityManager.persist(badUser);
entityManager.getTransaction().commit();
entityManager.close();
sessionFactory.close();
}
}
| [
"arganon@yandex.ru"
] | arganon@yandex.ru |
0d1245d982b9dad7ec0b1cf4597d3ff872c568c3 | e80153be4986bb96ca61df839575853cc67b2f34 | /regacy/src/main/java/com/jukbang/api/model/Review.java | 0feac8e8070bf773c596da43a594436bd647ae29 | [] | no_license | juk-bang/backend | 949372d09584db529d3ebe9d7a96b674e6cfe532 | 56bf57c70bc7cf1a4244480fbb265c0a7c179f25 | refs/heads/develop | 2021-08-22T06:57:53.978228 | 2020-12-05T01:41:01 | 2020-12-05T01:41:01 | 231,685,797 | 0 | 0 | null | 2020-12-05T01:41:02 | 2020-01-04T00:16:25 | Java | UTF-8 | Java | false | false | 1,406 | java | package com.jukbang.api.model;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Entity
@Table
public class Review extends Time {
@Id
/**
* 각 리뷰의 고유번호 (중복 불가)
*/
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
/**
* 리뷰를 달 writer의 이름
*/
@Column(length = 30, nullable = false)
private String writer;
/**
* 리뷰의 title이름
*/
@Column(length = 30, nullable = false)
private String title;
/**
* 100자 이내의 리뷰 입력
*/
@Column(length = 100, nullable = false)
private String body;
/**
* 대학 번호
*/
@Column(nullable = false)
private int univid;
/**
* 방 정보 번호
*/
@Column(nullable = false)
private int roomid;
/**
* 리뷰 평점
*/
@Column(nullable = false)
private int score;
@Builder
public Review(long id, String writer, String body, int univid, int roomid, int score, String title) {
this.id = id;
this.writer = writer;
this.body = body;
this.univid = univid;
this.roomid = roomid;
this.score = score;
this.title = title;
}
}
| [
"si8363@naver.com"
] | si8363@naver.com |
5d96d27198f464a35148dc5c58bb489fbac08dcd | 21659d9a413b246622f3951ab4e250c4def430aa | /src/main/java/com/mao/service/data/DrugServiceHandler.java | f8124e384f06d443486d496fc150a26dd1405a16 | [] | no_license | KeepYoungerMao/keep-younger-api | cb1d1c9dea4bf353ea1f4f61143f7b90bf0da63e | 248ce0b73ba414a076d77745f3ac21efb7e428e9 | refs/heads/master | 2022-02-18T11:59:02.426304 | 2019-09-12T07:03:34 | 2019-09-12T07:03:34 | 205,352,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,255 | java | package com.mao.service.data;
import com.mao.entity.ResponseData;
import com.mao.entity.drug.*;
import com.mao.mapper.data.DrugMapper;
import com.mao.service.ResponseServiceHandler;
import com.mao.util.SU;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 中草药、药品数据处理
* @author mao by 10:38 2019/9/4
*/
@Service
public class DrugServiceHandler implements DrugService {
@Resource
private ResponseServiceHandler responseServiceHandler;
@Resource
private DrugMapper drugMapper;
/**
* 查询中草药简要列表
* @param trait 四气
* @param flavor 五味
* @param tropism 归经
* @param page 页码
* @return 中草药简要列表
*/
@Override
public ResponseData crudeDrugList(String trait, String flavor, String tropism, String page) {
TraitEnum _trait = SU.getType(TraitEnum.class, trait);
if (null == _trait)
return responseServiceHandler.bad("unknown type: " + trait);
FlavorEnum _flavor = SU.getType(FlavorEnum.class, flavor);
if (null == _flavor)
return responseServiceHandler.bad("unknown type: " + flavor);
MeridianTropismEnum _tropism = SU.getType(MeridianTropismEnum.class, tropism);
if (null == _tropism)
return responseServiceHandler.bad("unknown type: " + tropism);
Integer _page = SU.getNumber(page);
if (null == _page)
return responseServiceHandler.bad("invalid param: " + page);
_page = _page > 0 ? (_page == 1 ? 0 : (_page - 1)*10) : 0;
String type;
if (_trait == TraitEnum.all && _flavor == FlavorEnum.all
&& _tropism == MeridianTropismEnum.all){
type = null;
} else {
type = "%";
if (_trait != TraitEnum.all)
type += _trait.getType() + "%";
if (_flavor != FlavorEnum.all)
type += _flavor.getType() + "%";
if (_tropism != MeridianTropismEnum.all)
type += _tropism.getType() + "%";
}
List<SimpleCrudeDrug> list = drugMapper.getCrudeDrugByType(type,_page);
return responseServiceHandler.ok(list);
}
/**
* 查询中草药详细信息
* @param id id
* @return 中草药详细信息
*/
@Override
public ResponseData crudeDrugSrc(String id) {
Integer _id = SU.getNumber(id);
if (null == _id)
return responseServiceHandler.bad("invalid param: " + id);
CrudeDrug crudeDrug = drugMapper.getCrudeDrugById(_id);
return responseServiceHandler.ok(crudeDrug);
}
/**
* 获取成品药简要列表
* @param fl 分类 科室或用处划分
* @param jx 剂型 药品性状
* @param lb 类别 品种和等级划分
* @param page 页码
* @return 成品药简要列表
*/
@Override
public ResponseData drugList(String fl, String jx, String lb, String page) {
FlEnum _fl = SU.getType(FlEnum.class, fl);
if (null == _fl)
return responseServiceHandler.bad("unknown type: " + fl);
JxEnum _jx = SU.getType(JxEnum.class, jx);
if (null == _jx)
return responseServiceHandler.bad("unknown type: " + jx);
LbEnum _lb = SU.getType(LbEnum.class, lb);
if (null == _lb)
return responseServiceHandler.bad("unknown type: " + lb);
Integer _page = SU.getNumber(page);
if (_page == null)
return responseServiceHandler.bad("invalid param: " + page);
_page = _page > 0 ? (_page == 1 ? 0 : (_page - 1)*10) : 0;
List<Drug> list = drugMapper.getDrugByType(_fl.getType(),_jx.getType(),_lb.getType(),_page);
return responseServiceHandler.ok(list);
}
/**
* 获取成品药详情信息
* @param id id
* @return 成品药详情信息
*/
@Override
public ResponseData drugSrc(String id) {
Integer _id = SU.getNumber(id);
if (_id == null)
return responseServiceHandler.bad("invalid id: " + id);
DrugSrc drugSrc = drugMapper.getDrugSrcById(_id);
return responseServiceHandler.ok(drugSrc);
}
} | [
"maozx@dayiai.com"
] | maozx@dayiai.com |
284db9cfc880c5df8099ebb2eb3f90c1330d22ca | 5ca3901b424539c2cf0d3dda52d8d7ba2ed91773 | /src_cfr/com/google/protobuf/Descriptors$DescriptorValidationException.java | 54739f68646d300b82db85b07fe13051d5b77ebd | [] | no_license | fjh658/bindiff | c98c9c24b0d904be852182ecbf4f81926ce67fb4 | 2a31859b4638404cdc915d7ed6be19937d762743 | refs/heads/master | 2021-01-20T06:43:12.134977 | 2016-06-29T17:09:03 | 2016-06-29T17:09:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,934 | java | /*
* Decompiled with CFR 0_115.
*/
package com.google.protobuf;
import com.google.protobuf.DescriptorProtos$FileDescriptorProto;
import com.google.protobuf.Descriptors$1;
import com.google.protobuf.Descriptors$FileDescriptor;
import com.google.protobuf.Descriptors$GenericDescriptor;
import com.google.protobuf.Message;
public class Descriptors$DescriptorValidationException
extends Exception {
private static final long serialVersionUID = 5750205775490483148L;
private final String name;
private final Message proto;
private final String description;
public String getProblemSymbolName() {
return this.name;
}
public Message getProblemProto() {
return this.proto;
}
public String getDescription() {
return this.description;
}
private Descriptors$DescriptorValidationException(Descriptors$GenericDescriptor descriptors$GenericDescriptor, String string) {
String string2 = String.valueOf(String.valueOf(descriptors$GenericDescriptor.getFullName()));
String string3 = String.valueOf(String.valueOf(string));
super(new StringBuilder(2 + string2.length() + string3.length()).append(string2).append(": ").append(string3).toString());
this.name = descriptors$GenericDescriptor.getFullName();
this.proto = descriptors$GenericDescriptor.toProto();
this.description = string;
}
private Descriptors$DescriptorValidationException(Descriptors$GenericDescriptor descriptors$GenericDescriptor, String string, Throwable throwable) {
this(descriptors$GenericDescriptor, string);
this.initCause(throwable);
}
private Descriptors$DescriptorValidationException(Descriptors$FileDescriptor descriptors$FileDescriptor, String string) {
String string2 = String.valueOf(String.valueOf(descriptors$FileDescriptor.getName()));
String string3 = String.valueOf(String.valueOf(string));
super(new StringBuilder(2 + string2.length() + string3.length()).append(string2).append(": ").append(string3).toString());
this.name = descriptors$FileDescriptor.getName();
this.proto = descriptors$FileDescriptor.toProto();
this.description = string;
}
/* synthetic */ Descriptors$DescriptorValidationException(Descriptors$FileDescriptor descriptors$FileDescriptor, String string, Descriptors$1 descriptors$1) {
this(descriptors$FileDescriptor, string);
}
/* synthetic */ Descriptors$DescriptorValidationException(Descriptors$GenericDescriptor descriptors$GenericDescriptor, String string, Descriptors$1 descriptors$1) {
this(descriptors$GenericDescriptor, string);
}
/* synthetic */ Descriptors$DescriptorValidationException(Descriptors$GenericDescriptor descriptors$GenericDescriptor, String string, Throwable throwable, Descriptors$1 descriptors$1) {
this(descriptors$GenericDescriptor, string, throwable);
}
}
| [
"manouchehri@riseup.net"
] | manouchehri@riseup.net |
2e1cd524c2b807171c718fe4c20633c582c99e44 | 95faf9e91e7d2dffb855f46d044c7393146a3469 | /HW3 GUI/src/Employee.java | 6f827fdc3e72754d314e4d49e98815cc9cc73475 | [] | no_license | gmarler20/CS-372-HW3 | 264bf0e168a71017f5fd40e0572623cc8274f8a9 | 249d9060625f6c898ccba762d5c33be59fcef85d | refs/heads/master | 2020-04-16T13:01:29.462194 | 2019-01-14T06:41:49 | 2019-01-14T06:41:49 | 165,606,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | /**
* This interface contains methods to give employee's their pay and a
* method to ask the employee their EmployeeID. Police and Teacher
* classes will implement Employee.
* @author Griffen Marler
* @version 1.00, 9 Jan 2019
*/
public interface Employee {
int AskId();
void PayEmployee(double a);
}
| [
"noreply@github.com"
] | noreply@github.com |
3a35198c327a9c028cb30785b4fc761091283994 | 0ff4843297d350d6146f563f91c02a35fe11b57d | /server_side/src/DataAccess/DaoNotificaionsReferee.java | d7a5d122bcda0b33b65aeebc12ebfe29303964c7 | [] | no_license | avitalze/Football-system-project | 7585efc628e67e5dfe6478a32c60d53c562bcb6c | 2af0f64c3c43cf2f692bedb7dbe3abecb2bacf80 | refs/heads/master | 2022-11-29T02:28:25.616716 | 2020-08-08T12:12:04 | 2020-08-08T12:12:04 | 285,851,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,877 | java | package DataAccess;
import DB.Tables.tables.records.FanNotificationRecord;
import DB.Tables.tables.records.MatchesRecord;
import DB.Tables.tables.records.RefereeNotificationRecord;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.exception.DataAccessException;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import static DB.Tables.Tables.*;
import static DB.Tables.Tables.FAN_NOTIFICATION;
/**
* table name : referee_notification
* 5 keys!
* **/
public class DaoNotificaionsReferee implements Dao<String> {
private DateTimeFormatter out = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private DateTimeFormatter in= DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
@Override
public List<String> get(List<String> keys) throws ParseException {
/** check connection to DB **/
DBHandler.conectToDB();
DSLContext create = DBHandler.getDSLConnect();
String key0Date=out.format(in.parse(keys.get(0)));
LocalDateTime dateTime = LocalDateTime.parse(key0Date, out);
String key1= keys.get(1);
String key2=keys.get(2);
String key3=keys.get(3);
String key4=keys.get(4);
List<String> result=new LinkedList<>();
/** select retrieval row from table **/
RefereeNotificationRecord refereeNotificationRecord =create.selectFrom(REFEREE_NOTIFICATION)
.where(REFEREE_NOTIFICATION.MATCH_DATE.ge(dateTime))
.and(REFEREE_NOTIFICATION.HOME_TEAM.eq(key1))
.and(REFEREE_NOTIFICATION.AWAY_TEAM.eq(key2))
.and(REFEREE_NOTIFICATION.REFEREE.eq(key3))
.and(REFEREE_NOTIFICATION.NOTIFICATION_CONTENT.eq(key4))
.fetchOne();
/** key noy found in table **/
if (refereeNotificationRecord == null || refereeNotificationRecord.size()==0){
//return null;
throw new ParseException("key noy found in table",0);
}
for (int i = 0; i <refereeNotificationRecord.size() ; i++) {
if(refereeNotificationRecord.get(i) instanceof LocalDateTime){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
result.add(((LocalDateTime) refereeNotificationRecord.get(i)).format(formatter));
//dd-MM-yyyy HH:mm:ss
}
else{
result.add(refereeNotificationRecord.get(i).toString());
}
}
return result;
}
@Override
public List<List<String>> getAll(String collName, String filter) {
/** check connection to DB **/
DBHandler.conectToDB();
DSLContext create = DBHandler.getDSLConnect();
if( collName==null && filter==null){
/** return all rows in table **/
Result<Record> result=create.select().from(REFEREE_NOTIFICATION).fetch();
/** iinitialize List<List<String>> **/
List<List<String>> ans=new ArrayList<>(result.size());
for(int i=0; i<result.size(); i++){
List<String> temp = new LinkedList<>();
ans.add(temp);
}
/** insert coll values to ans **/
int numOfCols=result.fields().length; //6!
for(int i=0;i< numOfCols;i++){
List <?> currCol = result.getValues(i);
for (int j = 0; j <result.size() ; j++) {
if(currCol.get(j) instanceof LocalDateTime){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
ans.get(j).add(((LocalDateTime) currCol.get(j)).format(formatter));
}
else{
ans.get(j).add(currCol.get(j).toString());
}
}
}
return ans;
}
/** filter **/
if(collName.equals("match_date")){
filter=out.format(in.parse(filter));
}
ResultSet rs=null;
Result<Record> result=null;
int numOfCols=0;
String sql="SELECT * FROM referee_notification WHERE "+collName+"= '" + filter + "'"; //!!!!!!!!!!!!!!!!!!!!!!!!!
List<List<String>> ans=null;
try {
rs=DBHandler.getConnection().createStatement().executeQuery(sql);
result=DBHandler.getDSLConnect().fetch(rs);
ResultSetMetaData rsmd=rs.getMetaData();
numOfCols=rsmd.getColumnCount();
/** iinitialize List<List<String>> **/
ans=new ArrayList<>(result.size());
for(int i=0; i<result.size(); i++){
List<String> temp = new LinkedList<>();
ans.add(temp);
}
/** insert coll values to ans **/
for(int i=0;i< numOfCols;i++){
List <?> currCol = result.getValues(i);
for (int j = 0; j <result.size() ; j++) {
if(currCol.get(j) instanceof LocalDateTime){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
ans.get(j).add(((LocalDateTime) currCol.get(j)).format(formatter));
}
if( currCol.get(j) instanceof Timestamp ){
//DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
String formattedDate = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(currCol.get(j));
ans.get(j).add((formattedDate));
}
else{
ans.get(j).add(currCol.get(j).toString());
}
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return ans;
}
@Override
public void save(List<String> strings) throws SQLException {
/** check connection to DB **/
DBHandler.conectToDB();
DSLContext create = DBHandler.getDSLConnect();//DSL.using(connection, SQLDialect.MARIADB);
/** check if key not already exist in DB **/
String key0Date=out.format(in.parse(strings.get(0)));
LocalDateTime dateTime = LocalDateTime.parse(key0Date, out);
String key1= strings.get(1);
String key2=strings.get(2);
String key3=strings.get(3);
String key4=strings.get(4);
Result<Record> isExist = create.select().from(REFEREE_NOTIFICATION)
.where(REFEREE_NOTIFICATION.MATCH_DATE.ge(dateTime))
.and(REFEREE_NOTIFICATION.HOME_TEAM.eq(key1))
.and(REFEREE_NOTIFICATION.AWAY_TEAM.eq(key2))
.and(REFEREE_NOTIFICATION.REFEREE.eq(key3))
.and(REFEREE_NOTIFICATION.NOTIFICATION_CONTENT.eq(key4))
.fetch();
if(isExist.size()== 0){ // key not exist
/**add new row to DB **/
try{
/** convert to date format of DB **/
String matchDate=out.format(in.parse(strings.get(0)));
LocalDateTime local=LocalDateTime.parse(matchDate,out);
create.insertInto(REFEREE_NOTIFICATION,
REFEREE_NOTIFICATION.MATCH_DATE,
REFEREE_NOTIFICATION.HOME_TEAM,
REFEREE_NOTIFICATION.AWAY_TEAM,
REFEREE_NOTIFICATION.REFEREE,
REFEREE_NOTIFICATION.NOTIFICATION_CONTENT,
REFEREE_NOTIFICATION.READED)
.values(local , strings.get(1), strings.get(2),strings.get(3), strings.get(4),
Byte.valueOf(strings.get(5))).execute();
System.out.println("new row add"); // dell ! !
}catch (DataAccessException e){
e.printStackTrace();
throw new SQLException("added failed, foreign key not exist.");
}
}
else {
throw new SQLException("added failed, key already exist.");
}
}
@Override
public void update(List<String> keys, List<String> string) {
/** check connection to DB **/
DBHandler.conectToDB();
DSLContext create = DBHandler.getDSLConnect();//DSL.using(connection, SQLDialect.MARIADB);
String key0Date=out.format(in.parse(keys.get(0)));
LocalDateTime dateTime = LocalDateTime.parse(key0Date, out);
String key1= keys.get(1);
String key2=keys.get(2);
String key3=keys.get(3);
String key4=keys.get(4);
/** select retrieval row from table **/
RefereeNotificationRecord refereeNotificationRecord=create.selectFrom(REFEREE_NOTIFICATION)
.where(REFEREE_NOTIFICATION.MATCH_DATE.ge(dateTime))
.and(REFEREE_NOTIFICATION.HOME_TEAM.eq(key1))
.and(REFEREE_NOTIFICATION.AWAY_TEAM.eq(key2))
.and(REFEREE_NOTIFICATION.REFEREE.eq(key3))
.and(REFEREE_NOTIFICATION.NOTIFICATION_CONTENT.eq(key4))
.fetchOne();
/** check if key exist in DB **/
if(refereeNotificationRecord != null) {
/**update row in DB **/
refereeNotificationRecord.setReaded(Byte.valueOf(string.get(0)));
try{
refereeNotificationRecord.store();
/** foreign key not exist **/
}catch (DataAccessException e){
//e.printStackTrace();
System.out.println("foreign key not exist. need to change it");
}
}
}
@Override
public void delete(List<String> strings) {
/** check connection to DB **/
DBHandler.conectToDB();
DSLContext create = DBHandler.getDSLConnect();//DSL.using(connection, SQLDialect.MARIADB);
String key0Date=out.format(in.parse(strings.get(0)));
LocalDateTime dateTime = LocalDateTime.parse(key0Date, out);
String key1= strings.get(1);
String key2=strings.get(2);
String key3=strings.get(3);
String key4=strings.get(4);
create.delete(REFEREE_NOTIFICATION)
.where(REFEREE_NOTIFICATION.MATCH_DATE.ge(dateTime))
.and(REFEREE_NOTIFICATION.HOME_TEAM.eq(key1))
.and(REFEREE_NOTIFICATION.AWAY_TEAM.eq(key2))
.and(REFEREE_NOTIFICATION.REFEREE.eq(key3))
.and(REFEREE_NOTIFICATION.NOTIFICATION_CONTENT.eq(key4))
.execute();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c13f837241c612739cb492a37299eb85d400ba99 | 711bcf9e158ecf263531d393a70124d12fee4008 | /app/.svn/pristine/c1/c13f837241c612739cb492a37299eb85d400ba99.svn-base | c820e008516ebfaf2aba8b6b772b8b61912d3f38 | [] | no_license | spzhong/qianbangzhu | 1f11eb8ef6adb9d2d583fb9215e8776a133b2dd7 | b8cad05001eee39e8690b9a88ddccd6af018c9d7 | refs/heads/master | 2021-01-18T20:25:19.080429 | 2017-11-06T05:41:12 | 2017-11-06T05:41:12 | 86,964,505 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,207 | package com.quqian.activity.mine;
import java.util.List;
import java.util.Map;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import com.example.quqian.R;
import com.quqian.activity.mine.KjChongZhiActivity.JavaScriptinterface;
import com.quqian.base.BaseActivity;
import com.quqian.been.UserMode;
import com.quqian.util.HttpResponseInterface;
import com.quqian.util.ProcessDialogUtil;
import com.quqian.util.Tool;
public class AppWithdrawActivity extends BaseActivity implements OnClickListener,
HttpResponseInterface {
private String mchnt_cd = null;
private String mchnt_txn_ssn = null;
private String amt = null;
private String login_id = null;
private String page_notify_url = null;
private String back_notify_url = null;
private String signatureStr = null;
private ProcessDialogUtil juhua = null;
private String fyUrl = null;
private WebView webView = null;
@Override
protected int layoutId() {
// TODO Auto-generated method stub
return R.layout.main_mine_appwithdraw;
}
@Override
protected void getIntentWord() {
// TODO Auto-generated method stub
super.getIntentWord();
}
/**
* 接受页面参数类,用于跳转和数据核对
* @author zhuming
* add by zhuming at 2016-07-08 14:14
*/
public class JavaScriptinterface {
@JavascriptInterface
public void getCode(String code) {
if(code.equals("0000")){
UserMode user = Tool.getUser(AppWithdrawActivity.this);
double money = Double.parseDouble(user.getKyye()) - Double.parseDouble(amt)/100 - 2;
user.setKyye(String.valueOf(money));
user.saveUserToDB(AppWithdrawActivity.this);
Intent intent1 = new Intent(AppWithdrawActivity.this,
MineActivity.class);
startActivity(intent1);
}
}
}
@Override
protected void initView() {
// TODO Auto-generated method stub
super.initView();
setTitle("富友提现");
showBack();
webView = (WebView) findViewById(R.id.appwithdrawView);
webView.setWebViewClient(new WebViewClient());
webView.setWebChromeClient(new WebChromeClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(new JavaScriptinterface(),
"android");
juhua = new ProcessDialogUtil(AppWithdrawActivity.this);
Intent intent = getIntent();
mchnt_cd = intent.getStringExtra("mchnt_cd");
mchnt_txn_ssn = intent.getStringExtra("mchnt_txn_ssn");
amt = intent.getStringExtra("amt");
login_id = intent.getStringExtra("login_id");
page_notify_url = intent.getStringExtra("page_notify_url");
back_notify_url = intent.getStringExtra("back_notify_url");
signatureStr = intent.getStringExtra("signatureStr");
fyUrl = intent.getStringExtra("fyUrl");
String postData = makePostHTML();
webView.loadData(postData, "text/html", "UTF-8");
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
webView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void initViewListener() {
// TODO Auto-generated method stub
super.initViewListener();
titleBarBack.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
switch (arg0.getId()) {
case R.id.title_bar_back:
AppWithdrawActivity.this.finish();
anim_right_out();
break;
default:
break;
}
}
private String makePostHTML(){
String html = "<!DOCTYPE HTML><html><body><form id='sbform' action='%s' method='post'>%s</form><script type='text/javascript'>document.getElementById('sbform').submit();</script></body></html>";;
StringBuffer sb = new StringBuffer();
sb.append("<input type='hidden' name='mchnt_cd' value='" + mchnt_cd + "'>\n");
sb.append("<input type='hidden' name='mchnt_txn_ssn' value='" + mchnt_txn_ssn + "'>\n");
sb.append("<input type='hidden' name='amt' value='" + amt + "'>\n");
sb.append("<input type='hidden' name='login_id' value='" + login_id + "'>\n");
sb.append("<input type='hidden' name='page_notify_url' value='" + page_notify_url + "'>\n");
sb.append("<input type='hidden' name='back_notify_url' value='" + back_notify_url + "'>\n");
sb.append("<input type='hidden' name='signature' value='" + signatureStr + "'>\n");
return String.format(html, fyUrl, sb.toString());
}
@Override
public void httpResponse_success(Map<String, String> map,
List<Object> list, Object jsonObj) {
// TODO Auto-generated method stub
}
@Override
public void httpResponse_fail(Map<String, String> map, String msg,
Object jsonObj) {
// TODO Auto-generated method stub
}
}
| [
"spzhongwin@126.com"
] | spzhongwin@126.com | |
4fb951dbf91566654affb62eea4f05b885f80176 | dad01bf303e63d89c53751fb2c147e3d5fb29583 | /ParserFactory.java | 6ddcc941aaa2a361db9cdc3387f23ec0f08076a5 | [] | no_license | PCreations/AndroidRESTClient | 326870ec9ec730ba31e66c4d9ed7cc01ab87326e | 2e81965085044e51b2d96c729cd0a117940ae1b3 | refs/heads/master | 2016-09-06T06:29:22.859510 | 2013-01-29T11:18:41 | 2013-01-29T11:18:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package com.pcreations.restclient;
abstract public class ParserFactory {
public abstract <P extends Parser<T>, T extends ResourceRepresentation<?>> P getParser(Class<T> clazz);
}
| [
"pcriulan@gmail.com"
] | pcriulan@gmail.com |
f434a8bb534aa3a2ddcb6377827d403e4ebd9f1c | 3a2398a023888d13d6f1559e8424766d3ba50b00 | /mybatis-one2one/src/main/java/com/itheima/mybatis/mapper/OrderMapper.java | 111ac609345292c8c2e7e4875093f41f11300c86 | [] | no_license | xshi0001/MyBatisLearing | f8c4941349a1d23912bb46808b3e32ace9eda18d | 197556ea926ac567b49b74784b95dfbfacf7bd09 | refs/heads/master | 2021-03-01T04:42:46.110477 | 2020-03-08T05:00:38 | 2020-03-08T05:00:38 | 245,754,733 | 1 | 0 | null | 2020-10-13T20:10:18 | 2020-03-08T04:58:28 | Java | UTF-8 | Java | false | false | 355 | java | package com.itheima.mybatis.mapper;
import com.itheima.mybatis.pojo.Order;
import com.itheima.mybatis.pojo.OrderQueryUser;
import java.util.List;
/**
* @program: mybatis-sqlMapConfig
* @description: Order表的Dao
* @author: JClearLove
* @Date: 2020/03/06 11:07
*/
public interface OrderMapper {
List<OrderQueryUser> findOrderUserInfo();
}
| [
"shixiaokai@chinamobile.com"
] | shixiaokai@chinamobile.com |
a8c7a347e86d678be1ea5f6455fae4070aa21db3 | eb6d8269af62f8d76ffecd284fa7dd2892b47177 | /spring-hibernate-integrated/src/main/java/com/spring/hibernate/dao/StudentDao.java | e409c6a3738acf69ab6399ad3e39e6d4501edc08 | [] | no_license | RojaGowdaC/hibernate-spring-integrated | 1e05c71e66ab29c2582b4756e97b913e7fc91a00 | 95454ce9c7a749a7ac6b6bb74aa3ba509c179bd7 | refs/heads/master | 2022-12-08T07:08:46.426957 | 2020-03-23T04:28:34 | 2020-03-23T04:28:34 | 249,332,145 | 0 | 0 | null | 2022-11-24T02:34:11 | 2020-03-23T04:03:37 | Java | UTF-8 | Java | false | false | 2,613 | java | package com.spring.hibernate.dao;
import com.spring.hibernate.model.Student;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import java.util.List;
import java.util.Scanner;
public class StudentDao {
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
private void exit() {
sessionFactory.close();
}
private void create() {
Student student = new Student();
student.setName("Roja");
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.persist(student);
tx.commit();
session.close();
}
private List<Student> read() {
Session session = this.sessionFactory.openSession();
List<Student> studentList = session.createQuery("from student").list();
session.close();
return studentList;
}
private void update() {
Student student = new Student();
student.setName("Roja Gowda");
Session session = sessionFactory.openSession();
session.beginTransaction();
Student oldStudent = (Student) session.load(Student.class, 1);
oldStudent.setName(student.getName());
session.getTransaction().commit();
session.close();
System.out.println("Successfully updated " + oldStudent);
}
private void delete() {
Student student = new Student();
student.setId(2);
@SuppressWarnings("unchecked")
Session session = sessionFactory.openSession();
session.beginTransaction();
session.delete(student);
session.getTransaction().commit();
session.close();
}
public void performOperations() {
Scanner sc = new Scanner(System.in);
create();
while(true) {
int option;
System.out.println("Enter your choice : ");
System.out.println("1. Create \n 2. read\n 3. Update\n 4. Delete");
option = sc.nextInt();
switch (option) {
case 1:
create();
break;
case 2:
System.out.println(read());
break;
case 3:
update();
break;
case 4:
delete();
break;
default:
exit();
return;
}
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
34684b629ad07305c3e62073c290000b51098c11 | be30d124733f354d8929f20150898227950a2911 | /testPjt2/src/testPjt2/mainClass.java | ad9ed1600e9e0e2781eb0340c17ced3cd01e21a1 | [] | no_license | zehye/studyJava | 399db168cbc7064a26054c0321d6942cd4df71f3 | 4c5c0ae675d8841ef4ac38af6d20284437e910da | refs/heads/master | 2020-07-06T00:55:21.186347 | 2019-08-27T10:13:25 | 2019-08-27T10:13:25 | 202,837,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | package testPjt2;
public class mainClass {
public static void main(String[] args) {
System.out.println(" -- ObjectClass() -- ");
}
}
| [
"zehye.01@gmail.com"
] | zehye.01@gmail.com |
dc8441ed8a8dec059a72f364181e562464f77b8b | 7ebf037023b8f25f55d8405221e46083c9041421 | /src/test/java/com/rr2222/springsecurityetude/SpringsecurityEtudeApplicationTests.java | 795d4978af0c6278012e398baa0b8de23aa640af | [] | no_license | rr2222/springsecurity-etude | dde12536175973db85d21f3ff0f999b6a2ae7033 | a72028dba6ddca22f7255ca545d709748ed7dc02 | refs/heads/main | 2023-07-20T15:46:50.679829 | 2021-09-04T03:12:32 | 2021-09-04T03:12:32 | 396,470,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package com.rr2222.springsecurityetude;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringsecurityEtudeApplicationTests {
@Test
void contextLoads() {
}
}
| [
"ruither.carvalho@gmail.com"
] | ruither.carvalho@gmail.com |
388e614f2b16103d33a7395ed0786becd8041f5c | 3d81880098968a0217c258d865b59a64d0a0baeb | /app/src/main/java/com/sinergiinformatika/sisicrm/data/models/Subdistrict.java | bb73bda2db5e34df7d2f3a3ce34d76c03bbf5425 | [] | no_license | cyberstackover/sample-crm-mobile | d612dec97be4614dbe31eba0436215afdccb8084 | bbce9425a8f2e8d261f7f89007223dc9e95b0103 | refs/heads/master | 2021-09-06T03:55:01.039113 | 2018-02-02T07:46:37 | 2018-02-02T07:46:37 | 119,949,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package com.sinergiinformatika.sisicrm.data.models;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
/**
* Created by wendi on 17-Feb-15.
*/
public class Subdistrict implements Serializable{
@JsonIgnore
private Integer id;
@JsonProperty("id")
private String subdistrictId;
@JsonProperty("name")
private String subdistrictName;
@JsonProperty("city_id")
private String cityId;
@JsonProperty("date_modified")
private String syncDate;
public String getSyncDate() {
return syncDate;
}
public void setSyncDate(String syncDate) {
this.syncDate = syncDate;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSubdistrictId() {
return subdistrictId;
}
public void setSubdistrictId(String subdistrictId) {
this.subdistrictId = subdistrictId;
}
public String getSubdistrictName() {
return subdistrictName;
}
public void setSubdistrictName(String subdistrictName) {
this.subdistrictName = subdistrictName;
}
public String getCityId() {
return cityId;
}
public void setCityId(String cityId) {
this.cityId = cityId;
}
}
| [
"herwin@windowslive.com"
] | herwin@windowslive.com |
25b1760194c3562b20065100c07643af91d9d0a6 | 81382551cea049fa53136a38df6f376d8e62449e | /lottery-manager-system/src/main/java/com/manager/user/manager/fragment/ManagerConsumableOrdersTabFragment1.java | fe898db3193cde21488bea7c445213d1036419c0 | [] | no_license | yangdonghui/LotteryManagerSystemPro | caf07d60b00199e3329498b16cf0746a71c353f0 | c527fcda2b72b741b30e3a5a1f66fbd0f684add5 | refs/heads/master | 2021-01-11T04:21:55.492005 | 2016-10-18T02:25:44 | 2016-10-18T02:25:44 | 71,200,515 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 5,649 | java | package com.manager.user.manager.fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import com.manager.Interface.ICoallBack5;
import com.manager.adapter.user.ManagerConsumableOrdersListViewAdapter;
import com.manager.bean.DeclareOrdersBean;
import com.manager.bean.UserBean;
import com.manager.common.Constants;
import com.manager.lotterypro.R;
import com.manager.lotterypro.SysApplication;
import com.manager.user.manager.ManagerDeclareOrderDetailAct;
import com.manager.widgets.DeliveryFaildDialog;
import java.util.ArrayList;
/**
* 管理员 管理站点申报订单 全部 界面
* Created by Administrator on 2016/3/23 0023.
*/
public class ManagerConsumableOrdersTabFragment1 extends Fragment {
private UserBean userBean = SysApplication.userBean;
//上下文对象
private Context mContext = null;
//list控件
private ListView mListView;
private ManagerConsumableOrdersListViewAdapter mListViewAdapter;
//生成动态数组,加入数据
ArrayList<DeclareOrdersBean> mLists = new ArrayList<>();
//list无数据的提示
private View tipView;
//界面类型
private int pageType;
//根视图缓存
private View rootView = null;
//静态对象
private static ManagerConsumableOrdersTabFragment1 mTabFragment = null;
/**
* 静态工厂方法需要一个int型的值来初始化fragment的参数,
* 然后返回新的fragment到调用者
*/
public static ManagerConsumableOrdersTabFragment1 newInstance(int pageType) {
if (mTabFragment == null) {
mTabFragment = new ManagerConsumableOrdersTabFragment1();
mTabFragment.pageType = pageType;
}
return mTabFragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initData();
mContext = getActivity();
}
@Override
public void onDestroy() {
super.onDestroy();
mLists.clear();
mLists = null;
mTabFragment=null;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
if (null != rootView) {
ViewGroup parent = (ViewGroup) rootView.getParent();
if (null != parent) {
parent.removeView(rootView);
}
} else {
rootView = inflater.inflate(R.layout.entrust_record_tab,null);//注意不要指定父视图
initView();
initListView();
}
return rootView;
}
private void initView() {
tipView = (View) rootView.findViewById(R.id.entrust_record_tab_listview_no);
updateListTipView();
}
private void updateListTipView() {
if (mLists != null && mLists.size() > 0){
if (tipView.getVisibility() != View.GONE){
tipView.setVisibility(View.GONE);
}else {
tipView.setVisibility(View.VISIBLE);
}
}
}
private void initData() {
for (int i=0;i<Constants.ManagerOrderLists.size();i++){
DeclareOrdersBean att = Constants.ManagerOrderLists.get(i);
if (att != null){
mLists.add(att);
}
}
}
private void initListView() {
mListView = (ListView) rootView.findViewById(R.id.entrust_record_tab_listview);
mListViewAdapter = new ManagerConsumableOrdersListViewAdapter(mContext, mLists, 0);
mListViewAdapter.setonClick(new ICoallBack5() {
@Override
public void onClickCheckbox(boolean flag) {
//无
}
@Override
public void doConfirm(int pos) {
//确定 按钮
}
@Override
public void doFaild(int pos) {
//失败按钮
//int h = Tools.setListViewHeightBasedOnChildren(mListView);
showFaildDialog(pos);
}
});
mListViewAdapter.setListView(mListView);
mListView.setAdapter(mListViewAdapter);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(mContext, ManagerDeclareOrderDetailAct.class);
intent.putExtra("data", mLists.get(position));
startActivity(intent);
}
});
}
private void showFaildDialog(int position) {
final DeliveryFaildDialog dialog = new DeliveryFaildDialog(mContext, position, R.style.CustomDialog);
dialog.show();
dialog.setClicklistener(new DeliveryFaildDialog.ClickListenerInterface() {
@Override
public void doConfirm(int position, String str) {
// TODO Auto-generated method stub
dialog.closeDialog();
mListViewAdapter.updateItemFaild(position, str);
//int h = Tools.setListViewHeightBasedOnChildren(mListView);
mListView.requestLayout();
}
@Override
public void doCancel() {
// TODO Auto-generated method stub
dialog.closeDialog();
}
});
}
}
| [
"123456"
] | 123456 |
e139c19b9a79463d666045edb98331452cfb96b1 | c151dfc32cff22ec705562027b10679105463251 | /src/main/java/org/asmatron/messengine/annotations/ActionMethod.java | 3060f11af36f2815f53f4f04a5855b89698a06cf | [] | no_license | emoranchel/messengine | 988556a2a8dd7ffa04ea611874b810e5402967c7 | d421a77c853a08281787d7f11060be696e14acd8 | refs/heads/master | 2021-12-14T13:23:48.359745 | 2021-12-11T19:27:45 | 2021-12-11T19:27:45 | 33,387,283 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package org.asmatron.messengine.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ActionMethod {
String value();
}
| [
"emoranchel@gmail.com@befcc700-846b-ab0b-a1ec-da6099684dbc"
] | emoranchel@gmail.com@befcc700-846b-ab0b-a1ec-da6099684dbc |
d486898f5120088b082ecacb471d383b93f85360 | 5a9b8e800fd0a3bcd6907ebc98060ec3c4ec5183 | /app/src/test/java/com/apress/gerber/scarnesdice/ExampleUnitTest.java | b22a27f09167090c947344bd6845153445d80ee8 | [] | no_license | JohnCover/GoogleAppliedCS | 0ee8bdd14b7c2d9f5981a67a68e11fa31a079b43 | 61d556cce07b521984d6e64c61faa52ce93de276 | refs/heads/master | 2021-01-19T17:30:09.997087 | 2017-04-15T04:46:56 | 2017-04-15T04:46:56 | 88,324,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package com.apress.gerber.scarnesdice;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"John Cover"
] | John Cover |
d40712c932ed28d9a96b908799b4307b906e3dff | 592f9b5c8d42272229184eba89dae4eb8501c036 | /src/main/java/com/project/shop/model/Requests/User/SetUserRoleRequest.java | e7409d94adcc24ca7e7f8339fef5edba2763738e | [] | no_license | ristovkiril/shop | f1ad9093ae9347231671e8870e893ce5042568aa | ec50ed4eb2223afede5408f6e529fb71bc29a127 | refs/heads/master | 2023-08-05T05:00:01.488631 | 2020-05-12T22:04:48 | 2020-05-12T22:04:48 | 255,172,338 | 0 | 0 | null | 2021-09-21T12:33:56 | 2020-04-12T21:21:30 | JavaScript | UTF-8 | Java | false | false | 245 | java | package com.project.shop.model.Requests.User;
import com.project.shop.model.Enum.Roles;
import lombok.Getter;
import lombok.Setter;
import java.util.UUID;
@Getter
@Setter
public class SetUserRoleRequest {
UUID userId;
Roles role;
}
| [
"ristov.kiril@yahoo.com"
] | ristov.kiril@yahoo.com |
b1700220ed23a1c80e8bbcf40f94510051e31fc7 | 2c9046be5a54ff1b6d4187827b359eb6d6a2eebc | /implementations/sponge-7.2.0/src/main/java/de/bluecolored/bluemap/sponge/SpongePlayer.java | 4ac33aa3f79b4c60741940d1f99b63943942c251 | [
"MIT"
] | permissive | OskarZyg/BlueMap-UI | aa270287d8aaeb8750bf5d8301849bef48d5c982 | 7fa4a69b029726012f8a1695bd4d0c9fb30caa68 | refs/heads/master | 2023-02-22T06:52:01.118927 | 2021-01-28T17:30:46 | 2021-01-28T17:30:46 | 327,141,114 | 1 | 0 | MIT | 2021-01-28T17:30:47 | 2021-01-05T23:01:11 | Java | UTF-8 | Java | false | false | 4,340 | java | /*
* This file is part of BlueMap, licensed under the MIT License (MIT).
*
* Copyright (c) Blue (Lukas Rieger) <https://bluecolored.de>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.bluecolored.bluemap.sponge;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.effect.potion.PotionEffect;
import org.spongepowered.api.effect.potion.PotionEffectTypes;
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.common.plugin.serverinterface.Gamemode;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.text.Text;
public class SpongePlayer implements Player {
private static final Map<GameMode, Gamemode> GAMEMODE_MAP = new HashMap<>(5);
static {
GAMEMODE_MAP.put(GameModes.ADVENTURE, Gamemode.ADVENTURE);
GAMEMODE_MAP.put(GameModes.SURVIVAL, Gamemode.SURVIVAL);
GAMEMODE_MAP.put(GameModes.CREATIVE, Gamemode.CREATIVE);
GAMEMODE_MAP.put(GameModes.SPECTATOR, Gamemode.SPECTATOR);
GAMEMODE_MAP.put(GameModes.NOT_SET, Gamemode.SURVIVAL);
}
private UUID uuid;
private Text name;
private UUID world;
private Vector3d position;
private boolean online;
private boolean sneaking;
private boolean invisible;
private Gamemode gamemode;
public SpongePlayer(UUID playerUUID) {
this.uuid = playerUUID;
update();
}
@Override
public UUID getUuid() {
return this.uuid;
}
@Override
public Text getName() {
return this.name;
}
@Override
public UUID getWorld() {
return this.world;
}
@Override
public Vector3d getPosition() {
return this.position;
}
@Override
public boolean isOnline() {
return this.online;
}
@Override
public boolean isSneaking() {
return this.sneaking;
}
@Override
public boolean isInvisible() {
return this.invisible;
}
@Override
public Gamemode getGamemode() {
return this.gamemode;
}
/**
* API access, only call on server thread!
*/
public void update() {
org.spongepowered.api.entity.living.player.Player player = Sponge.getServer().getPlayer(uuid).orElse(null);
if (player == null) {
this.online = false;
return;
}
this.gamemode = GAMEMODE_MAP.get(player.get(Keys.GAME_MODE).orElse(GameModes.NOT_SET));
if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL;
boolean invis = player.get(Keys.VANISH).orElse(false);
if (!invis && player.get(Keys.INVISIBLE).orElse(false)) invis = true;
if (!invis) {
Optional<List<PotionEffect>> effects = player.get(Keys.POTION_EFFECTS);
if (effects.isPresent()) {
for (PotionEffect effect : effects.get()) {
if (effect.getType().equals(PotionEffectTypes.INVISIBILITY) && effect.getDuration() > 0) invis = true;
}
}
}
this.invisible = invis;
this.name = Text.of(player.getName());
this.online = player.isOnline();
this.position = player.getPosition();
this.sneaking = player.get(Keys.IS_SNEAKING).orElse(false);
this.world = player.getWorld().getUniqueId();
}
}
| [
"blue@bluecolored.de"
] | blue@bluecolored.de |
af4339f36c424fd2521dd4f506691207285887d0 | 7abce49519c252b2d048bc3fb5d7fd12b943bbbf | /Re-searcher/src_tests/researcher/test/utils/Stuff.java | ffada2b55d794bba052b55e3653e04ac229fd5df | [] | no_license | vrepsys/researcher | 3802da3d7285412de5262027c7c1a3d64ac36d5a | 93e1b5eac42f24a5729c434b70434d268f9b476f | refs/heads/master | 2021-01-23T12:16:51.765648 | 2012-10-12T12:59:46 | 2012-10-12T12:59:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package researcher.test.utils;
import org.apache.log4j.Logger;
public class Stuff {
public static Logger log = Logger.getLogger("testlog");
}
| [
"valdemaras@gmail.com"
] | valdemaras@gmail.com |
98504fecdb5cc00a31ba03e7177ac84a8704e05c | 3c32ee2b9aff949872a7abafbef9e6b75aebfdab | /Homework7/src/InsuranceApp.java | bf5a593abc689974ea24ac5b4c2c7991bf462aef | [] | no_license | dcazales/ObjectO | 2a76955d84642e021abd5aac0ca5bb8c53c3d450 | 8cefa4755fb406f4e288472af29e22815a3f9d0b | refs/heads/master | 2020-08-30T14:02:35.971896 | 2019-11-18T23:09:50 | 2019-11-18T23:09:50 | 218,402,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,969 | java | import java.util.Scanner;
import java.util.ArrayList;
//Presents a welcome message
public class InsuranceApp {
public static void printStars(int howMany) {
String stars = "";
for (int i = 0; i < howMany; i++) {
stars = stars + "*";
}
System.out.println(stars);
}
public static void printWelcome() {
printStars(58);
System.out.print("\t\tINSURANCE SCORE CARD \n This app scores a potential customer on various health \n"
+ "attributes: blood pressure, age, height, weight, and\n" +
"family history of disease. It writes each member's \n"
+ "insurance grade to a JSON file so that they can be easily\n "
+ "shared on a web based data exchange! \n");
printStars(58);
}
public static void showMenu() {
System.out.println("\n");
System.out.println("Here are your choices: \n");
System.out.println("\t1. List Members:");
System.out.println("\t2. Add a new member");
System.out.println("\t3. Save members");
System.out.println("\t4. Load members");
System.out.println("\t5. Assess members:");
System.out.println("\t6. Save assessments as JSON, ");
System.out.println("\t7. Exit");
System.out.print("Enter the number of your choice:");
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter name of data file: ");
String filename = sc.nextLine();
ArrayList<Member>members = MemberReader.readMembersFromTextFile(filename);
int choice; //for the menu
if (members == null) {
System.out.println("Something bad happened, try again.");
}else {
printWelcome();
do {
showMenu();
choice = sc.nextInt();
System.out.println("");
//Choices begin *_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*
if (choice == 1) {
System.out.print("Here are all of the Memebers: \n\n");
InsuranceScoreWriter.writeMembersToScreen(members);
} else if (choice == 2) {
}
else if (choice == 3) {
}
else if (choice == 4) {
}
else if (choice == 5) {
}
}
while (choice != 6);
System.out.println("Have a good day.");
}
}
}
| [
"dianacazales"
] | dianacazales |
d23418aeea8dfc47042721aff9e08de7f89b950b | 14a9b74d81d6c987cd0f7c9c8a0c94fae5105517 | /jeebiz-admin-extras/jeebiz-admin-extras-xxljob/src/main/java/net/jeebiz/admin/extras/xxljob/service/IXxlJobService.java | 6dc923c888c918087cfba9610b4449f77581f633 | [
"Apache-2.0"
] | permissive | p2a8t4a5a/jeebiz-admin | 5c228df410369cf5051bfebc002f5c735c98b22a | c0ebb51432683b98a9bd2b0eb6b71ba7e8842789 | refs/heads/master | 2023-08-26T10:09:09.488500 | 2021-11-11T16:22:22 | 2021-11-11T16:22:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,502 | java | package net.jeebiz.admin.extras.xxljob.service;
import com.xxl.job.core.biz.model.ReturnT;
import net.jeebiz.admin.extras.xxljob.dao.entities.XxlJobInfo;
import java.util.Date;
import java.util.Map;
/**
* core job action for xxl-job
*
* @author xuxueli 2016-5-28 15:30:33
*/
public interface IXxlJobService {
/**
* page list
*
* @param start
* @param length
* @param jobGroup
* @param jobDesc
* @param executorHandler
* @param author
* @return
*/
public Map<String, Object> pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author);
/**
* add job
*
* @param jobInfo
* @return
*/
public ReturnT<String> addOrUpdate(XxlJobInfo jobInfo);
/**
* add job
*
* @param jobInfo
* @return
*/
public ReturnT<String> add(XxlJobInfo jobInfo);
/**
* update job
*
* @param jobInfo
* @return
*/
public ReturnT<String> update(XxlJobInfo jobInfo);
/**
* remove job
* *
* @param id
* @return
*/
public ReturnT<String> remove(int id);
/**
* start job
*
* @param id
* @return
*/
public ReturnT<String> start(int id);
/**
* stop job
*
* @param id
* @return
*/
public ReturnT<String> stop(int id);
/**
* dashboard info
*
* @return
*/
public Map<String,Object> dashboardInfo();
/**
* chart info
*
* @param startDate
* @param endDate
* @return
*/
public ReturnT<Map<String,Object>> chartInfo(Date startDate, Date endDate);
}
| [
"hnxxyhcwdl1003@163.com"
] | hnxxyhcwdl1003@163.com |
6abb727bee1a765787a989eaa671289f488d5505 | c03939dda47ae7da546cbd2ef0e012dcfadd6ce9 | /src/main/java/fr/formation/security/UserDetailsServiceImpl.java | d3338c96fe9ed17b0c1ef86ab4479554292c3fcb | [] | no_license | Y-Shak/hotel | f3fe183150d2a84ef5cb17b449c1ebddcd2bec46 | 6be6a9c20013d585a86fd635eea67a592a3bf521 | refs/heads/master | 2023-08-13T21:22:35.788351 | 2021-10-12T15:24:14 | 2021-10-12T15:24:14 | 414,945,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 945 | java | package fr.formation.security;
import fr.formation.entities.AdminEntity;
import fr.formation.repository.AdminRepository;
import fr.formation.services.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
@Autowired
AdminService adminService;
@Override
public UserDetailsImpl loadUserByUsername(String usernameField ) throws
UsernameNotFoundException {
AdminEntity user = adminService.findByUsername(usernameField);
if(user == null) {
throw new UsernameNotFoundException("No user named " + usernameField);
} else {
return new UserDetailsImpl(user);
}
}
}
| [
""
] | |
3da6b043cfbc3432a6338493051e99bbc406b8dd | 2ba5d0096accdace51d0fd6219f0e71427bc2a8d | /app/src/main/java/com/idcg/idcw/model/bean/WalletAssetBean.java | 626df96f21f773ca10b644735d3ab110f87fe7fe | [] | no_license | yuzhongrong/IDCWallet | 37039027ebbe43cba11ea9781252f4f42fbae93d | 5cb9eee648ec54ad1e34ff1f778bf0961348c464 | refs/heads/master | 2020-03-26T21:33:28.068458 | 2018-08-20T09:17:39 | 2018-08-20T09:17:39 | 145,394,740 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,198 | java | package com.idcg.idcw.model.bean;
import java.io.Serializable;
/**
* 作者:hxy
* 电话:13891436532
* 邮箱:hua.xiangyang@shuweikeji.com
* 版本号:1.0
* 类描述:FoxIDCW com.idcg.idcw.model.params ${CLASS_NAME}
* 备注消息:
* 修改时间:2018/3/16 10:45
**/
public class WalletAssetBean implements Serializable {
/**
* id : 2180
* wallet_type : btc
* label : My Bitcoin Wallet
* balance : 22000.04183752
* realityBalance : 22000.04183752
* currency_unit : btc
* currency : btc
* currencyName : Bitcoin
* logo : /upload/coin/ico_btc.png
* localCurrencyName : USD
* currencySymbol : $
* localCurrencyMarket : 10573.0
* sortIndex : 0
*/
private int id;
private String wallet_type;
private String label;
private double balance;
private double realityBalance;
private String currency_unit;
private String currency;
private String currencyName;
private String logo;
private String logo_url;
private String localCurrencyName;
private String currencySymbol;
private double localCurrencyMarket;
private int sortIndex;
private boolean isSelect = false;
private int currencyLayoutType;
private boolean is_enable_ransceiver;
public String getLogo_url() {
return logo_url;
}
public void setLogo_url(String logo_url) {
this.logo_url = logo_url;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getWallet_type() {
return wallet_type;
}
public void setWallet_type(String wallet_type) {
this.wallet_type = wallet_type;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public double getRealityBalance() {
return realityBalance;
}
public void setRealityBalance(double realityBalance) {
this.realityBalance = realityBalance;
}
public String getCurrency_unit() {
return currency_unit;
}
public void setCurrency_unit(String currency_unit) {
this.currency_unit = currency_unit;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getCurrencyName() {
return currencyName;
}
public void setCurrencyName(String currencyName) {
this.currencyName = currencyName;
}
public String getLogo() {
return logo;
}
public void setLogo(String logo) {
this.logo = logo;
}
public String getLocalCurrencyName() {
return localCurrencyName;
}
public void setLocalCurrencyName(String localCurrencyName) {
this.localCurrencyName = localCurrencyName;
}
public String getCurrencySymbol() {
return currencySymbol;
}
public void setCurrencySymbol(String currencySymbol) {
this.currencySymbol = currencySymbol;
}
public double getLocalCurrencyMarket() {
return localCurrencyMarket;
}
public void setLocalCurrencyMarket(double localCurrencyMarket) {
this.localCurrencyMarket = localCurrencyMarket;
}
public int getSortIndex() {
return sortIndex;
}
public void setSortIndex(int sortIndex) {
this.sortIndex = sortIndex;
}
public boolean isSelect() {
return isSelect;
}
public void setSelect(boolean select) {
isSelect = select;
}
public int getCurrencyLayoutType() {
return currencyLayoutType;
}
public void setCurrencyLayoutType(int currencyLayoutType) {
this.currencyLayoutType = currencyLayoutType;
}
public boolean isIs_enable_ransceiver() {
return is_enable_ransceiver;
}
public void setIs_enable_ransceiver(boolean is_enable_ransceiver) {
this.is_enable_ransceiver = is_enable_ransceiver;
}
}
| [
"Zhongrong.Yu@lavainternational.com"
] | Zhongrong.Yu@lavainternational.com |
71e48d5c846d41ad70b366d9472b937584c3b2e3 | b5058a6c70ddcacdaa225799371ee17eb7e91354 | /src/main/java/com/xinfan/wxshop/business/vo/GoodsTypeTree.java | 87988b6b181a4691bdbdc91613678062425f9541 | [
"Apache-2.0"
] | permissive | sodoa/shop2 | 46d5109497a009dc34cf7d0fec0677a6f682b13b | 678e658ad366b1cc445d4f36d0d667c300d4039a | refs/heads/master | 2021-01-21T04:50:19.875220 | 2016-07-03T11:27:55 | 2016-07-03T11:27:55 | 52,521,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package com.xinfan.wxshop.business.vo;
public class GoodsTypeTree {
}
| [
"165614968@qq.com"
] | 165614968@qq.com |
641d40bfa28149973c302a93298adfc5c9f90331 | df134b422960de6fb179f36ca97ab574b0f1d69f | /io/netty/channel/MessageSizeEstimator.java | 72548b6fdd705326801791b14458d48ce137db14 | [] | no_license | TheShermanTanker/NMS-1.16.3 | bbbdb9417009be4987872717e761fb064468bbb2 | d3e64b4493d3e45970ec5ec66e1b9714a71856cc | refs/heads/master | 2022-12-29T15:32:24.411347 | 2020-10-08T11:56:16 | 2020-10-08T11:56:16 | 302,324,687 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package io.netty.channel;
public interface MessageSizeEstimator {
Handle newHandle();
public static interface Handle {
int size(Object param1Object);
}
}
/* Location: C:\Users\Josep\Downloads\Decompile Minecraft\tuinity-1.16.3.jar!\io\netty\channel\MessageSizeEstimator.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ | [
"tanksherman27@gmail.com"
] | tanksherman27@gmail.com |
785e7e160d63e6e6150ee443fcaf32e1d67bad6a | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a050/A050898Test.java | 8ceb0a033de1c1ebb155f556d96769ed2c1f996a | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 255 | java | package irvine.oeis.a050;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A050898Test extends AbstractSequenceTest {
@Override
protected int maxTerms() {
return 2;
}
}
| [
"sean.irvine@realtimegenomics.com"
] | sean.irvine@realtimegenomics.com |
0e55dfbc19c013eed6fde6c17e116fc351f26623 | 6bcc61044db6d7b652ecc3f3a5b8d9344b825cab | /app/src/main/java/com/gmail/fattazzo/activeandroidexample/db/models/library/Autore.java | 8cbadafef7516f2e61d81473ef47a9c9580a6727 | [] | no_license | fattazzo/active-android-example | c08bf664d5e811c2e315053c399a0f369a38b91e | f1fb66e10ca7821fd37e96891290c9cebc600db7 | refs/heads/master | 2021-04-12T05:52:35.565424 | 2018-04-11T19:16:10 | 2018-04-11T19:16:10 | 125,926,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package com.gmail.fattazzo.activeandroidexample.db.models.library;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
/**
* @author fattazzo
* <p/>
* date: 21/03/18
*/
@Table(name = "autori")
public class Autore extends Model {
@Column
private String nome;
@Column
private String cognome;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCognome() {
return cognome;
}
public void setCognome(String cognome) {
this.cognome = cognome;
}
}
| [
"fattazzo82@gmail.com"
] | fattazzo82@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.