blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0f61d90ed78b4fad9e19d7d2fa289a0dd1e12894 | 81381d89aeab7b162e70086c2f124d948c427af9 | /ChampChat/src/main/java/com/valge/champchat/util/DbAdapter.java | 244cf79f6f7110cbbdec388aa4b900a2472c9729 | [] | no_license | albertwidi/Walrus-Messenger | 0f0b109160fee17a88f809cd6a468b04a5be0646 | 9a1f43a429e2933b44734bfd92f8c6affa81af6d | refs/heads/master | 2021-05-27T09:11:15.622274 | 2014-02-22T12:28:18 | 2014-02-22T12:28:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,629 | java | package com.valge.champchat.util;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.io.File;
/**
* Created by Albert Widiatmoko on 07/12/13.
*/
public class DbAdapter {
private SQLiteDatabase db;
private DbHelper dbHelper;
Context appContext;
public DbAdapter(Context context) {
System.out.println("Db adapter");
dbHelper = new DbHelper(context);
appContext = context;
}
public void openConnection() {
if(db != null) {
if(db.isOpen()) {
return;
}
}
db = dbHelper.getWritableDatabase();
}
public void finalize() throws Throwable{
super.finalize();
closeConnection();
}
public void closeConnection() {
try {
db.close();
}
catch(Exception e) {
}
}
public boolean registerUser(int userId, String phoneNumber, String userName, String gcmId, String secretKey, byte[] privateKey) {
openConnection();
ContentValues values = new ContentValues();
values.put(DbHelper.COLUMN_USER_ID, userId);
values.put(DbHelper.COLUMN_USER_NAME, userName);
values.put(DbHelper.COLUMN_USER_PHONE_NUMBER, phoneNumber);
values.put(DbHelper.COLUMN_USER_GCM_ID, gcmId);
//values.put(DbHelper.COLUMN_USER_PHONE_NUMBER, DatabaseUtils.sqlEscapeString(phoneNumber));
//values.put(DbHelper.COLUMN_USER_GCM_ID, DatabaseUtils.sqlEscapeString(gcmId));
values.put(DbHelper.COLUMN_SECRET_PASS, secretKey);
values.put(DbHelper.COLUMN_PRIVATE_KEY, privateKey);
long id = db.insert(DbHelper.TABLE_USERDAT, null, values);
closeConnection();
if(id == -1) {
return false;
}
return true;
}
public boolean updatePrivateKey(int userId, byte[] privateKey) {
openConnection();
ContentValues values = new ContentValues();
String[] selectionArg = {String.valueOf(userId)};
values.put(DbHelper.COLUMN_PRIVATE_KEY, privateKey);
long id = db.update(DbHelper.TABLE_USERDAT,
values,
DbHelper.COLUMN_USER_ID + " = ?",
selectionArg);
if(id == -1) {
closeConnection();
return false;
}
closeConnection();
return true;
}
public void deleteRegisteredUser(String phoneNumber) {
openConnection();
db.delete(DbHelper.TABLE_USERDAT, DbHelper.COLUMN_USER_PHONE_NUMBER + " = " + phoneNumber, null);
return;
}
public boolean saveFriend(int friendId, String name, String phoneNumber, byte[] publicKey) {
openConnection();
//check if friend already exists
String[] columns = {DbHelper.COLUMN_FRIEND_PHONE_NUMBER};
String[] selectionArg = {phoneNumber};
//String[] selectionArg = {DatabaseUtils.sqlEscapeString(phoneNumber)};
Cursor cursor = db.query(DbHelper.TABLE_FRIEND_LIST,
columns,
DbHelper.COLUMN_FRIEND_ID + " = ?",
selectionArg, null, null, null);
if(cursor.getCount() > 0) {
ContentValues values = new ContentValues();
values.put(DbHelper.COLUMN_FRIEND_NAME, name);
//values.put(DbHelper.COLUMN_FRIEND_GCM_ID, DatabaseUtils.sqlEscapeString(gcmId));
values.put(DbHelper.COLUMN_FRIEND_PUBLIC_KEY, publicKey);
long id = db.update(DbHelper.TABLE_FRIEND_LIST,
values,
DbHelper.COLUMN_FRIEND_ID + " = ?",
selectionArg);
if(id == -1) {
cursor.close();
closeConnection();
return false;
}
}
else {
ContentValues values = new ContentValues();
values.put(DbHelper.COLUMN_FRIEND_ID, friendId);
values.put(DbHelper.COLUMN_FRIEND_NAME, name);
values.put(DbHelper.COLUMN_FRIEND_PHONE_NUMBER, phoneNumber);
values.put(DbHelper.COLUMN_FRIEND_PUBLIC_KEY, publicKey);
long id = db.insert(DbHelper.TABLE_FRIEND_LIST, null, values);
if(id == -1) {
cursor.close();
closeConnection();
return false;
}
}
cursor.close();
closeConnection();
return true;
}
public boolean updateFriend(String name, String phoneNumber, byte[] publicKey) {
openConnection();
ContentValues values = new ContentValues();
String[] selectionArg = {phoneNumber};
//String[] selectionArg = {DatabaseUtils.sqlEscapeString(phoneNumber)};
values.put(DbHelper.COLUMN_FRIEND_NAME, name);
//values.put(DbHelper.COLUMN_FRIEND_GCM_ID, DatabaseUtils.sqlEscapeString(gcmId));
values.put(DbHelper.COLUMN_FRIEND_PUBLIC_KEY, publicKey);
long id = db.update(DbHelper.TABLE_FRIEND_LIST,
values,
DbHelper.COLUMN_FRIEND_PHONE_NUMBER + " = ?",
selectionArg);
if(id == -1) {
closeConnection();
return false;
}
closeConnection();
return true;
}
public Cursor getFriends() {
openConnection();
String query = "SELECT * FROM " + DbHelper.TABLE_FRIEND_LIST;
Cursor cursor = db.rawQuery(query, null);
//closeConnection();
return cursor;
}
public Cursor getFriendInfo(String filter, String filterSelection) {
openConnection();
String[] columns = {DbHelper.COLUMN_FRIEND_NAME,
DbHelper.COLUMN_FRIEND_PUBLIC_KEY,};
String[] selectionArg = {filter};
//String[] selectionArg = {DatabaseUtils.sqlEscapeString(filter)};
Cursor cursor = null;
if(filterSelection.equalsIgnoreCase("phonenumber")) {
cursor = db.query(DbHelper.TABLE_FRIEND_LIST,
columns,
DbHelper.COLUMN_FRIEND_PHONE_NUMBER + " = ?",
selectionArg, null, null, DbHelper.COLUMN_ID);
}
else if(filterSelection.equalsIgnoreCase("friendid")) {
cursor = db.query(DbHelper.TABLE_MESSAGE_HISTORY,
columns,
DbHelper.COLUMN_FRIEND_ID + " = ?",
selectionArg, null, null, DbHelper.COLUMN_ID);
}
return cursor;
}
public Cursor getFriendInfo(int friendId) {
openConnection();
String[] columns = {DbHelper.COLUMN_FRIEND_NAME,
DbHelper.COLUMN_FRIEND_PHONE_NUMBER,
DbHelper.COLUMN_FRIEND_PUBLIC_KEY,};
String[] selectionArg = {String.valueOf(friendId)};
//String[] selectionArg = {DatabaseUtils.sqlEscapeString(filter)};
Cursor cursor;
cursor = db.query(DbHelper.TABLE_FRIEND_LIST,
columns,
DbHelper.COLUMN_FRIEND_ID + " = ?",
selectionArg, null, null, DbHelper.COLUMN_ID);
return cursor;
}
//message
public long saveMessage(int friendId, String phoneNumber, String friendName, String message, String date, String time, String status, String mode, int historyMode) {
openConnection();
ContentValues values = new ContentValues();
values.put(DbHelper.COLUMN_MESSAGE_WITH_ID, friendId);
values.put(DbHelper.COLUMN_MESSAGE_WITH, phoneNumber);
values.put(DbHelper.COLUMN_MESSAGE_FROM, friendName);
values.put(DbHelper.COLUMN_MESSAGE, message);
values.put(DbHelper.COLUMN_MESSAGE_STATUS, status);
values.put(DbHelper.COLUMN_MESSAGE_TIME_DATE, date);
values.put(DbHelper.COLUMN_MESSAGE_TIME_TIME, time);
values.put(DbHelper.COLUMN_MESSAGE_MODE, mode);
values.put(DbHelper.COLUMN_MESSAGE_HISTORYMODE, historyMode);
long id = db.insert(DbHelper.TABLE_MESSAGE_HISTORY, null, values);
closeConnection();
return id;
}
public boolean updateMessage(long insertId, String status) {
openConnection();
ContentValues values = new ContentValues();
String[] selectionArg = {String.valueOf(insertId)};
values.put(DbHelper.COLUMN_MESSAGE_STATUS, status);
long id = db.update(DbHelper.TABLE_MESSAGE_HISTORY,
values,
DbHelper.COLUMN_ID + " = ?",
selectionArg);
if(id == -1) {
closeConnection();
return false;
}
closeConnection();
return true;
}
public Cursor getAllMessage() {
openConnection();
String[] columns = {DbHelper.COLUMN_MESSAGE,
DbHelper.COLUMN_MESSAGE_FROM,
DbHelper.COLUMN_MESSAGE_WITH_ID,
DbHelper.COLUMN_MESSAGE_TIME_DATE,
DbHelper.COLUMN_MESSAGE_TIME_TIME,
DbHelper.COLUMN_MESSAGE_TIME_TIMESTAMP};
String query = "SELECT * FROM " + DbHelper.TABLE_MESSAGE_HISTORY;
Cursor cursor = db.rawQuery(query, null);
return cursor;
}
public Cursor getWhoMessage() {
openConnection();
String[] columns = {DbHelper.COLUMN_MESSAGE_WITH_ID};
Cursor cursor = db.query(DbHelper.TABLE_MESSAGE_HISTORY,
columns,
null,
null,
DbHelper.COLUMN_MESSAGE_WITH, null, null);
return cursor;
}
public Cursor getMessage(String friendId) {
openConnection();
String[] columns = {DbHelper.COLUMN_MESSAGE,
DbHelper.COLUMN_ID,
DbHelper.COLUMN_MESSAGE_FROM,
DbHelper.COLUMN_MESSAGE_STATUS,
DbHelper.COLUMN_MESSAGE_MODE,
DbHelper.COLUMN_MESSAGE_TIME_DATE,
DbHelper.COLUMN_MESSAGE_TIME_TIME,
DbHelper.COLUMN_MESSAGE_TIME_TIMESTAMP};
String[] selectionArg = {friendId};
Cursor cursor = db.query(DbHelper.TABLE_MESSAGE_HISTORY,
columns,
DbHelper.COLUMN_MESSAGE_WITH_ID + " = ?",
selectionArg, null, null, DbHelper.COLUMN_ID);
return cursor;
}
public Cursor getFriendLastMessage(String friendId) {
openConnection();
String[] columns = {DbHelper.COLUMN_MESSAGE,
DbHelper.COLUMN_MESSAGE_FROM,
DbHelper.COLUMN_MESSAGE_TIME_DATE,
DbHelper.COLUMN_MESSAGE_TIME_TIME,
DbHelper.COLUMN_MESSAGE_TIME_TIMESTAMP};
String[] selectionArg = {friendId};
Cursor cursor = db.query(DbHelper.TABLE_MESSAGE_HISTORY,
columns,
DbHelper.COLUMN_MESSAGE_WITH_ID + " = ?",
selectionArg, null, null, DbHelper.COLUMN_ID + " DESC", "1");
return cursor;
}
public boolean deleteMessage(long id) {
if(id == 0) {
return true;
}
openConnection();
long deleteId = db.delete(DbHelper.TABLE_MESSAGE_HISTORY, DbHelper.COLUMN_ID + " = " + id, null);
closeConnection();
if(deleteId == -1) {
return false;
}
return true;
}
public boolean deleteAllMessage(int friendId) {
openConnection();
long deleteId = db.delete(DbHelper.TABLE_MESSAGE_HISTORY, DbHelper.COLUMN_MESSAGE_WITH_ID + " = " + friendId, null);
closeConnection();
if(deleteId == -1) {
return false;
}
return true;
}
public boolean deleteMessageWithNoHistory(int friendId) {
openConnection();
String[] selectionArg = {String.valueOf(friendId), "0"};
long deleteId = db.delete(DbHelper.TABLE_MESSAGE_HISTORY, DbHelper.COLUMN_MESSAGE_WITH_ID + " = ? AND " + DbHelper.COLUMN_MESSAGE_HISTORYMODE + " = ?", selectionArg);
closeConnection();
if(deleteId == -1) {
System.out.println("Cannot delete message history");
return false;
}
return true;
}
public void saveChatThread(int friendId) {
openConnection();
//check
String[] columns = {DbHelper.COLUMN_FRIEND_THREAD_ID};
String[] selectionArg = {String.valueOf(friendId)};
//String[] selectionArg = {DatabaseUtils.sqlEscapeString(filter)};
Cursor cursor;
cursor = db.query(DbHelper.TABLE_CHAT_THREAD,
columns,
DbHelper.COLUMN_FRIEND_THREAD_ID + " = ?",
selectionArg, null, null, DbHelper.COLUMN_ID);
if(cursor.getCount() > 0) {
cursor.moveToFirst();
int id = cursor.getInt(cursor.getColumnIndex(DbHelper.COLUMN_FRIEND_THREAD_ID));
String[] updateArg = {String.valueOf(id)};
ContentValues values = new ContentValues();
values.put(DbHelper.COLUMN_TIMESTAMP_THREAD, " time('now') ");
long updateId = db.update(DbHelper.TABLE_CHAT_THREAD,
values,
DbHelper.COLUMN_FRIEND_THREAD_ID + " = ?",
updateArg);
cursor.close();
return;
}
//save
ContentValues values = new ContentValues();
values.put(DbHelper.COLUMN_FRIEND_THREAD_ID, friendId);
long id = db.insert(DbHelper.TABLE_CHAT_THREAD, null, values);
cursor.close();
closeConnection();
}
public Cursor getChatThread() {
openConnection();
String[] columns = {DbHelper.COLUMN_FRIEND_THREAD_ID};
Cursor cursor = db.query(DbHelper.TABLE_CHAT_THREAD,
columns,
null,
null, null, null, DbHelper.COLUMN_TIMESTAMP_THREAD + " DESC", null);
return cursor;
}
public boolean deleteChatThread(int friendId) {
openConnection();
long deleteIdThread = db.delete(DbHelper.TABLE_CHAT_THREAD, DbHelper.COLUMN_FRIEND_THREAD_ID + " = " + friendId, null);
long deleteIdChat = db.delete(DbHelper.TABLE_MESSAGE_HISTORY, DbHelper.COLUMN_MESSAGE_WITH_ID + " = " + friendId, null);
closeConnection();
if(deleteIdThread == -1 || deleteIdChat == -1) {
return false;
}
return true;
}
public boolean databaseExists() {
File database = appContext.getDatabasePath(DbHelper.DATABASE_NAME);
return database.exists();
}
public String unescapeSqlString(String escapedString) {
return escapedString.substring(1, escapedString.length()-1);
}
//dbhelper class
public class DbHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 3;
private static final String DATABASE_NAME = "EAndroidIM.db";
public static final String COLUMN_ID = "_id";
//table user data
public static final String TABLE_USERDAT = "userdat";
public static final String COLUMN_USER_ID = "userid";
public static final String COLUMN_USER_PHONE_NUMBER = "userphonenum";
public static final String COLUMN_USER_NAME = "username";
public static final String COLUMN_USER_GCM_ID = "usergcmid";
public static final String COLUMN_SECRET_PASS = "usersecpass";
public static final String COLUMN_PRIVATE_KEY = "privatekey";
//table friend list
public static final String TABLE_FRIEND_LIST = "friendlist";
public static final String COLUMN_FRIEND_ID = "friendid";
public static final String COLUMN_FRIEND_NAME = "friendname";
public static final String COLUMN_FRIEND_PHONE_NUMBER = "fphonenum";
public static final String COLUMN_FRIEND_PUBLIC_KEY = "fpublic";
//table message history
public static final String TABLE_MESSAGE_HISTORY = "msghistory";
public static final String COLUMN_MESSAGE_WITH_ID = "chatwithid";
public static final String COLUMN_MESSAGE_WITH = "chatwith";
public static final String COLUMN_MESSAGE_FROM = "msgfrom";
public static final String COLUMN_MESSAGE = "msgstring";
public static final String COLUMN_MESSAGE_MODE = "msgmode";
public static final String COLUMN_MESSAGE_TIME_DATE = "msgtimedate";
public static final String COLUMN_MESSAGE_TIME_TIME = "msgtimetime";
public static final String COLUMN_MESSAGE_TIME_TIMESTAMP = "msgtimestamp";
public static final String COLUMN_MESSAGE_STATUS = "msgstatus";
public static final String COLUMN_MESSAGE_HISTORYMODE = "msghistorymode";
//table block
public static final String TABLE_ID_BLOCK = "idblock";
public static final String COLUMN_BLOCKED_ID = "blockedid";
//table available chat thread
public static final String TABLE_CHAT_THREAD = "chatthread";
public static final String COLUMN_FRIEND_THREAD_ID = "friendthreadid";
public static final String COLUMN_TIMESTAMP_THREAD = "timestampthread";
//creating table
public static final String TABLE_CREATE_USERDAT = "CREATE TABLE " + TABLE_USERDAT + " (" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_USER_ID + " NUMBER NOT NULL, " +
COLUMN_USER_PHONE_NUMBER + " TEXT NOT NULL, " +
COLUMN_USER_NAME + " TEXT NOT NULL, " +
COLUMN_USER_GCM_ID + " TEXT NOT NULL, " +
COLUMN_SECRET_PASS + " TEXT NOT NULL, " +
COLUMN_PRIVATE_KEY + " BLOB NOT NULL);";
public static final String TABLE_CREATE_FRIEND_LIST = "CREATE TABLE " + TABLE_FRIEND_LIST + " (" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_FRIEND_ID + " NUMBER NOT NULL, " +
COLUMN_FRIEND_PHONE_NUMBER + " TEXT NOT NULL, " +
COLUMN_FRIEND_NAME + " TEXT NOT NULL, " +
COLUMN_FRIEND_PUBLIC_KEY + " BLOB NOT NULL);";
public static final String TABLE_CREATE_MESSAGE_HISTORY = "CREATE TABLE " + TABLE_MESSAGE_HISTORY + " (" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_MESSAGE_WITH_ID + " NUMBER NOT NULL, " +
COLUMN_MESSAGE_WITH + " TEXT NOT NULL, " +
COLUMN_MESSAGE_FROM + " TEXT NOT NULL, " +
COLUMN_MESSAGE + " TEXT NOT NULL, " +
COLUMN_MESSAGE_STATUS + " TEXT, " +
COLUMN_MESSAGE_MODE + " NUMBER NOT NULL, " +
COLUMN_MESSAGE_HISTORYMODE + " TINYINT NOT NULL, " +
COLUMN_MESSAGE_TIME_DATE + " TEXT NOT NULL, " +
COLUMN_MESSAGE_TIME_TIME + " TEXT NOT NULL, " +
COLUMN_MESSAGE_TIME_TIMESTAMP + " TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);";
public static final String TABLE_CREATE_ID_BLOCK = "CREATE TABLE " + TABLE_ID_BLOCK + " (" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_BLOCKED_ID + " NUMBER NOT NULL);";
public static final String TABLE_CREATE_CHAT_THREAD = "CREATE TABLE " + TABLE_CHAT_THREAD + " (" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_FRIEND_THREAD_ID + " NUMBER NOT NULL, " +
COLUMN_TIMESTAMP_THREAD + " TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);";
private static final String TRIGGER_CREATE_UPDATE_THREAD_TIMESTAMP =
"CREATE TRIGGER update_time_trigger" +
" AFTER UPDATE ON " + TABLE_CHAT_THREAD + " FOR EACH ROW" +
" BEGIN " +
"UPDATE " + TABLE_CHAT_THREAD +
" SET " + COLUMN_TIMESTAMP_THREAD + " = current_timestamp" +
" WHERE " + COLUMN_ID + " = old." + COLUMN_ID + ";" +
" END";
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
System.out.println("Db helper");
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
System.out.println("Creating table");
try {
sqLiteDatabase.execSQL(TABLE_CREATE_USERDAT);
sqLiteDatabase.execSQL(TABLE_CREATE_FRIEND_LIST);
sqLiteDatabase.execSQL(TABLE_CREATE_MESSAGE_HISTORY);
sqLiteDatabase.execSQL(TABLE_CREATE_ID_BLOCK);
sqLiteDatabase.execSQL(TABLE_CREATE_CHAT_THREAD);
sqLiteDatabase.execSQL(TRIGGER_CREATE_UPDATE_THREAD_TIMESTAMP);
}
catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
System.out.println("Upgrading database");
Log.w(DbHelper.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion +
" all data will be deleted");
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_USERDAT);
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_FRIEND_LIST);
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_MESSAGE_HISTORY);
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_ID_BLOCK);
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_CHAT_THREAD);
onCreate(sqLiteDatabase);
}
}
}
| [
"albert.widiatmoko@gmail.com"
] | albert.widiatmoko@gmail.com |
0c609ba2e01ef252dfefd74b8e716315b2a1917f | f3df3fd123b8c4739fa78b85ed7632aded02ff43 | /src/_8_Jantar_FAILS/Filosofo.java | 914c9063664811900f922bf7d409837d4f404a7a | [] | no_license | Gabrielnero000/Sincronizacao | 53af28d9676e87051448adcc284b68e8de37ab9b | f379345238c5fa5adebe173236aa41f1db0d8629 | refs/heads/master | 2021-08-19T12:08:30.270609 | 2017-11-26T05:33:28 | 2017-11-26T05:33:28 | 112,007,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package _8_Jantar_FAILS;
public class Filosofo extends Thread{
int id;
Mesa m;
public Filosofo(int i, Mesa m){
this.id = i;
this.m = m;
}
public void run(){
while (true){
System.out.println("Fil. " + id + " esta pensando");
try {sleep(2000); }catch (Exception e){}
System.out.println("Fil. " + id + " esta com fome");
m.acquire(id);
System.out.println("Fil. " + id + " esta comendo");
try {sleep(2000); }catch (Exception e){}
m.release(id);
}
}
}
| [
"gabriel.leite083@gmail.com"
] | gabriel.leite083@gmail.com |
98c9d2e34db0d3d16b5356653ea34394b5054faa | 1ec38e6e780aacc29e68598a07ea972b0f370c46 | /src/main/java/com/innovate/filseserver/controller/UploadController.java | c0b4d89edb8ee112f134868263ae23c42e43015b | [] | no_license | PieXu/springboot-fileserver | 70ec5cdeba8e558f74fc0ab65c0c7000cfced62d | 9c85fdcae16971602193fc695b0adbb8fb170ebd | refs/heads/master | 2022-12-07T09:17:16.201579 | 2019-06-11T06:59:56 | 2019-06-11T06:59:56 | 189,551,281 | 4 | 2 | null | 2022-12-06T00:31:43 | 2019-05-31T07:45:41 | CSS | UTF-8 | Java | false | false | 8,746 | java | package com.innovate.filseserver.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.innovate.filseserver.model.UploadFile;
import com.innovate.filseserver.model.UploadUser;
import com.innovate.filseserver.service.IFileProcessService;
import com.innovate.filseserver.service.IFileService;
import com.innovate.filseserver.service.IUploadUserService;
/**
* 文件上传
* @author IvanHsu
*/
@RestController
public class UploadController {
private Logger logger = LoggerFactory.getLogger(UploadController.class);
@Autowired
private IFileProcessService processService;
@Autowired
private IFileService fileService;
@Autowired
private IUploadUserService userService;
/**
* Title: auth
* Description: 上传之前的 验证 以及 页面删除文件的处理
* @param request
* @param response
* @param authcode
* @return
*/
@RequestMapping(value = { "/file_server/preUpload" })
public JSONObject auth(HttpServletRequest request,HttpServletResponse response,
String authcode,String fileIds,String objectId){
JSONObject json = new JSONObject();
if(StringUtils.isNotBlank(authcode)){
try {
UploadUser user = userService.getUserByAuthCode(authcode);
if(null!=user){
try {
String[] ids = StringUtils.isNotBlank(fileIds) ? fileIds.split(",") : null;
fileService.deleteFileExceptIds(ids, objectId);
json.put("errorCode", "0");
json.put("grantUser", user.getId());
json.put("errorMsg", "验证用户成功");
} catch (Exception e) {
json.put("errorCode", "104");
json.put("errorMsg", "上传验证失败,请联系管理员");
}
}else{
json.put("errorCode", "101");
json.put("errorMsg", " authcode授权码验证不通过,用户不存在");
}
} catch (Exception e) {
json.put("errorCode", "103");
json.put("errorMsg", " authcode授权码验证异常:"+e.getMessage());
}
}else{
json.put("errorCode", "100");
json.put("errorMsg", " authcode 不能为空,请设置授权码");
}
return json;
}
/**
*
* Title: uploadFile
* Description:
* @param request
* @param files
* @param response
* @return
* @throws ServletException
* @throws IOException
*/
@RequestMapping(value = { "/file_server/upload" })
public JSONObject uploadFile(HttpServletRequest request,@RequestParam("file")MultipartFile file,
HttpServletResponse response) throws ServletException, IOException {
JSONObject json = new JSONObject();
String objectId = request.getParameter("objectId");
String grantUser = request.getParameter("grantUser");//可以传id过来,为了防止泄露Id还是传zuthcode在查询一下
String operator = request.getParameter("operator");
if(null!= file){
if(StringUtils.isNotBlank(grantUser)){
try {
processService.uploadFile(file,objectId,grantUser,operator,getLoginIpAddr(request));
json.put("errorCode", "0");
json.put("errorMsg", "问先处理成功");
} catch (Exception e) {
json.put("errorCode", "102");
json.put("errorMsg", "文件保存异常:"+e.getMessage());
logger.error("[{}]上传文件失败{},原因:{}", operator,getLoginIpAddr(request),e.getMessage());
}
}else{
json.put("errorCode", "100");
json.put("errorMsg", " 授权用户为空,请检查设置...");
}
}
return json;
}
/**
* 下载文件
* @param response
* @param request
*/
@RequestMapping({ "/file_server/downloadSingle" })
public void downloadFile(HttpServletResponse response, HttpServletRequest request) {
// 要下在的文件的id集合
String fileId = request.getParameter("fileId");
if (StringUtils.isNotEmpty(fileId)) {
try {
processService.downloadSingleFile(fileId, response);
} catch (Exception e) {
logger.error("文件下载处理异常:{}", e.getMessage());
}
} else {
logger.error("文件下载失败,请选择要下载的文件!");
}
}
/**
* 关联对象的所有文件的压缩包下载
*
* @param response
* @param request
*/
@RequestMapping({ "/file_server/downloadZip" })
public void downloadRefObjFile(HttpServletResponse response, HttpServletRequest request) {
// 要下在的文件的id集合
String objectId = request.getParameter("objectId");
if (StringUtils.isNotEmpty(objectId)) {
try {
processService.downloadFileZip(objectId, response);
} catch (Exception e) {
logger.error("文件下载处理异常:{}", e.getMessage());
}
} else {
logger.error("文件下载失败,请选择要下载的文件!");
}
}
/**
* 单个文件的信息
* @param response
* @param request
*/
@RequestMapping({ "/file_server/getFileById" })
public String getFileById(HttpServletResponse response, HttpServletRequest request) {
JSONObject json = new JSONObject();
String fileId = request.getParameter("fileId");
try {
if (StringUtils.isNotBlank(fileId)) {
UploadFile uploadFile = fileService.getFile(fileId);
json.put("success", true);
json.put("message", "附件信息获取成功");
json.put("data", JSON.toJSONString(uploadFile));
} else {
json.put("success", false);
json.put("message", "文件fileId不能为空");
}
} catch (Exception e) {
json.put("success", false);
json.put("message", "服务处理异常,请查看日志");
logger.error("id[{}]对应附件信息获取异常:{}", fileId, e.getMessage());
}
return json.toJSONString();
}
/**
* 文件的信息
*
* @param response
* @param request
*/
@RequestMapping({ "/file_server/getFileByObjectId" })
public String getFileByObjectId(HttpServletResponse response, HttpServletRequest request) {
JSONObject json = new JSONObject();
String objectId = request.getParameter("objectId");
try {
if (StringUtils.isNotBlank(objectId)) {
List<UploadFile> uploadFileList = fileService.getFilesByObjectId(objectId);
json.put("success", true);
json.put("message", "附件信息获取成功");
json.put("data", uploadFileList);
} else {
json.put("success", false);
json.put("message", "文件objectId不能为空");
}
} catch (Exception e) {
json.put("success", false);
json.put("message", "服务处理异常,请查看日志");
logger.error("id[{}]对应附件信息获取异常:{}", objectId, e.getMessage());
}
return json.toJSONString();
}
/**
* 删除附件信息
*
* @param response
* @param request
*/
@RequestMapping({ "/file_server/delete" })
public String deleteFile(HttpServletResponse response, HttpServletRequest request) {
JSONObject json = new JSONObject();
String[] fileIds = request.getParameterValues("fileId");
String logic = request.getParameter("logic");
try {
if (ArrayUtils.isNotEmpty(fileIds)) {
boolean isLogicDel = StringUtils.isNotBlank(logic) && "false".equalsIgnoreCase(logic) ? false : true;
processService.deleteFile(fileIds, isLogicDel);
json.put("success", true);
json.put("message", "删除成功");
}
} catch (Exception e) {
json.put("success", false);
json.put("message", "服务处理异常,请查看日志");
logger.error("id[{}]对应附件信息删除异常:{}", fileIds, e.getMessage());
}
return json.toJSONString();
}
/**
* 获取真实的登录的ip
* @param request
* @return
*/
private static String getLoginIpAddr(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
}
| [
"xupai860911@163.com"
] | xupai860911@163.com |
b2355757216d680e64d75f39ebc035a0235f091d | 3d0631be67f6d8826aa6b03b7bfbfaca5150e45b | /FactoryMethod/src/java/com/meshpy/FactoryMethodDemo.java | 6d608dc722e7d3bd737c50e71ecc5983ab106643 | [] | no_license | xNIGHTHAWKx/Gang-of-Four-DP | 99d9b76cb3beb3f52f452a87d7221f66cf248962 | a23acefa126cb5ec6597ac74f0a25c115e46b810 | refs/heads/master | 2020-05-09T13:23:20.308842 | 2019-04-13T09:39:35 | 2019-04-13T09:39:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.meshpy;
import com.meshpy.dogs.Dog;
import com.meshpy.dogs.DogFactory;
public class FactoryMethodDemo {
public static void main(String[] args) {
Dog firstDog = DogFactory.getDog("Poodle");
firstDog.woof();
Dog secondDog = DogFactory.getDog("Siberian Husky");
secondDog.woof();
Dog thirdDog = DogFactory.getDog("Rottweiler");
thirdDog.woof();
}
}
| [
"209317@edu.p.lodz.pl"
] | 209317@edu.p.lodz.pl |
bfbe5409afd82fb4c449516cda8623bb42bbb0a0 | 3468bdeab577155470f9f62e2a56dda1db5f1855 | /ontology/graph/src/main/java/edu/arizona/biosemantics/common/ontology/graph/Reader.java | 426da11d6ea53d3880c46f04eb2c83b0d1ada547 | [] | no_license | biosemantics/common | 583d612a28b52b8d6e69088bfe7a669cbeeca767 | 14fcfafb72b6730ed79ea4f77afa8d22cabc8a2e | refs/heads/master | 2021-04-15T19:03:11.977247 | 2019-04-24T23:28:05 | 2019-04-24T23:28:05 | 25,384,744 | 0 | 0 | null | 2017-09-26T21:32:31 | 2014-10-18T02:26:12 | Java | UTF-8 | Java | false | false | 639 | java | package edu.arizona.biosemantics.common.ontology.graph;
import java.io.File;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import edu.uci.ics.jung.graph.DirectedSparseMultigraph;
public class Reader {
private String inputGraphFile;
public Reader(String inputGraphFile) {
this.inputGraphFile = inputGraphFile;
}
public OntologyGraph read() throws Exception {
try(FileInputStream fileInputStream = new FileInputStream(new File(inputGraphFile))) {
try(ObjectInputStream in = new ObjectInputStream(fileInputStream)) {
Object object = in.readObject();
return (OntologyGraph)object;
}
}
}
}
| [
"thomas.rodenhausen@gmail.com"
] | thomas.rodenhausen@gmail.com |
825ea69821c6dad61f4d05d049695b5cf1fbcd1c | 9c4352d462829bb11d475bb7292973ddebce00dd | /problema4/Problema4/src/main/java/Paquete1/Ejecutor.java | 20ac43ccf617c1b8313f30b62b47aa4fc084f6cb | [] | no_license | ProgOrientadaObjetos-P-AA2021/taller04-Gianfranco35 | 00bcd6f9c58c0e857328ab74fde2adb91dd7937d | d19135a4124bddb456c8a2e2f3281035031f45e6 | refs/heads/main | 2023-04-18T14:51:58.123535 | 2021-05-02T01:06:18 | 2021-05-02T01:06:18 | 362,937,762 | 0 | 0 | null | 2021-04-29T20:21:19 | 2021-04-29T20:21:14 | null | UTF-8 | Java | false | false | 466 | java | package Paquete1;
import paquete2.Cheque;
/*
* 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.
*/
/**
*
* @author bitxanax
*/
public class Ejecutor {
public static void main(String[] args) {
Cheque cheque = new Cheque();
cheque.calcularComisionBanco();
System.out.println(cheque.toString());
}
}
| [
"sanchezgian58@gmail.com"
] | sanchezgian58@gmail.com |
118faa9ba41936bd818eb8d276150344631d018d | ffee139269b9059c05c6039f12d6013efe45bfd6 | /starter/src/main/java/com/github/fonimus/ssh/shell/commands/PostProcessorsCommand.java | 35db1dd7399f58164f92913533c6014b8686b365 | [
"Apache-2.0"
] | permissive | xj921022/ssh-shell-spring-boot | 22a22d93a9e1b8cd8c9bdcf396a6edb456dd7611 | 33a4e5c2fe6d943527f2cc0642cfead6d35e5fd5 | refs/heads/master | 2023-05-12T07:25:02.850127 | 2021-05-30T08:07:57 | 2021-05-30T08:07:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,185 | java | /*
* Copyright (c) 2020 François Onimus
*
* 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.github.fonimus.ssh.shell.commands;
import com.github.fonimus.ssh.shell.SshShellHelper;
import com.github.fonimus.ssh.shell.SshShellProperties;
import com.github.fonimus.ssh.shell.postprocess.PostProcessor;
import org.jline.utils.AttributedStringBuilder;
import org.jline.utils.AttributedStyle;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.shell.Availability;
import org.springframework.shell.standard.ShellCommandGroup;
import org.springframework.shell.standard.ShellMethod;
import org.springframework.shell.standard.ShellMethodAvailability;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
/**
* Command to list available post processors
*/
@SshShellComponent
@ShellCommandGroup("Built-In Commands")
@ConditionalOnProperty(
name = SshShellProperties.SSH_SHELL_PREFIX + ".commands." + PostProcessorsCommand.GROUP + ".create",
havingValue = "true", matchIfMissing = true
)
public class PostProcessorsCommand extends AbstractCommand {
public static final String GROUP = "postprocessors";
public static final String COMMAND_POST_PROCESSORS = "postprocessors";
private final List<PostProcessor> postProcessors;
public PostProcessorsCommand(SshShellHelper helper, SshShellProperties properties,
List<PostProcessor> postProcessors) {
super(helper, properties, properties.getCommands().getPostprocessors());
this.postProcessors = new ArrayList<>(postProcessors);
this.postProcessors.sort(Comparator.comparing(PostProcessor::getName));
}
@ShellMethod(key = COMMAND_POST_PROCESSORS, value = "Display the available post processors")
@ShellMethodAvailability("postprocessorsAvailability")
public CharSequence postprocessors() {
AttributedStringBuilder result = new AttributedStringBuilder();
result.append("Available Post-Processors\n\n", AttributedStyle.BOLD);
for (PostProcessor postProcessor : postProcessors) {
result.append("\t" + postProcessor.getName() + ": ", AttributedStyle.BOLD);
Class<?> cls =
((Class) ((ParameterizedType) (postProcessor.getClass().getGenericInterfaces())[0]).getActualTypeArguments()[0]);
result.append(cls.getName() + "\n", AttributedStyle.DEFAULT);
}
return result;
}
private Availability postprocessorsAvailability() {
return availability(GROUP, COMMAND_POST_PROCESSORS);
}
}
| [
"francois.onimus@gmail.com"
] | francois.onimus@gmail.com |
20c035e50f75c9811ee5cef68c4ff70025ba6bba | 15237faf3113c144bad2c134dbe1cfa08756ba12 | /platypus-js-forms/src/main/java/com/eas/client/forms/components/rt/VTextField.java | 5518d3a2229a4f7821661c09b33da38f278f6615 | [
"Apache-2.0"
] | permissive | marat-gainullin/platypus-js | 3fcf5a60ba8e2513d63d5e45c44c11cb073b07fb | 22437b7172a3cbebe2635899608a32943fed4028 | refs/heads/master | 2021-01-20T12:14:26.954647 | 2020-06-10T07:06:34 | 2020-06-10T07:06:34 | 21,357,013 | 1 | 2 | Apache-2.0 | 2020-06-09T20:44:52 | 2014-06-30T15:56:35 | Java | UTF-8 | Java | false | false | 2,681 | 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 com.eas.client.forms.components.rt;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JTextField;
/**
*
* @author Марат
*/
public class VTextField extends JTextField implements HasValue<String>, HasEmptyText, HasEditable {
private String oldValue;
public VTextField(String aText) {
super(aText);
super.setText(aText != null ? aText : "");
if (aText == null) {
nullValue = true;
}
oldValue = aText;
super.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
checkValueChanged();
}
});
super.addActionListener((java.awt.event.ActionEvent e) -> {
checkValueChanged();
});
}
private void checkValueChanged() {
String newValue = getValue();
if (oldValue == null ? newValue != null : !oldValue.equals(newValue)) {
String wasOldValue = oldValue;
oldValue = newValue;
firePropertyChange(VALUE_PROP_NAME, wasOldValue, newValue);
}
}
@Override
public String getValue() {
return nullValue ? null : super.getText();
}
private boolean nullValue;
@Override
public void setValue(String aValue) {
nullValue = aValue == null;
super.setText(aValue != null ? aValue : "");
checkValueChanged();
}
@Override
public void addValueChangeListener(PropertyChangeListener listener) {
super.addPropertyChangeListener(VALUE_PROP_NAME, listener);
}
@Override
public void removeValueChangeListener(PropertyChangeListener listener) {
super.removePropertyChangeListener(VALUE_PROP_NAME, listener);
}
protected String emptyText;
@Override
public String getEmptyText() {
return emptyText;
}
@Override
public void setEmptyText(String aValue) {
emptyText = aValue;
}
@Override
public boolean getEditable() {
return super.isEditable();
}
@Override
public String getText() {
return super.getText();
}
@Override
public void setText(String aValue) {
nullValue = false;
super.setText(aValue != null ? aValue : "");
checkValueChanged();
}
}
| [
"mg@altsoft.biz"
] | mg@altsoft.biz |
5289c91af686729af9ec79afaf38ded7b28ed37a | 6dcd2762a4bbd0629b50f34962a58e87acbd3225 | /YuGiOh/src/com/bence/yugioh/utils/Point2.java | e6053de480ab8d28b3d7c5c1f38902bfb950ccee | [] | no_license | robot9706/CardGame | 927165e773e4e2e5e20fb2e9739e25c253264800 | c871968cacf3e4f5fe6fae74cf81a440d29cb275 | refs/heads/master | 2021-01-18T03:12:52.068220 | 2017-04-22T10:59:06 | 2017-04-22T10:59:06 | 85,838,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 189 | java | package com.bence.yugioh.utils;
/**
* Egy 2D beli pont.
* @author Bence
*
*/
public class Point2 {
public int X;
public int Y;
public Point2(int x, int y){
X = x;
Y = y;
}
}
| [
"robot9706@gmail.com"
] | robot9706@gmail.com |
edb9ddd54ed2f75dd072f241c4edd59f3e755fbd | 514dc002ba65eea38de258ba89412efcc8fc72ce | /ZombieBeat/src/main/java/View/Playground/PlayArea/Parts/Astern.java | 1c2f19f6924cca7372496946d6ec4f4c5e138798 | [] | no_license | Tim-Fischer-Git/ZombieBeat | 3592fe4f0c3c40a60162e78f9a2cfda424a89e96 | f0992edc76e33f22c30d53dec9cbc57110dd3f70 | refs/heads/master | 2020-06-10T17:39:38.541647 | 2019-06-25T12:54:47 | 2019-06-25T12:54:47 | 193,694,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,865 | java | package View.Playground.PlayArea.Parts;
import java.util.*;
/**
* A Star Algorithm
*
* @author Marcelo Surriabre
* @version 2.1, 2017-02-23
*/
public class Astern {
private static int DEFAULT_HV_COST = 10; // Horizontal - Vertical Cost
private static int DEFAULT_DIAGONAL_COST = 14;
private int hvCost;
private int diagonalCost;
private Node[][] searchArea;
private PriorityQueue<Node> openList;
private Set<Node> closedSet;
private Node initialNode;
private Node finalNode;
public Astern(int rows, int cols, Node initialNode, Node finalNode, int hvCost, int diagonalCost) {
this.hvCost = hvCost;
this.diagonalCost = diagonalCost;
setInitialNode(initialNode);
setFinalNode(finalNode);
this.searchArea = new Node[rows][cols];
this.openList = new PriorityQueue<Node>(new Comparator<Node>() {
@Override
public int compare(Node node0, Node node1) {
return Integer.compare(node0.getF(), node1.getF());
}
});
setNodes();
this.closedSet = new HashSet<>();
}
public Astern(int rows, int cols, Node initialNode, Node finalNode) {
this(rows, cols, initialNode, finalNode, DEFAULT_HV_COST, DEFAULT_DIAGONAL_COST);
}
private void setNodes() {
for (int i = 0; i < searchArea.length; i++) {
for (int j = 0; j < searchArea[0].length; j++) {
Node node = new Node(i, j);
node.calculateHeuristic(getFinalNode());
this.searchArea[i][j] = node;
}
}
}
public void setBlocks(int[][] blocksArray) {
for (int i = 0; i < blocksArray.length; i++) {
int row = blocksArray[i][0];
int col = blocksArray[i][1];
setBlock(row, col);
}
}
public List<Node> findPath() {
openList.add(initialNode);
while (!isEmpty(openList)) {
Node currentNode = openList.poll();
closedSet.add(currentNode);
if (isFinalNode(currentNode)) {
return getPath(currentNode);
} else {
addAdjacentNodes(currentNode);
}
}
return new ArrayList<Node>();
}
private List<Node> getPath(Node currentNode) {
List<Node> path = new ArrayList<Node>();
path.add(currentNode);
Node parent;
while ((parent = currentNode.getParent()) != null) {
path.add(0, parent);
currentNode = parent;
}
return path;
}
private void addAdjacentNodes(Node currentNode) {
addAdjacentUpperRow(currentNode);
addAdjacentMiddleRow(currentNode);
addAdjacentLowerRow(currentNode);
}
private void addAdjacentLowerRow(Node currentNode) {
int row = currentNode.getRow();
int col = currentNode.getCol();
int lowerRow = row + 1;
if (lowerRow < getSearchArea().length) {
if (col - 1 >= 0) {
checkNode(currentNode, col - 1, lowerRow, getDiagonalCost()); // Comment this line if diagonal movements are not allowed
}
if (col + 1 < getSearchArea()[0].length) {
checkNode(currentNode, col + 1, lowerRow, getDiagonalCost()); // Comment this line if diagonal movements are not allowed
}
checkNode(currentNode, col, lowerRow, getHvCost());
}
}
private void addAdjacentMiddleRow(Node currentNode) {
int row = currentNode.getRow();
int col = currentNode.getCol();
int middleRow = row;
if (col - 1 >= 0) {
checkNode(currentNode, col - 1, middleRow, getHvCost());
}
if (col + 1 < getSearchArea()[0].length) {
checkNode(currentNode, col + 1, middleRow, getHvCost());
}
}
private void addAdjacentUpperRow(Node currentNode) {
int row = currentNode.getRow();
int col = currentNode.getCol();
int upperRow = row - 1;
if (upperRow >= 0) {
if (col - 1 >= 0) {
checkNode(currentNode, col - 1, upperRow, getDiagonalCost()); // Comment this if diagonal movements are not allowed
}
if (col + 1 < getSearchArea()[0].length) {
checkNode(currentNode, col + 1, upperRow, getDiagonalCost()); // Comment this if diagonal movements are not allowed
}
checkNode(currentNode, col, upperRow, getHvCost());
}
}
private void checkNode(Node currentNode, int col, int row, int cost) {
Node adjacentNode = getSearchArea()[row][col];
if (!adjacentNode.isBlock() && !getClosedSet().contains(adjacentNode)) {
if (!getOpenList().contains(adjacentNode)) {
adjacentNode.setNodeData(currentNode, cost);
getOpenList().add(adjacentNode);
} else {
boolean changed = adjacentNode.checkBetterPath(currentNode, cost);
if (changed) {
// Remove and Add the changed node, so that the PriorityQueue can sort again its
// contents with the modified "finalCost" value of the modified node
getOpenList().remove(adjacentNode);
getOpenList().add(adjacentNode);
}
}
}
}
private boolean isFinalNode(Node currentNode) {
return currentNode.equals(finalNode);
}
private boolean isEmpty(PriorityQueue<Node> openList) {
return openList.size() == 0;
}
private void setBlock(int row, int col) {
this.searchArea[row][col].setBlock(true);
}
public Node getInitialNode() {
return initialNode;
}
public void setInitialNode(Node initialNode) {
this.initialNode = initialNode;
}
public Node getFinalNode() {
return finalNode;
}
public void setFinalNode(Node finalNode) {
this.finalNode = finalNode;
}
public Node[][] getSearchArea() {
return searchArea;
}
public void setSearchArea(Node[][] searchArea) {
this.searchArea = searchArea;
}
public PriorityQueue<Node> getOpenList() {
return openList;
}
public void setOpenList(PriorityQueue<Node> openList) {
this.openList = openList;
}
public Set<Node> getClosedSet() {
return closedSet;
}
public void setClosedSet(Set<Node> closedSet) {
this.closedSet = closedSet;
}
public int getHvCost() {
return hvCost;
}
public void setHvCost(int hvCost) {
this.hvCost = hvCost;
}
private int getDiagonalCost() {
return diagonalCost;
}
private void setDiagonalCost(int diagonalCost) {
this.diagonalCost = diagonalCost;
}
}
| [
"Fischer_Tim@gmx.de"
] | Fischer_Tim@gmx.de |
03ff31267c5966976fad64113dfff8f65b7b77d7 | 99c03face59ec13af5da080568d793e8aad8af81 | /hom_classifier/2om_classifier/scratch/ROR13COI7/Pawn.java | 00cd1798499bd1f7f6f07ed0f3cb4c84d84f4389 | [] | no_license | fouticus/HOMClassifier | 62e5628e4179e83e5df6ef350a907dbf69f85d4b | 13b9b432e98acd32ae962cbc45d2f28be9711a68 | refs/heads/master | 2021-01-23T11:33:48.114621 | 2020-05-13T18:46:44 | 2020-05-13T18:46:44 | 93,126,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,760 | java | // This is a mutant program.
// Author : ysma
import java.util.ArrayList;
public class Pawn extends ChessPiece
{
public Pawn( ChessBoard board, ChessPiece.Color color )
{
super( board, color );
}
public java.lang.String toString()
{
if (color == ChessPiece.Color.WHITE) {
return "♙";
} else {
return "♟";
}
}
public java.util.ArrayList<String> legalMoves()
{
java.util.ArrayList<String> returnList = new java.util.ArrayList<String>();
if (this.getColor().equals( ChessPiece.Color.WHITE )) {
int currentCol = this.getColumn();
int nextRow = this.getRow() + 1;
if (nextRow <= 7) {
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextRow, currentCol ) );
}
}
if (this.getRow() <= 1) {
int nextNextRow = this.getRow() + 2;
if (!(board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null && board.getPiece( onePossibleMove( nextNextRow, currentCol ) ) == null)) {
returnList.add( onePossibleMove( nextNextRow, currentCol ) );
}
}
int leftColumn = currentCol - 1;
int rightColumn = currentCol + 1;
if (leftColumn >= 0) {
if (board.getPiece( onePossibleMove( nextRow, leftColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, leftColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, leftColumn ) );
}
}
}
if (rightColumn <= 7) {
if (board.getPiece( onePossibleMove( nextRow, rightColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, rightColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, rightColumn ) );
}
}
}
} else {
int currentCol = this.getColumn();
int nextRow = this.getRow() - 1;
if (nextRow >= 0) {
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextRow, currentCol ) );
}
}
if (this.getRow() == 6) {
int nextNextRow = this.getRow() - 2;
if (board.getPiece( onePossibleMove( nextRow, currentCol ) ) == null && board.getPiece( onePossibleMove( nextNextRow, currentCol ) ) == null) {
returnList.add( onePossibleMove( nextNextRow, currentCol ) );
}
}
int leftColumn = currentCol - 1;
int rightColumn = currentCol + 1;
if (leftColumn >= 0) {
if (board.getPiece( onePossibleMove( nextRow, leftColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, leftColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, leftColumn ) );
}
}
}
if (rightColumn <= 7) {
if (board.getPiece( onePossibleMove( nextRow, rightColumn ) ) != null) {
if (!board.getPiece( onePossibleMove( nextRow, rightColumn ) ).getColor().equals( this.getColor() )) {
returnList.add( onePossibleMove( nextRow, rightColumn ) );
}
}
}
}
return returnList;
}
} | [
"fout.alex@gmail.com"
] | fout.alex@gmail.com |
e5797cf41c9c7b1bf1e31c19c4f45fde576189dd | b4ee3e31937a78f6e992174d3b7eb3a5ad445008 | /Triangle.java | c92128d7b8d58b451a2a2bfcdd872fb87b936da6 | [] | no_license | ideboer/Geometry | dadf683227168c9deb872af08921279bb7d544fc | 7e3c29cffd9b2287083cc96d9d3d8b712e7dee82 | refs/heads/master | 2020-12-12T10:48:31.419830 | 2020-01-21T15:24:21 | 2020-01-21T15:24:21 | 234,110,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | import java.util.*;
class Triangle
{
Point a;
Point b;
Point c;
public Triangle(Point a, Point b, Point c)
{
this.a = a;
this.b = b;
this.c = c;
}
public double area()
{
// Area = .5 * a * b * sinC
double angleC;
double area;
double aDist = b.distance(c);
double bDist = a.distance(c);
double cDist = a.distance(b);
angleC = Math.acos(((cDist * cDist) - (aDist * aDist) - (bDist * bDist)) / ( -2 * aDist * bDist)); // law of cosines
area = 0.5 * aDist * bDist * Math.sin(angleC);
return area;
}
} | [
"hickischja@s.dcsdk12.org"
] | hickischja@s.dcsdk12.org |
feee73589ef581d97bd45e0ebd71291cad011ce1 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project85/src/test/java/org/gradle/test/performance85_3/Test85_206.java | 31585ff03759c3b29c58362b85136bdd39592977 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 292 | java | package org.gradle.test.performance85_3;
import static org.junit.Assert.*;
public class Test85_206 {
private final Production85_206 production = new Production85_206("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
8518daddb6e0b601412aa2531cb1d6c89fe0ba50 | 243b6e8c391acc7ccaf3d36c94cdb21a1f62ff38 | /security-core/src/main/java/com/security/core/properties/SmsCodeProperties.java | 7ffb871fcb0cc0a394d3ed747f7ea324c674c1c7 | [] | no_license | fengyuhetao/security | e89ac05be5c03257725919d0d56007d89d835034 | ba20b3d697aee9d62a1c56fdae45762a042f96da | refs/heads/master | 2021-07-18T15:23:03.446363 | 2017-10-26T06:29:40 | 2017-10-26T06:29:40 | 107,833,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package com.security.core.properties;/**
* Created by HT on 2017/10/15.
*/
import lombok.Data;
/**
* @author HT
* @create 2017-10-15 18:37
**/
@Data
public class SmsCodeProperties {
private int length = 4;
private int expireIn = 60;
private String url;
}
| [
"fengyunhetao@gmail.com"
] | fengyunhetao@gmail.com |
fddd0a4f45a939e41ac16612ca5e2c1ebda9cfbb | e57229fad4514148aa68e1ca46575cb6cea61199 | /src/main/java/org/grade/demo/web/BoyController.java | b3809d3120f483ea2df03ad88b6aa6ac20a777a8 | [] | no_license | gograde/demo | eba403daf173649b61aab3f31692f164242e03b3 | 4a2c5a2af08339e7a48faf1277f0a99658f27b70 | refs/heads/master | 2021-04-04T23:34:55.160485 | 2020-03-19T12:52:59 | 2020-03-19T12:52:59 | 248,502,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,800 | java | package org.grade.demo.web;
import java.awt.PageAttributes.MediaType;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.grade.core.bean.ErrorResponse;
import org.grade.core.exception.BadRequestException;
import org.grade.demo.bean.response.BoyDetailedResponse;
import org.grade.demo.bean.response.BoyResponse;
import org.grade.demo.entity.Boy;
import org.grade.demo.filter.BoyFilter;
import org.grade.demo.mappers.BeanMappers;
import org.grade.demo.service.BoyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@RestController
@RequestMapping("/api/v1")
@Api(value = "Topad")
public class BoyController
{
@Autowired
private BoyService service;
@RequestMapping(value = "/boys", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ApiOperation(value = "List de boy par filtre", notes = "List de boy par filtre")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = Boy.class, responseContainer = "List")})
public @ResponseBody ResponseEntity<List<BoyResponse>> findAll(
@ApiParam(name = "nom", type = "String", value = "", required = false) @RequestParam(name = "nom", required = false) String nom,
@ApiParam(name = "description", type = "String", value = "", required = false) @RequestParam(name = "description", required = false) String description,
@ApiParam(name = "girl", type = "Long", value = "", required = false, allowMultiple = true) @RequestParam(name = "girl", required = false) List<Long> girl,
@ApiParam(name = "createdAtFrom", type = "Long", value = "", required = false, example = "0") @RequestParam(name = "createdAtFrom", required = false) Long createdAtFrom,
@ApiParam(name = "createdAtTo", type = "Long", value = "", required = false, example = "0") @RequestParam(name = "createdAtTo", required = false) Long createdAtTo,
@ApiParam(name = "updatedAtFrom", type = "Long", value = "", required = false, example = "0") @RequestParam(name = "updatedAtFrom", required = false) Long updatedAtFrom,
@ApiParam(name = "updatedAtTo", type = "Long", value = "", required = false, example = "0") @RequestParam(name = "updatedAtTo", required = false) Long updatedAtTo)
{
BoyFilter filter = new BoyFilter();
filter.setNom(nom);
filter.setDescription(description);
filter.setGirls(girl);
try
{
if (createdAtFrom != null)
{
filter.setCreatedAtFrom(new Date(createdAtFrom));
}
if (createdAtTo != null)
{
filter.setCreatedAtTo(new Date(createdAtTo));
}
if (updatedAtFrom != null)
{
filter.setUpdatedAtFrom(new Date(updatedAtFrom));
}
if (updatedAtTo != null)
{
filter.setUpdatedAtTo(new Date(updatedAtTo));
}
}
catch (Exception e)
{
throw new BadRequestException(e);
}
return new ResponseEntity<List<BoyResponse>>(service.findAll(filter).getContent().stream()
.map(BeanMappers::boyToResponse).collect(Collectors.toList()), HttpStatus.OK);
}
@RequestMapping(value = "/boys/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ApiOperation(value = "Obtention d'une boy", notes = "Obtention d'une boy par ID")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = Boy.class, responseContainer = "List"),
@ApiResponse(code = 500, message = "Server Error", response = ErrorResponse.class)})
public @ResponseBody ResponseEntity<BoyDetailedResponse> findById(
@PathVariable(name = "id", required = true) Long id)
{
return new ResponseEntity<BoyDetailedResponse>(BeanMappers.boyToResponseDetail(service.findById(id)),
HttpStatus.OK);
}
}
| [
"yasser.kantour@cgi.com"
] | yasser.kantour@cgi.com |
745499959ce26def04baa63872dba55d26a3f47a | b886dabfa7c888299f3f457f55e21fda597d739a | /manager/src/main/java/org/sergei/manager/rest/dto/mappers/PilotDTOListMapper.java | 7703081d97d7120be3a9360a362ac336bf230fab | [
"Apache-2.0"
] | permissive | netg5/airport-management | ea866739e9b153020bf5e27b3e217dc698d360e7 | cea22ef10800c2689b91d7ab16b9c83b7db07f9d | refs/heads/master | 2020-08-29T05:02:52.416212 | 2019-10-27T07:07:17 | 2019-10-27T07:07:17 | 217,930,025 | 2 | 1 | Apache-2.0 | 2019-10-27T23:21:59 | 2019-10-27T23:21:58 | null | UTF-8 | Java | false | false | 747 | java | package org.sergei.manager.rest.dto.mappers;
import org.sergei.manager.jpa.model.Pilot;
import org.sergei.manager.rest.dto.PilotDTO;
import org.sergei.manager.utils.IMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author Sergei Visotsky
*/
@Component
public class PilotDTOListMapper implements IMapper<List<Pilot>, List<PilotDTO>> {
private final PilotDTOMapper pilotDTOMapper;
@Autowired
public PilotDTOListMapper(PilotDTOMapper pilotDTOMapper) {
this.pilotDTOMapper = pilotDTOMapper;
}
@Override
public List<PilotDTO> apply(List<Pilot> pilots) {
return pilotDTOMapper.applyList(pilots);
}
}
| [
"sergei.visotsky@gmail.com"
] | sergei.visotsky@gmail.com |
aee97b276521f61e2020a7f0e6be8d5c9d998084 | 8d6cb66b9e3d20e329817307d8aebccbcf300f53 | /src/christmastree/Command.java | d833dffdd1368277003ed0a75a9be463a45aa813 | [] | no_license | KhooBaoXuan/Christmas-Tree | 652115ab634dcccc306c4fdfb99f5d482da9757e | 13c466f754a92cef09f249a2bdee2337ba9bbc03 | refs/heads/master | 2020-04-06T11:14:44.348288 | 2018-12-08T05:31:48 | 2018-12-08T05:31:48 | 157,405,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java | package christmastree;
public interface Command {
public String execute();
public String undo();
}
| [
"qkae96@gmail.com"
] | qkae96@gmail.com |
eb5fb9187ea4e9c6f87e5ce153ff852bf20965d7 | 518f5db0bbfd95b9743aa55aa378bef521b6ca9b | /gulimall-member/src/main/java/com/example/gulimall/member/entity/MemberEntity.java | 6e82ab6f76ab2fa25b60e0bcd55636f2373e13c5 | [] | no_license | TownMarshal/gulimall | 7d9d7ffd053916abbcca0d821f54eff183f8362e | 1868b8264614380f2c3d4320a96d285188e1a866 | refs/heads/master | 2023-03-07T23:29:52.653357 | 2021-02-16T06:11:29 | 2021-02-16T06:11:29 | 339,266,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,336 | java | package com.example.gulimall.member.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 会员
*
* @author tangshuai
* @email zz990027566@gmail.com
* @date 2020-10-19 16:56:48
*/
@Data
@TableName("ums_member")
public class MemberEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* 会员等级id
*/
private Long levelId;
/**
* 用户名
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 昵称
*/
private String nickname;
/**
* 手机号码
*/
private String mobile;
/**
* 邮箱
*/
private String email;
/**
* 头像
*/
private String header;
/**
* 性别
*/
private Integer gender;
/**
* 生日
*/
private Date birth;
/**
* 所在城市
*/
private String city;
/**
* 职业
*/
private String job;
/**
* 个性签名
*/
private String sign;
/**
* 用户来源
*/
private Integer sourceType;
/**
* 积分
*/
private Integer integration;
/**
* 成长值
*/
private Integer growth;
/**
* 启用状态
*/
private Integer status;
/**
* 注册时间
*/
private Date createTime;
}
| [
"906219187@qq.com"
] | 906219187@qq.com |
d19cd5016977feb53ba0462707c7fcdf9d08ccce | 64874fb0f327b8e1f9fa3a0e7806f0d66655eb4c | /ch08_ex2_Product/src/ProductDB.java | 55698c727f5e7372084aeab10be5320794b97b9e | [] | no_license | christopher-mason/java-instruction | 517a6c3545b4d94a60920f598d6568907e551b6f | 94c6f42028568d2d26996717c1012c32a2aa16ba | refs/heads/master | 2023-03-28T08:39:33.703051 | 2021-03-15T19:50:04 | 2021-03-15T19:50:04 | 291,838,260 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,539 | java | import java.util.HashMap;
import java.util.Map;
public class ProductDB {
public static Product getProductFromMap(String productCode) {
Map<String,Product> items = new HashMap<>();
Book javaBook = new Book();
javaBook.setCode("java");
javaBook.setDescription("Murach's Java Programming");
javaBook.setPrice(57.50);
javaBook.setAuthor("Joel Murach");
items.put("java", javaBook);
Book jspBook = new Book();
jspBook.setCode("jsp");
jspBook.setDescription("Murach's JSP Programming");
jspBook.setPrice(35.00);
jspBook.setAuthor("Joel Murach");
items.put("jsp", jspBook);
Software netbeans = new Software();
netbeans.setCode("netbeans");
netbeans.setVersion("8.2");
items.put("netbeans", netbeans);
Product p = items.get(productCode);
System.out.println("Retrieved " + p + " from the map.");
return p;
}
public static Product getProduct(String productCode) {
// In a more realistic application, this code would
// get the data for the product from a file or database
// For now, this code just uses if/else statements
// to return the correct product data
Product p = null;
if (productCode.equalsIgnoreCase("java")
|| productCode.equalsIgnoreCase("jsp")
|| productCode.equalsIgnoreCase("mysql")) {
Book b = new Book();
if (productCode.equalsIgnoreCase("java")) {
b.setCode(productCode);
b.setDescription("Murach's Java Programming");
b.setPrice(57.50);
b.setAuthor("Joel Murach");
} else if (productCode.equalsIgnoreCase("jsp")) {
b.setCode(productCode);
b.setDescription("Murach's Java Servlets and JSP");
b.setPrice(57.50);
b.setAuthor("Mike Urban");
} else if (productCode.equalsIgnoreCase("mysql")) {
b.setCode(productCode);
b.setDescription("Murach's MySQL");
b.setPrice(54.50);
b.setAuthor("Joel Murach");
}
p = b; // set Product object equal to the Book object
} else if (productCode.equalsIgnoreCase("netbeans")) {
Software s = new Software();
s.setCode("netbeans");
s.setDescription("NetBeans");
s.setPrice(0.00);
s.setVersion("8.2");
p = s; // set Product object equal to the Software object
}
return p;
}
}
| [
"m1achris43@gmail.com"
] | m1achris43@gmail.com |
3dc3a816cbbf755160809b7829e2bf7b254be8ca | 3e54fbace85e7c6ffd54e13e348fc5bbb0675807 | /day05/LargestNumber.java | f596bca03280073c5fc8f7f9985328bfcf6352c3 | [] | no_license | mukeshbhange/Bridgelabz | 5500a4c3fbfe64ef468121685b35114311732672 | 4dd77489e686bf871420dd536f80aa093c1ca2aa | refs/heads/master | 2023-08-15T05:50:29.357905 | 2021-10-18T14:41:21 | 2021-10-18T14:41:21 | 406,610,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package com.fellowship.day05;
import java.util.Scanner;
public class LargestNumber {
public static void main(String[] args) {
int one, two, three, largest, temp;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the first number:");
one = sc.nextInt();
System.out.println("Enter the second number:");
two = sc.nextInt();
System.out.println("Enter the third number:");
three = sc.nextInt();
temp=one>two?one:two;
largest=three>temp?three:temp;
System.out.println("The largest number is: "+largest);
}
} | [
"bhangemukesh98@gmail.com"
] | bhangemukesh98@gmail.com |
12a0006431a1877cae656d1c15733dd00e111ac5 | 862f166bd44188a47852cb782788e26037261eb9 | /Java Project/src/com/java/TestBigInteger.java | ab10ac4fbbc3e683bc56fd8bbcb6f9866bf3e7de | [] | no_license | reeteshac1212/Java-Projects | 7e62d7bf129785f3c20860892d0b11ccab8d999e | 33c0545b89bdb1b684e48046170bd90484b32d23 | refs/heads/master | 2016-09-13T11:32:02.799730 | 2016-05-09T05:15:51 | 2016-05-09T05:15:51 | 58,176,443 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,317 | java | package com.java;
/*
* In this problem you have to add and multiply huge numbers! These numbers are so big that you can't contain them in any ordinary data types like long integer.
Use the power of Java's BigInteger class and solve this problem.
Input Format
There will be two lines containing two numbers, aa and bb.
Constraints
aa and bb are non-negative integers and can have maximum 200200 digits.
Output Format
Output two lines. The first line should contain a+ba+b, and the second line should contain a×ba×b. Don't print any leading zeros.
Sample Input
1234
20
Sample Output
1254
24680
Explanation
1234+20=12541234+20=1254
1234×20=24680
*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class TestBigInteger {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
String numOne = sc.nextLine();
String numTwo = sc.nextLine();
BigInteger bigNumOne = new BigInteger(numOne);
BigInteger bigNumTwo = new BigInteger(numTwo);
System.out.println(bigNumOne.add(bigNumTwo));
System.out.println(bigNumOne.multiply(bigNumTwo));
}
} | [
"reetesh@reetesh-Lenovo-IdeaPad-Y530"
] | reetesh@reetesh-Lenovo-IdeaPad-Y530 |
f60135068f7eacae650549bf3c6c31ba82778a6c | 59e10e2ba7350d880c148b45830aa3a1f0609b3e | /app/src/main/java/com/example/pete/myapplication/FingerprintHandler.java | 078877c58aafdba97d4ed71d23793c78df0dc72f | [] | no_license | cit352/android-app | d932de6d8df111d572f368fc077d62b9325266fa | 1ce1af83d2d83e72f234fdad540b2ac3e4fb1e3e | refs/heads/master | 2021-01-24T11:02:05.035021 | 2016-11-20T10:06:58 | 2016-11-20T10:06:58 | 70,290,444 | 0 | 1 | null | 2016-11-20T10:06:59 | 2016-10-07T23:44:41 | Java | UTF-8 | Java | false | false | 2,452 | java | package com.example.pete.myapplication;
/**
* Credit for most of this code which we adadpted to our needs and
* the explaining how to use it goes to the tutorial at:
*
* http://www.techotopia.com/index.php/An_Android_Fingerprint_Authentication_Tutorial
*
* based on the book:
*
* Android Studio 2.2
* Development Essentials
* Android 7 Edition
* eBook
*
**/
import android.Manifest;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Build;
import android.os.CancellationSignal;
import android.support.v4.app.ActivityCompat;
import android.widget.Toast;
@TargetApi(Build.VERSION_CODES.M)
public class FingerprintHandler extends
FingerprintManager.AuthenticationCallback {
private CancellationSignal cancellationSignal;
private Context appContext;
public FingerprintHandler(Context context) {
appContext = context;
}
public void startAuth(FingerprintManager manager,
FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(appContext,
Manifest.permission.USE_FINGERPRINT) !=
PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
@Override
public void onAuthenticationError(int errMsgId,
CharSequence errString) {
Toast.makeText(appContext,
"Authentication error\n" + errString,
Toast.LENGTH_LONG).show();
}
@Override
public void onAuthenticationHelp(int helpMsgId,
CharSequence helpString) {
Toast.makeText(appContext,
"Authentication help\n" + helpString,
Toast.LENGTH_LONG).show();
}
@Override
public void onAuthenticationFailed() {
Toast.makeText(appContext,
"Authentication failed.",
Toast.LENGTH_LONG).show();
}
@Override
public void onAuthenticationSucceeded(
FingerprintManager.AuthenticationResult result) {
Toast.makeText(appContext,
"Authentication succeeded.",
Toast.LENGTH_LONG).show();
}
} | [
"rlwise@oakland.edu"
] | rlwise@oakland.edu |
9a31e283096479d3a6dab6ca48137371a1b3e33a | 0deffdd02bc1a330a7f06d5366ba693b2fd10e61 | /BOOT_CAMP_PROJECTS/Deevanshu/sessionbeandemo/ejbModule/com/soft/ejb/LoginBean.java | 195f306e2a06990136b3e6a62beaa1be8b930c8d | [] | no_license | deevanshu07/Projects | 77adb903575de9563a324a294c04c88e50dfffeb | 6c49672b3b1eda8b16327b56114560140b087e38 | refs/heads/master | 2021-04-27T21:52:13.560590 | 2018-04-26T15:35:21 | 2018-04-26T15:35:21 | 122,406,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | package com.soft.ejb;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.sql.DataSource;
/**
* Session Bean implementation class LoginBean
*/
@Stateless
public class LoginBean implements LoginBeanRemote, LoginBeanLocal {
/**
* Default constructor.
*/
public LoginBean() {
// TODO Auto-generated constructor stub
}
@Resource(mappedName="java:OracleDS")
DataSource ds;
public boolean validate(String username,String password)
{
/*if(username.equals(password))
{
return true;
}
else
return false;*/
try
{
String sql="select * from user_login where username=?";
Connection con= ds.getConnection();
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1,username);
ResultSet result=pstmt.executeQuery();
if(result.next())
{
return true;
}
else
return false;
}
catch(Exception e)
{
e.printStackTrace();
}
return true;
}
} | [
"deevanshumahajan07@gmail.com"
] | deevanshumahajan07@gmail.com |
2d78a77fa3d2fe7c85b17839a4b2bc10f6504192 | 9223a94cef7d68a59f0191cac19550a48d9b62b6 | /src/java/com/fred/mock/MockUserService.java | e4d9c8e04da8a03df645d1caf86a557db507f3a1 | [] | no_license | Reeson2003/SheetAmountFX | ea7dd03fdc7f547c5b00654d8c6d1b6e125e6630 | 7a57796194d53f1358db2acc9ff9016f330252bb | refs/heads/master | 2021-01-20T05:20:31.052030 | 2017-08-27T14:59:20 | 2017-08-27T14:59:20 | 101,434,198 | 0 | 0 | null | 2017-08-27T14:59:20 | 2017-08-25T19:04:19 | Java | UTF-8 | Java | false | false | 2,058 | java | package com.fred.mock;
import ru.reeson2003.persist_user.api.UserPersistException;
import ru.reeson2003.persist_user.api.domain.User;
import ru.reeson2003.persist_user.api.service.UserQuery;
import ru.reeson2003.persist_user.api.service.UserService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Date: 27.08.2017.
* Time: 12:26.
*
* @author Pavel Gavrilov.
*/
public class MockUserService implements UserService {
private Map<Long, User> userMap = new HashMap<>();
private long idGenerator = 1L;
@Override
public void addUser(User user) throws UserPersistException {
if (user.getId() == 0) {
user.setId(idGenerator++);
userMap.put(user.getId(), user);
} else
throw new UserPersistException();
}
@Override
public User getUser(long userId) throws UserPersistException {
if (userMap.containsKey(userId))
return userMap.get(userId);
else
throw new UserPersistException();
}
@Override
public void updateUser(User user) throws UserPersistException {
if (userMap.containsKey(user.getId()))
userMap.put(user.getId(), user);
else
throw new UserPersistException();
}
@Override
public void deleteUser(long id) throws UserPersistException {
if (userMap.containsKey(id))
userMap.remove(id);
else
throw new UserPersistException();
}
@Override
public User findByLogin(String login) throws UserPersistException {
List<User> users = new ArrayList<>(userMap.values());
User user = null;
for (User u: users)
if (u.getLogin().equals(login))
return u;
throw new UserPersistException();
}
@Override
public List<User> getUsers() throws UserPersistException {
return new ArrayList<>(userMap.values());
}
@Override
public UserQuery createUserQuery() {
return null;
}
}
| [
"reeson2003@gmail.com"
] | reeson2003@gmail.com |
8f9d814e055ae40d7690992c5e82328bda6061ee | 26bd52a9b810b9f06c3416fdc4fbe4eb0e218933 | /DocBot-java/src/test/facade/AppointmentFacadeTest.java | 074f52fd0e8f2fff82b40357c8f0fb743a04c4a1 | [] | no_license | BenAfonso/DocBot-java | 09685e26124e34a807e1c6aa0f880f3a2111978f | 384babf2038a2453cc403f35e4f1d083ec75f30a | refs/heads/master | 2021-01-20T11:13:16.279089 | 2017-03-31T09:45:55 | 2017-03-31T09:45:55 | 84,453,611 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package test.facade;
import org.junit.Test;
/**
* Created by benjaminafonso on 30/03/2017.
*/
public class AppointmentFacadeTest {
@Test
public void accept() throws Exception {
}
@Test
public void addNewAppointment() throws Exception {
}
@Test
public void remove() throws Exception {
}
@Test
public void reject() throws Exception {
}
@Test
public void createAnswer() throws Exception {
}
} | [
"darkyler57@gmail.com"
] | darkyler57@gmail.com |
eb7a09a73ddb3910a6282ce3f5962405d663e84a | 77d5003632234bffc09a08efecbc008c672edb02 | /staffClassLibrary/src/my/staffLibraryPackage/cleanerFeeder.java | 9ef2835d33370f94d36811b736ae138e0f413d3b | [] | no_license | willhogan11/ZooProject | 6c3696c56e24c7e83181e0deef8216f26d8d5b9e | f77b610e85d032b32d382f3abfdf0f78f4afcdb6 | refs/heads/master | 2020-05-19T11:37:53.590795 | 2015-05-04T22:59:38 | 2015-05-04T22:59:38 | 35,064,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,460 | java | package my.staffLibraryPackage;
public class cleanerFeeder extends staff {
private int reportsToID;
private String reportsToName;
private String cleaningProductsRequired;
private String notes;
private String reportsTo;
private String jobDescription;
public cleanerFeeder () {
}
public String getReportsTo () {
return reportsTo;
}
public void setReportsTo (String val) {
this.reportsTo = val;
}
public int getReportsToID () {
return reportsToID;
}
public void setReportsToID (int val) {
this.reportsToID = val;
}
public String getJobDescription () {
return jobDescription;
}
public void setJobDescription (String val) {
this.jobDescription = val;
}
public String getCleaningProductsRequired () {
return cleaningProductsRequired;
}
public void setCleaningProductsRequired (String val) {
this.cleaningProductsRequired = val;
}
public String getNotes () {
return notes;
}
public void setNotes (String val) {
this.notes = val;
}
public String getReportsToName () {
return reportsToName;
}
public void setReportsToName (String val) {
this.reportsToName = val;
}
public String canFeedAnimals (String val) {
return val;
}
public String canCleanArea (String val) {
return val;
}
} | [
"willhogan11@hotmail.com"
] | willhogan11@hotmail.com |
fbe2fc4b466b2bcd393c3da324809e828df30d53 | 6c84f76a3faf2ad9644d1371264599952598f343 | /src/View/Interpreter.java | d92e3c1ae46f9ddf5a19aed81f7157652d6f15a4 | [] | no_license | VasilicaMoldovan/Toy-Language-Interpreter-with-Procedures | 5b85041e78f508b44685986a2a662a5eea96b481 | 2e54f2ca81b4e950b61a0dd2da55226587005ec3 | refs/heads/master | 2021-01-16T02:50:41.275087 | 2020-02-25T08:50:35 | 2020-02-25T08:50:35 | 242,951,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,188 | java | package View;
import Controller.Controller;
import Model.*;
import Model.DataStructures.MyList;
import Model.Exceptions.MyException;
import Model.Expressions.*;
import Model.Statement.*;
import Model.Types.BoolType;
import Model.Types.RefType;
import Model.Values.BoolValue;
import Model.Types.IntType;
import Model.Values.IntValue;
import Model.Values.RefValue;
import Model.Values.StringValue;
import Repository.IRepository;
import Repository.InMemRepo;
import java.util.ArrayList;
import java.util.Scanner;
public class Interpreter {
private Controller controller;
private MyList<IStmt> statements;
public Interpreter(Controller newController, MyList<IStmt> newStatements){
this.controller = newController;
this.statements = newStatements;
}
private void printMenu(){
System.out.println("\n-------Toy Language Interpreter-------");
for(int i = 0; i < statements.size(); i++){
System.out.println(String.format("%d: %s", i, statements.get(i).toString()));
}
System.out.println("-1: Exit.");
}
private int getInteger(Scanner scanner) throws MyException{
try{
return Integer.parseInt(scanner.nextLine());
}
catch (NumberFormatException e){
throw new MyException("Invalid integer");
}
}
private void infiniteLoop() throws MyException{
Scanner scanner = new Scanner(System.in);
while (true){
printMenu();
System.out.println("Choose one option:");
int option = -1;
try{
option = getInteger(scanner);
if (option == -1) break;
if (option < statements.size()){
try{
controller.allStep();
}
catch (MyException e){
e.printStackTrace();
}
}
}
catch(MyException e){
System.out.println(e.getMessage());
}
}
scanner.close();
}
public void runInterpreter() throws MyException{
infiniteLoop();
}
}
| [
"vasilicamoldovan2@gmail.com"
] | vasilicamoldovan2@gmail.com |
43e3cefc88f67514c9e3dd1db4bcbe9d26742429 | dac8a56ee2c38c3a48f7a38677cc252fd0b5f94a | /CodeSnippets/December/15Dec/Prog4/Prog4.java | 6625fcc0bbc99751132d346d63e2a0620e70c42b | [] | no_license | nikitasanjaypatil/Java9 | 64dbc0ec8b204c54bfed128d9517ea0fb00e97a4 | fd92b1b13d767e5ee48d88fe22f0260d3d1ac391 | refs/heads/master | 2023-03-15T03:44:34.347450 | 2021-02-28T17:13:01 | 2021-02-28T17:13:01 | 281,289,978 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 243 | java |
class Parent {
public String toString() {
return "Parent";
}
}
class Child extends Parent {
public static void main(String[] args) {
Parent p = new Child();
System.out.println(p.toString());
}
}
/*
* Output-
* Parent
*/
| [
"nikitaspatilaarvi@gmail.com"
] | nikitaspatilaarvi@gmail.com |
e0406ec44373c42d0fd3d4a4939ac0aed063b993 | 4e12c27a2aa1ccc7d82c899bab1ceba44b0a2874 | /funs-admin/src/main/java/org/sun/admin/config/ShiroConfig.java | c1c9dd8fbe97d59619f3e3795e8d08a20f117917 | [] | no_license | github-sun/Funs | d1401d33e994566929dee873051579f6d8610754 | 54286cab1473a6f71e304e0afddd0dafa8b2318c | refs/heads/master | 2021-05-12T06:07:36.165392 | 2019-04-01T07:18:52 | 2019-04-01T07:18:52 | 117,209,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,004 | java | package org.sun.admin.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.Filter;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.authc.pam.AuthenticationStrategy;
import org.apache.shiro.authc.pam.FirstSuccessfulStrategy;
import org.apache.shiro.authz.ModularRealmAuthorizer;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.session.SessionListener;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.servlet.Cookie;
import org.apache.shiro.web.servlet.SimpleCookie;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.sun.admin.redis.RedisCacheManager;
import org.sun.admin.redis.RedisSessionDAO;
import org.sun.admin.shiro.AdminFormAuthenticationFilter;
import org.sun.admin.shiro.AdminShiroRealm;
import org.sun.admin.shiro.MModularRealmAuthenticator;
import org.sun.admin.shiro.MSessionListener;
/**
* @author sun
* @date Jan 16, 2018 5:09:58 PM
*
*/
@Configuration
public class ShiroConfig {
public static final String DEFAULT_SESSION_ID_NAME = "SHIRO_JSESSIONID";
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Bean(name = "adminShiroRealm")
public AdminShiroRealm adminShiroRealm() {
logger.info("===adminShiroRealm()");
AdminShiroRealm adminShiroRealm = new AdminShiroRealm();
adminShiroRealm.setCachingEnabled(true);
adminShiroRealm.setAuthenticationCachingEnabled(true);
adminShiroRealm.setCacheManager(redisCacheManager());// redis权限缓存 默认缓存可注释此行
adminShiroRealm.setCredentialsMatcher(adminHashedCredentialsMatcher());
return adminShiroRealm;
}
@Bean(name = "redisCacheManager")
public RedisCacheManager redisCacheManager() {
logger.info("===redisCacheManager()");
return new RedisCacheManager();
}
@Bean(name = "redisSessionDAO")
public RedisSessionDAO redisSessionDAO() {
logger.debug("===redisSessionDAO()");
return new RedisSessionDAO();
}
@Bean(name = "customSessionListener")
public MSessionListener customSessionListener(){
logger.debug("===customSessionListener()");
return new MSessionListener();
}
@Bean(name = "sessionManager")
public DefaultWebSessionManager defaultWebSessionManager() {
logger.debug("===defaultWebSessionManager()");
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
// 用户信息必须是序列化格式,要不创建用户信息创建不过去,此坑很大,
sessionManager.setSessionDAO(redisSessionDAO());// 如不想使用REDIS可注释此行
Collection<SessionListener> sessionListeners = new ArrayList<>();
sessionListeners.add(customSessionListener());
sessionManager.setSessionListeners(sessionListeners);
// 单位为毫秒(1秒=1000毫秒) 3600000毫秒为1个小时
sessionManager.setSessionValidationInterval(30 * 60 * 1000);
// 3600000 milliseconds = 1 hour
sessionManager.setGlobalSessionTimeout(30 * 60 * 1000);
// 是否删除无效的,默认也是开启
sessionManager.setDeleteInvalidSessions(true);
// 是否开启 检测,默认开启
sessionManager.setSessionValidationSchedulerEnabled(true);
// 创建会话Cookie
Cookie cookie = new SimpleCookie(DEFAULT_SESSION_ID_NAME);
cookie.setName("WEBID");
cookie.setHttpOnly(true);
sessionManager.setSessionIdCookie(cookie);
return sessionManager;
}
@Bean(name = "adminHashedCredentialsMatcher")
public HashedCredentialsMatcher adminHashedCredentialsMatcher() {
logger.info("===adminHashedCredentialsMatcher()");
HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
hashedCredentialsMatcher.setHashAlgorithmName("md5");// 散列算法:这里使用MD5算法;
hashedCredentialsMatcher.setHashIterations(2);// 散列的次数,当于 m比如散列两次,相d5(md5(""));
return hashedCredentialsMatcher;
}
@Bean(name = "authenticationStrategy")
public AuthenticationStrategy authenticationStrategy() {
logger.info("===authenticationStrategy()");
return new FirstSuccessfulStrategy();
}
@Bean(name = "securityManager")
public DefaultWebSecurityManager getDefaultWebSecurityManage() {
logger.info("===getDefaultWebSecurityManage()");
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
Map<String, Object> shiroAuthenticatorRealms = new HashMap<>();
shiroAuthenticatorRealms.put("adminShiroRealm", adminShiroRealm());
Collection<Realm> shiroAuthorizerRealms = new ArrayList<Realm>();
shiroAuthorizerRealms.add(adminShiroRealm());
MModularRealmAuthenticator customModularRealmAuthenticator = new MModularRealmAuthenticator();
customModularRealmAuthenticator.setDefinedRealms(shiroAuthenticatorRealms);
customModularRealmAuthenticator.setAuthenticationStrategy(authenticationStrategy());
securityManager.setAuthenticator(customModularRealmAuthenticator);
ModularRealmAuthorizer customModularRealmAuthorizer = new ModularRealmAuthorizer();
customModularRealmAuthorizer.setRealms(shiroAuthorizerRealms);
securityManager.setAuthorizer(customModularRealmAuthorizer);
// 注入缓存管理器;
securityManager.setCacheManager(redisCacheManager());
securityManager.setSessionManager(defaultWebSessionManager());
return securityManager;
}
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityManager) {
logger.info("===shirFilter()");
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
// 必须设置 SecurityManager
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 增加自定义过滤
Map<String, Filter> filters = new HashMap<>();
filters.put("admin", new AdminFormAuthenticationFilter());
shiroFilterFactoryBean.setFilters(filters);
// 拦截器.
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
filterChainDefinitionMap.put("/admin/**", "admin");
filterChainDefinitionMap.put("/login*", "anon");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
@Bean(name = "lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
logger.debug("===lifecycleBeanPostProcessor()");
return new LifecycleBeanPostProcessor();
}
@ConditionalOnMissingBean
@Bean(name = "defaultAdvisorAutoProxyCreator")
@DependsOn("lifecycleBeanPostProcessor")
public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
logger.debug("===getDefaultAdvisorAutoProxyCreator()");
DefaultAdvisorAutoProxyCreator daap = new DefaultAdvisorAutoProxyCreator();
daap.setProxyTargetClass(true);
return daap;
}
@Bean(name="authorizationAttributeSourceAdvisor")
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager){
logger.debug("===authorizationAttributeSourceAdvisor()");
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
}
| [
"g.sunzc@gmail.com"
] | g.sunzc@gmail.com |
838727e6714c2918c288a80874b1dd8fd6d88c48 | 1bc0335b38ee0fdcb78dc7f053913811fba7ee6f | /app/src/test/java/com/example/user/lovecalculator/ExampleUnitTest.java | 2e34cca9f28f8f27aff860d797c513cfdd8372da | [] | no_license | mkbipu/LoveCalculator | 80f113c110366dfd87b142b8cebbbc24c47d7e38 | b0e32b16a072fba46f5c04fca8cc0475d0ac4bdc | refs/heads/master | 2020-04-04T20:39:47.012101 | 2018-11-05T17:23:55 | 2018-11-05T17:23:55 | 156,255,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.example.user.lovecalculator;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"bipu799@gmail.com"
] | bipu799@gmail.com |
150f4461a109b8da0e3060a276dfb3341b584339 | a8745edd172bdd6f11bb6611b8fd5d56101ebc79 | /src/br/udesc/ppr/interpreter/terminalexpression/Milhar.java | 41a8cb608e1787edeab5df223b80495db122b2b5 | [] | no_license | gabrielnaoto/Interpreter | ce139713fe9dd17bb9b8ca93ec4a5fab812267df | 0385c0e7637681bd4ae21be94dfa350d4b261a4d | refs/heads/master | 2021-01-17T19:57:45.543562 | 2016-06-14T03:16:07 | 2016-06-14T03:16:07 | 61,087,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,136 | 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 br.udesc.ppr.interpreter.terminalexpression;
import br.udesc.ppr.interpreter.abstractexpression.Interpreter;
import br.udesc.ppr.interpreter.context.Context;
/**
*
* @author ignoi
*/
public class Milhar extends Interpreter {
@Override
public boolean filtrar(Context contexto) {
if (contexto.getLenght() > 3) {
String input = Integer.toString(contexto.getInput());
contexto.setData(Integer.parseInt(input.substring(input.length() - 3, input.length())));
contexto.setInput((contexto.getInput() - contexto.getData()) / 1000);
return true;
}
return false;
}
@Override
public void classe(Context contexto) {
if (contexto.getOutput().trim().equals("um")) {
contexto.setOutput("mil ");
} else {
contexto.setOutput(contexto.getOutput() + "mil ");
}
contexto.setInput(contexto.getData());
}
}
| [
"gabrielnaoto@yahoo.com.br"
] | gabrielnaoto@yahoo.com.br |
1b130e683cd21566060b060fe7c7ac208e6155fd | ec59d0de80aa64da2eaef3404b07aad915e84573 | /src/test/java/PS_openbucks_Test.java | 579ea969c8e2cd6d8732626d658fde796206fcde | [] | no_license | tamahouse/project3ds | a593075f321bbf8ba2085e63b7ffda68f78c8162 | 1feaf950e8bc4587c815a06e95d3557a74e642fb | refs/heads/master | 2022-06-24T23:25:44.949698 | 2020-01-21T11:34:19 | 2020-01-21T11:34:19 | 194,599,142 | 0 | 1 | null | 2022-06-21T01:22:03 | 2019-07-01T04:23:05 | HTML | UTF-8 | Java | false | false | 2,876 | java |
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import automation.project3ds.Action;
import automation.project3ds.AnnotationPage;
import automation.project3ds.Assertion;
import automation.project3ds.BaseTest;
import automation.project3ds.Driver;
import automation.project3ds.Network;
import automation.project3ds.PS_allthegate;
import automation.project3ds.PS_allthegate2;
import automation.project3ds.PS_boletobancario;
import automation.project3ds.PS_canadapost;
import automation.project3ds.PS_canadapost2;
import automation.project3ds.PS_cherrycredits;
import automation.project3ds.PS_cherrycredits2;
import automation.project3ds.PS_kftc;
import automation.project3ds.PS_kftc2;
import automation.project3ds.PS_mollie;
import automation.project3ds.PS_moneygram;
import automation.project3ds.PS_moneygram2;
import automation.project3ds.PS_netbanking;
import automation.project3ds.PS_netbanking2;
import automation.project3ds.PS_openbucks;
import automation.project3ds.PS_openbucks2;
import automation.project3ds.PS_shortcode;
import automation.project3ds.PS_walmart;
import automation.project3ds.PS_walmart2;
import automation.project3ds.PS_webmoney;
import automation.project3ds.PS_webmoney2;
import automation.project3ds.PS_yamoney;
import automation.project3ds.PS_yamoney2;
import automation.project3ds.PS_yandexmoney;
import automation.project3ds.PS_yandexmoney2;
import automation.project3ds.Pslog;
import automation.project3ds.WidgetMulti;
import automation.project3ds.WidgetPage;
public class PS_openbucks_Test extends BaseTest{
String shortcode = PS_shortcode.OPENBUCKS;
// String url = "http://feature-pwl-2060.wallapi.bamboo.stuffio.com";
String co_id = "2";
String host = AnnotationPage.WallapiUrl.host(url).widget(widget).isPrice(price, currency).isUidTimeline().co_id(co_id).isCustom(AnnotationPage.WallapiUrl.SUCCESS_URL, "https%3A%2F%2Fwww.spam4.me").generate();
// static Driver driver;
//
// @BeforeClass
// public void setUp() throws Exception {
// Login.login(host);
// }
//
//
// @AfterClass
// public void tearDown() {
// driver.quit();
// AnnotationPage.driver = null;
// }
@BeforeClass
public void setUp() {
this.driver = new Driver(browser);
login(host);
}
// @BeforeMethod
// public void openBrick() throws Exception {
// driver.get(host);
// ps = (PS_Neosurf) widgetMulti.createClick(shortcode);
// }
@Test
public void execute() throws Exception {
WidgetPage widgetPage = new WidgetPage(driver);
Object object = widgetPage.getPS(widget, shortcode,logo);
PS_openbucks ps = (PS_openbucks) object;
PS_openbucks2 ps2 = ps.getNewWindows();
ps2.finishPaymentOpenbuck();
String cl_id = Pslog.get_cl_id_email_Fasterpay(shortcode);
Assertion.assertClickAvailable(cl_id);
// String cl_id = Pslog.get_cl_id_email_Fasterpay("giropay");
// Assertion.assertConverted(cl_id);
}
}
| [
"chase@pw.loc"
] | chase@pw.loc |
2a76f7d63de9d882ad0723d19d492d2f221d7ff4 | 752ac632a86d21b392d6283cf913068e51c0331b | /app/src/main/java/com/bazaarvoice/bvsdkdemoandroid/conversations/answers/DemoAnswersAdapter.java | f6cc9b6a7dea1a609c6f6661ac2e5c638948a269 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | kenhkelly/bv-android-sdk | 287596fa73e747f6e96b1f1c7de3c5235b62a333 | 9b0af18b70e7281b3a9b83b4faa86a8ae09fdcff | refs/heads/master | 2021-01-01T16:36:10.278005 | 2017-07-20T20:42:27 | 2017-07-28T13:53:16 | 97,865,955 | 0 | 0 | null | 2017-07-20T18:21:15 | 2017-07-20T18:21:15 | null | UTF-8 | Java | false | false | 4,715 | java | /**
* Copyright 2016 Bazaarvoice Inc. All rights reserved.
*/
package com.bazaarvoice.bvsdkdemoandroid.conversations.answers;
import android.app.Activity;
import android.support.v4.text.util.LinkifyCompat;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.bazaarvoice.bvandroidsdk.Answer;
import com.bazaarvoice.bvsdkdemoandroid.R;
import com.bazaarvoice.bvsdkdemoandroid.author.DemoAuthorActivity;
import org.ocpsoft.prettytime.PrettyTime;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
public class DemoAnswersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<Answer> answers = Collections.emptyList();
private PrettyTime prettyTime;
public DemoAnswersAdapter() {
this.prettyTime = new PrettyTime();
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_product_answer, parent, false);
return new AnswerRowViewHolder(view);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
Answer bazaarAnswer = answers.get(position);
AnswerRowViewHolder answerRowViewHolder = (AnswerRowViewHolder) holder;
answerRowViewHolder.answerText.setText(bazaarAnswer.getAnswerText());
boolean hasTimeAgo = bazaarAnswer.getSubmissionDate() != null;
if (hasTimeAgo) {
String timeAgo = prettyTime.format(bazaarAnswer.getSubmissionDate());
boolean hasUserNickname = !TextUtils.isEmpty(bazaarAnswer.getUserNickname());
final String nickName = bazaarAnswer.getUserNickname();
final String authorId = bazaarAnswer.getAuthorId();
String timeAgoBy = hasUserNickname ? timeAgo + " by " + bazaarAnswer.getUserNickname() : timeAgo;
answerRowViewHolder.answerTimeAgo.setText(timeAgoBy);
answerRowViewHolder.answerTimeAgo.setVisibility(View.VISIBLE);
if (!TextUtils.isEmpty(nickName)) {
Pattern authorPattern = Pattern.compile(nickName);
LinkifyCompat.addLinks(answerRowViewHolder.answerTimeAgo, authorPattern, null);
answerRowViewHolder.answerTimeAgo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView tv = (TextView) v;
String tvText = String.valueOf(tv.getText());
int selectStart = tv.getSelectionStart();
int selectEnd = tv.getSelectionEnd();
String selectedString = null;
if (0 <= selectStart && selectStart <= tvText.length() && 0 <= selectEnd && selectEnd <= tvText.length()) {
selectedString = String.valueOf(tvText.subSequence(selectStart, selectEnd));
}
if (selectedString != null && selectedString.equals(nickName)) {
DemoAuthorActivity.transitionTo((Activity) tv.getContext(), authorId);
}
}
});
}
} else {
answerRowViewHolder.answerTimeAgo.setVisibility(View.GONE);
}
boolean hasFeedback = bazaarAnswer.getTotalFeedbackCount() > 0;
if (hasFeedback) {
String foundHelpfulFormatter = answerRowViewHolder.answerFoundHelpful.getResources().getString(R.string.answer_found_helpful);
String foundHelpful = String.format(foundHelpfulFormatter, bazaarAnswer.getTotalPositiveFeedbackCount(), bazaarAnswer.getTotalFeedbackCount());
answerRowViewHolder.answerFoundHelpful.setText(foundHelpful);
}
}
@Override
public int getItemCount() {
return answers.size();
}
public void refreshAnswers(List<Answer> answers) {
this.answers = answers;
notifyDataSetChanged();;
}
private final class AnswerRowViewHolder extends RecyclerView.ViewHolder {
TextView answerText, answerTimeAgo, answerFoundHelpful;
public AnswerRowViewHolder(View itemView) {
super(itemView);
answerText = (TextView) itemView.findViewById(R.id.answer_text);
answerTimeAgo = (TextView) itemView.findViewById(R.id.answer_time_ago);
answerFoundHelpful = (TextView) itemView.findViewById(R.id.answer_found_helpful);
}
}
}
| [
"casey.kulm@bazaarvoice.com"
] | casey.kulm@bazaarvoice.com |
4b76f9ad849174fec2583e14c118382819bbeb2c | 6ced4088ca5e23c38ad08b12bbae4cefa77f2ec6 | /app/src/main/java/com/sahil/newsapp/ui/ajjTak/HomeViewModel.java | 3128dddea5f13dc95b216b26087adca20dc7c89f | [] | no_license | SahilGupta03/NewsApp | 6791807f1666daa040e9eba1d5fb2fc05327e3b1 | d0552b73333715411be8de718ff2b69ee9649d97 | refs/heads/master | 2023-06-05T11:45:49.173669 | 2021-06-20T06:59:29 | 2021-06-20T06:59:29 | 378,579,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.sahil.newsapp.ui.ajjTak;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class HomeViewModel extends ViewModel {
private MutableLiveData<String> mText;
public HomeViewModel() {
mText = new MutableLiveData<>();
mText.setValue(" AajTak News");
}
public LiveData<String> getText() {
return mText;
}
} | [
"sahil84330@gmail.com"
] | sahil84330@gmail.com |
b6b2608eef2153515f700b4161ce762263aeba18 | 6217e1ca0939787bfcee3fb6ed6a2902cffa46ae | /app/src/main/java/com/example/purushotham/collapsingtoolbartest/Model/MyModel.java | 2792f56e80584b0f1535040ec82bb2c7f7542544 | [] | no_license | purushotham541/CollapsingToolbar2 | f48a94f5ee97a1ad806b4b0ce3ccd845eb3e4023 | a607268df0ae5d6856dadffaf5c8b8961bdd677e | refs/heads/master | 2020-06-09T03:48:22.893829 | 2019-06-23T15:28:51 | 2019-06-23T15:28:51 | 193,364,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,354 | java | package com.example.purushotham.collapsingtoolbartest.Model;
public class MyModel
{
private int userId;
private int id;
private String title;
private Boolean completed;
public MyModel(int userId, String title, Boolean completed) {
this.userId = userId;
this.title = title;
this.completed = completed;
}
public MyModel(int userId, int id, String title, Boolean completed) {
this.userId = userId;
this.id = id;
this.title = title;
this.completed = completed;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Boolean getCompleted() {
return completed;
}
public void setCompleted(Boolean completed) {
this.completed = completed;
}
@Override
public String toString() {
return "MyModel{" +
"userId=" + userId +
", id=" + id +
", title='" + title + '\'' +
", completed=" + completed +
'}';
}
}
| [
"purushotham541@gmail.com"
] | purushotham541@gmail.com |
f945efa3ac9b12dc79feaddb01ce3448f9296d0c | 0b4844d550c8e77cd93940e4a1d8b06d0fbeabf7 | /JavaSource/dream/mgr/usrgrp/action/MgrUsrGrpPageAuthBtnAction.java | 3e18f1e34296d42d13817e3c4c32921734a0f646 | [] | no_license | eMainTec-DREAM/DREAM | bbf928b5c50dd416e1d45db3722f6c9e35d8973c | 05e3ea85f9adb6ad6cbe02f4af44d941400a1620 | refs/heads/master | 2020-12-22T20:44:44.387788 | 2020-01-29T06:47:47 | 2020-01-29T06:47:47 | 236,912,749 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 8,787 | java | package dream.mgr.usrgrp.action;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import common.bean.User;
import common.config.service.ConfigService;
import common.struts.AuthAction;
import common.util.CommonUtil;
import dream.mgr.usrgrp.dto.MgrUsrGrpPageAuthBtnDTO;
import dream.mgr.usrgrp.form.MgrUsrGrpPageAuthBtnForm;
import dream.mgr.usrgrp.service.MgrUsrGrpPageAuthBtnService;
/**
* 화면권한설정상세탭버튼권한
* @author ghlee
* @version $Id:$
* @since 1.0
* @struts:action path="/mgrUsrGrpPageAuthBtnList" name="mgrUsrGrpPageAuthBtnForm"
* input="/dream/mgr/usrgrp/mgrUsrGrpPageAuthBtnList.jsp" scope="request"
* validate="false"
* @struts:action path="/mgrUsrGrpPageAuthBtnDetail" name="mgrUsrGrpPageAuthBtnForm"
* input="/dream/mgr/usrgrp/mgrUsrGrpPageAuthBtnDetail.jsp" scope="request"
* validate="false"
* @struts.action-forward name="mgrUsrGrpPageAuthBtnDetail" path="/dream/mgr/usrgrp/mgrUsrGrpPageAuthBtnDetail.jsp"
* redirect="false"
*/
public class MgrUsrGrpPageAuthBtnAction extends AuthAction
{
/** 목록 조회 */
public static final int LIST_FIND = 1001;
/** 목록 권한부여 */
public static final int LIST_INPUT_AUTH = 1002;
/** 목록 권한제거 */
public static final int LIST_DELETE_AUTH = 1003;
/** 목록에서 선택후 TAB이동 조회를 하는경우 */
public static final int DETAIL_INIT = 1004;
/** 상세 수정 */
public static final int DETAIL_UPDATE = 1005;
protected ActionForward run(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
ActionForward returnActionForward = null;
MgrUsrGrpPageAuthBtnForm mgrUsrGrpPageAuthBtnForm = (MgrUsrGrpPageAuthBtnForm) form;
switch (mgrUsrGrpPageAuthBtnForm.getStrutsAction())
{
case MgrUsrGrpPageAuthBtnAction.BASE_SET_HEADER:
setHeader(request, response, mgrUsrGrpPageAuthBtnForm);
returnActionForward = mapping.findForward("jsonPage");
break;
case MgrUsrGrpPageAuthBtnAction.LIST_FIND:
findList(request, response, mgrUsrGrpPageAuthBtnForm, false);
returnActionForward = mapping.findForward("jsonPage");
break;
case MgrUsrGrpPageAuthBtnAction.LIST_INPUT_AUTH:
inputAuth(request, mgrUsrGrpPageAuthBtnForm);
returnActionForward = mapping.findForward("ajaxXmlVal");
break;
case MgrUsrGrpPageAuthBtnAction.LIST_DELETE_AUTH:
deleteAuth(request, mgrUsrGrpPageAuthBtnForm);
returnActionForward = mapping.findForward("ajaxXmlVal");
break;
case MgrUsrGrpPageAuthBtnAction.BASE_GRID_EXPORT:
findList(request, response, mgrUsrGrpPageAuthBtnForm,true);
returnActionForward = new ActionForward("/gridExport");
break;
case MgrUsrGrpPageAuthBtnAction.DETAIL_INIT:
findDetail(request, response, mgrUsrGrpPageAuthBtnForm);
returnActionForward = mapping.findForward("mgrUsrGrpPageAuthBtnDetail");
break;
case MgrUsrGrpPageAuthBtnAction.DETAIL_UPDATE:
updateDetail(request, response, mgrUsrGrpPageAuthBtnForm);
returnActionForward = mapping.findForward("ajaxXmlVal");
break;
default:
returnActionForward = mapping.getInputForward();
break;
}
return returnActionForward;
}
private void setHeader(HttpServletRequest request, HttpServletResponse response, MgrUsrGrpPageAuthBtnForm mgrUsrGrpPageAuthBtnForm) throws IOException
{
super.setHeader(request, response, mgrUsrGrpPageAuthBtnForm.getListId(), mgrUsrGrpPageAuthBtnForm.getCurrentPageId());
}
private void findList(HttpServletRequest request, HttpServletResponse response, MgrUsrGrpPageAuthBtnForm mgrUsrGrpPageAuthBtnForm, boolean excelExport) throws Exception
{
MgrUsrGrpPageAuthBtnService mgrUsrGrpPageAuthBtnService = (MgrUsrGrpPageAuthBtnService) getBean("mgrUsrGrpPageAuthBtnService");
MgrUsrGrpPageAuthBtnDTO mgrUsrGrpPageAuthBtnDTO = mgrUsrGrpPageAuthBtnForm.getMgrUsrGrpPageAuthBtnDTO();
//Paging
mgrUsrGrpPageAuthBtnDTO.setIsLoadMaxCount("Y".equals(mgrUsrGrpPageAuthBtnForm.getIsLoadMaxCount())?true:false);
mgrUsrGrpPageAuthBtnDTO.setFirstRow(mgrUsrGrpPageAuthBtnForm.getFirstRow());
mgrUsrGrpPageAuthBtnDTO.setOrderBy(mgrUsrGrpPageAuthBtnForm.getOrderBy());
mgrUsrGrpPageAuthBtnDTO.setDirection(mgrUsrGrpPageAuthBtnForm.getDirection());
User user = getUser(request);
List resultList = mgrUsrGrpPageAuthBtnService.findList(mgrUsrGrpPageAuthBtnDTO, user);
//Paging
String totalCount = "";
if(Integer.parseInt(mgrUsrGrpPageAuthBtnForm.getIsTotalCount()) == 0 && !excelExport) totalCount = mgrUsrGrpPageAuthBtnService.findTotalCount(mgrUsrGrpPageAuthBtnDTO,getUser(request));
if(excelExport) CommonUtil.makeGridExport(resultList, request, response,mgrUsrGrpPageAuthBtnForm);
else CommonUtil.makeJsonResult(resultList, request, response, totalCount);
}
private void inputAuth(HttpServletRequest request, MgrUsrGrpPageAuthBtnForm mgrUsrGrpPageAuthBtnForm) throws Exception
{
MgrUsrGrpPageAuthBtnService mgrUsrGrpPageAuthBtnService = (MgrUsrGrpPageAuthBtnService) getBean("mgrUsrGrpPageAuthBtnService");
String[] pgbtnIds = mgrUsrGrpPageAuthBtnForm.getDeleteRows();
String[] usrgrpIds = mgrUsrGrpPageAuthBtnForm.getDeleteRowsExt();
User user = getUser(request);
mgrUsrGrpPageAuthBtnService.inputAuth(pgbtnIds, usrgrpIds, user);
loadSec();
setAjaxStatus(request);
}
private void deleteAuth(HttpServletRequest request, MgrUsrGrpPageAuthBtnForm mgrUsrGrpPageAuthBtnForm) throws Exception
{
MgrUsrGrpPageAuthBtnService mgrUsrGrpPageAuthBtnService = (MgrUsrGrpPageAuthBtnService) getBean("mgrUsrGrpPageAuthBtnService");
String[] pgbtnIds = mgrUsrGrpPageAuthBtnForm.getDeleteRows();
String[] usrgrpIds = mgrUsrGrpPageAuthBtnForm.getDeleteRowsExt();
User user = getUser(request);
mgrUsrGrpPageAuthBtnService.deleteAuth(pgbtnIds, usrgrpIds, user);
loadSec();
setAjaxStatus(request);
}
private void findDetail(HttpServletRequest request, HttpServletResponse response, MgrUsrGrpPageAuthBtnForm mgrUsrGrpPageAuthBtnForm) throws Exception
{
MgrUsrGrpPageAuthBtnService mgrUsrGrpPageAuthBtnService = (MgrUsrGrpPageAuthBtnService)getBean("mgrUsrGrpPageAuthBtnService");
MgrUsrGrpPageAuthBtnDTO mgrUsrGrpPageAuthBtnDTO = mgrUsrGrpPageAuthBtnForm.getMgrUsrGrpPageAuthBtnDTO();
User user = getUser(request);
mgrUsrGrpPageAuthBtnDTO = mgrUsrGrpPageAuthBtnService.findDetail(mgrUsrGrpPageAuthBtnDTO, user);
mgrUsrGrpPageAuthBtnForm.setMgrUsrGrpPageAuthBtnDTO(mgrUsrGrpPageAuthBtnDTO);
}
private void updateDetail(HttpServletRequest request, HttpServletResponse response, MgrUsrGrpPageAuthBtnForm mgrUsrGrpPageAuthBtnForm) throws Exception
{
MgrUsrGrpPageAuthBtnService mgrUsrGrpPageAuthBtnService = (MgrUsrGrpPageAuthBtnService)getBean("mgrUsrGrpPageAuthBtnService");
MgrUsrGrpPageAuthBtnDTO mgrUsrGrpPageAuthBtnDTO = mgrUsrGrpPageAuthBtnForm.getMgrUsrGrpPageAuthBtnDTO();
User user = getUser(request);
mgrUsrGrpPageAuthBtnService.updateDetail(mgrUsrGrpPageAuthBtnDTO, user);
loadSec();
setAjaxStatus(request);
}
private void loadSec()
{
Runnable myThreadTask = new Runnable(){ //Runnable 객체
public void run(){
ConfigService configService = (ConfigService) CommonUtil.getBean("configService");
configService.loadSecurityTable();
}
};
Thread thread = new Thread(myThreadTask);
thread.start();
}
}
| [
"HN4741@10.31.0.185"
] | HN4741@10.31.0.185 |
8cb1e2b299233bdadf025d8b39bc00e1f588596c | f08256664e46e5ac1466f5c67dadce9e19b4e173 | /sources/p602m/p613d/p614a/p626n2/C13622h.java | b8e29a7b999433f7a2445a0361669dd1f738e1e0 | [] | no_license | IOIIIO/DisneyPlusSource | 5f981420df36bfbc3313756ffc7872d84246488d | 658947960bd71c0582324f045a400ae6c3147cc3 | refs/heads/master | 2020-09-30T22:33:43.011489 | 2019-12-11T22:27:58 | 2019-12-11T22:27:58 | 227,382,471 | 6 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,237 | java | package p602m.p613d.p614a.p626n2;
import java.math.BigInteger;
import p602m.p613d.p614a.C13484b1;
import p602m.p613d.p614a.C13589n;
import p602m.p613d.p614a.C13630p;
import p602m.p613d.p614a.C13643t;
import p602m.p613d.p653e.p654a.C13812e;
import p602m.p613d.p653e.p654a.C13812e.C13813a;
import p602m.p613d.p653e.p654a.C13812e.C13814b;
/* renamed from: m.d.a.n2.h */
/* compiled from: X9FieldElement */
public class C13622h extends C13589n {
/* renamed from: U */
private static C13624j f30288U = new C13624j();
/* renamed from: c */
protected C13812e f30289c;
public C13622h(C13812e eVar) {
this.f30289c = eVar;
}
/* renamed from: a */
public C13643t mo34785a() {
return new C13484b1(f30288U.mo34847a(this.f30289c.mo35117l(), f30288U.mo34846a(this.f30289c)));
}
/* renamed from: e */
public C13812e mo34842e() {
return this.f30289c;
}
public C13622h(BigInteger bigInteger, C13630p pVar) {
this(new C13814b(bigInteger, new BigInteger(1, pVar.mo34797i())));
}
public C13622h(int i, int i2, int i3, int i4, C13630p pVar) {
C13813a aVar = new C13813a(i, i2, i3, i4, new BigInteger(1, pVar.mo34797i()));
this(aVar);
}
}
| [
"101110@vivaldi.net"
] | 101110@vivaldi.net |
c730d0f37ee86083c5c574087bb0c68f917afeea | c1e8e725b92b6d701d19cf5e123cd6deba60d1ad | /platforms/android2/app/build/generated/not_namespaced_r_class_sources/release/processReleaseResources/r/android/support/fragment/R.java | 4ccd0b54aedd024e237780300c35b7c0fbd7f488 | [] | no_license | andrecastilho/kartero | 53807dff0a323938e107c833a6640295fd179815 | 56c76af97a050cd3cb257e31099755300da7e5a1 | refs/heads/master | 2020-04-08T09:14:55.517441 | 2018-11-26T23:10:07 | 2018-11-26T23:10:07 | 159,214,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,946 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.fragment;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int font = 0x7f010003;
public static final int fontProviderAuthority = 0x7f010004;
public static final int fontProviderCerts = 0x7f010005;
public static final int fontProviderFetchStrategy = 0x7f010006;
public static final int fontProviderFetchTimeout = 0x7f010007;
public static final int fontProviderPackage = 0x7f010008;
public static final int fontProviderQuery = 0x7f010009;
public static final int fontStyle = 0x7f01000a;
public static final int fontWeight = 0x7f01000b;
}
public static final class bool {
private bool() {}
public static final int abc_action_bar_embed_tabs = 0x7f020000;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f03000b;
public static final int notification_icon_bg_color = 0x7f03000c;
public static final int ripple_material_light = 0x7f03000f;
public static final int secondary_text_default_material_light = 0x7f030011;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f040000;
public static final int compat_button_inset_vertical_material = 0x7f040001;
public static final int compat_button_padding_horizontal_material = 0x7f040002;
public static final int compat_button_padding_vertical_material = 0x7f040003;
public static final int compat_control_corner_material = 0x7f040004;
public static final int notification_action_icon_size = 0x7f040005;
public static final int notification_action_text_size = 0x7f040006;
public static final int notification_big_circle_margin = 0x7f040007;
public static final int notification_content_margin_start = 0x7f040008;
public static final int notification_large_icon_height = 0x7f040009;
public static final int notification_large_icon_width = 0x7f04000a;
public static final int notification_main_column_padding_top = 0x7f04000b;
public static final int notification_media_narrow_margin = 0x7f04000c;
public static final int notification_right_icon_size = 0x7f04000d;
public static final int notification_right_side_padding_top = 0x7f04000e;
public static final int notification_small_icon_background_padding = 0x7f04000f;
public static final int notification_small_icon_size_as_large = 0x7f040010;
public static final int notification_subtext_size = 0x7f040011;
public static final int notification_top_pad = 0x7f040012;
public static final int notification_top_pad_large_text = 0x7f040013;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f050018;
public static final int notification_bg = 0x7f050019;
public static final int notification_bg_low = 0x7f05001a;
public static final int notification_bg_low_normal = 0x7f05001b;
public static final int notification_bg_low_pressed = 0x7f05001c;
public static final int notification_bg_normal = 0x7f05001d;
public static final int notification_bg_normal_pressed = 0x7f05001e;
public static final int notification_icon_background = 0x7f05001f;
public static final int notification_template_icon_bg = 0x7f050020;
public static final int notification_template_icon_low_bg = 0x7f050021;
public static final int notification_tile_bg = 0x7f050022;
public static final int notify_panel_notification_icon_bg = 0x7f050023;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f060001;
public static final int action_divider = 0x7f060002;
public static final int action_image = 0x7f060003;
public static final int action_text = 0x7f060004;
public static final int actions = 0x7f060005;
public static final int async = 0x7f060008;
public static final int blocking = 0x7f06000a;
public static final int chronometer = 0x7f06000c;
public static final int forever = 0x7f06000f;
public static final int icon = 0x7f060010;
public static final int icon_group = 0x7f060011;
public static final int info = 0x7f060013;
public static final int italic = 0x7f060014;
public static final int line1 = 0x7f060016;
public static final int line3 = 0x7f060017;
public static final int normal = 0x7f06001a;
public static final int notification_background = 0x7f06001b;
public static final int notification_main_column = 0x7f06001c;
public static final int notification_main_column_container = 0x7f06001d;
public static final int right_icon = 0x7f06001e;
public static final int right_side = 0x7f06001f;
public static final int text = 0x7f060022;
public static final int text2 = 0x7f060023;
public static final int time = 0x7f060024;
public static final int title = 0x7f060025;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f070002;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f080000;
public static final int notification_action_tombstone = 0x7f080001;
public static final int notification_template_custom_big = 0x7f080008;
public static final int notification_template_icon_group = 0x7f080009;
public static final int notification_template_part_chronometer = 0x7f08000d;
public static final int notification_template_part_time = 0x7f08000e;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0a0016;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0b0000;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0b0001;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0b0003;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0b0006;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0b0008;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0b000a;
public static final int Widget_Compat_NotificationActionText = 0x7f0b000b;
}
public static final class styleable {
private styleable() {}
public static final int[] FontFamily = { 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x7f010003, 0x7f01000a, 0x7f01000b };
public static final int FontFamilyFont_font = 0;
public static final int FontFamilyFont_fontStyle = 1;
public static final int FontFamilyFont_fontWeight = 2;
}
}
| [
"andrecastilho007@hotmail.com"
] | andrecastilho007@hotmail.com |
a4ae593f7f7bfb55827ce05f79609c4c5978e312 | 09bd603553a799ae2965375aeada0b04e4379529 | /src/main/java/Pages/SavingPage.java | 6fdd80749186cc306cd335ad0209dcbbe15485fa | [] | no_license | rachitbhatt007/CucumberPOMAutomation | 299529b138a4ecf7612934f16db0cf3114808787 | c6df652fbac953ac4a6dbe3e343f235bc1ca8ba0 | refs/heads/main | 2023-06-10T01:16:56.503519 | 2021-06-30T16:08:27 | 2021-06-30T16:08:27 | 381,760,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | package Pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
public class SavingPage {
WebDriver driver;
Boolean flag=false;
@FindBy(xpath = "//input[@id='productFrm_product_descriptionname']")
WebElement NameOfProduct;
@FindBy(xpath = "//i[@class=\"fa fa-save fa-fw\"]")
WebElement Savebutton;
@FindBy(xpath="//li[@id=\"menu_product\"]")
WebElement ProductPageLink;
@FindBy(xpath = "//div[@class='success alert alert-success']")
WebElement successalert;
public SavingPage(WebDriver driver){
PageFactory.initElements(driver,this);
this.driver=driver;
}
public void inputName(){
NameOfProduct.sendKeys(" Rachit");
}
public void saveProduct(){
Savebutton.click();
}
public Boolean Assertsaved(){
if(successalert!=null){
flag=true;
}
return flag;
}
public void navigateToproductPage(){
ProductPageLink.click();
}
}
| [
"rachit.bhatt07@gmail.com"
] | rachit.bhatt07@gmail.com |
b28900efeb4f25d465674182032e838ea8345e57 | 59e0d4e02296448ff591036debcc3d1757c19d2d | /src/main/java/com/growth/startupone/StartupOneApplication.java | f145217e643b40036596fff418dc062a7c83c145 | [] | no_license | vinicius-mfelix/traba.io | 46d54dc6f04ec28f4a85bd865002c4b7a58d92c0 | d4e9da7c172c2e0a25be688c3b22afb54976f1ac | refs/heads/main | 2023-06-20T07:55:22.000348 | 2021-07-16T20:00:48 | 2021-07-16T20:00:48 | 386,787,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package com.growth.startupone;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class StartupOneApplication {
public static void main(String[] args) {
SpringApplication.run(StartupOneApplication.class, args);
}
}
| [
"vinicius.matosfelix@gmail.com"
] | vinicius.matosfelix@gmail.com |
3dfe0bb5b162891e9b241a30891881f22ce9506f | a1593b159dd4f10a553a3b674f9e76928716d226 | /android/src/com/xinyuli/flappy/AndroidLauncher.java | 442e5e6077b311a9f81228f1ab37fa235ed2315f | [] | no_license | tracyliu1/Flappy | c87bf048772db8a454a315fddb8ba76d55de9ac3 | ce82fd79d441552778bc222652b53d0d3c5b6f10 | refs/heads/master | 2021-06-24T04:17:03.299960 | 2017-08-27T15:36:32 | 2017-08-27T15:36:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,143 | java | package com.xinyuli.flappy;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.google.android.gms.games.Games;
import com.google.example.games.basegameutils.GameHelper;
import com.xinyuli.flappy.utils.AndroidActionResolver;
/**
* The android launcher that sets up all needed android objects and pass them into the core game.
*/
public class AndroidLauncher extends AndroidApplication implements AndroidActionResolver {
private Recorder recorder;
private GameHelper gameHelper;
private Toast toast;
private final static int requestCode = 1;
private static final int msgWait = 0x1001;
private static final int refreshTime = 100;
private float volume = 10000;
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
setUpGame();
recorder = new Recorder();
initialize(new Flappy(this), config);
}
/**
* Set up google play game service.
*/
private void setUpGame() {
gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
gameHelper.enableDebugLog(false);
GameHelper.GameHelperListener gameHelperListener = new GameHelper.GameHelperListener() {
@Override
public void onSignInFailed(){
}
@Override
public void onSignInSucceeded(){
}
};
gameHelper.setup(gameHelperListener);
}
@Override
protected void onStart() {
super.onStart();
gameHelper.onStart(this);
}
@Override
protected void onStop() {
super.onStop();
try {
gameHelper.onStop();
recorder.stopRecording();
vHandler.removeMessages(msgWait);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Pause the handler by removing all messages. **Important**
*/
@Override
protected void onPause() {
super.onPause();
try {
recorder.stopRecording();
vHandler.removeMessages(msgWait);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onResume() {
super.onResume();
startRecording(); // safe because startRecording handles permission errors
}
@Override
protected void onDestroy() {
super.onDestroy();
try {
recorder.stopRecording();
vHandler.removeMessages(msgWait);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
gameHelper.onActivityResult(requestCode, resultCode, data);
}
@Override
public void signIn() {
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
gameHelper.beginUserInitiatedSignIn();
}
});
} catch (Exception e) {
Gdx.app.log("MainActivity", "Log in failed: " + e.getMessage() + ".");
Toast.makeText(this, "Failed to log in to Google Play", Toast.LENGTH_SHORT).show();
}
}
@Override
public void submitScore(int highScore) {
if (isSignedIn()) {
Games.Leaderboards.submitScore(gameHelper.getApiClient(),
getString(R.string.leaderboard_flappy), highScore);
}
}
@Override
public void showScore() {
if (isSignedIn()) {
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(gameHelper.getApiClient(),
getString(R.string.leaderboard_flappy)), requestCode);
} else {
signIn();
}
}
@Override
public boolean isSignedIn() {
return gameHelper.isSignedIn();
}
/**
* Use a new handler to show toast. Only one toast is shown at a time.
* @param text The text goes in the toast.
*/
@Override
public void showToast(final CharSequence text) {
final Context context = this;
handler.post(new Runnable() {
@Override
public void run() {
if (toast == null) {
toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
}
if (!toast.getView().isShown()) {
toast.setText(text);
toast.show();
}
}
});
}
@Override
public int getVolume() {
return (int)volume;
}
/**
* Separate thread for update volume. Has refresh threshold.
*/
private Handler vHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (this.hasMessages(msgWait)) {
return;
}
volume = recorder.getMaxAmplitude();
vHandler.sendEmptyMessageDelayed(msgWait, refreshTime);
}
};
/**
* Send message to handler to request for volume update.
*/
private void startListening() {
vHandler.sendEmptyMessageDelayed(msgWait, refreshTime);
}
/**
* Will pop up error toast if exceptions are thrown.
*/
public void startRecording() {
try {
if (recorder.startRecording()) {
startListening();
} else {
Toast.makeText(this, "Failed to get sound input", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Toast.makeText(this, "No permit to the recorder", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
}
| [
"li.cynthia.f@gmail.com"
] | li.cynthia.f@gmail.com |
c383e5f6e5476bbfbc11806dd1141be0e46c2df1 | 045a6e15cf0dc0a99e4be0486aa90ef35bd7a43d | /SeleniumTraining/src/com/typecasting/DowncastingTest.java | 3a03afb1d57941f269d6da41a671000d4a03f396 | [] | no_license | nareshbabumandula/Selenium_Tutorial | 1ea69a39806e7ae154a90b6d14265ffaae661a80 | e7399d6a381cd3f9fd39ee2013ed50197dbe0166 | refs/heads/main | 2023-04-22T22:55:09.023510 | 2021-05-18T17:36:57 | 2021-05-18T17:36:57 | 347,644,710 | 0 | 0 | null | 2021-04-04T16:54:06 | 2021-03-14T13:29:52 | Java | UTF-8 | Java | false | false | 389 | java | package com.typecasting;
public class DowncastingTest {
int y=200;
public static void main(String[] args) {
// Performing downcasting implicity
//Child c = new Parent(); // Compilation error
// Performing downcasting explicitly
Parent p = new Child();
Child c = (Child)p;
System.out.println(c.y);
System.out.println(c.x);
c.Walk();
c.Run();
c.Sleep();
}
}
| [
"naresh2223@gmail.com"
] | naresh2223@gmail.com |
a836ff20b906174804793497a7304b6d983b869d | 2237cb302827a244e8378ad195c5285c9c2bc5a4 | /src/main/java/exceptions/MyEntityNotFoundException.java | 46e4430e7085d5e645e2c85ad60a5c0deada846b | [] | no_license | DAE-2020/MSManagement | ebde6e91522e9cb75db2e7eb499fc88f49e6693a | c77dfceb527c00141a17c2f7ecdb88b08970b601 | refs/heads/master | 2023-02-02T16:51:18.784503 | 2020-12-15T19:17:09 | 2020-12-15T19:17:09 | 309,787,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package exceptions;
public class MyEntityNotFoundException extends Exception{
public MyEntityNotFoundException(){
}
public MyEntityNotFoundException(String msg){
super(msg);
}
}
| [
"marc_23.7@hotmail.com"
] | marc_23.7@hotmail.com |
15ee097f27a286ec6c48ac7e20efdf392d04ae2b | 9e2623af8c2dbe10f25ec80e4b277212f8fd68aa | /src/loongpluginfmrtool/popup/actions/RecoveryFeatureModelLIMBO.java | f36217322e87f1111bfe0fec22d197c47a8969f6 | [] | no_license | csytang/LoongFMR | 3cf37e5e85794bfd429c531d664e5cd199f0550c | 4630dd699508f05444096845a2e927102c65c0be | refs/heads/master | 2020-06-17T03:08:30.853738 | 2017-03-20T04:00:51 | 2017-03-20T04:00:51 | 75,045,876 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,751 | java | package loongpluginfmrtool.popup.actions;
import java.util.Iterator;
import loongplugin.source.database.ApplicationObserver;
import loongpluginfmrtool.module.model.module.ModuleBuilder;
import loongpluginfmrtool.toolbox.limbo.LIMBOConfigurationDialog;
import loongpluginfmrtool.views.moduleviews.ModuleViewPart.ModuleModelChangeListener;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
public class RecoveryFeatureModelLIMBO implements IObjectActionDelegate {
private IStructuredSelection aSelection;
private IProject aProject;
private Shell shell;
private IWorkbenchPart part;
private ApplicationObserver lDB;
public RecoveryFeatureModelLIMBO() {
// TODO Auto-generated constructor stub
}
@Override
public void run(IAction action) {
// TODO Auto-generated method stub
aProject = getSelectedProject();
WorkspaceJob op = null;
// ProgramDB 没有被初始化
lDB = ApplicationObserver.getInstance();
if(!this.lDB.isInitialized(aProject)){
Display.getCurrent().syncExec(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
MessageDialog.openInformation(shell, "Loong Plugin System-FMRTool",
"Please create the programDB first.");
}
});
}else{
LIMBOConfigurationDialog dialog = new LIMBOConfigurationDialog(lDB,shell);
dialog.create();
dialog.open();
}
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
// TODO Auto-generated method stub
if (selection instanceof IStructuredSelection)
aSelection = (IStructuredSelection) selection;
}
@Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
// TODO Auto-generated method stub
this.part = targetPart;
shell = targetPart.getSite().getShell();
}
private IProject getSelectedProject() {
IProject lReturn = null;
Iterator i = aSelection.iterator();
if (i.hasNext()) {
Object lNext = i.next();
if (lNext instanceof IResource) {
lReturn = ((IResource) lNext).getProject();
} else if (lNext instanceof IJavaElement) {
IJavaProject lProject = ((IJavaElement) lNext).getJavaProject();
lReturn = lProject.getProject();
}
}
return lReturn;
}
}
| [
"chris.yttang@hotmail.com"
] | chris.yttang@hotmail.com |
3f4a2812d3e7287559594e9edc0fb29a9ae30e5c | 72c10deaba9d380d746b82c41abc7c8a7cfa7c74 | /app/src/main/java/nu/paheco/patrik/homecontrol2015/dataadapter.java | 0030c4a0c05ca60037f2d436385c7a366cadf79b | [] | no_license | bphermansson/HomeControl2015 | 630ac03ddcaff65d5852bdeb6117a050327b8b9d | d6fa1a9026066259ff845f4663da8dd723d57a97 | refs/heads/master | 2016-09-06T11:19:31.842449 | 2015-03-23T06:44:05 | 2015-03-23T06:44:05 | 31,558,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,785 | java | package nu.paheco.patrik.homecontrol2015;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
/**
* Created by user on 1/18/15.
*/
public class dataadapter extends ArrayAdapter<dataclass> {
Context context;
int layoutResourceId;
dataclass data[] = null;
public dataadapter(Context context, int layoutResourceId, dataclass[] data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
WeatherHolder holder = null;
if(row == null)
{
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new WeatherHolder();
//holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon);
holder.txtTitle = (TextView)row.findViewById(R.id.txtTitle);
holder.txtInfo = (TextView)row.findViewById(R.id.txtInfo);
row.setTag(holder);
}
else
{
holder = (WeatherHolder)row.getTag();
}
dataclass weather = data[position];
holder.txtTitle.setText(weather.title);
holder.txtInfo.setText(weather.info);
//holder.imgIcon.setImageResource(weather.icon);
//holder.
return row;
}
static class WeatherHolder
{
//ImageView imgIcon;
TextView txtTitle;
TextView txtInfo;
}
}
| [
"patrik@paheco.nu"
] | patrik@paheco.nu |
41eceef84d30e05266c0383837f2bdaa5c89f190 | 1e28be61968d1bfc53dc6c3276a1723627b40401 | /javaweb工具类/C3P0工具包/c3p0资料/c3p0_jar/c3p0-0.9.2-pre1.src/src/java/com/mchange/v2/c3p0/management/PooledDataSourceManager.java | 0c08791e32ae991d5ea6a8483fd80e9e3866a36f | [] | no_license | zhangzhizheng/C3P0 | 46c41ee02d6bb72155d3a46a29936ab7bccb9c08 | 8e13e9ea983fa41e3112ee7601efefe2dccd192f | refs/heads/master | 2020-04-08T18:58:14.639043 | 2018-12-22T13:39:33 | 2018-12-22T13:39:33 | 159,632,756 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,731 | java | /*
* Distributed as part of c3p0 v.0.9.2-pre1
*
* Copyright (C) 2010 Machinery For Change, Inc.
*
* Author: Steve Waldman <swaldman@mchange.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1, as
* published by the Free Software Foundation.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; see the file LICENSE. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
package com.mchange.v2.c3p0.management;
import java.sql.SQLException;
import java.util.Collection;
import com.mchange.v2.c3p0.PooledDataSource;
public class PooledDataSourceManager implements PooledDataSourceManagerMBean
{
PooledDataSource pds;
public PooledDataSourceManager( PooledDataSource pds )
{ this.pds = pds; }
public String getIdentityToken()
{ return pds.getIdentityToken(); }
public String getDataSourceName()
{ return pds.getDataSourceName(); }
public void setDataSourceName(String dataSourceName)
{ pds.setDataSourceName( dataSourceName ); }
public int getNumConnectionsDefaultUser() throws SQLException
{ return pds.getNumConnectionsDefaultUser(); }
public int getNumIdleConnectionsDefaultUser() throws SQLException
{ return pds.getNumIdleConnectionsDefaultUser(); }
public int getNumBusyConnectionsDefaultUser() throws SQLException
{ return pds.getNumBusyConnectionsDefaultUser(); }
public int getNumUnclosedOrphanedConnectionsDefaultUser() throws SQLException
{ return pds.getNumUnclosedOrphanedConnectionsDefaultUser(); }
public float getEffectivePropertyCycleDefaultUser() throws SQLException
{ return pds.getEffectivePropertyCycleDefaultUser(); }
public int getThreadPoolSize() throws SQLException
{ return pds.getThreadPoolSize(); }
public int getThreadPoolNumActiveThreads() throws SQLException
{ return pds.getThreadPoolNumActiveThreads(); }
public int getThreadPoolNumIdleThreads() throws SQLException
{ return pds.getThreadPoolNumIdleThreads(); }
public int getThreadPoolNumTasksPending() throws SQLException
{ return pds.getThreadPoolNumTasksPending(); }
public String sampleThreadPoolStackTraces() throws SQLException
{ return pds.sampleThreadPoolStackTraces(); }
public String sampleThreadPoolStatus() throws SQLException
{ return pds.sampleThreadPoolStatus(); }
public void softResetDefaultUser() throws SQLException
{ pds.softResetDefaultUser(); }
public int getNumConnections(String username, String password) throws SQLException
{ return pds.getNumConnections( username, password ); }
public int getNumIdleConnections(String username, String password) throws SQLException
{ return pds.getNumIdleConnections( username, password ); }
public int getNumBusyConnections(String username, String password) throws SQLException
{ return pds.getNumBusyConnections( username, password ); }
public int getNumUnclosedOrphanedConnections(String username, String password) throws SQLException
{ return pds.getNumUnclosedOrphanedConnections( username, password ); }
public float getEffectivePropertyCycle(String username, String password) throws SQLException
{ return pds.getEffectivePropertyCycle( username, password ); }
public void softReset(String username, String password) throws SQLException
{ pds.softReset( username, password ); }
public int getNumBusyConnectionsAllUsers() throws SQLException
{ return pds.getNumBusyConnectionsAllUsers(); }
public int getNumIdleConnectionsAllUsers() throws SQLException
{ return pds.getNumIdleConnectionsAllUsers(); }
public int getNumConnectionsAllUsers() throws SQLException
{ return pds.getNumConnectionsAllUsers(); }
public int getNumUnclosedOrphanedConnectionsAllUsers() throws SQLException
{ return pds.getNumUnclosedOrphanedConnectionsAllUsers(); }
public void softResetAllUsers() throws SQLException
{ pds.softResetAllUsers(); }
public int getNumUserPools() throws SQLException
{ return pds.getNumUserPools(); }
public Collection getAllUsers() throws SQLException
{ return pds.getAllUsers(); }
public void hardReset() throws SQLException
{ pds.hardReset(); }
public void close() throws SQLException
{ pds.close(); }
}
| [
"zhang15036896990@163.com"
] | zhang15036896990@163.com |
9c09cb75ef68258c6c315e128d120503f118562a | 5934ea8903ab19a31b0724fb866bb45b332b34ad | /src/main/java/Main.java | 3b7e02c3c0489f033540b1233cf64a3c42a8b9c6 | [] | no_license | vlasiuk-andrii/BookingUZ | 4760ce4b79e3ee962412eafadb879c6c609dfe64 | 8a27197be7345914812daf04fd70c54a1139d904 | refs/heads/master | 2021-01-19T06:46:22.877018 | 2016-08-12T09:39:53 | 2016-08-12T09:39:53 | 60,261,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | import java.awt.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Main {
public static void main(String[] args) throws InterruptedException, AWTException {
Driver driver = new Driver();
int i = 0;
do {
DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
Date date = new Date();
i++;
System.out.println("i = " + i + " " + dateFormat.format(date));
driver.driverDoActions();
Thread.sleep(10*60000);
} while (true);
}
}
| [
"vlasiuk.andrii93@gmail.com"
] | vlasiuk.andrii93@gmail.com |
7aa6b8a6c14d21bc3b623d73c3515ceba604c363 | 7d2b200db2c005f39edbe6e85facf2d2f308b550 | /app/src/main/java/com/xuechuan/xcedu/mvp/contract/VideoOrderContract.java | 20d3d4500bba31af80338074518f36c080974569 | [] | no_license | yufeilong92/tushday | 872f54cd05d3cf8441d6f47d2a35ffda96f19edf | 7d463709de92e6c719557f4c5cba13676ed4b988 | refs/heads/master | 2020-04-13T08:38:43.435530 | 2018-12-25T14:02:12 | 2018-12-25T14:02:12 | 163,087,412 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | package com.xuechuan.xcedu.mvp.contract;
import android.content.Context;
import com.xuechuan.xcedu.mvp.view.RequestResulteView;
import com.xuechuan.xcedu.net.PayService;
import com.xuechuan.xcedu.net.view.StringCallBackView;
import java.util.List;
/**
* @version V 1.0 xxxxxxxx
* @Title: xcedu
* @Package com.xuechuan.xcedu.mvp.contract
* @Description: 视频下单
* @author: L-BackPacker
* @date: 2018/8/25 9:00
* @verdescript 版本号 修改时间 修改人 修改的概要说明
* @Copyright: 2018
*/
public interface VideoOrderContract {
interface Model {
public void sumbitPayFrom(Context context, String usebalance, List<Integer> products, String ordersource, final String remark, int addressid, RequestResulteView view);
}
interface View {
public void paySuccess(String result);
public void payError(String msg);
}
interface Presenter {
public void initModelView(Model model, View view);
public void sumbitPayFrom(Context context, String usebalance, List<Integer> products, String ordersource, final String remark, int addressid);
}
}
| [
"931697478@qq.com"
] | 931697478@qq.com |
94cd98c00da14cd4eff72ef2318620a906906906 | 393be50c47b4917b54cdd751681db3cea24966c0 | /app/src/main/java/com/example/ibrhm/instagramclone/Models/Users.java | 8ba5872a08b1f6918568c95a6f845841cb4c73fb | [] | no_license | ibrhmdurna/InstagramClone | 1af6eff88530a0f26b9b02fceb7247e26fba4f3d | 2d004fb3bcbfeebf4ee64fb3ee83116b647cea01 | refs/heads/master | 2023-01-20T05:02:22.249064 | 2019-05-16T14:30:20 | 2019-05-16T14:30:20 | 187,024,004 | 1 | 0 | null | 2023-01-09T11:40:02 | 2019-05-16T12:31:11 | Java | UTF-8 | Java | false | false | 1,853 | java | package com.example.ibrhm.instagramclone.Models;
public class Users {
private String email;
private String user_name;
private String full_name;
private String phone_number;
private String user_id;
private boolean private_account;
private Details details;
public Users() {
}
public Users(String email, String user_name, String full_name, String phone_number, String user_id, boolean private_account, Details details) {
this.email = email;
this.user_name = user_name;
this.full_name = full_name;
this.phone_number = phone_number;
this.user_id = user_id;
this.private_account = private_account;
this.details = details;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getFull_name() {
return full_name;
}
public void setFull_name(String full_name) {
this.full_name = full_name;
}
public String getPhone_number() {
return phone_number;
}
public void setPhone_number(String phone_number) {
this.phone_number = phone_number;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public Details getDetails() {
return details;
}
public void setDetails(Details details) {
this.details = details;
}
public boolean isPrivate_account() {
return private_account;
}
public void setPrivate_account(boolean private_account) {
this.private_account = private_account;
}
}
| [
"ibrhmdurna@gmail.com"
] | ibrhmdurna@gmail.com |
9a069344dc9841cdcfff7b2fcf264b119415864b | 39a190c30c9e9ee257ae9d2f4168f0fa4e3a1af1 | /serializable/serializableDemo/serializable/src/main/java/net/lishaoy/serializable/externalizable/Course.java | 294c10f36f8bfddb56bce175a475689395382849 | [] | no_license | persilee/android_practice | c4d4512b4ac1262af1cea12d5a1c3c06a6a1b545 | d4e2ee648e012021b4441f2ca553b4960bc8c7f9 | refs/heads/master | 2022-12-22T08:10:52.321019 | 2020-09-27T12:18:23 | 2020-09-27T12:18:23 | 282,993,066 | 10 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,464 | java | package net.lishaoy.serializable.externalizable;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
public class Course implements Externalizable {
private static final long serialVersionUID = -342346458732794596L;
private String name;
private float score;
public Course(){}
public Course(String name, float score) {
this.name = name;
this.score = score;
System.out.println("Course: " + "name " + name + " score " + score);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getScore() {
return score;
}
public void setScore(float score) {
this.score = score;
}
@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
System.out.println("writeExternal ...");
objectOutput.writeObject(name);
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
System.out.println("readExternal ...");
name = (String) objectInput.readObject();
}
@Override
public String toString() {
return "Course{" +
"name='" + name + '\'' +
", score=" + score +
'}';
}
public static void main(String[] args) throws IOException, ClassNotFoundException {
Course course = new Course("数学",66);
// 序列化
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream outputStream = new ObjectOutputStream(byteArrayOutputStream);
outputStream.writeObject(course);
course.setName("英语");
outputStream.reset();
outputStream.writeObject(course);
byte[] bytes = byteArrayOutputStream.toByteArray();
outputStream.close();
// 反序列化
ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(bytes));
Course course1 = (Course) inputStream.readObject();
Course course2 = (Course) inputStream.readObject();
System.out.println(course1);
System.out.println(course2);
}
}
| [
"i@lishaoy.net"
] | i@lishaoy.net |
8066477ded6fe103993716dd205ce92d56246d3b | ae57bad2430996035c1098ce25936ffa8d936a67 | /src/main/java/com/hxx/erp/common/PagePlugin.java | d578b4d92c8893fea6d1410e5e49e32c933fcb28 | [] | no_license | huangxingzhe/erp_web | 6c0116aea51b0d269da76ab93919fdefbe01bc2a | 5f13c5f84eb1ec9ba9eadc1e4b036f7f1087a46e | refs/heads/master | 2020-12-24T15:06:00.008748 | 2016-11-28T03:04:25 | 2016-11-28T03:04:25 | 32,071,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,570 | java | package com.hxx.erp.common;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.ibatis.executor.ErrorContext;
import org.apache.ibatis.executor.ExecutorException;
import org.apache.ibatis.executor.statement.BaseStatementHandler;
import org.apache.ibatis.executor.statement.RoutingStatementHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.mapping.ParameterMode;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.property.PropertyTokenizer;
import org.apache.ibatis.scripting.xmltags.ForEachSqlNode;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.type.TypeHandler;
import org.apache.ibatis.type.TypeHandlerRegistry;
import org.springframework.util.StringUtils;
import com.hxx.erp.util.ReflectHelper;
@Intercepts({@Signature(type=StatementHandler.class,method="prepare",args={Connection.class})})
public class PagePlugin implements Interceptor {
private static String dialect=""; //数据库方言
private static String pageSqlId = ""; //mapper.xml中需要拦截的ID(正则匹配)
public Object intercept(Invocation ivk) throws Throwable {
// TODO Auto-generated method stub
if(ivk.getTarget() instanceof RoutingStatementHandler){
RoutingStatementHandler statementHandler = (RoutingStatementHandler)ivk.getTarget();
BaseStatementHandler delegate = (BaseStatementHandler) ReflectHelper.getValueByFieldName(statementHandler, "delegate");
MappedStatement mappedStatement = (MappedStatement) ReflectHelper.getValueByFieldName(delegate, "mappedStatement");
if(mappedStatement.getId().matches(pageSqlId)){ //拦截需要分页的SQL
BoundSql boundSql = delegate.getBoundSql();
Object parameterObject = boundSql.getParameterObject();//分页SQL<select>中parameterType属性对应的实体参数,即Mapper接口中执行分页方法的参数,该参数不得为空
if(parameterObject==null){
throw new NullPointerException("parameterObject尚未实例化!");
}else{
Page<?> page = null;
if(parameterObject instanceof Page<?>){ //参数就是Page实体
page = (Page<?>) parameterObject;
}else if(parameterObject instanceof Map){
Object obj = ((Map)parameterObject).get("page");
if(obj != null){
page = (Page)obj;
}
}
Connection connection = (Connection) ivk.getArgs()[0];
String sql = boundSql.getSql();
if(page != null){
String countSql = getCountSql(sql); //记录统计
PreparedStatement countStmt = connection.prepareStatement(countSql);
BoundSql countBS = new BoundSql(mappedStatement.getConfiguration(),countSql,boundSql.getParameterMappings(),parameterObject);
setParameters(countStmt,mappedStatement,countBS,parameterObject);
ResultSet rs = countStmt.executeQuery();
int count = 0;
if (rs.next()) {
count = rs.getInt(1);
}
rs.close();
countStmt.close();
page.setEntityOrField(true);
page.setTotalResult(count);
}
// else{ //参数为某个实体,该实体拥有Page属性
// Field pageField = ReflectHelper.getFieldByFieldName(parameterObject,"page");
// if(pageField!=null){
// page = (Page<?>) ReflectHelper.getValueByFieldName(parameterObject,"page");
// if(page==null)
// page = new Page<?>();
// page.setEntityOrField(false); //见com.flf.entity.Page.entityOrField 注释
// page.setTotalResult(count);
// ReflectHelper.setValueByFieldName(parameterObject,"page", page); //通过反射,对实体对象设置分页对象
// }else{
// throw new NoSuchFieldException(parameterObject.getClass().getName()+"不存在 page 属性!");
// }
// }
String pageSql = generatePageSql(sql,page);
ReflectHelper.setValueByFieldName(boundSql, "sql", pageSql); //将分页sql语句反射回BoundSql.
}
}
}
return ivk.proceed();
}
/**
* 对SQL参数(?)设值,参考org.apache.ibatis.executor.parameter.DefaultParameterHandler
* @param ps
* @param mappedStatement
* @param boundSql
* @param parameterObject
* @throws SQLException
*/
private void setParameters(PreparedStatement ps,MappedStatement mappedStatement,BoundSql boundSql,Object parameterObject) throws SQLException {
ErrorContext.instance().activity("setting parameters").object(mappedStatement.getParameterMap().getId());
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
if (parameterMappings != null) {
Configuration configuration = mappedStatement.getConfiguration();
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
MetaObject metaObject = parameterObject == null ? null: configuration.newMetaObject(parameterObject);
for (int i = 0; i < parameterMappings.size(); i++) {
ParameterMapping parameterMapping = parameterMappings.get(i);
if (parameterMapping.getMode() != ParameterMode.OUT) {
Object value;
String propertyName = parameterMapping.getProperty();
PropertyTokenizer prop = new PropertyTokenizer(propertyName);
if (parameterObject == null) {
value = null;
} else if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
value = parameterObject;
} else if (boundSql.hasAdditionalParameter(propertyName)) {
value = boundSql.getAdditionalParameter(propertyName);
} else if (propertyName.startsWith(ForEachSqlNode.ITEM_PREFIX)&& boundSql.hasAdditionalParameter(prop.getName())) {
value = boundSql.getAdditionalParameter(prop.getName());
if (value != null) {
value = configuration.newMetaObject(value).getValue(propertyName.substring(prop.getName().length()));
}
} else {
value = metaObject == null ? null : metaObject.getValue(propertyName);
}
TypeHandler typeHandler = parameterMapping.getTypeHandler();
if (typeHandler == null) {
throw new ExecutorException("There was no TypeHandler found for parameter "+ propertyName + " of statement "+ mappedStatement.getId());
}
typeHandler.setParameter(ps, i + 1, value, parameterMapping.getJdbcType());
}
}
}
}
/**
* 根据数据库方言,生成特定的分页sql
* @param sql
* @param page
* @return
*/
private String generatePageSql(String sql,Page<?> page){
if(page!=null && !StringUtils.isEmpty(dialect)){
StringBuffer pageSql = new StringBuffer();
if("mysql".equals(dialect)){
pageSql.append(sql);
pageSql.append(" limit "+page.getCurrentResult()+","+page.getPageCount());
}else if("oracle".equals(dialect)){
pageSql.append("select * from (select tmp_tb.*,ROWNUM row_id from (");
pageSql.append(sql);
pageSql.append(") as tmp_tb where ROWNUM<=");
pageSql.append(page.getCurrentResult()+page.getPageCount());
pageSql.append(") where row_id>");
pageSql.append(page.getCurrentResult());
}
return pageSql.toString();
}else{
return sql;
}
}
private String getCountSql(String sql){
int index=sql.indexOf("from");
return " select count(1) "+sql.substring(index);
}
public Object plugin(Object arg0) {
// TODO Auto-generated method stub
return Plugin.wrap(arg0, this);
}
public void setProperties(Properties p) {
dialect = p.getProperty("dialect");
if (StringUtils.isEmpty(dialect)) {
try {
throw new Exception("dialect property is not found!");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
pageSqlId = p.getProperty("pageSqlId");
if (StringUtils.isEmpty(pageSqlId)) {
try {
throw new Exception("pageSqlId property is not found!");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
} | [
"huangxingzhe88@163.com"
] | huangxingzhe88@163.com |
b45408127251071fe3de1f332a2ea78d1a346c5d | 72c0f8fe31e8468be945a9883563906a2047e008 | /Heimaverkefni 13/BSTNode.java | 91b41a9a3722beb8f5ffac32fcf3ecf9a3c6a9b8 | [] | no_license | alli959/Dafny | 4b582de2394265b4e214e36f155e6b201ea97a08 | 0677b6431f5760bd781a23b2499016c0da1a1a99 | refs/heads/master | 2023-04-13T04:30:45.372706 | 2021-04-19T14:02:38 | 2021-04-19T14:02:38 | 329,484,797 | 0 | 0 | null | 2021-04-10T20:05:42 | 2021-01-14T02:22:25 | Dafny | UTF-8 | Java | false | false | 2,158 | java | // Höfundur: Snorri Agnarsson, snorri@hi.is
// Tilvik af klasanum BSTNode eru hnútar í tvíundartré.
// Afleiðing af þessari skilgreiningu er að öll möguleg
// tvíundartré eru annaðhvort null eða smíðuð með
// new BSTNode(left,val,right)
// þar sem left og right eru lögleg tvíundartré og val
// er heiltölugildi.
//
// Athugið að ekki er mögulegt að breyta innihaldi
// tvíundartrés.
//
// Þessi klasaskilgreining er bein samsvörun við Dafny
// skilgreininguna
// datatype BST = BSTEmpty | BSTNode(BST,int,BST)
// Öll gildi af tagi BSTNode eru lögleg, endanleg og
// óbreytanleg tvíundartré, sem helgast af því að ekki
// er hægt að breyta innihaldi hlutar af tagi BSTNode.
//
// Tómt tré er táknað með null.
//
// Ef gildin í tvíundartrénu eru í vaxandi röð þegar
// ferðast er gegnum tréð í milliröð (inorder röð)
// þá telst tréð vera tvíleitartré (binary search tree).
public class BSTNode
{
private int val;
private BSTNode left;
private BSTNode right;
// Notkun: BSTNode t = new BSTNode(left,val,right);
// Fyrir: left og right eru BSTNode (mega vera null),
// val er int. (Allt er þetta sjálfgefið og
// þarf ekki að taka fram.)
// Eftir: t vísar á hnút sem hefur val sem gildi,
// left sem vinstra undirtré og right sem
// hægra undirtré.
public BSTNode( BSTNode left, int val, BSTNode right )
{
this.left = left;
this.val = val;
this.right = right;
}
// Notkun: int x = BSTNode.rootValue(t);
// Fyrir: t != null.
// Eftir: x er gildið í rót t.
public static int rootValue( BSTNode t )
{
return t.val;
}
// Notkun: BSTNode x = BSTNode.left(t);
// Fyrir: t != null.
// Eftir: x er vinstra undirtré rótar t.
public static BSTNode left( BSTNode t )
{
return t.left;
}
// Notkun: BSTNode x = BSTNode.right(t);
// Fyrir: t != null.
// Eftir: x er hægra undirtré rótar t.
public static BSTNode right( BSTNode t )
{
return t.right;
}
} | [
"alexandergudmundsson@gmail.com"
] | alexandergudmundsson@gmail.com |
f66d8e835cc4b4508ba4267e5ede7fed5a33c82d | 25b2f2c7be843d14da2e4b103045c6d4e107d6a5 | /model/src/main/java/com/pitt/kill/model/mapper/ItemKillMapper.java | e9e05dcce74dd49ed2961ea97b1441273cfb0b16 | [] | no_license | pittttt/Seckill-system | 36368e852e2095034b1436d685f84909286d965a | 887c2a3f0a5dc480d4fc354f62b3ebd31314fbe8 | refs/heads/master | 2021-03-18T05:27:28.294605 | 2020-04-10T13:58:30 | 2020-04-10T13:58:30 | 247,049,586 | 1 | 0 | null | 2020-03-13T10:59:43 | 2020-03-13T10:52:33 | Java | UTF-8 | Java | false | false | 1,066 | java | package com.pitt.kill.model.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.pitt.kill.model.entity.ItemKill;
import com.pitt.kill.model.entity.ItemKillExample;
public interface ItemKillMapper {
// 查询待秒杀的商品列表
List<ItemKill> selectAll();
// 获取秒杀商品详情
ItemKill selectById(Integer id);
// 扣库存
int updateKillItem(Integer id);
long countByExample(ItemKillExample example);
int deleteByExample(ItemKillExample example);
int deleteByPrimaryKey(Integer id);
int insert(ItemKill record);
int insertSelective(ItemKill record);
List<ItemKill> selectByExample(ItemKillExample example);
ItemKill selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") ItemKill record, @Param("example") ItemKillExample example);
int updateByExample(@Param("record") ItemKill record, @Param("example") ItemKillExample example);
int updateByPrimaryKeySelective(ItemKill record);
int updateByPrimaryKey(ItemKill record);
} | [
"pitt@windows10.microdone.cn"
] | pitt@windows10.microdone.cn |
c7b992df04d4319d1cc35f6465fd1324b02f8c1f | 3f815e288a3d9002b9ae6cdf5a75d274b48a08c0 | /YummyProject/app/src/main/java/com/example/yummyproject/ItemActivity2.java | 11dcf9660a57be9587e40f4f7ef3309d4dbd63f9 | [] | no_license | DannnniHuang/CS6392019 | 0bd6ce2c0b2b9e6a27827ac264a1e9e4af6467ff | ff86faa4441f69acad985a3f2dd8f9a33d82f282 | refs/heads/master | 2020-05-30T00:23:42.262256 | 2019-07-13T15:16:57 | 2019-07-13T15:16:57 | 189,455,680 | 0 | 1 | null | 2019-06-03T02:50:24 | 2019-05-30T17:31:52 | null | UTF-8 | Java | false | false | 894 | java | package com.example.yummyproject;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
public class ItemActivity2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item2);
Button share_button = findViewById(R.id.button_share);
share_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "Share");
startActivity(Intent.createChooser(intent, "Share Food"));
}
});
}
}
| [
"DH12977N@PACE.EDU"
] | DH12977N@PACE.EDU |
b8ecb782121899dadc8e32ed6eefa096c9417ef4 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/elastic--elasticsearch/8a37cc2a3c2a718d17ed2e4883cb791f214e27c7/after/TermsQueryBuilder.java | 10967addd18f552db41a8e77de8aeeae7b36339e | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,253 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch 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.elasticsearch.index.query;
import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
/**
* A filter for a field based on several terms matching on any of them.
*/
public class TermsQueryBuilder extends QueryBuilder<TermsQueryBuilder> {
public static final String NAME = "terms";
private final String name;
private final Object values;
private String queryName;
private String execution;
private String lookupIndex;
private String lookupType;
private String lookupId;
private String lookupRouting;
private String lookupPath;
private Boolean lookupCache;
static final TermsQueryBuilder PROTOTYPE = new TermsQueryBuilder(null, (Object) null);
/**
* A filter for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
*/
public TermsQueryBuilder(String name, String... values) {
this(name, (Object[]) values);
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
*/
public TermsQueryBuilder(String name, int... values) {
this.name = name;
this.values = values;
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
*/
public TermsQueryBuilder(String name, long... values) {
this.name = name;
this.values = values;
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
*/
public TermsQueryBuilder(String name, float... values) {
this.name = name;
this.values = values;
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
*/
public TermsQueryBuilder(String name, double... values) {
this.name = name;
this.values = values;
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
*/
public TermsQueryBuilder(String name, Object... values) {
this.name = name;
this.values = values;
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
*/
public TermsQueryBuilder(String name, Iterable values) {
this.name = name;
this.values = values;
}
/**
* Sets the execution mode for the terms filter. Cane be either "plain", "bool"
* "and". Defaults to "plain".
* @deprecated elasticsearch now makes better decisions on its own
*/
@Deprecated
public TermsQueryBuilder execution(String execution) {
this.execution = execution;
return this;
}
/**
* Sets the filter name for the filter that can be used when searching for matched_filters per hit.
*/
public TermsQueryBuilder queryName(String queryName) {
this.queryName = queryName;
return this;
}
/**
* Sets the index name to lookup the terms from.
*/
public TermsQueryBuilder lookupIndex(String lookupIndex) {
this.lookupIndex = lookupIndex;
return this;
}
/**
* Sets the index type to lookup the terms from.
*/
public TermsQueryBuilder lookupType(String lookupType) {
this.lookupType = lookupType;
return this;
}
/**
* Sets the doc id to lookup the terms from.
*/
public TermsQueryBuilder lookupId(String lookupId) {
this.lookupId = lookupId;
return this;
}
/**
* Sets the path within the document to lookup the terms from.
*/
public TermsQueryBuilder lookupPath(String lookupPath) {
this.lookupPath = lookupPath;
return this;
}
public TermsQueryBuilder lookupRouting(String lookupRouting) {
this.lookupRouting = lookupRouting;
return this;
}
public TermsQueryBuilder lookupCache(boolean lookupCache) {
this.lookupCache = lookupCache;
return this;
}
@Override
public void doXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(NAME);
if (values == null) {
builder.startObject(name);
if (lookupIndex != null) {
builder.field("index", lookupIndex);
}
builder.field("type", lookupType);
builder.field("id", lookupId);
if (lookupRouting != null) {
builder.field("routing", lookupRouting);
}
if (lookupCache != null) {
builder.field("cache", lookupCache);
}
builder.field("path", lookupPath);
builder.endObject();
} else {
builder.field(name, values);
}
if (execution != null) {
builder.field("execution", execution);
}
if (queryName != null) {
builder.field("_name", queryName);
}
builder.endObject();
}
@Override
public String queryId() {
return NAME;
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
9142c272d2b3fe75339e85a4a3120ae4749ac09d | c914af9235374ede137c33c9a3e2c1dd514e9d2d | /src/main/java/kr/nzzi/msa/pmg/pomangamapimonilith/domain/product/sub/sub/service/ProductSubService.java | 014c3e20411306361c01a540f1d7e22a9302e285 | [] | no_license | cholnh/pomangam-api-monolith | 0e83f64ed39edbf712150bd62c7a348dcb87ac38 | bcbf045584068e0f03f69eab1e92d3b2e5771a29 | refs/heads/master | 2023-06-24T16:11:12.544604 | 2021-08-03T03:01:11 | 2021-08-03T03:01:11 | 390,221,364 | 0 | 0 | null | 2021-08-03T03:01:12 | 2021-07-28T05:09:15 | Java | UTF-8 | Java | false | false | 513 | java | package kr.nzzi.msa.pmg.pomangamapimonilith.domain.product.sub.sub.service;
import kr.nzzi.msa.pmg.pomangamapimonilith.domain.product.sub.category.dto.ProductSubCategoryDto;
import kr.nzzi.msa.pmg.pomangamapimonilith.domain.product.sub.sub.dto.ProductSubDto;
import java.util.List;
public interface ProductSubService {
List<ProductSubCategoryDto> findByIdxProduct(Long pIdx);
List<ProductSubCategoryDto> findByIdxProductSubCategory(Long cIdx);
ProductSubDto findByIdx(Long idx);
long count();
}
| [
"cholnh1@naver.com"
] | cholnh1@naver.com |
4ea05a1458946e185cab3d9b16391ce9d06edd1e | ed5795cb92a415d46565fe7db0c120ea7667edb9 | /src/main/java/com/staticcrud/StaticCrud/service/StudentService.java | 2bda29f4ffb5d517ebd88354fcd38e611c518858 | [] | no_license | samrait/SimpleJavaApp | 18ee3cb894f04997ebd1aacd8577288798f622e0 | e1eaca95114cda8883261054c5497d2a1930ca7b | refs/heads/master | 2022-10-24T06:57:54.382306 | 2020-06-11T10:55:53 | 2020-06-11T10:55:53 | 271,466,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,650 | java | package com.staticcrud.StaticCrud.service;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.stereotype.Service;
import com.staticcrud.StaticCrud.model.Course;
import com.staticcrud.StaticCrud.model.Student;
@Service
public class StudentService {
private static List<Student> students = new ArrayList<>();
static {
//Initialize Data
Course course1 = new Course("Course1", "Spring", "10 Steps", Arrays
.asList("Learn Maven", "Import Project", "First Example",
"Second Example"));
Course course2 = new Course("Course2", "Spring MVC", "10 Examples",
Arrays.asList("Learn Maven", "Import Project", "First Example",
"Second Example"));
Course course3 = new Course("Course3", "Spring Boot", "6K Students",
Arrays.asList("Learn Maven", "Learn Spring",
"Learn Spring MVC", "First Example", "Second Example"));
Course course4 = new Course("Course4", "Maven",
"Most popular maven course on internet!", Arrays.asList(
"Pom.xml", "Build Life Cycle", "Parent POM",
"Importing into Eclipse"));
Student ranga = new Student("Student1", "Ranga Karanam",
"Hiker, Programmer and Architect", new ArrayList<>(Arrays
.asList(course1, course2, course3, course4)));
Student satish = new Student("Student2", "Satish T",
"Hiker, Programmer and Architect", new ArrayList<>(Arrays
.asList(course1, course2, course3, course4)));
students.add(ranga);
students.add(satish);
}
public List<Student> retrieveAllStudents() {
return students;
}
public Student retrieveStudent(String studentId) {
for (Student student : students) {
if (student.getId().equals(studentId)) {
return student;
}
}
return null;
}
public List<Course> retrieveCourses(String studentId) {
Student student = retrieveStudent(studentId);
if (student == null) {
return null;
}
return student.getCourses();
}
public Course retrieveCourse(String studentId, String courseId) {
Student student = retrieveStudent(studentId);
if (student == null) {
return null;
}
for (Course course : student.getCourses()) {
if (course.getId().equals(courseId)) {
return course;
}
}
return null;
}
private SecureRandom random = new SecureRandom();
public Course addCourse(String studentId, Course course) {
Student student = retrieveStudent(studentId);
if (student == null) {
return null;
}
String randomId = new BigInteger(130, random).toString(32);
course.setId(randomId);
student.getCourses().add(course);
return course;
}
}
| [
"shishir.meshram@perficient.com"
] | shishir.meshram@perficient.com |
014c7411f9377e7f12db14382c156564de6c72dc | a6fb1906006f64e216f4ea8f4c078469c375e606 | /src/main/java/com/bolyartech/forge/server/misc/GzipUtils.java | 8ba6eb4af836eb13d74aafb9372a91c49445a6c5 | [
"Apache-2.0"
] | permissive | ogrebgr/forge-server-http | d6626c9fa3f549931eae691d5b6094878ec23f58 | 43cc4a6577bed6267a05000bf21d8e206bed9776 | refs/heads/master | 2020-06-10T16:50:21.419915 | 2017-01-02T11:36:25 | 2017-01-02T11:36:25 | 75,931,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | package com.bolyartech.forge.server.misc;
import com.bolyartech.forge.server.response.HttpHeaders;
import com.bolyartech.forge.server.route.RequestContext;
import java.util.List;
public class GzipUtils {
public static boolean supportsGzip(RequestContext ctx) {
List<String> values = ctx.getHeaderValues(HttpHeaders.ACCEPT_ENCODING);
if (values != null) {
for (String val : values) {
if (val.contains(",")) {
String[] exploded = val.split(",");
for (String s : exploded) {
if (s.contains(HttpHeaders.CONTENT_ENCODING_GZIP)) {
return true;
}
}
} else {
if (val.contains(HttpHeaders.CONTENT_ENCODING_GZIP)) {
return true;
}
}
}
return false;
} else {
return false;
}
}
}
| [
"ogibankov@gmail.com"
] | ogibankov@gmail.com |
32ddf778a0094a3963f2b02537d84feff7bb65fd | db84bfdad194f56125f822e9e112743bf31fbb94 | /Telephony/app/src/main/java/edu/ucucite/telephony/message2.java | 9d1fee5aadc75666e1431bd75251aac8a6eb1734 | [] | no_license | Jhunalyne15/AppDev | cfd8cf4bc06efe0bc06043585c0a2f708120a52d | 2f970310098a3a7dbc1ff2c9f278bd6e7b167da5 | refs/heads/main | 2023-01-20T21:53:23.828562 | 2020-11-30T15:49:36 | 2020-11-30T15:49:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,520 | java | package edu.ucucite.telephony;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class message2 extends AppCompatActivity {
EditText editMessage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message2);
editMessage = findViewById(R.id.editMessage);
}
public void btnSend(View view) {
int permissionCheck =
ContextCompat.checkSelfPermission(this,
Manifest.permission.SEND_SMS);
if (permissionCheck ==
PackageManager.PERMISSION_GRANTED) {
sendMessage();
} else {
ActivityCompat.requestPermissions(this, new
String[]{Manifest.permission.SEND_SMS}, 0);
}
}
protected void sendMessage() {
String message;
message = editMessage.getText().toString().trim();
SmsManager smsManager =
SmsManager.getDefault();
smsManager.sendTextMessage("09888888888", null,
message, null, null);
Toast.makeText(this, "Message Sent",
Toast.LENGTH_SHORT).show();
}
}
| [
"disonojub@gmail.com"
] | disonojub@gmail.com |
6aa7432d8598b6ce7b88a7ec77377d4c80d4b836 | 5be28a0481d0e369f89f1d0909955e3eca956e52 | /src/com/challenge/graph/WordSearch.java | e7edf8a567866bdfa0809b1e023c225d1046ee50 | [] | no_license | Sathesh85/100DaysCodingChallenge | 36f2b24d7307a5a16ccf94791be852f8f278df0c | 922ae3a3baadf1fd99b49a06a99adc3c68113f62 | refs/heads/master | 2022-12-12T12:43:39.294409 | 2020-09-08T03:05:39 | 2020-09-08T03:05:39 | 278,677,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java | package com.challenge.graph;
import java.util.HashSet;
import java.util.Set;
public class WordSearch {
public static void main(String[] args) {
char[][] board = { { 'F', 'Y', 'C', 'E', 'N', 'R', 'D' }, { 'K', 'L', 'N', 'F', 'I', 'N', 'U' },
{ 'A', 'A', 'A', 'R', 'A', 'H', 'R' }, { 'N', 'D', 'K', 'L', 'P', 'N', 'E' },
{ 'A', 'L', 'A', 'N', 'S', 'A', 'P' }, { 'O', 'O', 'G', 'O', 'T', 'P', 'N' },
{ 'H', 'P', 'O', 'L', 'A', 'N', 'O' } };
WordSearch w = new WordSearch();
boolean res = w.exist(board, "CHINA");
System.out.println(res);
}
int a[] = { -1, 1, 0, 0 };
int b[] = { 0, 0, -1, 1 };
public boolean exist(char[][] board, String word) {
boolean isFound = false;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
Set<Point> set = new HashSet<Point>();
if (isValid(i, j, board, word.charAt(0), set) && exist(board, word, set, i, j, 1)) {
return true;
}
}
}
return isFound;
}
private boolean isValid(int i, int j, char[][] board, char ch, Set<Point> set) {
if (i < 0 || j < 0 || i >= board.length || j >= board[0].length || set.contains(new Point(i, j))
|| board[i][j] != ch) {
return false;
}
return true;
}
private boolean exist(char[][] board, String word, Set<Point> points, int row, int col, int p) {
if (p == word.length()) {
return true;
}
points.add(new Point(row, col));
for (int j = 0; j < a.length; j++) {
if (isValid(row + a[j], col + b[j], board, word.charAt(p), points)) {
points.add(new Point(row + a[j], col + b[j]));
if (exist(board, word, points, row + a[j], col + b[j], p + 1)) {
return true;
}
}
}
// points.remove(new Point(row, col));
points.remove(new Point(row, col));
return false;
}
}
| [
"satheshkumarv85@gmail.com"
] | satheshkumarv85@gmail.com |
d8de34dd8ca92b2f613b852ebaae76e61a68b6d4 | 7909f7f90722706edc8ce53dc36189e78305bf18 | /task04/task0433/Solution.java | a75c9120ec193cc32d60c5483fdd95a0361ddf5c | [] | no_license | OleksandrChekalenko/JavaRushTasks | def8c42c6a889d05933d26bcc4cc1a633c4652e3 | a286dbcc1f8ad906ec7784778b98cf1b0af67764 | refs/heads/master | 2021-01-23T05:55:32.348324 | 2017-09-05T12:55:55 | 2017-09-05T12:55:55 | 101,553,499 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.javarush.task.task04.task0433;
/*
Гадание на долларовый счет
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
String s = "S";
int i = 0;
while ( i < 10){
System.out.println(s+s+s+s+s+s+s+s+s+s);
i++;
}
}
}
| [
"whibleykevin@gmail.com"
] | whibleykevin@gmail.com |
ef77ea00517bfc3cd30f29eaef66c968a41d94cb | 45d812e6621d143c7205a3fbbb856d4a0379b8c1 | /tetris/src/tetris/Base.java | e308f94fffe67be2a67083b49fe88db9da620f59 | [] | no_license | Yashswarnkar/Java_projects | 91c5ec9aab6a5711f293a91ccc3438373b649e8a | ec1dc8150c53e090d367fa54b939c63d92bab186 | refs/heads/master | 2021-01-12T06:58:55.335938 | 2017-01-10T17:55:30 | 2017-01-10T17:55:30 | 76,887,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,863 | java | package tetris;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
public class Base extends JFrame {
JLabel nm=new JLabel("NAME :");
JLabel gm=new JLabel("WHAT DO YOU WANT TO PLAY?");
JLabel wm=new JLabel("WELCOME TO THE GAMERS POINT");
JTextField n=new JTextField();
JRadioButton p1=new JRadioButton(" TETRIS");
JRadioButton p2=new JRadioButton(" BEAT THE TRAFFIC");
JRadioButton p3=new JRadioButton(" STACK");
JLabel i1=new JLabel();
JLabel i2=new JLabel();
JLabel i3=new JLabel();
JLabel abtus=new JLabel();
public Base()
{
super("GAMERS POINT");
setLayout(null);
nm.setBounds(145, 110, 100, 40);
nm.setForeground(new Color(0,52,113));
nm.setFont(new Font("COPPERPLATE GOTHIC LIGHT",Font.PLAIN,20));
add(nm);
wm.setBounds(0, 20, 600, 40);
wm.setForeground(new Color(0,52,113));
wm.setFont(new Font("ROCKWELL",Font.BOLD,25));
wm.setHorizontalAlignment(JLabel.CENTER);
add(wm);
gm.setBounds(0, 200, 600, 40);
gm.setForeground(new Color(0,52,113));
gm.setFont(new Font("ROCKWELL",Font.BOLD,18));
gm.setHorizontalAlignment(JLabel.CENTER);
add(gm);
n.setText("");
n.requestFocusInWindow();
n.setFont(new Font("ROCKWELL",Font.PLAIN,15));
n.setBounds(235,115,200,30);
add(n);
p1.setBounds(210,265,200,20);
p1.setForeground(Color.WHITE);
p1.setBackground(new Color(0,52,113));
p1.setFont(new Font("COPPERPLATE GOTHIC LIGHT",Font.BOLD,13));
add(p1);
p2.setBounds(210,315,200,20);
p2.setForeground(Color.WHITE);
p2.setBackground(new Color(0,52,113));
p2.setFont(new Font("COPPERPLATE GOTHIC LIGHT",Font.BOLD,13));
add(p2);
p3.setBounds(210,365,200,20);
p3.setForeground(Color.WHITE);
p3.setBackground(new Color(0,52,113));
p3.setFont(new Font("COPPERPLATE GOTHIC LIGHT",Font.BOLD,13));
add(p3);
i1.setIcon(new ImageIcon("button.png"));
i1.setBounds(200, 245, 250, 60);
add(i1);
i2.setIcon(new ImageIcon("button.png"));
i2.setBounds(200, 295, 250, 60);
add(i2);
i3.setIcon(new ImageIcon("button.png"));
i3.setBounds(200, 345, 250, 60);
add(i3);
abtus.setIcon(new ImageIcon("ABOUT.png"));
abtus.setBounds(200,445,250,60);
add(abtus);
abtus.addMouseListener(
new MouseListener()
{
@Override
public void mouseClicked(MouseEvent arg0) {
Aboutus base2=new Aboutus();
//base2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
base2.setBounds(100,100, 400, 300);
base2.setVisible(true);
base2.getContentPane().setBackground(new Color(179,214,254));
}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}
);
p1.addItemListener(
new ItemListener(){
public void itemStateChanged(ItemEvent arg0) {
String s=n.getText();
dispose();
Game base2=new Game(s);
base2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
base2.setSize(800,700);
base2.setVisible(true);
base2.getContentPane().setBackground(new Color(179,214,254));
}
}
);
p2.addItemListener(
new ItemListener(){
public void itemStateChanged(ItemEvent arg0) {
String s=n.getText();
dispose();
Game2 base2=new Game2(s);
base2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
base2.setSize(750,650);
base2.setVisible(true);
base2.getContentPane().setBackground(new Color(179,214,254));
}
}
);
p3.addItemListener(
new ItemListener(){
public void itemStateChanged(ItemEvent arg0) {
String s=n.getText();
dispose();
Game4 base2=new Game4(s);
base2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
base2.setSize(1000,700);
base2.setVisible(true);
base2.getContentPane().setBackground(new Color(179,214,254));
}
}
);
}
}
| [
"yash01071996@gmail.com"
] | yash01071996@gmail.com |
ed61f077262fbe3a094abdb5807f26e54148b1af | 732977348930a7bed05aa3d1aa4a55b2521f9ca8 | /src/main/java/domain/Persona.java | fc7281b28dfe44bd8257a67711fa86a2ac83d82d | [] | no_license | kmra00/ManejoJDBC | c120aafcab9b288affa9204ad32e141db8abf286 | ee0985654ae9411e99247f9d5de3c71066f17d81 | refs/heads/master | 2023-06-23T19:56:32.980347 | 2021-07-25T19:40:07 | 2021-07-25T19:40:07 | 388,338,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,141 | java | package domain;
public class Persona {
private int id_persona;
private String nombre;
private String apellido;
private String email;
private String telefono;
public int getId_persona() {
return id_persona;
}
public void setId_persona(int id_persona) {
this.id_persona = id_persona;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTelefono() {
return telefono;
}
public void setTelefono(String telefono) {
this.telefono = telefono;
}
@Override
public String toString() {
return "Persona{" + "id_persona=" + id_persona + ", nombre=" + nombre + ", apellido=" + apellido + ", email=" + email + ", telefono=" + telefono + '}';
}
}
| [
"kevinmoroa@gmail.com"
] | kevinmoroa@gmail.com |
0ea6e97e7bf6e85f947c45775894a4f936657379 | 85d9937c22cabdc79c798eb3c6dbaba62de9b33e | /module_common/src/main/java/com/alpha/module_common/utils/encrypt/AES/Base64.java | 069b8b8f7f61ac0fc99dfffb77c26299c41ded9a | [
"MIT"
] | permissive | weixingtai/FrameworkAlpha | 379298b25235d8383329046facde5b54a6fda8da | 6437a4cb3b8ef28d5ad2859a886b72e416da8375 | refs/heads/master | 2020-03-25T13:12:17.385387 | 2018-09-07T07:07:27 | 2018-09-07T07:07:27 | 143,808,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,567 | java | /*
* Java Base64 - A pure Java library for reading and writing Base64
* encoded streams.
*
* Copyright (C) 2007-2009 Carlo Pelliccia (www.sauronsoftware.it)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version
* 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License version 2.1 along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
package com.alpha.module_common.utils.encrypt.AES;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
/**
* <p>
* Base64 encoding and decoding utility methods, both for binary and textual
* informations.
* </p>
*
* @author Carlo Pelliccia
* @since 1.1
* @version 1.3
*/
public class Base64 {
/**
* <p>
* Encodes a string.
* </p>
* <p>
* Before the string is encoded in Base64, it is converted in a binary
* sequence using the system default charset.
* </p>
*
* @param str
* The source string.
* @return The encoded string.
* @throws RuntimeException
* If an unexpected error occurs.
*/
public static String encode(String str) throws RuntimeException {
byte[] bytes = str.getBytes();
byte[] encoded = encode(bytes);
try {
return new String(encoded, "ASCII");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("ASCII is not supported!", e);
}
}
/**
* <p>
* Encodes a string.
* </p>
* <p>
* Before the string is encoded in Base64, it is converted in a binary
* sequence using the supplied charset.
* </p>
*
* @param str
* The source string
* @param charset
* The charset name.
* @return The encoded string.
* @throws RuntimeException
* If an unexpected error occurs.
* @since 1.2
*/
public static String encode(String str, String charset)
throws RuntimeException {
byte[] bytes;
try {
bytes = str.getBytes(charset);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Unsupported charset: " + charset, e);
}
byte[] encoded = encode(bytes);
try {
return new String(encoded, "ASCII");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("ASCII is not supported!", e);
}
}
/**
* <p>
* Decodes the supplied string.
* </p>
* <p>
* The supplied string is decoded into a binary sequence, and then the
* sequence is encoded with the system default charset and returned.
* </p>
*
* @param str
* The encoded string.
* @return The decoded string.
* @throws RuntimeException
* If an unexpected error occurs.
*/
public static String decode(String str) throws RuntimeException {
byte[] bytes;
try {
bytes = str.getBytes("ASCII");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("ASCII is not supported!", e);
}
byte[] decoded = decode(bytes);
return new String(decoded);
}
/**
* <p>
* Decodes the supplied string.
* </p>
* <p>
* The supplied string is decoded into a binary sequence, and then the
* sequence is encoded with the supplied charset and returned.
* </p>
*
* @param str
* The encoded string.
* @param charset
* The charset name.
* @return The decoded string.
* @throws RuntimeException
* If an unexpected error occurs.
* @since 1.2
*/
public static String decode(String str, String charset)
throws RuntimeException {
byte[] bytes;
try {
bytes = str.getBytes("ASCII");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("ASCII is not supported!", e);
}
byte[] decoded = decode(bytes);
try {
return new String(decoded, charset);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Unsupported charset: " + charset, e);
}
}
/**
* <p>
* Encodes a binary sequence.
* </p>
* <p>
* If data are large, i.e. if you are working with large binary files,
* consider to use a {@link Base64OutputStream} instead of loading too much
* data in memory.
* </p>
*
* @param bytes
* The source sequence.
* @return The encoded sequence.
* @throws RuntimeException
* If an unexpected error occurs.
* @since 1.2
*/
public static byte[] encode(byte[] bytes) throws RuntimeException {
return encode(bytes, 0);
}
/**
* <p>
* Encodes a binary sequence, wrapping every encoded line every
* <em>wrapAt</em> characters. A <em>wrapAt</em> value less than 1 disables
* wrapping.
* </p>
* <p>
* If data are large, i.e. if you are working with large binary files,
* consider to use a {@link Base64OutputStream} instead of loading too much
* data in memory.
* </p>
*
* @param bytes
* The source sequence.
* @param wrapAt
* The max line length for encoded data. If less than 1 no wrap
* is applied.
* @return The encoded sequence.
* @throws RuntimeException
* If an unexpected error occurs.
* @since 1.2
*/
public static byte[] encode(byte[] bytes, int wrapAt)
throws RuntimeException {
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
encode(inputStream, outputStream, wrapAt);
} catch (IOException e) {
throw new RuntimeException("Unexpected I/O error", e);
} finally {
try {
inputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
try {
outputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
return outputStream.toByteArray();
}
/**
* <p>
* Decodes a binary sequence.
* </p>
* <p>
* If data are large, i.e. if you are working with large binary files,
* consider to use a {@link Base64InputStream} instead of loading too much
* data in memory.
* </p>
*
* @param bytes
* The encoded sequence.
* @return The decoded sequence.
* @throws RuntimeException
* If an unexpected error occurs.
* @since 1.2
*/
public static byte[] decode(byte[] bytes) throws RuntimeException {
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
decode(inputStream, outputStream);
} catch (IOException e) {
throw new RuntimeException("Unexpected I/O error", e);
} finally {
try {
inputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
try {
outputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
return outputStream.toByteArray();
}
/**
* <p>
* Encodes data from the given input stream and writes them in the given
* output stream.
* </p>
* <p>
* The supplied input stream is read until its end is reached, but it's not
* closed by this method.
* </p>
* <p>
* The supplied output stream is nor flushed neither closed by this method.
* </p>
*
* @param inputStream
* The input stream.
* @param outputStream
* The output stream.
* @throws IOException
* If an I/O error occurs.
*/
public static void encode(InputStream inputStream, OutputStream outputStream)
throws IOException {
encode(inputStream, outputStream, 0);
}
/**
* <p>
* Encodes data from the given input stream and writes them in the given
* output stream, wrapping every encoded line every <em>wrapAt</em>
* characters. A <em>wrapAt</em> value less than 1 disables wrapping.
* </p>
* <p>
* The supplied input stream is read until its end is reached, but it's not
* closed by this method.
* </p>
* <p>
* The supplied output stream is nor flushed neither closed by this method.
* </p>
*
* @param inputStream
* The input stream from which clear data are read.
* @param outputStream
* The output stream in which encoded data are written.
* @param wrapAt
* The max line length for encoded data. If less than 1 no wrap
* is applied.
* @throws IOException
* If an I/O error occurs.
*/
public static void encode(InputStream inputStream,
OutputStream outputStream, int wrapAt) throws IOException {
Base64OutputStream aux = new Base64OutputStream(outputStream, wrapAt);
copy(inputStream, aux);
aux.commit();
}
/**
* <p>
* Decodes data from the given input stream and writes them in the given
* output stream.
* </p>
* <p>
* The supplied input stream is read until its end is reached, but it's not
* closed by this method.
* </p>
* <p>
* The supplied output stream is nor flushed neither closed by this method.
* </p>
*
* @param inputStream
* The input stream from which encoded data are read.
* @param outputStream
* The output stream in which decoded data are written.
* @throws IOException
* If an I/O error occurs.
*/
public static void decode(InputStream inputStream, OutputStream outputStream)
throws IOException {
copy(new Base64InputStream(inputStream), outputStream);
}
/**
* <p>
* Encodes data from the given source file contents and writes them in the
* given target file, wrapping every encoded line every <em>wrapAt</em>
* characters. A <em>wrapAt</em> value less than 1 disables wrapping.
* </p>
*
* @param source
* The source file, from which decoded data are read.
* @param target
* The target file, in which encoded data are written.
* @param wrapAt
* The max line length for encoded data. If less than 1 no wrap
* is applied.
* @throws IOException
* If an I/O error occurs.
* @since 1.3
*/
public static void encode(File source, File target, int wrapAt)
throws IOException {
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = new FileInputStream(source);
outputStream = new FileOutputStream(target);
Base64.encode(inputStream, outputStream, wrapAt);
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
if (inputStream != null) {
try {
inputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
/**
* <p>
* Encodes data from the given source file contents and writes them in the
* given target file.
* </p>
*
* @param source
* The source file, from which decoded data are read.
* @param target
* The target file, in which encoded data are written.
* @throws IOException
* If an I/O error occurs.
* @since 1.3
*/
public static void encode(File source, File target) throws IOException {
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = new FileInputStream(source);
outputStream = new FileOutputStream(target);
Base64.encode(inputStream, outputStream);
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
if (inputStream != null) {
try {
inputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
/**
* <p>
* Decodes data from the given source file contents and writes them in the
* given target file.
* </p>
*
* @param source
* The source file, from which encoded data are read.
* @param target
* The target file, in which decoded data are written.
* @throws IOException
* If an I/O error occurs.
* @since 1.3
*/
public static void decode(File source, File target) throws IOException {
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = new FileInputStream(source);
outputStream = new FileOutputStream(target);
decode(inputStream, outputStream);
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
if (inputStream != null) {
try {
inputStream.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
/**
* Copies data from a stream to another.
*
* @param inputStream
* The input stream.
* @param outputStream
* The output stream.
* @throws IOException
* If a unexpected I/O error occurs.
*/
private static void copy(InputStream inputStream, OutputStream outputStream)
throws IOException {
// 1KB buffer
byte[] b = new byte[1024];
int len;
while ((len = inputStream.read(b)) != -1) {
outputStream.write(b, 0, len);
}
}
}
| [
"455943225@qq.com"
] | 455943225@qq.com |
12a1236679ec2e784f73000f1431348e0434c64a | 76d5d21d51a667f2cd87d613f9c7aa013a9c8db6 | /src/main/java/skill/thread/Run.java | 0229d855cac567562fb2b4ec5583b8754a22eab8 | [] | no_license | DaveDeYoung/thread | b03cec2892146df1631b0a2df01e820bb50ea1f3 | b0befb10aff32b81b6b393607d9f0ba6b253b379 | refs/heads/master | 2020-12-02T22:48:55.228007 | 2017-07-04T07:05:21 | 2017-07-04T07:05:21 | 96,186,191 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | /**
*
*/
package skill.thread;
/**
* @author caiwenyuan
*
*/
public class Run {
public static void main(String[] args) throws InterruptedException {
// MyThread a = new MyThread("A");
// MyThread b = new MyThread("B");
// MyThread c = new MyThread("C");
// a.start();
// b.start();
// c.start();
//共享数据 五个线程
MyShareThread mythread = new MyShareThread();
Thread a = new Thread(mythread,"A");
Thread b = new Thread(mythread,"B");
Thread c = new Thread(mythread,"C");
Thread d = new Thread(mythread,"D");
Thread e = new Thread(mythread,"E");
a.start();
b.start();
c.start();
d.start();
e.start();
}
}
| [
"358597989@qq.com"
] | 358597989@qq.com |
8876919cd7c236d64356811c3682e3fd172d8f0e | 80c59236f98b693cb18359ac2767f9cb42e2c1f4 | /src/rotate_array/Solution.java | cbc3f4fd000602b7cc4a0a26edc2505973d8079d | [] | no_license | anjaly13/leet | 62e5fa64bbe010e9765b0ec345ad6c715f61df69 | d366da592876f048b6a31784eb3ad14435377989 | refs/heads/master | 2022-11-22T13:42:23.952537 | 2020-07-26T18:09:13 | 2020-07-26T18:09:13 | 280,871,499 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 921 | java | package rotate_array;
import java.util.Arrays;
import java.util.Collections;
public class Solution {
public static void main(String args[]){
Solution solution= new Solution();
solution.rotate(new int []{1,2,3,4,5,6,7},21);
// for (int i=0;i<nums.length;i++){
// System.out.print( nums[i] +"\t");
// }
}
public void rotate(int[] nums, int k) {
int shift = 0;
if (nums.length <= k){
shift = k % nums.length;
if(shift == 0)
return;
}
else {
shift = k;
}
swap(nums,0,nums.length-1);
swap(nums,0,shift-1);
swap(nums,shift,nums.length-1);
}
public void swap(int[] nums,int l,int r){
while (l<r){
int temp = nums[l];
nums[l] = nums[r];
nums[r] = temp;
l++;
r--;
}
}
}
| [
"anjaly.s@highpeaksw.com"
] | anjaly.s@highpeaksw.com |
96f89c3d2980bdb197af0f7900b60dd3717cdf78 | 192f29254d602b8075610e2a5d5b951782def105 | /rating-service/src/main/java/com/hsbg/RatingController.java | 7543f3765fa1c1e50c4348e2e7f4d588adcbe6bb | [] | no_license | vilasvarghese/microservices | 0d88573048d5c106931d8a77d9f941f7308d1bfa | fad77dc80fda59328a0456d698370eb3f63bc7ec | refs/heads/master | 2022-11-10T01:42:02.754214 | 2022-10-18T08:10:06 | 2022-10-18T08:10:06 | 249,636,572 | 0 | 5 | null | 2020-10-13T21:35:57 | 2020-03-24T07:05:08 | Java | UTF-8 | Java | false | false | 575 | java | package com.hsbg;
import java.util.Collections;
import java.util.List;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hsbg.models.Rating;
@RestController
@RequestMapping("/ratings")
public class RatingController {
//There is a class level mapping as well.
@RequestMapping("/employeerating/{employeeId}")
public Rating getEmployeeRatings(@PathVariable String employeeId){
return new Rating(employeeId, 4);
}
}
| [
"vilas.varghese@gmail.com"
] | vilas.varghese@gmail.com |
f630188b293a957eb669862ec12f9d9667fe58b4 | 09cc0de2ca8e4b389a2e4d952d1b6791a0ac5620 | /lab9/lab9/MyHashMap.java | 981efeba67c6ffa1b002bd276ce7ee0df7efbc1b | [] | no_license | ema00/Berkeley-CS61B-sp18 | 41cb2a1583029ecc6bfba3fcded9cfe07db8a29d | 1532b4388ce2f8f8b0124b937f613151977573d7 | refs/heads/master | 2020-05-27T09:55:08.390322 | 2020-03-14T02:26:37 | 2020-03-14T02:26:37 | 188,573,995 | 2 | 2 | null | 2019-08-21T01:21:59 | 2019-05-25T14:10:09 | Java | UTF-8 | Java | false | false | 3,963 | java | package lab9;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/**
* A hash table-backed Map implementation. Provides amortized constant time
* access to elements via get(), remove(), and put() in the best case.
* Null values are not allowed as keys.
*
* @author Emanuel Aguirre
*/
public class MyHashMap<K, V> implements Map61B<K, V> {
private static final int DEFAULT_SIZE = 16;
private static final double MAX_LF = 0.75;
private ArrayMap<K, V>[] buckets;
private int size;
public MyHashMap() {
buckets = new ArrayMap[DEFAULT_SIZE];
this.clear();
}
private int loadFactor() {
return size / buckets.length;
}
/* Removes all of the mappings from this map. */
@Override
public void clear() {
this.size = 0;
for (int i = 0; i < this.buckets.length; i += 1) {
this.buckets[i] = new ArrayMap<>();
}
}
/** Computes the hash function of the given key. Consists of
* computing the hashcode, followed by modding by the number of buckets.
* To handle negative numbers properly, uses floorMod instead of %.
*/
private int hash(K key) {
int numBuckets = buckets.length;
return Math.floorMod(key.hashCode(), numBuckets);
}
/* Returns the value to which the specified key is mapped, or null if this
* map contains no mapping for the key.
*/
@Override
public V get(K key) {
int hash = hash(key);
return buckets[hash].get(key);
}
/* Associates the specified value with the specified key in this map. */
@Override
public void put(K key, V value) {
int hash = hash(key);
size = buckets[hash].containsKey(key) ? size : size + 1;
buckets[hash].put(key, value);
if (loadFactor() > MAX_LF) {
resize(buckets.length * 2);
}
}
/* Returns the number of key-value mappings in this map. */
@Override
public int size() {
return size;
}
//////////////// EVERYTHING BELOW THIS LINE IS OPTIONAL ////////////////
/* Returns a Set view of the keys contained in this map. */
@Override
public Set<K> keySet() {
Set<K> keySet = new HashSet<>();
for (ArrayMap<K, V> bucket : buckets) {
keySet.addAll(bucket.keySet());
}
return keySet;
}
/* Removes the mapping for the specified key from this map if exists.
* Not required for this lab. If you don't implement this, throw an
* UnsupportedOperationException. */
@Override
public V remove(K key) {
int hash = hash(key);
V value = buckets[hash].remove(key);
if (size < MAX_LF / 4) {
resize(buckets.length / 2);
}
return value;
}
/* Removes the entry for the specified key only if it is currently mapped to
* the specified value. Not required for this lab. If you don't implement this,
* throw an UnsupportedOperationException.*/
@Override
public V remove(K key, V value) {
if (get(key).equals(value)) {
return remove(key);
} else {
return null;
}
}
/**
* Resizes the array of ArrayMap used to store (K,V) pairs. That is, changes number of buckets.
* @param length is the new number of buckets.
*/
private void resize(int length) {
ArrayMap<K, V>[] oldBuckets = buckets;
Set<K> keys = keySet();
buckets = new ArrayMap[length];
clear();
for (K key : keys) {
int hash = hash(key);
int oldHash = Math.floorMod(key.hashCode(), oldBuckets.length);
V value = oldBuckets[oldHash].get(key);
buckets[hash].put(key, value);
size += 1;
}
}
@Override
public Iterator<K> iterator() {
Set<K> keySet = keySet();
return keySet.iterator();
}
}
| [
"ema_a_@hotmail.com"
] | ema_a_@hotmail.com |
1b49715a21db8cecacd8a9a1122cc0bb35c1e0c0 | 744b5f1afadb341024e5c9a61561b3d26c2154a4 | /src/main/java/me/alen_alex/bridgepractice/commands/Firework.java | 1ee28e9979c89feb0492ef09e940b0ce87cc2b7c | [
"MIT"
] | permissive | AlenGeoAlex/BridgePractice | aac6ff0e51220457977568e1ab623ac3d94e4d01 | fc67d1c0919ff50fa7977cbba2e992ea02cf9f9f | refs/heads/master | 2023-08-11T06:00:10.685471 | 2021-09-16T09:58:13 | 2021-09-16T09:58:13 | 389,329,050 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,322 | java | package me.alen_alex.bridgepractice.commands;
import me.alen_alex.bridgepractice.configurations.MessageConfiguration;
import me.alen_alex.bridgepractice.enumerators.PlayerState;
import me.alen_alex.bridgepractice.menu.MenuManager;
import me.alen_alex.bridgepractice.playerdata.PlayerDataManager;
import me.alen_alex.bridgepractice.utility.Messages;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Firework implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(commandSender instanceof Player) {
Player player = (Player) commandSender;
if (!player.hasPermission("practice.gui.firework")) {
Messages.sendMessage(player, MessageConfiguration.getNoPermission(), false);
return true;
}
if (PlayerDataManager.getCachedPlayerData().get(player.getUniqueId()).getCurrentState() == PlayerState.PLAYING) {
Messages.sendMessage(player, MessageConfiguration.getInSession(), false);
return true;
}
MenuManager.openFireworkMenu(player);
}
return false;
}
}
| [
"71920951+AlenGeoAlex@users.noreply.github.com"
] | 71920951+AlenGeoAlex@users.noreply.github.com |
94712a933262c2dadf10e4b9f606c10925398465 | e9805d8a03558ee4bf81b178cc630fa2f0f2bff2 | /WireBean/src/main/java/pojo/aspect/Audience.java | 3a3f00d9e36a71080fc6d53e9f7f7a4a1c6557fa | [] | no_license | challengerzsz/SpringFramework-learning | 06e720d96477a1f6516eeea41a979d76f23b03bb | a601621e6f874b66cabfc16c385593437bb05a51 | refs/heads/master | 2021-04-03T07:10:01.779081 | 2018-05-28T15:48:12 | 2018-05-28T15:48:12 | 124,574,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package pojo.aspect;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@Aspect
public class Audience {
@Before("execution(* pojo.Performance.perform(..))")
public void silenceCellPhone() {
System.out.println("silence Cell Phone");
}
@Before("execution(* pojo.Performance.perform(..))")
public void takeSeats() {
System.out.println("Taking Seats");
}
@AfterReturning("execution(* pojo.Performance.perform(..))")
public void applause() {
System.out.println("Clap Clap Clap");
}
@AfterThrowing("execution(* pojo.Performance.perform(..))")
public void demandRefund() {
System.out.println("Demand a refund");
}
}
| [
"664903471@qq.com"
] | 664903471@qq.com |
175d0c475cb84441f62e872ca06f7fe3b96d40d0 | d2706056e61fa2b5a5684e4870879044a9518a74 | /zuulservice/src/main/java/com/stackroute/zuulservice/ZuulserviceApplication.java | 099badaacb0e71d2b032b06e9411c0e18e8bdc58 | [] | no_license | arnabmid88/Spring-Boot | c866fb263cea42625f4a5e0d01c6d56814708638 | 10fc72bb00f0e5e830503d563f56f9f610e3306d | refs/heads/master | 2023-02-04T22:49:35.171537 | 2019-05-28T04:01:01 | 2019-05-28T04:01:01 | 189,163,497 | 0 | 0 | null | 2023-02-02T04:15:52 | 2019-05-29T06:26:06 | Java | UTF-8 | Java | false | false | 884 | java | package com.stackroute.zuulservice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import com.stackroute.zuulservice.filter.JwtFilter;
@EnableZuulProxy
@SpringBootApplication
public class ZuulserviceApplication {
public static void main(String[] args) {
SpringApplication.run(ZuulserviceApplication.class, args);
}
@Bean
public FilterRegistrationBean jwtFilter() {
final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(new JwtFilter());
registrationBean.addUrlPatterns("/muzixservice/api/v1/usertrackservice/user/*");
return registrationBean;
}
}
| [
"arbhatta@in.ibm.com"
] | arbhatta@in.ibm.com |
7d5606272285ca2a11467458310eb478c85c587b | 845c33684c7b3a0426b5be8f54a78785d0382786 | /e4ds-template/src/main/java/ch/rasc/e4ds/entity/Role.java | e1444c9926c8ca10b1bfaba3b12ce4c0156a7df6 | [] | no_license | ralscha/attic | f8291d8a860f3c4f45b3d795d71a2fc73adbc516 | 1d22497aa7c978f25d85106af4c1f72c79629917 | refs/heads/master | 2023-07-09T11:09:14.768995 | 2023-06-30T17:49:52 | 2023-06-30T17:49:52 | 22,188,364 | 2 | 0 | null | 2023-03-09T21:11:55 | 2014-07-24T00:23:20 | Java | UTF-8 | Java | false | false | 64 | java | package ch.rasc.e4ds.entity;
public enum Role {
ADMIN, USER
}
| [
"ralphschaer@gmail.com"
] | ralphschaer@gmail.com |
7d74187c5360db8fbbbffc9789173e668cea9b23 | fa444cda81bf78a21b634718d1b30f078b7087e1 | /src/main/java/com/learn/patterns/freemanAndFreeman/headfirst/command/party/TVOffCommand.java | cae5c8ba4b42593ca0eacee1a4d891632d023448 | [] | no_license | dmitrybilyk/interviews | 8fb4356a77ef63d74db613295bbbb296e3e652b7 | f48d00bd348bab871304578c0c6c423c24db175e | refs/heads/master | 2022-12-22T08:11:35.366586 | 2022-04-29T17:36:20 | 2022-04-29T17:36:20 | 23,141,851 | 4 | 0 | null | 2022-12-16T03:39:20 | 2014-08-20T08:42:27 | Java | UTF-8 | Java | false | false | 255 | java | package com.learn.patterns.freemanAndFreeman.headfirst.command.party;
public class TVOffCommand implements Command {
TV tv;
public TVOffCommand(TV tv) {
this.tv= tv;
}
public void execute() {
tv.off();
}
public void undo() {
tv.on();
}
}
| [
"dmitry.bilyk@symmetrics.de"
] | dmitry.bilyk@symmetrics.de |
f5bb571e4cf217229f3db28e26c8d328459a49b0 | a338a3228b5a4b6e89f523358783a7787f32befd | /app/src/main/java/com/e/rpi_controller/ui/home/HomeFragment.java | d5464824840b1c59a9fec7c9a5b7bc52bdd538f7 | [] | no_license | dj-d/RPI-Controller | e90aa353cc6e45f4132f3ef3f2f97428e811b5c3 | 6bfdf3814de83d7749aa127cd87d7f5b2db8a366 | refs/heads/master | 2020-12-13T12:22:35.598287 | 2020-01-16T21:30:20 | 2020-01-16T21:30:20 | 234,414,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,591 | java | package com.e.rpi_controller.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.e.rpi_controller.R;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.tabs.TabLayout;
public class HomeFragment extends Fragment {
private static final String TAB_1 = "RGB";
private static final String TAB_2 = "1° POWER STRIP";
private static final String TAB_3 = "2° POWER STRIP";
private static final int NUM_OF_TABS = 3;
private AppBarLayout appBar;
private TabLayout tabs;
private ViewPager viewPager;
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_home, container, false);
View homeContainer = (View) container.getParent();
appBar = homeContainer.findViewById(R.id.appbar);
tabs = new TabLayout(getActivity());
appBar.addView(tabs);
viewPager = root.findViewById(R.id.home_viewPager);
ViewPagerAdapter pagerAdapter = new ViewPagerAdapter(getFragmentManager());
viewPager.setAdapter(pagerAdapter);
tabs.setupWithViewPager(viewPager);
return root;
}
@Override
public void onDestroyView() {
super.onDestroyView();
appBar.removeView(tabs);
}
/**
* Manage the tabs of fragment
*/
public class ViewPagerAdapter extends FragmentStatePagerAdapter {
private ViewPagerAdapter(@NonNull FragmentManager fm) {
super(fm);
}
String[] titleTabs = {TAB_1, TAB_2, TAB_3};
@NonNull
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return new RGBFragment();
case 1:
return new PowerStripOneFragment();
case 2:
return new PowerStripTwoFragment();
}
return null;
}
@Override
public int getCount() {
return NUM_OF_TABS;
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return titleTabs[position];
}
}
} | [
"d.albanese1@studenti.unimol.it"
] | d.albanese1@studenti.unimol.it |
5084c1396b1c05b07fb3671d553eb9ec932f59a4 | 710ecd40b4ef786ebe1ac785c850d9a29ddcd0fa | /springboot/springboot-exception/src/main/java/com/lifengming/exception/config/CommonEnum.java | 508809245bf7ff93b4c2d417e816288a44ef0fe1 | [] | no_license | fengmingli/awesome-java | e48e4ee8de5c767cf795ac5d5812add32cbbc9a2 | 61fe0c8e9fd1ee439b98167a5f235c437c8706e6 | refs/heads/main | 2023-09-06T02:18:30.783594 | 2021-11-27T13:17:23 | 2021-11-27T13:17:23 | 398,754,707 | 0 | 0 | null | 2021-11-27T13:17:24 | 2021-08-22T08:52:12 | Java | UTF-8 | Java | false | false | 954 | java | package com.lifengming.exception.config;
/**
* 自定义枚举类
* @author lifengming
* @date 2020.11.28
*/
public enum CommonEnum implements BaseErrorInfoInterface {
// 数据操作错误定义
SUCCESS("200", "成功!"),
BODY_NOT_MATCH("400", "请求的数据格式不符!"),
SIGNATURE_NOT_MATCH("401", "请求的数字签名不匹配!"),
NOT_FOUND("404", "未找到该资源!"),
INTERNAL_SERVER_ERROR("500", "服务器内部错误!"),
SERVER_BUSY("503", "服务器正忙,请稍后再试!");
/** 错误码 */
private final String resultCode;
/** 错误描述 */
private final String resultMsg;
CommonEnum(String resultCode, String resultMsg) {
this.resultCode = resultCode;
this.resultMsg = resultMsg;
}
@Override
public String getResultCode() {
return resultCode;
}
@Override
public String getResultMsg() {
return resultMsg;
}
}
| [
"lifengming@mockuai.com"
] | lifengming@mockuai.com |
94a6b3debcdca7d09e43ed4a24a3a2b3f2309099 | c41ff252b6628d3d8015eb25facbd6b29f39f961 | /src/main/java/com/labin/discordbot/FriendCommand.java | 245695230fe74dbf7b115ff88dcbda58931f37b4 | [] | no_license | labyrintos71/LabinBot | ddc25ae85eceaa562ec42f7bfc7000822f9a4a16 | 39df7d3bba66d12dbf4be30dcb58ae691b17a4b7 | refs/heads/master | 2020-03-08T04:38:10.541631 | 2018-06-10T15:15:36 | 2018-06-10T15:15:36 | 127,927,743 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,427 | java | package com.labin.discordbot;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.entities.User;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;
public class FriendCommand extends ListenerAdapter {
@Override
public void onMessageReceived(MessageReceivedEvent event) {
User user = event.getAuthor();
TextChannel tc = event.getTextChannel();
Message msg = event.getMessage();
if(user.isBot()) return;
if(msg.getContentRaw().charAt(0) == '!'){
String[] args = msg.getContentRaw().substring(1).split(" ");
//args 는 명령어
//args 1 2 3 은 인수가 있을경우
if(args[0].equals("ㅎㅇ")) tc.sendMessage("ㅎㅇ").queue();
switch(args[0]) {
case "최태열":
break;
}
if(args[0].indexOf("님태열")!=-1) tc.sendMessage("좆같은소리하지마;").queue();
if(args[0].indexOf("동훈")!=-1) tc.sendMessage("씨발련아").queue();
if(args[0].indexOf("퇴까")!=-1) tc.sendMessage("씨 발!").queue();
if(args[0].indexOf("용진")!=-1) tc.sendMessage("현재 던파중이여서 연락을 할수 없으며,, 자세한 연락은 대신택배로 부탁드립니다").queue();
}
}
}
| [
"labyrintos71@gmail.com"
] | labyrintos71@gmail.com |
aca1cdbdd7c1757baf022479c9324d4ae379792d | f6baa3cdbcb1d997f809ea2b90208d61a246e7cd | /Tutorial07Consumer/src/main/java/com/example/service/CourseServiceRest.java | 86a65d37fbd62ae228112bd9aa60fc56351b2277 | [] | no_license | apap-2017/tutorial7_1506724096 | d2451916a32142f9c7a5b6d1dd44329edd9d5ef1 | 921c001654ff05e75e085df63c737976fac99a63 | refs/heads/master | 2021-07-23T04:35:11.425396 | 2017-11-02T08:33:00 | 2017-11-02T08:33:00 | 109,114,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | package com.example.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import com.example.dao.CourseDAO;
import com.example.model.CourseModel;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Service
@Primary
public class CourseServiceRest implements CourseService {
@Autowired
private CourseDAO courseDAO;
@Override
public CourseModel selectCourse (String id_course) {
log.info ("REST - select course with id_course {}", id_course);
return courseDAO.selectCourse (id_course);
}
@Override
public List<CourseModel> selectAllCourses() {
log.info("REST - select all courses");
return courseDAO.selectAllCourses();
}
}
| [
"fajar.marseto28@gmail.com"
] | fajar.marseto28@gmail.com |
cf3849a0176777bc43b9a85ea4db925f87638f19 | 00189b9a72b99e69eb3f1e1453dbd2dda538df19 | /11/Exercise_11_10/src/com/denizsalman/Main.java | 7ef830d26b81959746a87495d06fe394f1efef3e | [] | no_license | denizsalman/Projelerim | 10b062f50a04ecdf48bc7cae9de721442a5af17a | 60836e389c4397f3b2eb1a0a627d603c590392e7 | refs/heads/master | 2020-03-28T12:34:36.103543 | 2018-09-11T12:17:23 | 2018-09-11T12:17:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.denizsalman;
public class Main {
public static void main(String[] args) {
// write your code here
MyStack myStack = new MyStack();
myStack.add(2);
myStack.add(3);
myStack.add("r");
System.out.println(myStack.pop());
myStack.push(6);
System.out.println(myStack.pop());
System.out.println(myStack.pop());
System.out.println(myStack.pop());
System.out.println(myStack.isEmpty());
}
}
| [
"ddenizsalman@gmail.com"
] | ddenizsalman@gmail.com |
3b7721b900d9702490f8f6e88672338cdb51554b | f127878f4e57a7a67d2a396402426b2963f7e707 | /src/main/java/vehicles/VehicleType.java | 0da7e4178292927e45c605200e180299784f9cda | [] | no_license | Jennycbx/CodeClan_Cars_Lab | fafaf16a918debe3a977e850edad3d7ebff5b085 | 2b9278d2173fb37b661c667604ce239e4be0b1de | refs/heads/main | 2023-04-01T07:29:55.955615 | 2021-03-31T07:23:48 | 2021-03-31T07:23:48 | 353,264,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74 | java | package vehicles;
public enum VehicleType {
CAR,
ELECTRIC_CAR;
}
| [
"jennycbx@hotmail.com"
] | jennycbx@hotmail.com |
f67b99af24ca69eb7abd99b27a61ee258b6a2e9d | e44759c6e645b4d024e652ab050e7ed7df74eba3 | /src/org/ace/java/component/idgen/persistence/IDGenDAO.java | e19094ecf34939d0d76b8738bf4c7211a2fc3747 | [] | no_license | LifeTeam-TAT/MI-Core | 5f779870b1328c23b192668308ee25c532ab6280 | 8c5c4466da13c7a8bc61df12a804f840417e2513 | refs/heads/master | 2023-04-04T13:36:11.616392 | 2021-04-02T14:43:34 | 2021-04-02T14:43:34 | 354,033,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,645 | java | package org.ace.java.component.idgen.persistence;
import javax.annotation.Resource;
import javax.persistence.LockModeType;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceException;
import javax.persistence.Query;
import org.ace.insurance.system.common.branch.Branch;
import org.ace.java.component.idgen.IDGen;
import org.ace.java.component.idgen.persistence.interfaces.IDGenDAOInf;
import org.ace.java.component.idgen.service.interfaces.IDConfigLoader;
import org.ace.java.component.persistence.BasicDAO;
import org.ace.java.component.persistence.exception.DAOException;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Repository("IDGenDAO")
public class IDGenDAO extends BasicDAO implements IDGenDAOInf {
@Resource(name = "IDConfigLoader")
protected IDConfigLoader configLoader;
@Transactional(propagation = Propagation.REQUIRED)
public IDGen getNextId(String generateItem, boolean isIgnoreBranch) throws DAOException {
IDGen idGen = null;
String branchCode = "";
try {
StringBuffer query = new StringBuffer();
query.append("SELECT g FROM IDGen g WHERE g.generateItem = :generateItem");
if (!isIgnoreBranch) {
query.append(" AND g.branch.id IN (SELECT b.id FROM Branch b Where b.branchCode = :branchCode)");
} else {
query.append(" AND g.branch IS NULL ");
}
Query selectQuery = em.createQuery(query.toString());
selectQuery.setLockMode(LockModeType.PESSIMISTIC_WRITE);
selectQuery.setHint("javax.persistence.lock.timeout", 30000);
if (configLoader.isCentralizedSystem()) {
branchCode = userProcessService.getLoginUser().getBranch().getBranchCode();
} else {
branchCode = configLoader.getBranchCode();
}
selectQuery.setParameter("generateItem", generateItem);
if (!isIgnoreBranch) {
selectQuery.setParameter("branchCode", branchCode);
}
idGen = (IDGen) selectQuery.getSingleResult();
idGen.setMaxValue(idGen.getMaxValue() + 1);
idGen = em.merge(idGen);
em.flush();
} catch (NoResultException e) {
throw translate("There is no Result " + generateItem, e);
} catch (PersistenceException pe) {
throw translate("Failed to update ID Generation for " + generateItem, pe);
}
return idGen;
}
@Transactional(propagation = Propagation.REQUIRED)
public IDGen getNextId(String generateItem) throws DAOException {
IDGen idGen = null;
String branchCode = "";
try {
Query selectQuery = em.createQuery(
"SELECT g FROM IDGen g WHERE g.generateItem = :generateItem AND g.branch.id IN " + " (SELECT b.id FROM Branch b Where b.branchCode = :branchCode)");
selectQuery.setLockMode(LockModeType.PESSIMISTIC_WRITE);
selectQuery.setHint("javax.persistence.lock.timeout", 30000);
if (configLoader.isCentralizedSystem()) {
branchCode = userProcessService.getLoginUser().getBranch().getBranchCode();
} else {
branchCode = configLoader.getBranchCode();
}
selectQuery.setParameter("generateItem", generateItem);
selectQuery.setParameter("branchCode", branchCode);
idGen = (IDGen) selectQuery.getSingleResult();
idGen.setMaxValue(idGen.getMaxValue() + 1);
idGen = em.merge(idGen);
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to update ID Generation for " + generateItem, pe);
}
return idGen;
}
@Transactional(propagation = Propagation.REQUIRED)
public IDGen getNextId(String generateItem, Branch branch) throws DAOException {
IDGen idGen = null;
try {
Query selectQuery = em
.createQuery("SELECT g FROM IDGen g WHERE g.generateItem = :generateItem AND g.branch.id IN (SELECT b.id FROM Branch b Where b.branchCode = :branchCode)");
selectQuery.setLockMode(LockModeType.PESSIMISTIC_WRITE);
selectQuery.setHint("javax.persistence.lock.timeout", 30000);
selectQuery.setParameter("generateItem", generateItem);
selectQuery.setParameter("branchCode", branch.getBranchCode());
idGen = (IDGen) selectQuery.getSingleResult();
idGen.setMaxValue(idGen.getMaxValue() + 1);
idGen = em.merge(idGen);
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to update ID Generation for " + generateItem, pe);
}
return idGen;
}
@Transactional(propagation = Propagation.REQUIRED)
public IDGen getIDGen(String generateItem) throws DAOException {
IDGen idGen = null;
try {
Query selectQuery = em
.createQuery("SELECT g FROM IDGen g WHERE g.generateItem = :generateItem AND g.branch.id IN (SELECT b.id FROM Branch b Where b.branchCode = :branchCode)");
selectQuery.setParameter("generateItem", generateItem);
selectQuery.setParameter("branchCode", configLoader.getBranchCode());
idGen = (IDGen) selectQuery.getSingleResult();
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to find Max Value for " + generateItem, pe);
}
return idGen;
}
@Transactional(propagation = Propagation.REQUIRED)
public IDGen getIDGenForAutoRenewal(String generateItem) throws DAOException {
IDGen idGen = null;
try {
Query selectQuery = em.createQuery("SELECT g FROM IDGen g WHERE g.generateItem = :generateItem");
selectQuery.setParameter("generateItem", generateItem);
idGen = (IDGen) selectQuery.getSingleResult();
idGen.setMaxValue(idGen.getMaxValue() + 1);
idGen = em.merge(idGen);
em.flush();
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to find Max Value for " + generateItem, pe);
}
return idGen;
}
@Transactional(propagation = Propagation.REQUIRED)
public IDGen updateIDGen(IDGen idGen) throws DAOException {
try {
idGen = em.merge(idGen);
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to update IDGen ", pe);
}
return idGen;
}
@Transactional(propagation = Propagation.REQUIRED)
public IDGen getCustomNextNo(String generateItem, String productId) {
IDGen idGen = null;
StringBuffer queryBffer = new StringBuffer();
queryBffer.append("SELECT g FROM IDGen g WHERE g.generateItem = :generateItem ");
if (productId != null) {
queryBffer.append("AND :product MEMBER OF g.productList ");
}
Query selectQuery = em.createQuery(queryBffer.toString());
selectQuery.setLockMode(LockModeType.PESSIMISTIC_WRITE);
selectQuery.setHint("javax.persistence.lock.timeout", 30000);
selectQuery.setParameter("generateItem", generateItem);
if (productId != null) {
selectQuery.setParameter("product", productId);
}
idGen = (IDGen) selectQuery.getSingleResult();
idGen.setMaxValue(idGen.getMaxValue() + 1);
idGen = em.merge(idGen);
em.flush();
return idGen;
}
@Transactional(propagation = Propagation.REQUIRED)
public IDGen getCustomNextNoByBranchId(String generateItem, String branchId) {
IDGen idGen = null;
StringBuffer queryBffer = new StringBuffer();
queryBffer.append("SELECT g FROM IDGen g WHERE g.generateItem = :generateItem ");
if (branchId != null) {
queryBffer.append("AND g.branch.id=:branchId ");
}
Query selectQuery = em.createQuery(queryBffer.toString());
selectQuery.setLockMode(LockModeType.PESSIMISTIC_WRITE);
selectQuery.setHint("javax.persistence.lock.timeout", 30000);
selectQuery.setParameter("generateItem", generateItem);
if (branchId != null) {
selectQuery.setParameter("branchId", branchId);
}
idGen = (IDGen) selectQuery.getSingleResult();
idGen.setMaxValue(idGen.getMaxValue() + 1);
idGen = em.merge(idGen);
em.flush();
return idGen;
}
@Transactional(propagation = Propagation.REQUIRED)
public IDGen getIDGen(String generateItem, boolean isIgnoreBranch) throws DAOException {
IDGen idGen = null;
try {
StringBuffer query = new StringBuffer();
query.append("SELECT g FROM IDGen g WHERE g.generateItem = :generateItem");
if (!isIgnoreBranch) {
query.append(" AND g.branch.id IN (SELECT b.id FROM Branch b Where b.branchCode = :branchCode)");
} else {
query.append(" AND g.branch IS NULL ");
}
Query selectQuery = em.createQuery(query.toString());
selectQuery.setParameter("generateItem", generateItem);
if (!isIgnoreBranch) {
selectQuery.setParameter("branchCode", configLoader.getBranchCode());
}
idGen = (IDGen) selectQuery.getSingleResult();
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to find Max Value for " + generateItem, pe);
}
return idGen;
}
@Override
public IDGen getNextId(String generateItem, Branch branch, boolean isIgnoreBranch) throws DAOException {
// TODO Auto-generated method stub
return null;
}
}
| [
"lifeteam.tat@gmail.com"
] | lifeteam.tat@gmail.com |
fedc5299a72c9b8095f9cb4d92778868a37d2cc6 | 30edba3cc1757d6df5b5a830e4ddb3fb7896e605 | /hu.bme.mit.trainbenchmark.benchmark.sql/src/main/java/hu/bme/mit/trainbenchmark/benchmark/sql/transformations/repair/SQLTransformationRepairSwitchSet.java | 4c63cffda3a45c129b4b57d9e1f38385507e54af | [] | no_license | IncQueryLabs/trainbenchmark | b21ecf17b1ed4efdc2e04031ca35599abf1f5ec7 | aa610691387a04f41f5fd745b610924cae32dd48 | refs/heads/master | 2023-08-11T08:38:00.435601 | 2015-11-09T15:47:04 | 2015-11-09T15:47:04 | 45,915,684 | 1 | 0 | null | 2015-11-10T14:04:53 | 2015-11-10T14:04:53 | null | UTF-8 | Java | false | false | 1,766 | java | /*******************************************************************************
* Copyright (c) 2010-2015, Benedek Izso, Gabor Szarnyas, Istvan Rath and Daniel Varro
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Benedek Izso - initial API and implementation
* Gabor Szarnyas - initial API and implementation
*******************************************************************************/
package hu.bme.mit.trainbenchmark.benchmark.sql.transformations.repair;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Collection;
import hu.bme.mit.trainbenchmark.benchmark.config.BenchmarkConfig;
import hu.bme.mit.trainbenchmark.benchmark.sql.driver.SQLDriver;
import hu.bme.mit.trainbenchmark.benchmark.sql.match.SQLSwitchSetMatch;
import hu.bme.mit.trainbenchmark.constants.Query;
public class SQLTransformationRepairSwitchSet extends SQLTransformationRepair<SQLSwitchSetMatch> {
public SQLTransformationRepairSwitchSet(final SQLDriver driver, final BenchmarkConfig benchmarkConfig, final Query query) throws IOException {
super(driver, benchmarkConfig, query);
}
@Override
public void rhs(final Collection<SQLSwitchSetMatch> matches) throws SQLException {
if (preparedUpdateStatement == null) {
preparedUpdateStatement = driver.getConnection().prepareStatement(updateQuery);
}
for (final SQLSwitchSetMatch match : matches) {
preparedUpdateStatement.setLong(1, match.getPosition());
preparedUpdateStatement.setLong(2, match.getSw());
preparedUpdateStatement.executeUpdate();
}
}
}
| [
"szarnyasg@gmail.com"
] | szarnyasg@gmail.com |
504f96afa4b5a90f7e7c4bd91b4c72f84e572c2f | aa9d536b64ba88c13e6b19343b79edbd9f9e1925 | /JavaNetWorkTest/src/basic/C_URLConnectionTest.java | e22149c28845a2fc7167169610d1a79cdba2013c | [] | no_license | khw0613/dditJavaHigh | 4af5455f6596c1fc8792e837e0fbd4076283e66f | b2a4a2baa98dfdb4d775511024a49da1eb5ae0ad | refs/heads/master | 2020-04-27T11:33:27.136270 | 2019-05-09T09:15:05 | 2019-05-09T09:15:05 | 174,299,788 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,012 | java | package basic;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class C_URLConnectionTest {
public static void main(String[] args) throws IOException {
//URLConnection => 어플리케이션과 URL간의 통신 연결을 위한 추상 클래스
//특정 서버 (예:naver서버)의 정보와 파일 내용을 출력하는 예제
URL url = new URL("http://www.naver.com/index.html");
//Header 정보 가져오기
//URLConnection 객체 구하기
URLConnection urlCon = url.openConnection();
System.out.println("Content-Type : " + urlCon.getContentType());
System.out.println("Encoding : " + urlCon.getContentEncoding());
System.out.println("Content : " + urlCon.getContent());
System.out.println();
//전체 Header정보 출력하기
Map<String, List<String>> headerMap = urlCon.getHeaderFields();
//Header의 Key값 구하기
Iterator<String> iterator = headerMap.keySet().iterator();
while(iterator.hasNext()) {
String key = iterator.next();
System.out.println(key + " : " + headerMap.get(key));
}
System.out.println("-----------------------------------------------");
//해당 호스트의 페이지 내용 가져오기
//방법 1. => URLConnection의 getInputStream메서드 이용하기
//파일을 읽어오기 위한 스트림 생성
//InputStream is = urlCon.getInputStream();
//방법 2. => URL객체의 openStream()메서드 이용하기
InputStream is = url.openStream();
InputStreamReader isr = new InputStreamReader(is, "utf-8");
BufferedReader br = new BufferedReader(isr);
//내용 출력하기
while(true) {
String str = br.readLine();
if(str == null) {
break;
}
System.out.println(str);
}
//스트림 닫기
br.close();
}
}
| [
"thy1348@gmail.com"
] | thy1348@gmail.com |
01b7dc33f8884a57e56133a0227985226553745b | 9623f83defac3911b4780bc408634c078da73387 | /powercraft_147/src/minecraft/net/minecraft/server/gui/GuiStatsListener.java | a5ba2afdf47afdcfd8b88acca2522b387360d2a3 | [] | no_license | BlearStudio/powercraft-legacy | 42b839393223494748e8b5d05acdaf59f18bd6c6 | 014e9d4d71bd99823cf63d4fbdb65c1b83fde1f8 | refs/heads/master | 2021-01-21T21:18:55.774908 | 2015-04-06T20:45:25 | 2015-04-06T20:45:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 586 | java | package net.minecraft.server.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@SideOnly(Side.SERVER)
class GuiStatsListener implements ActionListener
{
final GuiStatsComponent statsComponent;
GuiStatsListener(GuiStatsComponent par1GuiStatsComponent)
{
this.statsComponent = par1GuiStatsComponent;
}
public void actionPerformed(ActionEvent par1ActionEvent)
{
GuiStatsComponent.update(this.statsComponent);
}
}
| [
"nils.h.emmerich@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c"
] | nils.h.emmerich@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c |
b3c24371560bc371be6b3dfd0e068c19b267b09f | 8e111a29078dd807655d4da1f727b7b883f00e23 | /online_test_management_user/src/main/java/com/base_class/Library.java | 66b8de230ccae7f6d30a015020c5d06b6a33498e | [] | no_license | praveenb9/OnlineTestManagement | 6b7f0828d3acd401d5f6bd4ec66370f1523edced | 13727764146e74dab098b7e263a780f86f37e541 | refs/heads/master | 2023-01-09T22:47:54.123229 | 2020-11-10T15:24:20 | 2020-11-10T15:24:20 | 296,783,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,751 | java | package com.base_class;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class Library {
public static WebDriver driver;
public static Properties properties;
public static Logger logger;
public Library() {
properties = new Properties();
try {
InputStream inputStream = new FileInputStream("./src/test/resources/config.property/Config.property");
try {
properties.load(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
logger = Logger.getLogger(Library.class);
PropertyConfigurator.configure("./src/test/resources/log4jproperties/Log4j.property");
}
public static void browserSetUp() {
logger.info("Starting with Browser Set Up");
String browser = properties.getProperty("browser");
String url = properties.getProperty("url");
switch (browser.toLowerCase()) {
case "chrome":
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
logger.info(String.format("Identified the browser as %s. Launching the browser", browser));
break;
case "firefox":
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver();
logger.info(String.format("Identified the browser as %s. Launching the browser", browser));
break;
case "ie":
WebDriverManager.iedriver().setup();
driver = new InternetExplorerDriver();
logger.info(String.format("Identified the browser as %s. Launching the browser", browser));
break;
case "headlessbrowser":
WebDriverManager.chromedriver().setup();
ChromeOptions options=new ChromeOptions();
options.setHeadless(true);
driver=new ChromeDriver(options);
default:
logger.info(String.format("Could not identify the browser as %s. Please specify correct browser", browser));
break;
}
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get(url);
logger.info("Launched the OrangeHRM Application");
}
public static void tearDown() {
driver.quit();
logger.info("Exiting the application and closing the browser");
}
}
| [
"Sai Charan@saicharan"
] | Sai Charan@saicharan |
6191f001a631f60ca85d6e4c3ef831d1a42db68a | fe774f001d93d28147baec987a1f0afe0a454370 | /ml-model/files/set34/The_Sudhanshu.java | eb7e2e1f5cdfc840580a7772b8e42a449365affe | [] | no_license | gabrielchl/ml-novice-expert-dev-classifier | 9dee42e04e67ab332cff9e66030c27d475592fe9 | bcfca5870a3991dcfc1750c32ebbc9897ad34ea3 | refs/heads/master | 2023-03-20T05:07:20.148988 | 2021-03-19T01:38:13 | 2021-03-19T01:38:13 | 348,934,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
static int[] circularArrayRotation(int[] a, int k, int[] queries) {
int z=0,len = a.length;
int ro = k % len;
int arr[] = new int[queries.length];
for(int i : queries){
arr[z++] = a[((len-ro +i)% len)];
}
return arr;
}
}
| [
"chihonglee777@gmail.com"
] | chihonglee777@gmail.com |
6e89096236bec4dae79ada9a9da5071ea81d099b | dbf750f0ab05270498a41215de7dabae17dd2723 | /src/main/java/com/trade/orderbook/model/OrderBookBuySide.java | 4919a2278f7ca265ef49e6df30756b100ea79c97 | [] | no_license | KyranRana/BasicOrderBook | 1cf8250f148893c15cd813eaa0ce5c8db71b4617 | 0053afe714bbfef5283b4c973eaa165b915a72ff | refs/heads/main | 2023-07-18T23:55:11.131834 | 2021-09-26T14:35:16 | 2021-09-26T14:35:16 | 410,397,440 | 0 | 0 | null | 2021-09-26T14:33:00 | 2021-09-25T22:46:30 | Java | UTF-8 | Java | false | false | 296 | java | package com.trade.orderbook.model;
import java.util.Optional;
public class OrderBookBuySide extends OrderBookSide {
@Override
public Optional<Long> getBestPrice() {
return Optional.ofNullable(orderedPrices.last());
}
@Override
public Side getSide() {
return Side.BUY;
}
}
| [
"kyranportfolio@gmail.com"
] | kyranportfolio@gmail.com |
bad048ab3b983f28d21a82c312f349f2a1a9b718 | 75a421e86e092e988f90fe9342a9be8ad0b46dc3 | /android_dev/UDP_receive/app/src/main/java/com/example/rft/udp_receive/Paint_Data.java | cc1d276840a59a5e2a0562d8f0d1556ddf5ad543 | [] | no_license | hungrygeek/RFT | bcc474539bcf8d479427a360ad3f5087ae59a92b | 1a11a6ef80b31ae0385cd016d53bd938b899a061 | refs/heads/master | 2021-01-25T07:28:23.351492 | 2014-10-13T20:02:01 | 2014-10-13T20:02:01 | 16,613,654 | 1 | 0 | null | 2014-08-03T10:07:18 | 2014-02-07T12:11:21 | JavaScript | UTF-8 | Java | false | false | 169 | java | package com.example.rft.udp_receive;
/**
* Created by shishu on 26/09/2014.
*/
public class Paint_Data extends Thread {
@Override
public void run(){
}
}
| [
"shushi139@gmail.com"
] | shushi139@gmail.com |
4b2c7da82394c32ca4382c5c50b51016390240f5 | 7660ba44cc149e49573e0d9b50ab5af863d0b69f | /app/src/androidTest/java/com/example/golu/apitest/ExampleInstrumentedTest.java | 468178400d226ef479d042367bca4bed9a22e245 | [] | no_license | fxrahul/login_android | 657536148b0d9ecf57d861cc00b0be6953f6c52b | 5965c5358d7f4a6a2c5724695917e73778aab829 | refs/heads/master | 2020-04-04T15:05:48.337497 | 2018-11-03T21:13:22 | 2018-11-03T21:13:22 | 156,024,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package com.example.golu.apitest;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.golu.apitest", appContext.getPackageName());
}
}
| [
"rohits130198@gmail.com"
] | rohits130198@gmail.com |
ace26695421e5aef549076ee2b54ccd95a0b6802 | e3974b1ba6a8cfbbf337cdd82bc4797fddbd3866 | /src/main/java/lk/wisdom_institute/asset/batch_student/controller/BatchStudentController.java | 5eaec8ada2301cd26e3182e3be9bc1802725b026 | [] | no_license | jlenagala/wisdom-institute | 5a7da80a99d39fda9d247630a9fa0b61ce52c103 | 4a1f591288a17bed04f5e1489b266ef2022d60fe | refs/heads/master | 2023-04-10T22:47:08.006585 | 2021-04-22T21:58:57 | 2021-04-22T21:58:57 | 312,890,562 | 0 | 0 | null | 2021-04-22T20:30:06 | 2020-11-14T19:49:31 | HTML | UTF-8 | Java | false | false | 4,006 | java | package lk.wisdom_institute.asset.batch_student.controller;
import lk.wisdom_institute.asset.batch.entity.Batch;
import lk.wisdom_institute.asset.batch.service.BatchService;
import lk.wisdom_institute.asset.batch_student.entity.BatchStudent;
import lk.wisdom_institute.asset.batch_student.service.BatchStudentService;
import lk.wisdom_institute.asset.common_asset.model.enums.LiveDead;
import lk.wisdom_institute.asset.employee.service.EmployeeService;
import lk.wisdom_institute.asset.student.entity.Student;
import lk.wisdom_institute.asset.student.service.StudentService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Controller
@RequestMapping( "/batchStudent" )
public class BatchStudentController {
private final BatchService batchService;
private final BatchStudentService batchStudentService;
private final StudentService studentService;
private final EmployeeService employeeService;
public BatchStudentController(BatchService batchService, BatchStudentService batchStudentService,
StudentService studentService, EmployeeService employeeService) {
this.batchService = batchService;
this.batchStudentService = batchStudentService;
this.studentService = studentService;
this.employeeService = employeeService;
}
@GetMapping
public String allActiveBatch(Model model) {
List< Batch > batchList = batchService.findAll()
.stream()
.filter(x -> x.getLiveDead().equals(LiveDead.ACTIVE))
.collect(Collectors.toList());
List< Batch > batches = new ArrayList<>();
for ( Batch batch : batchList ) {
batch.setCount(batchStudentService.countByBatch(batch));
batches.add(batch);
}
model.addAttribute("batches", batches);
return "batchStudent/batchStudent";
}
@GetMapping( "/batch/{id}" )
public String studentAddBatch(@PathVariable( "id" ) Integer id, Model model) {
common(id, model, true);
return "batchStudent/addBatchStudent";
}
@PostMapping( "/removeBatch" )
public String removeStudentFromBatch(@ModelAttribute BatchStudent batchStudent) {
BatchStudent batchStudentDB = batchStudentService.findByStudentAndBatch(batchStudent.getStudent(),
batchStudent.getBatch());
batchStudentDB.setLiveDead(LiveDead.STOP);
batchStudentService.persist(batchStudentDB);
return "redirect:/batchStudent/batch/" + batchStudentDB.getBatch().getId();
}
@GetMapping( "/batch/student/{id}" )
public String batchStudent(@PathVariable( "id" ) Integer id, Model model) {
common(id, model, false);
return "batchStudent/showStudent";
}
private void common(Integer id, Model model, boolean addStatus) {
Batch batch = batchService.findById(id);
model.addAttribute("batchDetail", batch);
//already registered student on this batch
List< Student > registeredStudent = new ArrayList<>();
batch.getBatchStudents()
.stream()
.filter(x -> x.getLiveDead().equals(LiveDead.ACTIVE))
.collect(Collectors.toList())
.forEach(x -> registeredStudent.add(studentService.findById(x.getStudent().getId())));
model.addAttribute("students", registeredStudent);
model.addAttribute("studentRemoveBatch", true);
model.addAttribute("employeeDetail", employeeService.findById(batch.getEmployee().getId()));
if ( addStatus ) {
model.addAttribute("student", new BatchStudent());
//not registered student on this batch
// List< Student > notRegisteredStudent = studentService.findByGrade(batch.getGrade())
// .stream()
// .filter(x -> !registeredStudent.contains(x))
// .collect(Collectors.toList());
// model.addAttribute("notRegisteredStudent", notRegisteredStudent);
}
}
}
| [
"jananianut@gmail.com"
] | jananianut@gmail.com |
e76f9f5f7e25a1bf27f0daf8f104ebebfdfb828e | 34fb95b16ccefbde3a1899334ba5815a8f7c8383 | /anno/src/Users.java | 02f697da6e45358e9b6050633d53d35ae961527d | [] | no_license | mwfj/Java_Basic_Practice | 80b7fce6e2f164494e3811dc3a9ae7ffda1acbce | 6067e2703cd8693d081bdcf666728640586f6abf | refs/heads/master | 2021-03-31T03:42:01.873622 | 2021-01-18T20:40:37 | 2021-01-18T20:40:37 | 248,072,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | java |
@Table(tableName="user")
public class Users {
@Column(columnName="id", isStr="no")
private int id;
@Column(columnName="name", isStr="yes")
private String name;
@Column(columnName="password", isStr="yes")
private String pwd;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
}
| [
"wufangm@clemson.edu"
] | wufangm@clemson.edu |
b8d9b8b547557852d378ae7375642882ff9b9083 | 99b7dd09706b62e21926fbeb07d846195463a881 | /src/test/java/com/avi/educative/multithreading/OrderPrintingTest.java | d8bb3245d9187162eb87eed9bb711abdba565c39 | [] | no_license | aviundefined/dailypractice | ad10c9661d6af03c77935222bf0bf95fcf78bb2b | ca98e0610a38827b74719ca65cbe739e29bd7a99 | refs/heads/master | 2023-07-06T11:16:44.561228 | 2023-06-24T13:45:14 | 2023-06-24T13:45:14 | 208,435,489 | 0 | 0 | null | 2022-05-20T22:02:19 | 2019-09-14T12:12:10 | Java | UTF-8 | Java | false | false | 435 | java | package com.avi.educative.multithreading;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Created by navinash on 26/10/20.
* Copyright 2019 VMware, Inc. All rights reserved.
* -- VMware Confidential
*/
public class OrderPrintingTest {
@Test
public void test() throws InterruptedException {
final OrderPrinting orderPrinting = new OrderPrinting();
orderPrinting.orderPrinting();
}
} | [
"iitk.avinash.nigam@gmail.com"
] | iitk.avinash.nigam@gmail.com |
38ec124c82e3ae3a081f9b38bacb338e570cb9d9 | 64f48f636ba3e197789bf79c80f34c518bb79fc6 | /src/main/java/com/se/bt1_nguyenthanhtu_18045511/entity/Student.java | 69b8bb7def62e9023c94076512a4d9e01ce739cf | [] | no_license | tusin261/KTPM_2021_BT1 | c15ba60aea02e56ff80564d2d374c8523afb548e | 4cc57cd97ae1874a09ceba5fe4877063fe8f9c14 | refs/heads/master | 2023-07-24T22:51:53.866726 | 2021-09-10T13:18:01 | 2021-09-10T13:18:01 | 404,925,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.se.bt1_nguyenthanhtu_18045511.entity;
import lombok.*;
import javax.persistence.*;
@Entity
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@Table
public class Student {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long studentId;
@Column(name = "name")
private String name;
@Column(name = "age")
private int age;
}
| [
"thanhtu3885585@gmail.com"
] | thanhtu3885585@gmail.com |
cff83064aa99695d2e73f9b0eb554b0e3e0c0601 | 5f04cf301638bfed95d34128486f21138e23602f | /foodie-dev-mapper/src/main/java/com/imooc/mapper/ItemsMapperCustom.java | 650014f1554e2579475a47ea29601a3cc56e1d46 | [] | no_license | i-kang/foodie-dev | d6c406e5de7c0b21a10a65e3014c5abe870850f1 | c937b2decdbed89dcf3059eb685b2db2f66f30b3 | refs/heads/master | 2020-11-30T12:29:24.495991 | 2019-11-16T13:38:44 | 2019-11-16T13:38:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package com.imooc.mapper;
import com.imooc.vo.ItemCommentVO;
import com.imooc.vo.SearchItemsVO;
import com.imooc.vo.ShopCartVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface ItemsMapperCustom {
List<ItemCommentVO> queryItemComments(@Param("paramsMap") Map<String, Object> map);
List<SearchItemsVO> searchItems(@Param("paramsMap") Map<String, Object> map);
List<SearchItemsVO> searchItemsByThirdCat(@Param("paramsMap") Map<String, Object> map);
List<ShopCartVO> queryItemsBySpecIds(@Param("paramsList") List specIdsList);
int decreaseItemSpecStock(@Param("specId") String specId, @Param("pendingStock") int pendingCounts);
} | [
"1677390657@qq.com"
] | 1677390657@qq.com |
662f9a315add3b27081ebe2b72b0154c94e22602 | e2e536e3c0486c00daf8341cfc9ce56f4e4e0b45 | /src/main/java/com/kanban/config/WebSecurityConfig.java | 74da232f307fddd65fe6fb38a6a083c4aff11270 | [] | no_license | anndov/kanban-backend | 7a69a19ab25e5b6ca36996d22376c0f296325a18 | b326d1415b775a4c3455daa4d36bea7cc21ef4bf | refs/heads/master | 2021-09-11T22:19:20.710938 | 2018-01-22T10:04:23 | 2018-01-22T10:04:23 | 104,710,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,543 | java | package com.kanban.config;
import com.kanban.security.JwtAuthenticationEntryPoint;
import com.kanban.security.JwtAuthenticationTokenFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@SuppressWarnings("SpringJavaAutowiringInspection")
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private JwtAuthenticationEntryPoint unauthorizedHandler;
@Autowired
private UserDetailsService userDetailsService;
@Autowired
public void configureAuthentication(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
authenticationManagerBuilder
.userDetailsService(this.userDetailsService)
.passwordEncoder(passwordEncoder());
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public JwtAuthenticationTokenFilter authenticationTokenFilterBean() throws Exception {
return new JwtAuthenticationTokenFilter();
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
// we don't need CSRF because our token is invulnerable
.csrf().disable()
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// don't create session
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests()
//.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
// allow anonymous resource requests
.antMatchers(
HttpMethod.GET,
"/",
"/*.html",
"/favicon.ico",
"/**/*.html",
"/**/*.css",
"/**/*.js"
).permitAll()
.antMatchers("/auth/**").permitAll()
.antMatchers("/registration/**").permitAll()
.antMatchers("/invitation/**").permitAll()
.anyRequest().authenticated();
// Custom JWT based security filter
httpSecurity
.addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class);
// disable page caching
httpSecurity.headers().cacheControl();
}
}
| [
"anndov@gmail.com"
] | anndov@gmail.com |
3e8d22e34df434fcc4f485ce240bd2aa7a1e945f | 802f1c1ac34f9fcda29ceb09b9160f25eeac90a4 | /src/java/controller/UpdateFeedbackServlet.java | cfaba4e4ea7cd904620dbeaea8ba5c8ae99a67ce | [] | no_license | ishansen97/Hemas_Project | 3fb796ba66bd8a0f61240a7e2fb7f055f74fc2c1 | 756ae3d38afe996ab9b684e095ddf6639076cb0c | refs/heads/master | 2020-07-11T00:28:51.146506 | 2019-08-31T04:22:06 | 2019-08-31T04:22:06 | 204,408,415 | 0 | 0 | null | 2019-08-29T07:13:36 | 2019-08-26T06:16:04 | CSS | UTF-8 | Java | false | false | 3,062 | 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 controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Ishan
*/
@WebServlet(name = "UpdateFeedbackServlet", urlPatterns = {"/UpdateFeedbackServlet"})
public class UpdateFeedbackServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet UpdateFeedbackServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet UpdateFeedbackServlet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"ishanksen@gmail.com"
] | ishanksen@gmail.com |
d33060a3b7bf5a0f1217381a2a275d65b6098916 | bc40a57eabc2ff204fca1f042494dccaa4ed0ff8 | /src/main/java/com/lowLevelFrameworkTest/lowLevelFrameworkTest/LowLevelORM/OmegaServicev1/Abstract/OmegaDatastoreService.java | 520b6c4f31f04c8203d584ad3eaec93e8d2a9d4c | [] | no_license | shriharistark/lowLevelFramework | 0102e40befa7b3af8d46e489ee71d8aa50e50c9e | 9c3b7b60890106f736f96bfe1bb1d53f19c121ed | refs/heads/master | 2020-04-17T11:02:08.195975 | 2019-07-06T15:58:56 | 2019-07-06T15:58:56 | 166,524,233 | 0 | 0 | null | 2019-07-06T15:58:57 | 2019-01-19T08:26:54 | Java | UTF-8 | Java | false | false | 661 | java | package com.lowLevelFrameworkTest.lowLevelFrameworkTest.LowLevelORM.OmegaServicev1.Abstract;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Transaction;
import java.util.List;
public interface OmegaDatastoreService {
Object get(Key key, String kind);
Object get(String ID, String kind);
Object put(Object pojo, String id);
Object put(Object pojo); //auto-generate numeric Id
Object upsert(Object pojo, Key key);
List<Key> put(List<?> pojo);
boolean delete(Key key);
boolean delete(List<Key> keys);
Transaction beginTransaction();
Transaction finishTransaction();
}
| [
"shrihari.stark@gmail.com"
] | shrihari.stark@gmail.com |
ab2ffbd761b37065155e869d5263ccea133683ec | 437a43105b811bf3488956b56eaa754bfc79fa8a | /APUCSC_1.2/src/apucsc_1/pkg2/GUI_50.java | 57ba8c216b0933ffee547a214f66384c1af3c8dd | [] | no_license | elricmercer/Automotive-car-service-centre | 69edecbc7afdd08b3f52f5f33c465d88e29249f3 | cd2ca30bad0c851ece7c46825c4b40efdc005791 | refs/heads/main | 2023-07-26T19:54:54.635685 | 2021-09-11T14:28:58 | 2021-09-11T14:28:58 | 405,375,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,615 | 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 apucsc_1.pkg2;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.Random;
import java.util.Scanner;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
/**
*
* @author ZAHIRUL
*/
public class GUI_50 extends javax.swing.JFrame {
/**
* Creates new form GUI_50
*/
private String name;
private String email;
private String phoneNumber;
private String day;
private int startTime;
private int finishTime;
private boolean check;
DefaultListModel dm = new DefaultListModel();
DefaultListModel dm2 = new DefaultListModel();
public GUI_50() {
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();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton3 = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList<>();
jScrollPane4 = new javax.swing.JScrollPane();
jList2 = new javax.swing.JList<>();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("ASSIGN JOB");
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel2.setBackground(new java.awt.Color(0, 204, 204));
jPanel2.setPreferredSize(new java.awt.Dimension(200, 388));
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel2.setText("TECHNICIANS");
jButton1.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jButton1.setText("ENTER CUSTOMER");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jButton2.setText("CLOSE");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel6.setIcon(new javax.swing.ImageIcon("F:\\yr 2 semester 1\\OODJ\\Assignment\\APU car service centre 1.2\\final\\APU Automotive car service centre\\icons\\converted\\admin.png")); // NOI18N
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(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(jLabel2)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jButton2)))
.addGap(26, 26, 26))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 168, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addGap(76, 76, 76))
);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel3.setText("WORKIGN ON THE DAY AND TIME");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel4.setText("ALL TECHNICIANS");
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel5.setText("TECHNICIAN'S ID:");
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jButton3.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jButton3.setText("OK");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jScrollPane3.setViewportView(jList1);
jScrollPane4.setViewportView(jList2);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addComponent(jLabel3)
.addGap(133, 133, 133)
.addComponent(jLabel4)
.addGap(53, 53, 53))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 294, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton3)
.addGap(301, 301, 301))))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane3)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3))
.addContainerGap(20, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
//CUSTOMER*********************************************************
name = JOptionPane.showInputDialog("Enter Customer Name");
email = JOptionPane.showInputDialog("Enter Email");
phoneNumber = JOptionPane.showInputDialog("Enter Phone Number");
if(!name.equals(null))
if(!email.equals(null))
if(!phoneNumber.equals(null))
{
day = JOptionPane.showInputDialog("Enter day - [MON,TUE,WED,THUR,FRI]");
if(day.equalsIgnoreCase("MON")||day.equalsIgnoreCase("TUE")||day.equalsIgnoreCase("WED")||day.equalsIgnoreCase("THUR")||day.equalsIgnoreCase("FRI"))
{
String a = JOptionPane.showInputDialog("Enter Time [2PM - 9PM]");
startTime = Integer.parseInt(a);
finishTime = startTime+1;
if(startTime==2||startTime==3||startTime==4||startTime==5||startTime==6||startTime==7||startTime==8||startTime==9)
{
check = true;
}
else
JOptionPane.showMessageDialog(this, "WRONG INPUT!!");
}
else
JOptionPane.showMessageDialog(this, "WRONG INPUT!!");
}
else
{
setVisible(false);
new GUI_4().setVisible(true);
}
if(check)
{
for(int i=0;i<APUCSC_12.allHeavyDuty.size();i++)
{
if(APUCSC_12.allHeavyDuty.get(i).getDay().equals(day) && APUCSC_12.allHeavyDuty.get(i).getBeginTime()==startTime && APUCSC_12.allHeavyDuty.get(i).getEndTime()==finishTime)
{
jList1.setModel(dm2);
dm2.addElement(APUCSC_12.allHeavyDuty.get(i).getWorker().getUserId());
}
}
for(int i=0;i<APUCSC_12.allTechs.size();i++)
{
jList2.setModel(dm);
dm.addElement(APUCSC_12.allTechs.get(i).getUserId());
}
}
else
JOptionPane.showMessageDialog(this,"Enter Customer Details first!!");
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
//CLOSE***********************************************************
setVisible(false);
new GUI_4().setVisible(true);
//CLOSE***********************************************************
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
//TECHS ID*********************************************************
if(check)
{
String inTechId = jTextField1.getText().trim();
boolean flag = false,flag_2 = false;
String ticketNumber="";
String ID = "";
Random rnd = new Random();
for(int i=0;i<APUCSC_12.allHeavyDuty.size();i++)
{
if(APUCSC_12.allHeavyDuty.get(i).getDay().equals(day) & APUCSC_12.allHeavyDuty.get(i).getBeginTime()==startTime & APUCSC_12.allHeavyDuty.get(i).getEndTime()==finishTime)
{
String a = APUCSC_12.allHeavyDuty.get(i).getWorker().getUserId();
if(a.equals(inTechId))
{
JOptionPane.showMessageDialog(this, "TECHNICIANS BOOKED OR WORKING AT THAT TIME AND DAY!!");
flag = true;
break;
}
}
}
if(flag==false)
{
boolean cusList = APUCSC_12.allCustomer.isEmpty();
if(cusList==true)
{
int ran = rnd.nextInt(1000)+1;
String sran = String.valueOf(ran);
ID = sran;
}
else
{
for(int i=0;i<APUCSC_12.allCustomer.size();i++)
{
int ran = rnd.nextInt(1000)+1;
String sran = String.valueOf(ran);
if(!APUCSC_12.allCustomer.get(i).getId().equals(sran))
{
ID = sran;
break;
}
}
}
String a = JOptionPane.showInputDialog("You charge is RM300");
int b = Integer.parseInt(a);
if(b>300)
{
JOptionPane.showMessageDialog(this, "You change is RM"+ (b-300));
boolean ticketList = APUCSC_12.allTicket.isEmpty();
if(ticketList==true)
{
int ran = rnd.nextInt(1000)+1;
flag_2 = true;
ticketNumber = "CS"+ran;
}
else
{
for(int i=0;i<APUCSC_12.allTicket.size();i++)
{
int ran = rnd.nextInt(1000)+1;
String c = APUCSC_12.allTicket.get(i).getTicketNumber();
int len = c.length();
String d = c.substring(2,len);
int oldTicket = Integer.parseInt(d);
if(ran!=oldTicket)
{
flag_2 = true;
ticketNumber = "CS"+ran;
break;
}
}
}
}
else
{
if(b<300)
{
JOptionPane.showMessageDialog(this, "You have paid RM"+ (300-b) +" less" );
}
int newCharge;
newCharge = 300-b;
while(newCharge>0)
{
String c = JOptionPane.showInputDialog("You charge is RM"+newCharge);
int d = Integer.parseInt(c);
newCharge = newCharge-d;
}
if(newCharge==0)
{
boolean ticketList = APUCSC_12.allTicket.isEmpty();
if(ticketList==true)
{
int ran = rnd.nextInt(1000)+1;
flag_2 = true;
ticketNumber = "CS"+ran;
}
else
{
for(int i=0;i<APUCSC_12.allTicket.size();i++)
{
int ran = rnd.nextInt(1000)+1;
String c = APUCSC_12.allTicket.get(i).getTicketNumber();
int len = c.length();
String d = c.substring(2,len);
int oldTicket = Integer.parseInt(d);
if(ran!=oldTicket)
{
flag_2 = true;
ticketNumber = "CS"+ran;
break;
}
}
}
}
else if(newCharge<0)
{
JOptionPane.showMessageDialog(this,"You change is RM"+(newCharge*-1));
boolean ticketList = APUCSC_12.allTicket.isEmpty();
if(ticketList==true)
{
int ran = rnd.nextInt(1000)+1;
flag_2 = true;
ticketNumber = "CS"+ran;
}
else
{
for(int i=0;i<APUCSC_12.allTicket.size();i++)
{
int ran = rnd.nextInt(1000)+1;
String c = APUCSC_12.allTicket.get(i).getTicketNumber();
int len = c.length();
String d = c.substring(2,len);
int oldTicket = Integer.parseInt(d);
if(ran!=oldTicket)
{
flag_2 = true;
ticketNumber = "CS"+ran;
break;
}
}
}
}
}
if(flag_2=true)
{
JOptionPane.showMessageDialog(this, "CUSTOMER ID: "+ID+ " TICKET NO.: "+ticketNumber+" Your TECHNICIAN: "+inTechId);
try
{
Customer cus = new Customer(ID,name,email,phoneNumber);
APUCSC_12.allCustomer.add(cus);
PrintWriter pw = new PrintWriter("customer.txt");
for(int i=0;i<APUCSC_12.allCustomer.size();i++)
{
pw.println(APUCSC_12.allCustomer.get(i).getId());
pw.println(APUCSC_12.allCustomer.get(i).getName());
pw.println(APUCSC_12.allCustomer.get(i).getEmail());
pw.println(APUCSC_12.allCustomer.get(i).getPhoneNo());
pw.println();
}
pw.flush();
pw.close();
}
catch(Exception e)
{
}
try
{
for(int i=0;i<APUCSC_12.allCustomer.size();i++)
{
if(name.equals(APUCSC_12.allCustomer.get(i).getName()))
{
APUCSC_12.customerName = APUCSC_12.allCustomer.get(i);
break;
}
}
for(int i=0;i<APUCSC_12.allCustomer.size();i++)
{
if(ID.equals(APUCSC_12.allCustomer.get(i).getId()))
{
APUCSC_12.customerID = APUCSC_12.allCustomer.get(i);
break;
}
}
for(int i=0;i<APUCSC_12.allTechs.size();i++)
{
if(inTechId.equals(APUCSC_12.allTechs.get(i).getUserId()))
{
APUCSC_12.techs = APUCSC_12.allTechs.get(i);
break;
}
}
Ticket ticket = new Ticket(ticketNumber,"100",APUCSC_12.customerName,APUCSC_12.customerID,APUCSC_12.techs);
APUCSC_12.allTicket.add(ticket);
PrintWriter pw = new PrintWriter("ticket.txt");
for(int i=0;i<APUCSC_12.allTicket.size();i++)
{
pw.println(APUCSC_12.allTicket.get(i).getTicketNumber());
pw.println(APUCSC_12.allTicket.get(i).getCharge());
pw.println(APUCSC_12.allTicket.get(i).getCustomer().getName());
pw.println(APUCSC_12.allTicket.get(i).getId().getId());
pw.println(APUCSC_12.allTicket.get(i).getWorker().getUserId());
pw.println();
}
pw.flush();
pw.close();
}
catch(Exception e)
{
}
try
{
for(int i=0;i<APUCSC_12.allTechs.size();i++)
{
if(inTechId.equals(APUCSC_12.allTechs.get(i).getUserId()))
{
APUCSC_12.techs = APUCSC_12.allTechs.get(i);
break;
}
}
for(int i=0;i<APUCSC_12.allTicket.size();i++)
{
if(ticketNumber.equals(APUCSC_12.allTicket.get(i).getTicketNumber()))
{
APUCSC_12.ticket = APUCSC_12.allTicket.get(i);
break;
}
}
for(int i=0;i<APUCSC_12.allCustomer.size();i++)
{
if(name.equals(APUCSC_12.allCustomer.get(i).getName()))
{
APUCSC_12.customerName = APUCSC_12.allCustomer.get(i);
break;
}
}
for(int i=0;i<APUCSC_12.allCustomer.size();i++)
{
if(ID.equals(APUCSC_12.allCustomer.get(i).getId()))
{
APUCSC_12.customerID = APUCSC_12.allCustomer.get(i);
break;
}
}
HeavyDuty hd = new HeavyDuty(APUCSC_12.techs,day,startTime,finishTime,APUCSC_12.ticket,APUCSC_12.customerName,APUCSC_12.customerID);
APUCSC_12.allHeavyDuty.add(hd);
PrintWriter pw = new PrintWriter("heavy_duty.txt");
for(int i=0;i<APUCSC_12.allHeavyDuty.size();i++)
{
pw.println(APUCSC_12.allHeavyDuty.get(i).getWorker().getUserId());
pw.println(APUCSC_12.allHeavyDuty.get(i).getDay());
pw.println(APUCSC_12.allHeavyDuty.get(i).getBeginTime());
pw.println(APUCSC_12.allHeavyDuty.get(i).getEndTime());
pw.println(APUCSC_12.allHeavyDuty.get(i).getTicketNumber().getTicketNumber());
pw.println(APUCSC_12.allHeavyDuty.get(i).getCusName().getName());
pw.println(APUCSC_12.allHeavyDuty.get(i).getCusID().getId());
pw.println();
}
pw.flush();
pw.close();
}
catch(Exception e)
{
}
setVisible(false);
new GUI_4().setVisible(true);
}
}
}
else
JOptionPane.showMessageDialog(this,"Enter Customer Details First!!");
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GUI_50.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GUI_50.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GUI_50.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GUI_50.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GUI_50().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JList<String> jList1;
private javax.swing.JList<String> jList2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
}
| [
"jahirul.gerrard@gmail.com"
] | jahirul.gerrard@gmail.com |
9250808399274a1fa31730c442cf4d71fb28af84 | c8e8ff50765ef37cd0ddcced6bb3b822d5777602 | /src/main/java/com/example/xhh/listviewtest/FruitActivity.java | 2e2854deb6be1ae7d97b1ff72c5128564fe234ba | [] | no_license | xhh4215/ListViewTest | 781a3d7b62dc3871d70c3effb82f854f8473510d | 10f9abb155596930079808e4698b3c5d6295486e | refs/heads/master | 2021-08-18T21:58:21.600011 | 2017-11-24T02:30:18 | 2017-11-24T02:30:18 | 111,867,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | package com.example.xhh.listviewtest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
public class FruitActivity extends AppCompatActivity {
private List<Fruit> fruitList = new ArrayList<>();
private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fruit);
initFruit();
listView = (ListView) findViewById(R.id.listid);
MyArrayAdapter adapter = new MyArrayAdapter(FruitActivity.this, R.layout.item_layout, fruitList);
listView.setAdapter(adapter);
}
private void initFruit() {
for (int i = 0; i < 2; i++) {
Fruit apple = new Fruit("apple", "xiaohei like eat apple");
fruitList.add(apple);
Fruit Banana = new Fruit("Banana", "xiaohei like eat Banana");
fruitList.add(Banana);
Fruit Orange = new Fruit("Orange", "xiaohei like eat Orange");
fruitList.add(Orange);
Fruit Watermelon = new Fruit("Watermelon", "xiaohei like eat Watermelon");
fruitList.add(Watermelon);
Fruit Pear = new Fruit("Pear", "xiaohei like eat Pear");
fruitList.add(Pear);
}
}
}
| [
"18734184215@163.com"
] | 18734184215@163.com |
109a044254f18c53b605279c0de0187259d5c410 | bbae5fcad4f379ea2494577e7369b58dcdb95e57 | /project/app/src/main/java/com/example/project/model/Meal.java | ad22dfee9ca010da8f58dceb6f7405c8f9236ef8 | [] | no_license | ParhamMootab/W21G5_MyFitness | 7695936da4c3314b215a63e192cd89fc17232139 | 2410a5d08ac80c01960341fe303faf92ac0e503c | refs/heads/main | 2023-04-14T08:36:05.868809 | 2021-04-04T22:31:57 | 2021-04-04T22:31:57 | 346,093,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | package com.example.project.model;
public class Meal {
String name;
String recipe;
int image;
String recipeUrl;
public Meal(String name, String recipe, int image, String recipeUrl) {
this.name = name;
this.recipe = recipe;
this.image = image;
this.recipeUrl = recipeUrl;
}
public String getRecipeUrl() {
return recipeUrl;
}
public void setRecipeUrl(String recipeUrl) {
this.recipeUrl = recipeUrl;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRecipe() {
return recipe;
}
public void setRecipe(String recipe) {
this.recipe = recipe;
}
public int getImage() {
return image;
}
public void setImage(int image) {
this.image = image;
}
}
| [
"psm1379@gmail.com"
] | psm1379@gmail.com |
a5947c76af67a11627ebd1a59f0885aa8e2d9c67 | f1a96900fea0fe9f9b00d38cb21ea0bdbe21b207 | /Assignment-2/task-service/src/main/java/com/janitha/assignment2/taskservice/controller/TaskController.java | 5256f5b13bcd4b235fc9791840d4c0a7033019e1 | [] | no_license | JanithaSampathBandara/Krish_SE_Training | 7e92e927798afab4bed55a318375f12896a3f297 | f72fa06a38184ab83dd526b2c5f0b5d24e3f09c3 | refs/heads/master | 2023-05-12T11:35:10.555773 | 2021-06-05T09:24:22 | 2021-06-05T09:24:22 | 322,067,769 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,343 | java | package com.janitha.assignment2.taskservice.controller;
import com.janitha.assignment2.commons.model.Task;
import com.janitha.assignment2.taskservice.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeParseException;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping(value = "services/tasks")
public class TaskController {
@Autowired
TaskService taskService;
@PostMapping
public ResponseEntity createTask(@RequestBody Task task){
System.out.println("createTask");
Task newTask = taskService.createTask(task);
if(newTask != null){
return ResponseEntity.ok().body(newTask);
}
else{
return ResponseEntity.status(HttpStatus.OK).body("Task Creation Failed");
}
}
@GetMapping
public List<Task> getAllTasks(){
System.out.println("getAllTasks");
return taskService.getAllTasks();
}
@GetMapping(value = "/{taskId}")
public ResponseEntity getTaskById(@PathVariable int taskId){
System.out.println("getTaskById");
try{
Task task = taskService.getTaskById(taskId).get();
return ResponseEntity.ok().body(task);
} catch(NullPointerException nullPointerException){
return ResponseEntity.status(HttpStatus.OK).body("No Task For This Id : "+taskId+"");
}
}
@PutMapping(value = "/{taskId}")
public Task updateTask(@RequestBody Task task, @PathVariable int taskId){
System.out.println("updateTask");
return taskService.updateTask(task, taskId);
}
@DeleteMapping(value = "/{taskId}")
public String deleteTask(@PathVariable int taskId){
System.out.println("deleteTask");
return taskService.deleteTask(taskId);
}
@GetMapping("/{taskId}/status")
public ResponseEntity<String> getTaskStatus(@PathVariable int taskId){
try{
System.out.println("getTaskStatus");
String status = taskService.getTaskStatus(taskId);
if(status != null){
return ResponseEntity.ok(status);
}
else{
return ResponseEntity.status(HttpStatus.OK).body("No Task For This Id : "+taskId+"");
}
}catch(NullPointerException nullPointerException){
return ResponseEntity.status(HttpStatus.OK).body(nullPointerException.getMessage());
}
catch(Exception exception){
return ResponseEntity.status(HttpStatus.OK).body(exception.getMessage());
}
}
@GetMapping(value = "/")
public List<Task> getAllCriticalTasks(@RequestParam("severity") String severity){
System.out.println("getAllCriticalTasks");
return taskService.getAllCriticalTasks(severity);
}
@GetMapping(value = "/hello")
public ResponseEntity getTasksFilterByDate(@RequestParam("endDate") String date) {
try{
String retrievedDate = date;
LocalDate datee = LocalDate.parse(date);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date formattedDate = formatter.parse(retrievedDate);// have to handle null exception here
formatter.format(formattedDate);
System.out.println(formattedDate);
return ResponseEntity.ok().body(taskService.getTasksFilterByDate(datee));
}catch(ParseException parseException){
return ResponseEntity.status(HttpStatus.OK).body(parseException.getMessage());
}
catch(DateTimeParseException dateTimeParseException){
return ResponseEntity.status(HttpStatus.OK).body("Date Format Should Be : yyyy-mm-dd");
}
catch(NullPointerException nullPointerException){
return ResponseEntity.status(HttpStatus.OK).body(nullPointerException.getMessage());
}catch(Exception exception){
return ResponseEntity.status(HttpStatus.OK).body(exception.getMessage());
}
}
}
| [
"it15145994@my.sliit.lk"
] | it15145994@my.sliit.lk |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.