blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7ceed76b2aa0a9892e0805142c48bab57533fa77 | 0c5ab09485e221a53b3cdf10639d4146bebb3054 | /src/main/java/com/nirrattner/splittimer/SplitTimerLauncher.java | 2a5f182d7ad02074aa2efc06e584b19360ceffc3 | [] | no_license | nirrattner/SplitTimer | 166043983ee48e55a94a3db2da2b29f83eadbf8c | 5dd66f39dc5cf167e6c1db65979de92d55415ca5 | refs/heads/main | 2023-01-03T11:35:11.811548 | 2020-10-31T20:48:22 | 2020-10-31T20:48:22 | 307,821,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package com.nirrattner.splittimer;
public class SplitTimerLauncher {
public static void main(String[] args) {
SplitTimerApplication.main(args);
}
}
| [
"[email protected]"
] | |
2e5f795c6f7887350fc3119c8251e301641c060a | b798729ad4c4b74b152d0fb7c3b251363350c23d | /src/test/java/com/test/LoginTest.java | b2a93f41b9c880cfa9420d4786f48dd7db62e3a5 | [] | no_license | saffins/LogsProject | 9cf7e725bb574a8993a3a4cc9d5c3da92cf5c912 | 515fea2e759f4165dba28812c72a7420325afb6f | refs/heads/master | 2023-08-09T11:01:17.467342 | 2019-05-27T07:08:20 | 2019-05-27T07:08:20 | 188,789,931 | 0 | 0 | null | 2023-07-22T06:48:02 | 2019-05-27T07:07:58 | HTML | UTF-8 | Java | false | false | 1,375 | java | package com.test;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;
import org.testng.log4testng.Logger;
public class LoginTest {
WebDriver driver ;
Logger log = Logger.getLogger(LoginTest.class);
@Test
public void m1() throws IOException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver.exe");
driver = new ChromeDriver();
log.info("launching chrome");
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get("http://google.com");
log.info("entering application url");
}
@Test
public void search() throws InterruptedException{
try{
Assert.assertFalse(driver.findElement(By.name("q")).isDisplayed());
log.info("search bar displayed");
}catch(AssertionError e){
log.warn("search bar not displayed");
}
driver.findElement(By.name("q")).sendKeys("ps4");
driver.findElement(By.name("q")).sendKeys(Keys.ESCAPE);
Thread.sleep(1000);
driver.findElement(By.name("btnK")).click();
log.info("button clicked");
}
@AfterTest
public void teardown(){
driver.quit();
}
}
| [
"[email protected]"
] | |
87f2bd2339130ee5a3f2b2a26099cf3c2af6163c | 4673dce7b4ac50ba2801faacfc1a9fe046e4895c | /library_common/src/main/java/others/core/utils/CleanUtils.java | 7bf719ec20d13657ea870648e639a945eb5a2fa0 | [] | no_license | Too-Stubborn/android-exercises | 532da8d9d37cdd8fe0e7022f612b62f922b431f5 | da84a825fda8fd3d65c9e04c2f77304219b38a26 | refs/heads/master | 2020-03-22T05:39:46.092599 | 2018-03-21T02:22:59 | 2018-03-21T02:22:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,898 | java | package others.core.utils;
import java.io.File;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/9/27
* desc : 清除相关工具类
* </pre>
*/
public class CleanUtils {
private CleanUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* 清除内部缓存
* <p>/data/data/com.xxx.xxx/cache</p>
*
* @return {@code true}: 清除成功<br>{@code false}: 清除失败
*/
public static boolean cleanInternalCache() {
return FileUtils.deleteFilesInDir(Utils.getContext().getCacheDir());
}
/**
* 清除内部文件
* <p>/data/data/com.xxx.xxx/files</p>
*
* @return {@code true}: 清除成功<br>{@code false}: 清除失败
*/
public static boolean cleanInternalFiles() {
return FileUtils.deleteFilesInDir(Utils.getContext().getFilesDir());
}
/**
* 清除内部数据库
* <p>/data/data/com.xxx.xxx/databases</p>
*
* @return {@code true}: 清除成功<br>{@code false}: 清除失败
*/
public static boolean cleanInternalDbs() {
return FileUtils.deleteFilesInDir(Utils.getContext().getFilesDir().getParent() + File.separator + "databases");
}
/**
* 根据名称清除数据库
* <p>/data/data/com.xxx.xxx/databases/dbName</p>
*
* @param dbName 数据库名称
* @return {@code true}: 清除成功<br>{@code false}: 清除失败
*/
public static boolean cleanInternalDbByName( String dbName) {
return Utils.getContext().deleteDatabase(dbName);
}
/**
* 清除内部SP
* <p>/data/data/com.xxx.xxx/shared_prefs</p>
*
* @return {@code true}: 清除成功<br>{@code false}: 清除失败
*/
public static boolean cleanInternalSP() {
return FileUtils.deleteFilesInDir(Utils.getContext().getFilesDir().getParent() + File.separator + "shared_prefs");
}
/**
* 清除外部缓存
* <p>/storage/emulated/0/android/data/com.xxx.xxx/cache</p>
*
* @return {@code true}: 清除成功<br>{@code false}: 清除失败
*/
public static boolean cleanExternalCache() {
return SDCardUtils.isSDCardEnable() && FileUtils.deleteFilesInDir(Utils.getContext().getExternalCacheDir());
}
/**
* 清除自定义目录下的文件
*
* @param dirPath 目录路径
* @return {@code true}: 清除成功<br>{@code false}: 清除失败
*/
public static boolean cleanCustomCache(String dirPath) {
return FileUtils.deleteFilesInDir(dirPath);
}
/**
* 清除自定义目录下的文件
*
* @param dir 目录
* @return {@code true}: 清除成功<br>{@code false}: 清除失败
*/
public static boolean cleanCustomCache(File dir) {
return FileUtils.deleteFilesInDir(dir);
}
}
| [
"[email protected]"
] | |
ba44e3e2bdc7a3b72fa243584b9b32e4564c85c8 | f45392ab7bddae26837cf3235a5fcce3c1b16a18 | /src/basics/FactorialUsingRecursion.java | df19960441508cc3a63526f34a2504b909296472 | [] | no_license | aina-shukla/CoreJavaCodes | 2a2575c142f00e4b9faad706b4534c22e7a827ba | b9428847ec032e9d82de56d383c5d6a4751da8df | refs/heads/main | 2023-08-14T07:04:31.517331 | 2021-09-30T11:13:59 | 2021-09-30T11:13:59 | 378,431,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package basics;
import java.util.Scanner;
public class FactorialUsingRecursion {
static int factorial(int num) {
if (num == 0)
return 1;
else
return (num * factorial(num - 1));
}
public static void main(String[] args) {
int fact = 1;
Scanner in = new Scanner(System.in);
System.out.println("Enter an integer");
int num = in.nextInt();
fact = factorial(num);
System.out.println("factorial of " + num + " is " + fact);
}
}
| [
"[email protected]"
] | |
f16a360647524e989e75f7b0e7c9d697cb77ed8f | eeaeddeab4775a1742dba5c8898686fd38caf669 | /base/base-kafka/src/test/java/com/zsw/kafka/ConsumerTests.java | e385d08a645e663f698f17e36ad1a148607046a4 | [
"Apache-2.0"
] | permissive | MasterOogwayis/spring | 8250dddd5d6ee9730c8aec4a7aeab1b80c3bf750 | c9210e8d3533982faa3e7b89885fd4c54f27318e | refs/heads/master | 2023-07-23T09:49:37.930908 | 2023-07-21T03:04:27 | 2023-07-21T03:04:27 | 89,329,352 | 0 | 0 | Apache-2.0 | 2023-06-14T22:51:13 | 2017-04-25T07:13:03 | Java | UTF-8 | Java | false | false | 1,426 | java | package com.zsw.kafka;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import java.time.Duration;
import java.util.Collections;
import java.util.Properties;
import static com.zsw.kafka.KafkaProperties.BROKER_LIST;
import static com.zsw.kafka.KafkaProperties.TOPIC;
/**
* @author ZhangShaowei on 2020/6/23 15:03
*/
@Slf4j
public class ConsumerTests {
public static void main(String[] args) {
Properties properties = new Properties();
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, BROKER_LIST);
properties.put(ConsumerConfig.GROUP_ID_CONFIG, "groupId");
KafkaConsumer<String, String> consumer = new KafkaConsumer<>(properties);
consumer.subscribe(Collections.singletonList(TOPIC));
while (true) {
ConsumerRecords<String, String> poll = consumer.poll(Duration.ofSeconds(10));
poll.forEach(System.out::println);
}
}
}
| [
"[email protected]"
] | |
cf0be42352c8a4cc5526ed8a3d9d7f49319960b5 | 86810fbecd548d9480419c632a8ae6f0472cdaf4 | /app/src/main/java/com/atguigu/mobileplayer2/service/MusicPlayService.java | cd76c8a16c98d3527fba6c36b214e026cbd26e18 | [] | no_license | rx1996/MobilePlayer | 3515b975bc3684fa235f8b15a2d670b36c4e9535 | 9bacc78cb1d33b8c82475cc5d3bb5248e8c0f131 | refs/heads/master | 2021-01-21T12:43:27.078219 | 2017-06-01T07:32:16 | 2017-06-01T07:32:16 | 91,758,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,064 | java | package com.atguigu.mobileplayer2.service;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteException;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.Toast;
import com.atguigu.mobileplayer2.IMusicPlayService;
import com.atguigu.mobileplayer2.R;
import com.atguigu.mobileplayer2.activity.AudioPlayerActivity;
import com.atguigu.mobileplayer2.domain.MediaItem;
import org.greenrobot.eventbus.EventBus;
import java.io.IOException;
import java.util.ArrayList;
/**
* Created by Administrator on 2017/5/24.
*/
public class MusicPlayService extends Service {
private IMusicPlayService.Stub stub = new IMusicPlayService.Stub() {
MusicPlayService service = MusicPlayService.this;
@Override
public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {
}
@Override
public void openAudio(int position) throws RemoteException {
service.openAudio(position);
}
@Override
public void start() throws RemoteException {
service.start();
}
@Override
public void pause() throws RemoteException {
service.pause();
}
@Override
public String getArtistName() throws RemoteException {
return service.getArtistName();
}
@Override
public String getAudioName() throws RemoteException {
return service.getAudioName();
}
@Override
public String getAudioPath() throws RemoteException {
return service.getAudioPath();
}
@Override
public int getDuration() throws RemoteException {
return service.getDuration();
}
@Override
public int getCurrentPosition() throws RemoteException {
return service.getCurrentPosition();
}
@Override
public void seekTo(int position) throws RemoteException {
service.seekTo(position);
}
@Override
public void next() throws RemoteException {
service.next();
}
@Override
public void pre() throws RemoteException {
service.pre();
}
@Override
public boolean isPlaying() throws RemoteException {
return mediaPlayer.isPlaying();
}
@Override
public int getPlaymode() throws RemoteException {
return service.getPlaymode();
}
@Override
public void setPlaymode(int playmode) throws RemoteException {
service.setPlaymode(playmode);
}
@Override
public int getAudioSessionId() throws RemoteException {
return mediaPlayer.getAudioSessionId();
}
};
private ArrayList<MediaItem> mediaItems;
private MediaPlayer mediaPlayer;
private int position;
private MediaItem mediaItem;
public static final String OPEN_COMPLETE = "com.atguigu.mobileplayer2.service.MUSICPLAYSERVICE";
//通知服务管理
private NotificationManager nm;
//顺序播放
public static final int REPEAT_NORMAL = 1;
//单曲播放
public static final int REPEAT_SINGLE = 2;
//列表循环播放
public static final int REPEAT_ALL = 3;
//播放模式
private int playmode = REPEAT_NORMAL;
private boolean isCompletion = false;
private SharedPreferences sp;
@Override
public void onCreate() {
super.onCreate();
sp = getSharedPreferences("atguigu",MODE_PRIVATE);
playmode = sp.getInt("playmode",getPlaymode());
//加载列表数据
getData();
}
/**
* 得到数据
*/
private void getData() {
new Thread() {
public void run() {
mediaItems = new ArrayList<MediaItem>();
ContentResolver resolver = getContentResolver();
Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
String[] objs = {
MediaStore.Audio.Media.DISPLAY_NAME,//视频在sdcard上的名称
MediaStore.Audio.Media.DURATION,//视频时长
MediaStore.Audio.Media.SIZE,//视频文件的大小
MediaStore.Audio.Media.DATA,//视频播放地址
MediaStore.Audio.Media.ARTIST//艺术家
};
Cursor cursor = resolver.query(uri, objs, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
long duration = cursor.getLong(cursor.getColumnIndex(MediaStore.Audio.Media.DURATION));
String name = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
long size = cursor.getLong(cursor.getColumnIndex(MediaStore.Audio.Media.SIZE));
String data = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA));
String artist = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST));
Log.e("TAG", "name==" + name + ",duration==" + duration + ",data===" + data + ",artist==" + artist);
if (duration > 10 * 1000) {
mediaItems.add(new MediaItem(name, duration, size, data, artist));
}
}
cursor.close();
}
}
}.start();
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return stub;
}
/**
* 根据位置播放一个音频
*
* @param position
*/
private void openAudio(int position) {
this.position = position;
if (mediaItems != null && mediaItems.size() > 0) {
if(position < mediaItems.size()) {
mediaItem = mediaItems.get(position);
if (mediaPlayer != null) {
mediaPlayer.reset();
//释放
mediaPlayer = null;
}
try {
mediaPlayer = new MediaPlayer();
//设置播放地址
mediaPlayer.setDataSource(mediaItem.getData());
//设置三个监听:准备完成,播放出错,播放完成
mediaPlayer.setOnPreparedListener(new MyOnpreparedListener());
mediaPlayer.setOnErrorListener(new MyOnErrorListener());
mediaPlayer.setOnCompletionListener(new MyOnCompletionListener());
//这个异步不写不播放音乐
mediaPlayer.prepareAsync();
if(playmode== MusicPlayService.REPEAT_SINGLE){
isCompletion = false;
}
} catch (IOException e) {
e.printStackTrace();
}
}
} else {
Toast.makeText(MusicPlayService.this, "视频还没有加载完成", Toast.LENGTH_SHORT).show();
}
}
class MyOnpreparedListener implements MediaPlayer.OnPreparedListener{
@Override
public void onPrepared(MediaPlayer mp) {
//发广播
//notifyChange(OPEN_COMPLETE);
start();
EventBus.getDefault().post(mediaItem);
}
}
private void notifyChange(String action) {
Intent intent = new Intent(action);
sendBroadcast(intent);
}
class MyOnErrorListener implements MediaPlayer.OnErrorListener{
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
next();
return true;
}
}
class MyOnCompletionListener implements MediaPlayer.OnCompletionListener{
@Override
public void onCompletion(MediaPlayer mp) {
isCompletion = true;
next();
}
}
/**
* 播放音频
*/
private void start() {
mediaPlayer.start();
nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Intent intent = new Intent(this, AudioPlayerActivity.class);
intent.putExtra("notification",true);//是否来自状态栏
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification notifation = new Notification.Builder(this)
.setSmallIcon(R.drawable.notification_music_playing)
.setContentTitle("321音乐")
.setContentText("正在播放:"+getAudioName())
.setContentIntent(pi)
.build();
nm.notify(1,notifation);
}
/**
* 暂停音频
*/
private void pause() {
mediaPlayer.pause();
nm.cancel(1);
}
/**
* 得到演唱者
*
* @return
*/
private String getArtistName() {
return mediaItem.getArtist();
}
/**
* 得到歌曲名
*
* @return
*/
private String getAudioName() {
return mediaItem.getName();
}
/**
* 得到歌曲路径
*
* @return
*/
private String getAudioPath() {
return mediaItem.getData();
}
/**
* 得到总时长
*
* @return
*/
private int getDuration() {
return mediaPlayer.getDuration();
}
/**
* 得到当前播放进度
*
* @return
*/
private int getCurrentPosition() {
return mediaPlayer.getCurrentPosition();
}
/**
* 音频拖动
*
* @param position
*/
private void seekTo(int position) {
mediaPlayer.seekTo(position);
}
/**
* 播放下一个
*/
private void next() {
//根据不同的播放模式设置不同的下标位置
setNextPosition();
//根据不同的下标位置打开对应的音频并播放
openNextPosition();
}
private void openNextPosition() {
int playmode = getPlaymode();
if(playmode == MusicPlayService.REPEAT_NORMAL) {
if(position < mediaItems.size()) {
openAudio(position);
}else {
position = mediaItems.size() - 1;
}
}else if(playmode == MusicPlayService.REPEAT_SINGLE) {
if(position < mediaItems.size()) {
openAudio(position);
}else {
position = mediaItems.size() - 1;
}
}else if(playmode == MusicPlayService.REPEAT_ALL) {
openAudio(position);
}
}
private void setNextPosition() {
int playmode = getPlaymode();
if(playmode == MusicPlayService.REPEAT_NORMAL) {
position++;
}else if(playmode == MusicPlayService.REPEAT_SINGLE) {
if(!isCompletion) {
position++;
}
}else if(playmode == MusicPlayService.REPEAT_ALL) {
position++;
if(position > mediaItems.size() - 1) {
position = 0;
}
}
}
/**
* 播放上一个
*/
private void pre() {
setPrePosition();
openPrePosition();
}
private void openPrePosition() {
int playmode = getPlaymode();
if (playmode == MusicPlayService.REPEAT_NORMAL) {
if(position >= 0){
openAudio(position);
}else{
position = 0;
}
} else if (playmode == MusicPlayService.REPEAT_SINGLE) {
if(position >=0 ){
openAudio(position);
}else{
position = 0;
}
} else if (playmode == MusicPlayService.REPEAT_ALL) {
openAudio(position);
}
}
private void setPrePosition() {
int playmode = getPlaymode();
if (playmode == MusicPlayService.REPEAT_NORMAL) {
position --;
} else if (playmode == MusicPlayService.REPEAT_SINGLE) {
if(!isCompletion){
position --;
}
} else if (playmode == MusicPlayService.REPEAT_ALL) {
position --;
if(position < 0){
position = mediaItems.size()-1;
}
}
}
//得到播放模式
public int getPlaymode(){
return playmode;
}
//设置播放模式
public void setPlaymode(int playmode){
this.playmode = playmode;
sp.edit().putInt("playmode",playmode).commit();
}
}
| [
"[email protected]"
] | |
822a24248575cb92bf2694a9b3feee4d691e401c | 00b7151e31bcdbff191a0fd1b16992e7cfad03b2 | /app/src/main/java/com/vnetoo/speex/echo/dsp/AndroidHardwareDsp.java | 31c9f0e63afa70232f3029c949015a1f427a8473 | [] | no_license | q384264619/speex_echo | 9fad9e78c9868bb4445cb29d9d59eea9af437246 | 84fc29d6115a445ff7f0ada49ea24b35abc22370 | refs/heads/master | 2022-09-07T22:02:13.222161 | 2020-06-02T07:32:43 | 2020-06-02T07:32:43 | 268,724,297 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,905 | java | package com.vnetoo.speex.echo.dsp;
import android.media.audiofx.AcousticEchoCanceler;
import android.media.audiofx.AutomaticGainControl;
import android.media.audiofx.NoiseSuppressor;
import android.util.Log;
import com.vnetoo.speex.echo.AudioGlobal;
public class AndroidHardwareDsp implements AudioDsp{
private static final String TAG = "AndroidHardwareDsp";
private int audioSession;
private AcousticEchoCanceler echoCanceler;//回声消除器
private NoiseSuppressor noiseSuppressor;//噪声抑制器
private AutomaticGainControl gainControl;//自动增益器
private static AndroidHardwareDsp hardDsp = null;
static class AndroidAudioFactory implements Factory{
@Override
public AudioDsp create(int audioSession, int sample, int channel) {
return new AndroidHardwareDsp(audioSession);
}
}
public static final AndroidHardwareDsp getInstance(){
synchronized (AndroidHardwareDsp.class){
if(hardDsp == null){
hardDsp = new AndroidHardwareDsp(AudioGlobal.audioSession);
}
}
return hardDsp;
}
public AndroidHardwareDsp(int audioSession) {
this.audioSession = audioSession;
}
@Override
public boolean isEnableVad() {
return false;
}
@Override
public void enableVad(boolean enable) {
}
@Override
public boolean isEnableDenoiseSuppression() {
return noiseSuppressor == null ? false:noiseSuppressor.getEnabled();
}
@Override
public void enableDenoiseSuppression(boolean enable) {
if(audioSession == -1)return;
if(noiseSuppressor==null){
noiseSuppressor = NoiseSuppressor.create(audioSession);
}
if(noiseSuppressor!=null){
int result= noiseSuppressor.setEnabled(enable);
if(result == NoiseSuppressor.SUCCESS){
Log.i(TAG,"噪声抑制操作结果 :"+result);
}
}
}
@Override
public boolean isEnableAudiomicGainControl() {
return gainControl == null ? false:gainControl.getEnabled();
}
@Override
public void enableAudiomicGainControl(boolean enable) {
if(audioSession == -1)return;
if(gainControl==null){
gainControl = AutomaticGainControl.create(audioSession);
}
if(gainControl!=null){
int result= gainControl.setEnabled(enable);
if(result == AutomaticGainControl.SUCCESS){
Log.i(TAG,"自动增益操作结果 :"+result);
}
}
}
@Override
public boolean isEnableEcho() {
return echoCanceler == null ? false:echoCanceler.getEnabled();
}
@Override
public void enableEcho(boolean enable) {
if(audioSession == -1)return;
if(echoCanceler==null){
echoCanceler = AcousticEchoCanceler.create(audioSession);
}
if(echoCanceler!=null){
int result= echoCanceler.setEnabled(enable);
if(result == AcousticEchoCanceler.SUCCESS){
Log.i(TAG,"回声消除操作结果 :"+result);
}
}
}
@Override
public int getDelayTimeInMs() {
return 0;
}
@Override
public void setDelayTimeInMs(int delaytimeMs) {
}
@Override
public int ProcessAudio(byte[] mic,int offset, int len) {
return 0;
}
@Override
public void ProcessReverseAudio(byte[] play,int offset, int len) {
}
@Override
public void destroy() {
if(echoCanceler!=null){
echoCanceler.release();
}
if(gainControl!= null){
gainControl.release();
}
if(noiseSuppressor!=null){
noiseSuppressor.release();
}
echoCanceler = null;
gainControl = null;
noiseSuppressor= null;
hardDsp = null;
}
}
| [
"[email protected]"
] | |
70384c552a3850edea53b345e6d1e5875536651d | e5912ef6d79aa5aa05563133d46b9a719c78c9dd | /Gomoku/src/inteligenca/AlfaBeta.java | 4d1c660417f50885bd66f3fe59c26edb60883a4f | [] | no_license | BlackPhoenixSlo/Gomoku | ca245d88f24a6af11f26027c57056dd6641d3895 | 3b5225548668f95c077b4ea8b2ca534c349fd545 | refs/heads/main | 2023-05-09T19:55:25.715701 | 2021-05-26T12:11:00 | 2021-05-26T12:11:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,076 | java | package inteligenca;
import java.util.List;
import logika.Igra;
import logika.Igralec;
import splosno.Koordinati;
public class AlfaBeta extends Inteligenca {
private static final int ZMAGA = 100; // vrednost zmage
private static final int PORAZ = -ZMAGA; // vrednost izgube
private static final int NEODLOC = 0; // vrednost neodločene igre
private int globina;
public AlfaBeta (int globina) {
super("alphabeta globina " + globina);
this.globina = globina;
}
public Koordinati izberiPotezo (Igra igra) {
return alphabetaPoteze(igra, this.globina, PORAZ, ZMAGA, igra.naPotezi()).poteza;
}
public static OcenjenaPoteza alphabetaPoteze(Igra igra, int globina, int alpha, int beta, Igralec jaz) {
int ocena;
if (igra.naPotezi() == jaz) {ocena = PORAZ;} else {ocena = ZMAGA;}
List<Koordinati> moznePoteze = igra.poteze();
Koordinati kandidat = moznePoteze.get(0); // Možno je, da se ne spremini vrednost kanditata. Zato ne more biti null.
for (Koordinati p: moznePoteze) {
Igra kopijaIgre = new Igra(igra);
kopijaIgre.odigraj (p);
int ocenap;
switch (kopijaIgre.stanje()) {
case ZMAGA_B: ocenap = (jaz == Igralec.B ? ZMAGA : PORAZ); break;
case ZMAGA_W: ocenap = (jaz == Igralec.W ? ZMAGA : PORAZ); break;
case NEODLOCENO: ocenap = NEODLOC; break;
default:
if (globina == 1) ocenap = OceniPozicijo.oceniPozicijo(kopijaIgre, jaz);
else ocenap = alphabetaPoteze (kopijaIgre, globina-1, alpha, beta, jaz).ocena;
}
if (igra.naPotezi() == jaz) { // Maksimiramo oceno
if (ocenap > ocena) { // mora biti > namesto >=
ocena = ocenap;
kandidat = p;
alpha = Math.max(alpha,ocena);
}
} else { // igra.naPotezi() != jaz, torej minimiziramo oceno
if (ocenap < ocena) { // mora biti < namesto <=
ocena = ocenap;
kandidat = p;
beta = Math.min(beta, ocena);
}
}
if (alpha >= beta) // Izstopimo iz "for loop", saj ostale poteze ne pomagajo
return new OcenjenaPoteza (kandidat, ocena);
}
return new OcenjenaPoteza (kandidat, ocena);
}
}
| [
"[email protected]"
] | |
6d096e02cb1cc4bf3e69bcc488e86cf2ed7fe0e9 | 0cadf674993a12766cfc02f6dd8f9b88f39a04ae | /app/src/test/java/pavel/bogrecov/example/ExampleUnitTest.java | 5c93065e96eb4f9263fca41376b5b982a5f8b611 | [] | no_license | pavelupward/MVP-RXjava2-Dagger2-CleanArchitecture | 38e364650fc285e1843b24a28bddc838f3d9bf73 | f5b99d3df15f98bf4f819009c2925673749fe0ac | refs/heads/master | 2021-09-06T22:42:07.041237 | 2018-02-12T19:19:49 | 2018-02-12T19:19:49 | 107,898,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package pavel.bogrecov.example;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"381PAVELm"
] | 381PAVELm |
01a9974c6380645e82f87567e4bd1fad9771222c | 2aafcd01b7d6f8b73c6841dde245f3fdd4060b5d | /code-bbo/code-bbo-usercenter/code-bbo-usercenter-provider/src/main/java/com/qooence/code/usercenter/entity/UserDetail.java | 3ef896df64623b2d5eeb81416bbad7c6f4533f6e | [] | no_license | Qooence/qooence-code | 1938eb053c62043acfce258f2cda67800d18ccb3 | 67a37a55b13afcfe8f195c0f81901bacde1bab7a | refs/heads/master | 2022-09-12T14:41:31.256790 | 2019-10-07T04:53:14 | 2019-10-07T04:53:14 | 199,962,781 | 0 | 0 | null | 2022-09-01T23:12:40 | 2019-08-01T02:37:29 | Java | UTF-8 | Java | false | false | 2,902 | java | package com.qooence.code.usercenter.entity;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
public class UserDetail implements UserDetails {
private static final long serialVersionUID = -2394542462441452723L;
private long id;
private String username;
private String password;
private Role role;
private Date lastPasswordResetDate;
public UserDetail(
long id,
String username,
Role role,
// Date lastPasswordResetDate,
String password) {
this.id = id;
this.username = username;
this.password = password;
this.role = role;
// this.lastPasswordResetDate = lastPasswordResetDate;
}
public UserDetail(String username, String password, Role role) {
this.username = username;
this.password = password;
this.role = role;
}
public UserDetail(long id, String username, String password) {
this.id = id;
this.username = username;
this.password = password;
}
//返回分配给用户的角色列表
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
List<GrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority(role.getName()));
return authorities;
}
public long getId() {
return id;
}
@Override
public String getPassword() {
return password;
}
@Override
public String getUsername() {
return username;
}
/**
* 账户是否未过期
*/
@Override
public boolean isAccountNonExpired() {
return true;
}
/**
* 账户是否未锁定
*/
@Override
public boolean isAccountNonLocked() {
return true;
}
/**
* 密码是否未过期
*/
@Override
public boolean isCredentialsNonExpired() {
return true;
}
/** 账户是否激活
*/
@Override
public boolean isEnabled() {
return true;
}
public Date getLastPasswordResetDate() {
return lastPasswordResetDate;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
public void setId(long id) {
this.id = id;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public void setLastPasswordResetDate(Date lastPasswordResetDate) {
this.lastPasswordResetDate = lastPasswordResetDate;
}
}
| [
"[email protected]"
] | |
3f3165b55c55069fdb0191aa9159732ddaadfed6 | 30c2f8483fb32da38f265a40cdea3b0ba743fb07 | /WechatParent/src/test/java/com/tuners/mobile/BasePages/Teacher/AddLinkPage.java | 6141ada449b645a006f213f2981393811a9a3623 | [] | no_license | ShaineGu-666/AutoTest | 1aba7edec2ffbe61ec86041a205acd8cbff9cc90 | 2ccf23ca7b088da44409f8de7406c0d3b198be01 | refs/heads/master | 2022-07-01T04:12:31.808292 | 2020-07-09T09:33:49 | 2020-07-09T09:33:49 | 242,301,075 | 0 | 0 | null | 2022-06-29T18:14:18 | 2020-02-22T07:43:09 | Roff | UTF-8 | Java | false | false | 1,976 | java | package com.tuners.mobile.BasePages.Teacher;
import com.tuners.mobile.util.Functions.FunctionUtil;
import com.tuners.mobile.util.PageObject;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.testng.Assert;
/**
* @Author Mason
* @Description
* @Date 2020/6/18 13:56
**/
public class AddLinkPage extends PageObject {
public AddLinkPage(AndroidDriver androidDriver) {
super(androidDriver);
}
@Override
public void verifyDisplayed() throws Exception {
waitForPageLoadComplete();
waitForElementVisible("//label[@for='title'][contains(text(),'链接名称')]",30);
waitForElementVisible(inputOfLinkName,30);
waitForElementVisible(textareaOfLinkAddress,30);
waitForElementVisible(btnOfComplete,30);
Assert.assertTrue(isElementExist(inputOfLinkName),"inputOfLinkName is not displayed");
Assert.assertTrue(isElementExist(textareaOfLinkAddress),"textareaOfLinkAddress is not displayed");
Assert.assertTrue(isElementExist(btnOfComplete),"btnOfComplete is not displayed");
}
//链接名称输入框
@FindBy(xpath="//input[@name='title']")
public WebElement inputOfLinkName;
//链接地址输入文本域
@FindBy(xpath="//textarea[@placeholder='链接地址']")
public WebElement textareaOfLinkAddress;
//完成按钮
@FindBy(xpath="//button[@class='base-btn'][contains(text(),'完成')]")
public WebElement btnOfComplete;
public void setLinkContent(String linkName,String linkAddress) throws Exception {
FunctionUtil functionUtil=new FunctionUtil(androidDriver);
inputOfLinkName.sendKeys(linkName);
textareaOfLinkAddress.sendKeys(linkAddress);
waitForElementClickable(btnOfComplete,30);
functionUtil.singleTabByCoordinate(200,200);
functionUtil.safeJavaScriptClick(btnOfComplete);
}
}
| [
"[email protected]"
] | |
e90ef27c4ab74f226743ce889fdb8f16fecf38ec | 77487662362182621ccad7b4a8095e553fa1e94e | /src/main/java/com/sisuz/cloud/admclinica/controller/IgvController.java | 0910ff8e7c80df3c8c21f2c72b09a9ee5106f9a2 | [] | no_license | aiturrizaga/SISUZ_WEB_BACKEND | 3e0438501f607ae05a60a3ae21646851d0367ca0 | 1befc82cf15ebed1142d8b14abcdd0f512926de0 | refs/heads/master | 2022-11-20T13:14:03.534255 | 2020-03-29T17:24:07 | 2020-03-29T17:24:07 | 251,089,481 | 0 | 0 | null | 2022-11-16T12:42:29 | 2020-03-29T17:21:48 | Java | UTF-8 | Java | false | false | 902 | java | package com.sisuz.cloud.admclinica.controller;
import com.sisuz.cloud.admclinica.entity.Igv;
import com.sisuz.cloud.admclinica.service.jpa.IgvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/igv")
public class IgvController {
@Autowired
private IgvService igvService;
@PostMapping("/new")
public Igv newIgv(@RequestBody Igv igv) {
return this.igvService.saveIgv(igv);
}
@PutMapping
public Igv updateIgv(@RequestBody Igv igv) {
return this.igvService.updateIgv(igv);
}
@GetMapping("/latest")
public Igv getIgvLatest() {
return this.igvService.getIgvLatest();
}
@GetMapping("/history")
public List<Igv> getIgvHistory() {
return this.igvService.getIgvHistory();
}
}
| [
"[email protected]"
] | |
438c12e073961a22ad78501b5815ebc66649bffc | 4eca12201d2628c2d0e5ccc007cb212531f4ba0d | /src/main/java/com/aaluni/spring5recipeapp/converters/NotesCommandToNotes.java | 98ebaaed7fb0de3d82bd2075042bb1a8d7d6cd77 | [] | no_license | arindamaluni/spring5-recipe-app-aaluni | f6785013a47d6b026abfeb86d263e3eed601a011 | 204851a5b14ff8ca2258cd4002a6a0e83f1133b0 | refs/heads/master | 2022-06-02T18:24:42.259248 | 2020-05-08T17:57:52 | 2020-05-08T17:57:52 | 256,959,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 786 | java | package com.aaluni.spring5recipeapp.converters;
import lombok.Synchronized;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import com.aaluni.spring5recipeapp.commands.NotesCommand;
import com.aaluni.spring5recipeapp.domain.Notes;
/**
* Created by jt on 6/21/17.
*/
@Component
public class NotesCommandToNotes implements Converter<NotesCommand, Notes> {
@Synchronized
@Nullable
@Override
public Notes convert(NotesCommand source) {
if(source == null) {
return null;
}
final Notes notes = new Notes();
notes.setId(source.getId());
notes.setRecipeNotes(source.getRecipeNotes());
return notes;
}
}
| [
"[email protected]"
] | |
d56356c7449220c397d267e57a76bb1f18b52d19 | 3697b3d8c598a75da5f5b64852d470de9d28aec3 | /akl-service/src/main/java/fi/tite/akl/config/WebConfigurer.java | a32414e3ac0d19b0b4ff429591a1828200f13377 | [] | no_license | Akzuu/akl-1 | 831e68acfde6da0fd14cb4fa506803a77159a11e | 172921606ddbdbc87852d670bd313a93d2ce1f25 | refs/heads/master | 2020-06-03T02:47:31.500070 | 2019-09-20T06:21:44 | 2019-09-20T06:21:44 | 191,400,388 | 0 | 0 | null | 2019-06-11T15:29:36 | 2019-06-11T15:29:35 | null | UTF-8 | Java | false | false | 3,437 | java | package fi.tite.akl.config;
import com.codahale.metrics.MetricRegistry;
import fi.tite.akl.web.filter.gzip.GZipServletFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.MimeMappings;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import javax.inject.Inject;
import javax.servlet.*;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
* Configuration of web application with Servlet 3.0 APIs.
*/
@Slf4j
@Configuration
@AutoConfigureAfter(CacheConfiguration.class)
public class WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer {
@Inject
private Environment env;
@Autowired(required = false)
private MetricRegistry metricRegistry;
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
log.info("Web application configuration, using profiles: {}", Arrays.toString(env.getActiveProfiles()));
EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC);
if (env.acceptsProfiles(Constants.SPRING_PROFILE_PRODUCTION)) {
initGzipFilter(servletContext, disps);
}
if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT)) {
initH2Console(servletContext);
}
log.info("Web application fully configured");
}
/**
* Set up Mime types.
*/
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
mappings.add("html", "text/html;charset=utf-8");
// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
mappings.add("json", "text/html;charset=utf-8");
container.setMimeMappings(mappings);
}
/**
* Initializes the GZip filter.
*/
private void initGzipFilter(ServletContext servletContext, EnumSet<DispatcherType> disps) {
log.debug("Registering GZip Filter");
FilterRegistration.Dynamic compressingFilter = servletContext.addFilter("gzipFilter", new GZipServletFilter());
Map<String, String> parameters = new HashMap<>();
compressingFilter.setInitParameters(parameters);
compressingFilter.addMappingForUrlPatterns(disps, true, "/api/*");
compressingFilter.setAsyncSupported(true);
}
/**
* Initializes H2 console
*/
private void initH2Console(ServletContext servletContext) {
log.debug("Initialize H2 console");
ServletRegistration.Dynamic h2ConsoleServlet = servletContext.addServlet("H2Console", new org.h2.server.web.WebServlet());
h2ConsoleServlet.addMapping("/console/*");
h2ConsoleServlet.setInitParameter("-properties", "src/main/resources");
h2ConsoleServlet.setLoadOnStartup(1);
}
}
| [
"[email protected]"
] | |
cb2d6532d68309f4b1e22b38839b8bc7b827225b | 36e845ee34d6026627c2da9b0f28d3568f33b161 | /mysnippet-io-server/src/main/java/io/mysnippet/server/service/AppUserService.java | 4b18c8800e0b84ff4f04e2e36183a734549cd98c | [] | no_license | wyt/mysnippet-io | 78e918286bfc6d04835f261c20c3bc2cbce4cacb | 03904084a62288db333264c4d2fbce203478ad05 | refs/heads/master | 2022-07-05T18:47:07.544448 | 2020-08-21T03:38:28 | 2020-08-21T03:38:28 | 200,636,578 | 2 | 0 | null | 2022-06-17T02:34:13 | 2019-08-05T10:46:36 | Java | UTF-8 | Java | false | false | 156 | java | package io.mysnippet.server.service;
import io.mysnippet.server.domain.AppUser;
public interface AppUserService {
AppUser getAppUserInfo(long id);
}
| [
"[email protected]"
] | |
dfc703585526140adce4ab8298675b62c565a73b | edb75c78456cf0ad0a1f7dd41e25f6c380c6b5d9 | /app/src/main/java/com/example/admin/mypplication/BaseVo.java | 874501caefb1c17a1a7d7ecf407685723f2fa98b | [] | no_license | zq12138/Mypplication | 5bc09df953494453c6c3e0fdb7e6311fb08f32aa | 91ff304242385a0387c5defda5523208e65664fd | refs/heads/master | 2021-01-23T18:51:57.094993 | 2017-02-24T05:19:57 | 2017-02-24T05:19:57 | 82,997,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | package com.example.admin.mypplication;
import java.io.Serializable;
/**
* Created by zq on 2017/1/16.
*/
public class BaseVo implements Serializable {
private String reason;
private ResultVo result;
private String error_code;
public ResultVo getResult() {
return result;
}
public void setResult(ResultVo result) {
this.result = result;
}
@Override
public String toString() {
return "BaseVo{" +
"reason='" + reason + '\'' +
", error_code='" + error_code + '\'' +
'}';
}
public String getError_code() {
return error_code;
}
public void setError_code(String error_code) {
this.error_code = error_code;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}
| [
"[email protected]"
] | |
bfac7772a5bbe17463556b3de8e56c10a1c7dd9d | 791a003d2a9a6568c4304f302256d1118a23330c | /src/main/java/br/com/dccom/tissV3/SignedInfoType.java | 05d97b40a01907b12e5ed7306700987bc7e8c9b8 | [] | no_license | ferreiramarcelo/tissV3 | 8b82f292319a7cd13644d0fff26dd32aded93322 | 40897e1b8090bc56f6d625867ceea4a20f139867 | refs/heads/master | 2021-01-09T05:56:57.802459 | 2014-10-21T01:31:56 | 2014-10-21T01:31:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,841 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.10.20 at 06:45:18 PM BRST
//
package br.com.dccom.tissV3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for SignedInfoType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SignedInfoType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethod"/>
* <element ref="{http://www.w3.org/2000/09/xmldsig#}SignatureMethod"/>
* <element ref="{http://www.w3.org/2000/09/xmldsig#}Reference" maxOccurs="unbounded"/>
* </sequence>
* <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SignedInfoType", namespace = "http://www.w3.org/2000/09/xmldsig#", propOrder = {
"canonicalizationMethod",
"signatureMethod",
"reference"
})
public class SignedInfoType {
@XmlElement(name = "CanonicalizationMethod", required = true)
protected CanonicalizationMethodType canonicalizationMethod;
@XmlElement(name = "SignatureMethod", required = true)
protected SignatureMethodType signatureMethod;
@XmlElement(name = "Reference", required = true)
protected List<ReferenceType> reference;
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
/**
* Gets the value of the canonicalizationMethod property.
*
* @return
* possible object is
* {@link CanonicalizationMethodType }
*
*/
public CanonicalizationMethodType getCanonicalizationMethod() {
return canonicalizationMethod;
}
/**
* Sets the value of the canonicalizationMethod property.
*
* @param value
* allowed object is
* {@link CanonicalizationMethodType }
*
*/
public void setCanonicalizationMethod(CanonicalizationMethodType value) {
this.canonicalizationMethod = value;
}
/**
* Gets the value of the signatureMethod property.
*
* @return
* possible object is
* {@link SignatureMethodType }
*
*/
public SignatureMethodType getSignatureMethod() {
return signatureMethod;
}
/**
* Sets the value of the signatureMethod property.
*
* @param value
* allowed object is
* {@link SignatureMethodType }
*
*/
public void setSignatureMethod(SignatureMethodType value) {
this.signatureMethod = value;
}
/**
* Gets the value of the reference property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the reference property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getReference().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/
public List<ReferenceType> getReference() {
if (reference == null) {
reference = new ArrayList<ReferenceType>();
}
return this.reference;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}
| [
"[email protected]"
] | |
2cdc5521f4bc1fccecdd303b350e9d223c64b569 | 1fc89c80068348031fdd012453d081bac68c85b0 | /Descompilando o apk do revival 2/src/revivaljarfiilecomum/Download_For_Motorola_128x160.jar.src/glomoRegForms/Resources.java | 1f1808fcc494b12fd6242c779d1df4785a5c76e0 | [] | no_license | Jose-R-Vieira/WorkspaceEstudosJava | e81858e295972928d3463f23390d5d5ee67966c9 | 7ba374eef760ba2c3ee3e8a69657a96f9adec5c1 | refs/heads/master | 2020-03-26T16:47:26.846023 | 2018-08-17T14:06:57 | 2018-08-17T14:06:57 | 145,123,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,528 | java | package glomoRegForms;
import GlomoReg.GlomoUtil;
import java.io.DataInputStream;
import java.io.EOFException;
import java.util.Hashtable;
public final class Resources
{
private static Hashtable a = new Hashtable();
public static String WND_TITLE_START_ALERT;
public static String WND_TITLE_ACTIVATE;
public static String WND_TITLE_ACTIVATE_RU;
public static String WND_TITLE_ACTIVATE_EN;
public static String WND_TITLE_COUNTRY_LIST;
public static String WND_TITLE_COUNTRY_LIST_RU;
public static String WND_TITLE_COUNTRY_LIST_EN;
public static String WND_TITLE_SERIAL_NUMBER;
public static String WND_TITLE_ERROR_ALERT;
public static String WND_TITLE_ERROR_ALERT_RU;
public static String WND_TITLE_ERROR_ALERT_EN;
public static String BTN_EXIT;
public static String BTN_EXIT_RU;
public static String BTN_EXIT_EN;
public static String BTN_BACK;
public static String BTN_SELECT;
public static String BTN_SELECT_RU;
public static String BTN_SELECT_EN;
public static String BTN_YES;
public static String BTN_YES_RU;
public static String BTN_YES_EN;
public static String BTN_NO;
public static String BTN_NO_RU;
public static String BTN_NO_EN;
public static String BTN_OK;
public static String BTN_CANCEL;
public static String MENU_ACTIVATE_GAME;
public static String MENU_SERIAL_NUMBER;
public static String MENU_CHANGE_COUNTRY;
public static String MENU_SEND_TO_FRIEND;
public static String MENU_MORE_GAMES;
public static String MENU_INTERFACE_LANGUAGE;
public static String MENU_LANGUAGE_EN = "English";
public static String MENU_LANGUAGE_RU = "Русский";
public static String MENU_HELP;
public static final int WND_ID_NO_FORM = 0;
public static final int WND_ID_MAIN_APP = 1;
public static final int WND_ID_START_ALERT = 2;
public static final int WND_ID_COUNTRY_LIST = 3;
public static final int WND_ID_ACTIVATE_FORM = 4;
public static final int WND_ID_REGISTER_OK_ALERT = 5;
public static final int WND_ID_REGISTER_FAILED_ALERT = 6;
public static final int WND_ID_SERIAL_NUMBER = 8;
public static final int WND_ID_SERIAL_NUMBER_RIGHT_ALERT = 9;
public static final int WND_ID_SERIAL_NUMBER_WRONG_ALERT = 10;
public static final int WND_ID_INTERFACE_LANGUAGE = 11;
public static final int WND_ID_ACTIVATION_TEXT_ALERT = 12;
public static final int WND_ID_SEND_TO_FRIEND_ALERT = 13;
public static final int WND_ID_SEND_TO_FRIEND = 14;
public static final int WND_ID_SENT_TO_FRIEND_OK_ALERT = 15;
public static final int WND_ID_SENT_TO_FRIEND_FAILED_ALERT = 16;
public static final int WND_ID_ERROR_ALERT = 17;
public static final int WND_ID_HELP = 18;
public static final int WND_ID_ACTIVATE_IN_PROGRESS_ALERT = 19;
public static final int WND_ID_ACTIVATE_IN_PROGRESS_PRE_ALERT = 101;
public static final int ID_QUIT_APP = 100;
public static String TEXT_START_ALERT_RU;
public static String TEXT_START_ALERT_EN;
public static String TEXT_REGISTERED_OK;
public static String TEXT_REGISTERED_FAILED;
public static String TEXT_SENT_TO_FRIEND_OK;
public static String TEXT_SENT_TO_FRIEND_FAILED;
public static String TEXT_SERIAL_NUMBER_RIGHT;
public static String TEXT_SERIAL_NUMBER_WRONG;
public static String TEXT_ACTIVATE_FORM;
public static String TEXT_SEND_TO_FRIEND;
public static String TEXT_ALERT_GLOMO_ERROR_CODE_0;
public static String TEXT_ALERT_GLOMO_ERROR_CODE_0_RU;
public static String TEXT_ALERT_GLOMO_ERROR_CODE_0_EN;
public static String TEXT_HELP;
public static String TEXT_ACTIVATE_IN_PROGRESS_ALERT;
public static String currentLanguage = "";
public static final int DEMO_MODE_DURATION_MINUTES = 4;
public static final String shortCountryNames = ",ru_a,ru,az,am,by,ge,kz,kg,md,tj,tm,uz,ua,";
private static String a(Object paramObject)
{
return (String)a.get(paramObject);
}
public static void loadInterfaceLanguage(String paramString)
{
currentLanguage = paramString;
Object localObject = "/glomoRes/en.lang";
if (paramString.compareTo(MENU_LANGUAGE_EN) == 0) {
localObject = "/glomoRes/en.lang";
} else if (paramString.compareTo(MENU_LANGUAGE_RU) == 0) {
localObject = "/glomoRes/ru.lang";
}
paramString = (String)localObject;
a.clear();
paramString = new DataInputStream(new Resources().getClass().getResourceAsStream(paramString));
try
{
for (;;)
{
if ((localObject = paramString.readUTF()).compareTo("") != 0)
{
localObject = GlomoUtil.split("\t", (String)localObject);
a.put(localObject[0], localObject[1]);
}
}
try
{
paramString.close();
}
catch (Exception localException2)
{
(localObject = localException2).printStackTrace();
}
}
catch (EOFException localEOFException) {}catch (Exception localException1)
{
(localObject = localException1).printStackTrace();
}
WND_TITLE_START_ALERT = a("WND_TITLE_START_ALERT");
WND_TITLE_ACTIVATE = a("WND_TITLE_ACTIVATE");
WND_TITLE_ACTIVATE_RU = a("WND_TITLE_ACTIVATE_RU");
WND_TITLE_ACTIVATE_EN = a("WND_TITLE_ACTIVATE_EN");
WND_TITLE_COUNTRY_LIST = a("WND_TITLE_COUNTRY_LIST");
WND_TITLE_COUNTRY_LIST_RU = a("WND_TITLE_COUNTRY_LIST_RU");
WND_TITLE_COUNTRY_LIST_EN = a("WND_TITLE_COUNTRY_LIST_EN");
WND_TITLE_SERIAL_NUMBER = a("WND_TITLE_SERIAL_NUMBER");
WND_TITLE_ERROR_ALERT = a("WND_TITLE_ERROR_ALERT");
WND_TITLE_ERROR_ALERT_RU = a("WND_TITLE_ERROR_ALERT_RU");
WND_TITLE_ERROR_ALERT_EN = a("WND_TITLE_ERROR_ALERT_EN");
BTN_EXIT = a("BTN_EXIT");
BTN_EXIT_RU = a("BTN_EXIT_RU");
BTN_EXIT_EN = a("BTN_EXIT_EN");
BTN_BACK = a("BTN_BACK");
BTN_SELECT = a("BTN_SELECT");
BTN_SELECT_RU = a("BTN_SELECT_RU");
BTN_SELECT_EN = a("BTN_SELECT_EN");
BTN_YES = a("BTN_YES");
BTN_YES_RU = a("BTN_YES_RU");
BTN_YES_EN = a("BTN_YES_EN");
BTN_NO = a("BTN_NO");
BTN_NO_RU = a("BTN_NO_RU");
BTN_NO_EN = a("BTN_NO_EN");
BTN_OK = a("BTN_OK");
BTN_CANCEL = a("BTN_CANCEL");
MENU_ACTIVATE_GAME = a("MENU_ACTIVATE_GAME");
MENU_SERIAL_NUMBER = a("MENU_SERIAL_NUMBER");
MENU_CHANGE_COUNTRY = a("MENU_CHANGE_COUNTRY");
MENU_SEND_TO_FRIEND = a("MENU_SEND_TO_FRIEND");
MENU_MORE_GAMES = a("MENU_MORE_GAMES");
MENU_INTERFACE_LANGUAGE = a("MENU_INTERFACE_LANGUAGE");
MENU_HELP = a("MENU_HELP");
TEXT_START_ALERT_RU = a("TEXT_START_ALERT_RU");
TEXT_START_ALERT_EN = a("TEXT_START_ALERT_EN");
TEXT_REGISTERED_OK = a("TEXT_REGISTERED_OK");
TEXT_REGISTERED_FAILED = a("TEXT_REGISTERED_FAILED");
TEXT_SENT_TO_FRIEND_OK = a("TEXT_SENT_TO_FRIEND_OK");
TEXT_SENT_TO_FRIEND_FAILED = a("TEXT_SENT_TO_FRIEND_FAILED");
TEXT_SERIAL_NUMBER_RIGHT = a("TEXT_SERIAL_NUMBER_RIGHT");
TEXT_SERIAL_NUMBER_WRONG = a("TEXT_SERIAL_NUMBER_WRONG");
TEXT_ACTIVATE_FORM = a("TEXT_ACTIVATE_FORM");
TEXT_SEND_TO_FRIEND = a("TEXT_SEND_TO_FRIEND");
TEXT_ALERT_GLOMO_ERROR_CODE_0 = a("TEXT_ALERT_GLOMO_ERROR_CODE_0");
TEXT_ALERT_GLOMO_ERROR_CODE_0_RU = a("TEXT_ALERT_GLOMO_ERROR_CODE_0_RU");
TEXT_ALERT_GLOMO_ERROR_CODE_0_EN = a("TEXT_ALERT_GLOMO_ERROR_CODE_0_EN");
TEXT_HELP = a("TEXT_HELP");
TEXT_ACTIVATE_IN_PROGRESS_ALERT = a("TEXT_ACTIVATE_IN_PROGRESS_ALERT");
}
}
/* Location: C:\WPrograming\jd-gui-windows-1.4.0\Download_For_Motorola_128x160.jar!\glomoRegForms\Resources.class
* Java compiler version: 3 (47.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
b051a09d3e1f92db83c31eea4618e1be17643702 | 19547797399ffc94f4749e89414557f731ce230b | /src/main/java/lk/recruitment/management/asset/commonAsset/model/Enum/BloodGroup.java | 96807831905491ae401209aeae82192b5b11ae6d | [] | no_license | PrasadAASL/management | 64e80b2960005dee1793f826f71fef0f35d243e8 | 1bd032a93b933d55d09947242bc86d47a19fbe77 | refs/heads/master | 2022-08-25T19:42:16.477879 | 2020-05-25T11:45:25 | 2020-05-25T11:45:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package lk.recruitment.management.asset.commonAsset.model.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum BloodGroup {
AP("A RhD positive"),
AN("A RhD negative"),
BP("B RhD positive"),
BN("B RhD negative"),
OP("O RhD positive"),
ON("O RhD negative"),
ABP("AB RhD positive"),
ABN("AB RhD negative");
private final String bloodGroup;
}
| [
"[email protected]"
] | |
f3f71d9460e66675def1b62520b0640aad7db9f3 | f2d594a1f3f8c5146f7356e4e1b553f5103db08f | /twgitter-gui/src/twgitter/croudia/Streaming.java | 18f9c8f2b45433139ad293181431732b95235157 | [] | no_license | S--Minecraft/twgitter | dd5050197803526a02ddcf2374e2563a4d7aec71 | 38cecffd5d92ff685667317b01fb16be9921cf71 | refs/heads/master | 2021-01-22T07:32:49.128139 | 2015-05-22T13:16:16 | 2015-05-22T13:16:16 | 23,569,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,349 | java | package twgitter.croudia;
import java.lang.reflect.Type;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import twgitter.TestThread;
import twgitter.croudia.json.CroudiaStream;
import twgitter.croudia.json.User;
import twgitter.get.GetHTTP;
import twgitter.gui.Test;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
public class Streaming {
//curl -k -H "Host: api.croudia.com" -H "Authorization: Bearer 58546eb740bf61f818e1e8fe1b136f45710d6a06ede4cfbf7426da89072b2d42" https://api.croudia.com/statuses/home_timeline.json
public static Date streaming(Date lastDate) throws Exception {
String URI = "https://api.croudia.com/statuses/home_timeline.json";
String[][] Header = { {"Host", "api.croudia.com"}, {"Authorization", "Bearer " + TestThread.allTokens.getCroudiaAccess_token()} };
String CharCode = "UTF-8";
Gson gson = new Gson();
List<String> json = new ArrayList<>();
Date nowGet = new Date();
json = GetHTTP.AccessHTTPString(URI,Header,CharCode);
String jsonString = json.get(0);
//System.out.println("C :" + jsonString);
Type collectionType = new TypeToken<Collection<CroudiaStream>>(){}.getType();
List<CroudiaStream> stream = gson.fromJson(jsonString.toString(),collectionType);
for(int i=stream.size()-1;i>=0;i--)
{
nowGet = stream.get(i).getCreated_atDate();
if(nowGet.after(lastDate))
{
//System.out.println(lastDate);
//System.out.println(nowGet);
User user = stream.get(i).getUser();
if(stream.get(i).getText() != null)
{
System.out.println("[Croudia][" + user.getName() + "(@" + user.getScreen_name() + ")]" + stream.get(i).getText());
Test.println("[Croudia][" + user.getName() + "(@" + user.getScreen_name() + ")]" + stream.get(i).getText());
}
}
}
Date lastGet = new Date();
lastGet = stream.get(0).getCreated_atDate();
return lastGet;
}
public static Date croudiaDateStringToDate(String dateString) throws ParseException
{
Date dateDate = new Date();
SimpleDateFormat croudiaDate = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z",Locale.ENGLISH);
croudiaDate.setLenient(false);
dateDate = croudiaDate.parse(dateString);
return dateDate;
}
}
| [
"[email protected]"
] | |
b428a6bc0642f5cf203aa473475ea5a42ddac5b7 | 4f62149c1f754761ef291ddeb382935af8519662 | /app/src/androidTest/java/com/dji/importsdkdemo/ExampleInstrumentedTest.java | 2c13ea6da5db0581ae581dd148be0d956dca95d2 | [] | no_license | shohei/phantom3-control | a8380defc23d55e11fd6c0cbe139c892122e3141 | 53e70515fb1799c4d76caabf9c6c373fe17e8fa8 | refs/heads/main | 2023-07-02T19:25:18.950562 | 2021-08-09T07:51:12 | 2021-08-09T07:51:12 | 393,903,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.dji.importsdkdemo;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.dji.importsdkdemo", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
6cbe325b4fad46231064f749b9c95daeb05f7486 | a5847e042ec33acaef8366eba1d54c0a1177a214 | /SeleniumProject01/src/com/ebfs/util/SummaryReport.java | 82a6a07fcf453ef0c821125bd75cb407dfc4ae56 | [] | no_license | TanvirRabbani/selenium01 | 18460ff9dfe217b0f864723f5c45c7044c5488ac | 4cbbfd30640c07ad2742fdf7368380fec976fdd9 | refs/heads/master | 2022-09-20T14:43:30.020712 | 2022-08-31T02:26:35 | 2022-08-31T02:26:35 | 46,285,366 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 12,071 | java | package com.ebfs.util;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.lang.reflect.Field;
import javax.imageio.ImageIO;
import jxl.Workbook;
import jxl.format.*;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableHyperlink;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.WritableImage;
import jxl.write.biff.RowsExceededException;
/**
* Logging class that makes use of the Jexcel API to write test logs to
* Excel files
*
* @author Tanvir Rabbani
* @version 1.0
* 2007-10-10 - Added javadoc commenting for methods and removed main method. This
* object must be instantiated now. Don't use static unless you have to!
*/
public class SummaryReport {
private static int num = 1;
private static int step = 1;
private static final String directory = "C:\\";
private static final String relResulXLtDir="./SummaryReport/";
private static final String relSnapShotDir="./Snapshot/";
private static WritableWorkbook workLog;
private static WritableSheet workSheet;
private static WritableFont font;
private static WritableCellFormat fontColor;
private static File fileXLS; //log file
private static int failCounter;
/**
* Default constructor
*/
public SummaryReport() {
this("TestLog");
}
/**
* Constructor that allows the log file name to be specified.
*
* @param name Name of the log file
*/
public SummaryReport(String name){
this(name, directory);
}
/**
* Constructor to specify the name of the log file and its path
*
* @param name Name of the log file
* @param path Path for the log file
*/
public SummaryReport(String name, String path) {
// Used to created the xls log file
SimpleDateFormat date = new SimpleDateFormat("EEE, MMM d ''yy hh_mm_ss a");
String formatedDate = date.format(new Date());
fileXLS = new File(path + name +" - " + formatedDate + ".xls");
try {
fileXLS.createNewFile();
WritableWorkbook workbook = Workbook.createWorkbook(fileXLS);
WritableSheet sheet = workbook.createSheet("Log", 0);
workLog = workbook;
workSheet = sheet;
} catch (IOException e) {
e.printStackTrace();
}
/*
*The following is used to format the excel file the first thing that needs to be created is
*a writable font here you can change the font and the size, the font is from a supplied list
*once the font is created you can change the color again this is from a supplied list
*after the font is given a color you convert that into a cell format which you can then
*change the aligment.
*/
font = new WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD);
try {
font.setColour(Colour.WHITE);
fontColor = new WritableCellFormat(font);
fontColor.setAlignment(Alignment.CENTRE);
fontColor.setBackground(Colour.GRAY_25);
} catch (WriteException e) {
e.printStackTrace();
}
/*
*This is used to format the row height and the column width
*the first argument is the row number the second is the row height which is really
*the height that you want multiplied by 20
*for the column the first argument is the column number the second is the height which is 1 to 1
*/
try {
workSheet.setRowView(0, 300);
} catch (RowsExceededException e) {
e.printStackTrace();
}
workSheet.setColumnView(0, 7);
workSheet.setColumnView(1, 60);
workSheet.setColumnView(2, 45);
workSheet.setColumnView(3, 10);
//inputs the information into the cell first variable is the column, second is row, third is text
Label label = new Label(0, 0, "Line #",fontColor);
try {
workSheet.addCell(label);
label = new Label(1, 0, "Description",fontColor);
workSheet.addCell(label);
label = new Label(2, 0, "Test Data",fontColor);
workSheet.addCell(label);
label = new Label(3, 0, "Pass\\Fail",fontColor);
workSheet.addCell(label);
} catch (RowsExceededException e) {
e.printStackTrace();
} catch (WriteException e) {
e.printStackTrace();
}
}
public static void createResultXL(String name) {
// Used to created the xls log file
failCounter = 0;
SimpleDateFormat date = new SimpleDateFormat("EEE, MMM d ''yy hh_mm_ss a");
String formatedDate = date.format(new Date());
fileXLS = new File(relResulXLtDir + name +" - " + formatedDate + ".xls");
try {
fileXLS.createNewFile();
WritableWorkbook workbook = Workbook.createWorkbook(fileXLS);
WritableSheet sheet = workbook.createSheet("Summary", 0);
workLog = workbook;
workSheet = sheet;
} catch (IOException e) {
e.printStackTrace();
}
/*
*The following is used to format the excel file the first thing that needs to be created is
*a writable font here you can change the font and the size, the font is from a supplied list
*once the font is created you can change the color again this is from a supplied list
*after the font is given a color you convert that into a cell format which you can then
*change the aligment.
*/
font = new WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD);
try {
font.setColour(Colour.WHITE);
fontColor = new WritableCellFormat(font);
fontColor.setAlignment(Alignment.CENTRE);
fontColor.setBackground(Colour.GRAY_25);
} catch (WriteException e) {
e.printStackTrace();
}
/*
*This is used to format the row height and the column width
*the first argument is the row number the second is the row height which is really
*the height that you want multiplied by 20
*for the column the first argument is the column number the second is the height which is 1 to 1
*/
try {
workSheet.setRowView(0, 300);
} catch (RowsExceededException e) {
e.printStackTrace();
}
workSheet.setColumnView(0, 7);
workSheet.setColumnView(1, 60);
workSheet.setColumnView(2, 45);
workSheet.setColumnView(3, 10);
//inputs the information into the cell first variable is the column, second is row, third is text
try {
Label label = new Label(0, 0, "Line #",fontColor);
workSheet.addCell(label);
label = new Label(1, 0, "Test Case Name",fontColor);
workSheet.addCell(label);
label = new Label(2, 0, "Pass\\Fail",fontColor);
workSheet.addCell(label);
label = new Label(3, 0, "Detail Result File",fontColor);
workSheet.addCell(label);
} catch (RowsExceededException e) {
e.printStackTrace();
} catch (WriteException e) {
e.printStackTrace();
}
}
/**
* Method for writing to the log file, including a step name and a pass or fail for the step
*
* @param description Log item description
* @param stepName The test step name
* @param Passed Passing or failing for this test step
* @throws IOException
* @throws RowsExceededException
* @throws WriteException
*/
public static void write(String testCaseName,Boolean Passed, String resultLink)
{
WritableFont font = new WritableFont(WritableFont.ARIAL,10, WritableFont.BOLD);
WritableCellFormat defaultCell = new WritableCellFormat(font);
try{
font.setColour(Colour.BLACK);
WritableCellFormat fontColor = new WritableCellFormat(font);
//Sets values for a cell for pass or fail values
String PF;
if(Passed)
{
PF = "Pass";
//sets color for pass/fail cell
font.setColour(Colour.GREEN);
fontColor = new WritableCellFormat(font);
}else
{ failCounter++;
PF = "Fail";
//sets color for pass/fail cell
font.setColour(Colour.RED);
fontColor = new WritableCellFormat(font);
}
//writes to the workbook
Number number = new Number(0, num, step);
workSheet.addCell(number);
Label label = new Label(1, num, testCaseName, defaultCell);
workSheet.addCell(label);
//fontColor added to create different colors for pass and fail
label = new Label(2, num, PF, fontColor);
workSheet.addCell(label);
label = new Label(3, num, resultLink, defaultCell);
workSheet.addCell(label);
//keeps track of rows
num++;
step++;
//sworkLog.write();
}catch(Exception e)
{
e.printStackTrace();
}
//write image to the log file
// if(PF.equals("Fail"))
// {
// takeSnapshot("C:\\resources", "snapshot");
// }
}
public void write(String text) throws IOException, RowsExceededException, WriteException
{
write(text, "INDIGO", "WHITE", false);
}
/**
* Method for writing text to the log file
*
* @param text The value being written to the log file
* @throws IOException
* @throws RowsExceededException
* @throws WriteException
*/
public void write(String text, String textFontColor, String bgColor, boolean bold) throws IOException, RowsExceededException, WriteException
{
WritableFont font;
if(bold)
{
font = new WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD);
}
else
{
font = new WritableFont(WritableFont.ARIAL,10);
}
WritableCellFormat cellFormat = new WritableCellFormat(font);
cellFormat.setAlignment(Alignment.LEFT);
Class<?> c1;
Field fontColorField;
Field bgColorField;
try{
c1 = Class.forName("jxl.format.Colour");
fontColorField = c1.getDeclaredField(textFontColor);
bgColorField = c1.getDeclaredField(bgColor);
font.setColour((Colour)fontColorField.get(font));
cellFormat.setBackground((Colour)bgColorField.get(cellFormat));
}
catch (Exception e) {
e.printStackTrace();
}
//font.setColour(Colour.INDIGO);
//fontColor added to create different colors for pass and fail
Number number = new Number(0, num, step);
workSheet.addCell(number);
Label label = new Label(1, num, text, cellFormat);
workSheet.addCell(label);
workSheet.mergeCells(1, num, 2, num);
// font must be reset to change one variable
// I havent been able to find a work around yet
font = new WritableFont(WritableFont.ARIAL,10);
font.setColour(Colour.BLACK);
cellFormat = new WritableCellFormat(font);
cellFormat.setAlignment(Alignment.LEFT);
label = new Label(3, num, "Info", cellFormat);
workSheet.addCell(label);
//keeps track of rows
num++;
step++;
}
/**
* Method that is called when finished writing the log.
* @throws IOException
* @throws WriteException
*/
public static boolean close() throws IOException, WriteException
{
boolean returnStatus=false;
workLog.write();
workLog.close();
num = 1;
step=1;
if(failCounter==0) returnStatus= true;
return returnStatus;
}
/**
* Finalize method for cleaning up after object is finished
*/
public void finalize(){
try {
workLog.write();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
workLog.close();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
super.finalize();
} catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void takeSnapshot(String filePath, String fileName)
{
try{
SimpleDateFormat date = new SimpleDateFormat("EEE, MMM d ''yy hh_mm_ss a");
String formattedDate = date.format(new Date());
Robot robot = new Robot();
File imgFile = new File(filePath + "\\" + fileName + "_" + formattedDate + ".png");
BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(screenShot, "png", imgFile);
WritableImage wi = new WritableImage(1, num, 2, 30, imgFile);
workSheet.addImage(wi);
num = num + 30;
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
public static void takeSnapshot(String fileName){
takeSnapshot(relSnapShotDir, fileName);
}
}
| [
"[email protected]"
] | |
9a617a003b9e5b6ec0d85048781a60a9aaf5dd7e | 4312a71c36d8a233de2741f51a2a9d28443cd95b | /RawExperiments/TB/Math280/AstorMain-Math280/src/variant-518/org/apache/commons/math/distribution/AbstractContinuousDistribution.java | 80b3e3f29df92d01b6f9c9b4b2cea2e2a4eddd64 | [] | no_license | SajjadZaidi/AutoRepair | 5c7aa7a689747c143cafd267db64f1e365de4d98 | e21eb9384197bae4d9b23af93df73b6e46bb749a | refs/heads/master | 2021-05-07T00:07:06.345617 | 2017-12-02T18:48:14 | 2017-12-02T18:48:14 | 112,858,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,423 | java | package org.apache.commons.math.distribution;
public abstract class AbstractContinuousDistribution extends org.apache.commons.math.distribution.AbstractDistribution implements java.io.Serializable , org.apache.commons.math.distribution.ContinuousDistribution {
private static final long serialVersionUID = -38038050983108802L;
protected AbstractContinuousDistribution() {
super();
}
public double inverseCumulativeProbability(final double p) throws org.apache.commons.math.MathException {
if ((p < 0.0) || (p > 1.0)) {
throw org.apache.commons.math.MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range", p, 0.0, 1.0);
}
org.apache.commons.math.analysis.UnivariateRealFunction rootFindingFunction = new org.apache.commons.math.analysis.UnivariateRealFunction() {
public double value(double x) throws org.apache.commons.math.FunctionEvaluationException {
try {
return (cumulativeProbability(x)) - p;
} catch (org.apache.commons.math.MathException ex) {
throw new org.apache.commons.math.FunctionEvaluationException(ex , x , ex.getPattern() , ex.getArguments());
}
}
};
double lowerBound = getDomainLowerBound(p);
double upperBound = getDomainUpperBound(p);
double[] bracket = null;
try {
bracket = org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils.bracket(rootFindingFunction, getInitialDomain(p), lowerBound, upperBound);
} catch (org.apache.commons.math.ConvergenceException ex) {
return java.lang.Double.POSITIVE_INFINITY;
if ((java.lang.Math.abs(rootFindingFunction.value(lowerBound))) < 1.0E-6) {
return lowerBound;
}
if ((java.lang.Math.abs(rootFindingFunction.value(upperBound))) < 1.0E-6) {
return upperBound;
}
throw new org.apache.commons.math.MathException(ex);
}
double root = org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils.solve(rootFindingFunction, bracket[0], bracket[1]);
return root;
}
protected abstract double getInitialDomain(double p);
protected abstract double getDomainLowerBound(double p);
protected abstract double getDomainUpperBound(double p);
}
| [
"[email protected]"
] | |
5fcc35425126c16e631abedb162211920257c94f | d0d920be4d499325f8c968da63a56e8c52190167 | /rr-exercise/src/main/java/com/rr/pricer/models/RateWithDurationDiscounts.java | b09a54fa376ee71d949b72bc5d3cb70d91e658c7 | [] | no_license | VijayEluri/javarepo | 559bf3840bb0ecfbaf03b769e7cd3b657931f0d9 | 8126828992fa063c95edfac05b30cda310a5edd2 | refs/heads/master | 2020-05-20T11:03:45.984284 | 2016-03-08T18:52:23 | 2016-03-08T18:52:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.rr.pricer.models;
import java.math.BigDecimal;
public class RateWithDurationDiscounts {
public BigDecimal daily;
// Percentage discount for a weekly rental, expressed as a decimal between 0 and 1
public BigDecimal weeklyDiscount;
// Percentage discount for a monthly rental, expressed as a decimal between 0 and 1
public BigDecimal monthlyDiscount;
public RateWithDurationDiscounts(BigDecimal daily, BigDecimal weeklyDiscount, BigDecimal monthlyDiscount) {
this.daily = daily;
this.weeklyDiscount = weeklyDiscount;
this.monthlyDiscount = monthlyDiscount;
}
}
| [
"[email protected]"
] | |
95f28a7974e9565030aab04f8a61c4737e25a1d3 | 490d5eb7e7af881a8d6a118b65408a372410fe05 | /app/src/main/java/sapphyx/gsd/com/drywall/fragments/Wallpapers.java | 21cd86776876907e2fed6d530b09f7815728c1a8 | [] | no_license | yassane/Drywall | 589e675d352cc5872ea85fac53e59f9a2e988249 | c23418dbc4585443b040bc02b7a77030d524fb26 | refs/heads/master | 2020-03-07T09:53:38.112575 | 2017-10-21T20:42:34 | 2017-10-21T20:42:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,158 | java | package sapphyx.gsd.com.drywall.fragments;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import java.util.List;
import sapphyx.gsd.com.drywall.R;
/**
* Created by ry on 1/27/17.
*/
public class Wallpapers extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.papers);
populateWallpaperTypes();
}
private void populateWallpaperTypes() {
final Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
final PackageManager pm = getPackageManager();
final List<ResolveInfo> rList = pm.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
final PreferenceScreen parent = getPreferenceScreen();
parent.setOrderingAsAdded(false);
for (ResolveInfo info : rList) {
Preference pref = new Preference(getActivity());
pref.setLayoutResource(R.layout.preference_wallpaper_type);
Intent prefIntent = new Intent(intent);
prefIntent.setComponent(new ComponentName(
info.activityInfo.packageName, info.activityInfo.name));
pref.setIntent(prefIntent);
CharSequence label = info.loadLabel(pm);
if (label == null) label = info.activityInfo.packageName;
pref.setTitle(label);
pref.setIcon(info.loadIcon(pm));
parent.addPreference(pref);
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
Wallpapers f = (Wallpapers) getFragmentManager()
.findFragmentById(R.id.fragment);
if (f != null)
getFragmentManager().beginTransaction().remove(f).commit();
}
protected PackageManager getPackageManager() {
return getActivity().getPackageManager();
}
} | [
"[email protected]"
] | |
ba4e6ae635fbb413a0c654b5eb372c9e8e765afc | 71e640ac44a47e88a813b0019f1ce3031edaad3a | /ctci/Q1.java | ce6708b075de4f05c33790d11740e73ffeb55c8e | [] | no_license | PyRPy/algorithms_books | ef19b45f24c08a189cb9914f8423f28d609700e2 | 1804863ca931abedbbb8053bcc771115d0c23a2d | refs/heads/master | 2022-05-25T20:22:03.776125 | 2022-05-10T13:47:33 | 2022-05-10T13:47:33 | 167,270,558 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package ctci;
// example code from CtCI
// https://github.com/careercup/CtCI-6th-Edition
public class Q1 {
public static boolean isUniqueChars(String str) {
if (str.length() > 128) {
return false;
}
boolean[] char_set = new boolean[128];
for (int i = 0; i < str.length(); i++) {
int val = str.charAt(i);
if (char_set[val]) return false;
char_set[val] = true;
}
return true;
}
public static void main(String[] args) {
String[] words = {"abcde", "hello", "apple", "kite", "padle"};
for (String word : words) {
System.out.println(word + ": " + isUniqueChars(word));
}
}
}
| [
"[email protected]"
] | |
4201118080473bbb5f4c07c28eb323da54ebeb57 | 2fabc48642b99cd24460b181a7ead0be8ea59ab8 | /AI_ProjectF/src/local_searches/queueState.java | c4600a989075d682b75fdf4aef199428a9806417 | [] | no_license | mpouyakh9/AI | 9f54cefe8aa8bd796df69f5aee12bf7d6a0f2ecf | 1edcb1c2c64300adff59245ad94cedc41314ef49 | refs/heads/master | 2022-04-08T18:16:45.683551 | 2019-12-23T09:04:40 | 2019-12-23T09:04:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package local_searches;
public class queueState implements Cloneable{
public int[] queue;
public int value;
public queueState(int[] queue,int value){
this.queue = queue;
this.value = value;
}
public String toString(){
String res = "queue :";
for(int i = 0; i < this.queue.length; i++){
res += " " + queue[i];
if(i<(queue.length-1)&&(i+1)%3==0) res+=",";
}
res += " value: "+ this.value;
return res;
}
public Object clone(){
int[] copy=new int[queue.length];
for(int i=0;i<queue.length;i++)
copy[i]=queue[i];
queueState tmp = new queueState(copy, value);
return tmp;
}
}
| [
"[email protected]"
] | |
e43476f4db1afebe47b5c3db4b60656c1914e1c2 | 737edc40f2866868111927916ab8aa88b0c3a222 | /app/src/test/java/br/com/ecarrara/yabaking/ExampleUnitTest.java | c72b1b6d0e4afd81575059de58538c4dd3e9c5ee | [
"Apache-2.0"
] | permissive | ecarrara-araujo/yabaking | 98acbe2c2f9a8a39199ec8f3271fa89bf4ca9632 | 6438ab4ee16a63ef8cedda12475b145deb0e649a | refs/heads/master | 2021-07-12T07:28:01.067766 | 2017-10-15T20:12:16 | 2017-10-15T20:12:16 | 106,834,763 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package br.com.ecarrara.yabaking;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
20f146d06ab0035afe62dee55151d0e470623d50 | 45758c55216ca6ae6afc1f7a3ba11dd6a33903e5 | /Project_188_Online/src/ui_verifactioncommands/getText/Get_Page_Visible_Text.java | 1c60599820fb38cf4d07ed4dba228e576965a3ff | [] | no_license | sunilreddyg/15th_feb_12PM-2021 | cbefa2de795c12c905c47ac1d68d28e54c9c8733 | 5ee77bd133622aafeed90df9a05e24a64d3bc08d | refs/heads/master | 2023-06-12T14:33:06.301890 | 2021-07-10T07:18:50 | 2021-07-10T07:18:50 | 340,297,792 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java | package ui_verifactioncommands.getText;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Get_Page_Visible_Text {
public static void main(String[] args) throws Exception
{
/*
* Scenario: Verifying login with invalid email address
*
* Given site url is http://outlook.com
* And click Signin button
* When Use enter invalid email address
* And click on Next button to validate email
* Then error message should be displayed
*/
System.setProperty("webdriver.chrome.driver", "drivers\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://www.outlook.com");
driver.manage().window().maximize();
WebElement Singn_nav_button=driver.findElement(By.xpath("(//a[contains(.,'Sign in')])[1]"));
Singn_nav_button.click();
WebElement email_textbox=driver.findElement(By.xpath("//input[@id='i0116']"));
email_textbox.clear();
email_textbox.sendKeys("[email protected]");
WebElement Email_Next_validation_btn=driver.findElement(By.xpath("//input[@id='idSIButton9']"));
Email_Next_validation_btn.click();
//Static timeout to load error message
Thread.sleep(5000);
//Target Webpage
String pageVisible_Text=driver.findElement(By.tagName("body")).getText();
//System.out.println(pageVisible_Text);
//Store expected text
String Exp_text="That Microsoft account doesn't exist. Enter a different account or get a new one.";
if(pageVisible_Text.contains(Exp_text))
{
System.out.println("Text visible at webpage");
}
else
{
System.out.println("Text not visible at webpage");
}
}
}
| [
"[email protected]"
] | |
4a95a1a80afe21830163e26b9249574d5a9b772f | 13289be26a855a9cf30cf6eebea53776a8675ebf | /app/src/main/java/com/ycsx/www/wms/activity/OrderQueryActivity.java | 3c87f7298f560203525987c167d9527c1e412395 | [] | no_license | zhangzs1994/WMS | ba577fd863a250c93ee97dab0e65f152c171c19f | bae4e0ce6504b6ee73e328750db4668d2a8797cb | refs/heads/master | 2020-12-07T00:32:34.097597 | 2017-07-31T05:47:33 | 2017-07-31T05:47:33 | 95,504,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,435 | java | package com.ycsx.www.wms.activity;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.text.format.DateFormat;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.ycsx.www.wms.R;
import com.ycsx.www.wms.base.BaseActivity;
import com.ycsx.www.wms.bean.CategoryInfo;
import com.ycsx.www.wms.common.API;
import com.ycsx.www.wms.util.RetrofitUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class OrderQueryActivity extends BaseActivity {
private Spinner spinner2,spinner1;
private List<String> spinnerValue2 = new ArrayList<>();
private List<String> spinnerCode2 = new ArrayList<>();
private List<String> spinnerValue1 = new ArrayList<>();
private List<String> spinnerCode1 = new ArrayList<>();
private ArrayAdapter<String> arrayAdapter1;
private ArrayAdapter<String> arrayAdapter2;
private LinearLayout start_dataSelect, end_dataSelect;
private TextView start_dataTime, end_dataTime;
private Button query;
private DatePickerDialog dialog;
private EditText order_id;
private String status;
private String classify;
@Override
public void init() {
super.init();
setContentView(R.layout.activity_order_query);
initView();
queryDropdown1();
queryDropdown2();
spinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if(spinnerValue1.get(position).toString().equals("全部")){
classify = "";
}else{
for (int i = 0; i < spinnerValue1.size(); i++) {
if (spinnerValue1.get(i).toString().equals(spinnerValue1.get(position).toString())) {
classify = spinnerCode1.get(i-1).toString();
}
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
status = "";
}
});
spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if(spinnerValue2.get(position).toString().equals("全部")){
status = "";
}else{
for (int i = 0; i < spinnerValue2.size(); i++) {
if (spinnerValue2.get(i).toString().equals(spinnerValue2.get(position).toString())) {
status = spinnerCode2.get(i-1).toString();
}
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
status = "";
}
});
query.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (start_dataTime.getText().equals("") && !end_dataTime.getText().equals("")) {
Toast.makeText(OrderQueryActivity.this, "请选择开始日期!", Toast.LENGTH_SHORT).show();
} else if (!start_dataTime.getText().equals("") && end_dataTime.getText().equals("")) {
Toast.makeText(OrderQueryActivity.this, "请选择结束日期!", Toast.LENGTH_SHORT).show();
} else {
Intent intent = new Intent(OrderQueryActivity.this, OrderListActivity.class);
intent.putExtra("title", "订单列表");
intent.putExtra("oid", order_id.getText() + "");
intent.putExtra("ostatus", status + "");
intent.putExtra("classify", classify + "");
intent.putExtra("starttime", start_dataTime.getText() + "");
intent.putExtra("endtime", end_dataTime.getText() + "");
startActivity(intent);
}
}
});
}
private void queryDropdown1() {
spinnerValue1.add("全部");
Map<String, String> params = new HashMap<>();
params.put("colName", "order1");
Call<CategoryInfo> call = RetrofitUtil.getInstance(API.URL).queryDropdown(params);
call.enqueue(new Callback<CategoryInfo>() {
@Override
public void onResponse(Call<CategoryInfo> call, Response<CategoryInfo> response) {
if (response.isSuccessful()) {
CategoryInfo info = response.body();
if (("10200").equals(info.getStatus())) {
for (int i = 0; i < info.getData().size(); i++) {
spinnerValue1.add(info.getData().get(i).getValue() + "");
spinnerCode1.add(info.getData().get(i).getCode() + "");
}
arrayAdapter1 = new ArrayAdapter<String>(OrderQueryActivity.this, R.layout.spinner_item, spinnerValue1);
arrayAdapter1.setDropDownViewResource(R.layout.dropdown_stytle);
spinner1.setAdapter(arrayAdapter1);
} else {
Toast.makeText(OrderQueryActivity.this, "获取订单类型失败1!", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(OrderQueryActivity.this, "获取订单类型失败2!", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<CategoryInfo> call, Throwable t) {
Toast.makeText(OrderQueryActivity.this, "获取订单类型失败3!", Toast.LENGTH_SHORT).show();
}
});
}
private void queryDropdown2() {
spinnerValue2.add("全部");
Map<String, String> params = new HashMap<>();
params.put("colName", "order2");
Call<CategoryInfo> call = RetrofitUtil.getInstance(API.URL).queryDropdown(params);
call.enqueue(new Callback<CategoryInfo>() {
@Override
public void onResponse(Call<CategoryInfo> call, Response<CategoryInfo> response) {
if (response.isSuccessful()) {
CategoryInfo info = response.body();
if (("10200").equals(info.getStatus())) {
for (int i = 0; i < info.getData().size(); i++) {
spinnerValue2.add(info.getData().get(i).getValue() + "");
spinnerCode2.add(info.getData().get(i).getCode() + "");
}
arrayAdapter2 = new ArrayAdapter<String>(OrderQueryActivity.this, R.layout.spinner_item, spinnerValue2);
arrayAdapter2.setDropDownViewResource(R.layout.dropdown_stytle);
spinner2.setAdapter(arrayAdapter2);
} else {
Toast.makeText(OrderQueryActivity.this, "获取订单状态失败1!", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(OrderQueryActivity.this, "获取订单状态失败2!", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<CategoryInfo> call, Throwable t) {
Toast.makeText(OrderQueryActivity.this, "获取订单状态失败3!", Toast.LENGTH_SHORT).show();
}
});
}
public void back(View view) {
finish();
}
private void initView() {
query = (Button) findViewById(R.id.query);
spinner2 = (Spinner) findViewById(R.id.spinner);
spinner1 = (Spinner) findViewById(R.id.spinner1);
order_id = (EditText) findViewById(R.id.order_id);
start_dataSelect = (LinearLayout) findViewById(R.id.start_dataSelect);
start_dataTime = (TextView) findViewById(R.id.start_dataTime);
end_dataSelect = (LinearLayout) findViewById(R.id.end_dataSelect);
end_dataTime = (TextView) findViewById(R.id.end_dataTime);
final Calendar c = Calendar.getInstance();
start_dataSelect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog = new DatePickerDialog(OrderQueryActivity.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
c.set(year, monthOfYear, dayOfMonth);
start_dataTime.setText(DateFormat.format("yyy-MM-dd", c));
}
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
if (!end_dataTime.getText().toString().equals("")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Date date = sdf.parse(end_dataTime.getText().toString());
dialog.getDatePicker().setMaxDate(date.getTime());
} catch (ParseException e) {
e.printStackTrace();
}
} else {
//dialog.getDatePicker().setMaxDate((new Date()).getTime());
}
dialog.show();
}
});
end_dataSelect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog = new DatePickerDialog(OrderQueryActivity.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
c.set(year, monthOfYear, dayOfMonth);
end_dataTime.setText(DateFormat.format("yyy-MM-dd", c));
}
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
if (!start_dataTime.getText().toString().equals("")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
Date date = sdf.parse(start_dataTime.getText().toString());
dialog.getDatePicker().setMinDate(date.getTime());
//dialog.getDatePicker().setMaxDate((new Date()).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
} else {
//dialog.getDatePicker().setMaxDate((new Date()).getTime());
}
dialog.show();
}
});
}
}
| [
"[email protected]"
] | |
59382760dbf7dcb1b89a0d1a9a24e81fea2b0bd3 | c11f14cb1f869db946d1c0391002359cf59125a5 | /spboot-jta-automatic/src/main/java/com/wangye/spbootjtaautomatic/config/DB2Properties.java | e18849f4d3b65db0e17f9d3c9e7bc7ea88bf296e | [
"MIT"
] | permissive | wangyeIsClever/myProject | 46110749949178e172404e7409c4eea09f744d7d | 3b9d686db6929142ec4dc1bbc306b2e846f38d69 | refs/heads/master | 2023-08-08T21:10:50.647380 | 2021-06-03T06:27:06 | 2021-06-03T06:27:06 | 171,386,019 | 1 | 0 | MIT | 2023-07-21T09:26:59 | 2019-02-19T01:53:07 | Java | UTF-8 | Java | false | false | 3,090 | java | package com.wangye.spbootjtaautomatic.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "mysql.datasource.test2")
public class DB2Properties {
private String url;
private String username;
private String password;
private Integer minPoolSize;
private Integer maxPoolSize;
private Integer maxLifetime;
private Integer borrowConnectionTimeout;
private Integer loginTimeout;
private Integer maintenanceInterval;
private Integer maxIdleTime;
private String testQuery;
private String mapperLocations;
private String typeAliasesPackage;
public String getTypeAliasesPackage() {
return typeAliasesPackage;
}
public void setTypeAliasesPackage(String typeAliasesPackage) {
this.typeAliasesPackage = typeAliasesPackage;
}
public String getMapperLocations() {
return mapperLocations;
}
public void setMapperLocations(String mapperLocations) {
this.mapperLocations = mapperLocations;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getMinPoolSize() {
return minPoolSize;
}
public void setMinPoolSize(Integer minPoolSize) {
this.minPoolSize = minPoolSize;
}
public Integer getMaxPoolSize() {
return maxPoolSize;
}
public void setMaxPoolSize(Integer maxPoolSize) {
this.maxPoolSize = maxPoolSize;
}
public Integer getMaxLifetime() {
return maxLifetime;
}
public void setMaxLifetime(Integer maxLifetime) {
this.maxLifetime = maxLifetime;
}
public Integer getBorrowConnectionTimeout() {
return borrowConnectionTimeout;
}
public void setBorrowConnectionTimeout(Integer borrowConnectionTimeout) {
this.borrowConnectionTimeout = borrowConnectionTimeout;
}
public Integer getLoginTimeout() {
return loginTimeout;
}
public void setLoginTimeout(Integer loginTimeout) {
this.loginTimeout = loginTimeout;
}
public Integer getMaintenanceInterval() {
return maintenanceInterval;
}
public void setMaintenanceInterval(Integer maintenanceInterval) {
this.maintenanceInterval = maintenanceInterval;
}
public Integer getMaxIdleTime() {
return maxIdleTime;
}
public void setMaxIdleTime(Integer maxIdleTime) {
this.maxIdleTime = maxIdleTime;
}
public String getTestQuery() {
return testQuery;
}
public void setTestQuery(String testQuery) {
this.testQuery = testQuery;
}
}
| [
"[email protected]"
] | |
1bef987f4cc7ccfdc780f35b6085e194b49258c3 | b133407921519f6745a9058bcdc1f5f64cad136c | /mileem-app/src/com/mileem/FileCache.java | 9ea5d53acb4faf64b92ce13b39a18179189d3232 | [] | no_license | ma-alvarez/mileem-grupo5-mobile | fa79d53da9778451141567af8b29a15053dce450 | 2ed8f3fe483f20170c8011c198ddd3ad5ca458cd | refs/heads/master | 2021-01-01T15:41:29.051490 | 2014-11-17T03:33:52 | 2014-11-17T03:33:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package com.mileem;
import java.io.File;
import android.content.Context;
public class FileCache {
private File cacheDir;
public FileCache(Context context) {
//Find the dir to save cached images
cacheDir = context.getCacheDir();
if (!cacheDir.exists())
cacheDir.mkdirs();
}
public File getFile(String url) {
return new File(cacheDir, String.valueOf(url.hashCode()));
}
public void clear() {
File[] files = cacheDir.listFiles();
if (files == null)
return;
for (File f : files)
f.delete();
}
}
| [
"[email protected]"
] | |
42dc12bd19e834a72bf491af17a9c74eeaf46a2d | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/MATH-78b-2-4-Single_Objective_GGA-WeightedSum-BasicBlockCoverage/org/apache/commons/math/analysis/solvers/BrentSolver_ESTest_scaffolding.java | 26c67d275154b4d982a378ab4e07b44a709b54e4 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,938 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu May 14 22:13:58 UTC 2020
*/
package org.apache.commons.math.analysis.solvers;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import static org.evosuite.shaded.org.mockito.Mockito.*;
@EvoSuiteClassExclude
public class BrentSolver_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math.analysis.solvers.BrentSolver";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(BrentSolver_ESTest_scaffolding.class.getClassLoader() ,
"org.apache.commons.math.MathException",
"org.apache.commons.math.analysis.SinFunction$1",
"org.apache.commons.math.ConvergenceException",
"org.apache.commons.math.analysis.solvers.UnivariateRealSolver",
"org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl",
"org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction",
"org.apache.commons.math.analysis.UnivariateRealFunction",
"org.apache.commons.math.MaxIterationsExceededException",
"org.apache.commons.math.analysis.SinFunction",
"org.apache.commons.math.FunctionEvaluationException",
"org.apache.commons.math.analysis.Expm1Function",
"org.apache.commons.math.analysis.QuinticFunction$1",
"org.apache.commons.math.analysis.solvers.BrentSolver",
"org.apache.commons.math.analysis.MonitoredFunction",
"org.apache.commons.math.ConvergingAlgorithm",
"org.apache.commons.math.analysis.QuinticFunction",
"org.apache.commons.math.ConvergingAlgorithmImpl",
"org.apache.commons.math.MathRuntimeException",
"org.apache.commons.math.MathRuntimeException$1",
"org.apache.commons.math.MathRuntimeException$2",
"org.apache.commons.math.MathRuntimeException$3",
"org.apache.commons.math.MathRuntimeException$4",
"org.apache.commons.math.MathRuntimeException$5",
"org.apache.commons.math.MathRuntimeException$6",
"org.apache.commons.math.MathRuntimeException$7",
"org.apache.commons.math.MathRuntimeException$8",
"org.apache.commons.math.MathRuntimeException$10",
"org.apache.commons.math.MathRuntimeException$9"
);
}
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
mock(Class.forName("org.apache.commons.math.analysis.UnivariateRealFunction", false, BrentSolver_ESTest_scaffolding.class.getClassLoader()));
}
}
| [
"[email protected]"
] | |
814ece8bf3f8d39f2d7198554b7fd830891305f4 | 16518e03a6049c34a84a2c905119c61d9b2e7af4 | /alt-web/src/main/java/by/kes/altReality/data/dao/RealityElementsDao.java | 18c1d478dde463cad2c5a7cf780eca08fb7b5c0f | [] | no_license | Kesstyle/AltReality | 3773155ccc4b3c5823bc72bea8d187de2d05cfd2 | 4fee97bdafe73d9a26219b8ba7f7444461007ea4 | refs/heads/master | 2023-02-19T06:48:37.013517 | 2021-01-20T08:12:28 | 2021-01-20T08:12:28 | 281,085,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package by.kes.altReality.data.dao;
import by.kes.altReality.data.domain.DateBreakdown;
public interface RealityElementsDao extends GenericDao<DateBreakdown, String> {
}
| [
"[email protected]"
] | |
fd003d06917a42a034c36624ae2d82cffe118822 | 9254e7279570ac8ef687c416a79bb472146e9b35 | /sofa-20190815/src/main/java/com/aliyun/sofa20190815/models/GetLinkeBahamutIterationsgetlterationsRequest.java | a8149ce608c24376b5e5d2d23e32dc01a8dad22d | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,392 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sofa20190815.models;
import com.aliyun.tea.*;
public class GetLinkeBahamutIterationsgetlterationsRequest extends TeaModel {
@NameInMap("AppName")
public String appName;
@NameInMap("IsDeleted")
public String isDeleted;
@NameInMap("IsFinished")
public String isFinished;
@NameInMap("Page")
public String page;
@NameInMap("PageSize")
public String pageSize;
@NameInMap("ShowAll")
public String showAll;
@NameInMap("TenantId")
public String tenantId;
public static GetLinkeBahamutIterationsgetlterationsRequest build(java.util.Map<String, ?> map) throws Exception {
GetLinkeBahamutIterationsgetlterationsRequest self = new GetLinkeBahamutIterationsgetlterationsRequest();
return TeaModel.build(map, self);
}
public GetLinkeBahamutIterationsgetlterationsRequest setAppName(String appName) {
this.appName = appName;
return this;
}
public String getAppName() {
return this.appName;
}
public GetLinkeBahamutIterationsgetlterationsRequest setIsDeleted(String isDeleted) {
this.isDeleted = isDeleted;
return this;
}
public String getIsDeleted() {
return this.isDeleted;
}
public GetLinkeBahamutIterationsgetlterationsRequest setIsFinished(String isFinished) {
this.isFinished = isFinished;
return this;
}
public String getIsFinished() {
return this.isFinished;
}
public GetLinkeBahamutIterationsgetlterationsRequest setPage(String page) {
this.page = page;
return this;
}
public String getPage() {
return this.page;
}
public GetLinkeBahamutIterationsgetlterationsRequest setPageSize(String pageSize) {
this.pageSize = pageSize;
return this;
}
public String getPageSize() {
return this.pageSize;
}
public GetLinkeBahamutIterationsgetlterationsRequest setShowAll(String showAll) {
this.showAll = showAll;
return this;
}
public String getShowAll() {
return this.showAll;
}
public GetLinkeBahamutIterationsgetlterationsRequest setTenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
public String getTenantId() {
return this.tenantId;
}
}
| [
"[email protected]"
] | |
7820e584d86ea88826ddb0504bf82cea69987cfe | 57b0444885d39252a7faa22f99848b51a19e2e13 | /lab00/src/main/java/lab00_elio/model/Instrutor.java | 17f932722328301e2d847215966bd4f5a8396b0a | [] | no_license | viniciusdenovaes/Unip202ALPOONoturno | fdf56631437585a20f1570bf13684afba762c043 | 37c9b33e3bd8ce91d3d433bae59927e2e2129bc1 | refs/heads/master | 2022-12-28T19:00:17.541881 | 2020-10-09T23:16:09 | 2020-10-09T23:16:09 | 289,386,194 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,505 | java | package lab00_elio.model;
public class Instrutor {
private String nome;
private Integer codigo;
private Double cargaHoraria;
private Double salario;
public Instrutor() {
}
/**
* @return the nome
*/
public String getNome() {
return nome;
}
/**
* @param nome the nome to set
*/
public void setNome(String nome) {
this.nome = nome;
}
/**
* @return the codigo
*/
public Integer getCodigo() {
return codigo;
}
/**
* @param codigo the codigo to set
*/
public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
/**
* @return the cargaHoraria
*/
public Double getCargaHoraria() {
return cargaHoraria;
}
/**
* @param cargaHoraria the cargaHoraria to set
*/
public void setCargaHoraria(Double cargaHoraria) {
this.cargaHoraria = cargaHoraria;
}
/**
* @return the salario
*/
public Double getSalario() {
return salario;
}
/**
* @param salario the salario to set
*/
public void setSalario(Double salario) {
this.salario = salario;
}
public void calcularSalario()
{
if (this.cargaHoraria < 30)
this.salario = 20 * this.cargaHoraria;
else
this.salario = 15 * this.cargaHoraria;
}
}
| [
"[email protected]"
] | |
abf2470df3848814f32e10cb7b425f464722e30b | 94693278dd25dc0504dedd2b1e5f57b4a2bb75c3 | /Switch_Debug/app/src/main/java/jtp/c/dendai/ac/jp/switch_test/Drawlist.java | 067efc73d2c97c96d5a5a0f119d2ccddcc85bd3c | [] | no_license | suke123/Android_Games | 876ed5e2ed8053bd87909a0d2485737c87ce6f1d | afc2a20ec572c9b64db5794190ec758574ce384e | refs/heads/master | 2021-01-19T23:05:28.267832 | 2018-12-25T21:37:50 | 2018-12-25T21:37:50 | 88,918,980 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 118 | java | package jtp.c.dendai.ac.jp.switch_test;
/**
* Created by DE on 2017/10/23.
*/
public class Drawlist {
}
| [
"[email protected]"
] | |
7538a96e2faa206d7bfba6ddfcd6842fe8c68d5c | 952ef99fcd7540e70c3c7749209d7aa5a418e3b3 | /app/src/main/java/com/hedyhidoury/githubprofile/di/qualifiers/RetrofitType.java | f899c4795f7f1ec23d6b5831352ab58d42e2761c | [] | no_license | HedyHidouRy/GithubProfile | ba59bcad5e6df2aea1dfbd00a6d5e07198eb0917 | 5b21edfc71008f64cc079aa9a3b7aeee4f261eaf | refs/heads/master | 2021-05-11T07:46:45.947626 | 2018-01-18T20:49:35 | 2018-01-18T20:49:35 | 118,030,000 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 156 | java | package com.hedyhidoury.githubprofile.di.qualifiers;
/**
* Created by Hedy HidouRy on 1/7/2018.
*/
public enum RetrofitType {
AUTH, HOME
}
| [
"[email protected]"
] | |
e47f22008da6c241899b53425bfeea01997696ca | bb00da7c8569cad8ffb5ca81301b3d89ae2a9b5b | /src/main/java/com/tegik/api/lambda/annotations/Query.java | a0c3f5b608454886369506dd6bd1ae5875e5f121 | [] | no_license | cesarcastmore/api-lambda | 20680c4adb2cd3c8bc2980fd4269c158aaf8b6e0 | b4eae24b2640620d1fa3eb4d4e4f840a91228af6 | refs/heads/master | 2021-01-09T20:09:05.044827 | 2016-07-03T22:37:31 | 2016-07-03T22:37:31 | 62,517,787 | 0 | 0 | null | 2016-07-07T03:39:46 | 2016-07-03T22:36:10 | Java | UTF-8 | Java | false | false | 318 | java | package com.tegik.api.lambda.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface Query {
String value();
}
| [
"[email protected]"
] | |
61e0e4dd24932e6d3effb9592e4ed274b0dcaa9f | 709a1b7c9de4802aa3a5c4817dae8d14ede74939 | /src/main/java/com/woozet/findspot/domain/model/entity/KeywordTrend.java | e04b233cd439fc697fb58b236e620ed7622a2358 | [] | no_license | tezoow/find-spot | adf586da75f19ac212eee3d250210d3c9e4dc00b | 04173bb83e9262988dd5e498ebd50b7bbd4cc8d2 | refs/heads/master | 2020-05-02T01:19:32.309755 | 2019-03-26T09:42:10 | 2019-03-26T09:42:10 | 177,684,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package com.woozet.findspot.domain.model.entity;
import lombok.Builder;
import lombok.Data;
import javax.persistence.*;
import java.time.LocalDateTime;
@Entity
@Table(name = "keyword_trend")
@Data
@Builder
public class KeywordTrend {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private LocalDateTime snapshotTime;
private String keyword;
private Integer count;
}
| [
"[email protected]"
] | |
13a4f523d3dc78e5483e03f6744ce7499118af7a | afe55a9f17ce5395b92202d77635200f30160b88 | /src/upload/Uuid.java | 2de0f265eb02fc5d3c00d68a1d7ec768aca89ba3 | [] | no_license | MichaelHauss/v7-upload-sample | eb1c12dcdb7fddb27f7f3c92ddfefe9ab50584e0 | 432181de370b011f89f928966378468651791cff | refs/heads/master | 2020-03-14T19:25:26.306583 | 2018-05-01T20:46:29 | 2018-05-01T20:46:29 | 131,760,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package upload;
import java.nio.ByteBuffer;
import java.util.Base64;
import java.util.Base64.Encoder;
import java.util.UUID;
public class Uuid {
private final Encoder encoder;
public Uuid() {
this.encoder = Base64.getEncoder();
}
public String randomId() {
// Create random UUID
UUID uuid = UUID.randomUUID();
// Create byte[] for base64 from uuid
byte[] src = ByteBuffer.wrap(new byte[16])
.putLong(uuid.getMostSignificantBits())
.putLong(uuid.getLeastSignificantBits())
.array();
// Encode to Base64 and remove trailing ==
return encoder.encodeToString(src).substring(0, 22) + "==";
}
} | [
"[email protected]"
] | |
41bc1867015a204feadaf6c17ec274179090a280 | 422a4034650045f503221f46caba71571fe83394 | /app/src/main/java/org/botparty/annabelle/AppModule.java | da50efc492b9c7f1516486eb620a86a5fd55bfaf | [] | no_license | BotParty/AnnabelleFace | 5c4911ccaa6d1f7c01e8252df64afa00cd0e8203 | df145791aecce2b9d2d6eda0cd01f2f76a0dd669 | refs/heads/master | 2021-01-11T19:04:00.350013 | 2018-09-26T03:31:26 | 2018-09-26T03:31:26 | 79,305,672 | 0 | 2 | null | 2018-09-26T03:31:28 | 2017-01-18T05:11:12 | JavaScript | UTF-8 | Java | false | false | 1,049 | java | package org.botparty.annabelle;
import android.app.Application;
import android.content.Context;
import android.location.LocationManager;
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import static android.content.Context.LOCATION_SERVICE;
/**
* A module for Android-specific dependencies which require a {@link Context} or
* {@link android.app.Application} to create.
*/
@Module
public class AppModule {
private final Application application;
public AppModule(Application application) {
this.application = application;
}
/**
* Allow the application context to be injected but require that it be annotated with
* {@link ForApplication @Annotation} to explicitly differentiate it from an activity context.
*/
@Provides @Singleton
Application provideApplication() {
return application;
}
@Provides
@Singleton
LocationManager provideLocationManager() {
return (LocationManager) application.getSystemService(LOCATION_SERVICE);
}
} | [
"[email protected]"
] | |
8ae234fb67de3b69d8b34fdf649593c18864a295 | 7fb036676ad8e6c2cdac11f6123d35fc3c741081 | /app/src/main/java/com/example/bluetooth/view/interfaces/IBaseView.java | e3dffd458f57636d8e29a232ccbcf14ac845a877 | [] | no_license | Xxxseventea/Bluetooth | 3a06c25f4aa6b145289130b2b5892de378306fe2 | 27e1500edd70ca80917d6a89fdd2187649fdc4ca | refs/heads/master | 2020-12-28T13:47:27.959825 | 2020-05-26T05:48:08 | 2020-05-26T05:48:08 | 238,355,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 79 | java | package com.example.bluetooth.view.interfaces;
public interface IBaseView {
}
| [
"[email protected]"
] | |
33f15f85bfc8e1a635b798dcee81c0640e4159c9 | 5aa45ca78ddb5b93c9dad8fe39600cc764f2c4b2 | /testweb/src/main/java/com/hdsx/testweb/controller/HelloWorldController.java | 41d92f5cf6ab4a5eef8432a84dbef738ffb49e6f | [] | no_license | cuixingchen/springmvc-mongodb | c10ceaef6ce1549f04c7c447479b03e15f97aab2 | 2dde2fd9aab478e789cd59204098f7cbac0e6770 | refs/heads/master | 2021-01-02T09:15:01.692168 | 2017-09-08T06:18:14 | 2017-09-08T06:18:14 | 33,076,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 903 | java | package com.hdsx.testweb.controller;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.hdsx.testweb.service.HelloWordService;
@RestController
@Scope(value = "prototype")
public class HelloWorldController {
@Resource
private HelloWordService HelloWordService;
// "text/html;charset=UTF-8"
// "application/json;charset=UTF-8"
@RequestMapping(value = "/helloWorld/1/{type}/{name}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public String helloWorld(@PathVariable String type,
@PathVariable String name) {
return HelloWordService.getHelloword(type, name);
}
}
| [
"[email protected]"
] | |
1da521a32a8cba2627abb77733435218001b4c48 | 56980be4e6fa61738f2b792139ebeead1ded0b5a | /JUnitInAction/src/test/java/org/junit/inaction/ii/MasterTestSuite.java | 6bbf4dfead0167f7b7158c051eff23a97f280762 | [] | no_license | lmendonca/RandomCode | 913b67ef9967bab4bdd30b8f0bb02addf1482e6a | 47b76b2e4afd724dec871fdd6c72ac244cbad2fc | refs/heads/master | 2016-09-15T14:24:13.067657 | 2012-02-11T02:32:07 | 2012-02-11T02:32:07 | 3,356,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | /**
*
*/
package org.junit.inaction.ii;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
/**
* @author leonardo
*
*/
@RunWith(value = Suite.class)
@SuiteClasses(value = {TestSuiteA.class, TestSuiteB.class })
public class MasterTestSuite {
}
| [
"[email protected]"
] | |
4f4a07498b5a2a8ba25359a73e23e16d00da2a6c | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/java-design-patterns/learning/2855/ConsumerTest.java | edabd6d2d1a77e3b271906a0231347ede5cdcaaf | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,662 | java | /**
* The MIT License
* Copyright (c) 2014-2016 Ilkka Seppälä
*
* 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.iluwatar.poison.pill;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.LoggerFactory;
import java.time.LocalDateTime;
import java.util.LinkedList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Date: 12/27/15 - 9:45 PM
*
* @author Jeroen Meulemeester
*/
public class ConsumerTest {
private InMemoryAppender appender;
@BeforeEach
public void setUp() {
appender = new InMemoryAppender(Consumer.class);
}
@AfterEach
public void tearDown() {
appender.stop();
}
@Test
public void testConsume() throws Exception {
final Message[] messages = new Message[]{
createMessage("you", "Hello!"),
createMessage("me", "Hi!"),
Message.POISON_PILL,
createMessage("late_for_the_party", "Hello? Anyone here?"),
};
final MessageQueue queue = new SimpleMessageQueue(messages.length);
for (final Message message : messages) {
queue.put(message);
}
new Consumer("NSA", queue).consume();
assertTrue(appender.logContains("Message [Hello!] from [you] received by [NSA]"));
assertTrue(appender.logContains("Message [Hi!] from [me] received by [NSA]"));
assertTrue(appender.logContains("Consumer NSA receive request to terminate."));
}
/**
* Create a new message from the given sender with the given message body
*
* @param sender The sender's name
* @param message The message body
* @return The message instance
*/
private static Message createMessage(final String sender, final String message) {
final SimpleMessage msg = new SimpleMessage();
msg.addHeader(Message.Headers.SENDER, sender);
msg.addHeader(Message.Headers.DATE, LocalDateTime.now().toString());
msg.setBody(message);
return msg;
}
private class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>();
public InMemoryAppender(Class clazz) {
((Logger) LoggerFactory.getLogger(clazz)).addAppender(this);
start();
}
@Override
protected void append(ILoggingEvent eventObject) {
log.add(eventObject);
}
public boolean logContains(String message) {
return log.stream().anyMatch(event -> event.getFormattedMessage().equals(message));
}
}
}
| [
"[email protected]"
] | |
f08965b76256834e5221e0055c9d33893ef20ab1 | a5c8d31a78032e6a22a27c3558fe1f6c75bd67ce | /src/algorithms/Recursion.java | 55d9e20a6f3039abbfb5726702ae57bef92414a0 | [] | no_license | premagopu/DataStructures | 7ab7fcc12313e2a20e4514842d517daf5406bcbe | ce9c8711b5b90fb313c5b91c7c11816faf2d639c | refs/heads/master | 2022-04-20T19:57:59.921832 | 2020-04-22T01:56:02 | 2020-04-22T01:56:02 | 120,560,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,379 | java | package algorithms;
public class Recursion {
public static void main(String[] args) {
reduceByOne(10);
System.out.println( recursiveLinearSearch(new int[]{1,2,3,4,6,7},2,7));
System.out.println( recursiveBinarySearch(new int[]{1,2,3,4,7,9, 16,19},0,8,8));
}
//Sample recursion implementation
public static void reduceByOne(int n){
if(n>=0){
reduceByOne(n-1);
}
System.out.println(n);
}
//Recursive Linear search from xth position of the array
public static int recursiveLinearSearch(int[] a,int x,int element){
if(x > a.length-1){
return -1;
}else if(a[x] ==element){
return x;
}else {
return recursiveLinearSearch(a,x+1,element);
}
}
//Recursive Binary Search
public static int recursiveBinarySearch(int[] a,int p, int r, int element){
System.out.println("[ p "+p+" ... "+r+" ]");
if(p>r) {
return -1;
}else{
int q = (p+r)/2;
if(element<a[q]){
return recursiveBinarySearch(a,p,q-1,element);
}else if(element>a[q]){
return recursiveBinarySearch(a,q+1,r,element);
}else{
return q;
}
}
}
}
| [
"[email protected]"
] | |
cc7f8604be20480a94402c1e60e54854e5be4f5e | d743888c3f214c9e7954db39b171dec346ead657 | /Spring Data Intro - Lab/shampoo_company/src/main/java/app/domain/impl/Lavender.java | 22f15b1f173a3d972a4c446485abffc880349533 | [] | no_license | GeorgeK95/DatabasesAdvanced | 6683000266d922e7855cca4e55b246d8a97d0b49 | cb2ed0fcaff163617460d860af70f2105471a7e1 | refs/heads/master | 2020-12-03T07:58:46.414568 | 2017-08-31T11:10:10 | 2017-08-31T11:10:10 | 95,643,423 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package app.domain.impl;
import app.service.impl.BasicIngredient;
import app.service.impl.BasicShampoo;
import javax.persistence.Entity;
import java.math.BigDecimal;
import java.util.Set;
/**
* Created by George-Lenovo on 7/18/2017.
*/
@Entity
//@Table(name = "lavender")
public class Lavender extends BasicIngredient {
private BigDecimal price = new BigDecimal(2);
public Lavender() {
super();
}
@Override
public Set<BasicShampoo> getShampoos() {
return null;
}
@Override
public void setShampoos(Set<BasicShampoo> shampoos) {
}
}
| [
"[email protected]"
] | |
3527d9182059a78d8744096cf89ef63d15450d2b | beb5d30aac533a04b62c9c18109a0b02f6be7eca | /src/cool/structures/FindTypesVisitor.java | d86ad96f4f6f5c16d46e5cff29d6c2a9641311e5 | [] | no_license | florinrm/Tema3-CPL | 743d2fe3e9bbbab2fc29ddb6d5303f4f1605a855 | bfa51d76a73c9c9802df03d788b863fd0e50a392 | refs/heads/master | 2022-03-28T22:52:47.410396 | 2020-01-10T22:35:37 | 2020-01-10T22:35:37 | 230,462,536 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,677 | java | package cool.structures;
import cool.compiler.*;
import java.util.ArrayList;
public class FindTypesVisitor implements Visitor<Void> {
private Scope currentScope = null;
@Override
public Void visit(Id id) {
return null;
}
@Override
public Void visit(Int intt) {
return null;
}
@Override
public Void visit(If iff) {
return null;
}
@Override
public Void visit(AddSub sum) {
return null;
}
@Override
public Void visit(Program prog) {
currentScope = new DefaultScope(null);
currentScope.add(TypeSymbol.BOOL);
currentScope.add(TypeSymbol.INT);
currentScope.add(TypeSymbol.STRING);
for (var statement : prog.getClasses()) {
statement.accept(this);
}
return null;
}
@Override
public Void visit(MultDivNode prod) {
return null;
}
@Override
public Void visit(BoolNode bool) {
return null;
}
@Override
public Void visit(FunctionCall call) {
return null;
}
@Override
public Void visit(CompareNode comp) {
return null;
}
@Override
public Void visit(FloatNode flt) {
return null;
}
@Override
public Void visit(FuncDefNode func) {
return null;
}
@Override
public Void visit(UnaryMinusNode minus) {
return null;
}
@Override
public Void visit(VarDef var) {
return null;
}
@Override
public Void visit(AssignmentNode assignmentNode) {
return null;
}
@Override
public Void visit(ClassNode classNode) {
var id = classNode.getName();
var idType = new TypeSymbol(id.getText());
if (idType.equals(TypeSymbol.BOOL)
|| idType.equals(TypeSymbol.INT)
|| idType.equals(TypeSymbol.STRING)) {
return null;
}
if (idType.equals(TypeSymbol.SELF)) {
return null;
}
ClassSymbol classSymbol = new ClassSymbol(currentScope, classNode.getName().getText());
currentScope = classSymbol;
Id classId = new Id(id);
classId.setScope(currentScope);
classId.setSymbol(classSymbol);
if (classNode.getParent() != null) {
SymbolTable.classesAndParents.put(classNode.getName().getText(), classNode.getParent().getText());
} else {
SymbolTable.classesAndParents.put(classNode.getName().getText(), null);
}
SymbolTable.classesAndMethods.put(classNode.getName().getText(), new ArrayList<FuncDefNode>());
currentScope = currentScope.getParent();
return null;
}
@Override
public Void visit(StringNode stringNode) {
return null;
}
@Override
public Void visit(WhileNode whileNode) {
return null;
}
@Override
public Void visit(VoidNode voidNode) {
return null;
}
@Override
public Void visit(NewNode newNode) {
return null;
}
@Override
public Void visit(LetNode letNode) {
return null;
}
@Override
public Void visit(ListVariables listVariables) {
return null;
}
@Override
public Void visit(CaseOfNode caseOfNode) {
return null;
}
@Override
public Void visit(Branch branch) {
return null;
}
@Override
public Void visit(BlockNode blockNode) {
return null;
}
@Override
public Void visit(ParanthesesNode paranthesesNode) {
return null;
}
@Override
public Void visit(NegationNode negationNode) {
return null;
}
}
| [
"[email protected]"
] | |
5aa1deb05c5053fa474d438396e923733c1d0abc | 3bbd1585d938bf1694a6e0948a2c724590cf8dce | /src/main/java/ro/ubb/dp1819/lab4/exercises/strategy/NotificationType.java | 53ec8225474d0273d2501ba2e504a6087d4f928a | [
"GPL-1.0-only",
"MIT"
] | permissive | lzrmihnea/ubb.dp.1819 | 0e6df29a11d07aba58549ef8bb453cbeb704be5e | 4fff0194cea401bf5c4c141e68fe6e0b81eea715 | refs/heads/master | 2020-04-25T06:25:32.797607 | 2019-05-18T20:57:57 | 2019-05-18T20:57:57 | 172,580,827 | 2 | 49 | MIT | 2019-05-27T10:52:45 | 2019-02-25T20:37:59 | Java | UTF-8 | Java | false | false | 123 | java | package ro.ubb.dp1819.lab4.exercises.strategy;
public enum NotificationType {
SMS,
PUSH_NOTIFICATION,
EMAIL
}
| [
"[email protected]"
] | |
3eab465d25e5a4e0b9ce544d7161443f002a78b4 | 6fefdd0b7ca0115c40ca717b253c9dc873755ef6 | /src/com/springboot/controller/Example.java | 46fcf03282e19afd2a027acd5fe7fa1b8f06bc8d | [] | no_license | jiger25783/MyfirstSpringBoot | 2e9870a9a94499c4d342db7a722b356e60d0f48c | c45a20df170670c5375d758a362f641649df8fd4 | refs/heads/master | 2020-06-12T22:29:42.733542 | 2016-12-03T21:53:37 | 2016-12-03T21:53:37 | 75,497,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java | package com.springboot.controller;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.springboot.domain.Product;
@RestController
@EnableAutoConfiguration
public class Example {
@RequestMapping("/testing")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_XHTML_XML ,MediaType.APPLICATION_JSON})
Product home() {
Product p = new Product();
p.setName("Mobile");
p.setDesc("Iphone");
return p;
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Example.class, args);
}
} | [
"[email protected]"
] | |
72f910a4dc3ac1e364ac186e47638d95c366d366 | cfc7bdfcd61367b727c62da124a2bfeb390d1578 | /apps/bankingwarehouse/android/native/src/com/ibm/cio/be/android/banking/RetailBank/GCMIntentService.java | 1070a1e03d9fa2cb546202c34a6cb095a3b3773f | [] | no_license | bhudith/IBM_Mobile_Contest_Competition | e6e7cf37a7a91107e5345694bc71b2efec4ed71f | 1c1d3b73078a5d6dffd607a59036fe04c81f8d27 | refs/heads/master | 2020-03-23T23:43:38.359753 | 2018-07-25T05:35:27 | 2018-07-25T05:35:27 | 142,251,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package com.ibm.cio.be.android.banking.RetailBank;
public class GCMIntentService extends com.worklight.androidgap.push.GCMIntentService{
//Nothing to do here...
}
| [
"[email protected]"
] | |
65fdc690c19a0216fd7ad51a3575473f250bafac | ca15c84686592d2efabcc55e25e6ff750031dd8f | /javarush/test/level14/lesson08/bonus03/Solution.java | 3334b9602d325859838c15ab1c628282eb7bd4cb | [] | no_license | Kutsanin/JavaRush | 2b6ded854d11d9543d105ce5c00c942daefa81ec | f32ad2d848d9ec4cefec914a17aca6f1102acc9a | refs/heads/master | 2021-01-20T08:49:07.195215 | 2015-12-22T11:26:24 | 2015-12-22T11:26:24 | 34,452,354 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,311 | java | package com.javarush.test.level14.lesson08.bonus03;
/* Singleton
Класс является синглтоном (реализует паттерн(шаблон) Singleton), если позволяет создать всего один объект своего типа.
Реализовать Singleton pattern:
1. Создай класс Singleton в отдельном файле.
2. Добавь в него статический метод getInstance().
3. Метод getInstance должен возвращать один и тот же объект класса Singleton при любом вызове метода getInstance.
4. Подумай, каким образом можно запретить создание других объектов этого класса.
5. Сделай все конструкторы в классе Singleton приватными (private).
6. В итоге должна быть возможность создать объект (экземпляр класса) ТОЛЬКО используя метод getInstance.
*/
public class Solution
{
public static void main(String[] args)
{
Object o = Singleton.getInstance();
Object a = Singleton.getInstance();
System.out.println(o);
System.out.println(a);
}
}
| [
"[email protected]"
] | |
1a80a0db8ec67b954a993f2c3e5860d0e4ccec19 | 1d0eee6701aba76ae09609caf91f3303b7bf7b90 | /VideoShop/src/by/epam/vshop/service/validation/FilmValidator.java | 3af4867aa01836018e8f7365ccfbff85bfaff6d7 | [] | no_license | n1k1taM/JWD_Final_project | f42197d8a3aa0dd6a07e93fcb1bce5f0ebbf1a89 | 7f5ff56a4f449c7c2243542310e1213392590ef5 | refs/heads/master | 2020-03-18T01:48:24.503428 | 2018-06-21T06:50:43 | 2018-06-21T06:50:43 | 134,160,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,779 | java | package by.epam.vshop.service.validation;
import java.util.regex.Pattern;
public final class FilmValidator {
private FilmValidator() {
}
public static boolean validFilm(String title, String cover, String url, String trailerUrl, String year,
String price, String shortDescription, String longDescription, String[] genres) {
if (validString(title) && validString(url) && validString(trailerUrl) && validNumber(year) && validNumber(price)
&& validString(shortDescription) && validString(longDescription) && validGenre(genres)
&& validString(cover)) {
return true;
} else {
return false;
}
}
public static boolean validFilm(String title, String cover, String url, String trailerUrl, String year,
String price, String shortDescription, String longDescription, String[] genres, String id) {
if (validString(title) && validString(url) && validString(trailerUrl) && validNumber(year) && validNumber(price)
&& validString(shortDescription) && validString(longDescription) && validGenre(genres)
&& validString(cover) && validNumber(id)) {
return true;
} else {
return false;
}
}
private static boolean validString(String line) {
if (line == null || line.isEmpty()) {
return false;
} else {
return true;
}
}
public static boolean validGenre(String[] genres) {
boolean result = true;
if (genres != null) {
for (String genre : genres) {
if (!validNumber(genre)) {
result = false;
break;
}
}
}
return result;
}
private static boolean validNumber(String number) {
if ((number.length() == 0)||(number.equals("0"))) {
return false;
}
return Pattern.matches(RegularExpression.POSITIVE_FLOAT_PATTERN, number);
}
}
| [
"[email protected]"
] | |
9767bec60d1c2fe6a5f277b0fbc80045e022c455 | 3723957f0279f7ef4b5724db59135b0e1d0d3a57 | /src/model/CharacterPicker.java | 9d50ab1e6d58c2096c36e0b9d4843a8a98e1ce54 | [] | no_license | Nichapanit/ProgMeth-Project-2020 | 95346c4bb3aeab354f210ace7e3dce353fb972c2 | 6df2dbb918ec9be1e222ecb180803696d52d0261 | refs/heads/main | 2023-05-09T07:38:54.385404 | 2021-05-16T04:04:31 | 2021-05-16T04:04:31 | 360,530,419 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,799 | java | package model;
import javafx.geometry.Pos;import javafx.geometry.Rectangle2D;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
public class CharacterPicker extends VBox{
private ImageView circleImage;
private ImageView characterImage;
private static final int OFFSETX = 0;
private static final int OFFSETY = 0;
private static final int WIDTH = 64;
private static final int HEIGHT = 64;
private String circleNotChosen = ClassLoader.getSystemResource("grey_circle.png").toString();
private String circleChosen = ClassLoader.getSystemResource("yellow_boxTick.png").toString();
private CHARACTER character;
private boolean isCircleChosen;
public CharacterPicker(CHARACTER character) {
this.circleImage = new ImageView(this.circleNotChosen);
this.character = character;
this.characterImage = new ImageView(character.getCharacterUrl());
//this.characterImage.setFitWidth(70);
//this.characterImage.setFitHeight(62);
this.characterImage.setViewport(new Rectangle2D(OFFSETX, OFFSETY, WIDTH, HEIGHT));
// this.characterImage.setFitWidth(70);
// this.characterImage.setFitHeight(62);
this.isCircleChosen = false;
this.setAlignment(Pos.CENTER);
this.setSpacing(20);
this.getChildren().add(circleImage);
this.getChildren().add(characterImage);
}
public CHARACTER getCharacter() {
return this.character;
}
public boolean getIsCircleChosen() {
return this.isCircleChosen;
}
public void setIscircleChosen(boolean isCircleChosen) {
this.isCircleChosen = isCircleChosen;
String imageToSet;
if(this.isCircleChosen) {
imageToSet = this.circleChosen;
}else {
imageToSet = this.circleNotChosen;
}
this.circleImage.setImage(new Image(imageToSet));
}
}
| [
"[email protected]"
] | |
995360da5eef7ab55f3a72477542a427e790674e | 17ac58f7cebc83bca2c24d6d53142298793479eb | /src/main/java/edu/uchicago/lowasser/fingertree/DeepContainer.java | 5786e6e4c690f68cfdedc0e1fa0ebfea6a25a133 | [] | no_license | renesugar/JFingerTree | 3ff3f15badc509c9d1d74c0d97220806a1532fdc | ef05e675bd0d4f2bdf6ac460f0a6a43340e6769a | refs/heads/master | 2021-05-27T09:04:23.563743 | 2011-12-01T20:11:54 | 2011-12-01T20:11:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 150 | java | package edu.uchicago.lowasser.fingertree;
interface DeepContainer<E, T extends Container<E>> extends Container<E> {
T get(int i);
int size();
}
| [
"[email protected]"
] | |
3798b6034f5b8b95f1734d7a989cc32215d57cfb | be4a8376b4e8c994a79d117d9fe5ee5508a50fcc | /2.1 (2017-2018)/lostshard/src/main/java/com/lostshard/lostshard/DamageBalance/Enchantments/Armor/FireProtection.java | 578e6daf08e095fb0eab9793042924ae5b75d1fc | [
"MIT"
] | permissive | BuntsFidleyBits/Lostshard-ARCHIVE | 5b140d36c058421ce02ff12eaee143850a274db1 | 6094e3c12b181e86c313edc7ec2f13fd0907f716 | refs/heads/master | 2021-09-28T13:44:52.398297 | 2018-11-17T14:52:51 | 2018-11-17T14:52:51 | 157,993,584 | 0 | 2 | MIT | 2018-11-17T14:42:58 | 2018-11-17T14:42:58 | null | UTF-8 | Java | false | false | 842 | java | package com.lostshard.lostshard.DamageBalance.Enchantments.Armor;
import org.bukkit.enchantments.Enchantment;
public enum FireProtection {
LEVEL1(Enchantment.DAMAGE_ALL, 1, 0),
LEVEL2(Enchantment.DAMAGE_ALL, 2, 0),
LEVEL3(Enchantment.DAMAGE_ALL, 3, 0),
LEVEL4(Enchantment.DAMAGE_ALL, 4, 0),
;
private final Enchantment enchantment;
private final int level;
private final double modifier;
private FireProtection(Enchantment enchantment, int level, double modifier) {
this.enchantment = enchantment;
this.level = level;
this.modifier = modifier;
}
/**
* @return the enchantment
*/
public Enchantment getEnchantment() {
return enchantment;
}
/**
* @return the level
*/
public int getLevel() {
return level;
}
/**
* @return the modifier
*/
public double getModifier() {
return modifier;
}
}
| [
"[email protected]"
] | |
aff63098844bcdcb979ca563ff684935a5a19329 | 622053c570d178ea9f9a68784822cfa829e4ac63 | /jetrix/tags/0.2.1/src/java/net/jetrix/messages/OneLineAddedMessage.java | b152d523b1f04efe2eedee16b13a7ca957d01ae7 | [] | no_license | ebourg/jetrix-full | 41acb3f2aa19155dd39071fea038625a4ba022f4 | 10fb59ee2d8b46f3553978f46726fd4ee6c90058 | refs/heads/master | 2023-07-31T21:36:12.712631 | 2014-03-17T21:40:47 | 2014-03-17T21:40:47 | 179,978,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 981 | java | /**
* Jetrix TetriNET Server
* Copyright (C) 2001-2003 Emmanuel Bourg
*
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU 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 net.jetrix.messages;
import net.jetrix.*;
/**
*
*
* @author Emmanuel Bourg
* @version $Revision$, $Date$
*/
public class OneLineAddedMessage extends SpecialMessage
{
}
| [
"[email protected]"
] | |
13b923c31d109233d8bfbe628ba62758efe1c17b | f0a6dc554ad160e55a3c27ea53067bb7ce4dcbb1 | /machineModel.java | 646369a0eae668af2484bd392619c01493daed47 | [] | no_license | KevinPrianka/UAS-PBO | 4dd717f86483db635675077474a2a806ee49c18e | 2fc2c3479e0e5dbbecb3d877dad182a886526661 | refs/heads/main | 2023-02-17T02:18:28.196577 | 2021-01-20T15:18:09 | 2021-01-20T15:18:09 | 329,475,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,980 | 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.
*/
/**
*
* @author baros
*/
public class machineModel {
private String Vehicles;
private String Passanger;
private int Code;
private int Price;
private int Balance;
private int Total;
public machineModel(int nom)
{
Price = nom;
Balance = 0;
Total = 0;
}
//SETTER
public void setVehicles (String vehicles)
{
this.Vehicles = vehicles;
}
public void setPassanger(String passanger)
{
this.Passanger = passanger;
}
public void setCode(int code)
{
this.Code = code;
}
public void setPrice(int price)
{
this.Price = price;
}
public void setBalance(int balance)
{
this.Balance = balance;
}
//GETTER
public String getVehicles() {
return Vehicles;
}
public String getPassanger() {
return Passanger;
}
public int getCode() {
return Code;
}
public int getPrice() {
return Price;
}
public int getBalance() {
return Balance;
}
public void masuk(int am)
{
Balance = Balance + am;
}
public void print(int am)
{
Total = am*Price;
if(Balance>=Total){
for(int i=0;i<am;i++){
System.out.println("=====================");
//System.out.println("= Tiket" + kendaraan + "=");
System.out.println("= Rp "+Price+"=");
System.out.println("=====================");
}
Balance = Balance - Total;
}
else System.out.println("Saldo tidak cukup");
}
public int kembali()
{
if(Balance>0){
Balance = 0;
}
return Balance;
}
}
| [
"[email protected]"
] | |
05af805777634b2dd43f4e4db24c96a0f20886be | d97af3db60df4fd365fefb9f761aea98441a87fa | /app/src/main/java/com/ximai/savingsmore/save/modle/SubmitOrderResult.java | 38d85f2f2c00e697492c04b4f38bd54e6d6ef0af | [] | no_license | liufanglin/jianjian_shengyousheng | efd1eb3f070ff6ad1f206a7d1d90a0306ec6c353 | 763b1d45157e9c1011e92fd39e49471a7c91b3df | refs/heads/master | 2020-04-08T18:19:44.545286 | 2019-03-24T07:11:58 | 2019-03-24T07:11:58 | 159,603,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,170 | java | package com.ximai.savingsmore.save.modle;
import java.io.Serializable;
import java.util.List;
/**
* Created by caojian on 17/1/4.
*/
public class SubmitOrderResult implements Serializable{
public boolean IsSuccess;
public String Message;
public String Id;
public List<MainData> MainData;
public String ShowData;
public String OtherData;
public int TotalRecordCount;
public int TotalPageCount;
public int AllTotalRecordCount;
public class MainData implements Serializable{
public String Number;
public String SellerId;
public String TotalPrice;
public String PreferentialPrice;
public String SellerPreferentialPrice;
public double PointPreferentialPrice;
public String DeductionPoint;
public double Price;
public String Recipients;
public String PhoneNumber;
public String ProvinceId;
public String CityId;
public String AreaId;
public String Address;
public String InvoiceTitle;
public String Remark;
public String OrderState;
public String PayType;
public String PayApp;
public String PayOrderSn;
public String RefundSn;
public String IsNormalApplyRefund;
public String DeliveryName;
public String DeliverySn;
public boolean IsBag;
public boolean IsDeleted;
public boolean IsDeletedBySeller;
public String PaySecurityStamp;
public List<OrderDynamics> OrderDynamics;
public List<OrderProducts> OrderProducts;
public User User;
public Seller Seller;
public Province Province;
public City City;
public String Area;
public String OrderStateName;
public String Id;
public String CreateTime;
public String CreateTimeName;
public String CreateDateName;
}
public class Seller implements Serializable{
public String Areas;
public City City;
public Area Area;
public Province Province;
public UserExtInfo UserExtInfo;
public String UserDisplayName;
public String PhotoId;
public String PhotoPath;
public String NickName;
public boolean Sex;
public String Birthday;
public String BirthPlace;
public String Domicile;
public String QQ;
public String Weibo;
public String WeChat;
public double Longitude;
public double Latitude;
public String IMId;
public String IMUserName;
public String ApprovalDate;
public String Post;
public String ProvinceId;
public String CityId;
public String AreaId;
public String Point;
public boolean IsVIP;
public String ShowName;
public String ApprovalDateName;
public String VipLevel;
public String VipLevelName;
public String Email;
public boolean EmailConfirmed;
public String PhoneNumber;
public boolean PhoneNumberConfirmed;
public String Id;
public String UserName;
}
} | [
"[email protected]"
] | |
ff28367709c258c010b062adf4e8dd25e9578ecd | 5c277b0cb7d68a31248a9aa0358c5787b7953924 | /app/src/main/java/com/nfcencrypter/Fragments/TagRegistryAdapter.java | 39612af3377cc8ff05c0dc985deda2671db2709e | [] | no_license | mcpecommander/NfcEncrypter | 222a613970d54669cf0f3065e080f6f79a54f2c2 | 39ecb65df71f9b13220d7400fe765ec49f8715a7 | refs/heads/master | 2020-06-08T22:44:08.377443 | 2019-07-05T20:26:30 | 2019-07-05T20:26:30 | 193,320,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,175 | java | package com.nfcencrypter.Fragments;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.selection.ItemDetailsLookup;
import androidx.recyclerview.selection.ItemKeyProvider;
import androidx.recyclerview.widget.RecyclerView;
import com.nfcencrypter.R;
import java.util.List;
public class TagRegistryAdapter extends RecyclerView.Adapter<TagRegistryAdapter.CustomRecordHolder> {
List<String> records;
TagRegistryAdapter(List<String> records){
this.records = records;
setHasStableIds(true);
}
@NonNull
@Override
public CustomRecordHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ConstraintLayout recordRoot = (ConstraintLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_record, parent, false);
return new CustomRecordHolder(recordRoot);
}
@Override
public void onBindViewHolder(@NonNull CustomRecordHolder holder, int position) {
TextView info = (TextView) holder.root.getViewById(R.id.registry_record);
Button addRecord = (Button) holder.root.getViewById(R.id.add_record);
addRecord.setOnClickListener(WriterFragment.add_record_listener);
if(position >= records.size()){
addRecord.setVisibility(View.VISIBLE);
addRecord.setLongClickable(false);
holder.root.setLongClickable(false);
info.setVisibility(View.GONE);
}else{
holder.root.setLongClickable(true);
info.setText(records.get(position));
info.setVisibility(View.VISIBLE);
addRecord.setVisibility(View.GONE);
}
}
@Override
public int getItemCount() {
return records.size() + 1;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemViewType(int position) {
return position;
}
static class CustomRecordHolder extends RecyclerView.ViewHolder{
ConstraintLayout root;
CustomRecordHolder(@NonNull ConstraintLayout itemView) {
super(itemView);
this.root = itemView;
}
RecordItemDetails getItemDetails(){
return new RecordItemDetails(getAdapterPosition(), getItemId());
}
}
static final class MyDetailsLookup extends ItemDetailsLookup<Long> {
private final RecyclerView mRecyclerView;
MyDetailsLookup(RecyclerView recyclerView) {
mRecyclerView = recyclerView;
}
public ItemDetails<Long> getItemDetails(MotionEvent e) {
View view = mRecyclerView.findChildViewUnder(e.getX(), e.getY());
if (view != null) {
RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(view);
if (holder instanceof CustomRecordHolder) {
return ((CustomRecordHolder) holder).getItemDetails();
}
}
return null;
}
}
static class RecordItemDetails extends ItemDetailsLookup.ItemDetails<Long> {
private int position;
private Long key;
RecordItemDetails(int position, Long key) {
this.position = position;
this.key = key;
}
@Override
public int getPosition() {
return position;
}
@Nullable
@Override
public Long getSelectionKey() {
return key;
}
}
static class CustomItemKeyProvider extends ItemKeyProvider<Long>{
protected CustomItemKeyProvider() {
super(SCOPE_CACHED);
}
@Nullable
@Override
public Long getKey(int position) {
return (long) position;
}
@Override
public int getPosition(@NonNull Long key) {
return Math.toIntExact(key);
}
}
}
| [
"[email protected]"
] | |
006c7dba561a44e0a3fd61c5f9ffb646c6d71af0 | eb01c17cee324cc1441aa6e872da946dc074eb11 | /src/main/java/Trama.java | 6ef024881ef1b8c1215e754942cb537035ad6223 | [] | no_license | gonzamandarino/QMP_02 | e730460f89c0b879e8e8ee1383ebd188b95d0674 | e339727c5a33313cef2b1ec18195dbea669d2dc3 | refs/heads/main | 2023-05-06T04:28:32.201667 | 2021-05-28T02:52:55 | 2021-05-28T02:52:55 | 362,199,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java | enum Trama {
LISA, RAYADA, CUADROS, ESTAMPADO
}
| [
"[email protected]"
] | |
808b20be2fe8215366dd82bbdb9ecb75f9053a67 | c7f6170689c11bd1daa1b038a32b1c84f4cc1785 | /module-simple/src/main/java/domainapp/modules/project/fixture/ProjectBuilder.java | df6b2aa305b298ef12b44c9db14cb5288a009a68 | [
"Apache-2.0"
] | permissive | johandoornenbal/proplannio | 35582434f1b85d18e04e5278b035ce7471000aa7 | 2afb78af9e7c1651eeee961cc8b2d64b78c75cf7 | refs/heads/master | 2020-09-16T22:33:03.490299 | 2020-04-09T10:54:25 | 2020-04-09T10:54:25 | 223,905,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,935 | java | package domainapp.modules.project.fixture;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import org.apache.isis.applib.services.factory.FactoryService;
import org.apache.isis.testing.fixtures.applib.fixturescripts.BuilderScriptWithResult;
import domainapp.modules.project.actions.Project_addProduct;
import domainapp.modules.project.dom.Product;
import domainapp.modules.project.dom.Products;
import domainapp.modules.project.dom.Project;
import domainapp.modules.project.dom.Projects;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
@Accessors(chain = true)
public class ProjectBuilder extends BuilderScriptWithResult<Project> {
@Getter @Setter
private String name;
@Getter @Setter
private List<Project_persona.ProductSpec> productSpecs = new ArrayList<>();
@Override
protected Project buildResult(final ExecutionContext ec) {
checkParam("name", ec, String.class);
checkParam("productSpecs", ec, List.class);
final Project project = wrap(projects).create(name);
productSpecs.forEach(ps->{
Product parentProduct = null;
if (ps.getParentReference()!=null){
parentProduct = project.getProducts().stream()
.filter(p -> p.getReference().equals(ps.getParentReference())).findFirst().orElse(null);
}
final Product product = products.create(ps.getReference(), ps.getName(), project, parentProduct);
if (ps.getDeadline()!=null){
product.createDeadline(ps.getDeadline());
}
if (ps.getEffortInWorkingDays()!=null){
product.createEffort(ps.getEffortInWorkingDays());
}
});
return project;
}
// -- DEPENDENCIES
@Inject Projects projects;
@Inject Products products;
}
| [
"[email protected]"
] | |
ffee5f1cbbc46cc3e06ac242d0941a22927a24b6 | 21dbe9f22562e91f717582fc9e95112e75ab003f | /app/src/main/java/it/tiwiz/whatsong/intents/EmptyIntent.java | bbaa2cdf7782559ce22919b8955c47119626fc82 | [
"MIT"
] | permissive | tiwiz/WhatSong | 97012c69472160b53f650888d01bcb79cfed83e7 | 8c295e1d49a1f595567aa14956ca8cdd64a40f5e | refs/heads/master | 2020-05-16T22:24:25.910457 | 2015-06-11T15:38:28 | 2015-06-11T15:38:28 | 37,154,952 | 18 | 1 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package it.tiwiz.whatsong.intents;
import android.content.Intent;
import android.support.annotation.Nullable;
/**
* This is the default implementation of the {@link MusicAppIntent} Interface
*/
public class EmptyIntent implements MusicAppIntent {
@Override
@Nullable
public Intent getInstance() {
return null;
}
}
| [
"[email protected]"
] | |
bb37a5bd222f56b8e6f8752efe88d66648147486 | 019d4238d5571ecd66668e3e3ab8ed2220d9c0a5 | /app/src/main/java/rs/pedjaapps/moviewallpapers/fragment/PopularFragment.java | 79cb92ac55fb2bdc028c65734f076fa56ea1ecad | [] | no_license | duchien85/TV-Wallpapers | e85edaa25b6e8c3aafd6dfc3a8a474c3405ad792 | fc89977244b7a93072faafcb9dd81168d7a1b46c | refs/heads/master | 2020-05-17T16:25:53.909501 | 2017-10-05T15:00:38 | 2017-10-05T15:00:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,702 | java | package rs.pedjaapps.moviewallpapers.fragment;
import org.skynetsoftware.dataloader.DataProvider;
import org.skynetsoftware.snet.Request;
import java.util.List;
import rs.pedjaapps.moviewallpapers.model.Page;
import rs.pedjaapps.moviewallpapers.model.ShowPhoto;
import rs.pedjaapps.moviewallpapers.network.NetworkDataProvider;
/**
* Copyright (c) 2016 "Predrag Čokulov,"
* pedjaapps [https://pedjaapps.net]
* <p>
* This file is part of MovieWallpapers.
* <p>
* MovieWallpapers 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.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
public class PopularFragment extends PhotoGridFragment
{
@Override
protected List<DataProvider<Page<ShowPhoto>>> getAdditionalProviders()
{
return null;
}
@Override
protected Request getRequest()
{
Request request = new Request(Request.Method.GET);
request.addUrlPart("photos").addUrlPart("popular");
request.addParam("with_show", String.valueOf(true));
return request;
}
@Override
protected int getRequestCode()
{
return NetworkDataProvider.REQUEST_CODE_SHOWS_PHOTOS;
}
}
| [
"[email protected]"
] | |
e9658e32bc95e73f94af221ee07c4819d5ffe8a3 | e2da0a2ad716cb7747d15467e52c1959d505c457 | /jeesite-data/jeesite-data-provider/src/main/java/com/fsnip/jg/modules/cms/utils/CmsUtils.java | ae5fff3457935c5be44444eb5df9ed5df03d41d7 | [
"Apache-2.0"
] | permissive | waile23/jeesite-parent | 5b217ec545075adc9c4a315fa563d50fc0437e99 | 2bb2be6f00c0a24d38415c234392d93399a5b181 | refs/heads/master | 2020-12-03T03:52:04.689602 | 2017-06-29T18:40:42 | 2017-06-29T18:40:42 | 95,783,760 | 0 | 0 | null | 2017-06-29T14:02:39 | 2017-06-29T14:02:39 | null | UTF-8 | Java | false | false | 10,618 | java | ///**
// * Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
// */
//package com.fsnip.jg.modules.cms.utils;
//
//import com.fsnip.jg.common.config.Global;
//import com.fsnip.jg.common.mapper.JsonMapper;
//import com.fsnip.jg.common.persistence.Page;
//import com.fsnip.jg.common.utils.CacheUtils;
//import com.fsnip.jg.common.utils.SpringContextHolder;
//import com.fsnip.jg.common.utils.StringUtils;
//import com.fsnip.jg.modules.cms.entity.Article;
//import com.fsnip.jg.modules.cms.entity.Category;
//import com.fsnip.jg.modules.cms.entity.Link;
//import com.fsnip.jg.modules.cms.entity.Site;
//import com.fsnip.jg.modules.cms.service.ArticleService;
//import com.fsnip.jg.modules.cms.service.CategoryService;
//import com.fsnip.jg.modules.cms.service.LinkService;
//import com.fsnip.jg.modules.cms.service.SiteService;
//import com.google.common.collect.Lists;
//import org.springframework.ui.Model;
//
//import javax.servlet.ServletContext;
//import java.util.Collections;
//import java.util.List;
//import java.util.Map;
//
///**
// * 内容管理工具类
// * @author ThinkGem
// * @version 2013-5-29
// */
//public class CmsUtils {
//
// private static SiteService siteService = SpringContextHolder.getBean(SiteService.class);
// private static CategoryService categoryService = SpringContextHolder.getBean(CategoryService.class);
// private static ArticleService articleService = SpringContextHolder.getBean(ArticleService.class);
// private static LinkService linkService = SpringContextHolder.getBean(LinkService.class);
// private static ServletContext context = SpringContextHolder.getBean(ServletContext.class);
//
// private static final String CMS_CACHE = "cmsCache";
//
// /**
// * 获得站点列表
// */
// public static List<Site> getSiteList(){
// @SuppressWarnings("unchecked")
// List<Site> siteList = (List<Site>) CacheUtils.get(CMS_CACHE, "siteList");
// if (siteList == null){
// Page<Site> page = new Page<Site>(1, -1);
// page = siteService.findPage(page, new Site());
// siteList = page.getList();
// CacheUtils.put(CMS_CACHE, "siteList", siteList);
// }
// return siteList;
// }
//
// /**
// * 获得站点信息
// * @param siteId 站点编号
// */
// public static Site getSite(String siteId){
// String id = "1";
// if (StringUtils.isNotBlank(siteId)){
// id = siteId;
// }
// for (Site site : getSiteList()){
// if (site.getId().equals(id)){
// return site;
// }
// }
// return new Site(id);
// }
//
// /**
// * 获得主导航列表
// * @param siteId 站点编号
// */
// public static List<Category> getMainNavList(String siteId){
// @SuppressWarnings("unchecked")
// List<Category> mainNavList = (List<Category>) CacheUtils.get(CMS_CACHE, "mainNavList_"+siteId);
// if (mainNavList == null){
// Category category = new Category();
// category.setSite(new Site(siteId));
// category.setParent(new Category("1"));
// category.setInMenu(Global.SHOW);
// Page<Category> page = new Page<Category>(1, -1);
// page = categoryService.find(page, category);
// mainNavList = page.getList();
// CacheUtils.put(CMS_CACHE, "mainNavList_"+siteId, mainNavList);
// }
// return mainNavList;
// }
//
// /**
// * 获取栏目
// * @param categoryId 栏目编号
// * @return
// */
// public static Category getCategory(String categoryId){
// return categoryService.get(categoryId);
// }
//
// /**
// * 获得栏目列表
// * @param siteId 站点编号
// * @param parentId 分类父编号
// * @param number 获取数目
// * @param param 预留参数,例: key1:'value1', key2:'value2' ...
// */
// public static List<Category> getCategoryList(String siteId, String parentId, int number, String param){
// Page<Category> page = new Page<Category>(1, number, -1);
// Category category = new Category();
// category.setSite(new Site(siteId));
// category.setParent(new Category(parentId));
// if (StringUtils.isNotBlank(param)){
// @SuppressWarnings({ "unused", "rawtypes" })
// Map map = JsonMapper.getInstance().fromJson("{"+param+"}", Map.class);
// }
// page = categoryService.find(page, category);
// return page.getList();
// }
//
// /**
// * 获取栏目
// * @param categoryIds 栏目编号
// * @return
// */
// public static List<Category> getCategoryListByIds(String categoryIds){
// return categoryService.findByIds(categoryIds);
// }
//
// /**
// * 获取文章
// * @param articleId 文章编号
// * @return
// */
// public static Article getArticle(String articleId){
// return articleService.get(articleId);
// }
//
// /**
// * 获取文章列表
// * @param siteId 站点编号
// * @param categoryId 分类编号
// * @param number 获取数目
// * @param param 预留参数,例: key1:'value1', key2:'value2' ...
// * posid 推荐位(1:首页焦点图;2:栏目页文章推荐;)
// * image 文章图片(1:有图片的文章)
// * orderBy 排序字符串
// * @return
// * ${fnc:getArticleList(category.site.id, category.id, not empty pageSize?pageSize:8, 'posid:2, orderBy: \"hits desc\"')}"
// */
// public static List<Article> getArticleList(String siteId, String categoryId, int number, String param){
// Page<Article> page = new Page<Article>(1, number, -1);
// Category category = new Category(categoryId, new Site(siteId));
// category.setParentIds(categoryId);
// Article article = new Article(category);
// if (StringUtils.isNotBlank(param)){
// @SuppressWarnings({ "rawtypes" })
// Map map = JsonMapper.getInstance().fromJson("{"+param+"}", Map.class);
// if (new Integer(1).equals(map.get("posid")) || new Integer(2).equals(map.get("posid"))){
// article.setPosid(String.valueOf(map.get("posid")));
// }
// if (new Integer(1).equals(map.get("image"))){
// article.setImage(Global.YES);
// }
// if (StringUtils.isNotBlank((String)map.get("orderBy"))){
// page.setOrderBy((String)map.get("orderBy"));
// }
// }
// article.setDelFlag(Article.DEL_FLAG_NORMAL);
// page = articleService.findPage(page, article, false);
// return page.getList();
// }
//
// /**
// * 获取链接
// * @param linkId 文章编号
// * @return
// */
// public static Link getLink(String linkId){
// return linkService.get(linkId);
// }
//
// /**
// * 获取链接列表
// * @param siteId 站点编号
// * @param categoryId 分类编号
// * @param number 获取数目
// * @param param 预留参数,例: key1:'value1', key2:'value2' ...
// * @return
// */
// public static List<Link> getLinkList(String siteId, String categoryId, int number, String param){
// Page<Link> page = new Page<Link>(1, number, -1);
// Link link = new Link(new Category(categoryId, new Site(siteId)));
// if (StringUtils.isNotBlank(param)){
// @SuppressWarnings({ "unused", "rawtypes" })
// Map map = JsonMapper.getInstance().fromJson("{"+param+"}", Map.class);
// }
// link.setDelFlag(Link.DEL_FLAG_NORMAL);
// page = linkService.findPage(page, link, false);
// return page.getList();
// }
//
// // ============== Cms Cache ==============
//
// public static Object getCache(String key) {
// return CacheUtils.get(CMS_CACHE, key);
// }
//
// public static void putCache(String key, Object value) {
// CacheUtils.put(CMS_CACHE, key, value);
// }
//
// public static void removeCache(String key) {
// CacheUtils.remove(CMS_CACHE, key);
// }
//
// /**
// * 获得文章动态URL地址
// * @param article
// * @return url
// */
// public static String getUrlDynamic(Article article) {
// if(StringUtils.isNotBlank(article.getLink())){
// return article.getLink();
// }
// StringBuilder str = new StringBuilder();
// str.append(context.getContextPath()).append(Global.getFrontPath());
// str.append("/view-").append(article.getCategory().getId()).append("-").append(article.getId()).append(Global.getUrlSuffix());
// return str.toString();
// }
//
// /**
// * 获得栏目动态URL地址
// * @param category
// * @return url
// */
// public static String getUrlDynamic(Category category) {
// if(StringUtils.isNotBlank(category.getHref())){
// if(!category.getHref().contains("://")){
// return context.getContextPath()+ Global.getFrontPath()+category.getHref();
// }else{
// return category.getHref();
// }
// }
// StringBuilder str = new StringBuilder();
// str.append(context.getContextPath()).append(Global.getFrontPath());
// str.append("/list-").append(category.getId()).append(Global.getUrlSuffix());
// return str.toString();
// }
//
// /**
// * 从图片地址中去除ContextPath地址
// * @param src
// * @return src
// */
// public static String formatImageSrcToDb(String src) {
// if(StringUtils.isBlank(src)) return src;
// if(src.startsWith(context.getContextPath() + "/userfiles")){
// return src.substring(context.getContextPath().length());
// }else{
// return src;
// }
// }
//
// /**
// * 从图片地址中加入ContextPath地址
// * @param src
// * @return src
// */
// public static String formatImageSrcToWeb(String src) {
// if(StringUtils.isBlank(src)) return src;
// if(src.startsWith(context.getContextPath() + "/userfiles")){
// return src;
// }else{
// return context.getContextPath()+src;
// }
// }
//
// public static void addViewConfigAttribute(Model model, String param){
// if(StringUtils.isNotBlank(param)){
// @SuppressWarnings("rawtypes")
// Map map = JsonMapper.getInstance().fromJson(param, Map.class);
// if(map != null){
// for(Object o : map.keySet()){
// model.addAttribute("viewConfig_"+o.toString(), map.get(o));
// }
// }
// }
// }
//
// public static void addViewConfigAttribute(Model model, Category category){
// List<Category> categoryList = Lists.newArrayList();
// Category c = category;
// boolean goon = true;
// do{
// if(c.getParent() == null || c.getParent().isRoot()){
// goon = false;
// }
// categoryList.add(c);
// c = c.getParent();
// }while(goon);
// Collections.reverse(categoryList);
// for(Category ca : categoryList){
// addViewConfigAttribute(model, ca.getViewConfig());
// }
// }
//} | [
"[email protected]"
] | |
e96426d20971ddabe098f9a7ebe63fe6d59ce487 | 7d5e557ce546b92ea9d1943f920edb5150578bb5 | /src/pk2Variables/Ex1FirstExample.java | 900b6895a2ec15c8a2a222eb92201efeb18a9207 | [] | no_license | tejaswidurga/JavaPractiseExamples | c1bd1e9a68289a177a8dc09cd0bd5baef26c6e4c | b51f88cc604c45e9653169ae6f661edce592e586 | refs/heads/master | 2021-01-06T16:38:57.800987 | 2020-02-25T09:53:41 | 2020-02-25T09:53:41 | 241,401,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package pk2Variables;
public class Ex1FirstExample {
public static void main(String[] args) {
int a = 10;
int b = 20;
char c1 = 'j';
System.out.println("a value is "+a);
System.out.println("b value is "+b);
System.out.println("C1 is "+c1);
int c = a * b;
System.out.println("c value is "+c);
}
}
| [
"[email protected]"
] | |
cd94f6434f9ccd8ef4cd972bcd37ffbd27d5b639 | ab5250b122e57bacb0f58422b38b8e73ef265c5c | /src/main/java/com/luanvan/dto/request/RegisterDTO.java | 42cd565045026fb13877cf8b65255c78165f7a70 | [] | no_license | nmikz1997/luanvan_banhang | c8eb3916196931ea1e33359396dded45c23a1f66 | 5902140e0d2f9ae7ea30e17ab098cea6b516f6b7 | refs/heads/master | 2020-07-05T20:03:00.599993 | 2019-12-06T10:22:15 | 2019-12-06T10:22:15 | 202,758,118 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.luanvan.dto.request;
import javax.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class RegisterDTO {
@Valid
private CreateUserDTO user;
@Valid
private CreateCustomerDTO customer;
}
| [
"[email protected]"
] | |
6959a5f85ffc16d8eb6916da54d853f1685c6da0 | 4d34aa8c67a265b3e644101ea126eaed57835053 | /src/main/java/com/service/BaseService.java | b342ce2565c6854f176e86143c171ecc9f3822b5 | [] | no_license | 1026957152/coalpit-server | 354eda1d72a3cb6b801b718493bc7b3ee989e92e | 99f1654308daf94bcd5817719325a3dfff5853ee | refs/heads/master | 2021-05-09T06:35:23.853649 | 2018-01-29T05:09:20 | 2018-01-29T05:09:20 | 119,334,608 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 101 | java | package com.service;
/**
* Created by Peter Xu on 01/05/2015.
*/
public interface BaseService {
}
| [
"[email protected]"
] | |
4fe4fea8d7901e333d7fe05b2a7ca81856a24ad5 | d9e2f80bd3f5bd80bfcc6a8fce0c51ec2d90c31d | /src/test/java/org/loadtest4j/factory/DriverFactorySupplierTest.java | cbfd587e2d94552e66e877e342572c14bc4d508b | [
"MIT"
] | permissive | loadtest4j/loadtest4j | a8347c868cd051c8caeda18d460ff2d46e5f5cca | 699d9fce7c639fbbac8510738e4e13fff09b0b03 | refs/heads/master | 2022-10-20T03:59:05.953800 | 2022-10-10T19:47:09 | 2022-10-10T19:47:09 | 128,529,526 | 11 | 2 | MIT | 2022-10-10T19:47:10 | 2018-04-07T13:12:24 | Java | UTF-8 | Java | false | false | 1,898 | java | package org.loadtest4j.factory;
import org.loadtest4j.LoadTesterException;
import org.loadtest4j.driver.DriverFactory;
import org.loadtest4j.junit.UnitTest;
import org.loadtest4j.test_utils.NopDriverFactory;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.Collections;
import static org.assertj.core.api.Assertions.assertThat;
@Category(UnitTest.class)
public class DriverFactorySupplierTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void shouldSupplyFactory() {
final Iterable<DriverFactory> singleFinder = Collections.singletonList(new NopDriverFactory());
final DriverFactorySupplier supplier = new DriverFactorySupplier(singleFinder);
final DriverFactory factory = supplier.get();
assertThat(factory).isInstanceOf(NopDriverFactory.class);
}
@Test
public void shouldThrowExceptionWhenNoFactoriesAreFound() {
final Iterable<DriverFactory> emptyFinder = Collections.emptyList();
final DriverFactorySupplier supplier = new DriverFactorySupplier(emptyFinder);
thrown.expect(LoadTesterException.class);
thrown.expectMessage("No load test drivers were found on the classpath. Please add one to your project.");
supplier.get();
}
@Test
public void shouldThrowExceptionWhenMultipleFactoriesAreFound() {
final Iterable<DriverFactory> duplicateFinder = Arrays.asList(new NopDriverFactory(), new NopDriverFactory());
final DriverFactorySupplier supplier = new DriverFactorySupplier(duplicateFinder);
thrown.expect(LoadTesterException.class);
thrown.expectMessage("Only 1 load test driver may be on the classpath at a time, but 2 were found.");
supplier.get();
}
}
| [
"[email protected]"
] | |
eb8a4edb4ed540e570cc3a1d2bdef56284f5d969 | a84913743e8605b98a9f8590771a4d4582a76924 | /app/src/main/java/com/example/nctai_trading/bithumb/bithumbConfigResponse.java | b51c52d2696f9501b74555d2d0c4c8db0125910f | [
"Apache-2.0"
] | permissive | marcellinamichie291/NCT-AndroidGUI | 467f5ab22ad618e9f7c907d86312b6b12b0e368f | 6466ccd9bf24697f24ea5652eeb4de83cc4b9191 | refs/heads/master | 2023-05-14T11:19:45.201708 | 2021-06-09T11:32:22 | 2021-06-09T11:32:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | package com.example.nctai_trading.bithumb;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class bithumbConfigResponse {
@SerializedName("coinConfig")
@Expose
private List<bithumbConfigCoinConfig> coinConfig = null;
@SerializedName("contractConfig")
@Expose
private List<bithumbConfigContractConfig> contractConfig = null;
@SerializedName("spotConfig")
@Expose
private List<bithumbConfigResponseDetails> spotConfig = null;
public List<bithumbConfigCoinConfig> getCoinConfig() {
return coinConfig;
}
public void setCoinConfig(List<bithumbConfigCoinConfig> coinConfig) {
this.coinConfig = coinConfig;
}
public List<bithumbConfigContractConfig> getContractConfig() {
return contractConfig;
}
public void setContractConfig(List<bithumbConfigContractConfig> contractConfig) {
this.contractConfig = contractConfig;
}
public List<bithumbConfigResponseDetails> getSpotConfig() {
return spotConfig;
}
public void setSpotConfig(List<bithumbConfigResponseDetails> spotConfig) {
this.spotConfig = spotConfig;
}
}
| [
"[email protected]"
] | |
5d01ac728cc37daa580801a0a0585d02d4ee020d | 7d5941960eef64d2b69e8b26d783b295835d9568 | /Ultima_Versão_Trabalho_Java/src/caixaDeTexto/somenteLetra.java | 2dda6bd66ad91d0f92468314025df49d74bd65e5 | [] | no_license | ItaloGus/Java | ae46cbeb5e09d91ef5ca3b686d30442f9db507bc | 2caf40dc99d4449e327912688a09ac4530eca17e | refs/heads/master | 2021-07-03T13:50:23.593191 | 2019-12-10T20:56:26 | 2019-12-10T20:56:26 | 187,312,050 | 0 | 0 | null | 2020-10-13T18:07:35 | 2019-05-18T04:00:15 | Java | UTF-8 | Java | false | false | 773 | 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 caixaDeTexto;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
/**
*
* @author Italo
*/
public class somenteLetra extends PlainDocument
{
@Override
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException{
int tamanho = (this.getLength() + str.length());
if(tamanho <= 40){
super.insertString(offs, str.replaceAll("[^aA -zZ ]", ""), a);
}else
{
super.insertString(offs, str.replaceAll("[aA0-zZ9]", ""), a);
}
}
}
| [
"[email protected]"
] | |
e7090abffb32ed6cf853f666f3e8b487a36b2137 | 60568c532630f3aafe779b687a2b75bc95902deb | /app/src/main/java/com/muhammad_adi_yusuf/projeksubmission2/adapter/AdapterRview.java | fc27d8f62cbadd7ece41cc88320ed84a0bb16929 | [] | no_license | kazuiains/ProjekSubmission2-Movie_Catalogue | 14ad56d5c57ee8649bfb70f0066f6ba55c6c3188 | 8a06c50c7e82779147edea8d2fd897f713c3cfbf | refs/heads/master | 2020-07-03T10:09:58.102146 | 2019-08-12T06:57:21 | 2019-08-12T06:57:21 | 201,875,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,047 | java | package com.muhammad_adi_yusuf.projeksubmission2.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.muhammad_adi_yusuf.projeksubmission2.R;
import com.muhammad_adi_yusuf.projeksubmission2.model.DataList;
import java.util.ArrayList;
public class AdapterRview extends RecyclerView.Adapter<AdapterRview.gViewholder> {
private Context conText;
private ArrayList<DataList> dataList;
public AdapterRview(Context conText, ArrayList<DataList> dataList) {
this.conText = conText;
this.dataList = dataList;
}
@NonNull
@Override
public gViewholder onCreateViewHolder(@NonNull ViewGroup paRent, int viewType) {
View itemRow = LayoutInflater.from(conText).inflate(R.layout.listitem_rv, paRent, false);
return new gViewholder(itemRow);
}
@Override
public void onBindViewHolder(@NonNull gViewholder ghoLder, int poSition) {
DataList dataPosition = dataList.get(poSition);
ghoLder.dataTitle.setText(dataPosition.getDataTitle());
ghoLder.dataRelease.setText(dataPosition.getDataRelease());
ghoLder.dataRate.setText(dataPosition.getDataRate());
ghoLder.dataImage.setImageResource(dataPosition.getDataImage());
}
@Override
public int getItemCount() {
return dataList.size();
}
public class gViewholder extends RecyclerView.ViewHolder {
ImageView dataImage;
TextView dataTitle, dataRelease, dataRate;
public gViewholder(@NonNull View itemView) {
super(itemView);
dataImage = itemView.findViewById(R.id.iv_image);
dataTitle = itemView.findViewById(R.id.tv_title);
dataRelease = itemView.findViewById(R.id.tv_release);
dataRate = itemView.findViewById(R.id.tv_rating);
}
}
}
| [
"[email protected]"
] | |
fae4153bcb414cd6538b05b84d28f2c39d19c088 | 6400224b2ff4797f0ad7283685056ff5e50004d4 | /erwin-cloud-business/erwin-cloud-storage/src/main/java/com/fengwenyi/example/erwincloudstorage/config/MyBatisPlusConfiguration.java | 9b416d9ddb482cb88245edfdb523a072caddd88a | [] | no_license | fengwenyi/erwin-cloud-example | c8d34ee36c9bede4cca8ebc598b2a401dc738307 | bed01693c67174642b52a37b51c9e6a014a21b60 | refs/heads/master | 2023-03-19T18:09:16.672238 | 2021-03-10T06:25:22 | 2021-03-10T06:25:22 | 336,506,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | package com.fengwenyi.example.erwincloudstorage.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Erwin Feng
* @since 2021-03-08
*/
@Configuration
@MapperScan("com.fengwenyi.example.erwincloudstorage.dao")
public class MyBatisPlusConfiguration {
/**
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}
| [
"[email protected]"
] | |
db00d5c25dd5611044e566ab81ceb6cc5235179a | 3d7435ac8c62281c8fc902192917a8de4ad7a4b5 | /backend/src/main/java/com/example/demo/security/oauth2/user/OAuth2UserInfoFactory.java | d839f3ba800aea073cd06e0c549fd565eb7578de | [] | no_license | nicolebradleey/Auctionista | 81ec173e1e7307777464f4daea33378792b19865 | f8c5820174ce0ecd40c2a43b33dec99099368707 | refs/heads/main | 2023-09-04T20:17:55.173834 | 2021-11-17T08:46:04 | 2021-11-17T08:46:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 785 | java | package com.example.demo.security.oauth2.user;
import com.example.demo.entities.AuthProvider;
import com.example.demo.exception.OAuth2AuthenticationProcessingException;
import java.util.Map;
public class OAuth2UserInfoFactory {
public static OAuth2UserInfo getOAuth2UserInfo(String registrationId, Map<String, Object> attributes) {
if(registrationId.equalsIgnoreCase(AuthProvider.google.toString())) {
return new GoogleOAuth2UserInfo(attributes);
} else if (registrationId.equalsIgnoreCase(AuthProvider.facebook.toString())) {
return new FacebookOAuth2UserInfo(attributes);
} else {
throw new OAuth2AuthenticationProcessingException("Sorry! Login with " + registrationId + " is not supported yet.");
}
}
} | [
"[email protected]"
] | |
34a4449bd6a2aef0e5e8224ab2e63457d0368cee | 614030ce632f662bd3b055063bba9ec90fe7c6ac | /app/src/main/java/com/mycampusdock/dock/utils/GlideHelperUpscale.java | 5d88b72a334b2435aa1f92729f6cfb89e9cc909d | [] | no_license | ogil7190/android-LookOut | 2a5afa3a6114e96a2dda06c5a5c8f10b8daa1994 | a956db499f1320f3236723b56fcadd87b3b6086a | refs/heads/master | 2021-09-16T07:00:51.679921 | 2018-06-18T07:06:23 | 2018-06-18T07:06:23 | 137,719,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.mycampusdock.dock.utils;
import android.content.Context;
import android.graphics.Bitmap;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
public class GlideHelperUpscale extends CenterCrop {
public GlideHelperUpscale(BitmapPool bitmapPool) {
}
public GlideHelperUpscale(Context context) {
}
@Override
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
if (toTransform.getHeight() > outHeight || toTransform.getWidth() > outWidth) {
return super.transform(pool, toTransform, outWidth, outHeight);
} else {
return toTransform;
}
}
} | [
"[email protected]"
] | |
78c20fa474c406ff8f816e746f225c98f83c28da | 61602d4b976db2084059453edeafe63865f96ec5 | /org/greenrobot/greendao/rx/RxDao$7.java | fcbdb8d49f3c618dc4e0061e9f527d084ddf5382 | [] | no_license | ZoranLi/thunder | 9d18fd0a0ec0a5bb3b3f920f9413c1ace2beb4d0 | 0778679ef03ba1103b1d9d9a626c8449b19be14b | refs/heads/master | 2020-03-20T23:29:27.131636 | 2018-06-19T06:43:26 | 2018-06-19T06:43:26 | 137,848,886 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package org.greenrobot.greendao.rx;
import java.util.concurrent.Callable;
class RxDao$7 implements Callable<T> {
final /* synthetic */ RxDao this$0;
final /* synthetic */ Object val$entity;
RxDao$7(RxDao rxDao, Object obj) {
this.this$0 = rxDao;
this.val$entity = obj;
}
public T call() throws Exception {
RxDao.access$000(this.this$0).insertOrReplace(this.val$entity);
return this.val$entity;
}
}
| [
"[email protected]"
] | |
8b1b5d23d6f259fed83a226245159a79cbcefef2 | 9b19b02129c18c946295e897bc99dd4b8778638f | /app/src/main/java/com/yjhh/ppwbusiness/views/cui/AlertDialogFactory.java | 6055d2d08d901207c8b6fe5660f59557e738077d | [] | no_license | majian1234554321/ppwbusiness | 253982cff2ecf1c0e98a51d9748de1040fbe2e32 | 3a93167bdcb0813a7db0f8e74bfbad1d7b4a6f37 | refs/heads/master | 2020-04-06T18:18:23.309190 | 2019-02-15T02:54:53 | 2019-02-15T02:54:53 | 157,693,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,135 | java | package com.yjhh.ppwbusiness.views.cui;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.text.TextUtils;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.yjhh.ppwbusiness.R;
import java.util.List;
/**
* AlertDialogFactory
* Created by D on 2017/4/29.
*/
public class AlertDialogFactory {
private Context context;
private AlertDialogFactory(Context context) {
this.context = context;
}
public static AlertDialogFactory createFactory(Context context) {
return new AlertDialogFactory(context);
}
/**
* LoadingDialog
*/
public AlertDialog getLoadingDialog() {
return getLoadingDialog(null);
}
/**
* LoadingDialog
*/
public AlertDialog getLoadingDialog(String text) {
final AlertDialog dlg = new AlertDialog
.Builder(new ContextThemeWrapper(context, R.style.lib_pub_dialog_style))
.create();
if (context instanceof Activity && !((Activity) context).isFinishing()) {
dlg.show();
}
dlg.setContentView(R.layout.lib_pub_dialog_loading);
TextView tips = (TextView) dlg.findViewById(R.id.tv_tips);
if (text != null) {
tips.setText(text);
}
return dlg;
}
public AlertDialog getAlertDialog(String title, String content, String btnOkText, String btnCancelText, final OnClickListener btnOkListener, final OnClickListener btnCancelListener) {
final AlertDialog dlg = new AlertDialog
.Builder(new ContextThemeWrapper(context, R.style.lib_pub_dialog_style))
.create();
if (context instanceof Activity && !((Activity) context).isFinishing()) {
dlg.show();
}
dlg.setContentView(R.layout.lib_pub_dialog);
TextView tv_title = (TextView) dlg.findViewById(R.id.tv_title);
tv_title.setVisibility(!TextUtils.isEmpty(title) ? View.VISIBLE : View.GONE);
tv_title.setText(!TextUtils.isEmpty(title) ? title : "");
TextView tv_content = (TextView) dlg.findViewById(R.id.tv_content);
tv_content.setVisibility(!TextUtils.isEmpty(content) ? View.VISIBLE : View.GONE);
tv_content.setText(!TextUtils.isEmpty(content) ? content : "");
TextView btnOk = dlg.findViewById(R.id.btn_ok);
btnOk.setText(!TextUtils.isEmpty(btnOkText) ? btnOkText : "确定");
TextView btnCancel = dlg.findViewById(R.id.btn_cancel);
btnCancel.setText(!TextUtils.isEmpty(btnCancelText) ? btnCancelText : "");
btnCancel.setVisibility(!TextUtils.isEmpty(btnCancelText) ? View.VISIBLE : View.GONE);
View lineBottom = dlg.findViewById(R.id.line_bottom);
lineBottom.setVisibility(!TextUtils.isEmpty(btnCancelText) ? View.VISIBLE : View.GONE);
btnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dlg.dismiss();
if (btnOkListener != null) {
btnOkListener.onClick(dlg, v);
}
}
});
btnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dlg.dismiss();
if (btnCancelListener != null) {
btnCancelListener.onClick(dlg, v);
}
}
});
return dlg;
}
public BottomVerSheetDialog getBottomVerDialog(List<BottomVerSheetDialog.Bean> datas,
AbsSheetDialog.OnItemClickListener<BottomVerSheetDialog.Bean> listener) {
return getBottomVerDialog(null, datas, listener);
}
public BottomVerSheetDialog getBottomVerDialog(String title, List<BottomVerSheetDialog.Bean> datas,
AbsSheetDialog.OnItemClickListener<BottomVerSheetDialog.Bean> listener) {
BottomVerSheetDialog dialog = new BottomVerSheetDialog(context, title, datas);
dialog.setOnItemClickListener(listener);
dialog.show();
return dialog;
}
/*public AlertSubDialog getAlertSubDialog(String title, String content, String subTips, boolean isChecked, AlertSubDialog.OnCheckListener listener) {
AlertSubDialog dialog = new AlertSubDialog(context, title, content, subTips, isChecked);
dialog.setOnCheckListener(listener);
dialog.show();
return dialog;
}
public EditDialog getEditDialog(String title, String content, EditDialog.OnEditListener listener) {
EditDialog dialog = new EditDialog(context, title, content);
dialog.setOnEditListener(listener);
dialog.show();
return dialog;
}
public InfoDialog getInfoDialog(String title, List<InfoDialog.Bean> datas) {
InfoDialog dialog = new InfoDialog(context, title, datas);
dialog.show();
return dialog;
}
public OperationDialog getOperationDialog(String title, List<OperationDialog.Bean> datas, AbsSheetDialog.OnItemClickListener listener) {
OperationDialog dialog = new OperationDialog(context, title, datas);
dialog.show();
return dialog;
}
public BottomHorSheetDialog getBottomHorDialog(String title, List<BottomHorSheetDialog.Bean> datas,
AbsSheetDialog.OnItemClickListener<BottomHorSheetDialog.Bean> listener) {
BottomHorSheetDialog dialog = new BottomHorSheetDialog(context, title, datas);
dialog.setOnItemClickListener(listener);
dialog.show();
return dialog;
}
public BottomShareSheetDialog getBottomShareDialog(String title, List<BottomShareSheetDialog.Bean> datas) {
BottomShareSheetDialog dialog = new BottomShareSheetDialog(context, title, datas);
dialog.show();
return dialog;
}*/
public interface OnClickListener {
void onClick(AlertDialog dlg, View v);
}
}
| [
"[email protected]"
] | |
7ca80273708802d0a78ba448437dad30793d4799 | d00be105055225808a242cd6bd8411b376c4f4e1 | /src/net/java/sip/communicator/util/launchutils/SipCommunicatorLock.java | ea8a6d4780073d6f68905aa838c9b5934222a7b8 | [] | no_license | zhiji6/sip-comm-jn | bae7d463353de91a5e95bfb4ea5bb85e42c7609c | 8259cf641bd4d868481c0ef4785a5ce75aac098d | refs/heads/master | 2020-04-29T02:52:02.743960 | 2010-11-08T19:48:29 | 2010-11-08T19:48:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,402 | java | /*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.util.launchutils;
import java.io.*;
import java.net.*;
import java.util.*;
import net.java.sip.communicator.launcher.*;
import net.java.sip.communicator.util.*;
/**
* This class is used to prevent from running multiple instances of SIP
* Communicator. The class binds a socket somewhere on the localhost domain and
* records its socket address in the SIP Communicator configuration directory.
*
* All following instances of SIP Communicator (and hence this class) will look
* for this record in the configuration directory and try to connect to the
* original instance through the socket address in there.
*
* @author Emil Ivov
*/
public class SipCommunicatorLock extends Thread
{
private static final Logger logger = Logger
.getLogger(SipCommunicatorLock.class);
/**
* Indicates that something went wrong. More information will probably be
* available in the console ... if anyone cares at all.
*/
public static final int LOCK_ERROR = 300;
/**
* Returned by the soft start method to indicate that we have successfully
* started and locked the configuration directory.
*/
public static final int SUCCESS = 0;
/**
* Returned by the soft start method to indicate that an instance of SIP
* Communicator has been already started and we should exit. This return
* code also indicates that all arguments were passed to that new instance.
*/
public static final int ALREADY_STARTED = 301;
/**
* The name of the file that we use to store the address and port that this
* lock is bound on.
*/
private static final String LOCK_FILE_NAME = ".lock";
/**
* The name of the property that we use to store the address that we bind on
* in this class.
*/
private static final String PNAME_LOCK_ADDRESS = "lockAddress";
/**
* The name of the property that we use to store the address that we bind on
* in this class.
*/
private static final String PNAME_LOCK_PORT = "lockPort";
/**
* The header preceding each of the arguments that we toss around between
* instances of SIP Communicator
*/
private static final String ARGUMENT = "Argument";
/**
* The name of the header that contains the number of arguments that we send
* from one instance to another.
*/
private static final String ARG_COUNT = "Arg-Count";
/**
* The name of the header that contains any error messages resulting from
* remote argument handling.
*/
private static final String ERROR_ARG = "ERROR";
/**
* The carriage return, line feed sequence (\r\n).
*/
private static final String CRLF = "\r\n";
/**
* The number of milliseconds that we should wait for a remote SC instance
* to come back to us.
*/
private long LOCK_COMMUNICATION_DELAY = 50;
/**
* The socket that we use for cross instance lock and communication.
*/
private ServerSocket instanceServerSocket = null;
/**
* Tries to lock the configuration directory. If lock-ing is not possible
* because a previous instance is already running, then it transmits the
* list of args to that running instance.
* <p>
* There are three possible outcomes of this method. 1. We lock
* successfully; 2. We fail to lock because another instance of SIP
* Communicator is already running; 3. We fail to lock for some unknown
* error. Each of these cases is represented by an error code returned as a
* result.
*
* @param args
* the array of arguments that we are to submit in case an
* instance of SIP Communicator has already been started.
*
* @return an error or success code indicating the outcome of the lock
* operation.
*/
public int tryLock(String[] args)
{
// first check whether we have a file.
File lockFile = getLockFile();
if (lockFile.exists())
{
InetSocketAddress lockAddress = readLockFile(lockFile);
if (lockAddress != null)
{
// we have a valid lockAddress and hence possibly an already
// running instance of SC. Try to communicate with it.
if (interInstanceConnect(lockAddress, args) == SUCCESS)
{
return ALREADY_STARTED;
}
}
// our lockFile is probably stale and left from a previous instance.
// or an instance that is still running but is not responding.
lockFile.delete();
}
// if we get here then this means that we should go for a real lock
// initialization
// create a new socket,
// right the bind address in the file
try
{
lockFile.getParentFile().mkdirs();
lockFile.createNewFile();
}
catch (IOException e)
{
logger.error("Failed to create lock file" + lockFile, e);
}
lockFile.deleteOnExit();
return lock(lockFile);
}
/**
* Locks the configuration directory by binding our lock socket and
* recording the lock file into the configuration directory. Returns SUCCESS
* if everything goes well and ERROR if something fails. This method does
* not return the ALREADY_RUNNING code as it is assumed that this has
* already been checked before calling this method.
*
* @param lockFile
* the file that we should use to lock the configuration
* directory.
*
* @return the SUCCESS or ERROR codes defined by this class.
*/
private int lock(File lockFile)
{
InetAddress lockAddress = getRandomBindAddress();
if (lockAddress == null)
{
return LOCK_ERROR;
}
int port = getRandomPortNumber();
InetSocketAddress serverSocketAddress = new InetSocketAddress(
lockAddress, port);
writeLockFile(lockFile, serverSocketAddress);
startLockServer(serverSocketAddress);
return SUCCESS;
}
/**
* Creates and binds a socket on <tt>lockAddress</tt> and then starts a
* <tt>LockServer</tt> instance so that we would start interacting with
* other instances of SIP Communicator that are trying to start.
*
* @return the <tt>ERROR</tt> code if something goes wrong and
* <tt>SUCCESS</tt> otherwise.
*/
private int startLockServer(InetSocketAddress localAddress)
{
try
{
// check config directory
instanceServerSocket = new ServerSocket();
}
catch (IOException exc)
{
// Just checked the impl and this doesn't seem to ever be thrown
// .... ignore ...
logger.error("Couldn't create server socket", exc);
return LOCK_ERROR;
}
try
{
instanceServerSocket.bind(localAddress, 16);// Why 16? 'cos I say
// so.
}
catch (IOException exc)
{
logger.error("Couldn't create server socket", exc);
return LOCK_ERROR;
}
LockServer lockServ = new LockServer(instanceServerSocket);
lockServ.start();
return SUCCESS;
}
/**
* Returns a randomly chosen socket address using a loopback interface (or
* another one in case the loopback is not available) that we should bind
* on.
*
* @return an InetAddress (most probably a loopback) that we can use to bind
* our semaphore socket on.
*/
private InetAddress getRandomBindAddress()
{
NetworkInterface loopback;
try
{
// find a loopback interface
Enumeration<NetworkInterface> interfaces;
try
{
interfaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException exc)
{
// I don't quite understand why this would happen ...
logger.error(
"Failed to obtain a list of the local interfaces.",
exc);
return null;
}
loopback = null;
while (interfaces.hasMoreElements())
{
NetworkInterface iface = interfaces.nextElement();
if (isLoopbackInterface(iface))
{
loopback = iface;
break;
}
}
// if we didn't find a loopback (unlikely but possible)
// return the first available interface on this machine
if (loopback == null)
{
loopback = NetworkInterface.getNetworkInterfaces()
.nextElement();
}
}
catch (SocketException exc)
{
// I don't quite understand what could possibly cause this ...
logger.error("Could not find the loopback interface", exc);
return null;
}
// get the first address on the loopback.
InetAddress addr = loopback.getInetAddresses().nextElement();
return addr;
}
/**
* Returns a random port number that we can use to bind a socket on.
*
* @return a random port number that we can use to bind a socket on.
*/
private int getRandomPortNumber()
{
return (int) (Math.random() * 64509) + 1025;
}
/**
* Parses the <tt>lockFile</tt> into a standard Properties Object and
* verifies it for completeness. The method also tries to validate the
* contents of <tt>lockFile</tt> and asserts presence of all properties
* mandated by this version.
*
* @param lockFile
* the file that we are to parse.
*
* @return the <tt>SocketAddress</tt> that we should use to communicate with
* a possibly already running version of SIP Communicator.
*/
private InetSocketAddress readLockFile(File lockFile)
{
Properties lockProperties = new Properties();
try
{
lockProperties.load(new FileInputStream(lockFile));
}
catch (Exception exc)
{
logger.error("Failed to read lock properties.", exc);
return null;
}
String lockAddressStr = lockProperties.getProperty(PNAME_LOCK_ADDRESS);
if (lockAddressStr == null)
{
logger.error("Lock file contains no lock address.");
return null;
}
String lockPort = lockProperties.getProperty(PNAME_LOCK_PORT);
if (lockPort == null)
{
logger.error("Lock file contains no lock port.");
return null;
}
InetAddress lockAddress = findLocalAddress(lockAddressStr);
if (lockAddress == null)
{
logger.error(lockAddressStr + " is not a valid local address.");
return null;
}
int port;
try
{
port = Integer.parseInt(lockPort);
}
catch (NumberFormatException exc)
{
logger.error(lockPort + " is not a valid port number.", exc);
return null;
}
InetSocketAddress lockSocketAddress = new InetSocketAddress(
lockAddress, port);
return lockSocketAddress;
}
/**
* Records our <tt>lockAddress</tt> into <tt>lockFile</tt> using the
* standard properties format.
*
* @param lockFile
* the file that we should store the address in.
* @param lockAddress
* the address that we have to record.
*
* @return <tt>SUCCESS</tt> upon success and <tt>ERROR</tt> if we fail to
* store the file.
*/
private int writeLockFile(File lockFile, InetSocketAddress lockAddress)
{
Properties lockProperties = new Properties();
lockProperties.setProperty(PNAME_LOCK_ADDRESS, lockAddress.getAddress()
.getHostAddress());
lockProperties.setProperty(PNAME_LOCK_PORT, Integer
.toString(lockAddress.getPort()));
try
{
lockProperties.store(new FileOutputStream(lockFile),
"SIP Communicator lock file. This file will be automatically"
+ "removed when execution of SIP Communicator terminates.");
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
logger.error("Failed to create lock file.", e);
return LOCK_ERROR;
}
return SUCCESS;
}
/**
* Returns a reference to the file that we should be using to lock SIP
* Communicator's home directory, whether it exists or not.
*
* @return a reference to the file that we should be using to lock SIP
* Communicator's home directory.
*/
private File getLockFile()
{
String homeDirLocation = System
.getProperty(SIPCommunicator.PNAME_SC_HOME_DIR_LOCATION);
String homeDirName = System
.getProperty(SIPCommunicator.PNAME_SC_HOME_DIR_NAME);
String fileSeparator = System.getProperty("file.separator");
String fullLockFileName = homeDirLocation + fileSeparator + homeDirName
+ fileSeparator + LOCK_FILE_NAME;
return new File(fullLockFileName);
}
/**
* Returns an <tt>InetAddress</tt> instance corresponding to
* <tt>addressStr</tt> or <tt>null</tt> if no such address exists on the
* local interfaces.
*
* @param addressStr
* the address string that we are trying to resolve into an
* <tt>InetAddress</tt>
*
* @return an <tt>InetAddress</tt> instance corresponding to
* <tt>addressStr</tt> or <tt>null</tt> if none of the local
* interfaces has such an address.
*/
private InetAddress findLocalAddress(String addressStr)
{
Enumeration<NetworkInterface> ifaces;
try
{
ifaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException exc)
{
logger.error(
"Could not extract the list of local intefcaces.",
exc);
return null;
}
// loop through local interfaces
while (ifaces.hasMoreElements())
{
NetworkInterface iface = ifaces.nextElement();
Enumeration<InetAddress> addreses = iface.getInetAddresses();
// loop iface addresses
while (addreses.hasMoreElements())
{
InetAddress addr = addreses.nextElement();
if (addr.getHostAddress().equals(addressStr))
return addr;
}
}
return null;
}
/**
* Initializes a client TCP socket, connects if to <tt>sockAddr</tt> and
* sends all <tt>args</tt> to it.
*
* @param sockAddr the address that we are to connect to.
* @param args the args that we need to send to <tt>sockAddr</tt>.
*
* @return <tt>SUCCESS</tt> upond success and <tt>ERROR</tt> if anything
* goes wrong.
*/
private int interInstanceConnect(InetSocketAddress sockAddr, String[] args)
{
try
{
Socket interInstanceSocket = new Socket(sockAddr.getAddress(),
sockAddr.getPort());
LockClient lockClient = new LockClient(interInstanceSocket);
lockClient.start();
PrintStream printStream = new PrintStream(interInstanceSocket
.getOutputStream());
printStream.print(ARG_COUNT + "=" + args.length + CRLF);
for (int i = 0; i < args.length; i++)
{
printStream.print(ARGUMENT + "=" + args[i] + CRLF);
}
lockClient.waitForReply(LOCK_COMMUNICATION_DELAY);
//NPEs are handled in catch so no need to check whether or not we
//actually have a reply.
String serverReadArgCountStr = lockClient.message
.substring((ARG_COUNT + "=").length());
int serverReadArgCount = Integer.parseInt(serverReadArgCountStr);
if (logger.isDebugEnabled())
logger.debug("Server read " + serverReadArgCount + " args.");
if(serverReadArgCount != args.length)
return LOCK_ERROR;
printStream.flush();
printStream.close();
interInstanceSocket.close();
}
//catch IOExceptions, NPEs and NumberFormatExceptions here.
catch (Exception e)
{
if (logger.isDebugEnabled())
logger.debug("Failed to connect to a running sc instance.");
return LOCK_ERROR;
}
return SUCCESS;
}
/**
* We use this thread to communicate with an already running instance of SIP
* Communicator. This thread will listen for a reply to a message that we've
* sent to the other instance. We will wait for this message for a maximum
* of <tt>runDuration</tt> milliseconds and then consider the remote
* instance dead.
*/
private class LockClient extends Thread
{
/**
* The <tt>String</tt> that we've read from the socketInputStream
*/
public String message = null;
/**
* The socket that this <tt>LockClient</tt> is created to read from.
*/
private Socket interInstanceSocket = null;
/**
* Creates a <tt>LockClient</tt> that should read whatever data we
* receive on <tt>sockInputStream</tt>.
*
* @param commSocket
* the socket that this client should be reading from.
*/
public LockClient(Socket commSocket)
{
super(LockClient.class.getName());
setDaemon(true);
this.interInstanceSocket = commSocket;
}
/**
* Blocks until a reply has been received or until run<tt>Duration</tt>
* milliseconds had passed.
*
* @param runDuration the number of seconds to wait for a reply from
* the remote instance
*/
public void waitForReply(long runDuration)
{
try
{
synchronized(this)
{
//return if we have already received a message.
if(message != null)
return;
wait(runDuration);
}
if (logger.isDebugEnabled())
logger.debug("Done waiting. Will close socket");
interInstanceSocket.close();
}
catch (Exception exception)
{
logger.error("Failed to close our inter instance input stream",
exception);
}
}
/**
* Simply collects everything that we read from the InputStream that
* this <tt>InterInstanceCommunicationClient</tt> was created with.
*/
public void run()
{
try
{
BufferedReader lineReader = new BufferedReader(
new InputStreamReader(interInstanceSocket
.getInputStream()));
//we only need to read a single line and then bail out.
message = lineReader.readLine();
if (logger.isDebugEnabled())
logger.debug("Message is " + message);
synchronized(this)
{
notifyAll();
}
}
catch (IOException exc)
{
// does not necessarily mean something is wrong. Could be
// that we got tired of waiting and want to quit.
if (logger.isInfoEnabled())
logger.info("An IOException is thrown while reading sock", exc);
}
}
}
/**
* We start this thread when running SIP Communicator as a means of
* notifying others that this is
*/
private class LockServer extends Thread
{
private boolean keepAccepting = true;
/**
* The socket that we use for cross instance lock and communication.
*/
private ServerSocket lockSocket = null;
/**
* Creates an instance of this <tt>LockServer</tt> wrapping the
* specified <tt>serverSocket</tt>. It is expected that the serverSocket
* will be already bound and ready to accept.
*
* @param serverSocket
* the serverSocket that we should use for inter instance
* communication.
*/
public LockServer(ServerSocket serverSocket)
{
super(LockServer.class.getName());
setDaemon(true);
this.lockSocket = serverSocket;
}
public void run()
{
try
{
while (keepAccepting)
{
Socket instanceSocket = lockSocket.accept();
new LockServerConnectionProcessor(instanceSocket).start();
}
}
catch (Exception exc)
{
logger.warn("Someone tried ", exc);
}
}
}
/**
* We use this thread to handle individual messages in server side inter
* instance communication.
*/
private static class LockServerConnectionProcessor extends Thread
{
/**
* The socket that we will be using to communicate with the fellow SIP
* Communicator instance..
*/
private final Socket connectionSocket;
/**
* Creates an instance of <tt>LockServerConnectionProcessor</tt> that
* would handle parameters received through the
* <tt>connectionSocket</tt>.
*
* @param connectedSocket
* the socket that we will be using to read arguments from
* the remote SIP Communicator instance.
*/
public LockServerConnectionProcessor(Socket connectionSocket)
{
this.connectionSocket = connectionSocket;
}
/**
* Starts reading messages arriving through the connection socket.
*/
public void run()
{
InputStream is;
PrintWriter printer;
try
{
is = connectionSocket.getInputStream();
printer = new PrintWriter(connectionSocket
.getOutputStream());
}
catch (IOException exc)
{
logger.warn("Failed to read arguments from another SC instance",
exc);
return;
}
ArrayList<String> argsList = new ArrayList<String>();
if (logger.isDebugEnabled())
logger.debug("Handling incoming connection");
int argCount = 1024;
try
{
BufferedReader lineReader =
new BufferedReader(new InputStreamReader(is));
while (true)
{
String line = lineReader.readLine();
if (logger.isDebugEnabled())
logger.debug(line);
if (line.startsWith(ARG_COUNT))
{
argCount = Integer.parseInt(line
.substring((ARG_COUNT + "=").length()));
}
else if (line.startsWith(ARGUMENT))
{
String arg = line.substring((ARGUMENT + "=").length());
argsList.add(arg);
}
else
{
// ignore unknown headers.
}
if (argCount <= argsList.size())
break;
}
// first tell the remote application that everything went OK
// and end the connection so that it could exit
printer.print(ARG_COUNT + "=" + argCount + CRLF);
printer.close();
connectionSocket.close();
// now let's handle what we've got
String[] args = new String[argsList.size()];
LaunchArgHandler.getInstance()
.handleConcurrentInvocationRequestArgs(
argsList.toArray(args));
}
catch (IOException exc)
{
if (logger.isInfoEnabled())
logger.info("An IOException is thrown while "
+ "processing remote args", exc);
printer.print(ERROR_ARG + "=" + exc.getMessage());
}
}
}
/**
* Determines whether or not the <tt>iface</tt> interface is a loopback
* interface. We use this method as a replacement to the
* <tt>NetworkInterface.isLoopback()</tt> method that only comes with
* java 1.6.
*
* @param iface the inteface that we'd like to determine as loopback or not.
*
* @return true if <tt>iface</tt> contains at least one loopback address
* and <tt>false</tt> otherwise.
*/
private boolean isLoopbackInterface(NetworkInterface iface)
{
Enumeration<InetAddress> addresses = iface.getInetAddresses();
return addresses.hasMoreElements()
&& addresses.nextElement().isLoopbackAddress();
}
}
| [
"[email protected]"
] | |
8124c9ed5587a93bda716aaab7ec236feb8b2c36 | 9c4f824a2aa803fd957e64c9de42529e5e729dc5 | /src/main/java/com/easou/untils/ConfigLoader.java | 3837d32b6374f9ae17440aae026e4c30e5cdcc47 | [] | no_license | yangweifeng2017/YWF_SparkJobs2Java | d8d8b66f488ce68fc83159f96f25dc2282d8c452 | cccd8b26e24b2805b513a195d09af4795d9f2ea5 | refs/heads/master | 2022-01-21T19:25:47.330984 | 2019-05-08T12:02:50 | 2019-05-08T12:02:50 | 185,597,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,596 | java | package com.easou.untils;
import com.easou.Constants.UserConstants;
import java.util.Properties;
/**
* ClassName ConfigLoader
* 功能: 配置文件加载类
* Author yangweifeng
* Date 2018/9/13 16:48
* Version 1.0
**/
public final class ConfigLoader {
private static Properties props = new Properties();
// 独立配置文件
static {
props.setProperty(UserConstants.APPLICATION_NAME,"Channel_Promotion_Count_Minute");
props.setProperty(UserConstants.BOOTSTRAP_SERVERS,"*:9092,*:9092,*:9092,*:9092,*:9092,*:9092");
props.setProperty(UserConstants.ZOOKEEPER_SERVERS,"*:2181,*:2181,*:2181");
props.setProperty(UserConstants.GROUPID,"Channel_Promotion_Count_Minute");
props.setProperty(UserConstants.KAFKA_TOPIC,"mobile_info");
props.setProperty(UserConstants.REDIS_IP,"*");
props.setProperty(UserConstants.REDIS_PORT,"6379");
props.setProperty(UserConstants.TIME_INTERVAL,"10");
props.setProperty(UserConstants.SPARK_MINUTE_OUTPUT,"...");
props.setProperty(UserConstants.SPARK_HOUR_OUTPUT,"...");
}
/**
* 根据Properties中的key获取value
*
* @param key 键
* @return value 值
*/
public synchronized static String getProperties(String key) {
return props.getProperty(key);
}
/**
* 根据Properties中的key获取value
*
* @param key 键
* @return value 值
*/
public synchronized static Integer getIntegerProperties(String key) {
return Integer.parseInt(props.getProperty(key));
}
public static void main(String[] args) {
System.out.println(ConfigLoader.getIntegerProperties(UserConstants.TIME_INTERVAL));
}
} | [
"[email protected]"
] | |
90dcfa80e2bfaab329a6070a52f950c4361014bd | a8b2472fbd4419e93c96b24a3029b65e91422989 | /src/main/java/com/xiaoyu/common/EventLogConstants.java | dc445bfa5aaa845ef998de567e2a6b5991fbb9a5 | [] | no_license | yudajun002/MRLogAnalyse | b2c18ad9ec4b318c8ee47dc50281441aa01f424d | 1002091e942097b76fe0775404ddaf65659520c8 | refs/heads/master | 2022-06-26T04:39:29.403034 | 2019-08-25T09:27:42 | 2019-08-25T09:27:42 | 204,276,687 | 0 | 0 | null | 2022-06-21T01:44:20 | 2019-08-25T10:04:20 | Java | UTF-8 | Java | false | false | 4,729 | java | package com.xiaoyu.common;
/**
* 定义日志收集客户端收集得到的用户数据参数的name名称<br/>
* 以及event_logs这张hbase表的结构信息<br/>
* 用户数据参数的name名称就是event_logs的列名
*
*
*/
public class EventLogConstants {
/**
* 事件枚举类。指定事件的名称
*
* @author root
*
*/
public static enum EventEnum {
LAUNCH(1, "launch event", "e_l"), // launch事件,表示第一次访问
PAGEVIEW(2, "page view event", "e_pv"), // 页面浏览事件
CHARGEREQUEST(3, "charge request event", "e_crt"), // 订单生产事件
CHARGESUCCESS(4, "charge success event", "e_cs"), // 订单成功支付事件
CHARGEREFUND(5, "charge refund event", "e_cr"), // 订单退款事件
EVENT(6, "event duration event", "e_e") // 事件
;
public final int id; // id 唯一标识
public final String name; // 名称
public final String alias; // 别名,用于数据收集的简写
private EventEnum(int id, String name, String alias) {
this.id = id;
this.name = name;
this.alias = alias;
}
/**
* 获取匹配别名的event枚举对象,如果最终还是没有匹配的值,那么直接返回null。
*
* @param alias
* @return
*/
public static EventEnum valueOfAlias(String alias) {
for (EventEnum event : values()) {
if (event.alias.equals(alias)) {
return event;
}
}
return null;
}
}
/**
* 表名称
*/
public static final String HBASE_NAME_EVENT_LOGS = "eventlog";
/**
* event_logs表的列簇名称
*/
public static final String EVENT_LOGS_FAMILY_NAME = "log";
/**
* 日志分隔符
*/
public static final String LOG_SEPARTIOR = "\\^A";
/**
* 用户ip地址
*/
public static final String LOG_COLUMN_NAME_IP = "ip";
/**
* 服务器时间
*/
public static final String LOG_COLUMN_NAME_SERVER_TIME = "s_time";
/**
* 事件名称
*/
public static final String LOG_COLUMN_NAME_EVENT_NAME = "en";
/**
* 数据收集端的版本信息
*/
public static final String LOG_COLUMN_NAME_VERSION = "ver";
/**
* 用户唯一标识符
*/
public static final String LOG_COLUMN_NAME_UUID = "u_ud";
/**
* 会员唯一标识符
*/
public static final String LOG_COLUMN_NAME_MEMBER_ID = "u_mid";
/**
* 会话id
*/
public static final String LOG_COLUMN_NAME_SESSION_ID = "u_sd";
/**
* 客户端时间
*/
public static final String LOG_COLUMN_NAME_CLIENT_TIME = "c_time";
/**
* 语言
*/
public static final String LOG_COLUMN_NAME_LANGUAGE = "l";
/**
* 浏览器user agent参数
*/
public static final String LOG_COLUMN_NAME_USER_AGENT = "b_iev";
/**
* 浏览器分辨率大小
*/
public static final String LOG_COLUMN_NAME_RESOLUTION = "b_rst";
/**
* 定义platform
*/
public static final String LOG_COLUMN_NAME_PLATFORM = "pl";
/**
* 当前url
*/
public static final String LOG_COLUMN_NAME_CURRENT_URL = "p_url";
/**
* 前一个页面的url
*/
public static final String LOG_COLUMN_NAME_REFERRER_URL = "p_ref";
/**
* 当前页面的title
*/
public static final String LOG_COLUMN_NAME_TITLE = "tt";
/**
* 订单id
*/
public static final String LOG_COLUMN_NAME_ORDER_ID = "oid";
/**
* 订单名称
*/
public static final String LOG_COLUMN_NAME_ORDER_NAME = "on";
/**
* 订单金额
*/
public static final String LOG_COLUMN_NAME_ORDER_CURRENCY_AMOUNT = "cua";
/**
* 订单货币类型
*/
public static final String LOG_COLUMN_NAME_ORDER_CURRENCY_TYPE = "cut";
/**
* 订单支付金额
*/
public static final String LOG_COLUMN_NAME_ORDER_PAYMENT_TYPE = "pt";
/**
* category名称
*/
public static final String LOG_COLUMN_NAME_EVENT_CATEGORY = "ca";
/**
* action名称
*/
public static final String LOG_COLUMN_NAME_EVENT_ACTION = "ac";
/**
* kv前缀
*/
public static final String LOG_COLUMN_NAME_EVENT_KV_START = "kv_";
/**
* duration持续时间
*/
public static final String LOG_COLUMN_NAME_EVENT_DURATION = "du";
/**
* 操作系统名称
*/
public static final String LOG_COLUMN_NAME_OS_NAME = "os";
/**
* 操作系统版本
*/
public static final String LOG_COLUMN_NAME_OS_VERSION = "os_v";
/**
* 浏览器名称
*/
public static final String LOG_COLUMN_NAME_BROWSER_NAME = "browser";
/**
* 浏览器版本
*/
public static final String LOG_COLUMN_NAME_BROWSER_VERSION = "browser_v";
/**
* ip地址解析的所属国家
*/
public static final String LOG_COLUMN_NAME_COUNTRY = "country";
/**
* ip地址解析的所属省份
*/
public static final String LOG_COLUMN_NAME_PROVINCE = "province";
/**
* ip地址解析的所属城市
*/
public static final String LOG_COLUMN_NAME_CITY = "city";
}
| [
"[email protected]"
] | |
2b88b18d5bf33be16fe0eef7770c4e4f0c5f4cdb | 2f0436c72eb19d6c069b9b78288536aae09c6c25 | /app/src/main/java/com/example/gamerapp/Modal/GameList.java | 59792e753438fe971510364a140af3ddb63ac713 | [] | no_license | samirthaker2020/GamerApp1.0 | be608d1a4ea45db76c3e88c2a4d2eff3ff0414f1 | 1a89159800072aad0c06bf38f9b054d104b22b37 | refs/heads/master | 2022-12-06T14:43:53.071350 | 2020-08-25T01:41:34 | 2020-08-25T01:41:34 | 268,860,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,390 | java | package com.example.gamerapp.Modal;
import java.io.Serializable;
public class GameList implements Serializable {
public String gamename,gameimage,gametrailer;
public int gameid;
public float lstgame_rating;
public float getLstgame_rating() {
return lstgame_rating;
}
@Override
public String toString() {
return "GameList{" +
"gamename='" + gamename + '\'' +
", gameimage='" + gameimage + '\'' +
", gametrailer='" + gametrailer + '\'' +
", gameid=" + gameid +
", lstgame_rating=" + lstgame_rating +
'}';
}
public void setLstgame_rating(float lstgame_rating) {
this.lstgame_rating = lstgame_rating;
}
public String getGametrailer() {
return gametrailer;
}
public void setGametrailer(String gametrailer) {
this.gametrailer = gametrailer;
}
public String getGamename() {
return gamename;
}
public void setGamename(String gamename) {
this.gamename = gamename;
}
public String getGameimage() {
return gameimage;
}
public void setGameimage(String gameimage) {
this.gameimage = gameimage;
}
public int getGameid() {
return gameid;
}
public void setGameid(int gameid) {
this.gameid = gameid;
}
}
| [
"[email protected]"
] | |
bd45b6e3122cc4f62dffb288c648936bc878ebe0 | 2aa2c0eeedfa0459725e249794e904528c5f1d0c | /trees/src/com/datastructures/list/MergeTwoSortedLinkedLists_Set1.java | c340576e9e0f6b0ee1752d6174faa77ce88e1890 | [] | no_license | mygitsource/data-structures | d911d0d19395adbc518a511be831c6d3426b315e | 7e58417f4a064766058cf5a8f8ebe79d7787ecd8 | refs/heads/master | 2021-01-22T05:38:30.112566 | 2014-04-27T10:20:18 | 2014-04-27T10:20:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | package com.datastructures.list;
public class MergeTwoSortedLinkedLists_Set1 {
static ListNode mergeSortedLinkedLists(ListNode head1, ListNode head2){
if(head1 == null) return head2;
if(head2 == null) return head1;
LinkedList nList = new LinkedList();
ListNode temp = head1;
ListNode current = head2;
while((temp != null && current != null)){
if(temp.getData() < current.getData()){
insertNode(nList, temp.getData());
temp = temp.getNext();
}else{
insertNode(nList, current.getData());
current = current.getNext();
}
}
if(temp != null) {
insertALL(temp, nList);
}else if(current != null) {
insertALL(current, nList);
}
return nList.getHead();
}
static void insertALL(ListNode node, LinkedList nList){
while(node != null){
insertNode(nList, node.getData());
node = node.getNext();
}
}
static void insertNode(LinkedList list, int data){
list.insertNode(data);
}
public static void main(String[] args) {
LinkedList list = getLinkedList1(1, 10);
LinkedList list2 = getLinkedList1(11, 20);
ListNode temp = mergeSortedLinkedLists(list2.getHead(), list.getHead());
while(temp != null){
System.out.print(temp);
temp = temp.getNext();
if(temp != null){
System.out.print("->");
}
}
System.out.print("\n");
}
public static LinkedList getLinkedList1(int s, int e){
LinkedList likedList = new LinkedList();
for (int i = s; i < e; i++) {
//ListNode x = new ListNode(i);
likedList.addNext(i);
}
return likedList;
}
}
| [
"[email protected]"
] | |
169f3c918ce93331f53bd165e45deb6c7c4ea10e | 555b52c2787ca6022553d43a1094bcd5acd1d63d | /sdk/appservice/mgmt/src/main/java/com/azure/resourcemanager/appservice/models/StaticSiteFunctionOverviewArmResourceInner.java | e9c6364a3c1de328a6b933f70e8affd12b58b74f | [
"MIT",
"LicenseRef-scancode-generic-cla",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | openapi-env-ppe/azure-sdk-for-java | c1abfe15e61bdb857dfb8c0821ea86ea2b297c6a | a4f6f4da8187c22db021421b331fe3bba019880f | refs/heads/master | 2020-09-12T10:05:08.376052 | 2020-06-08T07:44:30 | 2020-06-08T07:44:30 | 222,384,930 | 0 | 0 | MIT | 2019-11-18T07:09:37 | 2019-11-18T07:09:36 | null | UTF-8 | Java | false | false | 1,849 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.appservice.models;
import com.azure.core.annotation.Immutable;
import com.azure.core.annotation.JsonFlatten;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.appservice.ProxyOnlyResource;
import com.azure.resourcemanager.appservice.TriggerTypes;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The StaticSiteFunctionOverviewArmResource model. */
@JsonFlatten
@Immutable
public class StaticSiteFunctionOverviewArmResourceInner extends ProxyOnlyResource {
@JsonIgnore private final ClientLogger logger = new ClientLogger(StaticSiteFunctionOverviewArmResourceInner.class);
/*
* The name for the function
*/
@JsonProperty(value = "properties.functionName", access = JsonProperty.Access.WRITE_ONLY)
private String functionName;
/*
* The trigger type of the function
*/
@JsonProperty(value = "properties.triggerType", access = JsonProperty.Access.WRITE_ONLY)
private TriggerTypes triggerType;
/**
* Get the functionName property: The name for the function.
*
* @return the functionName value.
*/
public String functionName() {
return this.functionName;
}
/**
* Get the triggerType property: The trigger type of the function.
*
* @return the triggerType value.
*/
public TriggerTypes triggerType() {
return this.triggerType;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
super.validate();
}
}
| [
"[email protected]"
] | |
0b43890ebe3f5149d59540e819a8f0469aaa1910 | 33d997398460f0742b0a89ff9f298625965132ba | /core-recipes/src/main/java/com/java/se7/data/structures/list/ArrayList.java | 52e164e2b492a3b101347306773d6f4fe95afa4d | [] | no_license | sumit-srivastava/Recipes | 07a49999d31fc90b952b7c7edaa59fe7b2e2ff4b | 9ca9ffbb13c8b4d3613cc19cc4bb11f4251be276 | refs/heads/master | 2021-01-10T03:30:20.363913 | 2017-08-02T19:36:05 | 2017-08-02T19:36:05 | 48,569,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,713 | java | package com.java.se7.data.structures.list;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Realization of a list by means of a dynamic array. This is a simplified version
* of the java.util.ArrayList class.
*
* @author Michael T. Goodrich
* @author Roberto Tamassia
* @author Michael H. Goldwasser
*/
public class ArrayList<E> implements List<E> {
// instance variables
/**
* Default array capacity.
*/
public static final int CAPACITY = 16; // default array capacity
/**
* Generic array used for storage of list elements.
*/
private E[] data; // generic array used for storage
/**
* Current number of elements in the list.
*/
private int size = 0; // current number of elements
// constructors
/**
* Creates an array list with default initial capacity.
*/
public ArrayList() {
this(CAPACITY);
} // constructs list with default capacity
/**
* Creates an array list with given initial capacity.
*/
@SuppressWarnings({"unchecked"})
public ArrayList(int capacity) { // constructs list with given capacity
data = (E[]) new Object[capacity]; // safe cast; compiler may give warning
}
// public methods
/**
* Returns the number of elements in the list.
*
* @return number of elements in the list
*/
public int size() {
return size;
}
/**
* Tests whether the array list is empty.
*
* @return true if the array list is empty, false otherwise
*/
public boolean isEmpty() {
return size == 0;
}
/**
* Returns (but does not remove) the element at index i.
*
* @param i the index of the element to return
* @return the element at the specified index
* @throws IndexOutOfBoundsException if the index is negative or greater than size()-1
*/
public E get(int i) throws IndexOutOfBoundsException {
checkIndex(i, size);
return data[i];
}
/**
* Replaces the element at the specified index, and returns the element previously stored.
*
* @param i the index of the element to replace
* @param e the new element to be stored
* @return the previously stored element
* @throws IndexOutOfBoundsException if the index is negative or greater than size()-1
*/
public E set(int i, E e) throws IndexOutOfBoundsException {
checkIndex(i, size);
E temp = data[i];
data[i] = e;
return temp;
}
/**
* Inserts the given element at the specified index of the list, shifting all
* subsequent elements in the list one position further to make room.
*
* @param i the index at which the new element should be stored
* @param e the new element to be stored
* @throws IndexOutOfBoundsException if the index is negative or greater than size()
*/
public void add(int i, E e) throws IndexOutOfBoundsException {
checkIndex(i, size + 1);
if (size == data.length) // not enough capacity
resize(2 * data.length); // so double the current capacity
for (int k = size - 1; k >= i; k--) // start by shifting rightmost
data[k + 1] = data[k];
data[i] = e; // ready to place the new element
size++;
}
/**
* Removes and returns the element at the given index, shifting all subsequent
* elements in the list one position closer to the front.
*
* @param i the index of the element to be removed
* @return the element that had be stored at the given index
* @throws IndexOutOfBoundsException if the index is negative or greater than size()
*/
public E remove(int i) throws IndexOutOfBoundsException {
checkIndex(i, size);
E temp = data[i];
for (int k = i; k < size - 1; k++) // shift elements to fill hole
data[k] = data[k + 1];
data[size - 1] = null; // help garbage collection
size--;
return temp;
}
// utility methods
/**
* Checks whether the given index is in the range [0, n-1].
*/
protected void checkIndex(int i, int n) throws IndexOutOfBoundsException {
if (i < 0 || i >= n)
throw new IndexOutOfBoundsException("Illegal index: " + i);
}
/**
* Resizes internal array to have given capacity >= size.
*/
@SuppressWarnings({"unchecked"})
protected void resize(int capacity) {
E[] temp = (E[]) new Object[capacity]; // safe cast; compiler may give warning
for (int k = 0; k < size; k++)
temp[k] = data[k];
data = temp; // start using the new array
}
//---------------- nested ArrayIterator class ----------------
/**
* A (nonstatic) inner class. Note well that each instance contains an implicit
* reference to the containing list, allowing it to access the list's members.
*/
private class ArrayIterator implements Iterator<E> {
/**
* Index of the next element to report.
*/
private int j = 0; // index of the next element to report
private boolean removable = false; // can remove be called at this time?
/**
* Tests whether the iterator has a next object.
*
* @return true if there are further objects, false otherwise
*/
public boolean hasNext() {
return j < size;
} // size is field of outer instance
/**
* Returns the next object in the iterator.
*
* @return next object
* @throws NoSuchElementException if there are no further elements
*/
public E next() throws NoSuchElementException {
if (j == size) throw new NoSuchElementException("No next element");
removable = true; // this element can subsequently be removed
return data[j++]; // post-increment j, so it is ready for future call to next
}
/**
* Removes the element returned by most recent call to next.
*
* @throws IllegalStateException if next has not yet been called
* @throws IllegalStateException if remove was already called since recent next
*/
public void remove() throws IllegalStateException {
if (!removable) throw new IllegalStateException("nothing to remove");
ArrayList.this.remove(j - 1); // that was the last one returned
j--; // next element has shifted one cell to the left
removable = false; // do not allow remove again until next is called
}
} //------------ end of nested ArrayIterator class ------------
/**
* Returns an iterator of the elements stored in the list.
*
* @return iterator of the list's elements
*/
@Override
public Iterator<E> iterator() {
return new ArrayIterator(); // create a new instance of the inner class
}
/**
* Produces a string representation of the contents of the indexed list.
* This exists for debugging purposes only.
*
* @return textual representation of the array list
*/
public String toString() {
StringBuilder sb = new StringBuilder("(");
for (int j = 0; j < size; j++) {
if (j > 0) sb.append(", ");
sb.append(data[j]);
}
sb.append(")");
return sb.toString();
}
}
| [
"[email protected]"
] | |
8e57b696bab433611e40900d071279d4d1e8b453 | 9c65284a0069cf6d0e3bf19919fc229fd74789ba | /gt_front_api/src/main/java/com/gt/util/GoogleAuth.java | f1f75a3f47f9570542fa4b04483f9df47a25a2db | [] | no_license | moguli/powex | 95aa2699b6fbf92aef6ab7b5203864148af29467 | 56348db54db9456234010e5a20f9f8a09d234c64 | refs/heads/master | 2022-12-28T03:52:59.442332 | 2019-09-08T10:04:25 | 2019-09-08T10:04:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,282 | java | package com.gt.util;
import java.util.HashMap;
import java.util.Map;
/*
* Not really a unit test- but it shows usage
*/
public class GoogleAuth {
//网站名称,可自定义
private static String webName = Constant.GoogleAuthName;
/**
* 注册GOOGLE认证,先传入用户登陆名,返回一个MAP,里面有两个KEY,一个是url(value为二维码地址),一个是secret(为此用户的地址,此地址用于校验)
*
* */
public static Map genSecret(String userName) {
Map map = new HashMap();
String secret = GoogleAuthenticator.generateSecretKey();
String url = GoogleAuthenticator.getQRBarcodeURL(webName, userName, secret);
map.put("secret", secret);
map.put("url", url);
return map;
}
/**
* 校验GOOGLE认证是否成功
* **/
public static boolean auth(long code,String secret) {
long t = System.currentTimeMillis();
GoogleAuthenticator ga = new GoogleAuthenticator();
ga.setWindowSize(5); //should give 5 * 30 seconds of grace...
boolean r = ga.check_code(secret, code, t);
return r;
}
public static void main(String args[]){
Map<String, String> map = GoogleAuth.genSecret("hanklee") ;
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println(entry.getValue());
}
}
} | [
"[email protected]"
] | |
792f0279613ac4d8be96c00608930f665ae9dedf | 6bf22f8f46b8df21571f84cabc6337bf84f3246b | /Client/src/net/etfbl/controller/CommentController.java | 2f9f11b3522a66639d69fa172e639b85c52d153d | [] | no_license | ChaosNik/EmergencyInformationSharing | 4322c4a0fff55cf9c873ca6656ddbbcedf06279a | 73594090c7bad4c13132d223fb7a9df1524ce70e | refs/heads/main | 2022-12-27T20:55:34.661157 | 2020-10-06T14:23:33 | 2020-10-06T14:23:33 | 301,747,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,127 | java | package net.etfbl.controller;
import java.io.IOException;
import java.util.stream.Collectors;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.JSONObject;
import net.etfbl.beans.UserBean;
import net.etfbl.dao.CommentDAO;
import net.etfbl.dto.Comment;
@WebServlet("/Comment")
public class CommentController extends HttpServlet {
private static final long serialVersionUID = 1L;
public CommentController() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.getWriter().append("Served at: ").append(request.getContextPath());
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
HttpSession session = request.getSession();
UserBean userBean = (UserBean) session.getAttribute("userBean");
if(userBean != null && userBean.isLoggedIn()) {
String jsonText = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
JSONObject jsonObject = new JSONObject(jsonText);
createComment(jsonObject, request);
}
}
private void createComment(JSONObject jsonObject, HttpServletRequest request) {
HttpSession session = request.getSession();
UserBean userBean = (UserBean) session.getAttribute("userBean");
String description = null, image = null;
Integer postId = jsonObject.getInt("postId");
Integer userId = jsonObject.getInt("userId");
if (!jsonObject.isNull("description")) {
description = jsonObject.getString("description");
}
if (!jsonObject.isNull("image")) {
image = jsonObject.getString("image");
}
java.util.Date dt = new java.util.Date();
Comment postComment = new Comment(description, image, postId, dt, userId);
CommentDAO.insert(postComment);
}
}
| [
"[email protected]"
] | |
9f6eb0ebd707e2869971cc454f10a72a3c8882ea | 0f79f1649fedd19f86c382c28464e77aa54a0a37 | /app/src/main/java/com/zubisoft/campushelpdeskstudent/SplashActivity.java | f0ab5e94131c4168a6019e677b211c58fa8dd517 | [] | no_license | Dominic-32/Campus-Help-Desk-Student | edc16e6a92f26aee5479a97a1099e1d1be518dde | 7c30a95724185e3c8a2d9146fea996d204e81c4d | refs/heads/master | 2023-04-10T01:47:01.048763 | 2021-04-12T17:58:53 | 2021-04-12T17:58:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 767 | java | package com.zubisoft.campushelpdeskstudent;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
CountDownTimer timer = new CountDownTimer(2000,400) {
@Override
public void onTick(long l) {
}
@Override
public void onFinish() {
startActivity(new Intent(SplashActivity.this,SigninActivity.class));
finish();
}
}.start();
}
} | [
"[email protected]"
] | |
5d9c78c15f0c46a1f4077870bcc47caf927caa15 | d632a8d467b1caecc38f61f8845c5e8e088f85c6 | /src/first/Test12.java | 864aec85e7604d604c4cd53b80b1d92ded8900b0 | [] | no_license | YuFei-Soft/Project-Manage | 1e5520484ddcf4b825272e939d7e2c4b6fa39fb9 | d4d741de3fe949f42b676fd5b24108f90ad1014b | refs/heads/master | 2020-03-29T06:26:41.761128 | 2018-10-26T15:01:38 | 2018-10-26T15:01:38 | 149,624,972 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 621 | java | package first;
import java.util.Scanner;
public class Test12 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("STB的成绩是:");
int STB = input.nextInt();
System.out.println("JAVA的成绩是:");
int JAVA = input.nextInt();
System.out.println("SQL的成绩是: ");
int SQL = input.nextInt();
input.close();
int diffen = JAVA - SQL;
double avg = (STB + JAVA + SQL) / 3;
System.out.println("JAVA和SQL的成绩差是: " + diffen);
System.out.println("三门课的平均分是: " + avg);
}
}
| [
"[email protected]"
] | |
5264ad910182ad516258df90ddcb0f36cb1f10da | 44e8ebe55f9b3e58521183d16355b4691d02e213 | /qintaiframework/src/main/java/com/kasao/qintaiframework/bottomnavigation/behaviour/VerticalScrollingBehavior.java | 9618449aad6fdad33bf6aa1493fe5cda4f53f4dd | [] | no_license | chunhejingming123/KaSaoProject | 1289d4901804c625b0cc565d43c06d0d9f7d2a70 | 4606bbea35eacd4a9ba1f4aab62ff9abd2dd6dd2 | refs/heads/master | 2020-03-26T20:55:24.902019 | 2018-09-26T00:57:36 | 2018-09-26T00:58:06 | 145,355,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,720 | java | package com.kasao.qintaiframework.bottomnavigation.behaviour;
import android.content.Context;
import android.support.annotation.IntDef;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.view.View;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Class description
*
* @author ashokvarma
* @version 1.0
* @since 25 Mar 2016
*/
public abstract class VerticalScrollingBehavior<V extends View> extends CoordinatorLayout.Behavior<V> {
private int mTotalDyUnconsumed = -1;
private int mTotalDyConsumed = -1;
private int mTotalDy = -1;
@ScrollDirection
private int mScrollDirection = ScrollDirection.SCROLL_NONE;
@ScrollDirection
private int mPreScrollDirection = ScrollDirection.SCROLL_NONE;
@ScrollDirection
private int mConsumedScrollDirection = ScrollDirection.SCROLL_NONE;
public VerticalScrollingBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
public VerticalScrollingBehavior() {
super();
}
@Retention(RetentionPolicy.SOURCE)
@IntDef({ScrollDirection.SCROLL_DIRECTION_UP, ScrollDirection.SCROLL_DIRECTION_DOWN})
public @interface ScrollDirection {
int SCROLL_DIRECTION_UP = 1;
int SCROLL_DIRECTION_DOWN = -1;
int SCROLL_NONE = 0;
}
/**
* @return Scroll direction: SCROLL_DIRECTION_UP, CROLL_DIRECTION_DOWN, SCROLL_NONE
*/
@ScrollDirection
public int getScrollDirection() {
return mScrollDirection;
}
/**
* @return ConsumedScroll direction: SCROLL_DIRECTION_UP, CROLL_DIRECTION_DOWN, SCROLL_NONE
*/
@ScrollDirection
public int getConsumedScrollDirection() {
return mConsumedScrollDirection;
}
/**
* @return PreScroll direction: SCROLL_DIRECTION_UP, SCROLL_DIRECTION_DOWN, SCROLL_NONE
*/
@ScrollDirection
public int getPreScrollDirection() {
return mPreScrollDirection;
}
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, V child, View directTargetChild, View target, int nestedScrollAxes) {
return (nestedScrollAxes & View.SCROLL_AXIS_VERTICAL) != 0;
}
// @Override
// public void onNestedScrollAccepted(CoordinatorLayout coordinatorLayout, V child, View directTargetChild, View target, int nestedScrollAxes) {
// super.onNestedScrollAccepted(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
// }
//
// @Override
// public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target) {
// super.onStopNestedScroll(coordinatorLayout, child, target);
// }
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (dyUnconsumed > 0 && mTotalDyUnconsumed < 0) {
mTotalDyUnconsumed = 0;
mScrollDirection = ScrollDirection.SCROLL_DIRECTION_UP;
onNestedVerticalScrollUnconsumed(coordinatorLayout, child, mScrollDirection, dyConsumed, mTotalDyUnconsumed);
} else if (dyUnconsumed < 0 && mTotalDyUnconsumed > 0) {
mTotalDyUnconsumed = 0;
mScrollDirection = ScrollDirection.SCROLL_DIRECTION_DOWN;
onNestedVerticalScrollUnconsumed(coordinatorLayout, child, mScrollDirection, dyConsumed, mTotalDyUnconsumed);
}
mTotalDyUnconsumed += dyUnconsumed;
if (dyConsumed > 0 && mTotalDyConsumed < 0) {
mTotalDyConsumed = 0;
mConsumedScrollDirection = ScrollDirection.SCROLL_DIRECTION_UP;
onNestedVerticalScrollConsumed(coordinatorLayout, child, mConsumedScrollDirection, dyConsumed, mTotalDyConsumed);
} else if (dyConsumed < 0 && mTotalDyConsumed > 0) {
mTotalDyConsumed = 0;
mConsumedScrollDirection = ScrollDirection.SCROLL_DIRECTION_DOWN;
onNestedVerticalScrollConsumed(coordinatorLayout, child, mConsumedScrollDirection, dyConsumed, mTotalDyConsumed);
}
mTotalDyConsumed += dyConsumed;
}
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, V child, View target, int dx, int dy, int[] consumed) {
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed);
if (dy > 0 && mTotalDy < 0) {
mTotalDy = 0;
mPreScrollDirection = ScrollDirection.SCROLL_DIRECTION_UP;
onNestedVerticalPreScroll(coordinatorLayout, child, target, dx, dy, consumed, mPreScrollDirection);
} else if (dy < 0 && mTotalDy > 0) {
mTotalDy = 0;
mPreScrollDirection = ScrollDirection.SCROLL_DIRECTION_DOWN;
onNestedVerticalPreScroll(coordinatorLayout, child, target, dx, dy, consumed, mPreScrollDirection);
}
mTotalDy += dy;
}
@Override
public boolean onNestedFling(CoordinatorLayout coordinatorLayout, V child, View target, float velocityX, float velocityY, boolean consumed) {
super.onNestedFling(coordinatorLayout, child, target, velocityX, velocityY, consumed);
return onNestedDirectionFling(coordinatorLayout, child, target, velocityX, velocityY, consumed
, velocityY > 0 ? ScrollDirection.SCROLL_DIRECTION_UP : ScrollDirection.SCROLL_DIRECTION_DOWN);
}
/**
* @param coordinatorLayout the CoordinatorLayout parent of the view this Behavior is
* associated with
* @param child the child view of the CoordinatorLayout this Behavior is associated with
* @param scrollDirection Direction of the scroll: SCROLL_DIRECTION_UP, SCROLL_DIRECTION_DOWN
* @param currentOverScroll Unconsumed value, negative or positive based on the direction;
* @param totalScroll Cumulative value for current direction (Unconsumed)
*/
public abstract void onNestedVerticalScrollUnconsumed(CoordinatorLayout coordinatorLayout, V child, @ScrollDirection int scrollDirection, int currentOverScroll, int totalScroll);
/**
* @param coordinatorLayout the CoordinatorLayout parent of the view this Behavior is
* associated with
* @param child the child view of the CoordinatorLayout this Behavior is associated with
* @param scrollDirection Direction of the scroll: SCROLL_DIRECTION_UP, SCROLL_DIRECTION_DOWN
* @param currentOverScroll Unconsumed value, negative or positive based on the direction;
* @param totalConsumedScroll Cumulative value for current direction (Unconsumed)
*/
public abstract void onNestedVerticalScrollConsumed(CoordinatorLayout coordinatorLayout, V child, @ScrollDirection int scrollDirection, int currentOverScroll, int totalConsumedScroll);
/**
* @param coordinatorLayout the CoordinatorLayout parent of the view this Behavior is
* associated with
* @param child the child view of the CoordinatorLayout this Behavior is associated with
* @param target the descendant view of the CoordinatorLayout performing the nested scroll
* @param dx the raw horizontal number of pixels that the user attempted to scroll
* @param dy the raw vertical number of pixels that the user attempted to scroll
* @param consumed out parameter. consumed[0] should be set to the distance of dx that
* was consumed, consumed[1] should be set to the distance of dy that
* was consumed
* @param scrollDirection Direction of the scroll: SCROLL_DIRECTION_UP, SCROLL_DIRECTION_DOWN
*/
public abstract void onNestedVerticalPreScroll(CoordinatorLayout coordinatorLayout, V child, View target, int dx, int dy, int[] consumed, @ScrollDirection int scrollDirection);
/**
* @param coordinatorLayout the CoordinatorLayout parent of the view this Behavior is
* associated with
* @param child the child view of the CoordinatorLayout this Behavior is associated with
* @param target the descendant view of the CoordinatorLayout performing the nested scroll
* @param velocityX horizontal velocity of the attempted fling
* @param velocityY vertical velocity of the attempted fling
* @param consumed true if the nested child view consumed the fling
* @param scrollDirection Direction of the scroll: SCROLL_DIRECTION_UP, SCROLL_DIRECTION_DOWN
* @return true if the Behavior consumed the fling
*/
protected abstract boolean onNestedDirectionFling(CoordinatorLayout coordinatorLayout, V child, View target, float velocityX, float velocityY, boolean consumed, @ScrollDirection int scrollDirection);
// @Override
// public boolean onNestedPreFling(CoordinatorLayout coordinatorLayout, V child, View target, float velocityX, float velocityY) {
// return super.onNestedPreFling(coordinatorLayout, child, target, velocityX, velocityY);
// }
//
// @Override
// public WindowInsetsCompat onApplyWindowInsets(CoordinatorLayout coordinatorLayout, V child, WindowInsetsCompat insets) {
//
// return super.onApplyWindowInsets(coordinatorLayout, child, insets);
// }
//
// @Override
// public Parcelable onSaveInstanceState(CoordinatorLayout parent, V child) {
// return super.onSaveInstanceState(parent, child);
// }
}
| [
"[email protected]"
] | |
de4fdb3afe123badf47a5ec0d82c62d3fc5e4235 | 50ffe07742393048fe26984c5a5ab895c5ea4790 | /wshop-rest/src/main/java/com/wshop/rest/controller/ItemController.java | 710c79f625d238d640834a5eac37895712b033e8 | [] | no_license | xiaobaiyibu/Shop | 6d5f58ccb407fd8c6eace7c414c1143db142d4b6 | cebbadd6df217af750bf12d599ed0543c3136698 | refs/heads/master | 2022-01-02T22:35:43.548237 | 2018-03-10T06:31:26 | 2018-03-10T06:31:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,188 | java | package com.wshop.rest.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wshop.common.pojo.TaotaoResult;
import com.wshop.rest.service.ItemService;
/**
* 商品信息
* @author wangchuan
* 2016年11月28日
*/
@Controller
@RequestMapping("/item")
public class ItemController {
@Autowired
private ItemService itemService;
@RequestMapping("/info/{itemId}")
@ResponseBody
public TaotaoResult getItemBaseInfo(@PathVariable Long itemId) {
TaotaoResult result = itemService.getItemBaseInfo(itemId);
return result;
}
@RequestMapping("/desc/{itemId}")
@ResponseBody
public TaotaoResult getItemDesc(@PathVariable Long itemId) {
TaotaoResult result = itemService.getItemDesc(itemId);
return result;
}
@RequestMapping("/param/{itemId}")
@ResponseBody
public TaotaoResult getItemParam(@PathVariable Long itemId) {
TaotaoResult result = itemService.getItemParam(itemId);
return result;
}
}
| [
"[email protected]"
] | |
f1f58f9fdb5fce6506e10ec21dd3714e1ced211c | 9821de953fc8607b7900b64e51aa78f11387a3ed | /app/src/main/java/com/daleelpackage/myapp/packages/WorldPay/AlternativePaymentMethod.java | d6eacba1b1461d239bac41954068d3a38caa306c | [] | no_license | Suryabeam/Daleel_Al_Jahra | 6c94ebb290796d3d2874f20fd44717275fbdfc8e | 5a7c50bb17250ef6cd55d8da4d2400b537f819b1 | refs/heads/master | 2023-01-24T01:59:43.338792 | 2020-11-24T16:06:46 | 2020-11-24T16:06:46 | 315,617,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,539 | java | package com.daleelpackage.myapp.packages.WorldPay;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
/**
* Alternative Payment Method.
*/
public class AlternativePaymentMethod implements Serializable {
private static final String COUNTRY_CODE_PATTERN = "^[A-Z]{2}$";
private static final String PAYPAL_APM_NAME = "paypal";
private final String name;
private final String apmName;
private final String shopperCountryCode;
private AlternativePaymentMethod(final String name, final String apmName,
final String shopperCountryCode) {
this.name = name;
this.apmName = apmName;
this.shopperCountryCode = shopperCountryCode;
}
/**
* Creates a new {@link AlternativePaymentMethod} for PayPal for the specified shopper and their
* associated country code.
*
* @param name Shopper's name.
* @param shopperCountryCode Shopper's ISO 3166-1 alpha-2 country code.
* @return New {@link AlternativePaymentMethod}
*/
public static AlternativePaymentMethod newPayPalApm(final String name,
final String shopperCountryCode) {
return new AlternativePaymentMethod(name, PAYPAL_APM_NAME, shopperCountryCode);
}
/**
* Create a new {@link AlternativePaymentMethod} for the specified APM name, person and shopper
* country code.
*
* @param name Shopper name.
* @param apmName APM name.
* @param shopperCountryCode Shoppers ISO 3166-1 alpha-2 country code.
* @return New {@link AlternativePaymentMethod}
*/
static AlternativePaymentMethod newApm(final String name, final String apmName,
final String shopperCountryCode) {
return new AlternativePaymentMethod(name, apmName, shopperCountryCode);
}
/**
* Returns a {@link JSONObject} representation of {@code this} object.
* <p>
* See the example below:
* <pre>
* {
* "name": "First Last",
* "apmName": "paypal",
* "shopperCountryCode": "GB"
* }
* </pre>
* </p>
*
* @return A {@link JSONObject}
* @throws JSONException
* @see {@link JSONObject}
*/
JSONObject getAsJSONObject() throws JSONException {
final JSONObject jsonObject = new JSONObject();
jsonObject.put("type", "APM");
jsonObject.put("name", name);
jsonObject.put("apmName", apmName);
jsonObject.put("shopperCountryCode", shopperCountryCode);
return jsonObject;
}
private boolean isInvalidName() {
return name == null || name.trim().isEmpty();
}
private boolean isInvalidApmName() {
return apmName == null || apmName.trim().isEmpty();
}
private boolean isInvalidShopperCountryCode() {
return !shopperCountryCode.matches(COUNTRY_CODE_PATTERN);
}
public String getName() {
return name;
}
public String getApmName() {
return apmName;
}
public String getShopperCountryCode() {
return shopperCountryCode;
}
@Override
public String toString() {
return "AlternativePaymentMethod{" +
"name='" + name + '\'' +
", apmName='" + apmName + '\'' +
", shopperCountryCode='" + shopperCountryCode + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
a6a3bb0f2c7731ae3427f4ca30d83c4323119edb | dbf32df5ae0985ceb5c97e6ac9f9956659573be6 | /app/src/main/java/edu/handong/design/knockknock/fragment/HomeFragment.java | 75c99ff206d7bb89346bda31ec6543d3fd4b9982 | [] | no_license | hongkunyoo/knockknock | f90fa23f1ed4da2dad85af6e1c313bf3a981e5b2 | 914eb05b7ec7a6a7cb0c9f7840c15b21a9527ff7 | refs/heads/master | 2021-01-22T05:20:42.588335 | 2015-09-18T11:01:44 | 2015-09-18T11:01:44 | 40,882,286 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,964 | java | package edu.handong.design.knockknock.fragment;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.app.ProgressDialog;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.oguzdev.circularfloatingactionmenu.library.FloatingActionButton;
import com.oguzdev.circularfloatingactionmenu.library.FloatingActionMenu;
import com.oguzdev.circularfloatingactionmenu.library.SubActionButton;
import java.util.ArrayList;
import edu.handong.design.knockknock.R;
import edu.handong.design.knockknock.activity.MainActivity;
import edu.handong.design.knockknock.util.Logger;
import edu.handong.design.knockknock.util.ObjectPreferenceUtil;
import edu.handong.design.knockknock.view.CustomImageDialog;
public class HomeFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private ImageView myRoom;
private ImageButton myState;
private ImageButton fab;
private ImageButton profileBtn1;
private ImageButton profileBtn2;
private SubActionButton[] subActionButtons = new SubActionButton[4];
private int[] subButtonImages = new int[] {R.drawable.h_freemode_s, R.drawable.h_no_dist_s,
R.drawable.h_no_room_s, R.drawable.h_outside_s};
private int[] roomImages = new int[] {R.drawable.h_room_freemode_my, R.drawable.h_room_no_dist_my,
R.drawable.h_room_no_room_my, R.drawable.h_room_outside_my};
private int[] profileImages = new int[] {R.drawable.h_profile_taewan, R.drawable.h_profile_seojun,
R.drawable.h_profile_dohyung};
private int[] profileId = new int[] {R.id.h_profile_btn1, R.id.h_profile_btn2, R.id.h_profile_btn3};
private ArrayList<ImageButton> profileBtn = new ArrayList<>();
private RelativeLayout homeBg;
private ImageView dimBg;
FrameLayout ll;
public static HomeFragment newInstance(String param1, String param2) {
HomeFragment fragment = new HomeFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
public HomeFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// if (getArguments() != null) {
// mParam1 = getArguments().getString(ARG_PARAM1);
// mParam2 = getArguments().getString(ARG_PARAM2);
// }
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_home, container, false);
setView(view);
// ObjectPreferenceUtil pref = new ObjectPreferenceUtil(getActivity());
// pref.put("tab", 1);
// setBinding();
return view;
}
private void setView(View view) {
myRoom = (ImageView) view.findViewById(R.id.myroom_id);
myState = (ImageButton) view.findViewById(R.id.my_state);
homeBg = (RelativeLayout) view.findViewById(R.id.frag_home_bg_id);
dimBg = (ImageView) view.findViewById(R.id.dim_bg_id);
profileBtn2 = (ImageButton) view.findViewById(R.id.h_profile_btn2);
for (int id : profileId) {
profileBtn.add((ImageButton) view.findViewById(id));
}
for (ImageButton btn : profileBtn) {
viewProfile(btn, profileBtn.indexOf(btn));
}
myMenu(view);
}
private void viewProfile(ImageButton bt, final int index) {
bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CustomImageDialog customDialog = new CustomImageDialog(getActivity());
customDialog.setImage(profileImages[index]);
customDialog.show();
}
});
}
private void myMenu(View view) {
final ImageView icon = new ImageView(getActivity()); // Create an icon
icon.setImageResource(R.drawable.h_mode_s);
ll = (FrameLayout) view.findViewById(R.id.linear_layout_id);
final com.oguzdev.circularfloatingactionmenu.library.FloatingActionButton actionButton = new com.oguzdev.circularfloatingactionmenu.library.FloatingActionButton.Builder(getActivity())
.setContentView(icon)
.build();
ViewGroup parent = (ViewGroup) actionButton.getParent();
parent.removeView(actionButton);
ll.addView(actionButton);
FloatingActionButton.LayoutParams starParams = new FloatingActionButton.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
starParams.setMargins(0,
0,
0,
0);
actionButton.setLayoutParams(starParams);
actionButton.setPosition(FloatingActionButton.POSITION_BOTTOM_CENTER, starParams);
actionButton.setBackgroundResource(R.color.my_transparent);
for (int i = 0 ; i < subButtonImages.length ; i++) {
SubActionButton.Builder itemBuilder = new SubActionButton.Builder(getActivity());
// repeat many times:
ImageView itemIcon = new ImageView(getActivity());
itemIcon.setImageResource(subButtonImages[i]);
subActionButtons[i] = itemBuilder.setContentView(itemIcon).build();
subActionButtons[i].setLayoutParams(starParams);
subActionButtons[i].setBackgroundResource(R.color.my_transparent);
}
final FloatingActionMenu.Builder actionMenuBuilder = new FloatingActionMenu.Builder(getActivity());
actionMenuBuilder.attachTo(actionButton)
.setStartAngle(210)
.setEndAngle(330)
.setRadius(400);
for (int i = 0 ; i < subActionButtons.length ; i++) {
actionMenuBuilder.addSubActionView(subActionButtons[i]);
}
final FloatingActionMenu actionMenu = actionMenuBuilder.build();
actionMenu.setStateChangeListener(new FloatingActionMenu.MenuStateChangeListener() {
@Override
public void onMenuOpened(FloatingActionMenu floatingActionMenu) {
dimBg.setVisibility(View.VISIBLE);
dimBg.setZ(90);
ll.setZ(100);
ll.bringToFront();
}
@Override
public void onMenuClosed(FloatingActionMenu floatingActionMenu) {
dimBg.setVisibility(View.GONE);
}
});
for (int i = 0 ; i < roomImages.length ; i++) {
final int j = i;
subActionButtons[i].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myRoom.setImageResource(roomImages[j]);
myState.setImageResource(subButtonImages[j]);
actionMenu.close(true);
}
});
}
}
}
| [
"[email protected]"
] | |
f19125eeeac6528cb3814389e792ff86d1048e92 | 30fbdd508031271b2b85c7710b171c14f0c7b0d2 | /CSIS1410code/PersonDemo/src/Person.java | 648fe01b0ae2adb1e098a4644f7f0e67ab973f27 | [] | no_license | srollmanSLCC/csis1410 | 834523234f7c866d4b2e7669d4df4c3d8e41b07c | f5b4c5edbe2fde118491d62197316143394844f7 | refs/heads/master | 2020-04-09T14:47:48.193998 | 2018-12-12T19:40:55 | 2018-12-12T19:40:55 | 160,407,229 | 1 | 0 | null | 2018-12-11T08:05:12 | 2018-12-04T19:19:27 | Java | UTF-8 | Java | false | false | 1,857 | java | import java.util.Objects;
public class Person
{
private int age;
private String name;
/**
* Getter method for Age property.
*
* @return an int representing the age of this Person
*/
public int getAge()
{
return age;
}
/**
* Setter method for the Age property.
*
* @param age an int to set as the Age for this Person.
*/
public void setAge(int age)
{
this.age = age;
}
/**
* Getter method for Name property.
*
* @return a String representing the name of this Person
*/
public String getName()
{
return name;
}
/**
* Setter method for the Name property.
*
* @param name a String to set as the Name for this Person.
*/
public void setName(String name)
{
this.name = name;
}
/**
* Compares this Person with another object to see if they are equal
*
* @param other an object to compare this Person to
* @return true if other equals this Person
*/
@Override
public boolean equals(Object other)
{
try
{
if (this == other)
{
return true;
}
if (other == null || getClass() != other.getClass())
{
return false;
}
Person person = (Person) other;
return age == person.age && Objects.equals(name, person.name);
}
finally
{
return false;
}
}
/**
* Overridden hashCode method calls Objects.hash() with our values
*
* @return An int representing the hash of our object.
*/
@Override
public int hashCode()
{
return Objects.hash(age, name);
}
public static void main(String[] args)
{
}
}
| [
"[email protected]"
] | |
198c4bfd8ab03b961f2aa49f64295498d4e4e9b5 | 001088a896664b82944a45f32b6146d2445631af | /01-simple-app/src/main/java/ali/vertx/hello/s02/App.java | 6db4800d23b84607d0d71ce65e6adb2fd9bb3b28 | [] | no_license | alibenmessaoud/vertx | bfdab5764af230a11eb860ced35d88384c1cf758 | 5a2b48b56c14b506489247ca0d4a0c2b42b634dd | refs/heads/master | 2022-07-03T22:35:33.561859 | 2020-11-17T16:23:48 | 2020-11-17T16:24:07 | 167,631,607 | 0 | 0 | null | 2022-05-20T20:56:02 | 2019-01-26T00:19:37 | Java | UTF-8 | Java | false | false | 748 | java | package ali.vertx.hello.s02;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
/**
* Without future.complete() in the verticle, the deployer will not show the id;
* > Deployment id is: 73378d39-339b-4e81-88a7-ed452d0cf4e7
*/
public class App {
public static void main(String[] args) {
VertxOptions options = new VertxOptions();
options.setMaxEventLoopExecuteTime(Long.MAX_VALUE);
Vertx vertx = Vertx.vertx(options);
vertx.deployVerticle(new SimpleVerticle(), res -> {
if (res.succeeded()) {
System.out.println("Deployment id is: " + res.result());
} else {
System.out.println("Deployment failed!");
}
});
}
}
| [
"[email protected]"
] | |
50ba8a3b09bf7b802e5eb889277752ccb59374c2 | ffef94bd92a3e44c423104a2b186241e5ee9fd15 | /src/main/java/com/jansmerecki/domain/Notes.java | 061b4202bb757b2b0fef7ba29f9f14b8da7a61f1 | [] | no_license | JSmerec98/spring-recipe-app | 7f40157b9e6b0f75153dfdb3bab6d7cc0033f27e | 2418bb3920f6c6fb3d624dbfe5505f653bd9d016 | refs/heads/master | 2023-02-17T09:38:15.664024 | 2021-01-16T13:59:54 | 2021-01-16T13:59:54 | 286,211,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.jansmerecki.domain;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
@Getter
@Setter
@EqualsAndHashCode(exclude = {"recipe"})
@Entity
public class Notes {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@OneToOne
private Recipe recipe;
@Lob
private String recipeNotes;
}
| [
"[email protected]"
] | |
67315bd7ea84a21d47330eb613215002507d3838 | bd94a511f5c5a997d8672a196d08bed01fd2c943 | /Programming/src/com/danielchan/Dec2012UTMQuestion6/Counter.java | 0b1b67f375b427a4d7f3020df4431d9d11fcf517 | [] | no_license | DanielChanJA/CSC207Final | 06fcb6511db131b3df926a406445dac2768b2180 | 2368dc0e5d4a42b85d7ab6823ddd01c55ec6ae03 | refs/heads/master | 2021-05-01T04:57:17.864185 | 2016-04-25T21:23:38 | 2016-04-25T21:23:38 | 56,996,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package com.danielchan.Dec2012UTMQuestion6;
/**
* Created by chanj on 4/25/2016.
*/
public class Counter {
private int count;
public Counter() {
this.count = 0;
}
public int increment() throws OverLimitException {
if (count > 2) {
throw new OverLimitException("Greater than 2 limit");
}
return ++count;
}
public int decrement() throws UnderLimitException {
if (count < -2) {
throw new UnderLimitException("Less than 2 limit");
}
return --count;
}
public int getCount() {
return count;
}
}
| [
"[email protected]"
] | |
06e38f388d541d29a1d1d6af875ccbf42371c6a0 | 82fd989f92810b1d33d87fecb73f719acdfcf36c | /src/main/java/translate/commerce/CommerceRules.java | a9409e3b4c21d7ce8952c424893f50fe9d35bbdc | [] | no_license | anilkothari10/translate | 45e934ff94354aee199e06c933c29a1aad9ee573 | 2c8e2d2954e2fe54f943050e2cf58d312d807666 | refs/heads/master | 2022-07-07T02:34:08.327794 | 2019-09-12T17:10:59 | 2019-09-12T17:10:59 | 146,479,825 | 0 | 1 | null | 2022-06-29T16:57:00 | 2018-08-28T17:03:19 | Java | UTF-8 | Java | false | false | 886 | java | package translate.commerce;
public class CommerceRules {
private String name;
private String variableName;
private String description;
private String ruleType;
public String getRuleType() {
return ruleType;
}
public void setRuleType(String ruleType) {
this.ruleType = ruleType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVariableName() {
return variableName;
}
public void setVariableName(String variableName) {
this.variableName = variableName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "CommerceRules [name=" + name + ", variableName=" + variableName + ", description=" + description
+ ", ruleType=" + ruleType + "]";
}
}
| [
"[email protected]"
] | |
1f0c12972153e78727dbb419768c05ce99fb4ffb | aaf1c59952a3428f0084d99f5b91d5684d6ae6a1 | /app/src/main/java/com/example/mechrevo/myapplication/annotation/BindView.java | db52da04fa244826193552a8a6836c543945de62 | [] | no_license | zb666/jetpack | 995f17b67563464da6e831c9d4ee045108600f58 | 649109e1cdd5b7c1c63be01a8b846bc72aec1caf | refs/heads/master | 2020-04-20T20:40:58.802942 | 2019-03-09T08:54:13 | 2019-03-09T08:54:13 | 169,084,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package com.example.mechrevo.myapplication.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.CLASS)
public @interface BindView {
}
| [
"[email protected]"
] | |
8afb2972ed090254397f16bcd4684af063401c20 | 662429775d1be51c7df07a0dbb7d9d7cc1aae877 | /src/main/java/wind/yang/security/service/RoleService.java | 9c4a3e137ef14c2f1b77057ba5395109449b31ae | [] | no_license | swampwar/springsecurity-inflearnlecture-project | a13f3225e3b2b5679110f3a8caf21a99ecfb5800 | d0be2a44113faa0e92111cc93776799b8f15188b | refs/heads/master | 2022-12-02T10:56:31.054686 | 2020-08-03T12:45:01 | 2020-08-03T12:45:01 | 277,491,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package wind.yang.security.service;
import wind.yang.security.domain.entity.Role;
import java.util.List;
public interface RoleService {
Role getRole(long id);
List<Role> getRoles();
void createRole(Role role);
void deleteRole(long id);
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.