blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3f688360af609720a70d77f6e5507025c66dad8f
|
0b4ead484da51c5f76338f87b5013e262f8a0a97
|
/src/org/doubango/bangbangcall/Screens/ScreenIdentity.java
|
b920ddbb8a5336a8167ca500502e75ef217eb80d
|
[] |
no_license
|
holybomb/BangBangCall
|
9cd0d54bca982941f5c3c9c381279b3f30a78fdb
|
44d9f487a1883986067d03281f0b47b1bafb9982
|
refs/heads/master
| 2021-01-18T13:50:44.597709 | 2013-10-27T15:04:56 | 2013-10-27T15:04:56 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,620 |
java
|
/* Copyright (C) 2010-2011, Mamadou Diop.
* Copyright (C) 2011, Doubango Telecom.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango(dot)org>
*
* This file is part of imsdroid Project (http://code.google.com/p/imsdroid)
*
* imsdroid is free software: you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* imsdroid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.doubango.bangbangcall.Screens;
import org.doubango.bangbangcall.R;
import org.doubango.ngn.services.INgnConfigurationService;
import org.doubango.ngn.utils.NgnConfigurationEntry;
import org.doubango.ngn.utils.NgnStringUtils;
import android.os.Bundle;
import android.util.Log;
import android.widget.CheckBox;
import android.widget.EditText;
public class ScreenIdentity extends BaseScreen {
private final static String TAG = ScreenIdentity.class.getCanonicalName();
private final INgnConfigurationService mConfigurationService;
private EditText mEtDisplayName;
private EditText mEtIMPU;
private EditText mEtIMPI;
private EditText mEtPassword;
private EditText mEtRealm;
private CheckBox mCbEarlyIMS;
public ScreenIdentity() {
super(SCREEN_TYPE.IDENTITY_T, TAG);
mConfigurationService = getEngine().getConfigurationService();
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen_identity);
mEtDisplayName = (EditText)findViewById(R.id.screen_identity_editText_displayname);
mEtIMPU = (EditText)findViewById(R.id.screen_identity_editText_impu);
mEtIMPI = (EditText)findViewById(R.id.screen_identity_editText_impi);
mEtPassword = (EditText)findViewById(R.id.screen_identity_editText_password);
mEtRealm = (EditText)findViewById(R.id.screen_identity_editText_realm);
mCbEarlyIMS = (CheckBox)findViewById(R.id.screen_identity_checkBox_earlyIMS);
mEtDisplayName.setText(mConfigurationService.getString(NgnConfigurationEntry.IDENTITY_DISPLAY_NAME, NgnConfigurationEntry.DEFAULT_IDENTITY_DISPLAY_NAME));
mEtIMPU.setText(mConfigurationService.getString(NgnConfigurationEntry.IDENTITY_IMPU, NgnConfigurationEntry.DEFAULT_IDENTITY_IMPU));
mEtIMPI.setText(mConfigurationService.getString(NgnConfigurationEntry.IDENTITY_IMPI, NgnConfigurationEntry.DEFAULT_IDENTITY_IMPI));
mEtPassword.setText(mConfigurationService.getString(NgnConfigurationEntry.IDENTITY_PASSWORD, NgnStringUtils.emptyValue()));
mEtRealm.setText(mConfigurationService.getString(NgnConfigurationEntry.NETWORK_REALM, NgnConfigurationEntry.DEFAULT_NETWORK_REALM));
mCbEarlyIMS.setChecked(mConfigurationService.getBoolean(NgnConfigurationEntry.NETWORK_USE_EARLY_IMS, NgnConfigurationEntry.DEFAULT_NETWORK_USE_EARLY_IMS));
super.addConfigurationListener(mEtDisplayName);
super.addConfigurationListener(mEtIMPU);
super.addConfigurationListener(mEtIMPI);
super.addConfigurationListener(mEtPassword);
super.addConfigurationListener(mEtRealm);
super.addConfigurationListener(mCbEarlyIMS);
}
protected void onPause() {
if(super.mComputeConfiguration){
mConfigurationService.putString(NgnConfigurationEntry.IDENTITY_DISPLAY_NAME,
mEtDisplayName.getText().toString().trim());
mConfigurationService.putString(NgnConfigurationEntry.IDENTITY_IMPU,
mEtIMPU.getText().toString().trim());
mConfigurationService.putString(NgnConfigurationEntry.IDENTITY_IMPI,
mEtIMPI.getText().toString().trim());
mConfigurationService.putString(NgnConfigurationEntry.IDENTITY_PASSWORD,
mEtPassword.getText().toString().trim());
mConfigurationService.putString(NgnConfigurationEntry.NETWORK_REALM,
mEtRealm.getText().toString().trim());
mConfigurationService.putBoolean(NgnConfigurationEntry.NETWORK_USE_EARLY_IMS,
mCbEarlyIMS.isChecked());
// Compute
if(!mConfigurationService.commit()){
Log.e(TAG, "Failed to Commit() configuration");
}
super.mComputeConfiguration = false;
}
super.onPause();
}
}
|
[
"[email protected]"
] | |
5f8ef7841220cd67c9b71a37f0a4eb95703f9189
|
0e826c1e31c9fa172e90e21107e15c6f19156039
|
/day-2/src/day2/Exercise4_2.java
|
b770093fcfb7b04638ca4857d161669e2c11914e
|
[] |
no_license
|
Leaaaaaa/learn_java
|
0086b430e2cbd23636f4458f055721269fea4e1b
|
c9e11927ccea894872666f18d1fdeef7afa2a854
|
refs/heads/master
| 2020-07-17T18:50:54.326842 | 2019-10-09T14:19:48 | 2019-10-09T14:19:48 | 206,076,150 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 744 |
java
|
package day2;/* *
@author Lea
@date 2019/9/4
*/
import java.util.Random;
public class Exercise4_2 {
static Random random = new Random(47);
public static void main(String[] args) {
int a = random.nextInt();
int b = random.nextInt();
int i;
for ( i = 2; i < 26; i++) {
if (a > b)
System.out.println(a + " > " + b);
else if (a < b)
System.out.println(a + " < " + b);
else
System.out.println(a + " = " + b);
a = b;//把相邻随机数的值赋值给上一个,做到相邻的随机数比较
b = random.nextInt();
}
System.out.println("产生了" +(i-1) +"个随机数");
}
}
|
[
"[email protected]"
] | |
3c7b0f594b36b07e6fd58da366985935517e884f
|
972313410c33a1ed3154ab28bb25a5700aff528d
|
/mall-common/src/main/java/com/owwang/mall/pojo/Sftp.java
|
140140aea0fc3f288e27c1de6bde8464a76a1454
|
[] |
no_license
|
isamuelwang/amazingshop
|
1adcc5ef652f17c33add1da70d98fb28fb160c73
|
f74e3f46e7d4d60f37e6afe8393430c58b207686
|
refs/heads/master
| 2022-12-17T05:57:23.282230 | 2020-01-11T01:42:00 | 2020-01-11T01:42:00 | 227,566,169 | 2 | 1 | null | 2022-12-16T07:16:05 | 2019-12-12T09:16:20 |
JavaScript
|
UTF-8
|
Java
| false | false | 18,425 |
java
|
package com.owwang.mall.pojo;
import java.io.File;
import java.io.InputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Vector;
import org.apache.log4j.Logger;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpException;
import com.jcraft.jsch.ChannelSftp.LsEntry;
/**
* SFTP(Secure File Transfer Protocol),安全文件传送协议。
* @version 1.0 2014/12/18
* @author dongliyang
*/
public class Sftp implements Serializable {
/** 日志记录器 */
private Logger logger = Logger.getLogger(Sftp.class);
/** Session */
private Session session = null;
/** Channel */
private ChannelSftp channel = null;
/** SFTP服务器IP地址 */
private String host;
/** SFTP服务器端口 */
private int port;
/** 连接超时时间,单位毫秒 */
private int timeout;
/** 用户名 */
private String username;
/** 密码 */
private String password;
/**
* SFTP 安全文件传送协议
* @param host SFTP服务器IP地址
* @param port SFTP服务器端口
* @param timeout 连接超时时间,单位毫秒
* @param username 用户名
* @param password 密码
*/
public Sftp(String host,int port,int timeout,String username,String password){
this.host = host;
this.port = port;
this.timeout = timeout;
this.username = username;
this.password = password;
}
/**
* 登陆SFTP服务器
* @return boolean
*/
public boolean login() {
try {
JSch jsch = new JSch();
session = jsch.getSession(username, host, port);
if(password != null){
session.setPassword(password);
}
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.setTimeout(timeout);
session.connect();
logger.debug("sftp session connected");
logger.debug("opening channel");
channel = (ChannelSftp)session.openChannel("sftp");
channel.connect();
logger.debug("connected successfully");
return true;
} catch (JSchException e) {
logger.error("sftp login failed",e);
return false;
}
}
/**
* 上传文件
* <p>
* 使用示例,SFTP服务器上的目录结构如下:/testA/testA_B/
* <table border="1">
* <tr><td>当前目录</td><td>方法</td><td>参数:绝对路径/相对路径</td><td>上传后</td></tr>
* <tr><td>/</td><td>uploadFile("testA","upload.txt",new FileInputStream(new File("up.txt")))</td><td>相对路径</td><td>/testA/upload.txt</td></tr>
* <tr><td>/</td><td>uploadFile("testA/testA_B","upload.txt",new FileInputStream(new File("up.txt")))</td><td>相对路径</td><td>/testA/testA_B/upload.txt</td></tr>
* <tr><td>/</td><td>uploadFile("/testA/testA_B","upload.txt",new FileInputStream(new File("up.txt")))</td><td>绝对路径</td><td>/testA/testA_B/upload.txt</td></tr>
* </table>
* </p>
* @param pathName SFTP服务器目录
* @param fileName 服务器上保存的文件名
* @param input 输入文件流
* @return boolean
*/
public boolean uploadFile(String pathName,String fileName,InputStream input){
String currentDir = currentDir();
if(!changeDir(pathName)){
return false;
}
try {
channel.put(input,fileName,ChannelSftp.OVERWRITE);
if(!existFile(fileName)){
logger.debug("upload failed");
return false;
}
logger.debug("upload successful");
return true;
} catch (SftpException e) {
e.printStackTrace();
logger.error("upload failed",e);
return false;
} finally {
changeDir(currentDir);
}
}
/**
* 上传文件
* <p>
* 使用示例,SFTP服务器上的目录结构如下:/testA/testA_B/
* <table border="1">
* <tr><td>当前目录</td><td>方法</td><td>参数:绝对路径/相对路径</td><td>上传后</td></tr>
* <tr><td>/</td><td>uploadFile("testA","upload.txt","up.txt")</td><td>相对路径</td><td>/testA/upload.txt</td></tr>
* <tr><td>/</td><td>uploadFile("testA/testA_B","upload.txt","up.txt")</td><td>相对路径</td><td>/testA/testA_B/upload.txt</td></tr>
* <tr><td>/</td><td>uploadFile("/testA/testA_B","upload.txt","up.txt")</td><td>绝对路径</td><td>/testA/testA_B/upload.txt</td></tr>
* </table>
* </p>
* @param pathName SFTP服务器目录
* @param fileName 服务器上保存的文件名
* @param localFile 本地文件
* @return boolean
*/
public boolean uploadFile(String pathName,String fileName,String localFile){
String currentDir = currentDir();
if(!changeDir(pathName)){
return false;
}
try {
channel.put(localFile,fileName,ChannelSftp.OVERWRITE);
if(!existFile(fileName)){
logger.debug("upload failed");
return false;
}
logger.debug("upload successful");
return true;
} catch (SftpException e) {
logger.error("upload failed",e);
return false;
} finally {
changeDir(currentDir);
}
}
/**
* 下载文件
* <p>
* 使用示例,SFTP服务器上的目录结构如下:/testA/testA_B/
* <table border="1">
* <tr><td>当前目录</td><td>方法</td><td>参数:绝对路径/相对路径</td><td>下载后</td></tr>
* <tr><td>/</td><td>downloadFile("testA","down.txt","D:\\downDir")</td><td>相对路径</td><td>D:\\downDir\\down.txt</td></tr>
* <tr><td>/</td><td>downloadFile("testA/testA_B","down.txt","D:\\downDir")</td><td>相对路径</td><td>D:\\downDir\\down.txt</td></tr>
* <tr><td>/</td><td>downloadFile("/testA/testA_B","down.txt","D:\\downDir")</td><td>绝对路径</td><td>D:\\downDir\\down.txt</td></tr>
* </table>
* </p>
* @param remotePath SFTP服务器目录
* @param fileName 服务器上需要下载的文件名
* @param localPath 本地保存路径
* @return boolean
*/
public boolean downloadFile(String remotePath,String fileName,String localPath){
String currentDir = currentDir();
if(!changeDir(remotePath)){
return false;
}
try {
String localFilePath = localPath + File.separator + fileName;
channel.get(fileName,localFilePath);
File localFile = new File(localFilePath);
if(!localFile.exists()){
logger.debug("download file failed");
return false;
}
logger.debug("download successful");
return true;
} catch (SftpException e) {
logger.error("download file failed",e);
return false;
} finally {
changeDir(currentDir);
}
}
/**
* 切换工作目录
* <p>
* 使用示例,SFTP服务器上的目录结构如下:/testA/testA_B/
* <table border="1">
* <tr><td>当前目录</td><td>方法</td><td>参数(绝对路径/相对路径)</td><td>切换后的目录</td></tr>
* <tr><td>/</td><td>changeDir("testA")</td><td>相对路径</td><td>/testA/</td></tr>
* <tr><td>/</td><td>changeDir("testA/testA_B")</td><td>相对路径</td><td>/testA/testA_B/</td></tr>
* <tr><td>/</td><td>changeDir("/testA")</td><td>绝对路径</td><td>/testA/</td></tr>
* <tr><td>/testA/testA_B/</td><td>changeDir("/testA")</td><td>绝对路径</td><td>/testA/</td></tr>
* </table>
* </p>
* @param pathName 路径
* @return boolean
*/
public boolean changeDir(String pathName){
if(pathName == null || pathName.trim().equals("")){
logger.debug("invalid pathName");
return false;
}
try {
channel.cd(pathName.replaceAll("\\\\", "/"));
logger.debug("directory successfully changed,current dir=" + channel.pwd());
return true;
} catch (SftpException e) {
logger.error("failed to change directory",e);
return false;
}
}
/**
* 切换到上一级目录
* <p>
* 使用示例,SFTP服务器上的目录结构如下:/testA/testA_B/
* <table border="1">
* <tr><td>当前目录</td><td>方法</td><td>切换后的目录</td></tr>
* <tr><td>/testA/</td><td>changeToParentDir()</td><td>/</td></tr>
* <tr><td>/testA/testA_B/</td><td>changeToParentDir()</td><td>/testA/</td></tr>
* </table>
* </p>
* @return boolean
*/
public boolean changeToParentDir(){
return changeDir("..");
}
/**
* 切换到根目录
* @return boolean
*/
public boolean changeToHomeDir(){
String homeDir = null;
try {
homeDir = channel.getHome();
} catch (SftpException e) {
logger.error("can not get home directory",e);
return false;
}
return changeDir(homeDir);
}
/**
* 创建目录
* <p>
* 使用示例,SFTP服务器上的目录结构如下:/testA/testA_B/
* <table border="1">
* <tr><td>当前目录</td><td>方法</td><td>参数(绝对路径/相对路径)</td><td>创建成功后的目录</td></tr>
* <tr><td>/testA/testA_B/</td><td>makeDir("testA_B_C")</td><td>相对路径</td><td>/testA/testA_B/testA_B_C/</td></tr>
* <tr><td>/</td><td>makeDir("/testA/testA_B/testA_B_D")</td><td>绝对路径</td><td>/testA/testA_B/testA_B_D/</td></tr>
* </table>
* <br/>
* <b>注意</b>,当<b>中间目录不存在</b>的情况下,不能够使用绝对路径的方式期望创建中间目录及目标目录。
* 例如makeDir("/testNOEXIST1/testNOEXIST2/testNOEXIST3"),这是错误的。
* </p>
* @param dirName 目录
* @return boolean
*/
public boolean makeDir(String dirName){
try {
channel.mkdir(dirName);
logger.debug("directory successfully created,dir=" + dirName);
return true;
} catch (SftpException e) {
logger.error("failed to create directory", e);
return false;
}
}
/**
* 删除文件夹
* @param dirName
* @return boolean
*/
@SuppressWarnings("unchecked")
public boolean delDir(String dirName){
if(!changeDir(dirName)){
return false;
}
Vector<LsEntry> list = null;
try {
list = channel.ls(channel.pwd());
} catch (SftpException e) {
logger.error("can not list directory",e);
return false;
}
for(LsEntry entry : list){
String fileName = entry.getFilename();
if(!fileName.equals(".") && !fileName.equals("..")){
if(entry.getAttrs().isDir()){
delDir(fileName);
} else {
delFile(fileName);
}
}
}
if(!changeToParentDir()){
return false;
}
try {
channel.rmdir(dirName);
logger.debug("directory " + dirName + " successfully deleted");
return true;
} catch (SftpException e) {
logger.error("failed to delete directory " + dirName,e);
return false;
}
}
/**
* 删除文件
* @param fileName 文件名
* @return boolean
*/
public boolean delFile(String fileName){
if(fileName == null || fileName.trim().equals("")){
logger.debug("invalid filename");
return false;
}
try {
channel.rm(fileName);
logger.debug("file " + fileName + " successfully deleted");
return true;
} catch (SftpException e) {
logger.error("failed to delete file " + fileName,e);
return false;
}
}
/**
* 当前目录下文件及文件夹名称列表
* @return String[]
*/
public String[] ls(){
return list(Filter.ALL);
}
/**
* 指定目录下文件及文件夹名称列表
* @return String[]
*/
public String[] ls(String pathName){
String currentDir = currentDir();
if(!changeDir(pathName)){
return new String[0];
};
String[] result = list(Filter.ALL);
if(!changeDir(currentDir)){
return new String[0];
}
return result;
}
/**
* 当前目录下文件名称列表
* @return String[]
*/
public String[] lsFiles(){
return list(Filter.FILE);
}
/**
* 指定目录下文件名称列表
* @return String[]
*/
public String[] lsFiles(String pathName){
String currentDir = currentDir();
if(!changeDir(pathName)){
return new String[0];
};
String[] result = list(Filter.FILE);
if(!changeDir(currentDir)){
return new String[0];
}
return result;
}
/**
* 当前目录下文件夹名称列表
* @return String[]
*/
public String[] lsDirs(){
return list(Filter.DIR);
}
/**
* 指定目录下文件夹名称列表
* @return String[]
*/
public String[] lsDirs(String pathName){
String currentDir = currentDir();
if(!changeDir(pathName)){
return new String[0];
};
String[] result = list(Filter.DIR);
if(!changeDir(currentDir)){
return new String[0];
}
return result;
}
/**
* 当前目录是否存在文件或文件夹
* @param name 名称
* @return boolean
*/
public boolean exist(String name){
return exist(ls(), name);
}
/**
* 指定目录下,是否存在文件或文件夹
* @param path 目录
* @param name 名称
* @return boolean
*/
public boolean exist(String path,String name){
return exist(ls(path),name);
}
/**
* 当前目录是否存在文件
* @param name 文件名
* @return boolean
*/
public boolean existFile(String name){
return exist(lsFiles(),name);
}
/**
* 指定目录下,是否存在文件
* @param path 目录
* @param name 文件名
* @return boolean
*/
public boolean existFile(String path,String name){
return exist(lsFiles(path), name);
}
/**
* 当前目录是否存在文件夹
* @param name 文件夹名称
* @return boolean
*/
public boolean existDir(String name){
return exist(lsDirs(), name);
}
/**
* 指定目录下,是否存在文件夹
* @param path 目录
* @param name 文家夹名称
* @return boolean
*/
public boolean existDir(String path,String name){
return exist(lsDirs(path), name);
}
/**
* 当前工作目录
* @return String
*/
public String currentDir(){
try {
return channel.pwd();
} catch (SftpException e) {
logger.error("failed to get current dir",e);
return homeDir();
}
}
/**
* 登出
*/
public void logout(){
if(channel != null){
channel.quit();
channel.disconnect();
}
if(session != null){
session.disconnect();
}
logger.debug("logout successfully");
}
//------private method ------
/** 枚举,用于过滤文件和文件夹 */
private enum Filter {/** 文件及文件夹 */ ALL ,/** 文件 */ FILE ,/** 文件夹 */ DIR };
/**
* 列出当前目录下的文件及文件夹
* @param filter 过滤参数
* @return String[]
*/
@SuppressWarnings("unchecked")
private String[] list(Filter filter){
Vector<LsEntry> list = null;
try {
//ls方法会返回两个特殊的目录,当前目录(.)和父目录(..)
list = channel.ls(channel.pwd());
} catch (SftpException e) {
logger.error("can not list directory",e);
return new String[0];
}
List<String> resultList = new ArrayList<String>();
for(LsEntry entry : list){
if(filter(entry, filter)){
resultList.add(entry.getFilename());
}
}
return resultList.toArray(new String[0]);
}
/**
* 判断是否是否过滤条件
* @param entry LsEntry
* @param f 过滤参数
* @return boolean
*/
private boolean filter(LsEntry entry,Filter f){
if(f.equals(Filter.ALL)){
return !entry.getFilename().equals(".") && !entry.getFilename().equals("..");
} else if(f.equals(Filter.FILE)){
return !entry.getFilename().equals(".") && !entry.getFilename().equals("..") && !entry.getAttrs().isDir();
} else if(f.equals(Filter.DIR)){
return !entry.getFilename().equals(".") && !entry.getFilename().equals("..") && entry.getAttrs().isDir();
}
return false;
}
/**
* 根目录
* @return String
*/
private String homeDir(){
try {
return channel.getHome();
} catch (SftpException e) {
return "/";
}
}
/**
* 判断字符串是否存在于数组中
* @param strArr 字符串数组
* @param str 字符串
* @return boolean
*/
private boolean exist(String[] strArr,String str){
if(strArr == null || strArr.length == 0){
return false;
}
if(str == null || str.trim().equals("")){
return false;
}
for(String s : strArr){
if(s.equalsIgnoreCase(str)){
return true;
}
}
return false;
}
//------private method ------
}
|
[
"[email protected]"
] | |
9791cfba69751bbfbdded2a6d23d185cd5835537
|
6038b36200f16786421c2748d2917577f554c9c8
|
/Strings/src/maccess/DString7.java
|
cecbec953658d6ede0a8c19598dad0bf125e2945
|
[] |
no_license
|
furquan5/Java-Assignments-Topic-Wise-JALA-TECHNOLOGIES-
|
0ecc4135e3f1282bd52ff8742b6a01801fbcfcaa
|
06e33d001743688ae50e69bc53b44e605bbf0c31
|
refs/heads/master
| 2023-08-11T18:45:42.880305 | 2021-09-11T13:54:34 | 2021-09-11T13:54:34 | 381,376,316 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 264 |
java
|
package maccess;
public class DString7 {
public static void main(String[] args) {
// Comparing strings using the methods equals()
String s1=new String("Jala");
String s2=new String("Jala");
System.out.println(s1.equals(s2));
}
}
|
[
"[email protected]"
] | |
4bfcf69863d0dd265ff407f503959bd98a191233
|
59fad3b663816df86f7759dd58c27d927a980690
|
/src/test/java/com/baomidou/mybatisplus/test/oracle/TestSequserMapperTest.java
|
0d2d93d76688c2b4a47e73b1594de13a5fe6deaf
|
[
"MIT"
] |
permissive
|
Caratacus/mybatis-plus-mini
|
c1d4e428ba6ef0d368ef9944c508cc1182e40ecf
|
4fb4535c20245ebe626b7a97da1b325f90299193
|
refs/heads/master
| 2021-01-21T18:00:01.855137 | 2017-06-12T12:59:40 | 2017-06-12T12:59:40 | 92,007,116 | 3 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,329 |
java
|
package com.baomidou.mybatisplus.test.oracle;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import com.baomidou.mybatisplus.MybatisSessionFactoryBuilder;
import com.baomidou.mybatisplus.entity.GlobalConfiguration;
import com.baomidou.mybatisplus.test.oracle.entity.TestSequser;
/**
* <p>
* oracle sequence 测试类
* </p>
*
* @author zashitou
* @Date 2017-04-20
*/
public class TestSequserMapperTest {
/**
* Test Oracle Sequence
*/
public static void main(String[] args) {
//加载配置文件
InputStream in = TestSequserMapperTest.class.getClassLoader().getResourceAsStream("oracle-config.xml");
MybatisSessionFactoryBuilder mf = new MybatisSessionFactoryBuilder();
/** 设置数据库类型为 oracle */
GlobalConfiguration gc = new GlobalConfiguration();
gc.setDbType("oracle");
gc.setDbColumnUnderline(true);
mf.setGlobalConfig(gc);
SqlSessionFactory sessionFactory = mf.build(in);
SqlSession session = sessionFactory.openSession();
TestSequserMapper testSequserMapper = session.getMapper(TestSequserMapper.class);
/**
* 插入
*/
TestSequser one = new TestSequser("abc", 18, 1);
int rlt = testSequserMapper.insert(one);
System.err.println("\n one.id-------:" + one.getId());
sleep();
/**
* 批量插入
*/
List<TestSequser> ul = new ArrayList<>();
ul.add(new TestSequser("abc2", 18, 2));
ul.add(new TestSequser("abc3", 18, 3));
ul.add(new TestSequser("abc4", 18, 4));
ul.add(new TestSequser("abc5", 18, 5));
ul.add(new TestSequser("abc6", 18, 6));
for (TestSequser u : ul) {
rlt = testSequserMapper.insert(u);
}
for (TestSequser u : ul) {
System.err.println("\n one.id-------:" + u.getId());
}
/**
* 提交
*/
session.commit();
}
/*
* 慢点打印
*/
private static void sleep() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
007a0ddea93629ac9fa3309138d75bfd65da2e0a
|
76e2bc67c238295e7ec9b28610d2d4001f87f885
|
/app/src/main/java/sollian/com/soroundimageview/Util.java
|
cb8cf65b7c7aba275457918ff601a55ca22b7ca2
|
[] |
no_license
|
sollian/SoRoundImageView
|
4a05c85115e3e784d1ab2be02e5d1dec68ecd741
|
07841ecd32a89f916a0bbfda6838b027e32eddaf
|
refs/heads/master
| 2021-01-11T18:26:24.912776 | 2017-01-20T10:48:14 | 2017-01-20T10:48:14 | 79,545,140 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,094 |
java
|
package sollian.com.soroundimageview;
import android.content.Context;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import java.lang.reflect.Field;
/**
* @author sollian on 2017/1/20.
*/
public class Util {
public static int dip2px(Context context, float dpValue) {
float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
@Nullable
public static Object getFieldSafe(Class<?> clazz, String fieldName, Object target) {
try {
return getField(clazz, target, fieldName);
} catch (Exception ignored) {
}
return null;
}
public static Object getField(Class<?> clazz, Object target, String fieldName)
throws NoSuchFieldException, IllegalAccessException {
if (TextUtils.isEmpty(fieldName)) {
return null;
}
Field field = clazz.getDeclaredField(fieldName);
if (!field.isAccessible()) {
field.setAccessible(true);
}
return field.get(target);
}
}
|
[
"[email protected]"
] | |
490a1680934733a60f7e20add7d9e820e59c5b0e
|
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
|
/eclipsejdt_cluster/10634/src_0.java
|
1e4b026fe9146aacff7f7385bb410ad112f54ed0
|
[] |
no_license
|
martinezmatias/GenPat-data-C3
|
63cfe27efee2946831139747e6c20cf952f1d6f6
|
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
|
refs/heads/master
| 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,677 |
java
|
/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.core.search.matching;
import java.io.IOException;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.core.index.*;
import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants;
public class TypeDeclarationPattern extends JavaSearchPattern implements IIndexConstants {
public char[] simpleName;
public char[] pkg;
public char[][] enclosingTypeNames;
// set to CLASS_SUFFIX for only matching classes
// set to INTERFACE_SUFFIX for only matching interfaces
// set to ENUM_SUFFIX for only matching enums
// set to ANNOTATION_TYPE_SUFFIX for only matching annotation types
// set to TYPE_SUFFIX for matching both classes and interfaces
public char typeSuffix;
public int modifiers;
public boolean secondary = false;
protected static char[][] CATEGORIES = { TYPE_DECL };
// want to save space by interning the package names for each match
static PackageNameSet internedPackageNames = new PackageNameSet(1001);
static class PackageNameSet {
public char[][] names;
public int elementSize; // number of elements in the table
public int threshold;
PackageNameSet(int size) {
this.elementSize = 0;
this.threshold = size; // size represents the expected number of elements
int extraRoom = (int) (size * 1.5f);
if (this.threshold == extraRoom)
extraRoom++;
this.names = new char[extraRoom][];
}
char[] add(char[] name) {
int length = names.length;
int index = CharOperation.hashCode(name) % length;
char[] current;
while ((current = names[index]) != null) {
if (CharOperation.equals(current, name)) return current;
if (++index == length) index = 0;
}
names[index] = name;
// assumes the threshold is never equal to the size of the table
if (++elementSize > threshold) rehash();
return name;
}
void rehash() {
PackageNameSet newSet = new PackageNameSet(elementSize * 2); // double the number of expected elements
char[] current;
for (int i = names.length; --i >= 0;)
if ((current = names[i]) != null)
newSet.add(current);
this.names = newSet.names;
this.elementSize = newSet.elementSize;
this.threshold = newSet.threshold;
}
}
/*
* Create index key for type declaration pattern:
* key = typeName / packageName / enclosingTypeName / modifiers
* or for secondary types
* key = typeName / packageName / enclosingTypeName / modifiers / 'S'
*/
public static char[] createIndexKey(int modifiers, char[] typeName, char[] packageName, char[][] enclosingTypeNames, boolean secondary) { //, char typeSuffix) {
int typeNameLength = typeName == null ? 0 : typeName.length;
int packageLength = packageName == null ? 0 : packageName.length;
int enclosingNamesLength = 0;
if (enclosingTypeNames != null) {
for (int i = 0, length = enclosingTypeNames.length; i < length;) {
enclosingNamesLength += enclosingTypeNames[i].length;
if (++i < length)
enclosingNamesLength++; // for the '.' separator
}
}
int resultLength = typeNameLength + packageLength + enclosingNamesLength + 4;
if (secondary) resultLength += 2;
char[] result = new char[resultLength];
int pos = 0;
if (typeNameLength > 0) {
System.arraycopy(typeName, 0, result, pos, typeNameLength);
pos += typeNameLength;
}
result[pos++] = SEPARATOR;
if (packageLength > 0) {
System.arraycopy(packageName, 0, result, pos, packageLength);
pos += packageLength;
}
result[pos++] = SEPARATOR;
if (enclosingTypeNames != null && enclosingNamesLength > 0) {
for (int i = 0, length = enclosingTypeNames.length; i < length;) {
char[] enclosingName = enclosingTypeNames[i];
int itsLength = enclosingName.length;
System.arraycopy(enclosingName, 0, result, pos, itsLength);
pos += itsLength;
if (++i < length)
result[pos++] = '.';
}
}
result[pos++] = SEPARATOR;
result[pos] = (char) modifiers;
if (secondary) {
result[++pos] = SEPARATOR;
result[++pos] = 'S';
}
return result;
}
public TypeDeclarationPattern(
char[] pkg,
char[][] enclosingTypeNames,
char[] simpleName,
char typeSuffix,
int matchRule) {
this(matchRule);
this.pkg = isCaseSensitive() ? pkg : CharOperation.toLowerCase(pkg);
if (isCaseSensitive() || enclosingTypeNames == null) {
this.enclosingTypeNames = enclosingTypeNames;
} else {
int length = enclosingTypeNames.length;
this.enclosingTypeNames = new char[length][];
for (int i = 0; i < length; i++)
this.enclosingTypeNames[i] = CharOperation.toLowerCase(enclosingTypeNames[i]);
}
this.simpleName = (isCaseSensitive() || isCamelCase()) ? simpleName : CharOperation.toLowerCase(simpleName);
this.typeSuffix = typeSuffix;
((InternalSearchPattern)this).mustResolve = (this.pkg != null && this.enclosingTypeNames != null) || typeSuffix != TYPE_SUFFIX;
}
TypeDeclarationPattern(int matchRule) {
super(TYPE_DECL_PATTERN, matchRule);
}
/*
* Type entries are encoded as simpleTypeName / packageName / enclosingTypeName / modifiers
* e.g. Object/java.lang//0
* e.g. Cloneable/java.lang//512
* e.g. LazyValue/javax.swing/UIDefaults/0
*/
public void decodeIndexKey(char[] key) {
int slash = CharOperation.indexOf(SEPARATOR, key, 0);
this.simpleName = CharOperation.subarray(key, 0, slash);
int start = slash + 1;
slash = CharOperation.indexOf(SEPARATOR, key, start);
this.pkg = slash == start ? CharOperation.NO_CHAR : internedPackageNames.add(CharOperation.subarray(key, start, slash));
slash = CharOperation.indexOf(SEPARATOR, key, start = slash + 1);
if (slash == start) {
this.enclosingTypeNames = CharOperation.NO_CHAR_CHAR;
} else {
char[] names = CharOperation.subarray(key, start, slash);
this.enclosingTypeNames = CharOperation.equals(ONE_ZERO, names) ? ONE_ZERO_CHAR : CharOperation.splitOn('.', names);
}
slash = CharOperation.indexOf(SEPARATOR, key, start = slash + 1);
this.secondary = slash > 0;
int last = this.secondary ? slash : key.length;
decodeModifiers(key[last-1]);
}
protected void decodeModifiers(char value) {
this.modifiers = value; // implicit cast to int type
// Extract suffix from modifiers instead of index key
switch (this.modifiers & (ClassFileConstants.AccInterface|ClassFileConstants.AccEnum|ClassFileConstants.AccAnnotation)) {
case ClassFileConstants.AccAnnotation:
case ClassFileConstants.AccAnnotation+ClassFileConstants.AccInterface:
this.typeSuffix = ANNOTATION_TYPE_SUFFIX;
break;
case ClassFileConstants.AccEnum:
this.typeSuffix = ENUM_SUFFIX;
break;
case ClassFileConstants.AccInterface:
this.typeSuffix = INTERFACE_SUFFIX;
break;
default:
this.typeSuffix = CLASS_SUFFIX;
break;
}
}
public SearchPattern getBlankPattern() {
return new TypeDeclarationPattern(R_EXACT_MATCH | R_CASE_SENSITIVE);
}
public char[][] getIndexCategories() {
return CATEGORIES;
}
public boolean matchesDecodedKey(SearchPattern decodedPattern) {
TypeDeclarationPattern pattern = (TypeDeclarationPattern) decodedPattern;
switch(this.typeSuffix) {
case CLASS_SUFFIX :
switch (pattern.typeSuffix) {
case CLASS_SUFFIX :
case CLASS_AND_INTERFACE_SUFFIX :
case CLASS_AND_ENUM_SUFFIX :
break;
default:
return false;
}
break;
case INTERFACE_SUFFIX :
switch (pattern.typeSuffix) {
case INTERFACE_SUFFIX :
case CLASS_AND_INTERFACE_SUFFIX :
break;
default:
return false;
}
break;
case ENUM_SUFFIX :
switch (pattern.typeSuffix) {
case ENUM_SUFFIX :
case CLASS_AND_ENUM_SUFFIX :
break;
default:
return false;
}
break;
case ANNOTATION_TYPE_SUFFIX :
if (this.typeSuffix != pattern.typeSuffix) return false;
break;
case CLASS_AND_INTERFACE_SUFFIX :
switch (pattern.typeSuffix) {
case CLASS_SUFFIX :
case INTERFACE_SUFFIX :
case CLASS_AND_INTERFACE_SUFFIX :
break;
default:
return false;
}
break;
case CLASS_AND_ENUM_SUFFIX :
switch (pattern.typeSuffix) {
case CLASS_SUFFIX :
case ENUM_SUFFIX :
case CLASS_AND_ENUM_SUFFIX :
break;
default:
return false;
}
break;
}
if (!matchesName(this.simpleName, pattern.simpleName))
return false;
// check package - exact match only
if (this.pkg != null && !CharOperation.equals(this.pkg, pattern.pkg, isCaseSensitive()))
return false;
// check enclosingTypeNames - exact match only
if (this.enclosingTypeNames != null) {
if (this.enclosingTypeNames.length == 0)
return pattern.enclosingTypeNames.length == 0;
if (this.enclosingTypeNames.length == 1 && pattern.enclosingTypeNames.length == 1)
return CharOperation.equals(this.enclosingTypeNames[0], pattern.enclosingTypeNames[0], isCaseSensitive());
if (pattern.enclosingTypeNames == ONE_ZERO_CHAR)
return true; // is a local or anonymous type
return CharOperation.equals(this.enclosingTypeNames, pattern.enclosingTypeNames, isCaseSensitive());
}
return true;
}
EntryResult[] queryIn(Index index) throws IOException {
char[] key = this.simpleName; // can be null
int matchRule = getMatchRule();
switch(getMatchMode()) {
case R_PREFIX_MATCH :
// do a prefix query with the simpleName
break;
case R_EXACT_MATCH :
if (this.isCamelCase) break;
matchRule &= ~R_EXACT_MATCH;
if (this.simpleName != null) {
matchRule |= R_PREFIX_MATCH;
key = this.pkg == null
? CharOperation.append(this.simpleName, SEPARATOR)
: CharOperation.concat(this.simpleName, SEPARATOR, this.pkg, SEPARATOR, CharOperation.NO_CHAR);
break; // do a prefix query with the simpleName and possibly the pkg
}
matchRule |= R_PATTERN_MATCH;
// fall thru to encode the key and do a pattern query
case R_PATTERN_MATCH :
if (this.pkg == null) {
if (this.simpleName == null) {
switch(this.typeSuffix) {
case CLASS_SUFFIX :
case INTERFACE_SUFFIX :
case ENUM_SUFFIX :
case ANNOTATION_TYPE_SUFFIX :
case CLASS_AND_INTERFACE_SUFFIX :
case CLASS_AND_ENUM_SUFFIX :
// null key already returns all types
// key = new char[] {ONE_STAR[0], SEPARATOR, ONE_STAR[0]};
break;
}
} else if (this.simpleName[this.simpleName.length - 1] != '*') {
key = CharOperation.concat(this.simpleName, ONE_STAR, SEPARATOR);
}
break; // do a pattern query with the current encoded key
}
// must decode to check enclosingTypeNames due to the encoding of local types
key = CharOperation.concat(
this.simpleName == null ? ONE_STAR : this.simpleName, SEPARATOR, this.pkg, SEPARATOR, ONE_STAR);
break;
case R_REGEXP_MATCH :
// TODO (frederic) implement regular expression match
break;
}
return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
}
protected StringBuffer print(StringBuffer output) {
switch (this.typeSuffix){
case CLASS_SUFFIX :
output.append("ClassDeclarationPattern: pkg<"); //$NON-NLS-1$
break;
case CLASS_AND_INTERFACE_SUFFIX:
output.append("ClassAndInterfaceDeclarationPattern: pkg<"); //$NON-NLS-1$
break;
case CLASS_AND_ENUM_SUFFIX :
output.append("ClassAndEnumDeclarationPattern: pkg<"); //$NON-NLS-1$
break;
case INTERFACE_SUFFIX :
output.append("InterfaceDeclarationPattern: pkg<"); //$NON-NLS-1$
break;
case ENUM_SUFFIX :
output.append("EnumDeclarationPattern: pkg<"); //$NON-NLS-1$
break;
case ANNOTATION_TYPE_SUFFIX :
output.append("AnnotationTypeDeclarationPattern: pkg<"); //$NON-NLS-1$
break;
default :
output.append("TypeDeclarationPattern: pkg<"); //$NON-NLS-1$
break;
}
if (pkg != null)
output.append(pkg);
else
output.append("*"); //$NON-NLS-1$
output.append(">, enclosing<"); //$NON-NLS-1$
if (enclosingTypeNames != null) {
for (int i = 0; i < enclosingTypeNames.length; i++){
output.append(enclosingTypeNames[i]);
if (i < enclosingTypeNames.length - 1)
output.append('.');
}
} else {
output.append("*"); //$NON-NLS-1$
}
output.append(">, type<"); //$NON-NLS-1$
if (simpleName != null)
output.append(simpleName);
else
output.append("*"); //$NON-NLS-1$
output.append(">"); //$NON-NLS-1$
return super.print(output);
}
}
|
[
"[email protected]"
] | |
11cf8bc1d7f94e9dcdc4f51de159b127fc601899
|
1ec43f11ace3ebce522ff07570e155c236186a50
|
/DataStructure/SingleLinkedList/src/com/lyx/list/Linked.java
|
9c544612ce1e97247de233d8088ce3b88c562d24
|
[] |
no_license
|
TheHurtLocker9/Java
|
05341ddbf27fe686e0f23b469ba6152d18b95e1f
|
e3cdb83c755beda20d4458a8e9cf4a3e6a749648
|
refs/heads/main
| 2023-03-15T05:33:01.900425 | 2021-02-26T05:56:25 | 2021-02-26T05:57:20 | 336,003,512 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,377 |
java
|
package com.lyx.list;
/*
单链表:头指针为空白节点,依靠指针单项链接。(注意判断指针范围)
实现功能:
1.链表尾部增加新节点(增)
2.在指定位置插入新节点(增)
3.删除指定位置的节点(删)
4.删除指定数据的节点(删)
5.修改指定位置的节点(改)
6.查找指定位置的节点数据(查)
7.打印链表
8.链表倒置
*/
public class Linked {
private int size;
private Node head;
/**
* 初始化链表
*/
public Linked() {
size = 0;
head = new Node();
}
/**
* 1.链表尾部增加新节点(增)
*
* @param node 新节点
*/
public void add(Node node) {
Node temp = head;
//遍历查找尾节点后插入
while (true) {
if (temp.getNextNode() == null) {
temp.setNextNode(node);
size++;
return;
}
temp = temp.getNextNode();
}
}
/**
* 2.在指定位置插入新节点(增)
*
* @param node 新节点
* @param order 指定位置
* @return
*/
public boolean insertion(Node node, int order) {
boolean b = false;
Node temp = head;
if (order > size || order < 0) {
System.out.println("指定数据位置越界");
return b;
}
//在找到指定的节点后插入
for (int i = 0; i < order; i++) {
temp = temp.getNextNode();
}
node.setNextNode(temp.getNextNode());
temp.setNextNode(node);
size++;
return b = true;
}
/**
* 3.删除指定位置的节点(删)
*
* @param order 指定位置
* @return
*/
public boolean remove(int order) {
boolean b = false;
Node temp = head;
if (order > size || order < 1) {
System.out.println("指定数据位置越界");
return b;
}
for (int i = 0; i < order - 1; i++) {
temp = temp.getNextNode();
}
temp.setNextNode(temp.getNextNode().getNextNode());
size--;
return b = true;
}
/**
* 4.删除指定数据的节点(删)
*
* @param data 匹配删除的数据
* @return
*/
public void removeAll(String data) {
Node temp = head;
while (true) {
if (temp.getNextNode() == null) {
return;
}
if (temp.getNextNode().getData().equals(data)) {
temp.setNextNode(temp.getNextNode().getNextNode());
size--;
continue;
}
temp = temp.getNextNode();
}
}
/**
* 5.修改指定位置的节点(改)
*
* @param node 新节点
* @param order 指定位置
* @return
*/
public boolean updata(Node node, int order) {
boolean b = false;
Node temp = head;
if (order > size || order < 1) {
System.out.println("指定数据位置越界");
return b;
}
//找到需要替换节点的前一个节点
for (int i = 0; i < order - 1; i++) {
temp = temp.getNextNode();
}
node.setNextNode(temp.getNextNode().getNextNode());
temp.setNextNode(node);
return b = true;
}
/**
* 6.查找指定位置的节点数据(查)
*
* @param order 指定位置
* @return
*/
public boolean select(int order) {
boolean b = false;
Node temp = head;
if (order > size || order < 1) {
System.out.println("指定数据位置越界");
return b;
}
for (int i = 0; i < order; i++) {
temp = temp.getNextNode();
}
System.out.println("第" + order + "个节点的数据为:" + temp.getData());
return b = true;
}
/**
* 7.打印链表
*/
public void showList() {
System.out.println("------开始输出链表------");
//判空
if (head.getNextNode() == null) {
System.out.println("------链表为空------");
return;
}
//头节点为空,头结点的后一节点开始输出链表
Node temp = head.getNextNode();
while (true) {
if (temp == null) {
System.out.println("------链表打印完成------");
return;
}
System.out.println(temp.toString());
temp = temp.getNextNode();
}
}
/**
* 8.链表倒置
*/
public void reverse() {
//创建一个新的头结点
Node reverseHead = new Node();
//设置一个临时操作结点
Node temp = head.getNextNode();
while (temp != null) {
//将操作结点从原链表中拆出
head.setNextNode(temp.getNextNode());
//向逆序链表中插入操作结点
temp.setNextNode(reverseHead.getNextNode());
reverseHead.setNextNode(temp);
//操作下一个结点
temp = head.getNextNode();
}
//将倒序后的链表接入回原链表
head.setNextNode(reverseHead.getNextNode());
}
}
|
[
"[email protected]"
] | |
c49d69d74a21312085f8d506fce04869dc3c4292
|
58afe8815f26dd6d9703d1cd9131fc7a4bdba09a
|
/predavanja/primeri-java-knjiga-eckel-tij/src/p04/ExplicitStatic.java
|
70f8e5e44e882efb0d4dda754c32d6401814f5ec
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
MatfOOP/OOP
|
098213709417006ccb13519eea7208d9e6f32900
|
98eea2bb90c23973ad80c56dfcba42eaf1757b71
|
refs/heads/master
| 2023-07-07T01:34:49.955311 | 2023-06-30T17:13:48 | 2023-06-30T17:13:48 | 138,500,698 | 7 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 953 |
java
|
package p04;
//: c04:ExplicitStatic.java
// Explicit static initialization with the "static" clause.
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
import com.bruceeckel.simpletest.*;
class Cup {
Cup(int marker) {
System.out.println("Cup(" + marker + ")");
}
void f(int marker) {
System.out.println("f(" + marker + ")");
}
}
class Cups {
static Cup c1;
static Cup c2;
static {
c1 = new Cup(1);
c2 = new Cup(2);
}
Cups() {
System.out.println("Cups()");
}
}
public class ExplicitStatic {
static Test monitor = new Test();
public static void main(String[] args) {
System.out.println("Inside main()");
Cups.c1.f(99); // (1)
monitor.expect(new String[] {
"Inside main()",
"Cup(1)",
"Cup(2)",
"f(99)"
});
}
// static Cups x = new Cups(); // (2)
// static Cups y = new Cups(); // (2)
} ///:~
|
[
"[email protected]"
] | |
9ba2fa8f97f30d4a6a20f7338c31d8516eef692d
|
ee461488c62d86f729eda976b421ac75a964114c
|
/tags/pre-dom-changes/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/TableRowGroup.java
|
33a91f43b6adaf4f9a30ea3ce3a9bbf16d1f84a6
|
[
"BSD-2-Clause"
] |
permissive
|
svn2github/htmlunit
|
2c56f7abbd412e6d9e0efd0934fcd1277090af74
|
6fc1a7d70c08fb50fef1800673671fd9cada4899
|
refs/heads/master
| 2023-09-03T10:35:41.987099 | 2015-07-26T13:12:45 | 2015-07-26T13:12:45 | 37,107,064 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,132 |
java
|
/*
* Copyright (c) 2002, 2003 Gargoyle Software Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment:
*
* "This product includes software developed by Gargoyle Software Inc.
* (http://www.GargoyleSoftware.com/)."
*
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
* 4. The name "Gargoyle Software" must not be used to endorse or promote
* products derived from this software without prior written permission.
* For written permission, please contact [email protected].
* 5. Products derived from this software may not be called "HtmlUnit", nor may
* "HtmlUnit" appear in their name, without prior written permission of
* Gargoyle Software Inc.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE
* SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.gargoylesoftware.htmlunit.html;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.w3c.dom.Element;
/**
* Wrapper for the html element "tfoot".
*
* @version $Revision$
* @author <a href="mailto:[email protected]">Mike Bowler</a>
* @author David K. Taylor
*/
public abstract class TableRowGroup extends ClickableElement {
/**
* Create an instance of TableRowGroup
*
* @param page The HtmlPage that contains this element.
* @param xmlElement The actual html element that we are wrapping.
*/
TableRowGroup( final HtmlPage page, final Element xmlElement ) {
super(page, xmlElement);
}
/**
* Return a list of table rows contained in this element
*
* @return a list of table rows
*/
public final List getRows() {
final List childElements = getChildElements();
final List resultList = new ArrayList(childElements.size());
final Iterator iterator = childElements.iterator();
while( iterator.hasNext() ) {
final HtmlElement element = (HtmlElement)iterator.next();
if( element instanceof HtmlTableRow ) {
resultList.add(element);
}
}
return resultList;
}
/**
* Return the value of the attribute "align". Refer to the
* <a href='http://www.w3.org/TR/html401/'>HTML 4.01</a>
* documentation for details on the use of this attribute.
*
* @return The value of the attribute "align"
* or an empty string if that attribute isn't defined.
*/
public final String getAlignAttribute() {
return getAttributeValue("align");
}
/**
* Return the value of the attribute "char". Refer to the
* <a href='http://www.w3.org/TR/html401/'>HTML 4.01</a>
* documentation for details on the use of this attribute.
*
* @return The value of the attribute "char"
* or an empty string if that attribute isn't defined.
*/
public final String getCharAttribute() {
return getAttributeValue("char");
}
/**
* Return the value of the attribute "charoff". Refer to the
* <a href='http://www.w3.org/TR/html401/'>HTML 4.01</a>
* documentation for details on the use of this attribute.
*
* @return The value of the attribute "charoff"
* or an empty string if that attribute isn't defined.
*/
public final String getCharoffAttribute() {
return getAttributeValue("charoff");
}
/**
* Return the value of the attribute "valign". Refer to the
* <a href='http://www.w3.org/TR/html401/'>HTML 4.01</a>
* documentation for details on the use of this attribute.
*
* @return The value of the attribute "valign"
* or an empty string if that attribute isn't defined.
*/
public final String getValignAttribute() {
return getAttributeValue("valign");
}
}
|
[
"(no author)@5f5364db-9458-4db8-a492-e30667be6df6"
] |
(no author)@5f5364db-9458-4db8-a492-e30667be6df6
|
91fe12ce1d630aca5d5d377e9c39016c93db0bf4
|
8a06f4c90742137ab8077254e733819c6ce86d71
|
/PucSportMaster4/app/src/main/java/com/pucmasterapps/pucsportmaster/UpdaterService.java
|
521a4f50048abc9764f07021cafccc924a036267
|
[] |
no_license
|
Pucmaster/PucSportMaster
|
96b9f5eddcac23e27de76ae972a2283684d7d4a0
|
b59057dbefc84ad53b4c1b95008ef387a129d398
|
refs/heads/master
| 2021-01-10T16:05:39.532941 | 2016-01-07T22:50:24 | 2016-01-07T22:50:24 | 49,234,427 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,091 |
java
|
package com.pucmasterapps.pucsportmaster;
import android.app.IntentService;
import android.app.NotificationManager;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteConstraintException;
import android.database.sqlite.SQLiteDatabase;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Handler;
public class UpdaterService extends IntentService {
private static final String TAG = "UpdaterService";
private static final String RUNNER_URL = "http://atlantis.cnl.sk:8000/workouts/ ";
private static final String SQL_INSERT_DATA = "INSERT INTO forecast VALUES (NULL, %d, %d, '%s')";
private Handler mHandler;
public UpdaterService() {
super(TAG);
Log.i(TAG, "created");
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
protected void onHandleIntent(Intent intent) {
Log.i(TAG, "onHandleIntent()");
try {
URL url = new URL(String.format(RUNNER_URL));
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(15000 /* milliseconds */);
connection.setReadTimeout(10000 /* milliseconds */);
connection.connect();
Log.i(TAG, String.format("Connecting to %s", url.toString()));
Log.i(TAG, String.format("HTTP Status Code: %d", connection.getResponseCode()));
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
Log.e(TAG, "Response code is not OK");
return;
}
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line + '\n');
}
Log.i(TAG, String.format("GET: %s", stringBuilder.toString()));
JSONObject json = new JSONObject(stringBuilder.toString());
JSONArray list = json.getJSONArray("results");
DbHElper dbHelper = new DbHElper(this);
SQLiteDatabase db = dbHelper.getWritableDatabase();
ContentValues cvalues = new ContentValues();
/* try {
db.execSQL(String.format("INSERT INTO city VALUES (NULL, '%s', %e, %e)",
ThemedSpinnerAdapter.Helper.getCityName(json),
ThemedSpinnerAdapter.Helper.getLatitude(json),
ThemedSpinnerAdapter.Helper.getLongitude(json)
));
}catch(SQLiteConstraintException e){
Log.e(TAG, "Trying to insert existing city entry");
}
*/
for(int i = 0; i < list.length(); i++){
JSONObject data = list.getJSONObject(i);
try {
cvalues.put("pub_date",data.getString("pub_date"));
cvalues.put("username",data.getString("username"));
cvalues.put("duration",data.getInt("duration"));
cvalues.put("distance",data.getInt("distance"));
db.insert("runner", null, cvalues);
/*
String query = String.format(SQL_INSERT_DATA, data.getLong("dt"), 1, data.toString());
db.execSQL(query);*/
/* "_id INTEGER PRIMARY KEY, " +
"pub_date DATETIME UNIQUE NOT NULL, " +
"username TEXT, " +
"duration INTEGER, " +
"distance INTEGER, " +*/
}catch(SQLiteConstraintException e){
Log.e(TAG, "Trying to insert existing forecast data");
}
}
db.close();
dbHelper.close();
NotificationCompat.Builder notification =
new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Forecast Updated")
.setContentText("New Data Available");
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notification.build());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
1af109c86a9d5478b05b763648c51411c9d8677c
|
696ce7d6d916dd36912d5660e4921af7d793d80c
|
/Succorfish/Installer/ccp/src/main/java/com/hbb20/CountryCodePicker.java
|
e8d17e155249aa391ec7269f7a99f73fef658f49
|
[] |
no_license
|
VinayTShetty/GeoFence_Project_End
|
c669ff89cc355e1772353317c8d6e7bac9ac3361
|
7e178f207c9183bcd42ec24e339bf414a6df9e71
|
refs/heads/main
| 2023-06-04T13:54:32.836943 | 2021-06-26T02:27:59 | 2021-06-26T02:27:59 | 380,394,802 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 58,563 |
java
|
package com.hbb20;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.os.Build;
import android.telephony.PhoneNumberFormattingTextWatcher;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.Phonenumber;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* Created by hbb20 on 11/1/16.
*/
public class CountryCodePicker extends RelativeLayout {
static String TAG = "CCP";
static String BUNDLE_SELECTED_CODE = "selectedCode";
static int LIB_DEFAULT_COUNTRY_CODE = 1;
private static int TEXT_GRAVITY_LEFT = -1, TEXT_GRAVITY_RIGHT = 1, TEXT_GRAVITY_CENTER = 0;
private static String ANDROID_NAME_SPACE = "http://schemas.android.com/apk/res/android";
int defaultCountryCode;
String defaultCountryNameCode;
Context context;
View holderView;
LayoutInflater mInflater;
TextView textView_selectedCountry;
EditText editText_registeredCarrierNumber;
RelativeLayout holder;
ImageView imageViewArrow;
ImageView imageViewFlag;
LinearLayout linearFlagBorder;
LinearLayout linearFlagHolder;
Country selectedCountry;
Country defaultCountry;
RelativeLayout relativeClickConsumer;
CountryCodePicker codePicker;
TextGravity currentTextGravity;
boolean showNameCode = false;
boolean showPhoneCode = true;
boolean ccpDialogShowPhoneCode = true;
boolean showFlag = true;
boolean showFullName = false;
boolean showFastScroller;
boolean searchAllowed = true;
int contentColor;
int borderFlagColor;
int selectedTextColor;
List<Country> preferredCountries;
int ccpTextgGravity = TEXT_GRAVITY_CENTER;
//this will be "AU,IN,US"
String countryPreference;
int fastScrollerBubbleColor = 0;
List<Country> customMasterCountriesList;
//this will be "AU,IN,US"
String customMasterCountries;
Language customDefaultLanguage = Language.ENGLISH;
Language languageToApply = Language.ENGLISH;
boolean dialogKeyboardAutoPopup = true;
boolean ccpClickable = true;
boolean autoDetectLanguageEnabled, autoDetectCountryEnabled, numberAutoFormattingEnabled;
String xmlWidth = "notSet";
TextWatcher validityTextWatcher;
PhoneNumberFormattingTextWatcher textWatcher;
boolean reportedValidity;
private OnCountryChangeListener onCountryChangeListener;
private PhoneNumberValidityChangeListener phoneNumberValidityChangeListener;
private int fastScrollerHandleColor;
private int dialogBackgroundColor, dialogTextColor, dialogSearchEditTextTintColor;
private int fastScrollerBubbleTextAppearance;
View.OnClickListener countryCodeHolderClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isCcpClickable()) {
CountryCodeDialog.openCountryCodeDialog(codePicker);
}
}
};
public CountryCodePicker(Context context) {
super(context);
this.context = context;
init(null);
}
public CountryCodePicker(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
init(attrs);
}
public CountryCodePicker(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
init(attrs);
}
private boolean isNumberAutoFormattingEnabled() {
return numberAutoFormattingEnabled;
}
/**
* This will set boolean for numberAutoFormattingEnabled and refresh formattingTextWatcher
*
* @param numberAutoFormattingEnabled
*/
public void setNumberAutoFormattingEnabled(boolean numberAutoFormattingEnabled) {
this.numberAutoFormattingEnabled = numberAutoFormattingEnabled;
if (editText_registeredCarrierNumber != null) {
updateFormattingTextWatcher();
}
}
private void init(AttributeSet attrs) {
mInflater = LayoutInflater.from(context);
xmlWidth = attrs.getAttributeValue(ANDROID_NAME_SPACE, "layout_width");
Log.d(TAG, "init:xmlWidth " + xmlWidth);
removeAllViewsInLayout();
//at run time, match parent value returns LayoutParams.MATCH_PARENT ("-1"), for some android xml preview it returns "fill_parent"
if (xmlWidth != null && (xmlWidth.equals(LayoutParams.MATCH_PARENT + "") || xmlWidth.equals(LayoutParams.FILL_PARENT + "") || xmlWidth.equals("fill_parent") || xmlWidth.equals("match_parent"))) {
holderView = mInflater.inflate(R.layout.layout_full_width_code_picker, this, true);
} else {
holderView = mInflater.inflate(R.layout.layout_code_picker, this, true);
}
textView_selectedCountry = (TextView) holderView.findViewById(R.id.textView_selectedCountry);
holder = (RelativeLayout) holderView.findViewById(R.id.countryCodeHolder);
imageViewArrow = (ImageView) holderView.findViewById(R.id.imageView_arrow);
imageViewFlag = (ImageView) holderView.findViewById(R.id.image_flag);
linearFlagHolder = (LinearLayout) holderView.findViewById(R.id.linear_flag_holder);
linearFlagBorder = (LinearLayout) holderView.findViewById(R.id.linear_flag_border);
relativeClickConsumer = (RelativeLayout) holderView.findViewById(R.id.rlClickConsumer);
codePicker = this;
applyCustomProperty(attrs);
relativeClickConsumer.setOnClickListener(countryCodeHolderClickListener);
}
private void applyCustomProperty(AttributeSet attrs) {
// Log.d(TAG, "Applying custom property");
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CountryCodePicker, 0, 0);
//default country code
try {
//hide nameCode. If someone wants only phone code to avoid name collision for same country phone code.
showNameCode = a.getBoolean(R.styleable.CountryCodePicker_ccp_showNameCode, true);
//show phone code.
showPhoneCode = a.getBoolean(R.styleable.CountryCodePicker_ccp_showPhoneCode, true);
//show phone code on dialog
ccpDialogShowPhoneCode = a.getBoolean(R.styleable.CountryCodePicker_ccpDialog_showPhoneCode, showPhoneCode);
//show full name
showFullName = a.getBoolean(R.styleable.CountryCodePicker_ccp_showFullName, false);
//show fast scroller
showFastScroller = a.getBoolean(R.styleable.CountryCodePicker_ccpDialog_showFastScroller, true);
//bubble color
fastScrollerBubbleColor = a.getColor(R.styleable.CountryCodePicker_ccpDialog_fastScroller_bubbleColor, 0);
//scroller handle color
fastScrollerHandleColor = a.getColor(R.styleable.CountryCodePicker_ccpDialog_fastScroller_handleColor, 0);
//scroller text appearance
fastScrollerBubbleTextAppearance = a.getResourceId(R.styleable.CountryCodePicker_ccpDialog_fastScroller_bubbleTextAppearance, 0);
//auto detect language
autoDetectLanguageEnabled = a.getBoolean(R.styleable.CountryCodePicker_ccp_autoDetectLanguage, false);
//auto detect county
autoDetectCountryEnabled = a.getBoolean(R.styleable.CountryCodePicker_ccp_autoDetectCountry, true);
//show flag
showFlag(a.getBoolean(R.styleable.CountryCodePicker_ccp_showFlag, true));
//number auto formatting
numberAutoFormattingEnabled = a.getBoolean(R.styleable.CountryCodePicker_ccp_autoFormatNumber, true);
//autopop keyboard
setDialogKeyboardAutoPopup(a.getBoolean(R.styleable.CountryCodePicker_ccpDialog_keyboardAutoPopup, true));
//if custom default language is specified, then set it as custom
int attrLanguage = 3; //for english
if (a.hasValue(R.styleable.CountryCodePicker_ccp_defaultLanguage)) {
attrLanguage = a.getInt(R.styleable.CountryCodePicker_ccp_defaultLanguage, 1);
}
customDefaultLanguage = getLanguageEnum(attrLanguage);
updateLanguageToApply();
//custom master list
customMasterCountries = a.getString(R.styleable.CountryCodePicker_ccp_customMasterCountries);
refreshCustomMasterList();
//preference
countryPreference = a.getString(R.styleable.CountryCodePicker_ccp_countryPreference);
refreshPreferredCountries();
//text gravity
if (a.hasValue(R.styleable.CountryCodePicker_ccp_textGravity)) {
ccpTextgGravity = a.getInt(R.styleable.CountryCodePicker_ccp_textGravity, TEXT_GRAVITY_RIGHT);
}
applyTextGravity(ccpTextgGravity);
//default country
defaultCountryNameCode = a.getString(R.styleable.CountryCodePicker_ccp_defaultNameCode);
boolean setUsingNameCode = false;
if (defaultCountryNameCode != null && defaultCountryNameCode.length() != 0) {
if (Country.getCountryForNameCodeFromLibraryMasterList(getContext(), getLanguageToApply(), defaultCountryNameCode) != null) {
setUsingNameCode = true;
setDefaultCountry(Country.getCountryForNameCodeFromLibraryMasterList(getContext(), getLanguageToApply(), defaultCountryNameCode));
setSelectedCountry(defaultCountry);
}
}
//if default country is not set using name code.
if (!setUsingNameCode) {
int defaultCountryCode = a.getInteger(R.styleable.CountryCodePicker_ccp_defaultPhoneCode, -1);
//if invalid country is set using xml, it will be replaced with LIB_DEFAULT_COUNTRY_CODE
if (Country.getCountryForCode(getContext(), getLanguageToApply(), preferredCountries, defaultCountryCode) == null) {
defaultCountryCode = LIB_DEFAULT_COUNTRY_CODE;
}
setDefaultCountryUsingPhoneCode(defaultCountryCode);
setSelectedCountry(defaultCountry);
}
//set auto detected country
if (isAutoDetectCountryEnabled()) {
selectCountryFromSimInfo();
}
//content color
int contentColor;
if (isInEditMode()) {
contentColor = a.getColor(R.styleable.CountryCodePicker_ccp_contentColor, 0);
} else {
contentColor = a.getColor(R.styleable.CountryCodePicker_ccp_contentColor, context.getResources().getColor(R.color.defaultContentColor));
}
if (contentColor != 0) {
setContentColor(contentColor);
}
int textColor;
if (isInEditMode()) {
textColor = a.getColor(R.styleable.CountryCodePicker_ccp_textColor, 0);
} else {
textColor = a.getColor(R.styleable.CountryCodePicker_ccp_textColor, context.getResources().getColor(R.color.defaultTextColor));
}
if (textColor != 0) {
setTextColor(textColor);
}
// flag border color
int borderFlagColor;
if (isInEditMode()) {
borderFlagColor = a.getColor(R.styleable.CountryCodePicker_ccp_flagBorderColor, 0);
} else {
borderFlagColor = a.getColor(R.styleable.CountryCodePicker_ccp_flagBorderColor, context.getResources().getColor(R.color.defaultBorderFlagColor));
}
if (borderFlagColor != 0) {
setFlagBorderColor(borderFlagColor);
}
//dialog colors
setDialogBackgroundColor(a.getColor(R.styleable.CountryCodePicker_ccpDialog_backgroundColor, 0));
setDialogTextColor(a.getColor(R.styleable.CountryCodePicker_ccpDialog_textColor, 0));
setDialogSearchEditTextTintColor(a.getColor(R.styleable.CountryCodePicker_ccpDialog_searchEditTextTint, 0));
//text size
int textSize = a.getDimensionPixelSize(R.styleable.CountryCodePicker_ccp_textSize, 0);
if (textSize > 0) {
textView_selectedCountry.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
setFlagSize(textSize);
setArrowSize(textSize);
} else { //no textsize specified
DisplayMetrics dm = context.getResources().getDisplayMetrics();
int defaultSize = Math.round(18 * (dm.xdpi / DisplayMetrics.DENSITY_DEFAULT));
setTextSize(defaultSize);
}
//if arrow size is explicitly defined
int arrowSize = a.getDimensionPixelSize(R.styleable.CountryCodePicker_ccp_arrowSize, 0);
if (arrowSize > 0) {
setArrowSize(arrowSize);
}
searchAllowed = a.getBoolean(R.styleable.CountryCodePicker_ccpDialog_allowSearch, true);
setCcpClickable(a.getBoolean(R.styleable.CountryCodePicker_ccp_clickable, true));
} catch (Exception e) {
textView_selectedCountry.setText(e.getMessage());
} finally {
a.recycle();
}
Log.d(TAG, "end:xmlWidth " + xmlWidth);
}
boolean isCcpDialogShowPhoneCode() {
return ccpDialogShowPhoneCode;
}
/**
* To show/hide phone code from country selection dialog
*
* @param ccpDialogShowPhoneCode
*/
public void setCcpDialogShowPhoneCode(boolean ccpDialogShowPhoneCode) {
this.ccpDialogShowPhoneCode = ccpDialogShowPhoneCode;
}
boolean isShowPhoneCode() {
return showPhoneCode;
}
/**
* To show/hide phone code from ccp view
*
* @param showPhoneCode
*/
public void setShowPhoneCode(boolean showPhoneCode) {
this.showPhoneCode = showPhoneCode;
setSelectedCountry(selectedCountry);
}
int getFastScrollerBubbleTextAppearance() {
return fastScrollerBubbleTextAppearance;
}
/**
* This sets text appearance for fast scroller index character
*
* @param fastScrollerBubbleTextAppearance should be reference id of textappereance style. i.e. R.style.myBubbleTextAppearance
*/
public void setFastScrollerBubbleTextAppearance(int fastScrollerBubbleTextAppearance) {
this.fastScrollerBubbleTextAppearance = fastScrollerBubbleTextAppearance;
}
int getFastScrollerHandleColor() {
return fastScrollerHandleColor;
}
/**
* This should be the color for fast scroller handle.
*
* @param fastScrollerHandleColor
*/
public void setFastScrollerHandleColor(int fastScrollerHandleColor) {
this.fastScrollerHandleColor = fastScrollerHandleColor;
}
int getFastScrollerBubbleColor() {
return fastScrollerBubbleColor;
}
/**
* Sets bubble color for fast scroller
*
* @param fastScrollerBubbleColor
*/
public void setFastScrollerBubbleColor(int fastScrollerBubbleColor) {
this.fastScrollerBubbleColor = fastScrollerBubbleColor;
}
TextGravity getCurrentTextGravity() {
return currentTextGravity;
}
/**
* When width is set "match_parent", this gravity will set placement of text (Between flag and down arrow).
*
* @param textGravity expected placement
*/
public void setCurrentTextGravity(TextGravity textGravity) {
this.currentTextGravity = textGravity;
applyTextGravity(textGravity.enumIndex);
}
private void applyTextGravity(int enumIndex) {
if (enumIndex == TextGravity.LEFT.enumIndex) {
textView_selectedCountry.setGravity(Gravity.LEFT);
} else if (enumIndex == TextGravity.CENTER.enumIndex) {
textView_selectedCountry.setGravity(Gravity.CENTER);
} else {
textView_selectedCountry.setGravity(Gravity.RIGHT);
}
}
/**
* which language to show is decided based on
* autoDetectLanguage flag
* if autoDetectLanguage is true, then it should check language based on locale, if no language is found based on locale, customDefault language will returned
* else autoDetectLanguage is false, then customDefaultLanguage will be returned.
*
* @return
*/
private void updateLanguageToApply() {
//when in edit mode, it will return default language only
if (isInEditMode()) {
if (customDefaultLanguage != null) {
languageToApply = customDefaultLanguage;
} else {
languageToApply = Language.ENGLISH;
}
} else {
if (isAutoDetectLanguageEnabled()) {
Language localeBasedLanguage = getCCPLanguageFromLocale();
if (localeBasedLanguage == null) { //if no language is found from locale
if (getCustomDefaultLanguage() != null) { //and custom language is defined
languageToApply = getCustomDefaultLanguage();
} else {
languageToApply = Language.ENGLISH;
}
} else {
languageToApply = localeBasedLanguage;
}
} else {
if (getCustomDefaultLanguage() != null) {
languageToApply = customDefaultLanguage;
} else {
languageToApply = Language.ENGLISH; //library default
}
}
}
Log.d(TAG, "updateLanguageToApply: " + languageToApply);
}
private Language getCCPLanguageFromLocale() {
Locale currentLocale = context.getResources().getConfiguration().locale;
Log.d(TAG, "getCCPLanguageFromLocale: current locale language" + currentLocale.getLanguage());
for (Language language : Language.values()) {
if (language.getCode().equalsIgnoreCase(currentLocale.getLanguage())) {
return language;
}
}
return null;
}
private Country getDefaultCountry() {
return defaultCountry;
}
private void setDefaultCountry(Country defaultCountry) {
this.defaultCountry = defaultCountry;
// Log.d(TAG, "Setting default country:" + defaultCountry.logString());
}
private TextView getTextView_selectedCountry() {
return textView_selectedCountry;
}
private void setTextView_selectedCountry(TextView textView_selectedCountry) {
this.textView_selectedCountry = textView_selectedCountry;
}
private Country getSelectedCountry() {
return selectedCountry;
}
void setSelectedCountry(Country selectedCountry) {
//as soon as country is selected, textView should be updated
if (selectedCountry == null) {
selectedCountry = Country.getCountryForCode(getContext(), getLanguageToApply(), preferredCountries, defaultCountryCode);
}
this.selectedCountry = selectedCountry;
String displayText = "";
// add full name to if required
if (showFullName) {
displayText = displayText + selectedCountry.getName();
}
// adds name code if required
if (showNameCode) {
if (showFullName) {
displayText += " (" + selectedCountry.getNameCode().toUpperCase() + ")";
} else {
displayText += " " + selectedCountry.getNameCode().toUpperCase();
}
}
// hide phone code if required
if (showPhoneCode) {
if (displayText.length() > 0) {
displayText += " ";
}
displayText += "+" + selectedCountry.getPhoneCode();
}
textView_selectedCountry.setText(displayText);
//avoid blank state of ccp
if (showFlag == false && displayText.length() == 0) {
displayText += "+" + selectedCountry.getPhoneCode();
textView_selectedCountry.setText(displayText);
}
if (onCountryChangeListener != null) {
onCountryChangeListener.onCountrySelected();
}
imageViewFlag.setImageResource(selectedCountry.getFlagID());
// Log.d(TAG, "Setting selected country:" + selectedCountry.logString());
updateFormattingTextWatcher();
//notify to registered validity listener
if (editText_registeredCarrierNumber != null && phoneNumberValidityChangeListener != null) {
reportedValidity = isValidFullNumber();
phoneNumberValidityChangeListener.onValidityChanged(reportedValidity);
}
}
Language getLanguageToApply() {
if (languageToApply == null) {
updateLanguageToApply();
}
return languageToApply;
}
void setLanguageToApply(Language languageToApply) {
this.languageToApply = languageToApply;
}
private void updateFormattingTextWatcher() {
if (getEditText_registeredCarrierNumber() != null && selectedCountry != null) {
String enteredValue = getEditText_registeredCarrierNumber().getText().toString();
String digitsValue = PhoneNumberUtil.normalizeDigitsOnly(enteredValue);
editText_registeredCarrierNumber.removeTextChangedListener(textWatcher);
if (numberAutoFormattingEnabled) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
textWatcher = new PhoneNumberFormattingTextWatcher(selectedCountry.getNameCode());
} else {
textWatcher = new PhoneNumberFormattingTextWatcher();
}
editText_registeredCarrierNumber.addTextChangedListener(textWatcher);
}
//text watcher stops working when it finds non digit character in previous phone code. This will reset its function
editText_registeredCarrierNumber.setText("");
editText_registeredCarrierNumber.setText(digitsValue);
editText_registeredCarrierNumber.setSelection(editText_registeredCarrierNumber.getText().length());
}
}
Language getCustomDefaultLanguage() {
return customDefaultLanguage;
}
private void setCustomDefaultLanguage(Language customDefaultLanguage) {
this.customDefaultLanguage = customDefaultLanguage;
updateLanguageToApply();
setSelectedCountry(Country.getCountryForNameCodeFromLibraryMasterList(context, getLanguageToApply(), selectedCountry.getNameCode()));
}
private View getHolderView() {
return holderView;
}
private void setHolderView(View holderView) {
this.holderView = holderView;
}
private RelativeLayout getHolder() {
return holder;
}
private void setHolder(RelativeLayout holder) {
this.holder = holder;
}
boolean isAutoDetectLanguageEnabled() {
return autoDetectLanguageEnabled;
}
boolean isAutoDetectCountryEnabled() {
return autoDetectCountryEnabled;
}
boolean isDialogKeyboardAutoPopup() {
return dialogKeyboardAutoPopup;
}
/**
* By default, keyboard pops up every time ccp is clicked and selection dialog is opened.
*
* @param dialogKeyboardAutoPopup true: to open keyboard automatically when selection dialog is opened
* false: to avoid auto pop of keyboard
*/
public void setDialogKeyboardAutoPopup(boolean dialogKeyboardAutoPopup) {
this.dialogKeyboardAutoPopup = dialogKeyboardAutoPopup;
}
boolean isShowFastScroller() {
return showFastScroller;
}
/**
* Set visibility of fast scroller.
*
* @param showFastScroller
*/
public void setShowFastScroller(boolean showFastScroller) {
this.showFastScroller = showFastScroller;
}
EditText getEditText_registeredCarrierNumber() {
return editText_registeredCarrierNumber;
}
/**
* this will register editText and will apply required text watchers
*
* @param editText_registeredCarrierNumber
*/
void setEditText_registeredCarrierNumber(EditText editText_registeredCarrierNumber) {
this.editText_registeredCarrierNumber = editText_registeredCarrierNumber;
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
updateFormattingTextWatcher();
updateValidityTextWatcher();
}
/**
* This function will
* - remove existing, if any, validityTextWatcher
* - prepare new validityTextWatcher
* - attach validityTextWatcher
* - do initial reporting to watcher
*/
private void updateValidityTextWatcher() {
try {
editText_registeredCarrierNumber.removeTextChangedListener(validityTextWatcher);
} catch (Exception e) {
e.printStackTrace();
}
//initial REPORTING
reportedValidity = isValidFullNumber();
if (phoneNumberValidityChangeListener != null) {
phoneNumberValidityChangeListener.onValidityChanged(reportedValidity);
}
validityTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (phoneNumberValidityChangeListener != null) {
boolean currentValidity;
currentValidity = isValidFullNumber();
if (currentValidity != reportedValidity) {
reportedValidity = currentValidity;
phoneNumberValidityChangeListener.onValidityChanged(reportedValidity);
}
}
}
};
editText_registeredCarrierNumber.addTextChangedListener(validityTextWatcher);
}
private LayoutInflater getmInflater() {
return mInflater;
}
private OnClickListener getCountryCodeHolderClickListener() {
return countryCodeHolderClickListener;
}
int getDialogBackgroundColor() {
return dialogBackgroundColor;
}
/**
* This will be color of dialog background
*
* @param dialogBackgroundColor
*/
public void setDialogBackgroundColor(int dialogBackgroundColor) {
this.dialogBackgroundColor = dialogBackgroundColor;
}
int getDialogSearchEditTextTintColor() {
return dialogSearchEditTextTintColor;
}
/**
* If device is running above or equal LOLLIPOP version, this will change tint of search edittext background.
*
* @param dialogSearchEditTextTintColor
*/
public void setDialogSearchEditTextTintColor(int dialogSearchEditTextTintColor) {
this.dialogSearchEditTextTintColor = dialogSearchEditTextTintColor;
}
int getDialogTextColor() {
return dialogTextColor;
}
/**
* This color will be applied to
* Title of dialog
* Name of country
* Phone code of country
* "X" button to clear query
* preferred country divider if preferred countries defined (semi transparent)
*
* @param dialogTextColor
*/
public void setDialogTextColor(int dialogTextColor) {
this.dialogTextColor = dialogTextColor;
}
/**
* Publicly available functions from library
*/
/**
* this will load preferredCountries based on countryPreference
*/
void refreshPreferredCountries() {
if (countryPreference == null || countryPreference.length() == 0) {
preferredCountries = null;
} else {
List<Country> localCountryList = new ArrayList<>();
for (String nameCode : countryPreference.split(",")) {
Country country = Country.getCountryForNameCodeFromCustomMasterList(getContext(), customMasterCountriesList, getLanguageToApply(), nameCode);
if (country != null) {
if (!isAlreadyInList(country, localCountryList)) { //to avoid duplicate entry of country
localCountryList.add(country);
}
}
}
if (localCountryList.size() == 0) {
preferredCountries = null;
} else {
preferredCountries = localCountryList;
}
}
if (preferredCountries != null) {
// Log.d("preference list", preferredCountries.size() + " countries");
for (Country country : preferredCountries) {
country.log();
}
} else {
// Log.d("preference list", " has no country");
}
}
/**
* this will load preferredCountries based on countryPreference
*/
void refreshCustomMasterList() {
if (customMasterCountries == null || customMasterCountries.length() == 0) {
customMasterCountriesList = null;
} else {
List<Country> localCountryList = new ArrayList<>();
for (String nameCode : customMasterCountries.split(",")) {
Country country = Country.getCountryForNameCodeFromLibraryMasterList(getContext(), getLanguageToApply(), nameCode);
if (country != null) {
if (!isAlreadyInList(country, localCountryList)) { //to avoid duplicate entry of country
localCountryList.add(country);
}
}
}
if (localCountryList.size() == 0) {
customMasterCountriesList = null;
} else {
customMasterCountriesList = localCountryList;
}
}
if (customMasterCountriesList != null) {
// Log.d("custom master list:", customMasterCountriesList.size() + " countries");
for (Country country : customMasterCountriesList) {
country.log();
}
} else {
// Log.d("custom master list", " has no country");
}
}
List<Country> getCustomMasterCountriesList() {
return customMasterCountriesList;
}
/**
* @param customMasterCountriesList is list of countries that we need as custom master list
*/
void setCustomMasterCountriesList(List<Country> customMasterCountriesList) {
this.customMasterCountriesList = customMasterCountriesList;
}
/**
* @return comma separated custom master countries' name code. i.e "gb,us,nz,in,pk"
*/
String getCustomMasterCountries() {
return customMasterCountries;
}
/**
* To provide definite set of countries when selection dialog is opened.
* Only custom master countries, if defined, will be there is selection dialog to select from.
* To set any country in preference, it must be included in custom master countries, if defined
* When not defined or null or blank is set, it will use library's default master list
* Custom master list will only limit the visibility of irrelevant country from selection dialog. But all other functions like setCountryForCodeName() or setFullNumber() will consider all the countries.
*
* @param customMasterCountries is country name codes separated by comma. e.g. "us,in,nz"
* if null or "" , will remove custom countries and library default will be used.
*/
public void setCustomMasterCountries(String customMasterCountries) {
this.customMasterCountries = customMasterCountries;
}
/**
* @return true if ccp is enabled for click
*/
boolean isCcpClickable() {
return ccpClickable;
}
/**
* Allow click and open dialog
*
* @param ccpClickable
*/
public void setCcpClickable(boolean ccpClickable) {
this.ccpClickable = ccpClickable;
if (!ccpClickable) {
relativeClickConsumer.setOnClickListener(null);
relativeClickConsumer.setClickable(false);
relativeClickConsumer.setEnabled(false);
} else {
relativeClickConsumer.setOnClickListener(countryCodeHolderClickListener);
relativeClickConsumer.setClickable(true);
relativeClickConsumer.setEnabled(true);
}
}
/**
* This will match name code of all countries of list against the country's name code.
*
* @param country
* @param countryList list of countries against which country will be checked.
* @return if country name code is found in list, returns true else return false
*/
private boolean isAlreadyInList(Country country, List<Country> countryList) {
if (country != null && countryList != null) {
for (Country iterationCountry : countryList) {
if (iterationCountry.getNameCode().equalsIgnoreCase(country.getNameCode())) {
return true;
}
}
}
return false;
}
/**
* This function removes possible country code from fullNumber and set rest of the number as carrier number.
*
* @param fullNumber combination of country code and carrier number.
* @param country selected country in CCP to detect country code part.
*/
private String detectCarrierNumber(String fullNumber, Country country) {
String carrierNumber;
if (country == null || fullNumber == null) {
carrierNumber = fullNumber;
} else {
int indexOfCode = fullNumber.indexOf(country.getPhoneCode());
if (indexOfCode == -1) {
carrierNumber = fullNumber;
} else {
carrierNumber = fullNumber.substring(indexOfCode + country.getPhoneCode().length());
}
}
return carrierNumber;
}
/**
* Related to selected country
*/
//add entry here
private Language getLanguageEnum(int index) {
if (index < Language.values().length) {
return Language.values()[index];
} else {
return Language.ENGLISH;
}
}
String getDialogTitle() {
return Country.getDialogTitle(context, getLanguageToApply());
}
String getSearchHintText() {
return Country.getSearchHintMessage(context, getLanguageToApply());
}
/**
* @return translated text for "No Results Found" message.
*/
String getNoResultFoundText() {
return Country.getNoResultFoundAckMessage(context, getLanguageToApply());
}
/**
* This method is not encouraged because this might set some other country which have same country code as of yours. e.g 1 is common for US and canada.
* If you are trying to set US ( and countryPreference is not set) and you pass 1 as @param defaultCountryCode, it will set canada (prior in list due to alphabetical order)
* Rather use @function setDefaultCountryUsingNameCode("us"); or setDefaultCountryUsingNameCode("US");
* <p>
* Default country code defines your default country.
* Whenever invalid / improper number is found in setCountryForPhoneCode() / setFullNumber(), it CCP will set to default country.
* This function will not set default country as selected in CCP. To set default country in CCP call resetToDefaultCountry() right after this call.
* If invalid defaultCountryCode is applied, it won't be changed.
*
* @param defaultCountryCode code of your default country
* if you want to set IN +91(India) as default country, defaultCountryCode = 91
* if you want to set JP +81(Japan) as default country, defaultCountryCode = 81
*/
@Deprecated
public void setDefaultCountryUsingPhoneCode(int defaultCountryCode) {
Country defaultCountry = Country.getCountryForCode(getContext(), getLanguageToApply(), preferredCountries, defaultCountryCode); //xml stores data in string format, but want to allow only numeric value to country code to user.
if (defaultCountry == null) { //if no correct country is found
// Log.d(TAG, "No country for code " + defaultCountryCode + " is found");
} else { //if correct country is found, set the country
this.defaultCountryCode = defaultCountryCode;
setDefaultCountry(defaultCountry);
}
}
/**
* Default country name code defines your default country.
* Whenever invalid / improper name code is found in setCountryForNameCode(), CCP will set to default country.
* This function will not set default country as selected in CCP. To set default country in CCP call resetToDefaultCountry() right after this call.
* If invalid defaultCountryCode is applied, it won't be changed.
*
* @param defaultCountryNameCode code of your default country
* if you want to set IN +91(India) as default country, defaultCountryCode = "IN" or "in"
* if you want to set JP +81(Japan) as default country, defaultCountryCode = "JP" or "jp"
*/
public void setDefaultCountryUsingNameCode(String defaultCountryNameCode) {
Country defaultCountry = Country.getCountryForNameCodeFromLibraryMasterList(getContext(), getLanguageToApply(), defaultCountryNameCode); //xml stores data in string format, but want to allow only numeric value to country code to user.
if (defaultCountry == null) { //if no correct country is found
// Log.d(TAG, "No country for nameCode " + defaultCountryNameCode + " is found");
} else { //if correct country is found, set the country
this.defaultCountryNameCode = defaultCountry.getNameCode();
setDefaultCountry(defaultCountry);
}
}
/**
* @return: Country Code of default country
* i.e if default country is IN +91(India) returns: "91"
* if default country is JP +81(Japan) returns: "81"
*/
public String getDefaultCountryCode() {
return defaultCountry.phoneCode;
}
/**
* * To get code of default country as Integer.
*
* @return integer value of default country code in CCP
* i.e if default country is IN +91(India) returns: 91
* if default country is JP +81(Japan) returns: 81
*/
public int getDefaultCountryCodeAsInt() {
int code = 0;
try {
code = Integer.parseInt(getDefaultCountryCode());
} catch (Exception e) {
e.printStackTrace();
}
return code;
}
/**
* To get code of default country with prefix "+".
*
* @return String value of default country code in CCP with prefix "+"
* i.e if default country is IN +91(India) returns: "+91"
* if default country is JP +81(Japan) returns: "+81"
*/
public String getDefaultCountryCodeWithPlus() {
return "+" + getDefaultCountryCode();
}
/**
* To get name of default country.
*
* @return String value of country name, default in CCP
* i.e if default country is IN +91(India) returns: "India"
* if default country is JP +81(Japan) returns: "Japan"
*/
public String getDefaultCountryName() {
return getDefaultCountry().name;
}
/**
* To get name code of default country.
*
* @return String value of country name, default in CCP
* i.e if default country is IN +91(India) returns: "IN"
* if default country is JP +81(Japan) returns: "JP"
*/
public String getDefaultCountryNameCode() {
return getDefaultCountry().nameCode.toUpperCase();
}
/**
* reset the default country as selected country.
*/
public void resetToDefaultCountry() {
setSelectedCountry(defaultCountry);
}
/**
* To get code of selected country.
*
* @return String value of selected country code in CCP
* i.e if selected country is IN +91(India) returns: "91"
* if selected country is JP +81(Japan) returns: "81"
*/
public String getSelectedCountryCode() {
return getSelectedCountry().phoneCode;
}
/**
* To get code of selected country with prefix "+".
*
* @return String value of selected country code in CCP with prefix "+"
* i.e if selected country is IN +91(India) returns: "+91"
* if selected country is JP +81(Japan) returns: "+81"
*/
public String getSelectedCountryCodeWithPlus() {
return "+" + getSelectedCountryCode();
}
/**
* * To get code of selected country as Integer.
*
* @return integer value of selected country code in CCP
* i.e if selected country is IN +91(India) returns: 91
* if selected country is JP +81(Japan) returns: 81
*/
public int getSelectedCountryCodeAsInt() {
int code = 0;
try {
code = Integer.parseInt(getSelectedCountryCode());
} catch (Exception e) {
e.printStackTrace();
}
return code;
}
/**
* To get name of selected country.
*
* @return String value of country name, selected in CCP
* i.e if selected country is IN +91(India) returns: "India"
* if selected country is JP +81(Japan) returns: "Japan"
*/
public String getSelectedCountryName() {
return getSelectedCountry().name;
}
/**
* To get name code of selected country.
*
* @return String value of country name, selected in CCP
* i.e if selected country is IN +91(India) returns: "IN"
* if selected country is JP +81(Japan) returns: "JP"
*/
public String getSelectedCountryNameCode() {
return getSelectedCountry().nameCode.toUpperCase();
}
/**
* This will set country with @param countryCode as country code, in CCP
*
* @param countryCode a valid country code.
* If you want to set IN +91(India), countryCode= 91
* If you want to set JP +81(Japan), countryCode= 81
*/
public void setCountryForPhoneCode(int countryCode) {
Country country = Country.getCountryForCode(getContext(), getLanguageToApply(), preferredCountries, countryCode); //xml stores data in string format, but want to allow only numeric value to country code to user.
if (country == null) {
if (defaultCountry == null) {
defaultCountry = Country.getCountryForCode(getContext(), getLanguageToApply(), preferredCountries, defaultCountryCode);
}
setSelectedCountry(defaultCountry);
} else {
setSelectedCountry(country);
}
}
/**
* This will set country with @param countryNameCode as country name code, in CCP
*
* @param countryNameCode a valid country name code.
* If you want to set IN +91(India), countryCode= IN
* If you want to set JP +81(Japan), countryCode= JP
*/
public void setCountryForNameCode(String countryNameCode) {
Country country = Country.getCountryForNameCodeFromLibraryMasterList(getContext(), getLanguageToApply(), countryNameCode); //xml stores data in string format, but want to allow only numeric value to country code to user.
if (country == null) {
if (defaultCountry == null) {
defaultCountry = Country.getCountryForCode(getContext(), getLanguageToApply(), preferredCountries, defaultCountryCode);
}
setSelectedCountry(defaultCountry);
} else {
setSelectedCountry(country);
}
}
/**
* All functions that work with fullNumber need an editText to write and read carrier number of full number.
* An editText for carrier number must be registered in order to use functions like setFullNumber() and getFullNumber().
*
* @param editTextCarrierNumber - an editText where user types carrier number ( the part of full number other than country code).
*/
public void registerCarrierNumberEditText(EditText editTextCarrierNumber) {
setEditText_registeredCarrierNumber(editTextCarrierNumber);
}
/**
* This function combines selected country code from CCP and carrier number from @param editTextCarrierNumber
*
* @return Full number is countryCode + carrierNumber i.e countryCode= 91 and carrier number= 8866667722, this will return "918866667722"
*/
public String getFullNumber() {
String fullNumber;
if (editText_registeredCarrierNumber != null) {
fullNumber = getSelectedCountry().getPhoneCode() + editText_registeredCarrierNumber.getText().toString();
fullNumber = PhoneNumberUtil.normalizeDigitsOnly(fullNumber);
} else {
fullNumber = getSelectedCountry().getPhoneCode();
Log.w(TAG, "EditText for carrier number is not registered. Register it using registerCarrierNumberEditText() before getFullNumber() or setFullNumber().");
}
return fullNumber;
}
/**
* Separate out country code and carrier number from fullNumber.
* Sets country of separated country code in CCP and carrier number as text of editTextCarrierNumber
* If no valid country code is found from full number, CCP will be set to default country code and full number will be set as carrier number to editTextCarrierNumber.
*
* @param fullNumber is combination of country code and carrier number, (country_code+carrier_number) for example if country is India (+91) and carrier/mobile number is 8866667722 then full number will be 9188666667722 or +918866667722. "+" in starting of number is optional.
*/
public void setFullNumber(String fullNumber) {
Country country = Country.getCountryForNumber(getContext(), getLanguageToApply(), preferredCountries, fullNumber);
setSelectedCountry(country);
String carrierNumber = detectCarrierNumber(fullNumber, country);
if (getEditText_registeredCarrierNumber() != null) {
getEditText_registeredCarrierNumber().setText(carrierNumber);
} else {
Log.w(TAG, "EditText for carrier number is not registered. Register it using registerCarrierNumberEditText() before getFullNumber() or setFullNumber().");
}
}
/**
* This function combines selected country code from CCP and carrier number from @param editTextCarrierNumber
* This will return formatted number.
*
* @return Full number is countryCode + carrierNumber i.e countryCode= 91 and carrier number= 8866667722, this will return "918866667722"
*/
public String getFormattedFullNumber() {
String formattedFullNumber;
Phonenumber.PhoneNumber phoneNumber;
if (editText_registeredCarrierNumber != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
formattedFullNumber = PhoneNumberUtils.formatNumber(getFullNumberWithPlus(), getSelectedCountryCode());
} else {
formattedFullNumber = PhoneNumberUtils.formatNumber(getFullNumberWithPlus());
}
} else {
formattedFullNumber = getSelectedCountry().getPhoneCode();
Log.w(TAG, "EditText for carrier number is not registered. Register it using registerCarrierNumberEditText() before getFullNumber() or setFullNumber().");
}
return formattedFullNumber;
}
/**
* This function combines selected country code from CCP and carrier number from @param editTextCarrierNumber and prefix "+"
*
* @return Full number is countryCode + carrierNumber i.e countryCode= 91 and carrier number= 8866667722, this will return "+918866667722"
*/
public String getFullNumberWithPlus() {
String fullNumber = "+" + getFullNumber();
return fullNumber;
}
/**
* @return content color of CCP's text and small downward arrow.
*/
public int getContentColor() {
return contentColor;
}
/**
* Sets text and small down arrow color of CCP.
*
* @param contentColor color to apply to text and down arrow
*/
public void setContentColor(int contentColor) {
this.contentColor = contentColor;
textView_selectedCountry.setTextColor(this.contentColor);
imageViewArrow.setColorFilter(this.contentColor, PorterDuff.Mode.SRC_IN);
}
/**
* Sets flag border color of CCP.
*
* @param borderFlagColor color to apply to flag border
*/
public void setFlagBorderColor(int borderFlagColor) {
this.borderFlagColor = borderFlagColor;
linearFlagBorder.setBackgroundColor(this.borderFlagColor);
}
/**
* @return content color of CCP's text and small downward arrow.
*/
public int getTextColor() {
return selectedTextColor;
}
/**
* Sets flag border color of CCP.
*
* @param textColor color to apply to flag border
*/
public void setTextColor(int textColor) {
this.selectedTextColor = textColor;
textView_selectedCountry.setTextColor(this.selectedTextColor);
}
/**
* Modifies size of text in side CCP view.
*
* @param textSize size of text in pixels
*/
public void setTextSize(int textSize) {
if (textSize > 0) {
textView_selectedCountry.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
setArrowSize(textSize);
setFlagSize(textSize);
}
}
/**
* Modifies size of downArrow in CCP view
*
* @param arrowSize size in pixels
*/
public void setArrowSize(int arrowSize) {
if (arrowSize > 0) {
LayoutParams params = (LayoutParams) imageViewArrow.getLayoutParams();
params.width = arrowSize;
params.height = arrowSize;
imageViewArrow.setLayoutParams(params);
}
}
/**
* If nameCode of country in CCP view is not required use this to show/hide country name code of ccp view.
*
* @param showNameCode true will show country name code in ccp view, it will result " (IN) +91 "
* false will remove country name code from ccp view, it will result " +91 "
*/
public void showNameCode(boolean showNameCode) {
this.showNameCode = showNameCode;
setSelectedCountry(selectedCountry);
}
/**
* This will set preferred countries using their name code. Prior preferred countries will be replaced by these countries.
* Preferred countries will be at top of country selection box.
* If more than one countries have same country code, country in preferred list will have higher priory than others. e.g. Canada and US have +1 as their country code. If "us" is set as preferred country then US will be selected whenever setCountryForPhoneCode(1); or setFullNumber("+1xxxxxxxxx"); is called.
*
* @param countryPreference is country name codes separated by comma. e.g. "us,in,nz"
*/
public void setCountryPreference(String countryPreference) {
this.countryPreference = countryPreference;
}
/**
* Language will be applied to country select dialog
* If autoDetectCountry is true, ccp will try to detect language from locale.
* Detected language is supported If no language is detected or detected language is not supported by ccp, it will set default language as set.
*
* @param language
*/
public void changeDefaultLanguage(Language language) {
setCustomDefaultLanguage(language);
}
/**
* To change font of ccp views
*
* @param typeFace
*/
public void setTypeFace(Typeface typeFace) {
try {
textView_selectedCountry.setTypeface(typeFace);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* To change font of ccp views along with style.
*
* @param typeFace
* @param style
*/
public void setTypeFace(Typeface typeFace, int style) {
try {
textView_selectedCountry.setTypeface(typeFace, style);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* To get call back on country selection a onCountryChangeListener must be registered.
*
* @param onCountryChangeListener
*/
public void setOnCountryChangeListener(OnCountryChangeListener onCountryChangeListener) {
this.onCountryChangeListener = onCountryChangeListener;
}
/**
* Modifies size of flag in CCP view
*
* @param flagSize size in pixels
*/
public void setFlagSize(int flagSize) {
imageViewFlag.getLayoutParams().height = flagSize;
imageViewFlag.requestLayout();
}
public void showFlag(boolean showFlag) {
this.showFlag = showFlag;
if (showFlag) {
linearFlagHolder.setVisibility(VISIBLE);
} else {
linearFlagHolder.setVisibility(GONE);
}
}
public void showFullName(boolean showFullName) {
this.showFullName = showFullName;
setSelectedCountry(selectedCountry);
}
/**
* SelectionDialogSearch is the facility to search through the list of country while selecting.
*
* @return true if search is set allowed
*/
public boolean isSearchAllowed() {
return searchAllowed;
}
/**
* SelectionDialogSearch is the facility to search through the list of country while selecting.
*
* @param searchAllowed true will allow search and false will hide search box
*/
public void setSearchAllowed(boolean searchAllowed) {
this.searchAllowed = searchAllowed;
}
/**
* Sets validity change listener.
* First call back will be sent right away.
*
* @param phoneNumberValidityChangeListener
*/
public void setPhoneNumberValidityChangeListener(PhoneNumberValidityChangeListener phoneNumberValidityChangeListener) {
this.phoneNumberValidityChangeListener = phoneNumberValidityChangeListener;
if (editText_registeredCarrierNumber != null) {
reportedValidity = isValidFullNumber();
phoneNumberValidityChangeListener.onValidityChanged(reportedValidity);
}
}
/**
* This function will check the validity of entered number.
* It will use PhoneNumberUtil to check validity
*
* @return true if entered carrier number is valid else false
*/
public boolean isValidFullNumber() {
try {
if (getEditText_registeredCarrierNumber() != null && getEditText_registeredCarrierNumber().getText().length() != 0) {
Phonenumber.PhoneNumber phoneNumber = PhoneNumberUtil.getInstance().parse("+" + selectedCountry.getPhoneCode() + getEditText_registeredCarrierNumber().getText().toString(), selectedCountry.getNameCode());
return PhoneNumberUtil.getInstance().isValidNumber(phoneNumber);
} else if (getEditText_registeredCarrierNumber() == null) {
Toast.makeText(context, "No editText for Carrier number found.", Toast.LENGTH_SHORT).show();
return false;
} else {
return false;
}
} catch (NumberParseException e) {
// when number could not be parsed, its not valid
return false;
}
}
/**
* loads current country in ccp using telephony manager
*/
public void selectCountryFromSimInfo() {
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String currentCountryISO = telephonyManager.getSimCountryIso();
setSelectedCountry(Country.getCountryForNameCodeFromLibraryMasterList(getContext(), getLanguageToApply(), currentCountryISO));
} catch (Exception e) {
Log.w(TAG, "applyCustomProperty: could not set country from sim");
}
}
/**
* Update every time new language is supported #languageSupport
*/
//add an entry for your language in attrs.xml's <attr name="language" format="enum"> enum.
//add here so that language can be set programmatically
public enum Language {
ARABIC("ar"), BENGALI("bn"), CHINESE_SIMPLIFIED("zh"), ENGLISH("en"), FRENCH("fr"), GERMAN("de"), GUJARATI("gu"), HINDI("hi"), JAPANESE("ja"), INDONESIA("in"), PORTUGUESE("pt"), RUSSIAN("ru"), SPANISH("es"), HEBREW("iw"), CHINESE_TRADITIONAL("zh"), KOREAN("ko"), UKRAINIAN("uk");
String code;
Language(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
/**
* When width is "match_parent", this gravity will decide the placement of text.
*/
public enum TextGravity {
LEFT(-1), CENTER(0), RIGHT(1);
int enumIndex;
TextGravity(int i) {
enumIndex = i;
}
}
/**
* interface to set change listener
*/
public interface OnCountryChangeListener {
void onCountrySelected();
}
/**
* Interface to check phone number validity change listener
*/
public interface PhoneNumberValidityChangeListener {
void onValidityChanged(boolean isValidNumber);
}
}
|
[
"[email protected]"
] | |
dda32d0eb7537758508ce28e0dde41f064d28a76
|
304a72fc82ad198e30fd5a287dbd6b26da725bc3
|
/baseio-balance/src/main/java/com/generallycloud/baseio/balance/facade/BalanceFacadeAcceptorHandler.java
|
05576e8626c51382e6feb6ef8eb5acd27598fb58
|
[
"Apache-2.0"
] |
permissive
|
ffjava/baseio
|
eb04d351df151a2177fa1be943fc8c3bd0549346
|
5a691f59732b756434bea7555d51c4e8ad6909ea
|
refs/heads/master
| 2021-01-19T17:09:57.521605 | 2017-08-22T03:27:48 | 2017-08-22T03:27:48 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,645 |
java
|
/*
* Copyright 2015-2017 GenerallyCloud.com
*
* 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.generallycloud.baseio.balance.facade;
import com.generallycloud.baseio.balance.BalanceContext;
import com.generallycloud.baseio.balance.BalanceFuture;
import com.generallycloud.baseio.balance.FacadeInterceptor;
import com.generallycloud.baseio.balance.NoneLoadFutureAcceptor;
import com.generallycloud.baseio.balance.reverse.BalanceReverseLogger;
import com.generallycloud.baseio.balance.reverse.BalanceReverseSocketSession;
import com.generallycloud.baseio.balance.router.BalanceRouter;
import com.generallycloud.baseio.component.ExceptionCaughtHandle;
import com.generallycloud.baseio.component.IoEventHandleAdaptor;
import com.generallycloud.baseio.component.SocketSession;
import com.generallycloud.baseio.log.Logger;
import com.generallycloud.baseio.log.LoggerFactory;
import com.generallycloud.baseio.protocol.Future;
public abstract class BalanceFacadeAcceptorHandler extends IoEventHandleAdaptor {
private Logger logger = LoggerFactory.getLogger(getClass());
private BalanceRouter balanceRouter;
private FacadeInterceptor facadeInterceptor;
private BalanceReverseLogger balanceReverseLogger;
private ExceptionCaughtHandle exceptionCaughtHandle;
private NoneLoadFutureAcceptor noneLoadReadFutureAcceptor;
public BalanceFacadeAcceptorHandler(BalanceContext context) {
this.balanceRouter = context.getBalanceRouter();
this.facadeInterceptor = context.getFacadeInterceptor();
this.balanceReverseLogger = context.getBalanceReverseLogger();
this.exceptionCaughtHandle = context.getFacadeExceptionCaughtHandle();
this.noneLoadReadFutureAcceptor = context.getNoneLoadReadFutureAcceptor();
}
@Override
public void accept(SocketSession session, Future future) throws Exception {
BalanceFacadeSocketSession fs = (BalanceFacadeSocketSession) session;
BalanceFuture f = (BalanceFuture) future;
if (facadeInterceptor.intercept(fs, f)) {
logger.info("msg intercepted [ {} ], msg: {}", fs.getRemoteSocketAddress(), f);
return;
}
BalanceReverseSocketSession rs = balanceRouter.getRouterSession(fs, f);
if (rs == null || rs.isClosed()) {
noneLoadReadFutureAcceptor.accept(fs, f, balanceReverseLogger);
return;
}
doAccept(fs, rs, f);
}
protected abstract void doAccept(BalanceFacadeSocketSession fs, BalanceReverseSocketSession rs,
BalanceFuture future);
protected void logDispatchMsg(BalanceFacadeSocketSession fs, BalanceReverseSocketSession rs,
BalanceFuture f) {
logger.info("dispatch msg: F:[ {} ],T:[ {} ], msg :{}",
new Object[] { fs.getRemoteSocketAddress(), rs.getRemoteSocketAddress(), f });
}
@Override
public void exceptionCaught(SocketSession session, Future future, Exception cause,
IoEventState state) {
exceptionCaughtHandle.exceptionCaught(session, future, cause, state);
}
}
|
[
"[email protected]"
] | |
e332e295883030be69edb493147e5f4efb4015f8
|
575dfd6ce3d56e411ac741c4eaa57363f12f9d9c
|
/src/main/java/com/vdshb/exceptions/PathNotFound.java
|
f8cc9f987f839af7f43fc8dc460cffa796e18b3f
|
[
"MIT"
] |
permissive
|
vadim-shb/spike-Shell
|
3601a00ce350421c74945d2500dccf9bc57c611c
|
92091b117804fe6d96567d7085a7aba25f9cf225
|
refs/heads/master
| 2020-05-19T09:27:49.891585 | 2017-07-22T09:07:01 | 2017-07-22T09:07:01 | 39,861,532 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 130 |
java
|
package com.vdshb.exceptions;
public class PathNotFound extends Exception {
public PathNotFound() {
super();
}
}
|
[
"[email protected]"
] | |
efe1441a7553c52032202156ed40bb35d3021718
|
dd7810b7d812e725ca74b587829162a6d1a9544f
|
/tarea4/src/com/example/tarea4/data/DBAdapter.java
|
74b15f185c2b979c4c3b916b93c56ce50623c4f6
|
[] |
no_license
|
aliciadc/SeminarioP1
|
2a77e8e95a9c6aa08086412d30ea485af76ef0f1
|
543a977e5820d4c1cc23b9f1f7ce62a539750816
|
refs/heads/master
| 2021-01-22T05:24:41.794099 | 2014-05-08T04:02:47 | 2014-05-08T04:02:47 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,996 |
java
|
package com.example.tarea4.data;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
public class DBAdapter {
private DBHelper dbHelper;
private static final String DATABASE_NAME= "tienda.db";
private static final int DATABASE_VERSION =2 ;
public DBAdapter (Context context){
dbHelper =(new DBHelper(context, DATABASE_NAME, null, DATABASE_VERSION));
}
public DBHelper getDbHelper() {
return dbHelper;
}
public void insert (String[] p){
ContentValues values = buildFromPlace(p);
SQLiteDatabase db = dbHelper.getWritableDatabase();
try {
db.insertWithOnConflict(DBHelper.TIENDA_TABLE, null, values, SQLiteDatabase.CONFLICT_IGNORE);
} finally{
db.close();
}
}
public int getTotalTiendas(String nTienda){
SQLiteDatabase db = dbHelper.getReadableDatabase();
String[] args = new String[]{nTienda};
Cursor cursor = db.query(DBHelper.TIENDA_TABLE , null,DBHelper.KEY_TIENDA_ID+"=?", args, null, null, null);
int total =cursor.getCount();
db.close();
cursor.close();
return total;
}
public String[] getInfoTienda(String nTienda){
SQLiteDatabase db = dbHelper.getReadableDatabase();
String[] args = new String[]{nTienda};
Cursor cursor = db.query(DBHelper.TIENDA_TABLE , null, DBHelper.KEY_TIENDA_ID+"=?", args, null, null, null);
String[] tienda = null;
while (cursor.moveToNext()){
tienda = new String[]{
cursor.getString(cursor.getColumnIndex(DBHelper.KEY_TIENDA_ID)),
cursor.getString(cursor.getColumnIndex(DBHelper.KEY_TIENDA_NAME)),
cursor.getString(cursor.getColumnIndex(DBHelper.KEY_TIENDA_ADDRESS)),
cursor.getString(cursor.getColumnIndex(DBHelper.KEY_TIENDA_EMAIL)),
cursor.getString(cursor.getColumnIndex(DBHelper.KEY_TIENDA_HORARIO)),
cursor.getString(cursor.getColumnIndex(DBHelper.KEY_TIENDA_PHONE)),
cursor.getString(cursor.getColumnIndex(DBHelper.KEY_TIENDA_WEB))
};
}
db.close();
cursor.close();
return tienda;
}
public ContentValues buildFromPlace(String[] p){
ContentValues values = new ContentValues();
values.put(DBHelper.KEY_TIENDA_ID, p[0]);
values.put(DBHelper.KEY_TIENDA_ADDRESS, p[1]);
values.put(DBHelper.KEY_TIENDA_EMAIL, p[2]);
values.put(DBHelper.KEY_TIENDA_HORARIO,p[3]);
values.put(DBHelper.KEY_TIENDA_NAME, p[4]);
values.put(DBHelper.KEY_TIENDA_PHONE, p[5]);
values.put(DBHelper.KEY_TIENDA_WEB, p[6]);
values.put(DBHelper.PHOTO, p[7]);
return values;
}
////// FAVORITOS
public int getTotalFavTiendas(String nTienda){
SQLiteDatabase db = dbHelper.getReadableDatabase();
String[] args = new String[]{nTienda};
Cursor cursor = db.query(DBHelper.FAV_TABLE , null,DBHelper.KEY_TIENDA_ID+"=?", args, null, null, null);
int total =cursor.getCount();
db.close();
cursor.close();
return total;
}
public ContentValues buildFromFav(String[] p){
ContentValues values = new ContentValues();
values.put(DBHelper.KEY_TIENDA_ID, p[0]);
values.put(DBHelper.KEY_NUM_FAV, p[1]);
return values;
}
public void insert_fav (String[] p){
ContentValues values = buildFromFav(p);
SQLiteDatabase db = dbHelper.getWritableDatabase();
try {
db.insertWithOnConflict(DBHelper.FAV_TABLE, null, values, SQLiteDatabase.CONFLICT_IGNORE);
} finally{
db.close();
}
}
public void updateFAV (String[] p){
ContentValues values = buildFromFav(p);
SQLiteDatabase db = dbHelper.getWritableDatabase();
try {
db.updateWithOnConflict(DBHelper.FAV_TABLE, values,
DBHelper.KEY_TIENDA_ID+"=?",new String[]{p[0]}, SQLiteDatabase.CONFLICT_IGNORE);
Log.e("adapre p0",p[0]);
Log.e("adapre p1o",p[1]);
} finally{
db.close();
}
}
/*
*
public void deleteAll(){
SQLiteDatabase db = dbHelper.getWritableDatabase();
try {
db.delete(DBHelper.PLACES_TABLE,null,null);
} finally{
db.close();}
}
* */
}
|
[
"[email protected]"
] | |
6df580d06ac374d25e1840f9a7bfd8501e7e9d98
|
71436ff8f2fe5a1fa328b1fc82250b26dd7f25bf
|
/src/com/garbagemule/MobArena/MobArena.java
|
be9a23d778bd43d76da8f3c176f615868784d573
|
[] |
no_license
|
DarkStorm652/MobArena
|
756ce8b572718e7e98ba352547f41542970c015f
|
94b1734f6a939bfd4ed69440b49c1077425a3f07
|
refs/heads/master
| 2021-01-18T10:21:31.057647 | 2011-07-20T23:18:47 | 2011-07-20T23:18:47 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,815 |
java
|
package com.garbagemule.MobArena;
import java.io.File;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.util.config.Configuration;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.garbagemule.register.payment.Method;
import com.garbagemule.register.payment.Methods;
/**
* MobArena
* @author garbagemule
*/
public class MobArena extends JavaPlugin
{
private Configuration config;
private ArenaMaster am;
// Permissions stuff
private PermissionHandler permissionHandler;
// Economy stuff
protected Methods Methods;
protected Method Method;
// Global variables
protected static final double MIN_PLAYER_DISTANCE = 256.0;
protected static final int ECONOMY_MONEY_ID = -29;
public void onEnable()
{
PluginDescriptionFile pdfFile = this.getDescription();
// Config, messages and ArenaMaster initialization
loadConfig();
MAMessages.init(this);
am = new ArenaMaster(this);
am.initialize();
// Permissions
setupPermissions();
// Economy
Methods = new Methods();
if (!Methods.hasMethod() && Methods.setMethod(this))
{
Method = Methods.getMethod();
System.out.println("[MobArena] Payment method found (" + Method.getName() + " version: " + Method.getVersion() + ")");
}
// Bind the /ma, /marena, and /mobarena commands to MACommands.
MACommands commandExecutor = new MACommands(this, am);
getCommand("ma").setExecutor(commandExecutor);
getCommand("marena").setExecutor(commandExecutor);
getCommand("mobarena").setExecutor(commandExecutor);
// Create event listeners.
PluginManager pm = getServer().getPluginManager();
PlayerListener playerListener = new MAPlayerListener(this, am);
EntityListener entityListener = new MAEntityListener(am);
BlockListener blockListener = new MABlockListener(am);
// Register events.
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_TELEPORT, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_KICK, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Priority.Highest, this);
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Priority.Highest, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.High, this); // mcMMO is "Highest"
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Lowest, this); // Lowest because of Tombstone
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.Highest, this);
pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_TARGET, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Highest, this);
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Monitor, this);
System.out.println("[MobArena] v" + pdfFile.getVersion() + " enabled." );
}
public void onDisable()
{
// Force all arenas to end.
for (Arena arena : am.arenas)
arena.forceEnd();
am.arenaMap.clear();
// Permissions & Economy
permissionHandler = null;
if (Methods != null && Methods.hasMethod())
{
Methods = null;
System.out.println("[MobArena] Payment method was disabled. No longer accepting payments.");
}
System.out.println("[MobArena] disabled.");
}
/**
* Load the config-file and initialize the Configuration object.
*/
private void loadConfig()
{
File file = new File(this.getDataFolder(), "config.yml");
if (!file.exists())
{
try
{
this.getDataFolder().mkdir();
file.createNewFile();
}
catch (Exception e)
{
e.printStackTrace();
return;
}
}
// TODO: Remove in v1.0
else
{
Configuration tmp = new Configuration(file);
tmp.load();
if (tmp.getKeys("global-settings") == null)
{
file.renameTo(new File(this.getDataFolder(), "config_OLD.yml"));
file = new File(this.getDataFolder(), "config.yml");
try
{
this.getDataFolder().mkdir();
file.createNewFile();
}
catch (Exception e)
{
e.printStackTrace();
return;
}
config = new Configuration(file);
config.load();
fixConfig();
config.setHeader("# MobArena Configuration-file\r\n# Please go to https://github.com/garbagemule/MobArena/wiki/Installing-MobArena for more details.");
config.save();
}
}
config = new Configuration(file);
config.load();
config.setHeader("# MobArena Configuration-file\r\n# Please go to https://github.com/garbagemule/MobArena/wiki/Installing-MobArena for more details.");
config.save();
}
// Permissions stuff
public boolean has(Player p, String s)
{
//return (permissionHandler != null && permissionHandler.has(p, s));
return (permissionHandler == null || permissionHandler.has(p, s));
}
public boolean hasDefTrue(Player p, String s)
{
return (permissionHandler == null || permissionHandler.has(p, s));
}
private void setupPermissions()
{
if (permissionHandler != null)
return;
Plugin permissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions");
if (permissionsPlugin == null) return;
permissionHandler = ((Permissions) permissionsPlugin).getHandler();
}
public Configuration getConfig() { return config; }
public ArenaMaster getAM() { return am; } // More convenient.
public ArenaMaster getArenaMaster() { return am; }
// TODO: Remove in v1.0
private void fixConfig()
{
// If global-settings is sorted, don't do anything.
if (config.getKeys("global-settings") != null)
return;
File oldFile = new File(this.getDataFolder(), "config_OLD.yml");
if (!oldFile.exists())
return;
System.out.println("[MobArena] Config-file appears to be old. Trying to fix it...");
Configuration oldConfig = new Configuration(oldFile);
oldConfig.load();
config.setProperty("global-settings.enabled", true);
config.save();
config.load();
config.setProperty("global-settings.update-notification", true);
config.save();
config.load();
// Copy classes
for (String s : oldConfig.getKeys("classes"))
{
config.setProperty("classes." + s + ".items", oldConfig.getString("classes." + s + ".items"));
config.setProperty("classes." + s + ".armor", oldConfig.getString("classes." + s + ".armor"));
}
config.save();
// Make the default arena node.
config.setProperty("arenas.default.settings.enabled", true);
config.save();
config.load();
config.setProperty("arenas.default.settings.world", oldConfig.getString("settings.world"));
config.save();
config.load();
// Copy the coords.
for (String s : oldConfig.getKeys("coords"))
{
if (s.equals("spawnpoints"))
continue;
StringBuffer buffy = new StringBuffer();
buffy.append(oldConfig.getString("coords." + s + ".x"));
buffy.append(",");
buffy.append(oldConfig.getString("coords." + s + ".y"));
buffy.append(",");
buffy.append(oldConfig.getString("coords." + s + ".z"));
buffy.append(",");
buffy.append(oldConfig.getString("coords." + s + ".yaw"));
buffy.append(",");
buffy.append(oldConfig.getString("coords." + s + ".pitch"));
config.setProperty("arenas.default.coords." + s, buffy.toString());
}
config.save();
config.load();
for (String s : oldConfig.getKeys("coords.spawnpoints"))
{
StringBuffer buffy = new StringBuffer();
buffy.append(oldConfig.getString("coords.spawnpoints." + s + ".x"));
buffy.append(",");
buffy.append(oldConfig.getString("coords.spawnpoints." + s + ".y"));
buffy.append(",");
buffy.append(oldConfig.getString("coords.spawnpoints." + s + ".z"));
buffy.append(",");
buffy.append(oldConfig.getString("coords.spawnpoints." + s + ".yaw"));
buffy.append(",");
buffy.append(oldConfig.getString("coords.spawnpoints." + s + ".pitch"));
config.setProperty("arenas.default.coords.spawnpoints." + s, buffy.toString());
}
config.save();
config.load();
System.out.println("[MobArena] Updated the config-file!");
}
}
|
[
"[email protected]"
] | |
a7e7d7c57afc3fdb1c24fd60307f80422d9191ea
|
c06f0e277e869361c5c3d2b7638864eb96d27212
|
/JavaEssential/src/com/itvdn/lesson3/task2/BadPupil.java
|
e73f12bee5eaffebc9c77122de9afdf71d2f3a88
|
[] |
no_license
|
Boginsky/ITVDN
|
ad8c81af63553a8d73b4d6a04cf956b1c149c39b
|
62167d670f73d812085b3ffd83dd7a362b3fe577
|
refs/heads/master
| 2023-03-13T09:27:22.881352 | 2021-03-01T13:46:30 | 2021-03-01T13:46:30 | 343,427,523 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 423 |
java
|
package com.itvdn.lesson3.task2;
public class BadPupil extends Pupil {
void study(){
System.out.println("Я плохо учусь");
}
void read(){
System.out.println("Я плохо умею читать");
}
void write(){
System.out.println("Я умею плохо писать");
}
void relax(){
System.out.println("Я много отдыхаю");
}
}
|
[
"[email protected]"
] | |
8b696b726d611c083f01d480dbfc23fd660df4c8
|
bb085a85dde85d66778a76d541622c888d3738b0
|
/src/main/java/com/sf/qzm/controller/back/WelcomeController.java
|
dc3188cfd76c8ff6990a5b9fb51bd86da880fddf
|
[] |
no_license
|
quzhaomei/qzm
|
c98c742a76445e68e4173a72e6aae4a3db7d8c0b
|
1e37f042114e42c1f49991b0d9a7565b44b803f4
|
refs/heads/master
| 2020-12-24T06:38:14.016867 | 2017-03-06T05:13:53 | 2017-03-06T05:13:53 | 56,830,076 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 23,321 |
java
|
package com.sf.qzm.controller.back;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.sf.qzm.annotation.LoginTag;
import com.sf.qzm.bean.admin.AdminUser;
import com.sf.qzm.bean.biz.Customer;
import com.sf.qzm.bean.biz.CustomerHouse;
import com.sf.qzm.bean.biz.Order;
import com.sf.qzm.bean.constant.Zone;
import com.sf.qzm.bean.login.LoginOutMessage;
import com.sf.qzm.bean.message.Notice;
import com.sf.qzm.controller.BaseController;
import com.sf.qzm.controller.biz.MyOrderController;
import com.sf.qzm.controller.biz.MyWorkController;
import com.sf.qzm.controller.biz.OrderController;
import com.sf.qzm.controller.biz.SaleCalculateController;
import com.sf.qzm.controller.biz.UserRelationController;
import com.sf.qzm.dto.ImgUploadResultDTO;
import com.sf.qzm.dto.JsonDTO;
import com.sf.qzm.dto.PageDTO;
import com.sf.qzm.dto.admin.AdminUserDTO;
import com.sf.qzm.dto.biz.CustomerDTO;
import com.sf.qzm.dto.biz.CustomerHouseDTO;
import com.sf.qzm.dto.menu.AutoMenuDTO;
import com.sf.qzm.service.AdminUserService;
import com.sf.qzm.service.AutoMenuService;
import com.sf.qzm.service.CustomerHouseService;
import com.sf.qzm.service.CustomerService;
import com.sf.qzm.service.OrderService;
import com.sf.qzm.service.SystemSourceService;
import com.sf.qzm.service.ZoneService;
import com.sf.qzm.util.context.SfContextUtils;
import com.sf.qzm.util.other.Constant;
import com.sf.qzm.util.other.JsonUtils;
import com.sf.qzm.util.other.PasswordUtils;
import com.sf.qzm.util.other.StringUtils;
@Controller
@RequestMapping("welcome")
@LoginTag
public class WelcomeController extends BaseController {
@Resource
private AdminUserService adminUserService;
@Resource
private AutoMenuService menuService;
@Resource
private OrderService orderService;
@RequestMapping(value = "/index")
public String index(HttpServletRequest request,
HttpServletResponse response, Model model) {
List<Notice> notices=new ArrayList<Notice>();
Customer cuParam= new Customer();
CustomerHouse huParam=new CustomerHouse();
//查找总客户数
if(hasPower(request, UserRelationController.CUSTOMER_INDEX_CODE)){
Notice notice=new Notice();
notice.setTitle("总客户数");
notice.setUrl("sysCustomer/customer-index.htmls?ajaxTag_=1");
notice.setMessage(customerService.count(cuParam)+"");
notices.add(notice);
}
//查找新日新增客户数
if(hasPower(request, UserRelationController.CUSTOMER_INDEX_CODE)){
cuParam.setCreateDate_start(new Date());
cuParam.setCreateDate_end(new Date());
Notice notice=new Notice();
notice.setTitle("今日新增客户数");
notice.setUrl("sysCustomer/customer-index.htmls?ajaxTag_=1");
notice.setMessage(customerService.count(cuParam)+"");
notices.add(notice);
}
//未分配客户
if(hasPower(request, UserRelationController.CUSTOMER_INDEX_CODE)){
cuParam=new Customer();
cuParam.setStatus(1);
Notice notice=new Notice();
notice.setTitle("未分配客户");
notice.setUrl("sysCustomer/customer-index.htmls?ajaxTag_=1");
notice.setMessage(customerService.count(cuParam)+"");
notices.add(notice);
}
//今日客服以处理客户
if(hasPower(request, UserRelationController.CUSTOMER_INDEX_CODE)){
cuParam=new Customer();
cuParam.setCreateDate_start(new Date());
cuParam.setCreateDate_end(new Date());
cuParam.setStatus(2);
int num2=customerService.count(cuParam);
cuParam.setStatus(3);
int num3=customerService.count(cuParam);
cuParam.setStatus(4);
int num4=customerService.count(cuParam);
cuParam.setStatus(5);
int num5=customerService.count(cuParam);
Notice notice=new Notice();
notice.setTitle("今日客服已处理客户");
notice.setUrl("sysCustomer/customer-index.htmls?ajaxTag_=1");
notice.setMessage(num2+num3+num4+num5+"");
notices.add(notice);
}
//今日发布需求总数
if(hasPower(request, UserRelationController.CUSTOMER_INDEX_CODE)){
huParam.setCreateDate_start(new Date());
huParam.setCreateDate_end(new Date());
int num1=customerHouseService.count(null, huParam, null);
huParam.setHasSoft(1);//软装
int num2=customerHouseService.count(null, huParam, null);
Notice notice=new Notice();
notice.setTitle("今日发布需求数");
notice.setUrl("sysCustomer/customer-index.htmls?ajaxTag_=1");
notice.setMessage(num1+num2+"");
notices.add(notice);
}
//今日已派单需求总数
if(hasPower(request, UserRelationController.CUSTOMER_INDEX_CODE)){
huParam.setCreateDate_start(new Date());
huParam.setCreateDate_end(new Date());
huParam.setStatus(2);
int num2=customerHouseService.count(null, huParam, null);
huParam.setHasSoft(1);//软装
huParam.setSoftStatus(1);
int num4=customerHouseService.count(null, huParam, null);
Notice notice=new Notice();
notice.setTitle("今日已派单需求数");
notice.setUrl("sysCustomer/customer-index.htmls?ajaxTag_=1");
notice.setMessage(num2+num4+"");
notices.add(notice);
}
Order orPram=new Order();
orPram.setCreateDate_start(getYearFirst(Calendar.getInstance().get(Calendar.YEAR)));
orPram.setCreateDate_end(getYearLast(Calendar.getInstance().get(Calendar.YEAR)));
//年度总订单数
if(hasPower(request, OrderController.ORDER_ALL)){
Notice notice=new Notice();
notice.setTitle("年度总订单数");
notice.setUrl("order/order-all.htmls?ajaxTag_=1");
notice.setMessage(orderService.count(orPram)+"");
notices.add(notice);
}
//年度佣金总额
if(hasPower(request, OrderController.ORDER_ALL)){
Notice notice=new Notice();
notice.setTitle("年度佣金总额");
notice.setUrl("order/order-all.htmls?ajaxTag_=1");
notice.setMessage(orderService.totalPrice(orPram, null,
null, null)+"");
notices.add(notice);
}
cuParam=new Customer();
cuParam.setServiceId(getLoginAdminUser(request).getAdminUserId());
//我负责的客户总数
if(hasPower(request, MyWorkController.MY_WORK_INDEX)){
Notice notice=new Notice();
notice.setTitle("我负责的客户总数");
notice.setUrl("myWork/myWork-customer-index.htmls?ajaxTag_=1");
notice.setMessage(customerService.count(cuParam)+"");
notices.add(notice);
}
cuParam.setServiceDate_start(new Date());
cuParam.setServiceDate_end(new Date());
//今日新分配到的客户总数
if(hasPower(request, MyWorkController.MY_WORK_INDEX)){
Notice notice=new Notice();
notice.setTitle("今日新分配到的客户");
notice.setUrl("myWork/myWork-customer-index.htmls?ajaxTag_=1");
notice.setMessage(customerService.count(cuParam)+"");
notices.add(notice);
}
//未回访客户
if(hasPower(request, MyWorkController.MY_WORK_INDEX)){
cuParam=new Customer();
cuParam.setServiceId(getLoginAdminUser(request).getAdminUserId());
cuParam.setStatus(2);
Notice notice=new Notice();
notice.setTitle("未回访客户");
notice.setUrl("myWork/myWork-customer-index.htmls?ajaxTag_=1");
notice.setMessage(customerService.count(cuParam)+"");
notices.add(notice);
}
//待跟进客户
if(hasPower(request, MyWorkController.MY_WORK_INDEX)){
cuParam=new Customer();
cuParam.setServiceId(getLoginAdminUser(request).getAdminUserId());
cuParam.setStatus(3);
Notice notice=new Notice();
notice.setTitle("待跟进客户");
notice.setUrl("myWork/myWork-customer-index.htmls?ajaxTag_=1");
notice.setMessage(customerService.count(cuParam)+"");
notices.add(notice);
}
//我已发布的需求数
if(hasPower(request, MyWorkController.MY_WORK_INDEX)){
huParam=new CustomerHouse();
int num1=customerHouseService.count(getLoginAdminUser(request).getAdminUserId(),
huParam, null);
huParam.setHasSoft(1);//软装
int num2=customerHouseService.count(getLoginAdminUser(request).getAdminUserId(), huParam, null);
Notice notice=new Notice();
notice.setTitle("我已发布的需求数");
notice.setUrl("sysCustomer/customer-index.htmls?ajaxTag_=1");
notice.setMessage(num1+num2+"");
notices.add(notice);
}
//我已派出的订单数
if(hasPower(request, MyOrderController.MY_ORDER)){
orPram=new Order();
orPram.setCreateUserId(getLoginAdminUser(request).getAdminUserId());
int num1=orderService.count(orPram);
Notice notice=new Notice();
notice.setTitle("我已派出的订单数");
notice.setUrl("myOrder/service-order.htmls?ajaxTag_=1");
notice.setMessage(num1+"");
notices.add(notice);
}
//已确认接单的订单数
if(hasPower(request, MyOrderController.MY_ORDER)){
orPram.setAcceptStatus(1);
int num1=orderService.count(orPram);
Notice notice=new Notice();
notice.setTitle("已确认接单的订单数");
notice.setUrl("myOrder/service-order.htmls?ajaxTag_=1");
notice.setMessage(num1+"");
notices.add(notice);
}
//待处理客户
if(hasPower(request, MyWorkController.MY_WORK_INDEX)){
cuParam=new Customer();
cuParam.setServiceId(getLoginAdminUser(request).getAdminUserId());
cuParam.setStatus(2);
PageDTO<Customer> page = new PageDTO<Customer>();
page.setPageIndex(1);
page.setPageSize(5);
page.setParam(cuParam);
page.setOrderBy("createDate");
page.setDirection("desc");
PageDTO<List<CustomerDTO>> datas = customerService.listByPage(page);
// 处理手机号码
AdminUserDTO user = adminUserService.checkPower("myWork-customer-mobile-show",
getLoginAdminUser(request).getAdminUserId());
if (datas.getParam() != null && user == null) {// 没有权限
hidePhone(datas.getParam());
}
model.addAttribute("needDo", datas);
}
//待发布需求的房产
if(hasPower(request, MyWorkController.MY_WORK_INDEX)){
huParam=new CustomerHouse();
huParam.setStatus(0);
PageDTO<CustomerHouse> page=new PageDTO<CustomerHouse>();
page.setPageIndex(1);
page.setPageSize(5);
page.setParam(huParam);
page.setOrderBy("createDate");
page.setDirection("desc");
PageDTO<List<CustomerHouseDTO>> result=customerHouseService.listAllByServiceAndPage
(getLoginAdminUser(request).getAdminUserId(), page, null, null,MyWorkController.HARD_TYPE_Id);
model.addAttribute("needHouse", result);
}
//待派单需求
if(hasPower(request, MyWorkController.MY_WORK_INDEX)){
huParam=new CustomerHouse();
huParam.setStatus(1);//待派单
PageDTO<CustomerHouse> page=new PageDTO<CustomerHouse>();
page.setPageIndex(1);
page.setPageSize(3);
page.setParam(huParam);
page.setOrderBy("createDate");
page.setDirection("desc");
PageDTO<List<CustomerHouseDTO>> result=customerHouseService.listByServiceAndPage
(getLoginAdminUser(request).getAdminUserId(), page, null, null,MyWorkController.HARD_TYPE_Id);
int hardSize=result.getParam()!=null?5-result.getParam().size():5;
huParam.setStatus(null);//待派单
huParam.setHasSoft(1);
huParam.setSoftStatus(0);
PageDTO<CustomerHouse> pageSoft=new PageDTO<CustomerHouse>();
pageSoft.setPageIndex(1);
pageSoft.setPageSize(hardSize);
pageSoft.setParam(huParam);
PageDTO<List<CustomerHouseDTO>> result2=customerHouseService.softListByServiceAndPage
(getLoginAdminUser(request).getAdminUserId(), pageSoft, null, null,MyWorkController.HARD_TYPE_Id);
PageDTO<List<CustomerHouseDTO>> resultTotal=new PageDTO<List<CustomerHouseDTO>>();
List<CustomerHouseDTO> datas=new ArrayList<CustomerHouseDTO>();
for(CustomerHouseDTO temp:result.getParam()){
temp.setHouseId(null);//标注为硬装
datas.add(temp);
}
for(CustomerHouseDTO temp:result2.getParam()){
datas.add(temp);
}
Collections.sort(datas, new Comparator<CustomerHouseDTO>() {
@Override
public int compare(CustomerHouseDTO o1, CustomerHouseDTO o2) {
return (int) (o2.getCreateDate()-o1.getCreateDate());
}
});
resultTotal.setPageIndex(1);
resultTotal.setPageSize(5);
resultTotal.setParam(datas);
resultTotal.setCount(result.getCount()+result2.getCount());
model.addAttribute("needRequired", resultTotal);
}
model.addAttribute("notices", notices);
model.addAttribute("loginUser", request.getSession().getAttribute(Constant.ADMIN_USER_SESSION));
return "admin/welcome";
}
public static Date getYearFirst(int year){
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
Date currYearFirst = calendar.getTime();
return currYearFirst;
}
/**
* 获取某年最后一天日期
* @param year 年份
* @return Date
*/
public static Date getYearLast(int year){
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
Date currYearLast = calendar.getTime();
return currYearLast;
}
@RequestMapping(value = "/update_self")
@ResponseBody
public JsonDTO updateSelf(String avatar,String nickname,String phone,String password,
HttpSession session) {
JsonDTO json=new JsonDTO();
AdminUserDTO user= (AdminUserDTO) session.getAttribute(Constant.ADMIN_USER_SESSION);
AdminUser update=new AdminUser();
update.setAdminUserId(user.getAdminUserId());
update.setAvatar(avatar);
update.setNickname(nickname);
update.setPhone(phone);
if(!StringUtils.isEmpty(password)){
update.setPassword(PasswordUtils.MD5(password));
}
try {
adminUserService.saveOrUpdate(update);
json.setStatus(1).setMessage("更新成功!");
if(avatar!=null){
user.setAvatar(avatar);
}
if(nickname!=null){
user.setNickname(nickname);
}
if(phone!=null){
user.setPhone(phone);
}
} catch (Exception e) {
json.setStatus(0).setMessage("更新失败!");
e.printStackTrace();
}
return json;
}
@Resource
private CustomerService customerService;
@Resource
private CustomerHouseService customerHouseService;
public static final String MY_CUSTOMER_URL="myWork/myWork-customer-index.htmls?ajaxTag_=1";
public static final String HARD_URL="myWork/hard-index.htmls?ajaxTag_=1";
public static final String SOFT_URL="myWork/soft-index.htmls?ajaxTag_=1";
@RequestMapping(value = "/dailyMessage")
@ResponseBody
public List<Notice> dailyMessage(HttpServletRequest request) {
List<Notice> list=new ArrayList<Notice>();
//查找新分配
Customer customer=new Customer();
customer.setStatus(2);//等待回访
customer.setServiceId(getLoginAdminUser(request).getAdminUserId());
int newTask=customerService.count(customer);
if(newTask>0){
Notice notice=new Notice().setMessage("您有"+newTask+"新分配的用户需要回访")
.setUrl(MY_CUSTOMER_URL);
list.add(notice);
}
customer.setStatus(3);//待跟进
int requireTask=customerService.count(customer);
if(requireTask>0){
Notice notice=new Notice().setMessage("您有"+requireTask+"个待跟进库客户需要处理")
.setUrl(MY_CUSTOMER_URL);
list.add(notice);
}
//房产发布
CustomerHouse customerHouse=new CustomerHouse();
customerHouse.setStatus(0);
int all=customerHouseService.allCount(customerHouse,getLoginAdminUser(request).getAdminUserId());
if(all>0){
Notice notice=new Notice().setMessage("您有"+all+"房产需求未发布")
.setUrl(MY_CUSTOMER_URL);
list.add(notice);
}
//硬装需求派单
customerHouse.setStatus(1);
int hard=customerHouseService.count(getLoginAdminUser(request).getAdminUserId(), customerHouse, SaleCalculateController.HARD_TYPE_Id);
if(hard>0){
Notice notice=new Notice().setMessage("您有"+hard+"个硬装需求尚未派单")
.setUrl(HARD_URL);
list.add(notice);
}
//软装需求派单
customerHouse.setStatus(null);
customerHouse.setSoftStatus(0);
customerHouse.setHasSoft(1);
int soft=customerHouseService.count(getLoginAdminUser(request).getAdminUserId(), customerHouse, SaleCalculateController.SOFT_TYPE_Id);
if(soft>0){
Notice notice=new Notice().setMessage("您有"+soft+"个软装需求尚未派单")
.setUrl(SOFT_URL);
list.add(notice);
}
return list;
}
/**
* 查询是否有此权限
* @param powerCode
* @return
*/
@RequestMapping(value = "/checkPower")
@ResponseBody
public JsonDTO checkPower(HttpServletRequest request, String powerCode,HttpSession session) {
String godPhone = SfContextUtils.getWebXmlParam(request, "godPhone");
JsonDTO json=new JsonDTO();
AdminUserDTO user= (AdminUserDTO) session.getAttribute(Constant.ADMIN_USER_SESSION);
if(user.getPhone().equals(godPhone)|| user.getMenuCodeMap().get(powerCode)!=null){
json.setStatus(1);//1为有权限,0表示没有权限
}else{
json.setStatus(0);//1为有权限,0表示没有权限
}
return json;
}
private boolean hasPower(HttpServletRequest request,String powerCode){
String godPhone = SfContextUtils.getWebXmlParam(request, "godPhone");
AdminUserDTO user= (AdminUserDTO) request.getSession().getAttribute(Constant.ADMIN_USER_SESSION);
if(user.getPhone().equals(godPhone)|| user.getMenuCodeMap().get(powerCode)!=null){
return true;
}else{
return false;
}
}
/**
*
* @param request
* @param response
* @param model
* @return json字符串
* logo:{image:"images/logo.svg",title:"我的后台管理",url:"url"},
user:{name:"游客",avatar:"images/avatar.jpg"},
menu:[{
icon:"icon-cog",
title:"系统设置",
url:"",
sequence:1,
childMenu:[
{title:"通用设定",url:"",sequence:1},
{title:"内容模块管理",url:"",sequence:2,},
{title:"角色及权限分配",url:"",sequence:3,},
{title:"后台菜单",url:"",sequence:4}
]
},
{icon:"icon-users",title:"用户管理",url:"",sequence:2,childMenu:[]}
],
menu_:[
{icon:"icon-earth",title:"站点信息设置",url:"",sequence:1,childMenu:[]},
]
}
*/
@ResponseBody
@RequestMapping(value="/menu-info")
public Map<String,Object> menuInfo(HttpServletRequest request, HttpSession session,
HttpServletResponse response, Model model) {
AdminUserDTO loginUser=(AdminUserDTO) session.getAttribute(Constant.ADMIN_USER_SESSION);
Map<String,Object> result=new HashMap<String, Object>();
//模拟数据
Map<String,String> user=new HashMap<String, String>();
user.put("name", loginUser.getNickname());
user.put("avatar", loginUser.getAvatar()==null?"/static/images/avatar.jpg":loginUser.getAvatar());
result.put("user", user);
Map<String,String> logo=new HashMap<String, String>();
logo.put("image", "/static/images/logo-admin.png");
logo.put("title", SfContextUtils.getSystemSourceByKey("title"));
logo.put("url", "welcome/index.htmls");
result.put("logo", logo);
//根据用户角色查找菜单
List<AutoMenuDTO> menuList=menuService.getAdminNavMenu(loginUser.getAdminUserId());
String godPhone = SfContextUtils.getWebXmlParam(request, "godPhone");
if(godPhone.equals(loginUser.getPhone())){//超级账号
menuList=menuService.getAdminNavMenu();
}
//拆分
List<AutoMenuDTO> menu=new ArrayList<AutoMenuDTO>();
List<AutoMenuDTO> menu_=new ArrayList<AutoMenuDTO>();
for(AutoMenuDTO temp:menuList){
if(temp.getExtend()!=null&&temp.getExtend()==1){
menu_.add(temp);
}else{
menu.add(temp);
}
}
result.put("menu", menu);
result.put("menu_", menu_);
return result;
}
@ResponseBody
@RequestMapping(value="/sss_check")
public LoginOutMessage checkLoginStatus(HttpSession session){
LoginOutMessage loginOut=new LoginOutMessage();
loginOut.setType(1);//正常状态
return loginOut;
}
@Resource
private ZoneService zoneService;
@ResponseBody
@RequestMapping(value="/getZone")
public List<Zone> getChildZone(Integer id){
List<Zone> zones=zoneService.list(id);
return zones;
}
@RequestMapping(value="/allZone")
public String allZone(String varible,Map<String,Object> model){
List<Map<String,Object>> zones=new ArrayList<Map<String, Object>>();
List<Zone> roots=zoneService.root();
for(Zone temp:roots){
Map<String,Object> tempRoot=new HashMap<String, Object>();
tempRoot.put("zoneId", temp.getZoneId());
tempRoot.put("name", temp.getName());
tempRoot.put("children", initChildren(temp.getZoneId()));
zones.add(tempRoot);
}
model.put("varible", varible);
model.put("value", JsonUtils.object2json(zones));
return "script";
}
private List<Map<String,Object>> initChildren(Integer parentId){
List<Map<String,Object>> result=new ArrayList<Map<String,Object>>();
List<Zone> children=zoneService.list(parentId);
if(children!=null&&children.size()>0){
for(Zone temp:children){
Map<String,Object> tempRoot=new HashMap<String, Object>();
tempRoot.put("zoneId", temp.getZoneId());
tempRoot.put("name", temp.getName());
tempRoot.put("children", initChildren(temp.getZoneId()));
result.add(tempRoot);
}
}
return result;
}
@Resource
private SystemSourceService sourceService;
private String tomcat_house=System.getProperty("catalina.base");//tomcat根目录
//上传图片
@RequestMapping(value = "/uploadSource/{mkdirs}")
@ResponseBody
public ImgUploadResultDTO uploadSource(@PathVariable(value="mkdirs") String mkdirs,
@RequestParam(value = "file") MultipartFile file, Model model) {
String rootPath=sourceService.getByKey("img_path");//获取全局配置,图片根目录
String orName=file.getOriginalFilename();
String houzui="";
if(orName.lastIndexOf(".")!=-1){
houzui=orName.substring(orName.lastIndexOf("."));
}
File parent = new File("/"+tomcat_house+"/"+rootPath+"/"+mkdirs );
if (!parent.exists()) {
parent.mkdirs();
}
String filename = UUID.randomUUID()+houzui;
File target = new File(parent, filename);
// 如果大于200K,则进行压缩
try {
FileUtils.copyInputStreamToFile(file.getInputStream(), target);
} catch (IOException e) {
e.printStackTrace();
}
ImgUploadResultDTO result=new ImgUploadResultDTO();
result.setError(0);
result.setUrl("/"+rootPath+"/"+mkdirs+"/"+filename);
// 回传结果
return result;
}
private void hidePhone(List<CustomerDTO> datas) {
for (CustomerDTO temp : datas) {
String phone = temp.getPhone();
temp.setPhone(StringUtils.hideMobile(phone));
}
}
}
|
[
"[email protected]"
] | |
e6013fecca5c9923e0d425f50fc18ecfdb0fe2fc
|
23503667cd8b3cbe943972f7b6353499b1b89405
|
/tools/forge/bean/src/main/java/org/switchyard/tools/forge/bean/BeanServicePlugin.java
|
669222e1ce11b35629645a96aff81041b97f99f5
|
[] |
no_license
|
carriagada113/switchyard-components
|
408d81e0b8409998b5943e2cccfb18dbcdb6974b
|
0747af55f20bacce184580b296ffd3b87553f3f4
|
refs/heads/master
| 2020-04-02T15:47:07.471563 | 2013-06-21T14:06:14 | 2013-06-21T14:06:14 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,350 |
java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* 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,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.switchyard.tools.forge.bean;
import javax.inject.Inject;
import org.jboss.forge.project.Project;
import org.jboss.forge.project.facets.MetadataFacet;
import org.jboss.forge.project.facets.ResourceFacet;
import org.jboss.forge.shell.PromptType;
import org.jboss.forge.shell.Shell;
import org.jboss.forge.shell.ShellColor;
import org.jboss.forge.shell.plugins.Alias;
import org.jboss.forge.shell.plugins.Command;
import org.jboss.forge.shell.plugins.Help;
import org.jboss.forge.shell.plugins.Option;
import org.jboss.forge.shell.plugins.PipeOut;
import org.jboss.forge.shell.plugins.Plugin;
import org.jboss.forge.shell.plugins.RequiresFacet;
import org.jboss.forge.shell.plugins.RequiresProject;
import org.jboss.forge.shell.plugins.Topic;
import org.switchyard.tools.forge.plugin.TemplateResource;
/**
* Forge plugin for Bean component commands.
*/
@Alias("bean-service")
@RequiresProject
@RequiresFacet({BeanFacet.class})
@Topic("SOA")
@Help("Provides commands to create, edit, and remove CDI-based services in SwitchYard.")
public class BeanServicePlugin implements Plugin {
// Template files used for bean services
private static final String BEAN_INTERFACE_TEMPLATE = "/org/switchyard/tools/forge/bean/BeanInterfaceTemplate.java";
private static final String BEAN_IMPLEMENTATION_TEMPLATE = "/org/switchyard/tools/forge/bean/BeanImplementationTemplate.java";
@Inject
private Project _project;
@Inject
private Shell _shell;
/**
* Create a new Bean service interface and implementation.
* @param serviceName service name
* @param out shell output
* @throws java.io.IOException trouble reading/writing SwitchYard config
*/
@Command(value = "create", help = "Created a new service backed by a CDI bean.")
public void newBean(
@Option(required = true,
name = "serviceName",
description = "The service name")
final String serviceName,
final PipeOut out)
throws java.io.IOException {
String pkgName = _project.getFacet(MetadataFacet.class).getTopLevelPackage();
if (pkgName == null) {
pkgName = _shell.promptCommon(
"Java package for service interface and implementation:",
PromptType.JAVA_PACKAGE);
}
// Create the service interface and implementation
TemplateResource beanIntf = new TemplateResource(BEAN_INTERFACE_TEMPLATE);
beanIntf.serviceName(serviceName);
String interfaceFile = beanIntf.writeJavaSource(
_project.getFacet(ResourceFacet.class), pkgName, serviceName, false);
out.println("Created service interface [" + interfaceFile + "]");
TemplateResource beanImpl = new TemplateResource(BEAN_IMPLEMENTATION_TEMPLATE);
beanImpl.serviceName(serviceName);
String implementationFile = beanImpl.writeJavaSource(
_project.getFacet(ResourceFacet.class), pkgName, serviceName + "Bean", false);
out.println("Created service implementation [" + implementationFile + "]");
// Notify user of success
out.println(out.renderColor(ShellColor.BLUE,
"NOTE: Run 'mvn package' to make " + serviceName + " visible to SwitchYard shell."));
}
}
|
[
"[email protected]"
] | |
8549defb1a9bc17d24c98c4daf8ae21a5d778611
|
5c9992f2f06d4d298d737bd6c1ae46cd82f04ae5
|
/src/ua/com/iteducate/java/basic/homework/l0002/SeaBattle.java
|
70a7d2ea002ad31c2de521db185370de23ba80d8
|
[] |
no_license
|
sontseslav/Homeworks
|
b0dbe31a2dd577c329c0e0cc6dfd484e55b3520a
|
4a049870a01f9b93713d41bd02e67de14884fa17
|
refs/heads/master
| 2021-01-10T03:36:43.749272 | 2015-07-20T19:26:05 | 2015-07-20T19:26:05 | 36,012,095 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 13,568 |
java
|
/*
*
*/
package ua.com.iteducate.java.basic.homework.l0002;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
/**
*
* @author user
*/
public class SeaBattle {
private char[][] gameField = new char[10][10];
private char[][] pcGameField = new char[10][10];
private boolean turn;
private boolean gameMustGoesOn = true;
private final char miss = '\u263B';
private final char ship = '\u2395';
private final char hittedShip = '\u2588';
private final char waves = '\u2248';
private final int maxShips = 20;
private String direction;
private int x,y;
String player;
public void start(){
for (int i = 0;i<10;i++){ //make sea
for (int j = 0;j<10;j++){
gameField[i][j] = waves;
}
}
Scanner reader = new Scanner(System.in);
Random rand = new Random();
System.out.println("Як Вас звати?");
player = reader.next();
showField();
makeFleet(reader); //fleet for player
makeFleet(rand); //fleet for pc
turn = rand.nextBoolean(); //throw a coin, who is first?
do{
turn = (turn) ? hit(reader) : hit(rand);
if (countDead(gameField))
System.out.println("Адмірал " +player+" програв \u2639");
if (countDead(pcGameField))
System.out.println("Адмірал "+player+" переміг \u263A");
}
while (gameMustGoesOn);
}
private void showField(){
System.out.println("x/y0 1 2 3 4 5 6 7 8 9");
for (int i = 0;i<10;i++){
System.out.println(i+" "+Arrays.toString(gameField[i])
.replace("[", "|").replace("]", "|").replace(",", "|")
.replace(" ", ""));
}
System.out.println("Адмірал: "+player);
}
private void showField(String pc){//debugging purpose
System.out.println("x/y0 1 2 3 4 5 6 7 8 9");
for (int i = 0;i<10;i++){
System.out.println(i+" "+Arrays.toString(pcGameField[i])
.replace("[", "|").replace("]", "|").replace(",", "|")
.replace(" ", "").replace("\u0000"," ").replace(ship, ' '));
}
System.out.println("Адмірал: "+pc);
}
private void makeFleet(Scanner reader){
for (int i =0;i<4;i++){
System.out.println("Ведіть координати однопалубного корабля (x y):");
y = reader.nextInt();
x = reader.nextInt();
if ((x > 9 | y > 9) || (gameField[y][x] == ship)){
i--;
System.out.println("Помилкові координати, або зіткнення з "
+ "існуючим кораблем");
continue;
}
else{
gameField[y][x] = ship;
showField();
}
}
for (int i =0;i<3;i++){
System.out.println("Ведіть координати корми і напрямок (-,|) "
+ "двопалубного корабля (x y d):");
y = reader.nextInt();
x = reader.nextInt();
direction = reader.next();
if (direction.contentEquals("-")){
if ((x > 9 | y > 9 | x+1 > 9) || (gameField[y][x] == ship |
gameField[y][x+1] == ship)){
i--;
System.out.println("Помилкові координати, або зіткнення з "
+ "існуючим кораблем");
continue;
}else{
gameField[y][x] = ship;
gameField[y][x+1] = ship;
showField();
}
}else{
if ((x > 9 | y > 9 | y+1 > 9) || (gameField[y][x] == ship |
gameField[y+1][x] == ship)){
i--;
System.out.println("Помилкові координати, або зіткнення з "
+ "існуючим кораблем");
continue;
}else{
gameField[y][x] = ship;
gameField[y+1][x] = ship;
showField();
}
}
}
for (int i =0;i<2;i++){
System.out.println("Ведіть координати корми і напрямок (-,|) "
+ "трьохпалубного корабля (x y d):");
y = reader.nextInt();
x = reader.nextInt();
direction = reader.next();
if (direction.contentEquals("-")){
if ((x > 9 | y > 9 | x+2 > 9) ||(gameField[y][x] == ship |
gameField[y][x+1] == ship | gameField[y][x+2]
== ship)){
i--;
System.out.println("Помилкові координати, або зіткнення з "
+ "існуючим кораблем");
continue;
}else{
gameField[y][x] = ship;
gameField[y][x+1] = ship;
gameField[y][x+2] = ship;
showField();
}
}else{
if ((x > 9 | y > 9 | y+2 > 9) ||(gameField[y][x] == ship |
gameField[y+1][x] == ship | gameField[y+2][x]
== ship)){
i--;
System.out.println("Помилкові координати, або зіткнення з "
+ "існуючим кораблем");
continue;
}else{
gameField[y][x] = ship;
gameField[y+1][x] = ship;
gameField[y+2][x] = ship;
showField();
}
}
}
for (int i =0;i<1;i++){
System.out.println("Ведіть координати корми і напрямок (-,|) "
+ "чотирьохпалубного корабля (x y d):");
y = reader.nextInt();
x = reader.nextInt();
direction = reader.next();
if (direction.contentEquals("-")){
if ((x > 9 | y > 9 | x+3 > 9) ||(gameField[y][x] == ship |
gameField[y][x+1] == ship | gameField[y][x+2]
== ship | gameField[y][x+3] == ship)){
i--;
System.out.println("Помилкові координати, або зіткнення з "
+ "існуючим кораблем");
continue;
}else{
gameField[y][x] = ship;
gameField[y][x+1] = ship;
gameField[y][x+2] = ship;
gameField[y][x+3] = ship;
showField();
}
}else{
if ((x > 9 | y > 9 | y+3 > 9) ||(gameField[y][x] == ship |
gameField[y+1][x] == ship | gameField[y+2][x]
== ship | gameField[y+3][x] == ship)){
i--;
System.out.println("Помилкові координати, або зіткнення з "
+ "існуючим кораблем");
continue;
}else{
gameField[y][x] = ship;
gameField[y+1][x] = ship;
gameField[y+2][x] = ship;
gameField[y+3][x] = ship;
showField();
}
}
}
}
private void makeFleet(Random rand){
boolean direction = false;
for (int i =0;i<4;i++){
y = rand.nextInt(10);
x = rand.nextInt(10);
if (x > 9 | y > 9 || pcGameField[y][x] == ship){
i--;
continue;
}
else{
pcGameField[y][x] = ship;
}
}
for (int i =0;i<3;i++){
y = rand.nextInt(10);
x = rand.nextInt(10);
direction = rand.nextBoolean();
if (direction){
if ((x > 9 | y > 9 | x+1 > 9) ||(pcGameField[y][x] == ship |
pcGameField[y][x+1] == ship)){
i--;
continue;
}else{
pcGameField[y][x] = ship;
pcGameField[y][x+1] = ship;
}
}else{
if ((x > 9 | y > 9 | y+1 > 9) ||(pcGameField[y][x] == ship |
pcGameField[y+1][x] == ship)){
i--;
continue;
}else{
pcGameField[y][x] = ship;
pcGameField[y+1][x] = ship;
}
}
}
for (int i =0;i<2;i++){
y = rand.nextInt(10);
x = rand.nextInt(10);
direction = rand.nextBoolean();
if (direction){
if ((x > 9 | y > 9 | x+2 > 9) ||(pcGameField[y][x] == ship |
pcGameField[y][x+1] == ship | pcGameField[y][x+2]
== ship)){
i--;
continue;
}else{
pcGameField[y][x] = ship;
pcGameField[y][x+1] = ship;
pcGameField[y][x+2] = ship;
}
}else{
if ((x > 9 | y > 9 | y+2 > 9) ||(pcGameField[y][x] == ship |
pcGameField[y+1][x] == ship | pcGameField[y+2][x]
== ship)){
i--;
continue;
}else{
pcGameField[y][x] = ship;
pcGameField[y+1][x] = ship;
pcGameField[y+2][x] = ship;
}
}
}
for (int i =0;i<1;i++){
y = rand.nextInt(10);
x = rand.nextInt(10);
direction = rand.nextBoolean();
if (direction){
if ((x > 9 | y > 9 | x+3 > 9) ||(pcGameField[y][x] == ship |
pcGameField[y][x+1] == ship | pcGameField[y][x+2]
== ship | pcGameField[y][x+3] == ship)){
i--;
continue;
}else{
pcGameField[y][x] = ship;
pcGameField[y][x+1] = ship;
pcGameField[y][x+2] = ship;
pcGameField[y][x+3] = ship;
}
}else{
if ((x > 9 | y > 9 | y+3 > 9) ||(pcGameField[y][x] == ship |
pcGameField[y+1][x] == ship | pcGameField[y+2][x]
== ship | pcGameField[y+3][x] == ship)){
i--;
continue;
}else{
pcGameField[y][x] = ship;
pcGameField[y+1][x] = ship;
pcGameField[y+2][x] = ship;
pcGameField[y+3][x] = ship;
}
}
}
showField("PC");// for debud only
}
private boolean hit(Scanner scan){//winner shoots twice
while (true){
System.out.println("Оберіть координати мішені (x y):");
y = scan.nextInt();
x = scan.nextInt();
if ((x > 9 | y > 9)||(pcGameField[y][x] == miss |
pcGameField[y][x] == hittedShip)){
System.out.println("Неправильні координати або сюди вже стріляли");
continue;
}else{
if (pcGameField[y][x] == ship){
pcGameField[y][x] = hittedShip;
showField("PC");
return true;
}else{
pcGameField[y][x] = miss;
showField("PC");
return false;
}
}
}
}
private boolean hit(Random rand){
while (true){
y = rand.nextInt(10);
x = rand.nextInt(10);
if ((x > 9 | y > 9)||(gameField[y][x] == miss |
pcGameField[y][x] == hittedShip)){
continue;
}else{
if (gameField[y][x] == ship){
gameField[y][x] = hittedShip;
showField();
return false;
}else{
gameField[y][x] = miss;
showField();
return true;
}
}
}
}
private boolean countDead(char[][] inputField){
int counter = 0;
for (int i = 0; i < 10; i++){
for (int j = 0; j < 10; j++){
if (inputField[i][j] == hittedShip) counter += 1;
}
}
if (counter == maxShips){
gameMustGoesOn = false;
return true;
}
return false;
}
public static void main(String[] args){
SeaBattle game = new SeaBattle();
game.start();
}
}
|
[
"[email protected]"
] | |
156bde36afb2024bac6245f344d5d31062ffcbbc
|
5630f1d7e15364e5ad3ce81b35f6830843c6e219
|
/src/test/java/org/robolectric/shadows/MessengerTest.java
|
78971581256fb5a42399e77fdf65ad24b102f6fb
|
[
"MIT"
] |
permissive
|
qx/FullRobolectricTestSample
|
f0933149af29d37693db6e8da795a64c2e468159
|
53e79e4de84bbe4759a09a275d890b413ce757e7
|
refs/heads/master
| 2021-07-03T16:07:17.380802 | 2014-06-16T23:22:01 | 2014-06-16T23:22:01 | 20,903,797 | 2 | 3 |
MIT
| 2021-06-04T01:07:56 | 2014-06-16T23:20:19 |
Java
|
UTF-8
|
Java
| false | false | 758 |
java
|
package org.robolectric.shadows;
import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.TestRunners;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(TestRunners.WithDefaults.class)
public class MessengerTest {
@Test
public void testMessengerSend() throws Exception {
Handler handler = new Handler();
Messenger messenger = new Messenger(handler);
ShadowLooper.pauseMainLooper();
Message msg = Message.obtain(null, 123);
messenger.send(msg);
assertTrue(handler.hasMessages(123));
ShadowHandler.runMainLooperOneTask();
assertFalse(handler.hasMessages(123));
}
}
|
[
"[email protected]"
] | |
8383cddf570a77a377f3c91896bdb4c17531b28a
|
b158361a0f5def782ad0c8831245ed6fed4d0892
|
/presto-druid/src/main/java/com/facebook/presto/druid/segment/SegmentReader.java
|
f5c0153e95fd31f7245b02527e242b57a53e06e5
|
[
"Apache-2.0"
] |
permissive
|
pigxuyu/presto
|
e16409962be1c824d7259ee4f5b3d06445d4445d
|
4178b27e23ec85c489a493cd6552e76054007739
|
refs/heads/master
| 2021-05-23T11:03:06.418206 | 2020-04-10T08:04:39 | 2020-04-10T08:04:39 | 254,322,783 | 1 | 0 |
Apache-2.0
| 2020-04-09T09:06:41 | 2020-04-09T09:06:40 | null |
UTF-8
|
Java
| false | false | 801 |
java
|
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.druid.segment;
import com.facebook.presto.spi.block.Block;
import com.facebook.presto.spi.type.Type;
public interface SegmentReader
{
int nextBatch();
Block readBlock(Type type, String columnName);
}
|
[
"[email protected]"
] | |
64f2f2ee58b07a19dd22a77046c35c4ca824b577
|
32b432248ee60c09e3a48a635083a0fa54deef82
|
/decor/padl/event/ElementEvent.java
|
217047f1cbfe2d89ae97ce881a69584ff6eb5338
|
[] |
no_license
|
carloseduardoxp/GitMiner
|
eb11d397316c6d58ad96d17f66466a4aafd7102b
|
c326221ceb681445c81fb5bff57dc02a8b8ef6f4
|
refs/heads/master
| 2020-09-27T23:05:42.691185 | 2016-12-03T00:35:02 | 2016-12-03T00:35:02 | 66,943,583 | 3 | 0 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 1,146 |
java
|
/*******************************************************************************
* Copyright (c) 2001-2014 Yann-Gaël Guéhéneuc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v2.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* Yann-Gaël Guéhéneuc and others, see in file; API and its implementation
******************************************************************************/
package padl.event;
import padl.kernel.IConstituentOfEntity;
import padl.kernel.IContainer;
public final class ElementEvent implements IEvent {
private final IContainer aContainer;
private final IConstituentOfEntity anElement;
public ElementEvent(
final IContainer aContainer,
final IConstituentOfEntity anElement) {
this.aContainer = aContainer;
this.anElement = anElement;
}
public IConstituentOfEntity getElement() {
return this.anElement;
}
public IContainer getContainer() {
return this.aContainer;
}
}
|
[
"carloseduardoxp@carloseduardoxp-Inspiron-5547"
] |
carloseduardoxp@carloseduardoxp-Inspiron-5547
|
d2e1bb85ca2ac3d8bb3bfa59cd773d6d1e61b42f
|
b64fd694013416a4504dd11ffa9330a8637a9942
|
/src/baekjoon/baekjoon_10871.java
|
f3cbcf2b721a7eeca38ea535b1d94a0cd411c40f
|
[] |
no_license
|
ChaeAh/BOJ_PRC
|
b04187dc3480abd0d36b2bed5acd5a2285db1b99
|
3a8f25f5f1942862411f7f88877b18c8ddd50588
|
refs/heads/main
| 2023-07-23T09:23:40.826697 | 2021-08-19T05:35:00 | 2021-08-19T05:35:00 | 397,445,547 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 758 |
java
|
package baekjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class baekjoon_10871 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine()," ");
StringBuilder sb= new StringBuilder();
int N = Integer.parseInt(st.nextToken()); // N
int X = Integer.parseInt(st.nextToken()); // X
st = new StringTokenizer(br.readLine(), " ");
for(int i=0; i<N; i++) {
int comp = Integer.parseInt(st.nextToken());
if( comp <X) {
sb.append(comp).append(" ");
}
}
System.out.println(sb.toString());
}
}
|
[
"[email protected]"
] | |
f7e3ddd47c7f53130248234cf0299415d8aa50bf
|
6fc1240c9ae2a7b3d8eead384668e1f4b58d47da
|
/assignments/izal/unit2/HW14_Mongodb/TouristGuest/src/ec/edu/espe/contacts/model/Client.java
|
33510921b33b2efcf416f2e0f5829618306d9865
|
[] |
no_license
|
elascano/ESPE202105-OOP-TC-3730
|
38028e870d4de004cbbdf82fc5f8578126f8ca32
|
4275a03d410cf6f1929b1794301823e990fa0ef4
|
refs/heads/main
| 2023-08-09T13:24:26.898865 | 2021-09-13T17:08:10 | 2021-09-13T17:08:10 | 371,089,640 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,349 |
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 ec.edu.espe.contacts.model;
import java.time.LocalDateTime;
import java.util.ArrayList;
/**
*
* @author LILIAN IZA TOURIST GUEST OPP-ESPE
*/
public class Client {
private String firstName;
private String lastName;
private String password;
private String phoneNumber;
private String gender;
private ArrayList<Activity> activity ;
private LocalDateTime birthday;
private int monthIknewThisClient;
public Client(String firstName, String lastName, String password, String phoneNumber, String gender, ArrayList<Activity> activity, LocalDateTime birthday, int monthIknewThisClient) {
this.firstName = firstName;
this.lastName = lastName;
this.password = password;
this.phoneNumber = phoneNumber;
this.gender = gender;
this.activity = activity;
this.birthday = birthday;
this.monthIknewThisClient = monthIknewThisClient;
}
/**
* @return the firstName
*/
public String getFirstName() {
return firstName;
}
/**
* @param firstName the firstName to set
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* @return the lastName
*/
public String getLastName() {
return lastName;
}
/**
* @param lastName the lastName to set
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the phoneNumber
*/
public String getPhoneNumber() {
return phoneNumber;
}
/**
* @param phoneNumber the phoneNumber to set
*/
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
/**
* @return the gender
*/
public String getGender() {
return gender;
}
/**
* @param gender the gender to set
*/
public void setGender(String gender) {
this.gender = gender;
}
/**
* @return the activity
*/
public ArrayList<Activity> getActivity() {
return activity;
}
/**
* @param activity the activity to set
*/
public void setActivity(ArrayList<Activity> activity) {
this.activity = activity;
}
/**
* @return the birthday
*/
public LocalDateTime getBirthday() {
return birthday;
}
/**
* @param birthday the birthday to set
*/
public void setBirthday(LocalDateTime birthday) {
this.birthday = birthday;
}
/**
* @return the monthIknewThisClient
*/
public int getMonthIknewThisClient() {
return monthIknewThisClient;
}
/**
* @param monthIknewThisClient the monthIknewThisClient to set
*/
public void setMonthIknewThisClient(int monthIknewThisClient) {
this.monthIknewThisClient = monthIknewThisClient;
}
}
|
[
"[email protected]"
] | |
81217551590c16dcb09a08ecacabe535d9369735
|
b64c2872734c0c7e33f5d67f46989e7da1983428
|
/SpringBoot-WebSocket/src/main/java/gew/server/websocket/entity/ChatMessage.java
|
a8f8c16849fb6e81d0e0a31f55e4dacbc11226bb
|
[
"Apache-2.0"
] |
permissive
|
Jason-Gew/Java_Modules
|
2422e1831ceefbc48d07b2fbf65ad21035fcf8f3
|
4f7a2e06edffe327d1501ada63e43324341b123d
|
refs/heads/master
| 2022-12-13T23:29:51.437741 | 2021-09-06T14:07:43 | 2021-09-06T14:07:43 | 98,828,727 | 4 | 0 |
Apache-2.0
| 2022-12-06T00:41:47 | 2017-07-30T22:37:33 |
Java
|
UTF-8
|
Java
| false | false | 821 |
java
|
package gew.server.websocket.entity;
public class ChatMessage
{
private MessageType type;
private String content;
private String sender;
public enum MessageType {
CHAT,
JOIN,
LEAVE
}
public MessageType getType() { return type; }
public void setType(MessageType type) { this.type = type; }
public String getContent() { return content; }
public void setContent(String content) { this.content = content; }
public String getSender() { return sender; }
public void setSender(String sender) { this.sender = sender; }
@Override
public String toString() {
return "ChatMessage{" +
"type=" + type +
", content='" + content + '\'' +
", sender='" + sender + '\'' +
'}';
}
}
|
[
"[email protected]"
] | |
fdf7ca3aea767288f9c229221124f3b02085aa09
|
508a409addcf5afb84e57bbc3b88abc4ed8dea2a
|
/app/src/main/java/com/tcl/base/Config.java
|
de46a8d6f255eceeca8764b7c802286bf3fc52da
|
[] |
no_license
|
yangfeihu/RxjavaProject
|
72ab3438cffde5d8e7b2cc2118eff2dad3a10036
|
b983e8997208768ccd8dea80c10723d30780b4ba
|
refs/heads/master
| 2021-07-04T22:42:51.053712 | 2018-07-02T02:27:42 | 2018-07-02T02:27:42 | 96,280,693 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,292 |
java
|
package com.tcl.base;
/**
* Created by yangfeihu on 16/4/23.
*/
public class Config {
public static String BASE_URL = "http://172.19.0.11:8080/";
// 正确的Http请求返回状态码
public final static int CODE_SUCCESS = 0;
// 未知的错误 或者系统内部错误
public final static int CODE_ERROE = 1;
//token错误
public final static int CODE_NO_TOKEN = 1001;
public final static int CODE_TOKEN_ERROR = 1002;
//JSON属性,可以根据需求修改
public static final String RESULT_CODE = "returncode";//返回码
public static final String RESULT_MSG = "returnmsg";//返回的信息
public static final String RESULT_DATA = "data";//返回的数据
//列表页面属性,可以根据需求修改
public static final String PARA_PAGE_INDEX = "page_index";
public static final String PARA_PAGE_SIZE = "page_size";
public static final int PAGE_SIZE = 20;
public static final int FLAG_MULTI_VH = 0x000001;
public static final String PAGE = "page";
public static final int PAGE_COUNT = 10;
//log控制开关
public static final boolean isDebug = true;
//渠道配置
public static final String CHANNEL_NAME = "CHANNEL";
public static final String DEF_CHANNEL_NAME = "TCL";
}
|
[
"[email protected]"
] | |
7d22ca880d5dcdf665723112c39a5ae5487b361b
|
8560b9154247e7a7d9524c649001987f012916e5
|
/app/src/main/java/com/jeff/newtonianappproject/GravityAct.java
|
c8f8781ac91a4f887cef8c319f61f615b6297f43
|
[] |
no_license
|
s3F15/NewtoniaNProject
|
03d50743e12eeeea742930e5293b6754428ced27
|
057babb20c6fb0a118eacb1cc66e32622ef6a58a
|
refs/heads/master
| 2020-03-17T19:01:17.518345 | 2018-05-17T19:44:10 | 2018-05-17T19:44:10 | 133,841,878 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 768 |
java
|
package com.jeff.newtonianappproject;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class GravityAct extends AppCompatActivity {
private Button animapagebtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gravity);
animapagebtn = (Button)findViewById(R.id.gravityvidbtn);
animapagebtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(GravityAct.this, GravityVideo.class));
}
});
}
}
|
[
"[email protected]"
] | |
52f54c9c0043062b130ccc380a4bd1a82e5e5a56
|
deb6f7cbffe4ce4c916470646036ea38bbf3b314
|
/VijayaLakshmiBandi/Day10/SpringBootWithHibernateDemo/src/main/java/com/model/EmployeeModel.java
|
ebfa3e0c931ceaf15cfbddaaa7fcc7f4dae05005
|
[] |
no_license
|
USTGLOBLE-2020/springassignments
|
805956d995c0601930ebb64659ac0327856d0b53
|
d0e98af9b1053e7e153dd073b983c4cfa4017ca3
|
refs/heads/master
| 2022-12-20T11:43:37.680268 | 2020-10-28T12:23:04 | 2020-10-28T12:23:04 | 301,422,153 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 792 |
java
|
package com.model;
public class EmployeeModel {
private int id;
private String firstName;
private String lastName;
private int salary;
public EmployeeModel() {
}
public EmployeeModel(String fName, String lName, int eSalary) {
this.firstName = fName;
this.lastName = lName;
this.salary = eSalary;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getSalary() {
return salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
}
|
[
"[email protected]"
] | |
70bc76e3412b23bb38ca0dbc07a65212d8ae8b4e
|
cbc7f5b1f0ec0f07700aedf8f37b1a3fd79fb191
|
/12_septiembre/henryZerda/src/Directory.java
|
4b2b0fce125f4bfd0731bb1febbf64eab852972e
|
[] |
no_license
|
henryzrr/arquitectura_software
|
831328f73edfba926471b499897f6b3394804f8e
|
e20ff182bd8ac887540cb94b4aac85df55893cbd
|
refs/heads/master
| 2020-07-09T03:24:41.965384 | 2019-10-07T16:22:29 | 2019-10-07T16:22:29 | 203,859,734 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,253 |
java
|
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
class Directory {
private String name;
private String path;
Directory(String path,String name){
this.path=path;
this.name=name;
}
List<String> getFiles() throws Exception{
List<String> files;
try (Stream<Path> walk = Files.walk(Paths.get(path))) {
files = walk.filter(Files::isRegularFile)
.map(Path::toString).collect(Collectors.toList());
} catch (Exception e) {
throw new Exception("dir error, Direccion ingresada en bob.conf para "+name+" no válida");
}
return files;
}
List<String> getDirectories() throws Exception{
List<String> directories;
try (Stream<Path> walk = Files.walk(Paths.get(path))) {
directories = walk.filter(Files::isDirectory)
.map(Path::toString).collect(Collectors.toList());
} catch (Exception e) {
throw new Exception("dir error, Direccion ingresada en bob.conf para "+name+" no válida");
}
return directories;
}
String getPath() {
return path;
}
List<String> getOneFileType(String fileType) throws Exception {
List<String> result;
try (Stream<Path> walk = Files.walk(Paths.get(path))) {
result = walk.map(Path::toString)
.filter(f -> f.endsWith("."+fileType)).collect(Collectors.toList());
} catch (Exception e) {
throw new Exception("dir error, Direccion ingresada en bob.conf para "+name+" no válida");
}
return result;
}
List<String> getOneFileTypeRelativePath(String fileType) throws Exception {
List<String> files = getOneFileType(fileType);
List<String> trimmedFiles = new LinkedList<>();
String relativeFile;
for (String file: files
) {
int sizePath = path.length();
relativeFile = file.substring(sizePath+1);
trimmedFiles.add(relativeFile);
}
return trimmedFiles;
}
}
|
[
"[email protected]"
] | |
75594d3f336bb10abd930342f3be4828301e271c
|
9c3b24cd9bb4721146b70429253e32bed625cad1
|
/src/main/java/com/usit/service/PointHistoryService.java
|
ee1b1073a4d0b0ac8d7bfc17db4e562caa0ccc53
|
[] |
no_license
|
lsc15/usit_api
|
3f243cbe80802e8818ebe6a4e6c9e50b3042900d
|
f8025c0a28716146f75dcb5901e1b3e90117e30c
|
refs/heads/master
| 2020-03-19T23:48:31.149139 | 2019-11-07T06:58:35 | 2019-11-07T06:58:35 | 137,020,484 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 462 |
java
|
package com.usit.service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import com.usit.domain.PointHistory;
public interface PointHistoryService {
PointHistory addPoint(PointHistory point);
//이벤트
void addPointEvent(PointHistory point);
Page<PointHistory> getPointListByMemberId(PageRequest page,int member);
Page<PointHistory> getPointSummaryByMemberId(PageRequest page,int member);
}
|
[
"[email protected]"
] | |
027b5fa9b9b699a1ad6c941a34ca03d26de4136c
|
bac1bf7f7e960b29c69cfe05ecf9f89dab7d82ca
|
/app/src/main/java/com/reStock/app/Distributor.java
|
04c016529aed22ff593b376048e62f6033ede1b4
|
[] |
no_license
|
shlomi123/reStock
|
c9ab8a527a88f7144cd5e253334bb05d49781d50
|
ca4d042cc9917aad1ace51bba97ecc0de3fcc5f5
|
refs/heads/master
| 2020-05-30T09:25:51.027816 | 2019-07-15T10:35:38 | 2019-07-15T10:35:38 | 189,630,894 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 747 |
java
|
package com.reStock.app;
public class Distributor {
private String name;
private String email;
private String profile;
public Distributor(){
}
public Distributor(String name, String email, String profile)
{
this.name = name;
this.email = email;
this.profile = profile;
}
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
|
[
"[email protected]"
] | |
bbb88e75786f8612a3e749baef90e8306c674f80
|
b3b69669b39c064d7bdee549490140203faaa527
|
/src/main/java/com/yangrui/shark/security/service/MyUserDetailsService.java
|
e827eb1986b999e693e60648e8e7bdd266846f12
|
[] |
no_license
|
yr602294677/shark
|
16dd6278dd5f4e5ec573f978fbad4104dfdc9b24
|
9ba185a4c5795b66209e74a46a7ee62624de7f38
|
refs/heads/master
| 2022-06-29T06:31:09.643011 | 2022-03-07T12:27:45 | 2022-03-07T12:27:45 | 219,458,161 | 2 | 1 | null | 2022-06-17T02:37:55 | 2019-11-04T08:59:28 |
JavaScript
|
UTF-8
|
Java
| false | false | 1,114 |
java
|
package com.yangrui.shark.security.service;
import com.yangrui.shark.security.bean.MyUserBean;
import com.yangrui.shark.security.mapper.MyUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
/**
* Created by wxb on 2018/10/23 0023.
* UserDetailsService的实现类,用于在程序中引入一个自定义的AuthenticationProvider,实现数据库访问模式的验证
*
*/
@Service
public class MyUserDetailsService implements UserDetailsService {
@Autowired
MyUserMapper mapper;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
MyUserBean userBean = mapper.selectByUsername(username);
if (userBean == null) {
throw new UsernameNotFoundException("数据库中无此用户!");
}
return userBean;
}
}
|
[
"[email protected]"
] | |
3a7d40e5409271f70ed0c3819c1da54b7603f153
|
97c7ac8b8ab9161d788537cb85ca4274523c1d05
|
/.svn/pristine/15/154eb85b7b62dd069aff11f0fb22340a3ad1183c.svn-base
|
98235116a9b0d99af2d4413c2b39f584e38c2117
|
[] |
no_license
|
asroboy/sigma_migrasi
|
1e635dc92b814e92e428f4f6b1b33d86cf000658
|
c4ad4dfa2d3db27616db9a63566b00d0c559e88d
|
refs/heads/master
| 2020-04-18T11:25:18.787942 | 2019-01-25T06:56:08 | 2019-01-25T06:56:08 | 167,499,107 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,355 |
/*
* 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 model.metadata.xml.identificationinfo.extent;
/**
*
* @author WIN8
*/
public class ExGeographicBoundingBox {
private String subParent;
private String current="gmd:EX_GeographicBoundingBox";
private String extentTypeCode="gmd:extentTypeCode.gco:Boolean";
private String westBoundLongitude="gmd:westBoundLongitude.gco:Decimal";
private String eastBoundLongitude="gmd:eastBoundLongitude.gco:Decimal";
private String southBoundLatitude="gmd:southBoundLatitude.gco:Decimal";
private String northBoundLatitude="gmd:northBoundLatitude.gco:Decimal";
public ExGeographicBoundingBox(String parent) {
subParent = parent+"."+current;
}
public String ExtentTypeCode() {
return subParent+"."+extentTypeCode;
}
public String WestBoundLongitude() {
return subParent+"."+westBoundLongitude;
}
public String EastBoundLongitude() {
return subParent+"."+eastBoundLongitude;
}
public String SouthBoundLatitude() {
return subParent+"."+southBoundLatitude;
}
public String NorthBoundLatitude() {
return subParent+"."+northBoundLatitude;
}
}
|
[
"Asrofi Ridho"
] |
Asrofi Ridho
|
|
77beea30225467efb4e04076c943572d82eaea81
|
42256c65accfea4339706cb4c710a88e92d9ec5c
|
/src/factoryPattern/BigUFOEnemyShip.java
|
205a47efe833f6a2a77b92d64d9dff5ecf5eadad
|
[] |
no_license
|
pymd/DesignPatterns
|
132ee35573cc7b86b96c1d35b884028f4a26e649
|
e6381c6efd54fc7a4a174b429933a5cac1ea7687
|
refs/heads/master
| 2020-05-18T16:38:56.749758 | 2019-05-26T09:15:07 | 2019-05-26T09:15:07 | 184,532,107 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 180 |
java
|
package factoryPattern;
public class BigUFOEnemyShip extends UFOEnemyShip{
public BigUFOEnemyShip(){
setName("Big UFO Enemyship");
setAmtDamage(40.0);
}
}
|
[
"[email protected]"
] | |
efc144e7c647ee91e87bb689ed48751dc084e60c
|
f9eeaf929a848deca695b64633a250f2bc768aeb
|
/VotingServer/src/com/btv/admin/ShowPost.java
|
bdc3d4f7bd2c4f88ddcb47fce0282d9c72f101f0
|
[] |
no_license
|
Akavakon72/Online-Voting-App
|
2da8313fadf0a4cfd2c6a8fbb6c99198f5e7a698
|
edcc00baf83e5df0a99b2a27dc54ba179f93dd06
|
refs/heads/master
| 2020-06-08T02:38:09.851937 | 2019-06-21T18:48:35 | 2019-06-21T18:48:35 | 193,143,016 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,500 |
java
|
package com.btv.admin;
import java.awt.HeadlessException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import org.btv.conn.ConnectionClass;
public class ShowPost extends javax.swing.JDialog {
/**
* Creates new form Login
*/
static Connection conn;
static Statement stm;
public ShowPost(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
fillTable();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
but_add = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Add Department");
setIconImages(null);
getContentPane().setLayout(null);
but_add.setText("Exit");
but_add.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
but_addMouseClicked(evt);
}
});
but_add.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
but_addActionPerformed(evt);
}
});
getContentPane().add(but_add);
but_add.setBounds(520, 250, 91, 30);
model = new javax.swing.table.DefaultTableModel();
jTable1.setModel(model);
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(30, 20, 580, 210);
setSize(new java.awt.Dimension(663, 369));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void but_addMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_but_addMouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_but_addMouseClicked
private void but_addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_but_addActionPerformed
dispose();
}//GEN-LAST:event_but_addActionPerformed
private void fillTable() {
model = new DefaultTableModel();
model.addColumn("Sr. No.");
model.addColumn("Department");
model.addColumn("Post");
model.addColumn("Candidate-1");
model.addColumn("Candidate-2");
model.addColumn("Candidate-3");
ResultSet departments = new ConnectionClass().getPostData();
try {
while (departments.next()) {
Vector row = new Vector();
row.add(departments.getString(1));
row.add(departments.getString(2));
row.add(departments.getString(3));
row.add(departments.getString(4));
row.add(departments.getString(5));
row.add(departments.getString(6));
model.addRow(row);
}
} catch (SQLException ex) {
Logger.getLogger(ShowPost.class.getName()).log(Level.SEVERE, null, ex);
}
jTable1.setModel(model);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
ShowPost dialog = new ShowPost(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
} catch (HeadlessException e) {
e.printStackTrace();
}
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton but_add;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.table.DefaultTableModel model;
// End of variables declaration//GEN-END:variables
}
|
[
"[email protected]"
] | |
633b2e9bf039f1bce85a4751ade8e5f0b9b4acc7
|
8571a6010b67664281d705f058c117d948ec0b5c
|
/Exercises/16(ArvoreBinaria)/Pilha.java
|
2b15d486f310b1736036c11652628d161c16af77
|
[] |
no_license
|
Gstv/Java-Projects
|
76803be6ebaa4b2304f99be4364ec59f6e87b8a7
|
e9bef031ccee3fbd295c2f13bf55336fccf443a3
|
refs/heads/master
| 2020-06-04T17:02:18.844976 | 2019-08-24T21:38:10 | 2019-08-24T21:38:10 | 192,115,324 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 732 |
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 testaabb;
/**
*
* @author Fofolho
*/
public class Pilha {
private No pilha[];
private int topo;
public Pilha( int tamanho ) {
pilha = new No[tamanho];
topo = -1;
}
public void push (No e) {
topo++;
pilha[topo] = e;
}
public No pop() {
No e = pilha[topo];
topo--;
return e;
}
public boolean isEmpty() {
return topo == -1;
}
public boolean isFull() {
return topo == pilha.length - 1;
}
}
|
[
"[email protected]"
] | |
e176b84497fc5e3961e547078d5cc35d43a28dfc
|
d2a5f2fafcbcf2eba438c8eee161d4c35a98af9e
|
/src/main/java/com/cyx/dao/TravelerDao.java
|
57e87d48cd938fb96fab3772c1ce6c6b7a0349a2
|
[] |
no_license
|
mizuyeh/travel_web
|
691bf05e92474699960217dbe4491e8d8c02753d
|
b4cf133d919d9a4182cb2f5102f0ac196580a21f
|
refs/heads/master
| 2023-03-24T15:43:49.898851 | 2021-03-11T05:18:57 | 2021-03-11T05:18:57 | 349,920,077 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 881 |
java
|
package com.cyx.dao;
import com.cyx.entity.Traveler;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @Description
* @date 2021/2/27
*/
public interface TravelerDao {
@Select("select * from traveler where id in (select travelerId from order_traveler where orderId=#{orderId})")
List<Traveler> findById(String orderId) throws Exception;
//通过旅客名查找id
@Select("select id from traveler where travelerName = #{travelerName}")
String findId(String travelerName) throws Exception;
@Insert("insert into `traveler`(`travelerName`, `sex`, `phoneNum`, `credentialsType`, `credentialsNum`, `travelerType`) " +
"values(#{travelerName}, #{sex}, #{phoneNum}, #{credentialsType}, #{credentialsNum}, #{travelerType})")
int save(Traveler traveler) throws Exception;
}
|
[
"[email protected]"
] | |
7181df32cafb40db21e13a97184a1e46a36f62b5
|
696a2f10ecfc62bbfcf8674b550f5abff6c7944a
|
/Home PC Practice/LangPackage35.java
|
c8e2540338e25855f909d233e206942a99818033
|
[] |
no_license
|
KuntanSutar/Home-PC-Practice
|
79c82712d90e2ba2ce39c272fa974ebe89b8bd7d
|
bea5e3dc250af91022d49ac5212c9503fc4a65cc
|
refs/heads/master
| 2020-04-17T13:55:51.721293 | 2019-01-20T11:13:12 | 2019-01-20T11:13:12 | 166,636,042 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 357 |
java
|
class WrapperClassDemo
{
public static void main(String[] args)
{
String s1=Integer.toBinaryString(7);
String s2=Integer.toOctalString(10);
String s3=Integer.toHexString(20);
String s4=Integer.toHexString(10);
System.out.println(s1); // 111
System.out.println(s2); // 12
System.out.println(s3); // 14
System.out.println(s4); // a
}
}
|
[
"[email protected]"
] | |
06fa4b11f1fa55cf2ff1c033196151a36d862e39
|
58d6afce9f3b97e6432c1172c15bf5d00c206309
|
/oca/oca1/src/com/capgemini/set2/Q73.java
|
d0514110e5745bbedeed6ea9d96091f0b0d3c3cf
|
[] |
no_license
|
dikshathool/ocapractice
|
dcfcce0a7c4d9c4676fd05290bec795c98b0c095
|
e1e6e9a3aef748ed048e123856106719d80049cc
|
refs/heads/master
| 2022-11-05T07:27:27.163519 | 2020-06-23T13:46:41 | 2020-06-23T13:46:41 | 274,414,201 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 288 |
java
|
package com.capgemini.set2;
public class Q73 {
int i;
static int j;
public static void main(String[] args) {
Q73 x1 = new Q73();
Q73 x2 = new Q73();
x1.i = 3;
x1.j = 4;
x2.i = 5;
x2.j = 6;
System.out.println(
x1.i+" "+
x1.j+" "+
x2.i+" "+
x2.j);
}
}
|
[
"dikshat703"
] |
dikshat703
|
4c98d633f3ccdb2b0ec6f20cb7bf55ca7452d6f1
|
e10db00bef61c1d2daca0e8876ec2a971dfdd105
|
/src/test/java/com/arcapi/Common/CityCom/MeasuresPostAPITest.java
|
1f3a1a5fb3489403612e0d01ca8d89627b294938
|
[] |
no_license
|
saurav1501/TestArcAPI
|
0d730e57a84cb59df289256ce61dd1b8f9b70e92
|
dd5a36c16082d21ddacdc9dd4fbe7fe42071ac7e
|
refs/heads/master
| 2023-04-27T19:29:34.995560 | 2020-03-05T09:47:44 | 2020-03-05T09:47:44 | 201,176,801 | 0 | 0 | null | 2022-06-29T17:33:45 | 2019-08-08T04:15:44 |
HTML
|
UTF-8
|
Java
| false | false | 1,242 |
java
|
package com.arcapi.Common.CityCom;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.Utill.Controller.Assertion;
import com.Utill.Controller.MethodCall;
import com.Utill.Model.CityComPayload;
import com.arc.driver.BaseClass;
import com.arc.driver.CommonMethod;
public class MeasuresPostAPITest extends BaseClass {
@Test(groups="CheckMeasures")
@Parameters({ "SheetName","ProjectTypeColumn","rownumber" })
public void MeasuresPostAPI(String SheetName,String ProjectTypeColumn, int rownumber) {
try {
url = "/assets/LEED:" +data.getCellData(SheetName, ProjectTypeColumn, rownumber) + "/measures/" + data.getCellData(SheetName, "MeasuresID", rownumber)+"/?points_pursued=10";
String basescore[] = {"base_score.A","base_score.A.1.1","base_score.A.2.1","base_score.A.3.1","base_score.A.4.1","base_score.A.5.1","base_score.A.6.1","base_score.A.7.1","base_score.A.8.1","base_score.A.9.1","base_score.A.10.1","base_score.B"};
for(String base : basescore) {
payload = CityComPayload.checkMeasure(base);
CommonMethod.res = MethodCall.POSTRequest(url, payload);
Assertion.verifyStatusCode(CommonMethod.res, 200);
}
}catch (Exception e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
d88f86dfdf004382f11062f9e0685ba5934b869f
|
ad80a52c63ce32e9328e97ae0855b7fcb760235e
|
/src/main/java/com/shaft/gui/browser/WebDriverBrowserActions.java
|
f3946a21810c1a6d5cccd1b4c8572bb3e02fbe96
|
[
"MIT"
] |
permissive
|
elhusseinyIbrahim/SHAFT_ENGINE
|
65a921904625e46129696aba196e73943d426b40
|
221c00f433978e34dd318bd098a16c7081790b31
|
refs/heads/master
| 2023-08-25T22:36:42.934886 | 2021-11-07T07:57:25 | 2021-11-07T07:57:25 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 31,356 |
java
|
package com.shaft.gui.browser;
import com.shaft.driver.DriverFactoryHelper;
import com.shaft.gui.element.JavaScriptWaitManager;
import com.shaft.gui.element.WebDriverElementActions;
import com.shaft.gui.image.ScreenshotManager;
import com.shaft.tools.io.ReportManager;
import com.shaft.tools.io.ReportManagerHelper;
import com.shaft.tools.support.JavaScriptHelper;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import java.awt.*;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class WebDriverBrowserActions {
private static final Boolean HEADLESS_EXECUTION = Boolean.valueOf(System.getProperty("headlessExecution").trim());
private static final int NAVIGATION_TIMEOUT_INTEGER = Integer
.parseInt(System.getProperty("browserNavigationTimeout").trim());
private static WebDriver lastUsedDriver;
protected WebDriverBrowserActions(WebDriver driver) {
lastUsedDriver=driver;
}
/**
* Gets the current page URL and returns it as a string
*
* @return the URL that's currently open in the current page
*/
public String getCurrentURL() {
return getCurrentURL(lastUsedDriver);
}
/**
* Gets the current page URL and returns it as a string
*
* @param driver the current instance of Selenium webdriver
* @return the URL that's currently open in the current page
*/
public static String getCurrentURL(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
var currentURL = "";
try {
currentURL = driver.getCurrentUrl();
passAction(driver, currentURL);
} catch (Exception rootCauseException) {
failAction(driver, currentURL, rootCauseException);
}
return currentURL;
}
/**
* Gets the current window title and returns it as a string
*
* @return the title of the current window
*/
public String getCurrentWindowTitle() {
return getCurrentWindowTitle(lastUsedDriver);
}
/**
* Gets the current window title and returns it as a string
*
* @param driver the current instance of Selenium webdriver
* @return the title of the current window
*/
public static String getCurrentWindowTitle(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
var currentWindowTitle = "";
try {
currentWindowTitle = driver.getTitle();
passAction(driver, currentWindowTitle);
} catch (Exception rootCauseException) {
failAction(driver, currentWindowTitle, rootCauseException);
}
return currentWindowTitle;
}
/**
* Gets the current page source and returns it as a string
*
* @return the source of the current page
*/
public String getPageSource() {
return getPageSource(lastUsedDriver);
}
/**
* Gets the current page source and returns it as a string
*
* @param driver the current instance of Selenium webdriver
* @return the source of the current page
*/
public static String getPageSource(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
var pageSource = "";
try {
pageSource = driver.getPageSource();
passAction(driver, pageSource);
} catch (Exception rootCauseException) {
failAction(driver, pageSource, rootCauseException);
}
return pageSource;
}
/**
* Gets the current window handle and returns it as a string
*
* @return the window handle for the current window
*/
public String getWindowHandle() {
return getWindowHandle(lastUsedDriver);
}
/**
* Gets the current window handle and returns it as a string
*
* @param driver the current instance of Selenium webdriver
* @return the window handle for the current window
*/
public static String getWindowHandle(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
var windowHandle = "";
try {
windowHandle = driver.getWindowHandle();
passAction(driver, windowHandle);
} catch (Exception rootCauseException) {
failAction(driver, windowHandle, rootCauseException);
}
return windowHandle;
}
/**
* Gets the current window position and returns it as a string
*
* @return the position of the current window
*/
public String getWindowPosition() {
return getWindowPosition(lastUsedDriver);
}
/**
* Gets the current window position and returns it as a string
*
* @param driver the current instance of Selenium webdriver
* @return the position of the current window
*/
public static String getWindowPosition(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
var windowPosition = "";
try {
windowPosition = driver.manage().window().getPosition().toString();
passAction(driver, windowPosition);
} catch (Exception rootCauseException) {
failAction(driver, windowPosition, rootCauseException);
}
return windowPosition;
}
/**
* Gets the current window size and returns it as a string
*
* @return the size of the current window
*/
public String getWindowSize() {
return getWindowSize(lastUsedDriver);
}
/**
* Gets the current window size and returns it as a string
*
* @param driver the current instance of Selenium webdriver
* @return the size of the current window
*/
public static String getWindowSize(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
var windowSize = "";
try {
windowSize = driver.manage().window().getSize().toString();
passAction(driver, windowSize);
} catch (Exception rootCauseException) {
failAction(driver, windowSize, rootCauseException);
}
return windowSize;
}
/**
* Navigates to targetUrl in case the current URL is different, else refreshes
* the current page
*
* @param targetUrl a string that represents the URL that you wish to navigate
* to
*/
public WebDriverBrowserActions navigateToURL(String targetUrl) {
navigateToURL(lastUsedDriver, targetUrl);
return this;
}
/**
* Navigates to targetUrl in case the current URL is different, else refreshes
* the current page
*
* @param driver the current instance of Selenium webdriver
* @param targetUrl a string that represents the URL that you wish to navigate
* to
*/
public static void navigateToURL(WebDriver driver, String targetUrl) {
navigateToURL(driver, targetUrl, targetUrl);
}
/**
* Navigates to targetUrl in case the current URL is different, else refreshes
* the current page. Waits for successfully navigating to the final url after
* redirection.
*
* @param targetUrl a string that represents the URL that you
* wish to navigate to
* @param targetUrlAfterRedirection a string that represents a part of the url
* that should be present after redirection,
* this string is used to confirm successful
* navigation
*/
public WebDriverBrowserActions navigateToURL(String targetUrl, String targetUrlAfterRedirection) {
navigateToURL(lastUsedDriver, targetUrl, targetUrlAfterRedirection);
return this;
}
/**
* Navigates to targetUrl in case the current URL is different, else refreshes
* the current page. Waits for successfully navigating to the final url after
* redirection.
*
* @param driver the current instance of Selenium webdriver
* @param targetUrl a string that represents the URL that you
* wish to navigate to
* @param targetUrlAfterRedirection a string that represents a part of the url
* that should be present after redirection,
* this string is used to confirm successful
* navigation
*/
public static void navigateToURL(WebDriver driver, String targetUrl, String targetUrlAfterRedirection) {
if (targetUrl.equals(targetUrlAfterRedirection)) {
ReportManager.logDiscrete(
"Target URL: [" + targetUrl + "]");
} else {
ReportManager.logDiscrete(
"Target URL: [" + targetUrl + "], and after redirection: [" + targetUrlAfterRedirection + "]");
}
// force stop any current navigation
try {
((JavascriptExecutor) driver).executeScript("return window.stop;");
} catch (Exception rootCauseException) {
ReportManagerHelper.log(rootCauseException);
/*
* org.openqa.selenium.NoSuchSessionException: Session ID is null. Using
* WebDriver after calling quit()? Build info: version: '3.141.59', revision:
* 'e82be7d358', time: '2018-11-14T08:17:03' System info: host:
* 'gcp-test-automation-sys-187-jenkins-fullaccess', ip: '10.128.0.11', os.name:
* 'Linux', os.arch: 'amd64', os.version: '4.15.0-1027-gcp', java.version:
* '1.8.0_202' Driver info: driver.version: RemoteWebDriver
*/
}
try {
JavaScriptWaitManager.waitForLazyLoading();
String initialSource = driver.getPageSource();
String initialURL = driver.getCurrentUrl();
// remove trailing slash which may cause comparing the current and target urls
// to fail
if (initialURL.startsWith("/", initialURL.length() - 1)) {
initialURL = initialURL.substring(0, initialURL.length() - 1);
}
ReportManager.logDiscrete("Initial URL: [" + initialURL + "]");
if (!initialURL.equals(targetUrl)) {
// navigate to new url
navigateToNewURL(driver, initialURL, targetUrl, targetUrlAfterRedirection);
JavaScriptWaitManager.waitForLazyLoading();
if ((WebDriverElementActions.getElementsCount(driver, By.tagName("html")) == 1)
&& (!driver.getPageSource().equalsIgnoreCase(initialSource))) {
confirmThatWebsiteIsNotDown(driver, targetUrl);
passAction(driver, targetUrl);
} else {
failAction(driver, targetUrl);
}
} else {
// already on the same page
driver.navigate().refresh();
JavaScriptWaitManager.waitForLazyLoading();
if (WebDriverElementActions.getElementsCount(driver, By.tagName("html")) == 1) {
confirmThatWebsiteIsNotDown(driver, targetUrl);
passAction(driver, targetUrl);
}
}
} catch (Exception rootCauseException) {
failAction(driver, targetUrl, rootCauseException);
}
}
/**
* Navigates one step back from the browsers history
*
*/
public WebDriverBrowserActions navigateBack() {
navigateBack(lastUsedDriver);
return this;
}
/**
* Navigates one step back from the browsers history
*
* @param driver the current instance of Selenium webdriver
*/
public static void navigateBack(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
String initialURL;
var newURL = "";
try {
initialURL = driver.getCurrentUrl();
driver.navigate().back();
JavaScriptWaitManager.waitForLazyLoading();
(new WebDriverWait(driver, Duration.ofSeconds(NAVIGATION_TIMEOUT_INTEGER)))
.until(ExpectedConditions.not(ExpectedConditions.urlToBe(initialURL)));
newURL = driver.getCurrentUrl();
if (!newURL.equals(initialURL)) {
passAction(driver, newURL);
} else {
failAction(driver, newURL);
}
} catch (Exception rootCauseException) {
failAction(driver, newURL, rootCauseException);
}
}
/**
* Navigates one step forward from the browsers history
*
*/
public WebDriverBrowserActions navigateForward() {
navigateForward(lastUsedDriver);
return this;
}
/**
* Navigates one step forward from the browsers history
*
* @param driver the current instance of Selenium webdriver
*/
public static void navigateForward(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
String initialURL;
var newURL = "";
try {
initialURL = driver.getCurrentUrl();
driver.navigate().forward();
JavaScriptWaitManager.waitForLazyLoading();
(new WebDriverWait(driver, Duration.ofSeconds(NAVIGATION_TIMEOUT_INTEGER)))
.until(ExpectedConditions.not(ExpectedConditions.urlToBe(initialURL)));
newURL = driver.getCurrentUrl();
if (!newURL.equals(initialURL)) {
passAction(driver, newURL);
} else {
failAction(driver, newURL);
}
} catch (Exception rootCauseException) {
failAction(driver, newURL, rootCauseException);
}
}
/**
* Attempts to refresh the current page
*
*/
public WebDriverBrowserActions refreshCurrentPage() {
refreshCurrentPage(lastUsedDriver);
return this;
}
/**
* Attempts to refresh the current page
*
* @param driver the current instance of Selenium webdriver
*/
public static void refreshCurrentPage(WebDriver driver) {
JavaScriptWaitManager.waitForLazyLoading();
driver.navigate().refresh();
passAction(driver, driver.getPageSource());
// removed all exception handling as there was no comments on when and why this
// exception happens
}
/**
* Closes the current browser window
*
*/
public synchronized WebDriverBrowserActions closeCurrentWindow() {
closeCurrentWindow(lastUsedDriver);
return this;
}
/**
* Closes the current browser window
*
* @param driver the current instance of Selenium webdriver
*/
public static synchronized void closeCurrentWindow(WebDriver driver) {
if (driver != null) {
JavaScriptWaitManager.waitForLazyLoading();
try {
// TODO: handle session timeout while attempting to close empty window
String lastPageSource = driver.getPageSource();
DriverFactoryHelper.closeDriver(driver.hashCode());
passAction(lastPageSource);
} catch (WebDriverException rootCauseException) {
if (rootCauseException.getMessage() != null
&& (rootCauseException.getMessage().contains("was terminated due to TIMEOUT") || rootCauseException.getMessage().contains("Session ID is null"))) {
passAction(null);
} else {
failAction(rootCauseException);
}
} catch (Exception rootCauseException) {
failAction(rootCauseException);
} finally {
WebDriverElementActions.setLastUsedDriver(null);
}
} else {
ReportManager.logDiscrete("Window is already closed and driver object is null.");
passAction(null);
}
}
/**
* Maximizes current window size based on screen size minus 5%
*
*/
public WebDriverBrowserActions maximizeWindow() {
maximizeWindow(lastUsedDriver);
return this;
}
/**
* Maximizes current window size based on screen size minus 5%
*
* @param driver the current instance of Selenium webdriver
*/
public static void maximizeWindow(WebDriver driver) {
Dimension initialWindowSize;
Dimension currentWindowSize;
var targetWidth = 1920;
var targetHeight = 1080;
initialWindowSize = driver.manage().window().getSize();
ReportManager.logDiscrete("Initial window size: " + initialWindowSize.toString());
String targetBrowserName = System.getProperty("targetBrowserName").trim();
String targetOperatingSystem = System.getProperty("targetOperatingSystem").trim();
String executionAddress = System.getProperty("executionAddress").trim();
// try selenium webdriver maximize
currentWindowSize = attemptMaximizeUsingSeleniumWebDriver(driver, executionAddress, targetBrowserName,
targetOperatingSystem);
if ((initialWindowSize.height == currentWindowSize.height)
&& (initialWindowSize.width == currentWindowSize.width)) {
// attempt resize using toolkit
currentWindowSize = attemptMaximizeUsingToolkitAndJavascript(driver, targetWidth, targetHeight);
if ((currentWindowSize.height != targetHeight)
|| (currentWindowSize.width != targetWidth)) {
// happens with headless firefox browsers // remote // linux and windows
// also happens with chrome/windows
// attempt resize using WebDriver mange window
currentWindowSize = attemptMaximizeUsingSeleniumWebDriverManageWindow(driver, targetWidth, targetHeight);
}
if ((currentWindowSize.height != targetHeight)
|| (currentWindowSize.width != targetWidth)) {
// attempt setting window to fullscreen
fullScreenWindow(driver);
currentWindowSize = driver.manage().window().getSize();
ReportManager.logDiscrete("Window size after fullScreenWindow: " + currentWindowSize.toString());
}
if ((currentWindowSize.height != targetHeight)
|| (currentWindowSize.width != targetWidth)) {
ReportManager.logDiscrete("skipping window maximization due to unknown error, marking step as passed.");
}
}
passAction(driver, "New screen size is now: " + currentWindowSize);
}
/**
* Resizes the current window size based on the provided width and height
*
* @param width the desired new width of the target window
* @param height the desired new height of the target window
*/
public WebDriverBrowserActions setWindowSize(int width, int height) {
setWindowSize(lastUsedDriver, width, height);
return this;
}
/**
* Resizes the current window size based on the provided width and height
*
* @param driver the current instance of Selenium webdriver
* @param width the desired new width of the target window
* @param height the desired new height of the target window
*/
public static void setWindowSize(WebDriver driver, int width, int height) {
Dimension initialWindowSize;
Dimension currentWindowSize;
initialWindowSize = driver.manage().window().getSize();
ReportManager.logDiscrete("Initial window size: " + initialWindowSize.toString());
driver.manage().window().setPosition(new Point(0, 0));
driver.manage().window().setSize(new Dimension(width, height));
// apparently we need to add +1 here to ensure that the new window size matches
// the expected window size
currentWindowSize = driver.manage().window().getSize();
ReportManager.logDiscrete("Window size after SWD: " + currentWindowSize.toString());
if ((initialWindowSize.height == currentWindowSize.height)
&& (initialWindowSize.width == currentWindowSize.width)) {
((JavascriptExecutor) driver).executeScript(JavaScriptHelper.WINDOW_FOCUS.getValue());
((JavascriptExecutor) driver).executeScript(JavaScriptHelper.WINDOW_RESET_LOCATION.getValue());
((JavascriptExecutor) driver).executeScript(JavaScriptHelper.WINDOW_RESIZE.getValue()
.replace("$WIDTH", String.valueOf(width)).replace("$HEIGHT", String.valueOf(height)));
currentWindowSize = driver.manage().window().getSize();
ReportManager.logDiscrete("Window size after JavascriptExecutor: " + currentWindowSize.toString());
}
if ((initialWindowSize.height == currentWindowSize.height)
&& (initialWindowSize.width == currentWindowSize.width)) {
ReportManager.logDiscrete("skipping window resizing due to unknown error, marking step as passed.");
}
passAction(driver, "New screen size is now: " + currentWindowSize);
}
/**
* Resize the window to fill the current screen
*
*/
public WebDriverBrowserActions fullScreenWindow() {
fullScreenWindow(lastUsedDriver);
return this;
}
/**
* Resize the window to fill the current screen
*
* @param driver the current instance of Selenium webdriver
*/
public static void fullScreenWindow(WebDriver driver) {
Dimension initialWindowSize = driver.manage().window().getSize();
ReportManager.logDiscrete("Initial Windows Size: " + initialWindowSize.width + "x" + initialWindowSize.height);
if (!System.getProperty("executionAddress").trim().equalsIgnoreCase("local")
&& System.getProperty("headlessExecution").trim().equalsIgnoreCase("true")) {
maximizeWindow(driver);
} else {
driver.manage().window().fullscreen();
}
ReportManager.logDiscrete("Current Windows Size after fullScreen: " + driver.manage().window().getSize().width + "x" + driver.manage().window().getSize().height);
passAction(driver, driver.getPageSource());
}
private static void passAction(String testData) {
String actionName = Thread.currentThread().getStackTrace()[2].getMethodName();
passAction(null, actionName, testData);
}
private static void passAction(WebDriver driver, String testData) {
String actionName = Thread.currentThread().getStackTrace()[2].getMethodName();
passAction(driver, actionName, testData);
}
private static void passAction(WebDriver driver, String actionName, String testData) {
reportActionResult(driver, actionName, testData, true);
}
private static void failAction(Exception... rootCauseException) {
String actionName = Thread.currentThread().getStackTrace()[2].getMethodName();
failAction(null, actionName, "", rootCauseException);
}
private static void failAction(WebDriver driver, String testData, Exception... rootCauseException) {
String actionName = Thread.currentThread().getStackTrace()[2].getMethodName();
failAction(driver, actionName, testData, rootCauseException);
}
private static void failAction(WebDriver driver, String actionName, String testData,
Exception... rootCauseException) {
String message = reportActionResult(driver, actionName, testData, false);
if (rootCauseException != null && rootCauseException.length >= 1) {
Assert.fail(message, rootCauseException[0]);
} else {
Assert.fail(message);
}
}
private static String reportActionResult(WebDriver driver, String actionName, String testData,
Boolean passFailStatus) {
actionName = actionName.substring(0, 1).toUpperCase() + actionName.substring(1);
String message;
if (Boolean.TRUE.equals(passFailStatus)) {
message = "Browser Action [" + actionName + "] successfully performed.";
} else {
message = "Browser Action [" + actionName + "] failed.";
}
List<List<Object>> attachments = new ArrayList<>();
if (testData != null && testData.length() >= 500) {
List<Object> actualValueAttachment = Arrays.asList("Browser Action Test Data - " + actionName,
"Actual Value", testData);
attachments.add(actualValueAttachment);
} else if (testData != null && !testData.isEmpty()) {
message = message + " With the following test data [" + testData + "].";
}
if (driver != null) {
attachments.add(ScreenshotManager.captureScreenShot(driver, actionName, true));
ReportManagerHelper.log(message, attachments);
} else if (!attachments.equals(new ArrayList<>())) {
ReportManagerHelper.log(message, attachments);
} else {
ReportManager.log(message);
}
return message;
}
private static void confirmThatWebsiteIsNotDown(WebDriver driver, String targetUrl) {
List<String> navigationErrorMessages = Arrays.asList("This site can’t be reached", "Unable to connect",
"Safari Can’t Connect to the Server", "This page can't be displayed", "Invalid URL",
"<head></head><body></body>");
// TODO: get page loop outside the foreach loop
navigationErrorMessages.forEach(errorMessage -> {
if (driver.getPageSource().contains(errorMessage)) {
failAction(driver, "Error message: \"" + errorMessage + "\", Target URL: \"" + targetUrl + "\"");
}
});
}
private static void navigateToNewURL(WebDriver driver, String initialURL, String targetUrl, String targetUrlAfterRedirection) {
try {
driver.navigate().to(targetUrl);
} catch (WebDriverException rootCauseException) {
failAction(driver, targetUrl, rootCauseException);
}
if (Boolean.TRUE.equals(Boolean.valueOf(System.getProperty("forceCheckNavigationWasSuccessful")))) {
checkNavigationWasSuccesssful(driver, initialURL, targetUrl, targetUrlAfterRedirection);
}
}
private static void checkNavigationWasSuccesssful(WebDriver driver, String initialURL, String targetUrl, String targetUrlAfterRedirection) {
if (!targetUrl.equals(targetUrlAfterRedirection)) {
try {
(new WebDriverWait(driver, Duration.ofSeconds(NAVIGATION_TIMEOUT_INTEGER)))
.until(ExpectedConditions.not(ExpectedConditions.urlToBe(initialURL)));
} catch (TimeoutException rootCauseException) {
failAction(driver, "Waited for " + NAVIGATION_TIMEOUT_INTEGER + " seconds to navigate away from [" + initialURL + "] but didn't.", rootCauseException);
}
} else {
try {
(new WebDriverWait(driver, Duration.ofSeconds(NAVIGATION_TIMEOUT_INTEGER)))
.until(ExpectedConditions.not(ExpectedConditions.urlToBe(initialURL)));
(new WebDriverWait(driver, Duration.ofSeconds(NAVIGATION_TIMEOUT_INTEGER)))
.until(ExpectedConditions.urlContains(targetUrlAfterRedirection));
} catch (TimeoutException rootCauseException) {
failAction(driver, "Waited for " + NAVIGATION_TIMEOUT_INTEGER + " seconds to navigate to [" + targetUrlAfterRedirection + "] but ended up with [" + driver.getCurrentUrl() + "].", rootCauseException);
}
}
}
private static Dimension attemptMaximizeUsingSeleniumWebDriver(WebDriver driver, String executionAddress,
String targetBrowserName, String targetOperatingSystem) {
if ((!"local".equals(executionAddress) && !"GoogleChrome".equals(targetBrowserName))
|| ("local".equals(executionAddress)
&& !("GoogleChrome".equals(targetBrowserName) && "Mac-64".equals(targetOperatingSystem)))) {
try {
driver.manage().window().maximize();
Dimension currentWindowSize = driver.manage().window().getSize();
ReportManager.logDiscrete(
"Window size after SWD Maximize: " + currentWindowSize.toString());
return currentWindowSize;
} catch (WebDriverException rootCauseException) {
// org.openqa.selenium.WebDriverException: unknown error: failed to change
// window state to maximized, current state is normal
ReportManagerHelper.log(rootCauseException);
}
}
return driver.manage().window().getSize();
}
private static Dimension attemptMaximizeUsingToolkitAndJavascript(WebDriver driver, int width, int height) {
int targetWidth = width;
int targetHeight = height;
try {
var toolkit = Toolkit.getDefaultToolkit();
if (Boolean.FALSE.equals(HEADLESS_EXECUTION)) {
targetWidth = (int) toolkit.getScreenSize().getWidth();
targetHeight = (int) toolkit.getScreenSize().getHeight();
}
driver.manage().window().setPosition(new Point(0, 0));
driver.manage().window().setSize(new Dimension(targetWidth, targetHeight));
ReportManager.logDiscrete("Window size after Toolkit: " + driver.manage().window().getSize().toString());
return driver.manage().window().getSize();
} catch (HeadlessException e) {
((JavascriptExecutor) driver).executeScript(JavaScriptHelper.WINDOW_FOCUS.getValue());
((JavascriptExecutor) driver).executeScript(JavaScriptHelper.WINDOW_RESET_LOCATION.getValue());
((JavascriptExecutor) driver).executeScript(JavaScriptHelper.WINDOW_RESIZE.getValue()
.replace("$WIDTH", String.valueOf(targetWidth)).replace("$HEIGHT", String.valueOf(targetHeight)));
ReportManager.logDiscrete(
"Window size after JavascriptExecutor: " + driver.manage().window().getSize().toString());
return driver.manage().window().getSize();
}
}
private static Dimension attemptMaximizeUsingSeleniumWebDriverManageWindow(WebDriver driver, int width,
int height) {
driver.manage().window().setPosition(new Point(0, 0));
driver.manage().window().setSize(new Dimension(width, height));
ReportManager.logDiscrete(
"Window size after WebDriver.Manage.Window: " + driver.manage().window().getSize().toString());
return driver.manage().window().getSize();
}
}
|
[
"[email protected]"
] | |
af7dd7f27839d35b79f319adc7ca2a56cd1cfc5a
|
0a9be8f396ca8b09288b9a47194e880a8a392c42
|
/app/src/main/java/com/esaip/remarquarbres/Stockage.java
|
16121867a5695c56e144f6fbe7d4f24b5ec0c860
|
[] |
no_license
|
Batmarmelade/Remarquarbres
|
aef4ea5309c95c0aa893da6582d45bd2a7a5ce3e
|
244045fbf5cdca262102be68a6a9cb786f440f79
|
refs/heads/master
| 2020-05-05T05:06:34.280396 | 2019-06-23T19:19:37 | 2019-06-23T19:19:37 | 179,676,452 | 2 | 0 | null | 2019-04-05T18:54:16 | 2019-04-05T12:22:25 | null |
UTF-8
|
Java
| false | false | 5,337 |
java
|
package com.esaip.remarquarbres;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Intent;
import android.database.Cursor;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.nio.channels.FileChannel;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
public class Stockage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_stockage);
HashMap<String, String> answers = new HashMap<String, String>();
Intent data = getIntent();
Bundle bundle = data.getExtras();
if (bundle != null) {
Set<String> keys = bundle.keySet();
Iterator<String> it = keys.iterator();
Log.e("RESULTS","Dumping Intent start");
while (it.hasNext()) {
String key = it.next();
Log.i("RESULTS","[" + key + "=" + bundle.get(key)+"]");
answers.put(key, bundle.get(key).toString());
}
Log.e("RESULTS","Dumping Intent end");
}
try {
exportInCSV(answers);
} catch (IOException e) {
Log.e("IO ERROR", "IO Exception : " + e.getMessage());
e.printStackTrace();
}
}
public void exportInCSV(HashMap<String, String> answers) throws IOException {
final HashMap<String, String> data = answers;
File folderArbres = new File(Environment.getExternalStorageDirectory() + "/Arbres");
Log.d("PATH", "PATH : " + folderArbres.toString());
// On crée ici le dossier s'il n'existe pas
boolean var = false;
if (!folderArbres.exists()){
var = folderArbres.mkdir();
}
Log.d("IO : FOLDER CREATION", "Folder created : " + var);
File folder = new File(Environment.getExternalStorageDirectory() + "/Arbres" + "/Arbre" + Math.abs(new Random().nextInt()));
Log.d("PATH", "PATH : " + folder.toString());
// On crée ici le dossier s'il n'existe pas
var = false;
if (!folder.exists()){
var = folder.mkdir();
}
Log.d("IO : FOLDER CREATION", "Folder created : " + var);
final String infosName = folder.toString() + "/" + "Infos" + Math.abs(new Random().nextInt()) + ".txt";
Log.d("FOLDER CREATION", infosName);
File info = new File(infosName);
var = false;
if(!info.exists()) {
var = info.createNewFile();
}
Log.d("IO : FILE CREATION", "File info created : " + var);
// show waiting screen
CharSequence contentTitle = getString(R.string.app_name);
final ProgressDialog progDialog = ProgressDialog.show(
Stockage.this, contentTitle, "Allez-y, et que rien ne vous frêne !",
true);//please wait
@SuppressLint("HandlerLeak") final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
}
};
new Thread() {
public void run() {
try {
FileWriter fw = new FileWriter(infosName);
for ( String question : data.keySet() ){
fw.append(question + " : " + (data.get(question)) + "\n");
}
fw.flush();
fw.close();
} catch (Exception e) {
Log.e("IO ERROR", e.getMessage());
e.printStackTrace();
}
handler.sendEmptyMessage(0);
progDialog.dismiss();
}
}.start();
// Copy image to correct folder
copyImage(folder);
}
public void copyImage(File folder) {
File srcImage = new File(getIntent().getStringExtra("ImageName"));
File dstImage = new File(folder, srcImage.getName());
try {
dstImage.createNewFile();
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(srcImage).getChannel();
destination = new FileOutputStream(dstImage).getChannel();
destination.transferFrom(source, 0, source.size());
} finally {
if (source != null) {
source.close();
}
if (destination != null) {
destination.close();
}
}
} catch (IOException e) {
Log.e("COPY ERROR", e.getMessage());
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
bd96f471f1cd473b60be3aaaedd2733f83cd7fa2
|
64392a7091fae08dfd1e3db00b4772bedd746885
|
/src/main/java/br/com/encatman/api/UsuarioAPI.java
|
232c903535160e2b777a282f9e6f4969c6dfa923
|
[] |
no_license
|
munifgebara/encatman
|
d7837b03ddea3ae9cb5ba88ae441a06607b0ab97
|
5cd9376475710f1945425af3a5dd5b1425da4caf
|
refs/heads/master
| 2021-01-01T04:30:04.565354 | 2016-06-08T22:30:20 | 2016-06-08T22:30:20 | 58,589,001 | 1 | 7 | null | 2016-06-08T22:30:21 | 2016-05-11T23:06:12 |
Java
|
UTF-8
|
Java
| false | false | 4,509 |
java
|
package br.com.encatman.api;
import br.com.encatman.entidades.Usuario;
import br.com.encatman.negocio.UsuarioNegocio;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.List;
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 munif
*/
@WebServlet(name = "UsuarioAPI", urlPatterns = {"/api/usuario/*"})
public class UsuarioAPI extends HttpServlet {
private ObjectMapper mapper;
private UsuarioNegocio usuarioNegocio;
public UsuarioAPI() {
mapper = new ObjectMapper();
usuarioNegocio = new UsuarioNegocio();
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String parametros[] = getUrlParameters(request);
if (parametros.length == 0) {
List<Usuario> lista = usuarioNegocio.listar();
response.getOutputStream().write(mapper.writeValueAsBytes(lista));
} else if (parametros.length == 1) {
Long id = Long.parseLong(parametros[0]);
Usuario usuario = usuarioNegocio.recuperar(id);
response.getOutputStream().write(mapper.writeValueAsBytes(usuario));
} else {
response.setStatus(400);
response.getOutputStream().write(mapper.writeValueAsBytes("Número de parâmetros errado."));
}
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String parametros[] = getUrlParameters(request);
if (parametros.length == 0) {
Usuario novo = mapper.readValue(request.getInputStream(), Usuario.class);
Usuario salvar = usuarioNegocio.salvar(novo);
response.getOutputStream().write(mapper.writeValueAsBytes(salvar));
} else {
response.setStatus(400);
response.getOutputStream().write(mapper.writeValueAsBytes("Número de parâmetros errado."));
}
}
@Override
protected void doPut(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String parametros[] = getUrlParameters(request);
if (parametros.length == 1) {
Long id = Long.parseLong(parametros[0]);
Usuario novo = mapper.readValue(request.getInputStream(), Usuario.class);
novo.setCodigo(id);
Usuario salvar = usuarioNegocio.alterar(novo);
response.getOutputStream().write(mapper.writeValueAsBytes(salvar));
} else {
response.setStatus(400);
response.getOutputStream().write(mapper.writeValueAsBytes("Número de parâmetros errado."));
}
}
@Override
protected void doDelete(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String parametros[] = getUrlParameters(request);
if (parametros.length == 0) {
response.setStatus(400);
response.getOutputStream().write(mapper.writeValueAsBytes("Número de parâmetros errado."));
} else if (parametros.length == 1) {
Long id = Long.parseLong(parametros[0]);
Usuario usuario = usuarioNegocio.recuperar(id);
usuarioNegocio.excluir(usuario);
response.getOutputStream().write(mapper.writeValueAsBytes(usuario));
} else {
response.setStatus(400);
response.getOutputStream().write(mapper.writeValueAsBytes("Número de parâmetros errado."));
}
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Usuario API";
}// </editor-fold>
protected String[] getUrlParameters(HttpServletRequest request) {
String url = this.getServletContext().getContextPath() + this.getClass().getAnnotation(WebServlet.class).urlPatterns()[0].replace("/*", "").trim();
String paramters = request.getRequestURI().replaceFirst(url, "");
paramters = paramters.replaceFirst("/", "");
if (paramters.isEmpty()) {
return new String[0];
}
return paramters.split("/");
}
}
|
[
"[email protected]"
] | |
7e7009e189b1836cfc139971fcf605e747740dc0
|
78d64be58e6832cd8d85b33df8f53e96685ac08f
|
/jdej-api/src/main/java/com/miquankj/api/dto/Goodsdto.java
|
0d9b6171fa9334718b564be50ca8f8c9af78b239
|
[] |
no_license
|
WalkingSouls/jdej-manage
|
f802067844a1b1d401b5b56b77103388a47da264
|
288594dd75ca994f96c83063cc2fd607be184534
|
refs/heads/master
| 2020-05-19T07:51:05.790441 | 2019-05-16T03:22:13 | 2019-05-16T03:22:13 | 184,906,765 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,175 |
java
|
package com.miquankj.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
/**
* 商品dto,列表用
* @author liuyadong
* @since 2019/5/8
*/
@Data
public class Goodsdto {
@ApiModelProperty(value = "商品id", required = true)
private Integer id;
@ApiModelProperty(value = "商品名称", required = true)
private String comName;
@ApiModelProperty(value = "所属店铺", required = true)
private String addBis;
@ApiModelProperty(value = "商品主图", allowEmptyValue = true)
private String comMainPic;
@ApiModelProperty(value = "单价", required = true)
private Double price;
@ApiModelProperty(value = "库存", allowEmptyValue = true)
private Integer stock;
@ApiModelProperty(value = "商品创建时间", required = true)
private Date addDate;
@ApiModelProperty(value = "商品状态 0 下架 1 上架 -1 删除", required = true)
private String state;
@ApiModelProperty(value = "推荐 0 是 1 否", required = true)
private String recommend;
}
|
[
"[email protected]"
] | |
9e0bc1fb8b1bfc8420a464d7e7c860ae6f5760cb
|
04096e0c363762c9a6da47f599506e1a1679e2f8
|
/separatemodels/src/main/java/pl/altkom/asc/lab/cqrs/intro/separatemodels/commands/buyadditionalcover/BuyAdditionalCoverResult.java
|
4fb0143b5bb17b9fbe49027dd368908fa8a2af79
|
[] |
no_license
|
johan-taiger/java-cqrs-intro
|
1aa303eae3739051c433c8116c09d3b5dfefa786
|
1630903d8a4d011624fd18c963fb9d88d436ff6b
|
refs/heads/master
| 2023-08-29T17:36:43.993839 | 2021-11-11T09:42:42 | 2021-11-11T09:42:42 | 422,449,014 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 292 |
java
|
package pl.altkom.asc.lab.cqrs.intro.separatemodels.commands.buyadditionalcover;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class BuyAdditionalCoverResult {
private String policyNumber;
private int versionWithAdditionalCoverNumber;
}
|
[
"[email protected]"
] | |
3fa2d6486a643fcf291328d023f870cbab6dcc6c
|
f0faf79e4b275b1a825b7a2085f1d9ef5fc0d041
|
/src/entities/HourContract.java
|
5531306e78a53f2e7449b15a376b7a1e223db377
|
[] |
no_license
|
robertsouzza/teste-novo-repositorio
|
2ac3b4607aa15b58091c81ec9ede8e88af09b6ec
|
20ec609ea35614e07ecb250bc59577f65796ddfb
|
refs/heads/master
| 2023-07-01T18:43:35.415914 | 2021-08-05T03:07:43 | 2021-08-05T03:07:43 | 392,523,271 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 803 |
java
|
package entities;
import java.util.Date;
public class HourContract {
private Date date;
private Double valuePerHour;
private Integer hours;
public HourContract() {
}
public HourContract(Date date, Double valuePerHour, Integer hours) {
this.date = date;
this.valuePerHour = valuePerHour;
this.hours = hours;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Double getValuePerHour() {
return valuePerHour;
}
public void setValuePerHour(Double valuePerHour) {
this.valuePerHour = valuePerHour;
}
public Integer getHours() {
return hours;
}
public void setHours(Integer hours) {
this.hours = hours;
}
// metodos implementaveis
public double totalValue() {
return valuePerHour * hours;
}
}
|
[
"[email protected]"
] | |
7a412a154876c97b69a4a4e25b35e5655217739c
|
969629f482690566216781f9f63d621c9fa9f793
|
/vertx-vaadin/src/main/java/com/github/mcollovati/vertx/vaadin/VertxVaadinResponse.java
|
84fd51a5c620eeb416e0d52c5e2f52de6fe65a7a
|
[
"MIT"
] |
permissive
|
davidsowerby/vaadin-vertx-samples
|
c5d12fc1fbb19ee947683c205b7c4eaea98f6317
|
ebf7e0e2f65a00652acd41f0327d21a20ad72a4f
|
refs/heads/master
| 2021-01-25T13:57:35.090079 | 2018-03-03T09:51:19 | 2018-03-03T10:03:04 | 123,626,956 | 0 | 0 |
MIT
| 2018-03-02T20:23:47 | 2018-03-02T20:23:47 | null |
UTF-8
|
Java
| false | false | 5,305 |
java
|
/*
* The MIT License
* Copyright © 2016-2018 Marco Collovati ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.github.mcollovati.vertx.vaadin;
import com.vaadin.server.ExposeVaadinServerPkg;
import com.vaadin.server.VaadinResponse;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpHeaders;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.RoutingContext;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
/**
* Created by marco on 16/07/16.
*/
public class VertxVaadinResponse implements VaadinResponse {
private final RoutingContext routingContext;
private final HttpServerResponse response;
private final VertxVaadinService service;;
private Buffer outBuffer = Buffer.buffer();
private boolean useOOS = false;
private boolean useWriter = false;
public VertxVaadinResponse(VertxVaadinService service, RoutingContext routingContext) {
this.routingContext = routingContext;
this.response = routingContext.response();
this.service = service;
}
protected final RoutingContext getRoutingContext() {
return routingContext;
}
@Override
public void setStatus(int statusCode) {
response.setStatusCode(statusCode);
}
@Override
public void setContentType(String contentType) {
response.putHeader(HttpHeaders.CONTENT_TYPE, contentType);
}
@Override
public void setHeader(String name, String value) {
response.putHeader(name, value);
}
@Override
public void setDateHeader(String name, long timestamp) {
response.putHeader(name, DateTimeFormatter.RFC_1123_DATE_TIME.format(
OffsetDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.of("GMT")))
);
}
@Override
public OutputStream getOutputStream() throws IOException {
if (useWriter) {
throw new IllegalStateException("getWriter() has already been called for this response");
}
useOOS = true;
return new OutputStream() {
@Override
public void write(int b) throws IOException {
outBuffer.appendByte((byte) b);
}
@Override
public void close() throws IOException {
response.end(outBuffer);
}
};
}
@Override
public PrintWriter getWriter() throws IOException {
if (useOOS) {
throw new IllegalStateException("getOutputStream() has already been called for this response");
}
useWriter = true;
return new PrintWriter(new Writer() {
@Override
public void write(char[] cbuf, int off, int len) throws IOException {
outBuffer.appendString(new String(cbuf, off, len));
}
@Override
public void flush() throws IOException {
response.write(outBuffer);
outBuffer = Buffer.buffer();
}
@Override
public void close() throws IOException {
response.end(outBuffer);
}
});
}
@Override
public void setCacheTime(long milliseconds) {
ExposeVaadinServerPkg.setCacheTime(this, milliseconds);
}
@Override
public void sendError(int errorCode, String message) throws IOException {
response.setStatusCode(errorCode).end(message);
}
@Override
public VertxVaadinService getService() {
return service;
}
@Override
public void addCookie(javax.servlet.http.Cookie cookie) {
routingContext.addCookie(CookieUtils.toVertxCookie(cookie));
}
@Override
public void setContentLength(int len) {
response.putHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(len));
}
/**
* Ends the response.
*
* Does nothing if response is already endend or if it is chunked.
*/
void end() {
if (!response.ended() && !response.isChunked()) {
response.end(outBuffer);
}
}
}
|
[
"[email protected]"
] | |
50c5a9a6bc2f0531f82e01387130cd34cf838d38
|
4a6fdf0c583ad41dd2d522a891585056de131d26
|
/Full coding/Risk-BuildThree/src/org/risk/model/MapLoader.java
|
d5eb9243046a37c349bfe50aff508ab59b29a09e
|
[] |
no_license
|
Riskproject/RISK_CODING
|
3bcec7afc55c355a042578f1c21810e6d308edf3
|
178e4645b1b6d0c1477a5cf7d08a4122874e9ebb
|
refs/heads/master
| 2021-01-22T07:06:28.339434 | 2013-04-13T20:35:26 | 2013-04-13T20:35:26 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,670 |
java
|
/*
* Copyright (C) 2013 author Arij,Omer
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.risk.model;
import java.io.File;
import javax.xml.bind.JAXBException;
import org.risk.model.Utility.XmlHelper;
import org.risk.view.MapVerifier;
/**
* An instance of this class gets the XML from the controller and converts it to
* Map object by calling related methods.
*
* @author Kian
*
*/
public class MapLoader {
private Map loadedMap;
private MapVisualization mapVisualization;
/**
* Default constructor
*/
public MapLoader() {
loadedMap = Map.getInstance("My Map");
mapVisualization = new MapVisualization();
}
/**
* This method gets the file and sends it to XML converter and receives a
* Map object from XML converter If the returned Map object is not null,
* then the method calls an appropriate method to convert it to a graph
*
* @param file
* Uploaded file by the user
* @param validateRequired
* This parameter indicates whether the map should be drawn or
* validated
*/
public void createMap(File file, Boolean validateRequired) {
try {
// TODO send this loaded map to model
loadedMap = XmlHelper.convertFromXml(file);
Logger.logMessage("*********************************************************************");
Logger.logMessage("Game Startup:");
Logger.logMessage("*********************************************************************");
Logger.logMessage("Loading from file " + "'"+file.getName()+"'");
Logger.logMessage("File properly Loaded");
if (!loadedMap.equals(null)) {
if (validateRequired) {
String result = null;
String returnResult = null;
result = loadedMap.validateMap();
if (result.equals(null) || result.equals(""))
returnResult = "This map is valid, based on the defined condtions";
else {
returnResult = "<html>This map is not valid due to following results:<br>";
returnResult += result;
returnResult += "</html>";
}
MapVerifier mapVerifier = new MapVerifier(returnResult);
} else {
Map.setInstance(loadedMap);
mapVisualization.extractMap(loadedMap);
}
} else {
// TODO show a pop-up error message
System.out.println("The selected file is not a Map file");
}
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* This method gets the file and sends it to XML converter and receives a
* Map object from XML converter
*
* @param file
* : XML File
* @return : Map object
*/
public Map getLoadedMapObject(File file) {
try {
loadedMap = XmlHelper.convertFromXml(file);
Logger.logMessage("*********************************************************************");
Logger.logMessage("Game Startup:");
Logger.logMessage("*********************************************************************");
Logger.logMessage("Loading from file " + "'"+file.getName()+"'");
Logger.logMessage("File properly Loaded");
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
return loadedMap;
}
}
}
|
[
"[email protected]"
] | |
d5384a2f69a40631d41c30fefd56b8cf1fe3674c
|
6b710469ecc5dab840f532e5936280684528d3a9
|
/src/main/java/org/derp/jaxl/Task2.java
|
fd672093aed5ac2ef56bf20bb78fae5dc5cc219d
|
[
"Apache-2.0"
] |
permissive
|
kuxi/jaxl
|
14001e85e8fd5c01a94900639a74eefd977f3945
|
92779163a386a61239b12a9b94fb198c2557eeff
|
refs/heads/master
| 2021-01-12T15:34:27.889310 | 2016-10-26T10:12:36 | 2016-10-26T10:12:36 | 71,833,310 | 0 | 1 | null | 2016-10-26T10:09:46 | 2016-10-24T21:22:48 |
Java
|
UTF-8
|
Java
| false | false | 263 |
java
|
package org.derp.jaxl;
import java.util.function.BiFunction;
public interface Task2<T, V> {
<U> Task<U> map(BiFunction<T, V, U> transformer);
// <U> Task3<T, V, U> join(Task<U> other);
<U> Task<U> flatMap(BiFunction<T, V, Task<U>> transformer);
}
|
[
"[email protected]"
] | |
754c148841f9974b01efaff7c443857251c7c562
|
185693d9c090ead9b7b8bcfc45cdd6c713538ff4
|
/imooc-springboot-starter-master/demo2020/src/main/java/dubbodemo/demo/decorator/Test.java
|
d4308bf0938ae832961d5e47ca97fa420dafb7ab
|
[] |
no_license
|
wwwwj1994/demo2020
|
8f4d4b4c6ef2a32e2cb8acc64dbb963a9c9a220a
|
a66d78489a9c22fd3fe374ceb96e04d22fad7766
|
refs/heads/master
| 2022-12-12T04:33:04.247305 | 2020-09-12T15:54:03 | 2020-09-12T15:54:03 | 294,980,365 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 484 |
java
|
package dubbodemo.demo.decorator;
/**
* @author wj
* @date 2020/9/7 - 22:45
*/
public class Test {
public static void main(String[] args) {
MyDecorator myDecorator = new SumGperTheBar();
System.out.println(myDecorator.showMenu());
myDecorator = new NormGperTheBar(myDecorator);
System.out.println(myDecorator.showMenu());
myDecorator = new SupperGperTheBar(myDecorator);
System.out.println(myDecorator.showMenu());
}
}
|
[
"[email protected]"
] | |
50d33647ded14d19e26a34d26469f05583144a1e
|
0c7056596cabc17d76a3c105fc5e4c93282fff82
|
/src/main/java/uk/ac/imperial/einst/resource/Pool.java
|
daa69b8cebc280abeafeb89130e05d45942b699c
|
[] |
no_license
|
sammacbeth/electronic-institutions
|
8b03acfc7e7e8f9444a48d9c544810d919d33bc9
|
2935a07e6f07cd433a594d5cc71f01577b3f4e5d
|
refs/heads/master
| 2020-05-29T20:24:59.808246 | 2015-01-26T11:52:01 | 2015-01-26T11:52:01 | 16,578,039 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,644 |
java
|
package uk.ac.imperial.einst.resource;
import java.util.HashSet;
import java.util.Set;
import uk.ac.imperial.einst.Institution;
public class Pool {
final Institution inst;
final Set<String> contribRoles;
final Set<String> extractRoles;
final Set<String> removalRoles;
final ArtifactMatcher artifactMatcher;
final Set<Object> artifacts = new HashSet<Object>();
public Pool(Institution inst, Set<String> contribRoles,
Set<String> extractRoles, Set<String> removalRoles,
ArtifactMatcher artifactMatcher) {
super();
this.inst = inst;
this.contribRoles = contribRoles;
this.extractRoles = extractRoles;
this.removalRoles = removalRoles;
this.artifactMatcher = artifactMatcher;
}
public Institution getInst() {
return inst;
}
public Set<String> getContribRoles() {
return contribRoles;
}
public Set<String> getExtractRoles() {
return extractRoles;
}
public Set<String> getRemovalRoles() {
return removalRoles;
}
public ArtifactMatcher getArtifactMatcher() {
return artifactMatcher;
}
public Set<Object> getArtifacts() {
return artifacts;
}
public class Added {
final Provision prov;
final Pool pool;
public Added(Provision prov) {
super();
this.prov = prov;
this.pool = Pool.this;
}
public Provision getProv() {
return prov;
}
public Pool getPool() {
return pool;
}
@Override
public String toString() {
return "added(" + pool + ", " + prov + ")";
}
}
@Override
public String toString() {
return "pool(" + inst + ", " + contribRoles + ", " + extractRoles
+ ", " + artifactMatcher + ", " + artifacts.size()
+ " artifacts)";
}
}
|
[
"[email protected]"
] | |
4de15fd0e3a9fe71324568272385a393950c7a31
|
bfe635575c3c9e3fdcf507edb19326dab0f7daa8
|
/src/EXERCISEInheritance/restaurant/Product.java
|
a4cd0fa0c16bbfa5a417e92c40ad7494f5e55c32
|
[] |
no_license
|
GerganaL/JavaOOP
|
99bbeda833623747134724a2cc569bef179bc068
|
84069ebaec486a7a6333f716fe6f1406d9d9ee07
|
refs/heads/master
| 2023-03-31T01:58:56.135661 | 2021-04-08T13:53:19 | 2021-04-08T13:53:19 | 341,617,419 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 386 |
java
|
package EXERCISEInheritance.restaurant;
import java.math.BigDecimal;
public class Product {
private String name;
private BigDecimal price;
public Product(String name, BigDecimal price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public BigDecimal getPrice() {
return price;
}
}
|
[
"[email protected]"
] | |
8a9b05d6138e86d2100ebbeef9a3f9cbe7786c3c
|
6e4dc3a945a11644e2679bdd99641c3b33a649c3
|
/src/main/java/com/learning/bank/app/main/RegisterApp.java
|
3064e8357cc0e284bdf8390aa88612abb026219e
|
[] |
no_license
|
shree308/TestRepo
|
70001434f0566b1417eea0ec5c77a583f9efdb06
|
8c2be678fbd864b09692669a872010736afefca6
|
refs/heads/master
| 2021-01-25T14:04:31.767240 | 2018-03-03T02:10:25 | 2018-03-03T02:10:25 | 123,650,370 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 850 |
java
|
package com.learning.bank.app.main;
import com.learning.bank.app.service.UserRegisterService;
public class RegisterApp {
UserRegisterService userRegisterService = null;
public RegisterApp() {
userRegisterService = new UserRegisterService();
}
public static void main(String[] args) {
System.out.println("Registering users");
System.out.println(args[0]);
System.out.println(args[1]);
System.out.println(args[2]);
RegisterApp app = new RegisterApp();
//userName - arg[0], userId - arg[1], address - arg[2]
if (app.userRegisterService.registerUser(args[0],args[1],args[2]))
{
System.out.println("Congratulations !!! " + args[0] + " successfully registered!!");
}
else {
System.out.println("Sorry could not register user : " + args[0]);
}
}
}
|
[
"[email protected]"
] | |
c350365359f9b0218da6b6f9d6864c2f35267a38
|
985d643cbb6e6c6f019ae5776ce7c21891c9cd4f
|
/app/src/main/java/com/example/audiovideoapp/MainActivity.java
|
9cbb950fe6508824b8cc1c27b3695169e77edc03
|
[] |
no_license
|
MuhammadAliGhaffar/AudioVideoApp
|
97deb75a80cca438a8383cfb347b02ce58feeff5
|
6210151a4e6893d42d7408914c733628f91f90e9
|
refs/heads/master
| 2022-12-04T16:34:45.018991 | 2020-08-23T09:41:34 | 2020-08-23T09:41:34 | 288,974,769 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,916 |
java
|
package com.example.audiovideoapp;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.SeekBar;
import android.widget.Toast;
import android.widget.VideoView;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Timer;
import java.util.TimerTask;
public class MainActivity extends AppCompatActivity implements View.OnClickListener,SeekBar.OnSeekBarChangeListener {
//UI Components
private VideoView myvideoView;
private Button btnPlayVideo,btnPlayMusic,btnPauseMusic;
private MediaController mediaController;
private MediaPlayer playerAudio;
private SeekBar mSeekBarVoume,mSeekBarMove;
private AudioManager mAudioManager;
private Timer timer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myvideoView=findViewById(R.id.myvideoView);
btnPlayVideo=findViewById(R.id.btnPlayVideo);
btnPlayMusic=findViewById(R.id.btnPlayMusic);
btnPauseMusic=findViewById(R.id.btnPauseMusic);
mSeekBarVoume=findViewById(R.id.seekBarVolume);
mSeekBarMove=findViewById(R.id.seekBarMove);
btnPlayVideo.setOnClickListener(MainActivity.this);
btnPlayMusic.setOnClickListener(MainActivity.this);
btnPauseMusic.setOnClickListener(MainActivity.this);
mediaController = new MediaController(MainActivity.this);
playerAudio= MediaPlayer.create(this, R.raw.music);
mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
int maximumVoulumeOfUserDevice = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
int currentVoulumeOfUserDevice = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
//int minimumVoulumeOfUserDevice = mAudioManager.getStreamMinVolume(AudioManager.STREAM_MUSIC);
mSeekBarVoume.setMax(maximumVoulumeOfUserDevice);
mSeekBarVoume.setProgress(currentVoulumeOfUserDevice);
mSeekBarVoume.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if(fromUser){
//Toast.makeText(MainActivity.this,progress+"",Toast.LENGTH_SHORT).show();
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,progress,0);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
mSeekBarMove.setOnSeekBarChangeListener(MainActivity.this);
mSeekBarMove.setMax(playerAudio.getDuration());
playerAudio.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
timer.cancel();
Toast.makeText(MainActivity.this,"Music is Ended", Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onClick(View buttonView) {
switch (buttonView.getId()){
case R.id.btnPlayVideo:
myvideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.mow));
myvideoView.setMediaController(mediaController);
mediaController.setAnchorView(myvideoView);
myvideoView.start();
break;
case R.id.btnPlayMusic:
playerAudio.start();
timer=new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
mSeekBarMove.setProgress(playerAudio.getCurrentPosition());
}
},0,1000);
Log.i("TAG","Play Music Button is Tapped");
break;
case R.id.btnPauseMusic:
playerAudio.pause();
timer.cancel();
Log.i("TAG","Pause Music Button is Tapped");
break;
}
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if(fromUser){
//Toast.makeText(MainActivity.this,progress+"", Toast.LENGTH_SHORT).show();
playerAudio.seekTo(progress);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
playerAudio.pause();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
playerAudio.start();
}
}
|
[
"[email protected]"
] | |
3a5f0d4d66b713a25676ef2e71b9d78e57d2f183
|
b1a0fdc3c41bd757c5885b80abcd0df7b44bf32c
|
/app/build/generated/data_binding_base_class_source_out/debug/out/com/sh/wm/ministry/databinding/FragmentInspVisitOutOfPlaneBinding.java
|
5983be4d5efd7ecc6f0a601cd6f4317c6154d810
|
[] |
no_license
|
aseelamassi/Ministry
|
a3ac84f443afb02714433d010efb3063a774af8a
|
aa99c99aad1b0f205c7579d9354d9fc9e515410b
|
refs/heads/master
| 2023-03-27T16:40:18.510590 | 2021-03-31T21:06:49 | 2021-03-31T21:06:49 | 353,489,797 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,137 |
java
|
// Generated by view binder compiler. Do not edit!
package com.sh.wm.ministry.databinding;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewbinding.ViewBinding;
import com.sh.wm.ministry.R;
import java.lang.NullPointerException;
import java.lang.Override;
import java.lang.String;
public final class FragmentInspVisitOutOfPlaneBinding implements ViewBinding {
@NonNull
private final RelativeLayout rootView;
@NonNull
public final TextView insCmpName;
private FragmentInspVisitOutOfPlaneBinding(@NonNull RelativeLayout rootView,
@NonNull TextView insCmpName) {
this.rootView = rootView;
this.insCmpName = insCmpName;
}
@Override
@NonNull
public RelativeLayout getRoot() {
return rootView;
}
@NonNull
public static FragmentInspVisitOutOfPlaneBinding inflate(@NonNull LayoutInflater inflater) {
return inflate(inflater, null, false);
}
@NonNull
public static FragmentInspVisitOutOfPlaneBinding inflate(@NonNull LayoutInflater inflater,
@Nullable ViewGroup parent, boolean attachToParent) {
View root = inflater.inflate(R.layout.fragment_insp_visit_out_of_plane, parent, false);
if (attachToParent) {
parent.addView(root);
}
return bind(root);
}
@NonNull
public static FragmentInspVisitOutOfPlaneBinding bind(@NonNull View rootView) {
// The body of this method is generated in a way you would not otherwise write.
// This is done to optimize the compiled bytecode for size and performance.
int id;
missingId: {
id = R.id.ins_cmp_name;
TextView insCmpName = rootView.findViewById(id);
if (insCmpName == null) {
break missingId;
}
return new FragmentInspVisitOutOfPlaneBinding((RelativeLayout) rootView, insCmpName);
}
String missingId = rootView.getResources().getResourceName(id);
throw new NullPointerException("Missing required view with ID: ".concat(missingId));
}
}
|
[
"[email protected]"
] | |
766882d823b94bcd377706960552486503ac4f2f
|
c4ef6d6d465b883c2c0f927d096c6af760737cc5
|
/src/com/example/waysmap/HTTPTools.java
|
2ef290a80d471661f2ef436977fd0f3db58efdff
|
[] |
no_license
|
djisse/WazeMap
|
fabf1cceef3087b91d39b025c01640c2c4097d4e
|
9c74aabcbf14ddc31323350be6b4f5dcff903481
|
refs/heads/master
| 2021-01-01T18:11:33.916952 | 2014-06-01T14:53:50 | 2014-06-01T14:53:50 | null | 0 | 0 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 5,913 |
java
|
package com.example.waysmap;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.util.ArrayList;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.params.ConnManagerParams;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class HTTPTools {
/** The time it takes for our client to timeout */
public static final int HTTP_TIMEOUT = 30 * 1000; // milliseconds
/** Single instance of our HttpClient */
private static HttpClient mHttpClient;
/**
* Get our single instance of our HttpClient object.
*
* @return an HttpClient object with connection parameters set
*/
private static HttpClient getHttpClient() {
if (mHttpClient == null) {
mHttpClient = new DefaultHttpClient();
final HttpParams params = mHttpClient.getParams();
HttpConnectionParams.setConnectionTimeout(params, HTTP_TIMEOUT);
HttpConnectionParams.setSoTimeout(params, HTTP_TIMEOUT);
ConnManagerParams.setTimeout(params, HTTP_TIMEOUT);
}
return mHttpClient;
}
/**
* Performs an HTTP Post request to the specified url with the
* specified parameters.
*
* @param url The web address to post the request to
* @param postParameters The parameters to send via the request
* @return The result of the request
* @throws Exception
*/
public static String executeHttpPost(String url, ArrayList<NameValuePair> postParameters) throws Exception {
BufferedReader in = null;
try {
HttpClient client = getHttpClient();
HttpPost request = new HttpPost(url);
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParameters);
request.setEntity(formEntity);
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null) {
sb.append(line + NL);
}
in.close();
String result = sb.toString();
return result;
}
finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* Performs an HTTP GET request to the specified url.
*
* @param url The web address to post the request to
* @return The result of the request
* @throws Exception
*/
public static String executeHttpGet(String url) throws Exception {
BufferedReader in = null;
try {
HttpClient client = getHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI(url));
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null) {
sb.append(line + NL);
}
in.close();
String result = sb.toString();
return result;
}
finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
throw new Exception("Erreur lors de la recuperation de la requete");
}
}
}
}
public static ArrayList<Point> parseJSON(String result) throws Exception{
String returnString="";
// Parse les donnes JSON
ArrayList<Point> liste=new ArrayList<Point>();
try{
JSONArray jArray = new JSONArray(result);
for(int i=0;i<jArray.length();i++){
JSONObject json_data = jArray.getJSONObject(i);
Point current=new Point(json_data.getInt("id"),
json_data.getDouble("longitude"),
json_data.getDouble("latitude"),
json_data.getString("tag"));
liste.add(current);
// Rsultats de la requte
returnString += "\n\t" + jArray.getJSONObject(i);
}
}catch(JSONException e){
throw new Exception("Erreur lors du parsage JSON");
}
return liste;
}
public static ArrayList<Membre> parseJSONMembre(String result) throws Exception{
String returnString="";
// Parse les donnes JSON
ArrayList<Membre> liste=new ArrayList<Membre>();
try{
JSONArray jArray = new JSONArray(result);
for(int i=0;i<jArray.length();i++){
JSONObject json_data = jArray.getJSONObject(i);
Membre current=new Membre(json_data.getInt("id"),
json_data.getString("pseudo"),
json_data.getString("type"),
json_data.getString("mdp"));
liste.add(current);
// Rsultats de la requte
returnString += "\n\t" + jArray.getJSONObject(i);
}
}catch(JSONException e){
throw new Exception("Erreur lors du parsage JSON");
}
return liste;
}
}
|
[
"[email protected]"
] | |
7889d2997e44230fb8a3113bf5e80aa015144cf6
|
c3bfa6d7b06ea9262d1d82d2d0478ab42709a7bf
|
/spring-core-04/src/main/java/spring/core/dao/IElectionsDao.java
|
16450b929b20c028fbe3f091a141ca92039f7688
|
[] |
no_license
|
ICC-POO-Group2/Elections-Maven
|
5bba085aeae8201c8db1710ee164e4ba2d4d8a10
|
d31cfe288e53b63ed280de8390df8acef31b3d55
|
refs/heads/master
| 2021-01-21T11:30:08.904555 | 2017-03-26T16:00:46 | 2017-03-26T16:00:46 | 83,568,739 | 1 | 0 | null | 2017-03-26T16:00:47 | 2017-03-01T15:16:37 |
Java
|
UTF-8
|
Java
| false | false | 370 |
java
|
package spring.core.dao;
import spring.core.dao.entities.ListeElectorale;
public interface IElectionsDao {
public double getSeuilElectoral();
public int getNbSiegesAPourvoir();
public ListeElectorale[] getListesElectorales();
public void setListesElectorales(ListeElectorale[] listesElectorales);
public String getInFileName();
public String getOutFileName();
}
|
[
"[email protected]"
] | |
54034fb35594efe9b877c2f50cfe7d66b440802a
|
5a9568f06d54c8a8ffa7d3efec8063f474372817
|
/app/src/main/java/com/xinyuan/xyorder/common/bean/buy/TimchooesBean.java
|
3b15b5c421b66a1db659236ce080a5480694d7fc
|
[] |
no_license
|
xiasiqiu/ShareFood
|
a38851ccdcd06c3647cfac0fb925c2cb301c8c0c
|
e37fc520ce79b1b88a15dcdc26e5ff82e64da1f7
|
refs/heads/master
| 2022-12-01T00:35:50.329787 | 2020-07-29T09:46:44 | 2020-07-29T09:46:44 | 283,417,760 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 308 |
java
|
package com.xinyuan.xyorder.common.bean.buy;
/**
* Created by f-x on 2017/10/2517:41
*/
public class TimchooesBean {
public boolean isDisMiss;
public TimchooesBean(boolean isDisMiss) {
this.isDisMiss = isDisMiss;
}
public boolean isDisMiss() {
return isDisMiss;
}
}
|
[
"[email protected]"
] | |
091c3e50a6680f44c6abc4d37e407d46a2f2febf
|
ae865fb134648d58f55160e75311a2ac74bbc312
|
/java MIDlets/Canvas/src/Logica/Primitivas.java
|
0a2fad348ff990651770bc85def9fc80cdec4ea6
|
[] |
no_license
|
andresSaldanaAguilar/Mobile-Applications
|
aebc3e1418a17dee06f77c770eaabf50632df60d
|
689452e6e5fe666204c4ab865ef303f846376d89
|
refs/heads/master
| 2020-03-26T17:38:46.801677 | 2018-11-17T04:36:47 | 2018-11-17T04:36:47 | 145,172,482 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,518 |
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 Logica;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Primitivas extends MIDlet implements CommandListener {
private Display d;
private Command cs;
private Canvas ca;
public Primitivas( ) {
d = Display.getDisplay(this);
ca = new Canvas() {
private int w;
private int h;
public void paint (Graphics g){
w=getWidth();
h=getHeight();
g.setColor(0, 0, 0);
g.fillRect(0, 0, w, h);
g.setColor(255, 255, 255);
g.setStrokeStyle(Graphics.SOLID);
g.drawLine(0, h/2, w-1, h/2);
g.setColor(0, 255, 0);
g.setStrokeStyle(Graphics.DOTTED);
g.drawLine(0, 0, w-1, h-1);
g.setColor(255, 0, 0);
g.setStrokeStyle(Graphics.DOTTED);
g.drawRect(w/4, 0, w/2, h/4);
g.setColor(0, 0, 255);
g.setStrokeStyle(Graphics.SOLID);
g.drawRoundRect(w/4 + 4, 4, w/2 -8, h/4 -8, 8,8);
}
};
cs=new Command("Salir",Command.EXIT, 3);
ca.addCommand(cs);
ca.setCommandListener(this);
}
protected void startApp( ) {
d.setCurrent(ca);
}
protected void pauseApp( ) { }
protected void destroyApp(boolean b) { }
public void commandAction(Command co, Displayable di) {
if (co ==cs) {
destroyApp(true);
notifyDestroyed();
} else d.setCurrent(new Alert("", "Otro comando digitado...", null, AlertType.ERROR));
}
}
|
[
"[email protected]"
] | |
03d400eddee55163f2fffa8476b678713146383b
|
e2e8581d3992e3b0644cf76ad44028b524bb4c39
|
/com/so/pro/RoomUI.java
|
4a40b058bbede865ecb6fd2ce1352d85003e68db
|
[] |
no_license
|
Chae-jeongin/Networkproject
|
99374b488470bc454efbf10c061f1b6c02602d7b
|
65a882c5ea532a9e3f80fb501977cd0526e8df30
|
refs/heads/master
| 2023-02-03T13:51:22.883240 | 2020-12-16T11:39:57 | 2020-12-16T11:39:57 | 321,913,751 | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 6,389 |
java
|
package com.so.pro;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
public class RoomUI extends JFrame implements ActionListener {
EightClient client;
Room room;
JTextArea chatArea;
JTextField chatField;
JList uList;
DefaultListModel model;
ImageIcon icon;
public RoomUI(EightClient client, Room room) {
this.client = client;
this.room = room;
setTitle("Octopus ChatRoom : " + room.toProtocol());
icon = new ImageIcon("icon2.png");
this.setIconImage(icon.getImage());//타이틀바에 이미지넣기
initialize();
}
private void initialize() {
setBounds(100, 100, 502, 481);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
setResizable(false);
// 채팅 패널
final JPanel panel = new JPanel();
panel.setBounds(12, 10, 300, 358);
getContentPane().add(panel);
panel.setLayout(new BorderLayout(0, 0));
JScrollPane scrollPane = new JScrollPane();
panel.add(scrollPane, BorderLayout.CENTER);
chatArea = new JTextArea();
chatArea.setBackground(Color.WHITE);
chatArea.setEditable(false); // 수정불가
scrollPane.setViewportView(chatArea); // 화면 보임
chatArea.append("♠매너 채팅 하세요!!\n");
JPanel panel1 = new JPanel();
// 글쓰는 패널
panel1.setBounds(12, 378, 300, 34);
getContentPane().add(panel1);
panel1.setLayout(new BorderLayout(0, 0));
chatField = new JTextField();
panel1.add(chatField);
chatField.setColumns(10);
chatField.addKeyListener(new KeyAdapter() {
// 엔터 버튼 이벤트
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
msgSummit();
}
}
});
// 참여자 패널
JPanel panel2 = new JPanel();
// 참여자 패널
panel2.setBounds(324, 10, 150, 358);
getContentPane().add(panel2);
panel2.setLayout(new BorderLayout(0, 0));
JScrollPane scrollPane1 = new JScrollPane();
panel2.add(scrollPane1, BorderLayout.CENTER);
uList = new JList(new DefaultListModel());
model = (DefaultListModel) uList.getModel();
scrollPane1.setViewportView(uList);
// send button
JButton roomSendBtn = new JButton("보내기");
roomSendBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
msgSummit();
chatField.requestFocus();
}
});
roomSendBtn.setBounds(324, 378, 75, 34);
getContentPane().add(roomSendBtn);
// exit button
JButton roomExitBtn = new JButton("나가기");
roomExitBtn.addMouseListener(new MouseAdapter() { // 나가기 버튼
@Override
public void mouseClicked(MouseEvent e) {
int ans = JOptionPane.showConfirmDialog(panel, "방을 삭제 하시겠습니까?", "삭제확인", JOptionPane.OK_CANCEL_OPTION);
if (ans == 0) { // 삭제
try {
client.getUser().getDos().writeUTF(User.GETOUT_ROOM + "/" + room.getRoomNum());
for (int i = 0; i < client.getUser().getRoomArray().size(); i++) {
if (client.getUser().getRoomArray().get(i).getRoomNum() == room.getRoomNum()) {
client.getUser().getRoomArray().remove(i);
}
}
setVisible(false);
} catch (IOException e1) {
e1.printStackTrace();
}
} else { // 그냥 나가기
setVisible(false);
}
}
});
roomExitBtn.setBounds(400, 378, 75, 34);
getContentPane().add(roomExitBtn);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
setVisible(true);
//////////////////////////////////////
// 채팅내용 저장 및 가져오기 메뉴
JMenu mnuSaveChat = new JMenu("채팅저장");
mnuSaveChat.addActionListener(this);
menuBar.add(mnuSaveChat);
JMenuItem mitSaveChatToFile = new JMenuItem("파일로저장");
mitSaveChatToFile.addActionListener(this);
mnuSaveChat.add(mitSaveChatToFile);
JMenu mnuLoadChat = new JMenu("저장채팅확인");
mnuLoadChat.addActionListener(this);
menuBar.add(mnuLoadChat);
JMenuItem mitLoadChatFromFile = new JMenuItem("파일열기");
mitLoadChatFromFile.addActionListener(this);
mnuLoadChat.add(mitLoadChatFromFile);
///////////////////////////////////////////////
chatField.requestFocus();
this.addWindowListener(new WindowAdapter() { // 윈도우 나가기
@Override
public void windowClosing(WindowEvent e) {
try {
client.getUser().getDos().writeUTF(User.GETOUT_ROOM + "/" + room.getRoomNum());
for (int i = 0; i < client.getUser().getRoomArray().size(); i++) {
if (client.getUser().getRoomArray().get(i).getRoomNum() == room.getRoomNum()) {
client.getUser().getRoomArray().remove(i);
}
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
}
private void msgSummit() {
String string = chatField.getText();
if (!string.equals("")) {
try {
// 채팅방에 메시지 보냄
client.getDos()
.writeUTF(User.ECHO02 + "/" + room.getRoomNum() + "/" + client.getUser().toString() + string);
chatField.setText("");
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case "파일로저장":
String filename = UtilFileIO.saveFile(chatArea);
JOptionPane.showMessageDialog(chatArea.getParent(),
"채팅내용을 파일명(" + filename + ")으로 저장하였습니다",
"채팅백업", JOptionPane.INFORMATION_MESSAGE);
break;
case "파일열기":
filename = UtilFileIO.getFilenameFromFileOpenDialog("./");
String text = UtilFileIO.loadFile(filename);
TextViewUI textview = new TextViewUI(text);
break;
}
}
}
|
[
"[email protected]"
] | |
b8cf35c875b379ea2f8fdec9c1f03766208244ff
|
390df44aa7b6c720903076fd8816b770c7033ee8
|
/src/com/jmeyer/bukkit/jlevel/JLevelEntityListener.java
|
3f75a9847a7e804837a7c9bf8e28eb7722ac3c5b
|
[] |
no_license
|
JGMEYER/JLevel-Plugin
|
1ec1e87ddd128b849dae3cfdb832de698d5e8720
|
f9c43ecbe3bc766b73558b2192d9f057a5d70e3c
|
refs/heads/master
| 2021-01-13T02:36:44.737447 | 2011-01-23T06:01:26 | 2011-01-23T06:01:26 | 1,262,659 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,109 |
java
|
package com.jmeyer.bukkit.jlevel;
import java.util.ArrayList;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityListener;
public class JLevelEntityListener extends EntityListener {
private final JLevelPlugin plugin;
public JLevelEntityListener(JLevelPlugin instance) {
plugin = instance;
}
@Override
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
Entity damager = event.getDamager();
if (damager instanceof Player) {
Player player = (Player)damager;
int itemId = player.getItemInHand().getTypeId();
if (DatabaseManager.playerCanUseItem(player, itemId)) {
if (event.getEntity() instanceof LivingEntity) {
LivingEntity le = (LivingEntity)event.getEntity();
String leClass = event.getEntity().getClass().getName();
String leName = leClass.substring(leClass.indexOf(".Craft") + 6, leClass.length());
if ((le.getHealth()-event.getDamage() < 0) && (le.getHealth() >= 0)) {
ArrayList<String> skills = DatabaseManager.relatedSkillsForItem(itemId);
for (String skill : skills) {
int exp = DatabaseManager.getExperienceGainedFromAction(skill, "entitykill", leName, "");
DatabaseManager.addExperience(player, skill, exp);
}
}
}
} else {
event.setCancelled(true);
}
}
// MobType creeper = MobType.CREEPER;
// creeper == MobType.valueOf(creeper.toString())
// System.out.println("Entity: \n(" + event.getEntity().getEntityId() + ") \n" + event.getEntity().toString());
// System.out.println("Damager: \n(" + event.getDamager().getEntityId() + ") \n" + event.getDamager().toString());
}
}
|
[
"[email protected]"
] | |
36e47f996258b34afb6048234bf8193ab33da7fa
|
a8eeeadb52c36d37ddd3204c9fcb7ea1642c5ff3
|
/src/main/java/section4/Ex8.java
|
1215c8903714a45e89e19b35f4a0cb8b2b54dd33
|
[] |
no_license
|
os-tll/ThinkInJava
|
ff00d9ec28356ae99604ade12e95c417a9e0fa81
|
42115afc0d9078d96bd4e8cfaf55e257efb58207
|
refs/heads/master
| 2022-07-18T02:00:52.779623 | 2019-11-05T07:53:17 | 2019-11-05T07:53:17 | 136,112,710 | 0 | 0 | null | 2022-06-29T17:28:20 | 2018-06-05T03:08:59 |
Java
|
UTF-8
|
Java
| false | false | 725 |
java
|
package section4;
/**
* switch练习
* @author tanglonglong
* @version 1.0
* @date 2019/6/22 15:06
*/
public class Ex8 {
public static void main(String[] args) {
for (int i = 'a'; i <= 'e'; i++){
switch (i){
case 'a':
System.out.println("I AM A");
case 'b':
System.out.println("I AM B");
break;
case 'c':
System.out.println("I AM C");
break;
case 'd':
System.out.println("I AM D");
break;
default:
System.out.println(i);
}
}
}
}
|
[
"[email protected]"
] | |
585ca2124865ae90b28a7b5ed6f339cdb742d5b7
|
f4f5b6a2e8089b6180f3026a51c7a7ba24479b4b
|
/src/main/java/com/dlj/blog/utils/MarkdownUtils.java
|
cfe756e742b3a5a0bf1215a0273809fb235a9d03
|
[] |
no_license
|
co2ffee/coffsty
|
fdc0b04133970e990f3a1fb0a3756ddaae4205e0
|
3006a9c82941f634656f26420de84fffb2d48f37
|
refs/heads/master
| 2023-04-21T23:39:48.614764 | 2021-05-21T05:04:16 | 2021-05-21T05:04:16 | 361,131,498 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,132 |
java
|
package com.dlj.blog.utils;
import org.commonmark.Extension;
import org.commonmark.ext.gfm.tables.TableBlock;
import org.commonmark.ext.gfm.tables.TablesExtension;
import org.commonmark.ext.heading.anchor.HeadingAnchorExtension;
import org.commonmark.node.Link;
import org.commonmark.node.Node;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.AttributeProvider;
import org.commonmark.renderer.html.AttributeProviderContext;
import org.commonmark.renderer.html.AttributeProviderFactory;
import org.commonmark.renderer.html.HtmlRenderer;
import java.util.*;
/**
* @Description: Markdown
* @Author: dljdlj
* @Date: 2021/4/2
* @Url: dljdlj.top
* @Remark:
*/
public class MarkdownUtils {
/**
* markdown格式转换成HTML格式
* @param markdown
* @return
*/
public static String markdownToHtml(String markdown) {
Parser parser = Parser.builder().build();
Node document = parser.parse(markdown);
HtmlRenderer renderer = HtmlRenderer.builder().build();
return renderer.render(document);
}
/**
* 增加扩展[标题锚点,表格生成]
* Markdown转换成HTML
* @param markdown
* @return
*/
public static String markdownToHtmlExtensions(String markdown) {
//h标题生成id
Set<Extension> headingAnchorExtensions = Collections.singleton(HeadingAnchorExtension.create());
//转换table的HTML
List<Extension> tableExtension = Arrays.asList(TablesExtension.create());
Parser parser = Parser.builder()
.extensions(tableExtension)
.build();
Node document = parser.parse(markdown);
HtmlRenderer renderer = HtmlRenderer.builder()
.extensions(headingAnchorExtensions)
.extensions(tableExtension)
.attributeProviderFactory(new AttributeProviderFactory() {
public AttributeProvider create(AttributeProviderContext context) {
return new CustomAttributeProvider();
}
})
.build();
return renderer.render(document);
}
/**
* 处理标签的属性
*/
static class CustomAttributeProvider implements AttributeProvider {
@Override
public void setAttributes(Node node, String tagName, Map<String, String> attributes) {
//改变a标签的target属性为_blank
if (node instanceof Link) {
attributes.put("target", "_blank");
}
if (node instanceof TableBlock) {
attributes.put("class", "ui celled table");
}
}
}
public static void main(String[] args) {
String table = "| hello | hi | 哈哈哈 |\n" +
"| ----- | ---- | ----- |\n" +
"| 斯维尔多 | 士大夫 | f啊 |\n" +
"| 阿什顿发 | 非固定杆 | 撒阿什顿发 |\n" +
"\n";
String a = "[coffsty](http://47.98.60.238:8080/)";
System.out.println(markdownToHtmlExtensions(a));
}
}
|
[
"[email protected]"
] | |
156e8ba93853bbfb1ca91900e667793d5968e85d
|
24750a5e3d7e733a9ac6c38365a8c615cab8e507
|
/back end/excel microservice/src/main/java/com/fms/api/MediaApi.java
|
33ab9ff647a1382f2e2c4365532f83305e3c7eda
|
[] |
no_license
|
AravinthanPraba007/FeedbackSystem
|
13ad5c78fe47a1cae80efdbc14d792c4194d6a00
|
3abf9784297f0f9adab578a5987e9ee1af9bc528
|
refs/heads/master
| 2020-12-21T16:21:27.122150 | 2020-01-28T05:48:21 | 2020-01-28T05:48:21 | 236,487,514 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,555 |
java
|
/**
* NOTE: This class is auto generated by the swagger code generator program (3.0.16).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
package com.fms.api;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
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.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.CookieValue;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-01-27T17:03:08.953+05:30[Asia/Calcutta]")
@Api(value = "media", description = "the media API")
public interface MediaApi {
Logger log = LoggerFactory.getLogger(MediaApi.class);
default Optional<ObjectMapper> getObjectMapper(){
return Optional.empty();
}
default Optional<HttpServletRequest> getRequest(){
return Optional.empty();
}
default Optional<String> getAcceptHeader() {
return getRequest().map(r -> r.getHeader("Accept"));
}
@ApiOperation(value = "To download excel", nickname = "getExcelSheetUsingGET", notes = "Gets the excel sheet", tags={ "media-controller", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 403, message = "Forbidden"),
@ApiResponse(code = 404, message = "Not Found") })
@RequestMapping(value = "/media/download",
method = RequestMethod.GET)
default ResponseEntity<Void> getExcelSheetUsingGET() {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default MediaApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "To export excel", nickname = "uploadExcelSheetUsingGET", notes = "Gets the excel sheet", tags={ "media-controller", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 403, message = "Forbidden"),
@ApiResponse(code = 404, message = "Not Found") })
@RequestMapping(value = "/media/export",
method = RequestMethod.GET)
default ResponseEntity<Void> uploadExcelSheetUsingGET() {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default MediaApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}
|
[
"[email protected]"
] | |
12a835d58acad589a38058fc85dbdb11be159e2d
|
d71e879b3517cf4fccde29f7bf82cff69856cfcd
|
/ExtractedJars/Shopkick_com.shopkick.app/javafiles/android/support/v7/widget/AppCompatImageHelper.java
|
17b5cec169287d912326580f6f27cce729b7565b
|
[
"MIT"
] |
permissive
|
Andreas237/AndroidPolicyAutomation
|
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
|
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
|
refs/heads/master
| 2020-04-10T02:14:08.789751 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 20,936 |
java
|
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package android.support.v7.widget;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.support.v4.widget.ImageViewCompat;
import android.support.v7.content.res.AppCompatResources;
import android.util.AttributeSet;
import android.widget.ImageView;
// Referenced classes of package android.support.v7.widget:
// TintInfo, AppCompatDrawableManager, DrawableUtils, TintTypedArray
public class AppCompatImageHelper
{
public AppCompatImageHelper(ImageView imageview)
{
// 0 0:aload_0
// 1 1:invokespecial #19 <Method void Object()>
mView = imageview;
// 2 4:aload_0
// 3 5:aload_1
// 4 6:putfield #21 <Field ImageView mView>
// 5 9:return
}
private boolean applyFrameworkTintUsingColorFilter(Drawable drawable)
{
if(mTmpInfo == null)
//* 0 0:aload_0
//* 1 1:getfield #27 <Field TintInfo mTmpInfo>
//* 2 4:ifnonnull 18
mTmpInfo = new TintInfo();
// 3 7:aload_0
// 4 8:new #29 <Class TintInfo>
// 5 11:dup
// 6 12:invokespecial #30 <Method void TintInfo()>
// 7 15:putfield #27 <Field TintInfo mTmpInfo>
TintInfo tintinfo = mTmpInfo;
// 8 18:aload_0
// 9 19:getfield #27 <Field TintInfo mTmpInfo>
// 10 22:astore_2
tintinfo.clear();
// 11 23:aload_2
// 12 24:invokevirtual #33 <Method void TintInfo.clear()>
Object obj = ((Object) (ImageViewCompat.getImageTintList(mView)));
// 13 27:aload_0
// 14 28:getfield #21 <Field ImageView mView>
// 15 31:invokestatic #39 <Method ColorStateList ImageViewCompat.getImageTintList(ImageView)>
// 16 34:astore_3
if(obj != null)
//* 17 35:aload_3
//* 18 36:ifnull 49
{
tintinfo.mHasTintList = true;
// 19 39:aload_2
// 20 40:iconst_1
// 21 41:putfield #43 <Field boolean TintInfo.mHasTintList>
tintinfo.mTintList = ((ColorStateList) (obj));
// 22 44:aload_2
// 23 45:aload_3
// 24 46:putfield #47 <Field ColorStateList TintInfo.mTintList>
}
obj = ((Object) (ImageViewCompat.getImageTintMode(mView)));
// 25 49:aload_0
// 26 50:getfield #21 <Field ImageView mView>
// 27 53:invokestatic #51 <Method android.graphics.PorterDuff$Mode ImageViewCompat.getImageTintMode(ImageView)>
// 28 56:astore_3
if(obj != null)
//* 29 57:aload_3
//* 30 58:ifnull 71
{
tintinfo.mHasTintMode = true;
// 31 61:aload_2
// 32 62:iconst_1
// 33 63:putfield #54 <Field boolean TintInfo.mHasTintMode>
tintinfo.mTintMode = ((android.graphics.PorterDuff.Mode) (obj));
// 34 66:aload_2
// 35 67:aload_3
// 36 68:putfield #58 <Field android.graphics.PorterDuff$Mode TintInfo.mTintMode>
}
if(!tintinfo.mHasTintList && !tintinfo.mHasTintMode)
//* 37 71:aload_2
//* 38 72:getfield #43 <Field boolean TintInfo.mHasTintList>
//* 39 75:ifne 90
//* 40 78:aload_2
//* 41 79:getfield #54 <Field boolean TintInfo.mHasTintMode>
//* 42 82:ifeq 88
//* 43 85:goto 90
{
return false;
// 44 88:iconst_0
// 45 89:ireturn
} else
{
AppCompatDrawableManager.tintDrawable(drawable, tintinfo, mView.getDrawableState());
// 46 90:aload_1
// 47 91:aload_2
// 48 92:aload_0
// 49 93:getfield #21 <Field ImageView mView>
// 50 96:invokevirtual #64 <Method int[] ImageView.getDrawableState()>
// 51 99:invokestatic #70 <Method void AppCompatDrawableManager.tintDrawable(Drawable, TintInfo, int[])>
return true;
// 52 102:iconst_1
// 53 103:ireturn
}
}
private boolean shouldApplyFrameworkTintUsingColorFilter()
{
int i = android.os.Build.VERSION.SDK_INT;
// 0 0:getstatic #79 <Field int android.os.Build$VERSION.SDK_INT>
// 1 3:istore_1
if(i > 21)
//* 2 4:iload_1
//* 3 5:bipush 21
//* 4 7:icmple 21
return mInternalImageTint != null;
// 5 10:aload_0
// 6 11:getfield #81 <Field TintInfo mInternalImageTint>
// 7 14:ifnull 19
// 8 17:iconst_1
// 9 18:ireturn
// 10 19:iconst_0
// 11 20:ireturn
return i == 21;
// 12 21:iload_1
// 13 22:bipush 21
// 14 24:icmpne 29
// 15 27:iconst_1
// 16 28:ireturn
// 17 29:iconst_0
// 18 30:ireturn
}
void applySupportImageTint()
{
Drawable drawable = mView.getDrawable();
// 0 0:aload_0
// 1 1:getfield #21 <Field ImageView mView>
// 2 4:invokevirtual #86 <Method Drawable ImageView.getDrawable()>
// 3 7:astore_1
if(drawable != null)
//* 4 8:aload_1
//* 5 9:ifnull 16
DrawableUtils.fixDrawable(drawable);
// 6 12:aload_1
// 7 13:invokestatic #92 <Method void DrawableUtils.fixDrawable(Drawable)>
if(drawable != null)
//* 8 16:aload_1
//* 9 17:ifnull 79
{
if(shouldApplyFrameworkTintUsingColorFilter() && applyFrameworkTintUsingColorFilter(drawable))
//* 10 20:aload_0
//* 11 21:invokespecial #94 <Method boolean shouldApplyFrameworkTintUsingColorFilter()>
//* 12 24:ifeq 36
//* 13 27:aload_0
//* 14 28:aload_1
//* 15 29:invokespecial #96 <Method boolean applyFrameworkTintUsingColorFilter(Drawable)>
//* 16 32:ifeq 36
return;
// 17 35:return
TintInfo tintinfo = mImageTint;
// 18 36:aload_0
// 19 37:getfield #98 <Field TintInfo mImageTint>
// 20 40:astore_2
if(tintinfo != null)
//* 21 41:aload_2
//* 22 42:ifnull 58
{
AppCompatDrawableManager.tintDrawable(drawable, tintinfo, mView.getDrawableState());
// 23 45:aload_1
// 24 46:aload_2
// 25 47:aload_0
// 26 48:getfield #21 <Field ImageView mView>
// 27 51:invokevirtual #64 <Method int[] ImageView.getDrawableState()>
// 28 54:invokestatic #70 <Method void AppCompatDrawableManager.tintDrawable(Drawable, TintInfo, int[])>
return;
// 29 57:return
}
tintinfo = mInternalImageTint;
// 30 58:aload_0
// 31 59:getfield #81 <Field TintInfo mInternalImageTint>
// 32 62:astore_2
if(tintinfo != null)
//* 33 63:aload_2
//* 34 64:ifnull 79
AppCompatDrawableManager.tintDrawable(drawable, tintinfo, mView.getDrawableState());
// 35 67:aload_1
// 36 68:aload_2
// 37 69:aload_0
// 38 70:getfield #21 <Field ImageView mView>
// 39 73:invokevirtual #64 <Method int[] ImageView.getDrawableState()>
// 40 76:invokestatic #70 <Method void AppCompatDrawableManager.tintDrawable(Drawable, TintInfo, int[])>
}
// 41 79:return
}
ColorStateList getSupportImageTintList()
{
TintInfo tintinfo = mImageTint;
// 0 0:aload_0
// 1 1:getfield #98 <Field TintInfo mImageTint>
// 2 4:astore_1
if(tintinfo != null)
//* 3 5:aload_1
//* 4 6:ifnull 14
return tintinfo.mTintList;
// 5 9:aload_1
// 6 10:getfield #47 <Field ColorStateList TintInfo.mTintList>
// 7 13:areturn
else
return null;
// 8 14:aconst_null
// 9 15:areturn
}
android.graphics.PorterDuff.Mode getSupportImageTintMode()
{
TintInfo tintinfo = mImageTint;
// 0 0:aload_0
// 1 1:getfield #98 <Field TintInfo mImageTint>
// 2 4:astore_1
if(tintinfo != null)
//* 3 5:aload_1
//* 4 6:ifnull 14
return tintinfo.mTintMode;
// 5 9:aload_1
// 6 10:getfield #58 <Field android.graphics.PorterDuff$Mode TintInfo.mTintMode>
// 7 13:areturn
else
return null;
// 8 14:aconst_null
// 9 15:areturn
}
boolean hasOverlappingRendering()
{
Drawable drawable = mView.getBackground();
// 0 0:aload_0
// 1 1:getfield #21 <Field ImageView mView>
// 2 4:invokevirtual #106 <Method Drawable ImageView.getBackground()>
// 3 7:astore_1
return android.os.Build.VERSION.SDK_INT < 21 || !(drawable instanceof RippleDrawable);
// 4 8:getstatic #79 <Field int android.os.Build$VERSION.SDK_INT>
// 5 11:bipush 21
// 6 13:icmplt 25
// 7 16:aload_1
// 8 17:instanceof #108 <Class RippleDrawable>
// 9 20:ifeq 25
// 10 23:iconst_0
// 11 24:ireturn
// 12 25:iconst_1
// 13 26:ireturn
}
public void loadFromAttributes(AttributeSet attributeset, int i)
{
TintTypedArray tinttypedarray = TintTypedArray.obtainStyledAttributes(mView.getContext(), attributeset, android.support.v7.appcompat.R.styleable.AppCompatImageView, i, 0);
// 0 0:aload_0
// 1 1:getfield #21 <Field ImageView mView>
// 2 4:invokevirtual #114 <Method android.content.Context ImageView.getContext()>
// 3 7:aload_1
// 4 8:getstatic #120 <Field int[] android.support.v7.appcompat.R$styleable.AppCompatImageView>
// 5 11:iload_2
// 6 12:iconst_0
// 7 13:invokestatic #126 <Method TintTypedArray TintTypedArray.obtainStyledAttributes(android.content.Context, AttributeSet, int[], int, int)>
// 8 16:astore 4
Drawable drawable = mView.getDrawable();
// 9 18:aload_0
// 10 19:getfield #21 <Field ImageView mView>
// 11 22:invokevirtual #86 <Method Drawable ImageView.getDrawable()>
// 12 25:astore_3
attributeset = ((AttributeSet) (drawable));
// 13 26:aload_3
// 14 27:astore_1
if(drawable != null)
break MISSING_BLOCK_LABEL_77;
// 15 28:aload_3
// 16 29:ifnonnull 77
i = tinttypedarray.getResourceId(android.support.v7.appcompat.R.styleable.AppCompatImageView_srcCompat, -1);
// 17 32:aload 4
// 18 34:getstatic #129 <Field int android.support.v7.appcompat.R$styleable.AppCompatImageView_srcCompat>
// 19 37:iconst_m1
// 20 38:invokevirtual #133 <Method int TintTypedArray.getResourceId(int, int)>
// 21 41:istore_2
attributeset = ((AttributeSet) (drawable));
// 22 42:aload_3
// 23 43:astore_1
if(i == -1)
break MISSING_BLOCK_LABEL_77;
// 24 44:iload_2
// 25 45:iconst_m1
// 26 46:icmpeq 77
drawable = AppCompatResources.getDrawable(mView.getContext(), i);
// 27 49:aload_0
// 28 50:getfield #21 <Field ImageView mView>
// 29 53:invokevirtual #114 <Method android.content.Context ImageView.getContext()>
// 30 56:iload_2
// 31 57:invokestatic #138 <Method Drawable AppCompatResources.getDrawable(android.content.Context, int)>
// 32 60:astore_3
attributeset = ((AttributeSet) (drawable));
// 33 61:aload_3
// 34 62:astore_1
if(drawable == null)
break MISSING_BLOCK_LABEL_77;
// 35 63:aload_3
// 36 64:ifnull 77
mView.setImageDrawable(drawable);
// 37 67:aload_0
// 38 68:getfield #21 <Field ImageView mView>
// 39 71:aload_3
// 40 72:invokevirtual #141 <Method void ImageView.setImageDrawable(Drawable)>
attributeset = ((AttributeSet) (drawable));
// 41 75:aload_3
// 42 76:astore_1
if(attributeset == null)
break MISSING_BLOCK_LABEL_85;
// 43 77:aload_1
// 44 78:ifnull 85
DrawableUtils.fixDrawable(((Drawable) (attributeset)));
// 45 81:aload_1
// 46 82:invokestatic #92 <Method void DrawableUtils.fixDrawable(Drawable)>
if(tinttypedarray.hasValue(android.support.v7.appcompat.R.styleable.AppCompatImageView_tint))
//* 47 85:aload 4
//* 48 87:getstatic #144 <Field int android.support.v7.appcompat.R$styleable.AppCompatImageView_tint>
//* 49 90:invokevirtual #148 <Method boolean TintTypedArray.hasValue(int)>
//* 50 93:ifeq 111
ImageViewCompat.setImageTintList(mView, tinttypedarray.getColorStateList(android.support.v7.appcompat.R.styleable.AppCompatImageView_tint));
// 51 96:aload_0
// 52 97:getfield #21 <Field ImageView mView>
// 53 100:aload 4
// 54 102:getstatic #144 <Field int android.support.v7.appcompat.R$styleable.AppCompatImageView_tint>
// 55 105:invokevirtual #152 <Method ColorStateList TintTypedArray.getColorStateList(int)>
// 56 108:invokestatic #156 <Method void ImageViewCompat.setImageTintList(ImageView, ColorStateList)>
if(tinttypedarray.hasValue(android.support.v7.appcompat.R.styleable.AppCompatImageView_tintMode))
//* 57 111:aload 4
//* 58 113:getstatic #159 <Field int android.support.v7.appcompat.R$styleable.AppCompatImageView_tintMode>
//* 59 116:invokevirtual #148 <Method boolean TintTypedArray.hasValue(int)>
//* 60 119:ifeq 142
ImageViewCompat.setImageTintMode(mView, DrawableUtils.parseTintMode(tinttypedarray.getInt(android.support.v7.appcompat.R.styleable.AppCompatImageView_tintMode, -1), ((android.graphics.PorterDuff.Mode) (null))));
// 61 122:aload_0
// 62 123:getfield #21 <Field ImageView mView>
// 63 126:aload 4
// 64 128:getstatic #159 <Field int android.support.v7.appcompat.R$styleable.AppCompatImageView_tintMode>
// 65 131:iconst_m1
// 66 132:invokevirtual #162 <Method int TintTypedArray.getInt(int, int)>
// 67 135:aconst_null
// 68 136:invokestatic #166 <Method android.graphics.PorterDuff$Mode DrawableUtils.parseTintMode(int, android.graphics.PorterDuff$Mode)>
// 69 139:invokestatic #170 <Method void ImageViewCompat.setImageTintMode(ImageView, android.graphics.PorterDuff$Mode)>
tinttypedarray.recycle();
// 70 142:aload 4
// 71 144:invokevirtual #173 <Method void TintTypedArray.recycle()>
return;
// 72 147:return
attributeset;
// 73 148:astore_1
tinttypedarray.recycle();
// 74 149:aload 4
// 75 151:invokevirtual #173 <Method void TintTypedArray.recycle()>
throw attributeset;
// 76 154:aload_1
// 77 155:athrow
}
public void setImageResource(int i)
{
if(i != 0)
//* 0 0:iload_1
//* 1 1:ifeq 35
{
Drawable drawable = AppCompatResources.getDrawable(mView.getContext(), i);
// 2 4:aload_0
// 3 5:getfield #21 <Field ImageView mView>
// 4 8:invokevirtual #114 <Method android.content.Context ImageView.getContext()>
// 5 11:iload_1
// 6 12:invokestatic #138 <Method Drawable AppCompatResources.getDrawable(android.content.Context, int)>
// 7 15:astore_2
if(drawable != null)
//* 8 16:aload_2
//* 9 17:ifnull 24
DrawableUtils.fixDrawable(drawable);
// 10 20:aload_2
// 11 21:invokestatic #92 <Method void DrawableUtils.fixDrawable(Drawable)>
mView.setImageDrawable(drawable);
// 12 24:aload_0
// 13 25:getfield #21 <Field ImageView mView>
// 14 28:aload_2
// 15 29:invokevirtual #141 <Method void ImageView.setImageDrawable(Drawable)>
} else
//* 16 32:goto 43
{
mView.setImageDrawable(((Drawable) (null)));
// 17 35:aload_0
// 18 36:getfield #21 <Field ImageView mView>
// 19 39:aconst_null
// 20 40:invokevirtual #141 <Method void ImageView.setImageDrawable(Drawable)>
}
applySupportImageTint();
// 21 43:aload_0
// 22 44:invokevirtual #177 <Method void applySupportImageTint()>
// 23 47:return
}
void setInternalImageTint(ColorStateList colorstatelist)
{
if(colorstatelist != null)
//* 0 0:aload_1
//* 1 1:ifnull 40
{
if(mInternalImageTint == null)
//* 2 4:aload_0
//* 3 5:getfield #81 <Field TintInfo mInternalImageTint>
//* 4 8:ifnonnull 22
mInternalImageTint = new TintInfo();
// 5 11:aload_0
// 6 12:new #29 <Class TintInfo>
// 7 15:dup
// 8 16:invokespecial #30 <Method void TintInfo()>
// 9 19:putfield #81 <Field TintInfo mInternalImageTint>
TintInfo tintinfo = mInternalImageTint;
// 10 22:aload_0
// 11 23:getfield #81 <Field TintInfo mInternalImageTint>
// 12 26:astore_2
tintinfo.mTintList = colorstatelist;
// 13 27:aload_2
// 14 28:aload_1
// 15 29:putfield #47 <Field ColorStateList TintInfo.mTintList>
tintinfo.mHasTintList = true;
// 16 32:aload_2
// 17 33:iconst_1
// 18 34:putfield #43 <Field boolean TintInfo.mHasTintList>
} else
//* 19 37:goto 45
{
mInternalImageTint = null;
// 20 40:aload_0
// 21 41:aconst_null
// 22 42:putfield #81 <Field TintInfo mInternalImageTint>
}
applySupportImageTint();
// 23 45:aload_0
// 24 46:invokevirtual #177 <Method void applySupportImageTint()>
// 25 49:return
}
void setSupportImageTintList(ColorStateList colorstatelist)
{
if(mImageTint == null)
//* 0 0:aload_0
//* 1 1:getfield #98 <Field TintInfo mImageTint>
//* 2 4:ifnonnull 18
mImageTint = new TintInfo();
// 3 7:aload_0
// 4 8:new #29 <Class TintInfo>
// 5 11:dup
// 6 12:invokespecial #30 <Method void TintInfo()>
// 7 15:putfield #98 <Field TintInfo mImageTint>
TintInfo tintinfo = mImageTint;
// 8 18:aload_0
// 9 19:getfield #98 <Field TintInfo mImageTint>
// 10 22:astore_2
tintinfo.mTintList = colorstatelist;
// 11 23:aload_2
// 12 24:aload_1
// 13 25:putfield #47 <Field ColorStateList TintInfo.mTintList>
tintinfo.mHasTintList = true;
// 14 28:aload_2
// 15 29:iconst_1
// 16 30:putfield #43 <Field boolean TintInfo.mHasTintList>
applySupportImageTint();
// 17 33:aload_0
// 18 34:invokevirtual #177 <Method void applySupportImageTint()>
// 19 37:return
}
void setSupportImageTintMode(android.graphics.PorterDuff.Mode mode)
{
if(mImageTint == null)
//* 0 0:aload_0
//* 1 1:getfield #98 <Field TintInfo mImageTint>
//* 2 4:ifnonnull 18
mImageTint = new TintInfo();
// 3 7:aload_0
// 4 8:new #29 <Class TintInfo>
// 5 11:dup
// 6 12:invokespecial #30 <Method void TintInfo()>
// 7 15:putfield #98 <Field TintInfo mImageTint>
TintInfo tintinfo = mImageTint;
// 8 18:aload_0
// 9 19:getfield #98 <Field TintInfo mImageTint>
// 10 22:astore_2
tintinfo.mTintMode = mode;
// 11 23:aload_2
// 12 24:aload_1
// 13 25:putfield #58 <Field android.graphics.PorterDuff$Mode TintInfo.mTintMode>
tintinfo.mHasTintMode = true;
// 14 28:aload_2
// 15 29:iconst_1
// 16 30:putfield #54 <Field boolean TintInfo.mHasTintMode>
applySupportImageTint();
// 17 33:aload_0
// 18 34:invokevirtual #177 <Method void applySupportImageTint()>
// 19 37:return
}
private TintInfo mImageTint;
private TintInfo mInternalImageTint;
private TintInfo mTmpInfo;
private final ImageView mView;
}
|
[
"[email protected]"
] | |
c438af15575e1f6be692b4890bbfe86a6147ad6f
|
75d7760a4e03de45d58eda9cfd713f3aecde051f
|
/src/main/java/com/snb/deal/enums/OrderSourceEnum.java
|
992b789968371819b54809ea52497f9624fcc81b
|
[] |
no_license
|
lyp0715/test
|
23958977a2a696d1bfafa366bb12d2b348a03bbb
|
99f774a09a9840f0142609bc2c91b01793b1d217
|
refs/heads/master
| 2020-05-24T06:23:26.689663 | 2019-05-17T03:56:35 | 2019-05-17T03:56:35 | 98,869,205 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 358 |
java
|
package com.snb.deal.enums;
public enum OrderSourceEnum {
H5("H5","H5"),
;
private String code;
private String desc;
OrderSourceEnum(String code, String desc){
this.code = code;
this.desc = desc;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}
|
[
"[email protected]"
] | |
eb0fe1a12704d5cfb37dc32e5759cbf28ce10de8
|
959fdb8eaf4cbdc5e6d4f145f752129cd4949758
|
/project1/src/com/internousdev/project1/action/BackFollowersInfoAction.java
|
bc019511096e1101c74046e61fe8ea9d61d0a8f1
|
[] |
no_license
|
dsakai0730/backup
|
424f7903c9f51f60b41f6f3e4975df7405bfe27d
|
86697d99f7ad38b8370a05f9cc5436eb752cc630
|
refs/heads/master
| 2021-09-01T09:41:17.544991 | 2017-12-26T08:57:09 | 2017-12-26T08:57:09 | 114,215,041 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 521 |
java
|
package com.internousdev.project1.action;
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
public class BackFollowersInfoAction extends ActionSupport implements SessionAware{
public Map<String, Object> session;
public String execute(){
String ret = SUCCESS;
return ret;
}
public Map<String, Object> getSession() {
return session;
}
@Override
public void setSession(Map<String, Object> session) {
this.session = session;
}
}
|
[
"[email protected]"
] | |
23ed1d69ae6068163834ea1fd0d8d758c4555034
|
c30d4f174a28aac495463f44b496811ee0c21265
|
/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/linearBek/LinearBekGraphBuilder.java
|
e982ce652b4f097e7967c7244da0b87db8f20496
|
[
"Apache-2.0"
] |
permissive
|
sarvex/intellij-community
|
cbbf08642231783c5b46ef2d55a29441341a03b3
|
8b8c21f445550bd72662e159ae715e9d944ba140
|
refs/heads/master
| 2023-05-14T14:32:51.014859 | 2023-05-01T06:59:21 | 2023-05-01T06:59:21 | 32,571,446 | 0 | 0 |
Apache-2.0
| 2023-05-01T06:59:22 | 2015-03-20T08:16:17 |
Java
|
UTF-8
|
Java
| false | false | 11,094 |
java
|
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* 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.intellij.vcs.log.graph.linearBek;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.graph.api.EdgeFilter;
import com.intellij.vcs.log.graph.api.GraphLayout;
import com.intellij.vcs.log.graph.api.elements.GraphEdge;
import com.intellij.vcs.log.graph.api.elements.GraphEdgeType;
import com.intellij.vcs.log.graph.impl.print.PrintElementGeneratorImpl;
import com.intellij.vcs.log.graph.utils.IntIntMultiMap;
import com.intellij.vcs.log.graph.utils.LinearGraphUtils;
import gnu.trove.TIntHashSet;
import gnu.trove.TIntIterator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Set;
class LinearBekGraphBuilder {
private static final int MAX_BLOCK_SIZE = 200;
private static final int MAGIC_SET_SIZE = PrintElementGeneratorImpl.LONG_EDGE_SIZE;
private static final GraphEdgeToDownNode GRAPH_EDGE_TO_DOWN_NODE = new GraphEdgeToDownNode();
@NotNull private final GraphLayout myGraphLayout;
private final LinearBekGraph myLinearBekGraph;
public LinearBekGraphBuilder(@NotNull LinearBekGraph bekGraph, @NotNull GraphLayout graphLayout) {
myLinearBekGraph = bekGraph;
myGraphLayout = graphLayout;
}
public void collapseAll() {
for (int i = myLinearBekGraph.myGraph.nodesCount() - 1; i >= 0; i--) {
MergeFragment fragment = getFragment(i);
if (fragment != null) {
fragment.collapse(myLinearBekGraph);
}
}
}
@Nullable
public MergeFragment collapseFragment(int mergeCommit) {
MergeFragment fragment = getFragment(mergeCommit);
if (fragment != null) {
fragment.collapse(myLinearBekGraph);
return fragment;
}
return null;
}
@Nullable
public MergeFragment getFragment(int mergeCommit) {
List<Integer> downNodes = ContainerUtil.sorted(LinearGraphUtils.getDownNodes(myLinearBekGraph, mergeCommit));
if (downNodes.size() != 2) return null;
return getFragment(downNodes.get(1), downNodes.get(0), mergeCommit);
}
@Nullable
private MergeFragment getFragment(int leftChild, int rightChild, int parent) {
MergeFragment fragment = new MergeFragment(parent, leftChild, rightChild);
int leftLi = myGraphLayout.getLayoutIndex(leftChild);
int rightLi = myGraphLayout.getLayoutIndex(rightChild);
int rowsCount = 1;
int blockSize = 1;
PriorityQueue<GraphEdge> queue = new PriorityQueue<GraphEdge>(MAX_BLOCK_SIZE, new GraphEdgeComparator());
queue.addAll(myLinearBekGraph.getAdjacentEdges(rightChild, EdgeFilter.NORMAL_DOWN));
@Nullable Set<Integer> magicSet = null;
while (!queue.isEmpty()) {
GraphEdge nextEdge = queue.poll();
Integer next = nextEdge.getDownNodeIndex();
Integer upNodeIndex = nextEdge.getUpNodeIndex();
assert upNodeIndex != null; // can not happen
if (next == null) {
fragment.addTail(upNodeIndex);
continue; // allow very long edges down
}
if (next == leftChild) {
// found first child
fragment.addTail(upNodeIndex);
fragment.setMergeWithOldCommit(true);
}
else if (next == rightChild + rowsCount) {
// all is fine, continuing
rowsCount++;
blockSize++;
queue.addAll(myLinearBekGraph.getAdjacentEdges(next, EdgeFilter.NORMAL_DOWN));
fragment.addBody(upNodeIndex);
}
else if (next > rightChild + rowsCount && next < leftChild) {
rowsCount = next - rightChild + 1;
blockSize++;
queue.addAll(myLinearBekGraph.getAdjacentEdges(next, EdgeFilter.NORMAL_DOWN));
fragment.addBody(upNodeIndex);
}
else if (next > leftChild) {
int li = myGraphLayout.getLayoutIndex(next);
if (leftLi > rightLi && !fragment.isMergeWithOldCommit()) {
if (next > leftChild + MAGIC_SET_SIZE) {
return null;
}
if (magicSet == null) {
magicSet = calculateMagicSet(leftChild);
}
if (magicSet.contains(next)) {
fragment.addTailEdge(upNodeIndex, next);
}
else {
return null;
}
}
else {
if ((li > leftLi && li < rightLi) || (li == leftLi)) {
fragment.addTailEdge(upNodeIndex, next);
}
else {
if (li >= rightLi) {
return null;
}
else {
if (next > leftChild + MAGIC_SET_SIZE) {
if (!fragment.hasTailEdge(upNodeIndex) && !fragment.isBody(upNodeIndex)) return null;
}
else {
if (magicSet == null) {
magicSet = calculateMagicSet(leftChild);
}
if (magicSet.contains(next)) {
fragment.addTailEdge(upNodeIndex, next);
}
else {
return null;
}
}
}
}
}
}
if (blockSize >= MAX_BLOCK_SIZE) {
return null;
}
}
if (fragment.getTails().isEmpty()) {
return null; // this can happen if we ran into initial import
}
return fragment;
}
@NotNull
private Set<Integer> calculateMagicSet(int node) {
Set<Integer> magicSet;
magicSet = ContainerUtil.newHashSet(MAGIC_SET_SIZE);
PriorityQueue<Integer> magicQueue = new PriorityQueue<Integer>(MAGIC_SET_SIZE);
magicQueue.addAll(ContainerUtil.map(myLinearBekGraph.getAdjacentEdges(node, EdgeFilter.NORMAL_DOWN), GRAPH_EDGE_TO_DOWN_NODE));
while (!magicQueue.isEmpty()) {
Integer i = magicQueue.poll();
if (i > node + MAGIC_SET_SIZE) break;
magicSet.add(i);
magicQueue.addAll(ContainerUtil.map(myLinearBekGraph.getAdjacentEdges(i, EdgeFilter.NORMAL_DOWN), GRAPH_EDGE_TO_DOWN_NODE));
}
return magicSet;
}
public static class MergeFragment {
private final int myParent;
private final int myLeftChild;
private final int myRightChild;
private boolean myMergeWithOldCommit = false;
@NotNull private final IntIntMultiMap myTailEdges = new IntIntMultiMap();
@NotNull private final TIntHashSet myBlockBody = new TIntHashSet();
@NotNull private final TIntHashSet myTails = new TIntHashSet();
private MergeFragment(int parent, int leftChild, int rightChild) {
myParent = parent;
myLeftChild = leftChild;
myRightChild = rightChild;
}
public boolean isMergeWithOldCommit() {
return myMergeWithOldCommit;
}
public void setMergeWithOldCommit(boolean mergeWithOldCommit) {
myMergeWithOldCommit = mergeWithOldCommit;
}
public void addTail(int tail) {
if (!myBlockBody.contains(tail)) {
myTails.add(tail);
}
}
public void addTailEdge(int upNodeIndex, int downNodeIndex) {
if (!myBlockBody.contains(upNodeIndex)) {
myTails.add(upNodeIndex);
myTailEdges.putValue(upNodeIndex, downNodeIndex);
}
}
public void addBody(int body) {
myBlockBody.add(body);
}
@NotNull
public TIntHashSet getTails() {
return myTails;
}
public Set<Integer> getTailsAndBody() {
Set<Integer> nodes = ContainerUtil.newHashSet();
TIntIterator it = myBlockBody.iterator();
while (it.hasNext()) {
nodes.add(it.next());
}
it = myTails.iterator();
while (it.hasNext()) {
nodes.add(it.next());
}
return nodes;
}
public Set<Integer> getAllNodes() {
Set<Integer> nodes = ContainerUtil.newHashSet();
nodes.add(myParent);
nodes.add(myLeftChild);
nodes.add(myRightChild);
nodes.addAll(getTailsAndBody());
return nodes;
}
public void collapse(LinearBekGraph graph) {
for (int upNodeIndex : myTailEdges.keys()) {
for (int downNodeIndex : myTailEdges.get(upNodeIndex)) {
removeEdge(graph, upNodeIndex, downNodeIndex);
}
}
TIntIterator it = myTails.iterator();
while (it.hasNext()) {
int tail = it.next();
if (!LinearGraphUtils.getDownNodes(graph, tail).contains(myLeftChild)) {
addEdge(graph, tail, myLeftChild);
}
else {
replaceEdge(graph, tail, myLeftChild);
}
}
removeEdge(graph, myParent, myLeftChild);
}
private static void addEdge(LinearBekGraph graph, int up, int down) {
graph.myDottedEdges.createEdge(new GraphEdge(up, down, null, GraphEdgeType.DOTTED));
}
private static void removeEdge(LinearBekGraph graph, int up, int down) {
if (graph.myDottedEdges.hasEdge(up, down)) {
graph.myDottedEdges.removeEdge(new GraphEdge(up, down, null, GraphEdgeType.DOTTED));
graph.myHiddenEdges.createEdge(new GraphEdge(up, down, null, GraphEdgeType.DOTTED));
}
else {
GraphEdge edge = LinearGraphUtils.getEdge(graph.myGraph, up, down);
assert edge != null : "No edge between " + up + " and " + down;
graph.myHiddenEdges.createEdge(edge);
}
}
private static void replaceEdge(LinearBekGraph graph, int up, int down) {
if (!graph.myDottedEdges.hasEdge(up, down)) {
GraphEdge edge = LinearGraphUtils.getEdge(graph.myGraph, up, down);
assert edge != null : "No edge between " + up + " and " + down;
graph.myHiddenEdges.createEdge(edge);
graph.myDottedEdges.createEdge(new GraphEdge(up, down, null, GraphEdgeType.DOTTED));
}
}
public int getParent() {
return myParent;
}
public boolean hasTailEdge(Integer index) {
return !myTailEdges.get(index).isEmpty();
}
public boolean isBody(Integer index) {
return myBlockBody.contains(index);
}
}
private static class GraphEdgeComparator implements Comparator<GraphEdge> {
@Override
public int compare(@NotNull GraphEdge e1, @NotNull GraphEdge e2) {
Integer d1 = e1.getDownNodeIndex();
Integer d2 = e2.getDownNodeIndex();
if (d1 == null) {
if (d2 == null) return e1.hashCode() - e2.hashCode();
return 1;
}
if (d2 == null) return -1;
return d1.compareTo(d2);
}
}
private static class GraphEdgeToDownNode implements Function<GraphEdge, Integer> {
@Override
public Integer fun(GraphEdge graphEdge) {
return graphEdge.getDownNodeIndex();
}
}
}
|
[
"[email protected]"
] | |
44b53860c6567c65db0ff2ada0fe76d91210ea14
|
57e68d99f3be5887b84299b3164fbd2d03aa5ea8
|
/software/messaging/src/test/java/brooklyn/entity/messaging/activemq/ActiveMQEc2LiveTest.java
|
5566c7070c016f9a69d50e759d0256e2a12d0578
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
ganeshgitrepo/incubator-brooklyn
|
08d7e41971eaa910ee518c898fb1fb6e60a6ce7e
|
f28d9cc6b9fd21fe3e05dd04553f16d562bf419c
|
refs/heads/master
| 2021-01-17T08:46:31.582724 | 2014-07-03T09:46:32 | 2014-07-03T09:46:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,987 |
java
|
package brooklyn.entity.messaging.activemq;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import javax.jms.Connection;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.testng.annotations.Test;
import brooklyn.entity.AbstractEc2LiveTest;
import brooklyn.entity.proxying.EntitySpec;
import brooklyn.entity.trait.Startable;
import brooklyn.location.Location;
import brooklyn.test.EntityTestUtils;
import com.google.common.collect.ImmutableList;
public class ActiveMQEc2LiveTest extends AbstractEc2LiveTest {
/**
* Test that can install+start, and use, ActiveMQ.
*/
@Override
protected void doTest(Location loc) throws Exception {
String queueName = "testQueue";
int number = 10;
String content = "01234567890123456789012345678901";
// Start broker with a configured queue
ActiveMQBroker activeMQ = app.createAndManageChild(EntitySpec.create(ActiveMQBroker.class).configure("queue", queueName));
app.start(ImmutableList.of(loc));
EntityTestUtils.assertAttributeEqualsEventually(activeMQ, Startable.SERVICE_UP, true);
// Check queue created
assertEquals(ImmutableList.copyOf(activeMQ.getQueueNames()), ImmutableList.of(queueName));
assertEquals(activeMQ.getChildren().size(), 1);
assertEquals(activeMQ.getQueues().size(), 1);
// Get the named queue entity
ActiveMQQueue queue = activeMQ.getQueues().get(queueName);
assertNotNull(queue);
// Connect to broker using JMS and send messages
Connection connection = getActiveMQConnection(activeMQ);
clearQueue(connection, queueName);
EntityTestUtils.assertAttributeEqualsEventually(queue, ActiveMQQueue.QUEUE_DEPTH_MESSAGES, 0);
sendMessages(connection, number, queueName, content);
// Check messages arrived
EntityTestUtils.assertAttributeEqualsEventually(queue, ActiveMQQueue.QUEUE_DEPTH_MESSAGES, number);
connection.close();
}
private Connection getActiveMQConnection(ActiveMQBroker activeMQ) throws Exception {
int port = activeMQ.getAttribute(ActiveMQBroker.OPEN_WIRE_PORT);
String address = activeMQ.getAttribute(ActiveMQBroker.ADDRESS);
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(String.format("tcp://%s:%s", address, port));
Connection connection = factory.createConnection("admin", "activemq");
connection.start();
return connection;
}
private void sendMessages(Connection connection, int count, String queueName, String content) throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
org.apache.activemq.command.ActiveMQQueue destination = (org.apache.activemq.command.ActiveMQQueue) session.createQueue(queueName);
MessageProducer messageProducer = session.createProducer(destination);
for (int i = 0; i < count; i++) {
TextMessage message = session.createTextMessage(content);
messageProducer.send(message);
}
session.close();
}
private int clearQueue(Connection connection, String queueName) throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
org.apache.activemq.command.ActiveMQQueue destination = (org.apache.activemq.command.ActiveMQQueue) session.createQueue(queueName);
MessageConsumer messageConsumer = session.createConsumer(destination);
int received = 0;
while (messageConsumer.receive(500) != null) received++;
session.close();
return received;
}
@Test(enabled=false)
public void testDummy() {} // Convince testng IDE integration that this really does have test methods
}
|
[
"[email protected]"
] | |
16c34e25a42e7eb4933134624bdc05f30e92d7bf
|
1b1642cc00ed8623a439c0564d495ac8f29e9dbb
|
/src/ForPractice07.java
|
31f9503c8c0567d0423dd008fe75ba550ad89fd1
|
[] |
no_license
|
aratanakagawa/JavaPractice
|
7d94a3373e45a4ed0576f7cc268b9192b229ffdb
|
4f4f2bc8edb27f50cfa2789074304e158c874986
|
refs/heads/master
| 2021-04-15T14:33:10.212581 | 2018-03-21T13:08:53 | 2018-03-21T13:08:53 | 126,178,268 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 258 |
java
|
public class ForPractice07 {
public static void main(String[] args) {
for(int i = 5; i>0; i--) {
for(int j = 0; j < i; j++) {
System.out.print("*");
}
System.out.println("");
}
}
}
|
[
"[email protected]"
] | |
7d6be19368dd131bf5334532bab56bddc4d740fb
|
8ccb421ad59ae7de370da999c23ec4cafb5d87e7
|
/workspace_web/eventdash/src/main/java/br/com/elibeniciocorp/eventdash/EventdashApplication.java
|
7c8670b530c621d7c9b8392d599f40032a12f1ec
|
[] |
no_license
|
elibenicio/itmn
|
faf2f817bfb4cd45c027142ca55007e63080e40f
|
cae1bb548c47cba910c034ef0cb8ee0688f7a0ed
|
refs/heads/main
| 2023-05-23T04:24:32.819329 | 2021-06-11T12:36:30 | 2021-06-11T12:36:30 | 375,741,543 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 330 |
java
|
package br.com.elibeniciocorp.eventdash;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class EventdashApplication {
public static void main(String[] args) {
SpringApplication.run(EventdashApplication.class, args);
}
}
|
[
"[email protected]"
] | |
16f3820106ca31242f1b06c6befcbbafbf5f812a
|
ea40fe84b7078f90e29b3fb13aa29832599ecb23
|
/src/main/java/com/resmed/rpsgame/IRpsGameService.java
|
6b826ac56bc18c72b549590bc6bea523439ab0c8
|
[] |
no_license
|
jainr1/rps-game
|
121535650f57a05b47612cfd05df7ee01d7600db
|
be0683e307648a23a025b47fdf48913739fb7372
|
refs/heads/main
| 2023-05-31T13:52:25.163432 | 2021-07-13T14:33:28 | 2021-07-13T14:33:28 | 385,626,364 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 450 |
java
|
package com.resmed.rpsgame;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.resmed.rpsgame.dto.PlayerDto;
import com.resmed.rpsgame.dto.PlayerStatisticDto;
import com.resmed.rpsgame.dto.ResultDto;
import java.util.List;
public interface IRpsGameService {
ResultDto play(String id, String playerThrow);
PlayerStatisticDto getStatistics(String id) throws JsonProcessingException;
List<PlayerDto> getPlayers();
}
|
[
"[email protected]"
] | |
f2b77a5217cd52ffe1a2e3cecec51a0b1661400b
|
3e53b821f4c793c39b7d9a59cf9cff61a4a567dd
|
/BinaryTreeInorderTraversal.java
|
84cbe6ec986da32511c14e15059a62717d3fd58f
|
[] |
no_license
|
TianzheWang/Leetcode
|
3a371d7db2fbe535512420daf490228ea95ac9fe
|
3845ce1b492cc744c382fc2521f20bc6fb9e62d8
|
refs/heads/master
| 2021-01-23T01:34:43.949561 | 2017-06-05T03:59:17 | 2017-06-05T03:59:17 | 92,880,418 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 585 |
java
|
/**
class TreeNode {
int val;
TreeNode left;
TreeNode right;
public TreeNode(int x) {
this.val = x;
}
}
*/
/*
Inorder direction: left->root->right
*/
public class Solution {
public List<Integer> inorderTraversal(TreeNode root) {
List<Integer> result = new ArrayList<>();
Stack<TreeNode> stack = new Stack<>();
TreeNode curr = root;
while (curr != null || !stack.isEmpty()) {
if (curr != null) {
stack.push(curr);
curr = curr.left;
}
else {
TreeNode tmp = stack.pop();
result.add(tmp.val);
curr = tmp.right;
}
}
return result;
}
}
|
[
"[email protected]"
] | |
f37bc925cadbe8f9bfb1de46c3afe9a5814b4225
|
37f58bef29ecdd9573f4e4b15213a228a3dbb4cf
|
/src/net/minecraft/tileentity/TileEntitySkull.java
|
a3e008ce812abc787862ed9cc65e92c6f86b8df9
|
[] |
no_license
|
Liskoh/BasicsClient
|
35e7be6542801fd001bd5c1e13b026d999363864
|
4618799174ddd8b61c46da1de46cb97cebf477aa
|
refs/heads/master
| 2022-12-28T12:46:31.912693 | 2020-10-13T17:32:40 | 2020-10-13T17:32:40 | 303,152,665 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,825 |
java
|
package net.minecraft.tileentity;
import com.google.common.collect.Iterables;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import java.util.UUID;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.StringUtils;
public class TileEntitySkull extends TileEntity
{
private int field_145908_a;
private int field_145910_i;
private GameProfile field_152110_j = null;
private static final String __OBFID = "CL_00000364";
public void writeToNBT(NBTTagCompound p_145841_1_)
{
super.writeToNBT(p_145841_1_);
p_145841_1_.setByte("SkullType", (byte)(this.field_145908_a & 255));
p_145841_1_.setByte("Rot", (byte)(this.field_145910_i & 255));
if (this.field_152110_j != null)
{
NBTTagCompound var2 = new NBTTagCompound();
NBTUtil.func_152460_a(var2, this.field_152110_j);
p_145841_1_.setTag("Owner", var2);
}
}
public void readFromNBT(NBTTagCompound p_145839_1_)
{
super.readFromNBT(p_145839_1_);
this.field_145908_a = p_145839_1_.getByte("SkullType");
this.field_145910_i = p_145839_1_.getByte("Rot");
if (this.field_145908_a == 3)
{
if (p_145839_1_.func_150297_b("Owner", 10))
{
this.field_152110_j = NBTUtil.func_152459_a(p_145839_1_.getCompoundTag("Owner"));
}
else if (p_145839_1_.func_150297_b("ExtraType", 8) && !StringUtils.isNullOrEmpty(p_145839_1_.getString("ExtraType")))
{
this.field_152110_j = new GameProfile((UUID)null, p_145839_1_.getString("ExtraType"));
this.func_152109_d();
}
}
}
public GameProfile func_152108_a()
{
return this.field_152110_j;
}
/**
* Overriden in a sign to provide the text.
*/
public Packet getDescriptionPacket()
{
NBTTagCompound var1 = new NBTTagCompound();
this.writeToNBT(var1);
return new S35PacketUpdateTileEntity(this.field_145851_c, this.field_145848_d, this.field_145849_e, 4, var1);
}
public void func_152107_a(int p_152107_1_)
{
this.field_145908_a = p_152107_1_;
this.field_152110_j = null;
}
public void func_152106_a(GameProfile p_152106_1_)
{
this.field_145908_a = 3;
this.field_152110_j = p_152106_1_;
this.func_152109_d();
}
private void func_152109_d()
{
if (this.field_152110_j != null && !StringUtils.isNullOrEmpty(this.field_152110_j.getName()))
{
if (!this.field_152110_j.isComplete() || !this.field_152110_j.getProperties().containsKey("textures"))
{
GameProfile var1 = MinecraftServer.getServer().func_152358_ax().func_152655_a(this.field_152110_j.getName());
if (var1 != null)
{
Property var2 = (Property)Iterables.getFirst(var1.getProperties().get("textures"), (Object)null);
if (var2 == null)
{
var1 = MinecraftServer.getServer().func_147130_as().fillProfileProperties(var1, true);
}
this.field_152110_j = var1;
this.onInventoryChanged();
}
}
}
}
public int func_145904_a()
{
return this.field_145908_a;
}
public int func_145906_b()
{
return this.field_145910_i;
}
public void func_145903_a(int p_145903_1_)
{
this.field_145910_i = p_145903_1_;
}
}
|
[
"[email protected]"
] | |
f1f1489fe1f9ae4f760558755e80627a2c5c4c0f
|
c155a6ada740d3af6acc1d2bd5b352a1ae2effda
|
/src/exam/prooviEksamOtherVer/Objektorienteeritus.java
|
ba8ad9f3188943ff1c221fef4d3175098b717b72
|
[] |
no_license
|
mmuttik/javaHarjutused
|
0f85b30af9e233b64d68539a67ee75ed16df8984
|
b477546d697e4bb7bc69ae7393491c8f66451bdc
|
refs/heads/master
| 2021-01-17T11:45:09.627088 | 2016-01-29T09:08:12 | 2016-01-29T09:08:12 | 44,007,591 | 0 | 0 | null | 2015-10-10T11:15:40 | 2015-10-10T11:15:40 | null |
UTF-8
|
Java
| false | false | 1,182 |
java
|
package exam.prooviEksamOtherVer;
/**
* Siin failis kasutatakse objekti Seljakott, aga Seljakott klassi ei eksisteeri. Sinu ülesanne
* on see luua. Pane tähele, et mitte ükski objekti muutuja ei tohi olla
* kättesaadav objektist väljaspoolt.
* <p>
* Käesolevat klassi ei tohi muuta! Arvad, et ei jää vahele? :)
*/
public class Objektorienteeritus {
public static void main(String[] args) {
String omanikuNimi = "Kihnu Virve";
Seljakott kott = new Seljakott(omanikuNimi);
kott.lisaAsi("Hambapasta");
kott.lisaAsi("Hambahari");
kott.lisaAsi("Pleier");
kott.lisaAsi("Langevari");
kott.eemaldaAsi("Langevari"); // Ah mis sellest ikka vedada, saab ilma ka
System.out.println("Kotis on järgmised asjad: " + kott.misOnKotis());
System.out.println("Asju on kotis nii mitu: " + kott.mituAsjaOnKotis());
System.out.println("Omaniku nimi on: " + kott.omanikuNimi());
kott.rebene(); // oh shit, mis nüüd saab?
System.out.println("Kotis on järgmised asjad: " + kott.misOnKotis());
System.out.println("Asju on kotis nii mitu: " + kott.mituAsjaOnKotis());
}
}
|
[
"[email protected]"
] | |
fad3e477ccf879cdbd4f13f10bfe73444beff802
|
c45b44748ba1260f258a24835d4da68fb4141456
|
/app/src/main/java/com/zt/mdm/custom/device/receiver/SimStateReceiver.java
|
e85c3d323db0114a59eae4682df6ed1991a417c2
|
[] |
no_license
|
584178942/ztmdm
|
268f1e2fa95bd7c52ff3035bea7eec542b2f6713
|
3595dddb16f47757d44df4e6189fd501c382121d
|
refs/heads/master
| 2023-06-18T01:22:54.781608 | 2021-07-13T03:12:15 | 2021-07-13T03:12:15 | 385,449,944 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,221 |
java
|
package com.zt.mdm.custom.device.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import static android.content.Context.TELEPHONY_SERVICE;
/**
* 监听sim状态改变的广播,返回sim卡的状态, 有效或者无效。
* 双卡中只要有一张卡的状态有效即返回状态为有效,两张卡都无效则返回无效。
*
* @author ZT
* @date 20200925
*/
public class SimStateReceiver extends BroadcastReceiver {
private final static String ACTION_SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED";
@Override
public void onReceive(Context context, Intent intent) {
final String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
if (intent.getAction().equals(ACTION_SIM_STATE_CHANGED)) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(TELEPHONY_SERVICE);
int state = tm.getSimState();
switch (state) {
case TelephonyManager.SIM_STATE_READY:
if (IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(stateExtra)) {
try {
// HwMdmUtil.replaceSim();
} catch (Exception e) {
e.printStackTrace();
}
}
break;
case TelephonyManager.SIM_STATE_UNKNOWN:
case TelephonyManager.SIM_STATE_ABSENT:
case TelephonyManager.SIM_STATE_PIN_REQUIRED:
case TelephonyManager.SIM_STATE_PUK_REQUIRED:
case TelephonyManager.SIM_STATE_NETWORK_LOCKED:
default:
break;
}
}
}
/**
* @author Z T
* @date 20200925
*/
public class IccCardConstants {
/** The extra data for broacasting intent INTENT_ICC_STATE_CHANGE */
public static final String INTENT_KEY_ICC_STATE = "ss";
/** LOADED means all ICC records, including IMSI, are loaded */
public static final String INTENT_VALUE_ICC_LOADED = "LOADED";
}
}
|
[
"[email protected]"
] | |
391e51818a172b1f442f9e79ed087b3ceb3b8a15
|
81d81dbc3cd3fe3f68f42487bd28b1a762bde074
|
/src/main/java/com/arviiin/dataquality/service/WeightService.java
|
ea4c97c42f52d659d5472bc55dca45a0d9e55c94
|
[] |
no_license
|
Arviiin/dataquality
|
305acd34f14afce99759bd26316108f1f7aaeeab
|
2329859ad89e8eb0f97b59f3a3128ea6a3aa91eb
|
refs/heads/master
| 2020-04-16T07:36:40.308252 | 2019-04-11T10:04:51 | 2019-04-11T10:04:51 | 165,393,160 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 355 |
java
|
package com.arviiin.dataquality.service;
import com.arviiin.dataquality.model.WeightBean;
import java.util.Map;
public interface WeightService {
WeightBean getDefaultWeightResult();
void saveWeightBean(WeightBean weightResult);
WeightBean getWeightResult();
Map<String,String> formatWeightResultBean(WeightBean weightResultBean);
}
|
[
"[email protected]"
] | |
ba6841e9993115619275a74b52763f600e1130db
|
c08c5e86d40296751fdbf57b8db643f5b206fc19
|
/src/main/java/nl/rug/oop/cardgame/model/deck/Deck.java
|
3bcb8d0e743ba949308d6d2b82d5934a11253bfe
|
[] |
no_license
|
felix-zailskas/MagicStone
|
fd6cd072f60a524550224008746336b0553dfce6
|
05a33b79e81307576a8ac3561af14e737b100cb3
|
refs/heads/main
| 2023-08-06T13:54:48.323071 | 2021-09-21T08:04:25 | 2021-09-21T08:04:25 | 408,735,381 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,842 |
java
|
package nl.rug.oop.cardgame.model.deck;
import lombok.Data;
import nl.rug.oop.cardgame.model.card.*;
import java.util.ArrayList;
import java.util.Collections;
/**
* Deck class to store cards
*/
@Data
public class Deck {
private ArrayList<Card> deckList;
/**
* Creates a new Deck and fills it with cards and shuffles it
*/
public Deck() {
this.deckList = new ArrayList<>();
deckList.add(new CreatureCard(EnumCard.CREATURE_ZOMBIE));
deckList.add(new CreatureCard(EnumCard.CREATURE_ZOMBIE));
deckList.add(new CreatureCard(EnumCard.CREATURE_WEREWOLF));
deckList.add(new CreatureCard(EnumCard.CREATURE_WEREWOLF));
deckList.add(new CreatureCard(EnumCard.CREATURE_WOLF));
deckList.add(new CreatureCard(EnumCard.CREATURE_WOLF));
deckList.add(new CreatureCard(EnumCard.CREATURE_DRAGON));
deckList.add(new CreatureCard(EnumCard.CREATURE_DRAGON));
deckList.add(new CreatureCard(EnumCard.CREATURE_ARCHER));
deckList.add(new CreatureCard(EnumCard.CREATURE_ARCHER));
deckList.add(new CreatureCard(EnumCard.CREATURE_GUARD));
deckList.add(new CreatureCard(EnumCard.CREATURE_GUARD));
deckList.add(new CreatureCard(EnumCard.CREATURE_DEMON));
deckList.add(new CreatureCard(EnumCard.CREATURE_DEMON));
deckList.add(new CreatureCard(EnumCard.CREATURE_TORTOISE));
deckList.add(new CreatureCard(EnumCard.CREATURE_TORTOISE));
deckList.add(new CreatureCard(EnumCard.CREATURE_GARGOYLE));
deckList.add(new CreatureCard(EnumCard.CREATURE_GARGOYLE));
deckList.add(new CopySpell(EnumCard.SPELL_COPYPASTE));
deckList.add(new CopySpell(EnumCard.SPELL_COPYPASTE));
deckList.add(new HealthSpell(EnumCard.SPELL_INSTANTDAMAGE));
deckList.add(new HealthSpell(EnumCard.SPELL_INSTANTDAMAGE));
deckList.add(new DrawSpell(EnumCard.SPELL_INSTANTDRAW));
deckList.add(new DrawSpell(EnumCard.SPELL_INSTANTDRAW));
deckList.add(new HealthSpell(EnumCard.SPELL_INSTANTHEALTH));
deckList.add(new HealthSpell(EnumCard.SPELL_INSTANTHEALTH));
deckList.add(new HellFireSpell(EnumCard.SPELL_HELLFIRE));
deckList.add(new HellFireSpell(EnumCard.SPELL_HELLFIRE));
deckList.add(new DamageBuffSpell(EnumCard.SPELL_DAMAGEBUFF));
deckList.add(new DamageBuffSpell(EnumCard.SPELL_DAMAGEBUFF));
Collections.shuffle(deckList);
}
/**
* Removes a card from the top of the deck and returns it
* @return Card drawn
*/
public Card drawCard() {
Card card;
if (this.deckList.size() == 0) {
System.out.println("Deck empty!");
return null;
}
card = this.deckList.get(0);
this.deckList.remove(0);
return card;
}
}
|
[
"[email protected]"
] | |
f79e319379fb0596f665de86a222885253ec32d5
|
07ab93dcf287621f3ccfd9d5bdee1a452dfe3639
|
/baseModule/src/main/java/com/example/admin_xc/basemodule/util/IDCard.java
|
e7d173a06ded2051a47b91db0bb95c4f44a2719f
|
[] |
no_license
|
XiaoChongxc/AndroidStudioMaps
|
3ad9cb7ddf10586b4daeea94d4e5d581d70ecd98
|
411ec422fe0e7b2fff2994bfecdfceac180dfbec
|
refs/heads/master
| 2021-01-19T05:00:49.809558 | 2017-09-07T11:19:24 | 2017-09-07T11:19:24 | 87,382,784 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,528 |
java
|
package com.example.admin_xc.basemodule.util;
/**
* Created by @just_for_happy (@开心就好) on 2016/1/12.
* Date: 2016-01-12
* Time: 16:56
* Usege: 功能描述。。。
*/
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Hashtable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* author: just_for_happy(@开心就好)
* Date: 2016-01-12
* Time: 16:56
* FIXME
*/
public class IDCard {
/*********************************** 身份证验证开始 ****************************************/
/** 备注: 身份证 号码上面的 x 为小写,不然通不过
*
* 身份证号码验证 1、号码的结构 公民身份号码是特征组合码,由十七位数字本体码和一位校验码组成。排列顺序从左至右依次为:六位数字地址码,
* 八位数字出生日期码,三位数字顺序码和一位数字校验码。 2、地址码(前六位数)
* 表示编码对象常住户口所在县(市、旗、区)的行政区划代码,按GB/T2260的规定执行。 3、出生日期码(第七位至十四位)
* 表示编码对象出生的年、月、日,按GB/T7408的规定执行,年、月、日代码之间不用分隔符。 4、顺序码(第十五位至十七位)
* 表示在同一地址码所标识的区域范围内,对同年、同月、同日出生的人编定的顺序号, 顺序码的奇数分配给男性,偶数分配给女性。 5、校验码(第十八位数)
* (1)十七位数字本体码加权求和公式 S = Sum(Ai * Wi), i = 0, ... , 16 ,先对前17位数字的权求和
* Ai:表示第i位置上的身份证号码数字值 Wi:表示第i位置上的加权因子 Wi: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
* (2)计算模 Y = mod(S, 11) (3)通过模得到对应的校验码 Y: 0 1 2 3 4 5 6 7 8 9 10 校验码: 1 0 X 9 8 7 6 5 4 3 2
*
*
*/
/**
* 功能:身份证的有效验证
*
* @param IDStr
* 身份证号
* @return 有效:返回"" 无效:返回String信息
* @throws ParseException
*/
@SuppressWarnings("unchecked")
public static String IDCardValidate(String IDStr) {
String errorInfo = "";// 记录错误信息
String[] ValCodeArr = { "1", "0", "X", "9", "8", "7", "6", "5", "4",
"3", "2" };
String[] Wi = { "7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7",
"9", "10", "5", "8", "4", "2" };
String Ai = "";
// ================ 号码的长度 15位或18位 ================
if (IDStr.length() != 15 && IDStr.length() != 18) {
errorInfo = "身份证号码长度应该为15位或18位。";
return errorInfo;
}
// =======================(end)========================
// ================ 数字 除最后以为都为数字 ================
if (IDStr.length() == 18) {
Ai = IDStr.substring(0, 17);
} else if (IDStr.length() == 15) {
Ai = IDStr.substring(0, 6) + "19" + IDStr.substring(6, 15);
}
if (isNumeric(Ai) == false) {
errorInfo = "身份证15位号码都应为数字 ; 18位号码除最后一位外,都应为数字。";
return errorInfo;
}
// =======================(end)========================
// ================ 出生年月是否有效 ================
String strYear = Ai.substring(6, 10);// 年份
String strMonth = Ai.substring(10, 12);// 月份
String strDay = Ai.substring(12, 14);// 月份
if (isDate(strYear + "-" + strMonth + "-" + strDay) == false) {
errorInfo = "身份证生日无效。";
return errorInfo;
}
GregorianCalendar gc = new GregorianCalendar();
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
try {
if ((gc.get(Calendar.YEAR) - Integer.parseInt(strYear)) > 150
|| (gc.getTime().getTime() - s.parse(
strYear + "-" + strMonth + "-" + strDay).getTime()) < 0) {
errorInfo = "身份证生日不在有效范围。";
return errorInfo;
}
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0) {
errorInfo = "身份证月份无效";
return errorInfo;
}
if (Integer.parseInt(strDay) > 31 || Integer.parseInt(strDay) == 0) {
errorInfo = "身份证日期无效";
return errorInfo;
}
// =====================(end)=====================
// ================ 地区码时候有效 ================
Hashtable h = GetAreaCode();
if (h.get(Ai.substring(0, 2)) == null) {
errorInfo = "身份证地区编码错误。";
return errorInfo;
}
// ==============================================
// ================ 判断最后一位的值 ================
int TotalmulAiWi = 0;
for (int i = 0; i < 17; i++) {
TotalmulAiWi = TotalmulAiWi
+ Integer.parseInt(String.valueOf(Ai.charAt(i)))
* Integer.parseInt(Wi[i]);
}
int modValue = TotalmulAiWi % 11;
String strVerifyCode = ValCodeArr[modValue];
Ai = Ai + strVerifyCode;
if (IDStr.length() == 18) {
if (Ai.equals(IDStr) == false) {
errorInfo = "身份证无效,不是合法的身份证号码";
return errorInfo;
}
} else {
return "";
}
// =====================(end)=====================
return "";
}
/**
* 功能:设置地区编码
*
* @return Hashtable 对象
*/
@SuppressWarnings("unchecked")
private static Hashtable GetAreaCode() {
Hashtable hashtable = new Hashtable();
hashtable.put("11", "北京");
hashtable.put("12", "天津");
hashtable.put("13", "河北");
hashtable.put("14", "山西");
hashtable.put("15", "内蒙古");
hashtable.put("21", "辽宁");
hashtable.put("22", "吉林");
hashtable.put("23", "黑龙江");
hashtable.put("31", "上海");
hashtable.put("32", "江苏");
hashtable.put("33", "浙江");
hashtable.put("34", "安徽");
hashtable.put("35", "福建");
hashtable.put("36", "江西");
hashtable.put("37", "山东");
hashtable.put("41", "河南");
hashtable.put("42", "湖北");
hashtable.put("43", "湖南");
hashtable.put("44", "广东");
hashtable.put("45", "广西");
hashtable.put("46", "海南");
hashtable.put("50", "重庆");
hashtable.put("51", "四川");
hashtable.put("52", "贵州");
hashtable.put("53", "云南");
hashtable.put("54", "西藏");
hashtable.put("61", "陕西");
hashtable.put("62", "甘肃");
hashtable.put("63", "青海");
hashtable.put("64", "宁夏");
hashtable.put("65", "新疆");
hashtable.put("71", "台湾");
hashtable.put("81", "香港");
hashtable.put("82", "澳门");
hashtable.put("91", "国外");
return hashtable;
}
/**
* 功能:判断字符串是否为数字
*
* @param str
* @return
*/
private static boolean isNumeric(String str) {
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(str);
if (isNum.matches()) {
return true;
} else {
return false;
}
}
/**
* 功能:判断字符串是否为日期格式
*
* @param strDate
* @return
*/
public static boolean isDate(String strDate) {
Pattern pattern = Pattern
.compile("^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$");
Matcher m = pattern.matcher(strDate);
if (m.matches()) {
return true;
} else {
return false;
}
}
/**
* @param args
* @throws ParseException
*/
@SuppressWarnings("static-access")
public static void main(String[] args) throws ParseException {
String[] nums={"44098119930416171x","6124291995010802x","37078119790127719X","37142819800508053X","429004199401082953"};
for (String card: nums){
IDCard cc = new IDCard();
System.out.println("card:"+cc.IDCardValidate(card.toUpperCase()));
}
// System.out.println(cc.isDate("1996-02-29"));k
}
/*********************************** 身份证验证结束 ****************************************/
}
|
[
"[email protected]"
] | |
f17a4d39842f50f272b6f78ef952ce1d14a000a4
|
5f85d47dc2198393c7cfd8e8e983c12ff1252192
|
/generators/src/test/java/com/pholser/junit/quickcheck/generator/java/util/function/ToIntFunctionPropertyParameterTest.java
|
0f1a784b27dddffce32aa438b59be9230448b3b5
|
[
"MIT"
] |
permissive
|
imace/junit-quickcheck
|
0333308808bfcef799bd75051c4cdc5b786b9f2a
|
d67b037b4f774e188fcb4390c53d53bbf194f341
|
refs/heads/master
| 2021-01-20T16:44:39.929923 | 2015-12-24T16:51:19 | 2015-12-24T16:51:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,044 |
java
|
/*
The MIT License
Copyright (c) 2010-2015 Paul R. Holser, Jr.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.pholser.junit.quickcheck.generator.java.util.function;
import java.util.function.ToIntFunction;
import com.pholser.junit.quickcheck.Property;
import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
import static org.junit.experimental.results.PrintableResult.*;
import static org.junit.experimental.results.ResultMatchers.*;
public class ToIntFunctionPropertyParameterTest {
@Test public void unresolvedArgType() {
assertThat(testResult(UnresolvedArgType.class), isSuccessful());
}
@RunWith(JUnitQuickcheck.class)
public static class UnresolvedArgType<A> {
@Property public void consistent(ToIntFunction<? super A> f, A arg) {
int result = f.applyAsInt(arg);
for (int i = 0; i < 10000; ++i)
assertEquals(result, f.applyAsInt(arg));
}
}
}
|
[
"[email protected]"
] | |
92e8b68c2a5e2fd82d8991eaae0491c12bf04777
|
91e8a742dbc1abac7b24454d3d1786510672daca
|
/src/main/java/com/deity/restful/entity/Dynamic.java
|
a60faea3f491af85006f3f80563f013eb436a43d
|
[] |
no_license
|
MeDeity/RailleryRestful
|
5645693459fd548755d93f4b5e0e7caead7b7b83
|
6794a458eaf2387402affc85beafcb09425ca1f7
|
refs/heads/master
| 2021-01-19T19:27:00.873241 | 2017-07-24T14:51:22 | 2017-07-24T14:51:22 | 88,419,796 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,197 |
java
|
package com.deity.restful.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* 动态信息
* Created by Deity on 2017/4/16.
*/
@Entity
public class Dynamic {
@Id
@GeneratedValue
private Integer id;
/**动态描述*/
private String description;
/**附件地址*/
private String fileUrl;
/**附件的宽*/
private float width;
/**附件的高*/
private float height;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public float getWidth() {
return width;
}
public void setWidth(float width) {
this.width = width;
}
public float getHeight() {
return height;
}
public void setHeight(float height) {
this.height = height;
}
}
|
[
"[email protected]"
] | |
bf3e55f0ab36a0c66bbb4e66ba6205a556cebc12
|
93b73a6500e58314e8a15e80e7490518593057bc
|
/Advance Java/CodeSeven/src/com/app/service/ServiceDepositInterface.java
|
1024adec6f419152ca6f44cb2d1586480be8b43b
|
[] |
no_license
|
MadhuriTeli/Assignments
|
45bc800db5fe6f4c82c05fa4f7307d27286fa7cc
|
85cca67dfea60f6b21c6bc4c36d53eef6e934978
|
refs/heads/main
| 2023-08-18T18:02:36.322485 | 2021-10-04T20:22:31 | 2021-10-04T20:22:31 | 372,739,870 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 452 |
java
|
package com.app.service;
import java.util.Date;
import java.util.List;
import com.app.pojos.Address;
import com.app.pojos.Deposit;
import com.app.pojos.User;
public interface ServiceDepositInterface {
User validateUser(String usernm,String pass);
List<Deposit> getDeposit(Date startDate,Date endDate,User u);
String registerUser(User u);
String addDeposit(User u,Deposit d);
String addAddress(User u,Address a);
Address getAddress(User u);
}
|
[
"[email protected]"
] | |
7e21813d882108d24965812541d794a1ee7a563e
|
bf4f902314e0438aaee81a1370693243869c632d
|
/src/baekjoon/BOJ_3036.java
|
839155b4c0647260af21ba9b1cdbbb3f72b9374f
|
[] |
no_license
|
rekafekili/JavaStudy
|
7bc4dea87a42121ca87a342135a6560d43d61ff2
|
f002c26710925d2e9824c26f03d9f2975c497362
|
refs/heads/master
| 2023-05-12T04:06:49.186505 | 2021-05-21T05:27:08 | 2021-05-21T05:27:08 | 278,350,019 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,314 |
java
|
package baekjoon;
import java.util.ArrayList;
import java.util.Scanner;
/**
* Solved
*/
// https://www.acmicpc.net/problem/3036
public class BOJ_3036 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int testCase = sc.nextInt();
int[] rings = new int[testCase];
for (int i = 0; i < testCase; i++) {
rings[i] = sc.nextInt();
}
ArrayList<String> results = solve(rings);
for (String rs : results) {
System.out.println(rs);
}
}
private static ArrayList<String> solve(int[] rings) {
ArrayList<String> res = new ArrayList<>();
int first = rings[0];
for (int i = 1; i < rings.length; i++) {
res.add(getCommons(rings[i], first));
}
return res;
}
private static String getCommons(int ring, int first) {
while(true) {
boolean isComplete = true;
for (int i = 2; i < 1000; i++) {
if(ring % i == 0 && first % i == 0) {
ring /= i;
first /= i;
isComplete = false;
break;
}
}
if(isComplete) break;
}
return "" + first + "/" + ring;
}
}
|
[
"[email protected]"
] | |
ebe59400ab0e86e1aa618a69ef6f58067bccc351
|
a8210a7b508949afbb9715b2583cabbdcd05f45d
|
/PatternExtraction/src/main/java/cn/edu/sjtu/omnilab/tpca/pattern/utils/UserManager.java
|
7916a0834a2135ea98f1c5e762c9aa8a5dbe3814
|
[
"MIT"
] |
permissive
|
caomw/TPCA
|
5d30f5d634e0e4762e92062eb236d4bcc73b6208
|
9d43a37e1e655cfa85ef733cc606abbbc46b1cba
|
refs/heads/master
| 2021-01-15T20:58:16.242465 | 2015-03-07T12:35:54 | 2015-03-07T12:35:54 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,193 |
java
|
package cn.edu.sjtu.omnilab.tpca.pattern.utils;
import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import cn.edu.sjtu.omnilab.tpca.pattern.core.PatternSet;
public class UserManager implements Serializable{
/**
* auto generated UID for this class
*/
private static final long serialVersionUID = 6211004409002980337L;
// mapping between user ID and his sequence helper
private Map<String, SequencesHelper> userHelperMap = new HashMap<String, SequencesHelper>();
// mapping between user ID and his pattern sets
private Map<String, List<PatternSet>> userPatternsetsMap = new HashMap<String, List<PatternSet>>();
/**
* Default constructor.
*/
public UserManager(){}
/**
* Set the sequence helper of specific user.
* @param user The target user.
* @param helper The sequence helper to add.
*/
public void setSequencesHelper(String user, SequencesHelper helper){
if ( ! this.userHelperMap.containsKey(user) )
this.userHelperMap.put(user, helper);
else{
System.err.println("Duplicate SequencesHelper added to user " + user);
this.userHelperMap.put(user, helper);
}
}
/**
* Get all users from manager.
* @return A set of all user IDs.
*/
public Set<String> getAllUsers(){
Set<String> helperKeySet = userPatternsetsMap.keySet();
Set<String> psKeysSet = userHelperMap.keySet();
return (helperKeySet.size() == 0 ? psKeysSet : helperKeySet);
}
/**
* Get the sequence helper of specific user.
* @param user The target user.
* @return The sequence helper of the user.
*/
public SequencesHelper getSequencesHelper(String user){
if ( ! userHelperMap.containsKey(user) ){
System.err.println("Null SequencesHelper for user " + user);
return null;
} else{
return userHelperMap.get(user);
}
}
/**
* Add a pattern set to specific user.
* @param user The user who owns the pattern set.
* @param ps The pattern set to add.
*/
public void addPatternSet(String user, PatternSet ps){
if ( ! this.userPatternsetsMap.containsKey(user) ){
LinkedList<PatternSet> list = new LinkedList<PatternSet>();
list.add(ps);
this.userPatternsetsMap.put(user, list);
} else{
this.userPatternsetsMap.get(user).add(ps);
}
}
/**
* Get the list of pattern sets of specific user.
* @param user The target user.
* @return The list of pattern sets of the user.
*/
public List<PatternSet> getPatternSetList(String user){
List<PatternSet> list = new LinkedList<>();
if ( this.userPatternsetsMap.containsKey(user) ){
list = this.userPatternsetsMap.get(user);
}
return list;
}
/**
* Get all pattern sets of users.
* @return A list of pattern sets of all users.
*/
public List<PatternSet> getAllPatternSets(){
List<PatternSet> list = new LinkedList<>();
for( String user : this.userPatternsetsMap.keySet()){
list.addAll(this.userPatternsetsMap.get(user));
}
return list;
}
/**
* Clear data of all users.
*/
public void clear(){
this.userHelperMap.clear();
this.userPatternsetsMap.clear();
}
public int size(){
return this.userPatternsetsMap.size();
}
}
|
[
"[email protected]"
] | |
9f8a871b740752447b0b6160f7ddb3dec91c30e2
|
51a67a94f66e5bdb53f7da66140d173ee5ca4bd6
|
/app/src/main/java/com/example/hala/popularmovies/ViewModel/MovieViewModel.java
|
7501ee37c56b4d26c4aaa021f71fc3a6edca2efa
|
[] |
no_license
|
HalaBadr/PopularMovies
|
18124e47b83a99ceab123103f5963a76266ea035
|
8ccc185099aee132b2a82d32271c4e1b603f3530
|
refs/heads/master
| 2020-12-09T20:44:38.284333 | 2020-01-14T21:15:04 | 2020-01-14T21:15:04 | 233,412,649 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,456 |
java
|
package com.example.hala.popularmovies.ViewModel;
import com.example.hala.popularmovies.network.api.MovieDBAPI;
import com.example.hala.popularmovies.network.api.MovieDBInterface;
import com.example.hala.popularmovies.network.models.Movie;
import com.example.hala.popularmovies.network.models.Movie_Page;
import java.util.ArrayList;
import java.util.List;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MovieViewModel extends ViewModel {
public MutableLiveData<List<Movie>> moviepostmutableLiveData = new MutableLiveData<>();
List<Movie> All = new ArrayList<>();
public void getPopular_Movies() {
MovieDBInterface apiInterface = MovieDBAPI.getClient().create(MovieDBInterface.class);
for (int i = 1; i <= 500; i++){
apiInterface.getPopular_Movies(String.valueOf(i)).enqueue(new Callback<Movie_Page>() {
@Override
public void onResponse(Call<Movie_Page> call, Response<Movie_Page> response) {
All.addAll(response.body().getResults());
moviepostmutableLiveData.setValue(All);
}
@Override
public void onFailure(Call<Movie_Page> call, Throwable t) {
System.out.println("there is error : " + t);
}
});
}
}
}
|
[
"[email protected]"
] | |
216f64b0eca4257ea5b8c98a360b7221189b282e
|
7031785ce67f3f9e6daa1fb2ad7aa018f6510f87
|
/src/Stat/EventStat.java
|
4ae6db40c2a56876f155f673633f73d49c96b9ab
|
[] |
no_license
|
twlabc123/FinalThesis
|
2d78ae1646fcac92624c57e094bfc264d584d10a
|
509d67854b118fe358b902e7d6d7a3998b7ebb7a
|
refs/heads/master
| 2021-03-12T20:08:17.690792 | 2013-06-28T05:44:42 | 2013-06-28T05:44:42 | 9,092,993 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,296 |
java
|
package Stat;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Vector;
import Structure.Event;
/**
* The function of this class is to get statistics from event cluster results.<br>
* Not important.
* @author twl
*
*/
public class EventStat {
Vector<Integer> eventScale;
int[] eventScaleBound = {5,20,50,100,200};
int lowBound = 50;
int highBound = 20000;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
EventStat es = new EventStat();
es.stat("data/stat/news_lc_0.4.txt", "data/stat/eventscale0.4_"+es.lowBound+"_"+es.highBound+".txt");
}
EventStat()
{
eventScale = new Vector<Integer>();
}
public void stat(String input, String output)
{
try
{
FileOutputStream stream = new FileOutputStream(output);
OutputStreamWriter sw = new OutputStreamWriter(stream, "utf-8");
PrintWriter writer = new PrintWriter(sw);
FileInputStream istream = new FileInputStream(input);
InputStreamReader sr = new InputStreamReader(istream, "utf-8");
BufferedReader reader = new BufferedReader(sr);
for (int i = 0; i<=eventScaleBound.length; i++)
{
eventScale.add(0);
}
Event e;
while ((e = Event.readEvent(reader)) != null)
{
if (e.article.size() <= highBound && e.article.size() > lowBound)
{
for (int i = 0; i<e.article.size(); i++)
{
writer.println(e.article.elementAt(i).time.substring(0,10)+" "+e.article.elementAt(i).title);
}
writer.println("====");
}
Integer temp = eventScale.elementAt(getEventScaleIndex(e.article.size())) + 1;
eventScale.set(getEventScaleIndex(e.article.size()), temp);
}
for (int i = 0; i<eventScale.size(); i++)
{
if (i < eventScaleBound.length) writer.print(eventScaleBound[i]);
else writer.print("larger");
writer.println(" "+eventScale.elementAt(i));
}
reader.close();
writer.close();
} catch (Exception e)
{
e.printStackTrace();
}
}
int getEventScaleIndex(int n)
{
for (int i = 0; i<eventScaleBound.length; i++)
{
if (n <= eventScaleBound[i]) return i;
}
return eventScaleBound.length;
}
}
|
[
"[email protected]"
] | |
86ce07a0fc4722979f6898398a7023d0039fc482
|
5d918e4fdff53c399dafdc828036295d19117fc2
|
/app/src/main/java/com/laboratory/gallery/BaseApplication.java
|
1bcbe2caffb063851b55ba5e042b651ae0975e04
|
[] |
no_license
|
brokes6/Photolist
|
a9c5b0a427657d17b66173f7436e27b002ba76a7
|
af9243c628cdaff8232c57a4d0fc50015731a489
|
refs/heads/master
| 2023-02-26T05:33:28.379911 | 2021-02-04T07:10:05 | 2021-02-04T07:10:05 | 334,641,173 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,476 |
java
|
/*
* Copyright 2017 JessYan
*
* 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.laboratory.gallery;
import android.app.Application;
import me.jessyan.progressmanager.ProgressManager;
import okhttp3.OkHttpClient;
/**
* ================================================
* Created by JessYan on 06/06/2017 16:29
* <a href="mailto:[email protected]">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* ================================================
*/
public class BaseApplication extends Application {
//这里我就不写管理类了,捡个懒,直接在 Application 中管理单例 Okhttp
private OkHttpClient mOkHttpClient;
@Override
public void onCreate() {
super.onCreate();
this.mOkHttpClient = ProgressManager.getInstance().with(new OkHttpClient.Builder())
.build();
}
public OkHttpClient getOkHttpClient() {
return mOkHttpClient;
}
}
|
[
"[email protected]"
] | |
aea5db9883724864d7cbf8588fa9a4b2daf78cdc
|
04e7fb641a5f268ad8331bb5724acf6b39a44f9b
|
/GRIP-HTTP/MyLinesReport.java
|
c5ac657aa4b77401cddeddb29785da237d488839
|
[] |
no_license
|
SirLanceABot/Classes
|
7e5abe7b0198d7a2f8d31b9c0e17fb39705b7ddc
|
913c88bf38d9254401cd405c191aa935d87d3dd7
|
refs/heads/master
| 2023-04-08T16:16:58.150085 | 2023-04-01T01:12:43 | 2023-04-01T01:12:43 | 56,522,973 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 361 |
java
|
package app;
// json ata from GRIP lines report
// { "myLinesReport": { "length": [ , , ] , "y1": [ ,, ], "x1": [,, ] , "x2": [ ,,] , "y2": [,, ], "angle": [ , ,] }}
public class MyLinesReport{
public Data myLinesReport;
MyLinesReport(){}
public String toString(){
return myLinesReport.toString();
}
}
|
[
"[email protected]"
] | |
e0e44216a03ec1bd7433ba39b66a1071a209d125
|
a48c593e73010801ae5d9e1e8816a53e60a2960a
|
/VenttiGame/src/main/java/venttigame/domain/GameService.java
|
2f0240c964db899ff921319aee1b7f92a63596f8
|
[] |
no_license
|
marykristina4/ot-harjoitustyo
|
0fdb3f335b79162cd312dde2a3b76c3d2efceff3
|
c92d18223d294343e2fe76ae30ce6e45502fb3ee
|
refs/heads/master
| 2023-01-29T08:33:28.269930 | 2020-12-14T10:45:28 | 2020-12-14T10:45:28 | 307,980,366 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,379 |
java
|
package venttigame.domain;
import java.util.List;
import java.util.stream.Collectors;
import venttigame.dao.GameResultDao;
/**
* Luokka, joka hoitaa tiedonvälityksen ja vastaanottamisen tallennuksen suuntaan
* Sisältää metodit tulosten tallentamiseen, niiden hakemiseen tiedostosta sekä
* niiden hakemiseen tietylle pelaajanimelle
*/
public class GameService {
private GameResultDao gameResultDao;
private Deck gameDeck;
public GameService(GameResultDao gameResultDao) {
this.gameResultDao = gameResultDao;
gameDeck = new Deck();
gameDeck.shuffle();
}
/**
* Metodi luo tiedostoon uuden pelituloksen
* @param name Pelaajanimi, jonka pelaaja syöttänyt käyttöliittymässä
* @param result Pelitulos, johon pelaaja on pelissään päätynyt
*
* @return true jos virhettä ei tapahdu
*/
public boolean createGameResult(String name, String result) {
GameResult gameResult = new GameResult(name, result);
try {
gameResultDao.create(gameResult);
} catch (Exception ex) {
return false;
}
return true;
}
/**
* Metodi hakee tiedostosta kaikki pelitulokset
*
* @return Kaikki tallennetut pelitulokset listana
*/
public List<GameResult> getResults() {
return gameResultDao.getAll()
.stream()
.collect(Collectors.toList());
}
/**
* Metodi hakee tiedostosta pelitulokset syötteen mukaiselle pelaajalle
*
* @param name Pelaaja, jonka tulokset haetaan
*
* @return Kyseisen pelaajan tallennetut pelitulokset listana
*/
public List<GameResult> findByName(String name) {
return gameResultDao.findByName(name)
.stream()
.collect(Collectors.toList());
}
/**
* Metodi hoitaa kortin nostamisen pakasta, sen poistamisen pakasta
* sekä kortin laittamisen syötteenä saatuun käteen
*
* @param hand Käsi, johon nostettu kortti laitetaan
*
* @return Nostettu kortti string-muodossa
*/
public String cardFromDeck(Hand hand) {
gameDeck.shuffle();
Card drawnCard = gameDeck.cardDraw();
hand.addCard(drawnCard);
return drawnCard.tostring();
}
public void restartGame() {
gameDeck.cardsBackToDeck();
}
}
|
[
"[email protected]"
] | |
f3f79c2e3f5024352e79059839746fed0a3f0435
|
f6899a2cf1c10a724632bbb2ccffb7283c77a5ff
|
/blazeds-core/3.0.0.544/flex/management/BaseControlMBean.java
|
1f4f89b7b0eaaa027d6d1a7a83115d80927880ae
|
[] |
no_license
|
Appdynamics/OSS
|
a8903058e29f4783e34119a4d87639f508a63692
|
1e112f8854a25b3ecf337cad6eccf7c85e732525
|
refs/heads/master
| 2023-07-22T03:34:54.770481 | 2021-10-28T07:01:57 | 2021-10-28T07:01:57 | 19,390,624 | 2 | 13 | null | 2023-07-08T02:26:33 | 2014-05-02T22:42:20 | null |
UTF-8
|
Java
| false | false | 2,018 |
java
|
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* [2002] - [2007] Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated
* and its suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
*/
package flex.management;
import java.io.IOException;
import javax.management.ObjectName;
/**
* The base MBean interface for management beans that control aspects of
* Flex behavior on the server.
*
* @author shodgson
*/
public interface BaseControlMBean
{
/**
* Returns the id for this MBean. This is the value that is set for the
* <code>id</code> key in the <code>ObjectName</code> for this MBean.
*
* @return The MBean instance id.
* @throws IOException
*/
String getId() throws IOException;
/**
* Returns the type for this MBean. This is the value that is set for the
* <code>type</code> key in the <code>ObjectName</code> for this MBean.
*
* @return The MBean instance type.
* @throws IOException
*/
String getType() throws IOException;
/**
* Returns the parent for this MBean. The value is the <code>ObjectName</code>
* for the parent MBean that conceptually contains this MBean instance. If no
* parent exists, this method returns <code>null</code>.
*
* @return The <code>ObjectName</code> for the parent of this MBean instance.
* @throws IOException
*/
ObjectName getParent() throws IOException;
}
|
[
"[email protected]"
] | |
be010c0fc9c2218abc8576f3d14f7dcf24926d00
|
8d666524d75a601593f2693e92eae97a2e7ac7eb
|
/app/src/main/java/com/hhly/lyygame/presentation/view/activity/ActivityInfo.java
|
75d097b3a4236f5e4264477ec838416fd4cd128a
|
[] |
no_license
|
HelyLi/Play
|
70736c1df31236673cf8385496bd8da729acfbc2
|
8655d217e824379c097db15743fa63cc886950ae
|
refs/heads/master
| 2021-05-06T07:38:13.255076 | 2017-12-12T07:18:04 | 2017-12-12T07:18:04 | 113,956,226 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,083 |
java
|
package com.hhly.lyygame.presentation.view.activity;
/**
* Created by Simon on 2016/11/29.
*/
public class ActivityInfo {
private boolean isEnd;
private String name;
private String date;
private String url;
private String picUrl;
public ActivityInfo(boolean isEnd, String name, String date, String url, String picUrl) {
this.isEnd = isEnd;
this.name = name;
this.date = date;
this.url = url;
this.picUrl = picUrl;
}
public ActivityInfo(boolean isEnd, String name, String date, String url) {
this.isEnd = isEnd;
this.name = name;
this.date = date;
this.url = url;
this.picUrl = "http://imgsrc.baidu.com/anxun/pic/item/32fa828ba61ea8d3a24f0db9900a304e251f5819.jpg";
}
public boolean isEnd() {
return isEnd;
}
public String getName() {
return name;
}
public String getDate() {
return date;
}
public String getUrl() {
return url;
}
public String getPicUrl() {
return picUrl;
}
}
|
[
"[email protected]"
] | |
54dc98e5d2b1bfdb4420b2a78e8ab0a9067b065a
|
1fd6d2b78bd5e8b25fb049b18414e7c3dd2283b5
|
/app/src/main/java/com/jhhscm/platform/fragment/my/book/DetailToolBean.java
|
adc3ffadc9f56f8d57581b853a68499c0f88d07c
|
[] |
no_license
|
linhui123/jhhsProject
|
f0c54b89e540285d6969e016ea7238713fc327d5
|
12b9c97361b9b81f7e91d63f0f2cac537d124b84
|
refs/heads/master
| 2022-11-12T16:36:22.660387 | 2020-03-12T08:44:14 | 2020-03-12T08:44:14 | 275,484,168 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,028 |
java
|
package com.jhhscm.platform.fragment.my.book;
import java.io.Serializable;
public class DetailToolBean implements Serializable {
/**
* data : {"id":1,"userCode":"1111111111","dataCode":"20191119095230001740792477","dataType":0,"price1":100,"price2":200,"price3":300,"inType":11,"outType":0,"dataContent":"12212","picSmallUrl":"[11,11xx]","desc":"22,22xx","dataTime":"2019-11-11 00:00:00","addTime":"2019-11-19 09:52:19","updateTime":"2019-11-19 09:52:19","deleted":0}
*/
private DataBean data;
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean implements Serializable {
/**
* id : 1
* userCode : 1111111111
* dataCode : 20191119095230001740792477
* dataType : 0
* price1 : 100.0
* price2 : 200.0
* price3 : 300.0
* inType : 11
* outType : 0
* dataContent : 12212
* picSmallUrl : [11,11xx]
* desc : 22,22xx
* dataTime : 2019-11-11 00:00:00
* addTime : 2019-11-19 09:52:19
* updateTime : 2019-11-19 09:52:19
* deleted : 0
*/
private int id;
private String userCode;
private String data_code;
private int dataType;
private double price_1;
private double price_2;
private double price_3;
private int in_type;
private int out_type;
private String data_content;
private String pic_small_url;
private String desc;
private String data_time;
private String addTime;
private String updateTime;
private int deleted;
private String in_type_name;
private String out_type_name;
public String getIn_type_name() {
return in_type_name;
}
public void setIn_type_name(String in_type_name) {
this.in_type_name = in_type_name;
}
public String getOut_type_name() {
return out_type_name;
}
public void setOut_type_name(String out_type_name) {
this.out_type_name = out_type_name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public String getData_code() {
return data_code;
}
public void setData_code(String data_code) {
this.data_code = data_code;
}
public int getDataType() {
return dataType;
}
public void setDataType(int dataType) {
this.dataType = dataType;
}
public double getPrice_1() {
return price_1;
}
public void setPrice_1(double price_1) {
this.price_1 = price_1;
}
public double getPrice_2() {
return price_2;
}
public void setPrice_2(double price_2) {
this.price_2 = price_2;
}
public double getPrice_3() {
return price_3;
}
public void setPrice_3(double price_3) {
this.price_3 = price_3;
}
public int getIn_type() {
return in_type;
}
public void setIn_type(int in_type) {
this.in_type = in_type;
}
public int getOut_type() {
return out_type;
}
public void setOut_type(int out_type) {
this.out_type = out_type;
}
public String getData_content() {
return data_content;
}
public void setData_content(String data_content) {
this.data_content = data_content;
}
public String getPic_small_url() {
return pic_small_url;
}
public void setPic_small_url(String pic_small_url) {
this.pic_small_url = pic_small_url;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getData_time() {
return data_time;
}
public void setData_time(String data_time) {
this.data_time = data_time;
}
public String getAddTime() {
return addTime;
}
public void setAddTime(String addTime) {
this.addTime = addTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public int getDeleted() {
return deleted;
}
public void setDeleted(int deleted) {
this.deleted = deleted;
}
}
}
|
[
"[email protected]"
] | |
d9c229767cb96c76cff81c475440de97b5c45190
|
15bd22541824702bafb76ea587a6b659ba2f03ce
|
/Android/app/src/main/java/yagmurdan/sonra/toprakkokusu/ui/profile/ProfileFragment.java
|
e72536eaaa846f32831cd332fc74154114c55086
|
[] |
no_license
|
ozalc/toprak-kokusu
|
8e989e274e1ada9f8a34502621ee6a8c1945d77f
|
03302cb09622b143d2f13ccbf5148491ddcefddf
|
refs/heads/main
| 2023-07-11T09:02:52.512432 | 2021-08-13T08:57:30 | 2021-08-13T08:57:30 | 345,357,905 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 14,988 |
java
|
package yagmurdan.sonra.toprakkokusu.ui.profile;
import static android.app.Activity.RESULT_OK;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.renderscript.Sampler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.MimeTypeMap;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.MutableData;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.StorageTask;
import org.w3c.dom.Text;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.zip.Inflater;
import de.hdodenhof.circleimageview.CircleImageView;
import yagmurdan.sonra.toprakkokusu.MainActivity;
import yagmurdan.sonra.toprakkokusu.Model.CampingArea;
import yagmurdan.sonra.toprakkokusu.Model.User;
import yagmurdan.sonra.toprakkokusu.R;
import yagmurdan.sonra.toprakkokusu.ui.Authentication.LoginActivity;
import yagmurdan.sonra.toprakkokusu.ui.Authentication.RegisterActivity;
import yagmurdan.sonra.toprakkokusu.ui.CampingMainUI.CampingAreaDetailFragment;
import yagmurdan.sonra.toprakkokusu.ui.add.AddFragment;
import yagmurdan.sonra.toprakkokusu.ui.add.AddingScreen;
public class ProfileFragment extends Fragment {
protected Button logOutButton;
private FloatingActionButton fab_main, fab1_feedback, fab2_share;
private Animation fab_open, fab_close, fab_clock, fab_anticlock;
private TextView textView_share, textView_feedback,profileName,favoritesNumber,wentNumber,willGoNumber;
private CircleImageView profileImage;
private FirebaseAuth mAuth;
private DatabaseReference mDatabase;
Boolean isOpen = false;
public List<String> favoritedCampingAreasId=new ArrayList<>();
public List<String> wentCampingAreasId=new ArrayList<>();
public List<String> willGoCampingAreasId=new ArrayList<>();
public Uri filePath;
private final int PICK_IMAGE_REQUEST = 71;
public StorageReference storageReference;
public DatabaseReference databaseReference;
public StorageTask uploadTask;
private User user = new User();
public String user_id;
Uri uri;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = (ViewGroup) inflater.inflate(R.layout.fragment_profile, container, false);
mAuth=FirebaseAuth.getInstance();
user_id=mAuth.getCurrentUser().getUid();
storageReference = FirebaseStorage.getInstance().getReference("Users");
databaseReference = FirebaseDatabase.getInstance().getReference("Users").child(user_id);
logOutButton=view.findViewById(R.id.logOutButton);
fab_main = view.findViewById(R.id.hamburger);
fab1_feedback = view.findViewById(R.id.feedback);
fab2_share = view.findViewById(R.id.share);
fab_close = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_close);
fab_open = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_open);
fab_clock = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_rotate_clock);
fab_anticlock = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_rotate_anticlock);
profileImage = view.findViewById(R.id.circle_profile_image);
textView_share = (TextView) view.findViewById(R.id.textview_share);
textView_feedback = view.findViewById(R.id.textview_feedback);
profileName = (TextView) view.findViewById(R.id.profileName);
favoritesNumber=(TextView) view.findViewById(R.id.favoritesNumber);
wentNumber=(TextView) view.findViewById(R.id.wentNumber);
willGoNumber=(TextView) view.findViewById(R.id.willGoNumber);
profileImage.setImageResource(R.drawable.account_image);
//Şu anki kullanıcının id'sine göre veritabanından ismini alıp ekrana bastırırız
mDatabase= FirebaseDatabase.getInstance().getReference().child("Users").child(user_id);
mDatabase.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
String nameFromDB = snapshot.child("name").getValue().toString();
profileName.setText(nameFromDB);
String image = snapshot.child("image").getValue().toString();
if (!image.equals("default"))
{
Glide.with(getActivity())
.load(image)
.into(profileImage);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
profileImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { chooseImage(); }});
//FloatingActionButton işlemleri
fab_main.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(isOpen){
textView_share.setVisibility((View.INVISIBLE));
textView_feedback.setVisibility(View.INVISIBLE);
fab2_share.setVisibility(View.INVISIBLE);
fab1_feedback.setVisibility(View.INVISIBLE);
fab2_share.startAnimation(fab_close);
fab1_feedback.startAnimation(fab_close);
fab_main.startAnimation(fab_anticlock);
fab2_share.setClickable(false);
fab1_feedback.setClickable(false);
isOpen=false;
}
else {
textView_share.setVisibility(View.VISIBLE);
textView_feedback.setVisibility(View.VISIBLE);
fab1_feedback.setVisibility(View.VISIBLE);
fab2_share.setVisibility(View.VISIBLE);
fab1_feedback.startAnimation(fab_open);
fab2_share.startAnimation(fab_open);
fab_main.startAnimation(fab_clock);
fab2_share.setClickable(true);
fab1_feedback.setClickable(true);
isOpen = true;
}
}
});
//çıkış yapma butonu. Tıklanınca login ekranının getirir.
logOutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getContext(), "Oturum Kapatıldı",Toast.LENGTH_SHORT).show();
Intent loginIntent=new Intent(ProfileFragment.this.getActivity(), LoginActivity.class);
startActivity(loginIntent);
}
});
readUserCampInfos(user_id);
favoritesNumber.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FavoriteCampingAreasFragment favoriteCampingAreasFragment= new FavoriteCampingAreasFragment();
getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.fragment_container,favoriteCampingAreasFragment).commit();
}
});
wentNumber.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WentCampingAreasFragment wentCampingAreasFragment = new WentCampingAreasFragment();
getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.fragment_container,wentCampingAreasFragment).commit();
}
});
willGoNumber.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WillGoCampingAreasFragment willGoCampingAreasFragment=new WillGoCampingAreasFragment();
getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.fragment_container,willGoCampingAreasFragment).commit();
}
});
return view;
}
private void chooseImage() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Resim Seçiniz"), PICK_IMAGE_REQUEST);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data ) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
filePath = data.getData();
Glide.with(this).load(filePath).into(profileImage);
saveToDatabase(storageReference);
}
}
private String dosyaUzantisiAl(Uri uri) {
ContentResolver contentResolver = getActivity().getContentResolver();
MimeTypeMap mime = MimeTypeMap.getSingleton();
return mime.getExtensionFromMimeType(contentResolver.getType(uri));
}
private void saveToDatabase(StorageReference storageReference) {
if (filePath != null) {
StorageReference dosyaYolu = storageReference.child(System.currentTimeMillis()
+ "." + dosyaUzantisiAl(filePath));
ProgressDialog progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Yükleniyor...");
progressDialog.show();
//dosyayı storage'a gönder
uploadTask = dosyaYolu.putFile(filePath);
uploadTask.continueWithTask(new Continuation() {
@Override
public Object then(@NonNull Task task) throws Exception {
if (!task.isSuccessful())
throw task.getException();
return dosyaYolu.getDownloadUrl();
}
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
@Override
public void onComplete(@NonNull Task<Uri> task) {
if (task.isSuccessful()) {
//task başarılı ise Modelin bir örneği oluşturulur ve bu örnek üzerinden işlemler yapılır.
Toast.makeText(getActivity(),"Yükleme Başarılı",Toast.LENGTH_SHORT);
user.setimage(task.getResult().toString());
databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
HashMap<String, Object> hashMap= new HashMap<>();
hashMap.put("image", user.getimage());
databaseReference.updateChildren(hashMap);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
progressDialog.dismiss();
} else Toast.makeText(getActivity(), "Hata! ", Toast.LENGTH_SHORT).show();
}
});
}
}
private void readUserCampInfos(String user_id) {
favoritedCampingAreasId.removeAll(favoritedCampingAreasId);
wentCampingAreasId.removeAll(wentCampingAreasId);
willGoCampingAreasId.removeAll(willGoCampingAreasId);
DatabaseReference likeRef = FirebaseDatabase.getInstance().getReference("Users").child(user_id).child("likedCampingAreas");
DatabaseReference wentRef = FirebaseDatabase.getInstance().getReference("Users").child(user_id).child("wentCampingAreas");
DatabaseReference willGoRef = FirebaseDatabase.getInstance().getReference("Users").child(user_id).child("willGoCampingAreas");
likeRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot dataSnapshot : snapshot.getChildren())
{
favoritedCampingAreasId.add(dataSnapshot.child("likedCampingAreaID").getValue(String.class));
}
favoritesNumber.setText(String.valueOf(favoritedCampingAreasId.size()));
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
wentRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot dataSnapshot : snapshot.getChildren())
{
wentCampingAreasId.add(dataSnapshot.child("wentCampingAreaID").getValue(String.class));
}
wentNumber.setText(String.valueOf(wentCampingAreasId.size()));
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
willGoRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot dataSnapshot : snapshot.getChildren())
{
willGoCampingAreasId.add(dataSnapshot.child("willGoCampingAreaID").getValue(String.class));
}
willGoNumber.setText(String.valueOf(willGoCampingAreasId.size()));
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
}
|
[
"[email protected]"
] | |
08a8acefa863db0e363b839f79b91e3cdf08dfe5
|
bc55161e481f0cb05d9d61940a47b78aee2ef31d
|
/src/main/java/uy/gub/agesic/pge/context/SecurityActions.java
|
a0817ce07bd3668f7b83904ca553597a42d5f994
|
[] |
no_license
|
AGESIC-UY/cliente-java-plataforma-interoperabilidad
|
0d52fe811dc97a32c307f2f133cc5a8fcaedc768
|
273dfc7a81c16a3a45ef1de1902ac73e3853b5bd
|
refs/heads/master
| 2023-03-11T18:24:18.920294 | 2021-06-18T14:33:23 | 2021-06-18T14:33:23 | 222,720,636 | 0 | 0 | null | 2022-12-16T05:11:11 | 2019-11-19T14:53:24 |
Java
|
UTF-8
|
Java
| false | false | 3,922 |
java
|
package uy.gub.agesic.pge.context;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
class SecurityActions {
static Class<?> loadClass(final Class<?> theClass, final String fullQualifiedName) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
return AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
public Class<?> run() {
ClassLoader classLoader = theClass.getClassLoader();
Class<?> clazz = SecurityActions.loadClass(classLoader, fullQualifiedName);
if (clazz == null) {
classLoader = Thread.currentThread().getContextClassLoader();
clazz = SecurityActions.loadClass(classLoader, fullQualifiedName);
}
return clazz;
}
});
}
ClassLoader classLoader = theClass.getClassLoader();
Class<?> clazz = loadClass(classLoader, fullQualifiedName);
if (clazz == null) {
classLoader = Thread.currentThread().getContextClassLoader();
clazz = loadClass(classLoader, fullQualifiedName);
}
return clazz;
}
static Class<?> loadClass(final ClassLoader classLoader, final String fullQualifiedName) {
SecurityManager sm = System.getSecurityManager();
if (sm != null)
return AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
public Class<?> run() {
try {
return classLoader.loadClass(fullQualifiedName);
} catch (ClassNotFoundException e) {
return null;
}
}
});
try {
return classLoader.loadClass(fullQualifiedName);
} catch (ClassNotFoundException e) {
return null;
}
}
static String getSystemProperty(final String key, final String defaultValue) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty(key, defaultValue);
}
});
}
return System.getProperty(key, defaultValue);
}
static URL loadResource(final Class<?> clazz, final String resourceName) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
return AccessController.doPrivileged(new PrivilegedAction<URL>() {
public URL run() {
ClassLoader clazzLoader = clazz.getClassLoader();
URL url = clazzLoader.getResource(resourceName);
if (url == null) {
clazzLoader = Thread.currentThread().getContextClassLoader();
url = clazzLoader.getResource(resourceName);
}
return url;
}
});
}
ClassLoader clazzLoader = clazz.getClassLoader();
URL url = clazzLoader.getResource(resourceName);
if (url == null) {
clazzLoader = Thread.currentThread().getContextClassLoader();
url = clazzLoader.getResource(resourceName);
}
return url;
}
static String getProperty(final String key, final String defaultValue) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty(key, defaultValue);
}
});
}
return System.getProperty(key, defaultValue);
}
}
|
[
"[email protected]"
] | |
cc3eb3e81f4b2a25fb56fbbc5ea6f5757fc128e5
|
47e46acf195345e4ab24bb1f083472a9d4c895b2
|
/Products.java
|
4a604417956610e09de579d40934f1becda82d2c
|
[] |
no_license
|
macjon2014/sw-2013318336
|
193101774b3d793a407f9fac1b0b4e4b98eac197
|
88ad5b208dac750d56780c8f02d34c580923180f
|
refs/heads/master
| 2020-06-11T00:56:03.124041 | 2016-12-07T11:28:00 | 2016-12-07T11:28:00 | 75,828,585 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,814 |
java
|
package com.qz.transaction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import com.qz.transaction.MyHelper;
import com.qz.transaction.R;
import com.qz.transaction.UserInformation;
import com.qz.transaction.UserOperate;
public class Products extends Activity {
private Button publish;
private Button back;
private EditText search;
private Button searchBut;
private Button myProducts;
private Button allProducts;
private ListView listview;
Listener butListener = new Listener();
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
private String str_bundleAccount = new String();
private String str_bundleName = new String();
private String mainUserName;
MyHelper helper;
SQLiteDatabase db;
Cursor cursor;
SimpleAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.products);
publish = (Button) super.findViewById(R.id.publish);
search = (EditText) super.findViewById(R.id.search);
searchBut = (Button) super.findViewById(R.id.searchBut);
myProducts = (Button) super.findViewById(R.id.myProducts);
allProducts = (Button) super.findViewById(R.id.allProducts);
listview = (ListView) super.findViewById(R.id.listview);
back = (Button) findViewById(R.id.publish_back);
Bundle bundle = getIntent().getExtras();
str_bundleAccount = bundle.getString("account");
str_bundleName = bundle.getString("name");
helper = new MyHelper(this);
initmyPro();
GetLandedName();
searchBut.setOnClickListener(butListener);
publish.setOnClickListener(butListener);
myProducts.setOnClickListener(butListener);
allProducts.setOnClickListener(butListener);
back.setOnClickListener(butListener);
search.addTextChangedListener(new TextChangeListener());
listview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
HashMap map = (HashMap)arg0.getItemAtPosition(arg2);
String publisher = (String) map.get("publisher");
String goods_name = (String) map.get("goods_name");
Intent intent = new Intent(Products.this,ProductInfo.class);
Bundle bundle = new Bundle();
bundle.putString("publisher", publisher);
bundle.putString("goods_name", goods_name);
bundle.putString("mainUserName", mainUserName);
intent.putExtras(bundle);
startActivity(intent);
}
});
}
private void GetLandedName(){
db = helper.getWritableDatabase();
cursor = db.query("publisher", null, null, null, null, null, null);
for(int i=0;i<cursor.getCount();i++){
cursor.moveToPosition(i);
if(cursor.getString(cursor.getColumnIndex("publisher_account")).equals(str_bundleAccount)){
mainUserName = cursor.getString(cursor.getColumnIndex("publisher_name"));
}
}
cursor.close();
db.close();
helper.close();
}
private class TextChangeListener implements TextWatcher{
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
if(TextUtils.isEmpty(s)){
initallPro();
}
}
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before,
int count) {
// TODO Auto-generated method stub
}
}
private void AddData2ListView() {
adapter = new SimpleAdapter(getApplicationContext(), list,
R.layout.list_item, new String[] { "publisher", "goods_name","mainUserName" },
new int[] { R.id.publisher, R.id.goods_name });
listview.setAdapter(adapter);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
initmyPro();
initallPro();
super.onResume();
}
public class Listener implements OnClickListener {
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.searchBut:
Search();
break;
case R.id.publish:
Bundle bundle = new Bundle();
bundle.putString("account", str_bundleAccount);
bundle.putString("name", str_bundleName);
Intent intent = new Intent();
intent.setClass(Products.this, Publish.class);
intent.putExtras(bundle);
startActivity(intent);
break;
case R.id.myProducts:
initmyPro();
break;
case R.id.allProducts:
initallPro();
break;
case R.id.publish_back:
Products.this.finish();
break;
}
}
}
private void Search(){
list.clear();
String name = search.getText().toString();
db = helper.getWritableDatabase();
cursor = db.query("goods", new String[] { "publisher_name",
"goods_name" }, "goods_name like ?", new String[] { "%"
+ name + "%" }, null, null, null);
for (int i = 0; i < cursor.getCount(); i++) {
cursor.moveToPosition(i);
String goods_name = cursor.getString(cursor
.getColumnIndex("goods_name"));
String publisher = cursor.getString(cursor
.getColumnIndex("publisher_name"));
Map<String, String> map = new HashMap<String, String>();
map.put("publisher", publisher);
map.put("goods_name", goods_name);
list.add(map);
}
AddData2ListView();
cursor.close();
db.close();
helper.close();
}
public void initmyPro() {
list.clear();
db = helper.getWritableDatabase();
cursor = db.query("goods", null, null, null, null, null, null);
if (cursor != null) {
for (int i = 0; i < cursor.getCount(); i++) {
cursor.moveToPosition(i);
String publisher = cursor.getString(cursor
.getColumnIndex("publisher_name"));
if (publisher.equals(str_bundleName)) {
String goods_name = cursor.getString(cursor
.getColumnIndex("goods_name"));
Map<String, String> map = new HashMap<String, String>();
map.put("publisher", str_bundleName);
map.put("goods_name", goods_name);
map.put("mainUserName", mainUserName);
list.add(map);
}
}
AddData2ListView();
}
cursor.close();
db.close();
helper.close();
}
@SuppressLint("ParserError")
public void initallPro() {
list.clear();
db = helper.getWritableDatabase();
cursor = db.query("goods", null, null, null, null, null, null);
if (cursor != null) {
for (int i = 0; i < cursor.getCount(); i++) {
cursor.moveToPosition(i);
String goods_name = cursor.getString(cursor
.getColumnIndex("goods_name"));
String publisher = cursor.getString(cursor
.getColumnIndex("publisher_name"));
Map<String, String> map = new HashMap<String, String>();
map.put("publisher", publisher);
map.put("goods_name", goods_name);
map.put("mainUserName", mainUserName);
list.add(map);
}
AddData2ListView();
}
cursor.close();
db.close();
helper.close();
}
}
|
[
"[email protected]"
] | |
e39e3102513a489337f9bdaefe2f38fabc268824
|
b9a9ef1555ac0092f855d58a31d57ddd8bb689e4
|
/kafka-core/src/main/java/com/lzy/service/impl/UserVisitServiceImpl.java
|
ddd373fa44e5ba0b322701b7804f6249ecb71580
|
[] |
no_license
|
qq329559421/WIFI-Analysis
|
83c9a838d8c7ae422128c54b79f318f9381340a3
|
0b52f73d3d07201b22b8c94a77009d6acec00a5f
|
refs/heads/master
| 2022-01-09T20:22:34.646405 | 2018-06-09T16:36:38 | 2018-06-09T16:36:38 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,872 |
java
|
package com.lzy.service.impl;
import com.lzy.entity.UserBean;
import com.lzy.service.UserVisitService;
import com.lzy.component.QueryUsersShopInfo;
import com.lzy.entity.UserVisitBean;
import com.lzy.mapper.UserVisitMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by Wang Han on 2017/6/18 15:19.
* E-mail address is [email protected].
* Copyright © 2017 Wang Han. SCU. All Rights Reserved.
*/
@Service("userVisitService")
public class UserVisitServiceImpl implements UserVisitService {
@Autowired
UserVisitMapper userVisitMapper;
@Autowired
QueryUsersShopInfo queryUsersShopInfo;
public void addUserVisit(UserVisitBean userFlow) throws Exception {
userVisitMapper.addUserVisit(userFlow);
}
public List<UserVisitBean> queryUserVisit(List<Integer> shopIdlist) throws Exception {
return userVisitMapper.queryUserVisit(shopIdlist);
}
public List<UserBean> queryUserShop(List<Integer> shopIdlist) throws Exception {
return userVisitMapper.queryUserShop(shopIdlist);
}
public List<Integer> queryShopList(String userName) throws Exception {
UserVisitBean userVisitBean = new UserVisitBean();
userVisitBean.setTotalFlow(0);
userVisitBean.setTime(0l);
userVisitBean.setShopId(0);
userVisitBean.setShallowVisitRate(0d);
userVisitBean.setDeepVisitRate(0d);
userVisitBean.setCheckInRate(0d);
userVisitBean.setCheckInFlow(0);
userVisitBean.setMmac("0");
List<Integer> shopList = queryUsersShopInfo.getShopId(userName);
if (shopList == null) {
return null;
}
if (shopList.size() > 0) {
return shopList;
} else{
return null;
}
}
}
|
[
"[email protected]"
] | |
39f3c47b2083063f425a9021009d63ec56e61391
|
bba510647f45d4e971d55092980dbc8150801e81
|
/src/test/java/com/putact/websocket/LongEventProducer.java
|
8739330b1196bf9770768c3abf2f6f99c210f5e6
|
[] |
no_license
|
mnmhouse/stock-demo
|
0d093ec2788d8ae52362269a93f65e5db61e59d8
|
d69a0d42f4d2a779c00300c9faffdf2b51016ccc
|
refs/heads/master
| 2021-01-22T13:22:13.168671 | 2017-08-18T15:24:13 | 2017-08-18T15:24:13 | 100,667,597 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 499 |
java
|
package com.putact.websocket;
import java.nio.ByteBuffer;
import com.lmax.disruptor.RingBuffer;
public class LongEventProducer {
private final RingBuffer<LongEvent> ringBuffer;
public LongEventProducer(RingBuffer<LongEvent> ringBuffer) {
this.ringBuffer = ringBuffer;
}
public void onData(ByteBuffer bb) {
long sequence = ringBuffer.next();
try {
LongEvent event = ringBuffer.get(sequence);
event.setValue(bb.getInt());
} finally {
ringBuffer.publish(sequence);
}
}
}
|
[
"[email protected]"
] | |
cfe5a4bcbfdbeb6cb93f47ab9ccfc1aa4dbb13fd
|
e183ed9f2105613e83037b60d6b50f07a95b1d91
|
/tags/REL-5.0.332/utilities/Globals.java
|
0142ba3203159264d277751f9255c265aee092fe
|
[] |
no_license
|
sengadnl/jkemik1
|
1558d58c8342db4649b7573f689f5bc6b2f20a2c
|
b8c9e10ccd54597219920d9269d1560dec646ab9
|
refs/heads/master
| 2021-01-24T15:06:38.183407 | 2014-12-11T00:23:39 | 2014-12-11T00:23:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,472 |
java
|
/**
*
*/
package utilities;
import java.awt.Color;
/**
* @author Daniel Senga
*
*/
public class Globals {
public static final double PLR_N_LEN = 5;
public static final double FADE_VARIANT = .35;//for fading colors
public static final double LABEL_VARIANT = 120;//for fading colors
public static final int FADE_THRESHOLD = 50;
public static final String templateObjectFile = "/tmp/template.obj";
public static final String tempFile = "tmp";
public static final String gameObjectFile = "/tmp/game.obj";
public static final String settingsTemplateObjectFile = "/tmp/stemplate.obj";
public static final String VERSION = "Beta-5.0.315 ";
public static final int POINT_VALUE = 1;
public static final int REDEEMED_POINT_VALUE = 1;
public static final int RED_INDEX = 0;
public static final int WHITE_INDEX = 4;
public static final int GREEN_INDEX = 5;
public static final int YELLOW_INDEX = 3;
public static final double MAX_WIN = .9;
public static final int LIGHT_PURPPLE_INDEX = 3;
public static final int DARK_PURPPLE_INDEX = 9;
public static final int SQUARE_MIN_SIZE = 15;
public static final int SQUARE_MAX_SIZE = 64;
public static final double FRAME_WIDTH = 1280;
public static final double FRAME_HEIGHT = 800;
public static final double SIZE_PERCENT = .75;
public static final Color[] CHEMIK_COLOR = {
new Color(77, 192, 250),
new Color(103, 250, 95),
new Color(250, 250, 57)};
public static final Color[] ORIGINE_COLOR = {
new Color(232, 216, 37),
new Color(99, 196, 235),
new Color(45, 214, 68)};
public static final Color[] CLASSIC_COLOR = {
new Color(0, 255, 0),
new Color(250, 50, 50),
new Color(250, 250, 250)};
public static final Color[] GEECKY_COLOR = {
new Color(166, 171, 179),
new Color(206, 156, 151),
new Color(150, 196, 147)};
public static final Color PENALTY_COL = new Color(224,27,208);
public static final Color SYSPREFS_BUTTON_BGCOLOR = new Color(255, 150, 245);//
public static final Color SYSPREFS_BUTTON_FGCOLOR = new Color(160, 29, 100);
public static final Color EXIT_BUTTON_BGCOLOR = new Color(200, 20, 20);//
public static final Color EXIT_BUTTON_FGCOLOR = new Color(100, 40, 40);
public static final Color NEWG_BUTTON_BGCOLOR = new Color(30, 200, 30);
public static final Color NEWG_BUTTON_FRCOLOR = new Color(20, 100, 20);
public static final String[] code = {"en","fr","de"};
public static final String[] laguageNames = {"ENGLISH","FRANCAIS","DEUTSCH"};
}
|
[
"sengadnl@448f8b3a-472d-e0b5-a73d-fc981c7fd2c4"
] |
sengadnl@448f8b3a-472d-e0b5-a73d-fc981c7fd2c4
|
5cf5c0662d4da59c5eda854b679461b8e166f915
|
20eb62855cb3962c2d36fda4377dfd47d82eb777
|
/IntroClassJava/dataset/digits/d2b889e1ac42bc85f9df5c45c10708f46784be93d69acd1415cfd4d028cb50b19f50c374a9498c8e8b909173053a100e20c279ddb06c6359a06a920ead3e8080/000/mutations/367/digits_d2b889e1_000.java
|
88a6d9c6f10da4eaeec75e5ca32d1645ff797c76
|
[] |
no_license
|
ozzydong/CapGen
|
356746618848065cce4e253e5d3c381baa85044a
|
0ba0321b6b1191443276021f1997833342f02515
|
refs/heads/master
| 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,724 |
java
|
package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class digits_d2b889e1_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
digits_d2b889e1_000 mainClass = new digits_d2b889e1_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj x = new IntObj (), a = new IntObj (), b = new IntObj (), c =
new IntObj (), y = new IntObj ();
output += (String.format ("Enter an integer > "));
b.value = scanner.nextInt ();
a.value = b.value / 10;
c.value = c.value) * (-1 % 10;
if (c.value > 0) {
output += (String.format ("%d\n", c.value));
} else if (c.value < 0) {
y.value = c.value * (-1);
output += (String.format ("%d\n", y.value));
}
if (a.value > 0) {
while (a.value > 0) {
x.value = a.value % 10;
a.value = a.value / 10;
output += (String.format ("%d\n", x.value));
if (a.value < 10) {
output +=
(String.format ("%d\nThat's all, have a nice day!\n", a.value));
if (true)
return;;
}
}
} else if (a.value < 0) {
a.value = a.value * (-1);
while (a.value > 0) {
x.value = a.value % 10;
a.value = a.value / 10;
output += (String.format ("%d\n", x.value));
if (a.value < 10) {
a.value = a.value * (-1);
output +=
(String.format ("%d\nTHat's all, have a nice day~\n", a.value));
}
}
}
if (true)
return;;
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.