blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7c4ea7908f04fc95922d47e67d1a57ad5198c516 | 1e2f1940d7fc03b40c5b1d3d8a530fddaaaac1c3 | /quartz-demo/src/main/java/com/luoyu/quartz/manager/QuartzManager.java | 4ef40ef41254312902d312cf966ceb4348363e93 | [
"Apache-2.0"
] | permissive | cghtom/springboot-demo | ea92c2670064d1bed95fcac083ce28303fe2296e | 18171dfe80a077a412aea7e91329de562709d242 | refs/heads/master | 2022-12-10T04:52:41.284725 | 2020-09-08T05:51:43 | 2020-09-08T05:51:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,575 | java | package com.luoyu.quartz.manager;
import com.luoyu.quartz.request.AddCronJobReq;
import com.luoyu.quartz.request.AddSimpleJobReq;
import com.luoyu.quartz.request.DeleteJobReq;
import lombok.extern.slf4j.Slf4j;
import org.quartz.*;
import org.springframework.stereotype.Service;
import static org.quartz.DateBuilder.futureDate;
/**
* @Description: Quartz管理操作类
* @Author: jinhaoxun
* @Date: 2020/1/15 11:20
* @Version: 1.0.0
*/
@Slf4j
@Service
public class QuartzManager {
private Scheduler scheduler;
/**
* @author jinhaoxun
* @description 构造器
* @param scheduler 调度器
*/
public QuartzManager(Scheduler scheduler){
this.scheduler = scheduler;
}
/**
* quartz任务类包路径
*/
private static String jobUri = "com.luoyu.quartz.job.";
/**
* @author jinhaoxun
* @description 添加一个Simple定时任务,只执行一次的定时任务
* @param addSimpleJobReq 参数对象
* @param taskId 任务ID,不能同名
* @throws RuntimeException
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void addSimpleJob(AddSimpleJobReq addSimpleJobReq, String taskId) throws Exception {
String jobUrl = jobUri + addSimpleJobReq.getJobClass();
try {
Class<? extends Job> aClass = (Class<? extends Job>) Class.forName(jobUrl).newInstance().getClass();
// 任务名,任务组,任务执行类
JobDetail job = JobBuilder.newJob(aClass).withIdentity(taskId,
"JobGroup").build();
//增加任务ID参数
addSimpleJobReq.getParams().put("taskId",taskId);
// 添加任务参数
job.getJobDataMap().putAll(addSimpleJobReq.getParams());
// 转换为时间差,秒单位
int time = (int) (addSimpleJobReq.getDate().getTime() - System.currentTimeMillis()) / 1000;
SimpleTrigger trigger = (SimpleTrigger) TriggerBuilder.newTrigger()
.withIdentity(taskId, taskId + "TiggerGroup")
.startAt(futureDate(time, DateBuilder.IntervalUnit.SECOND))
.build();
// 调度容器设置JobDetail和Trigger
scheduler.scheduleJob(job, trigger);
if (!scheduler.isShutdown()) {
// 启动
scheduler.start();
}
} catch (Exception e) {
log.info("Quartz新增任务失败");
}
}
/**
* @author jinhaoxun
* @description 添加一个Cron定时任务,循环不断执行的定时任务
* @param addCronJobReq 参数对象
* @throws Exception
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void addCronJob(AddCronJobReq addCronJobReq) throws Exception {
String jobUrl = jobUri + addCronJobReq.getJobClass();
try {
Class<? extends Job> aClass = (Class<? extends Job>) Class.forName(jobUrl).newInstance().getClass();
// 任务名,任务组,任务执行类
JobDetail job = JobBuilder.newJob(aClass).withIdentity(addCronJobReq.getJobName(),
addCronJobReq.getJobGroupName()).build();
// 添加任务参数
job.getJobDataMap().putAll(addCronJobReq.getParams());
// 创建触发器
CronTrigger trigger = (CronTrigger) TriggerBuilder.newTrigger()
// 触发器名,触发器组
.withIdentity(addCronJobReq.getTriggerName(), addCronJobReq.getTriggerGroupName())
// 触发器时间设定
.withSchedule(CronScheduleBuilder.cronSchedule(addCronJobReq.getDate()))
.build();
// 调度容器设置JobDetail和Trigger
scheduler.scheduleJob(job, trigger);
if (!scheduler.isShutdown()) {
// 启动
scheduler.start();
}
} catch (Exception e) {
log.info("Quartz新增任务失败");
}
}
/**
* @author jinhaoxun
* @description 修改一个任务的触发时间
* @param triggerName 触发器名
* @param triggerGroupName 触发器组名
* @param cron 时间设置,参考quartz说明文档
* @throws Exception
*/
public void modifyJobTime(String triggerName, String triggerGroupName, String cron) throws Exception {
try {
TriggerKey triggerKey = TriggerKey.triggerKey(triggerName, triggerGroupName);
CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
if (trigger == null) {
return;
}
String oldTime = trigger.getCronExpression();
if (!oldTime.equalsIgnoreCase(cron)) {
// 触发器
TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger();
// 触发器名,触发器组
triggerBuilder.withIdentity(triggerName, triggerGroupName);
triggerBuilder.startNow();
// 触发器时间设定
triggerBuilder.withSchedule(CronScheduleBuilder.cronSchedule(cron));
// 创建Trigger对象
trigger = (CronTrigger) triggerBuilder.build();
// 方式一 :修改一个任务的触发时间
scheduler.rescheduleJob(triggerKey, trigger);
}
} catch (Exception e) {
log.info("Quartz修改任务失败");
}
}
/**
* @author jinhaoxun
* @description 移除一个任务
* @param deleteJobReq 参数对象
* @throws Exception
*/
public void removeJob(DeleteJobReq deleteJobReq) throws Exception {
try {
TriggerKey triggerKey = TriggerKey.triggerKey(deleteJobReq.getTriggerName(), deleteJobReq.getTriggerGroupName());
// 停止触发器
scheduler.pauseTrigger(triggerKey);
// 移除触发器
scheduler.unscheduleJob(triggerKey);
// 删除任务
scheduler.deleteJob(JobKey.jobKey(deleteJobReq.getJobName(), deleteJobReq.getJobGroupName()));
} catch (Exception e) {
log.info("Quartz删除改任务失败");
}
}
/**
* @author jinhaoxun
* @description 获取任务是否存在
* @param triggerName 触发器名
* @param triggerGroupName 触发器组名
* @return Boolean 返回操作结果
* 获取任务是否存在
* STATE_BLOCKED 4 阻塞
* STATE_COMPLETE 2 完成
* STATE_ERROR 3 错误
* STATE_NONE -1 不存在
* STATE_NORMAL 0 正常
* STATE_PAUSED 1 暂停
* @throws Exception
*/
public Boolean notExists(String triggerName, String triggerGroupName) throws Exception {
try {
if (scheduler.getTriggerState(TriggerKey.triggerKey(triggerName, triggerGroupName)) == Trigger.TriggerState.NORMAL){
return true;
}
} catch (Exception e) {
log.info("Quartz获取任务是否存在失败");
}
return false;
}
/**
* @author jinhaoxun
* @description 关闭调度器
* @throws RuntimeException
*/
public void shutdown() throws Exception {
try {
if(scheduler.isStarted()){
scheduler.shutdown(true);
}
} catch (Exception e) {
log.info("Quartz关闭调度器失败");
}
}
} | [
"luoyusoft@126.com"
] | luoyusoft@126.com |
13815c255ac4c0c736da7b76b4ec347f5a0a461f | 10d77fabcbb945fe37e15ae438e360a89a24ea05 | /graalvm/transactions/fork/narayana/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/resources/AtomicWorker1.java | 6c1d518fe0c687bea891d883b272f1586c5f9eb0 | [
"Apache-2.0",
"LGPL-2.1-or-later",
"LGPL-2.1-only",
"LicenseRef-scancode-other-copyleft"
] | permissive | nmcl/scratch | 1a881605971e22aa300487d2e57660209f8450d3 | 325513ea42f4769789f126adceb091a6002209bd | refs/heads/master | 2023-03-12T19:56:31.764819 | 2023-02-05T17:14:12 | 2023-02-05T17:14:12 | 48,547,106 | 2 | 1 | Apache-2.0 | 2023-03-01T12:44:18 | 2015-12-24T15:02:58 | Java | UTF-8 | Java | false | false | 8,348 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags.
* See the copyright.txt in the distribution for a full listing
* of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* (C) 2005-2006,
* @author JBoss Inc.
*/
/*
* Copyright (C) 1998, 1999, 2000,
*
* Arjuna Solutions Limited,
* Newcastle upon Tyne,
* Tyne and Wear,
* UK.
*
* $Id: AtomicWorker1.java 2342 2006-03-30 13:06:17Z $
*/
package com.hp.mwtests.ts.jts.orbspecific.resources;
import com.arjuna.ats.internal.jts.OTSImpleManager;
import com.arjuna.ats.internal.jts.orbspecific.CurrentImple;
import com.hp.mwtests.ts.jts.exceptions.TestException;
import com.hp.mwtests.ts.jts.utils.Util;
public class AtomicWorker1
{
public static void incr12 (char thr, int level)
{
boolean res = false;
boolean res1 = false;
boolean res2 = false;
int ran;
try
{
current.begin();
Util.indent(thr, level);
System.out.println("begin incr12");
ran = Util.rand.nextInt() % 16;
res1 = atomicObject_1.incr(ran);
res = res1;
Util.indent(thr, level);
System.out.println("part1 incr12 : "+res1);
if (res)
{
res2 = atomicObject_2.incr(-ran);
res = res2;
Util.indent(thr, level);
System.out.println("part2 incr12 : "+res2);
}
Util.indent(thr, level);
if (res)
{
System.out.print("end ");
current.commit(false);
res = true;
}
else
{
System.out.print("abort ");
current.rollback();
}
System.out.println(" incr12 : "+res1+" : "+res2+" : "+res
+" : "+ran);
}
catch (Exception e1)
{
System.err.println(e1);
}
}
public static void incr21 (char thr, int level)
{
boolean res = false;
boolean res1 = false;
boolean res2 = false;
int ran;
try
{
current.begin();
Util.indent(thr, level);
System.out.println("begin incr21");
ran = Util.rand.nextInt() % 16;
res1 = atomicObject_2.incr(ran);
res = res1;
Util.indent(thr, level);
System.out.println("part1 incr21 : "+res1);
if (res)
{
res2 = atomicObject_1.incr(-ran);
res = res2;
Util.indent(thr, level);
System.out.println("part2 incr21 : "+res2);
}
Util.indent(thr, level);
if (res)
{
System.out.print("end ");
current.commit(false);
res = true;
}
else
{
System.out.print("abort ");
current.rollback();
}
System.out.println(" incr21 : "+res1+" : "+res2+" : "+res
+" : "+ran);
}
catch (Exception e)
{
System.err.println(e);
}
}
public static void get12 (char thr, int level)
{
boolean res = false;
boolean res1 = false;
boolean res2 = false;
int value1 = 0;
int value2 = 0;
try
{
current.begin();
Util.indent(thr, level);
System.out.println("begin get12");
res1 = true;
try
{
value1 = atomicObject_1.get();
}
catch (TestException e)
{
res1 = false;
}
res = res1;
Util.indent(thr, level);
System.out.println("part1 get12 : "+res1);
if (res)
{
res2 = true;
try
{
value2 = atomicObject_2.get();
}
catch (TestException e)
{
res2 = false;
}
res = res2;
Util.indent(thr, level);
System.out.println("part2 get12 : "+res2);
}
Util.indent(thr, level);
if (res)
{
System.out.print("end ");
current.commit(false);
}
else
{
System.out.print("abort ");
current.rollback();
}
System.out.println(" get12 : "+res1+" : "+res2+" : "+res
+" : "+value1+" : "+value2);
}
catch (Exception e)
{
System.err.println(e);
}
}
public static void get21 (char thr, int level)
{
boolean res = false;
boolean res1 = false;
boolean res2 = false;
int value1 = 0;
int value2 = 0;
try
{
current.begin();
Util.indent(thr, level);
System.out.println("begin get21");
res1 = true;
try
{
value1 = atomicObject_2.get();
}
catch (TestException e)
{
res1 = false;
}
res = res1;
Util.indent(thr, level);
System.out.println("part1 get21 : "+res1);
if (res)
{
res2 = true;
try
{
value2 = atomicObject_1.get();
}
catch (TestException e)
{
res2 = false;
}
res = res2;
Util.indent(thr, level);
System.out.println("part2 get21 : "+res2);
}
Util.indent(thr, level);
if (res)
{
System.out.print("end ");
current.commit(false);
}
else
{
System.out.print("abort ");
current.rollback();
}
System.out.println(" get21 : "+res1+" : "+res2+" : "+res
+" : "+value1+" : "+value2);
}
catch (Exception e)
{
System.err.println(e);
}
}
public static void randomOperation (char thr, int level)
{
switch (Util.rand.nextInt() % 6)
{
case 0:
incr12(thr, level);
break;
case 1:
incr21(thr, level);
break;
case 2:
get12(thr, level);
break;
case 3:
get21(thr, level);
break;
case 4:
{
try
{
current.begin();
Util.indent(thr, level);
System.out.println("begin");
randomOperation(thr, level + 1);
randomOperation(thr, level + 1);
current.commit(false);
Util.indent(thr, level);
System.out.println("end");
}
catch (Exception e)
{
System.err.println(e);
}
}
break;
case 5:
{
try
{
current.begin();
Util.indent(thr, level);
System.out.println("begin");
randomOperation(thr, level + 1);
randomOperation(thr, level + 1);
current.rollback();
Util.indent(thr, level);
System.out.println("abort");
}
catch (Exception e)
{
System.err.println(e);
}
}
break;
}
}
public static int get1() throws Exception
{
boolean res = false;
int returnValue = -1;
try
{
current.begin();
try
{
returnValue = atomicObject_1.get();
res = true;
}
catch (TestException e)
{
}
if (res)
current.commit(false);
else
current.rollback();
}
catch (Exception e)
{
System.err.println(e);
throw e;
}
if (!res)
throw new Exception("Get1: Failed to retrieve value");
return(returnValue);
}
public static int get2() throws Exception
{
boolean res = false;
int returnValue = -1;
try
{
current.begin();
try
{
returnValue = atomicObject_2.get();
res = true;
}
catch (TestException e)
{
}
if (res)
current.commit(false);
else
current.rollback();
}
catch (Exception e)
{
System.err.println(e);
throw e;
}
if (!res)
throw new Exception("Get2: Failed to retrieve value");
return(returnValue);
}
public static void init ()
{
AtomicWorker1.current = OTSImpleManager.current();
}
public static AtomicObject atomicObject_1 = null;
public static AtomicObject atomicObject_2 = null;
public static CurrentImple current = null;
}
| [
"mlittle@redhat.com"
] | mlittle@redhat.com |
ca4c7107bfaa410ee17f1534f181b2eef3d5e38c | a90f04b19052536f27775cd828f88c04bf03a2fb | /src/main/java/com/linle/mobileapi/v1/request/BankCardRequest.java | 651f505e95a7948e693576ca7319f3af3ed67a54 | [] | no_license | biaoa/test | 3a935b2675f52ac7a4e440f52dc86097928e61a1 | b4039c2345824fd82c23c8c9ac21db36529ba96e | refs/heads/master | 2021-01-20T07:13:39.415844 | 2017-04-25T08:46:57 | 2017-04-25T08:46:57 | 89,980,300 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package com.linle.mobileapi.v1.request;
import com.linle.mobileapi.base.BaseRequest;
public class BankCardRequest extends BaseRequest {
private static final long serialVersionUID = -6993086139549886855L;
}
| [
"hugo@365hdzs.com"
] | hugo@365hdzs.com |
341fa57a8991fba4108fe373b469805d83933d83 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-f9473.java | ed96fad2060f0b5b4007022ac52407120f97f212 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
3673378328986 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
398de9e2895df18a466d2424e38af9f6087338b7 | d620221e946d82f2c68be64dd20a002b7ed51b04 | /medical/src/com/henglianmobile/medical/ui/activity/doctor/PatientBaseInfoLiActivity.java | f1d1233b3a8ce523e9d5c7b1ac2058bf4005f4a9 | [] | no_license | kaiyuanshengshichangan/medical | 0253f7cd93316ddb54a45763b918a52ec1fdbf91 | d4cb1d2f6c1b0f942017190cf89d7b1b24ed2f95 | refs/heads/master | 2021-01-22T14:38:28.361967 | 2015-02-14T13:05:41 | 2015-02-14T13:05:41 | 30,796,286 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,871 | java | package com.henglianmobile.medical.ui.activity.doctor;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import com.henglianmobile.medical.R;
import com.henglianmobile.medical.activity.BaseActivity;
import com.henglianmobile.medical.app.TApplication;
import com.henglianmobile.medical.entity.UserInfoDetailObject;
import com.henglianmobile.medical.util.MyAnimateFirstDisplayListener;
import com.nostra13.universalimageloader.core.ImageLoader;
public class PatientBaseInfoLiActivity extends BaseActivity {
private ImageView btn_back;
private TextView tv_name,tv_age, tv_mobile, tv_area, tv_person_introduce;
private ImageView iv_photo;
private RadioButton radioMan, radioFemale;
private UserInfoDetailObject userInfoDetailObject;
@Override
public void loadLayout() {
// 使软键盘不自动弹出
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
setContentView(R.layout.activity_doctor_patient_base_info);
}
@Override
public void initViews() {
btn_back = (ImageView) findViewById(R.id.btn_back);
tv_name = (TextView) findViewById(R.id.tv_name);
tv_age = (TextView) findViewById(R.id.tv_age);
tv_mobile = (TextView) findViewById(R.id.tv_mobile);
tv_area = (TextView) findViewById(R.id.tv_area);
tv_person_introduce = (TextView) findViewById(R.id.tv_person_introduce);
iv_photo = (ImageView) findViewById(R.id.iv_photo);
radioMan = (RadioButton) findViewById(R.id.radio0);
radioFemale = (RadioButton) findViewById(R.id.radio1);
}
@Override
public void addListener() {
btn_back.setOnClickListener(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
userInfoDetailObject = (UserInfoDetailObject) getIntent().getSerializableExtra("userInfoDetailObject");
showContent();
}
private void showContent() {
int isex = userInfoDetailObject.getDnSex();
if (isex == 0) {
radioMan.setChecked(false);
radioFemale.setChecked(true);
} else if (isex == 1) {
radioMan.setChecked(true);
radioFemale.setChecked(false);
}
tv_name.setText(userInfoDetailObject.getDcRealName());
tv_age.setText(userInfoDetailObject.getDnAge() + "");
tv_mobile.setText(userInfoDetailObject.getDcCellPhone());
tv_area.setText(userInfoDetailObject.getDcAddress());
tv_person_introduce.setText(userInfoDetailObject.getDcSign());
String photoPath = userInfoDetailObject.getDcHeadImg();
ImageLoader.getInstance().displayImage(photoPath, iv_photo,
TApplication.optionsImage, new MyAnimateFirstDisplayListener());
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_back:
this.finish();
break;
default:
break;
}
}
}
| [
"zhangchangan3259@126.com"
] | zhangchangan3259@126.com |
0f9e8bf56e237289d9b8782ab16487cba6a90a17 | 9cd86811c2b7ee9815b6e7ff219bfb1c57b7b549 | /cloud-provider-payment8001/src/main/java/com/atguigu/springcloud/singleton/TestSingletonDCL.java | 4b7110c82c3883479e880984429c29c335e64a88 | [] | no_license | jokeryang1/myGithub | 289115458f4b994ccd94b81fcc2c076f3f4e0891 | dc202a2c6f59963329742335016918c3d797544a | refs/heads/master | 2023-04-22T07:12:22.836552 | 2021-05-06T06:02:07 | 2021-05-06T06:02:07 | 363,072,662 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 863 | java | package com.atguigu.springcloud.singleton;
/**
* @author Y.J.G
* @version 1.0.0
* @description
* @email banana_yang@outlook.com
* @date 2021/4/20 9:46
* 处理并发时候单例问题加锁 双重检查加锁
*/
public class TestSingletonDCL {
private static TestSingletonDCL singleton = null;
private String ddk ;
private TestSingletonDCL() {
}
public static TestSingletonDCL getInstance() {
if (singleton == null) {
synchronized (TestSingletonDCL.class) {
if (singleton == null) {
singleton = new TestSingletonDCL();
singleton.setDdk("二哥测试");
}
}
}
return singleton;
}
public String getDdk() {
return ddk;
}
public void setDdk(String ddk) {
this.ddk = ddk;
}
}
| [
"banana_yang@outlook.com"
] | banana_yang@outlook.com |
4c24976d698e3d8ae01f3222b6d7f93066c80f5a | 12ebee252e4afe21002c2387c2cfa3ddbd3d2f17 | /src/test/java/com/kish/AzureFunctions/FunctionTest.java | fd444eab4bc47b3e0d0b5235563475e8a82ecd7b | [] | no_license | manishanker/Java-AzureFunctions | 81c7ea292051752724c0a81523525b48fcd862db | ba040e83295d02f1296475d71debface0f659bfe | refs/heads/master | 2022-04-22T16:39:19.126557 | 2020-04-27T17:20:57 | 2020-04-27T17:20:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,760 | java | package com.kish.AzureFunctions;
import com.microsoft.azure.functions.*;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.util.*;
import java.util.logging.Logger;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
/**
* Unit test for Function class.
*/
public class FunctionTest {
/**
* Unit test for HttpTriggerJava method.
*/
@Test
public void testHttpTriggerJava() throws Exception {
// Setup
@SuppressWarnings("unchecked")
final HttpRequestMessage<Optional<String>> req = mock(HttpRequestMessage.class);
final Map<String, String> queryParams = new HashMap<>();
queryParams.put("name", "Azure");
doReturn(queryParams).when(req).getQueryParameters();
final Optional<String> queryBody = Optional.empty();
doReturn(queryBody).when(req).getBody();
doAnswer(new Answer<HttpResponseMessage.Builder>() {
@Override
public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
HttpStatus status = (HttpStatus) invocation.getArguments()[0];
return new HttpResponseMessageMock.HttpResponseMessageBuilderMock().status(status);
}
}).when(req).createResponseBuilder(any(HttpStatus.class));
final ExecutionContext context = mock(ExecutionContext.class);
doReturn(Logger.getGlobal()).when(context).getLogger();
// Invoke
// final HttpResponseMessage ret = new HttpTriggerFunction().run(req, context);
// Verify
// assertEquals(ret.getStatus(), HttpStatus.OK);
}
}
| [
"kanuparthikish@gmail.com"
] | kanuparthikish@gmail.com |
94be8a9cbfafd07bab2ca921262fce9de7f92d5d | 1017618669fe394c5b464a11adddeff552290245 | /app/src/main/java/com/michael/flickrbrowser/flick/FlickrImageViewHolder.java | 800355e2d6b4202b78c4500346c3fd4e73fe80e8 | [] | no_license | miketrng/Flickr | d0b7cbfbacc577d8865d8ab9a66ccc1f0a94af67 | 36566bd1a6188230ddc547dd00315e3f549ba73c | refs/heads/master | 2021-11-10T00:56:16.433214 | 2017-01-28T19:36:45 | 2017-01-28T19:36:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.michael.flickrbrowser.flick;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by Michael on 1/7/2017.
*/
public class FlickrImageViewHolder extends RecyclerView.ViewHolder{
protected ImageView thumbnail;
protected TextView title;
public FlickrImageViewHolder(View view){
super(view);
this.thumbnail= (ImageView) view.findViewById(R.id.thumbnail);
this.title = (TextView) view.findViewById(R.id.title);
}
}
| [
"Michael Nguyen"
] | Michael Nguyen |
de50081dbe72b5d0cd4290a2c41d158f3a3d7c15 | aae446f7bbc953c3280c95a3fdb1b0e69b56000a | /07-javaoopgame0/src/polymorphism/game/Goblin.java | 45d4156341e900f7fbd8ec04b94a546d49ce8b8d | [] | no_license | Ryu-kwonhee/javabasic | 499ee2c0c4e86099ee0ce2c5cd48167c0c3b151e | 48645def241fdb7bd5a4510872edfd14b308d3e6 | refs/heads/master | 2023-07-13T04:24:39.518230 | 2021-08-15T00:59:16 | 2021-08-15T00:59:16 | 380,178,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java | package polymorphism.game;
public class Goblin extends Monster {
public Goblin() {
super("고블린", 20, 10, 5);
}
public void battle() {
if (getHp() <= 0) {
}
}
}
| [
"wnsgkdl123@naver.com"
] | wnsgkdl123@naver.com |
3e80b3b93247d45bf10540066d22da48f4fb7539 | a1a5cd9ecf5b3e81ebbd43d2e2aac8d71fd4c930 | /src/main/java/com/coopcycle/service/package-info.java | f29fec2162a2c30ce648e25c553d090e2552af6d | [] | no_license | MathildeAguiar/coopcycle-application | 4cbff5da7a78219575c5a74749b073e1e50a6a80 | 47e006291874232ad977e1dbd1512e2fc41ae614 | refs/heads/main | 2023-03-31T23:20:05.491210 | 2021-04-03T14:06:07 | 2021-04-03T14:06:07 | 354,300,366 | 0 | 0 | null | 2021-04-03T14:00:51 | 2021-04-03T13:33:53 | Java | UTF-8 | Java | false | false | 63 | java | /**
* Service layer beans.
*/
package com.coopcycle.service;
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
6e8f6661f262655d66b84188007f68db2264b8b5 | 945caad96ceacfd4819374b999a08ed0b8a18f9d | /sBuilding/Trunk/Server/Java/smeetingregister/src/com/swt/meetingregister/controller/CustomMeetingController.java | 6be8e10ee043db60a13410720b614183e6e2b59c | [] | no_license | vuquangtin/VPUB | 1241f53a95253babb1df034ba63239198652ee72 | 48a8268136a1bcc22a515f2f418e14e549104b28 | refs/heads/master | 2021-06-25T14:11:39.845903 | 2017-09-14T15:07:04 | 2017-09-14T15:07:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,865 | java | /**
*
*/
package com.swt.meetingregister.controller;
/**
* @author Tenit
*
*/
public class CustomMeetingController {
// public static final CustomMeetingController Instance = new CustomMeetingController();
//// public static String PATH_SAVE = "/usr/tomcat-sworld/imagebarcode/";
// public static String PATH_SAVE = "/";
// public OrgPartaker insertOrgPartaker(OrgPartaker orgPartaker) {
// // insert orgmeeting
// OrgPartaker orgPartakerObj = new OrgPartaker();
// OrganizationMeeting organizationMeeting = new OrganizationMeeting();
// organizationMeeting.setName(orgPartaker.getName());
// organizationMeeting.setMeeting(false);
// OrganizationMeeting result = insertOrgMeeting(organizationMeeting);
// if (null != result) {
// //insert bang invite
// MeetingInvitation meetingInvitation = new MeetingInvitation();
// String barcode = RandomStringUtils.randomNumeric(13);
// meetingInvitation.setMeetingBarCode(barcode);
// meetingInvitation.setMeetingId(orgPartaker.getMeetingId());
// meetingInvitation.setOrganizationAttendId(result.getId());
// MeetingInvitation meetingInvitationResult = MeetingInvitationController.Instance.insert(meetingInvitation);
// if (meetingInvitationResult != null) {
// orgPartakerObj.setMeeting(result.isMeeting());
// orgPartakerObj.setBarcode(barcode);
// orgPartakerObj.setMeetingId(meetingInvitationResult.getId());
// orgPartakerObj.setName(result.getName());
// orgPartakerObj.setOrgattendId(result.getId());
// }
// }
// return orgPartakerObj;
// }
// private OrganizationMeeting insertOrgMeeting(OrganizationMeeting organizationMeeting) {
// return OrganizationMeetingController.Instance.insert(organizationMeeting);
// }
// public String saveImage(String barcode) throws FileNotFoundException, DocumentException, URISyntaxException {
// Document document = new Document();
// String path = PATH_SAVE + barcode + ".pdf";
// File file = new File(path);
// System.out.println(file.getAbsolutePath());
// PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
// document.open();
// PdfContentByte cb = writer.getDirectContent();
// BarcodeEAN codeEAN = new BarcodeEAN();
// codeEAN.setCodeType(Barcode.EAN13);
// codeEAN.setCode(barcode);
// Image imageEAN = codeEAN.createImageWithBarcode(cb, null, null);
// imageEAN.scaleToFit(250, 700);
// document.add(imageEAN);
// document.close();
//
// return path;
// }
//
// public int sendEmail(ObjectMail obj) {
// // ObjectMail objectMail = readAppConfig();
// List<Partaker> lstPartaker = PartakerController.Instance.getPartakerByOrgPartakerId(obj.getOrgPartaker());
// if (null != lstPartaker) {
// for (Partaker objSend : lstPartaker) {
// sendEmailPartaker(objSend, obj);
// }
// }
// return 0;
// }
//
// private void sendEmailPartaker(Partaker partaker, ObjectMail obj) {
// EmailConfig emailConfig = RegisterAccountController.Instance.getEmailConfig();
// if (emailConfig != null && !partaker.getIsSenmail()) {
// final String email = emailConfig.getEmail();
// final String password = emailConfig.getPassWord();
//
// Properties props = new Properties();
// props.put("mail.smtp.host", "smtp.gmail.com");
// props.put("mail.smtp.socketFactory.port", "465");
// props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
// props.put("mail.smtp.auth", "true");
// props.put("mail.smtp.port", "465");
//
// Session session = Session.getInstance(props, new javax.mail.Authenticator() {
// protected PasswordAuthentication getPasswordAuthentication() {
// return new PasswordAuthentication(email, password);
// }
// });
//
// try {
// Message message = new MimeMessage(session);
// message.setFrom(new InternetAddress(email));
// message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(partaker.getEmail()));
// message.setSubject(obj.getSubject());
// message.setText (obj.getContent());
// message.setHeader("Content-Type", "multipart/mixed;charset=UTF-8");
//
// BodyPart messageBodyPart = new MimeBodyPart();
//
// // Now set the actual message
// messageBodyPart.setText(obj.getContent());
//
// // Create a multipar message
// Multipart multipart = new MimeMultipart();
//
// // Set text message part
// multipart.addBodyPart(messageBodyPart);
// String fileAttachment = PATH_SAVE + partaker.getBarcode() + ".pdf";
// System.out.println(fileAttachment);
// File file = new File(fileAttachment);
// file.getAbsolutePath();
// // Part two is attachment
// messageBodyPart = new MimeBodyPart();
// DataSource source = new FileDataSource(fileAttachment);
// messageBodyPart.setDataHandler(new DataHandler(source));
// messageBodyPart.setFileName(partaker.getBarcode() + ".pdf");
// multipart.addBodyPart(messageBodyPart);
//
// // Send the complete message parts
// message.setContent(multipart);
// Transport.send(message);
// partaker.setIsSenmail(true);
// PartakerController.Instance.update(partaker);
// file.delete();
// System.out.println("Done");
//
// } catch (MessagingException e) {
// throw new RuntimeException(e);
// }
// }
// }
// public void sendMailDelete(long partakerId){
// Partaker partaker = PartakerController.Instance.getPartakerById(partakerId);
// EmailConfig emailConfig = RegisterAccountController.Instance.getEmailConfig();
// if (emailConfig != null && partaker!=null) {
// final String email = emailConfig.getEmail();
// final String password = emailConfig.getPassWord();
//
// Properties props = new Properties();
// props.put("mail.smtp.host", "smtp.gmail.com");
// props.put("mail.smtp.socketFactory.port", "465");
// props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
// props.put("mail.smtp.auth", "true");
// props.put("mail.smtp.port", "465");
//
// Session session = Session.getInstance(props, new javax.mail.Authenticator() {
// protected PasswordAuthentication getPasswordAuthentication() {
// return new PasswordAuthentication(email, password);
// }
// });
//
// try {
// Message message = new MimeMessage(session);
// message.setFrom(new InternetAddress(email));
// message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(partaker.getEmail()));
// message.setSubject("Hủy cuộc hop");
// message.setText("Bạn đã bị xóa khỏi cuộc họp");
// message.setHeader("Content-Type", "multipart/mixed");
//
// message.setContent(emailConfig.getUser(),"Bạn đã bị xóa khỏi cuộc họp này");
// Transport.send(message);
// partaker.setIsSenmail(true);
// PartakerController.Instance.update(partaker);
// System.out.println("Done");
//
// } catch (MessagingException e) {
// throw new RuntimeException(e);
// }
// }
// }
}
| [
"minhnpa1907@gmail.com"
] | minhnpa1907@gmail.com |
60d642106e787f950c8a3fa406e9b4746a3272f3 | b2f44ba766a44426cd06ebfb922d8b75c1773d63 | /src/com/leetcode/P934_ShortestBridge.java | a81af7d9a594bbbae199959e817f7e599d0cb1d6 | [] | no_license | joy32812/leetcode | a1179ecff91127a6cda83cf70838354b0670970f | 9bd74b9774012df0e2e221eedc63d10f3ba88238 | refs/heads/master | 2023-08-16T14:11:34.232388 | 2023-08-13T11:30:05 | 2023-08-13T11:30:05 | 81,704,645 | 10 | 5 | null | null | null | null | UTF-8 | Java | false | false | 2,458 | java | package com.leetcode;
import java.util.*;
public class P934_ShortestBridge {
int[] dx = new int[]{0, 0, 1, -1};
int[] dy = new int[]{1, -1, 0, 0};
public int shortestBridge(int[][] A) {
if (A == null || A.length == 0) return 0;
int m = A.length;
int n = A[0].length;
int[][] color = new int[m][n];
int cnt = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (A[i][j] == 0) continue;
if (color[i][j] != 0) continue;;
cnt ++;
Queue<Integer> Q = new LinkedList<>();
Q.add(i * n + j);
color[i][j] = cnt;
while (!Q.isEmpty()) {
int now = Q.poll();
int x = now / n;
int y = now % n;
for (int k = 0; k < dx.length; k++) {
int nx = x + dx[k];
int ny = y + dy[k];
if (nx < 0 || nx >= m || ny < 0 || ny >= n) continue;
if (A[nx][ny] == 0) continue;
if (color[nx][ny] != 0) continue;
color[nx][ny] = cnt;
Q.add(nx * n + ny);
}
}
}
}
List<Integer> one = new ArrayList<>();
List<Integer> two = new ArrayList<>();
for (int i = 0; i < m; i++) {
for (int j = 0;j < n; j++) {
if (color[i][j] == 1) one.add(i * n + j);
if (color[i][j] == 2) two.add(i * n + j);
}
}
int ans = Integer.MAX_VALUE;
for (int i = 0; i < one.size(); i++) {
int ax = one.get(i) / n;
int ay = one.get(i) % n;
for (int j = 0; j < two.size(); j++) {
int bx = two.get(j) / n;
int by = two.get(j) % n;
int nowVal = 0;
if (ax != bx) nowVal += Math.abs(ax - bx);
if (ay != by) nowVal += Math.abs(ay - by);
ans = Math.min(ans, nowVal - 1);
}
}
return ans;
}
public static void main(String[] args) {
int[][] A = new int[][]{
{1,1,1,1,1},{1,0,0,0,1},{1,0,1,0,1},{1,0,0,0,1},{1,1,1,1,1}
};
System.out.println(new P934_ShortestBridge().shortestBridge(A));
}
}
| [
"joy32812@qq.com"
] | joy32812@qq.com |
3065e2489cce197bce55f19c2f45b8d1d3933e98 | 47266a6e073295cf7e1248fef367420425a765ac | /com/epsilon/world/content/skill/impl/farming/Allotment.java | e702a81b7787483416d2908320b1eceb8e622d37 | [] | no_license | StraterAU/Epsilon | 86d4e392c2fad892e7c6b141506d5a42458d576e | 6b89b34fba253314d93cd9ae09ea3a9737cb7482 | refs/heads/master | 2021-03-24T13:02:28.476618 | 2017-04-02T12:23:14 | 2017-04-02T12:23:14 | 86,983,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 86 | java | package com.epsilon.world.content.skill.impl.farming;
public class Allotment {
}
| [
"Taylan Selvi@Taylan"
] | Taylan Selvi@Taylan |
786a74c1d97982ec250927fa8e616d7003f2b36a | b82e48e27b6f8442e28d2844bc7da5a3a93fd0de | /base/src/main/java/com/avogine/render/shader/uniform/light/UniformPointLight.java | 5ff422179dad0c2204b673746dcd0f05cf630436 | [] | no_license | Avoduhcado/MAvogine | b6d67e7a3e5aaa661653ac6e8433da13dca8e794 | 14479da79a3fca38f6fac921a192034f1ddfb7ba | refs/heads/master | 2023-07-09T13:38:04.081723 | 2023-06-18T19:02:44 | 2023-06-18T19:02:44 | 234,962,574 | 0 | 0 | null | 2023-07-03T00:17:29 | 2020-01-19T20:41:00 | Java | UTF-8 | Java | false | false | 1,351 | java | package com.avogine.render.shader.uniform.light;
import com.avogine.entity.light.*;
import com.avogine.render.shader.uniform.*;
/**
*
*/
public class UniformPointLight extends UniformLight<PointLight> {
private final UniformVec3 position = new UniformVec3();
/**
* @see <a href="http://wiki.ogre3d.org/tiki-index.php?page=-Point+Light+Attenuation">Ogre3D Wiki</a>
*/
private final UniformFloat constant = new UniformFloat();
private final UniformFloat linear = new UniformFloat();
private final UniformFloat quadratic = new UniformFloat();
@Override
public void storeUniformLocation(int programID, String name) {
super.storeUniformLocation(programID, name);
position.storeUniformLocation(programID, name + ".position");
constant.storeUniformLocation(programID, name + ".constant");
linear.storeUniformLocation(programID, name + ".linear");
quadratic.storeUniformLocation(programID, name + ".quadratic");
}
@Override
public void loadLight(PointLight light) {
position.loadVec3(light.getTransformPosition());
ambient.loadVec3(light.getAmbient());
diffuse.loadVec3(light.getDiffuse());
specular.loadVec3(light.getSpecular());
constant.loadFloat(light.getConstant());
linear.loadFloat(light.getLinear());
quadratic.loadFloat(light.getQuadratic());
}
}
| [
"lostking9@yahoo.com"
] | lostking9@yahoo.com |
d1823545a277457ef28d0dbc034ec5f763b09c9b | e3464d625ce48e29bb4f3d70122f8879ce71ee0c | /helpdesk-ui/src/main/java/com/helpdesk/ui/request/AddRequestPage.java | 90625438296e86482892fc41446a9c5e014441bb | [] | no_license | dariusdanis/HelpDesk | 097641f9cf67aa8c7c189c55c23a10b2ae65f9e8 | 8a5ca841609aef63320e0ffba8fce38a680d5c2e | refs/heads/master | 2021-01-20T06:25:09.650276 | 2014-01-07T05:03:41 | 2014-01-07T05:03:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,367 | java | package com.helpdesk.ui.request;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import com.helpdesk.domain.entity.FacilityEntity;
import com.helpdesk.domain.entity.RequestEntity;
import com.helpdesk.domain.entity.TypeEntity;
import com.helpdesk.domain.entity.UserEntity;
import com.helpdesk.domain.service.FacilityService;
import com.helpdesk.domain.service.RequestService;
import com.helpdesk.domain.service.TypeService;
import com.helpdesk.domain.service.UserService;
import com.helpdesk.ui.BasePage;
import com.helpdesk.ui.SingInPage;
import com.helpdesk.ui.user.HomePage;
import com.helpdesk.ui.utils.Constants;
public class AddRequestPage extends BasePage {
private static final long serialVersionUID = 1L;
private RequestEntity requestEntity;
@SpringBean
private TypeService typeService;
@SpringBean
private UserService userService;
@SpringBean
private RequestService requestService;
@SpringBean
private FacilityService facilityService;
@Override
protected void onInitialize() {
super.onInitialize();
if (!isSingIn()) {
setResponsePage(SingInPage.class);
return;
} else if (authorize(getLoggedUser())) {
setResponsePage(HomePage.class);
return;
}
requestEntity = new RequestEntity();
Form<?> form = initForm("requsetForm");
form.add(initInputField("summary", "requestEntity.summary"));
form.add(initTextArea("requestText", "requestEntity.requestText"));
form.add(initTypeDropDown("type", typeService.getAll(), "requestEntity.typeEntity"));
DropDownChoice<FacilityEntity> facilityDropDown = initFacilityDropDown("facility", "requestEntity.facilityEntity");
DropDownChoice<RequestEntity> parentDropDown = initParentDropDown("parent", "requestEntity.parentRequsetId");
WebMarkupContainer parentAndFacilityContainer = new WebMarkupContainer("parentAndFacilityContainer");
parentAndFacilityContainer.setOutputMarkupId(true);
form.add(initClientDropDown("client", userService.findAllByRole(Constants.Roles.CLIEN.toString()),
"requestEntity.requestBelongsTo", parentAndFacilityContainer));
form.add(initReceiptDropDown("receipt", Constants.receiptMethodsList, "requestEntity.receiptMethod"));
parentAndFacilityContainer.add(facilityDropDown);
parentAndFacilityContainer.add(parentDropDown);
form.add(parentAndFacilityContainer);
add(form);
}
private Form<?> initForm(String wicketId) {
final Form<?> form = new Form<Void>(wicketId);
form.add(new AjaxFormSubmitBehavior("onsubmit") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
List<Object> validationError = validateRequsetForm(getFieldToValidate(), requestEntity);
if (validationError != null) {
appendJavaScript(target, validationError.get(0), validationError.get(1));
} else {
requestEntity.setCreatorEntity(getLoggedUser());
if (client()) {
requestEntity.setReceiptMethod(Constants.ReceiptMethod.SELF_SERVICE.toString());
requestEntity.setRequestBelongsTo(getLoggedUser());
}
requestEntity.setRequestDate(BasePage.getSysteDate());
requestEntity.setStatus(Constants.Status.NOT_ASSIGNED.toString());
requestEntity = requestService.merge(requestEntity);
notificationService.merge(requestEntity, userService.findAllByRole("ADMIN"), Constants.NEW_REQUEST);
sendToRole(Constants.Roles.ADMIN.toString());
getSession().info("Request successfully added!");
setResponsePage(HomePage.class);
}
}
});
return form;
}
private DropDownChoice<TypeEntity> initTypeDropDown(String wicketId,
List<TypeEntity> list, String expression) {
DropDownChoice<TypeEntity> types = new DropDownChoice<TypeEntity>(wicketId,
new PropertyModel<TypeEntity>(this, expression), list) {
private static final long serialVersionUID = 1L;
@Override
protected CharSequence getDefaultChoice(String selectedValue) {
return "";
}
};
types.setOutputMarkupId(true);
return types;
}
private DropDownChoice<FacilityEntity> initFacilityDropDown(String wicketId, String expression) {
List<FacilityEntity> list;
if (client()) {
list = facilityService.getAllByCompany(getLoggedUser().getCompanyEntity());
} else if (requestEntity.getRequestBelongsTo() != null) {
list = facilityService.getAllByCompany(requestEntity.getRequestBelongsTo().getCompanyEntity());
} else {
list = new ArrayList<FacilityEntity>();
}
DropDownChoice<FacilityEntity> types = new DropDownChoice<FacilityEntity>(wicketId,
new PropertyModel<FacilityEntity>(this, expression), list) {
private static final long serialVersionUID = 1L;
@Override
protected CharSequence getDefaultChoice(String selectedValue) {
return "";
}
};
types.setOutputMarkupId(true);
return types;
}
private WebMarkupContainer initClientDropDown(String wicketId,
List<UserEntity> list, String expression, WebMarkupContainer parentAndFacilityContainer) {
WebMarkupContainer clientConteiner = new WebMarkupContainer("clientConteiner");
DropDownChoice<UserEntity> clients = new DropDownChoice<UserEntity>(wicketId,
new PropertyModel<UserEntity>(this, expression), list) {
private static final long serialVersionUID = 1L;
@Override
protected CharSequence getDefaultChoice(String selectedValue) {
return "";
}
};
clients.setOutputMarkupId(true);
clients.add(initChangeBehaviour(parentAndFacilityContainer));
clientConteiner.add(clients);
clientConteiner.setVisible(director() || admin());
return clientConteiner;
}
private OnChangeAjaxBehavior initChangeBehaviour(final WebMarkupContainer parentAndFacilityContainer) {
return new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
parentAndFacilityContainer.removeAll();
DropDownChoice<FacilityEntity> facilityDropDown = initFacilityDropDown("facility", "requestEntity.facilityEntity");
DropDownChoice<RequestEntity> parentDropDown = initParentDropDown("parent", "requestEntity.parentRequsetId");
parentAndFacilityContainer.add(facilityDropDown);
parentAndFacilityContainer.add(parentDropDown);
target.add(parentAndFacilityContainer);
target.appendJavaScript("refreshSelects('" + facilityDropDown.getMarkupId() + "', '"
+ parentDropDown.getMarkupId() + "');");
}
};
}
private DropDownChoice<RequestEntity> initParentDropDown(String wicketId, String expression) {
List<RequestEntity> list;
if (client()) {
list = requestService.getAllByCreatOrBelongsTo(getLoggedUser());
} else if (requestEntity.getRequestBelongsTo() != null) {
list = requestService.getAllByCreatOrBelongsTo(requestEntity.getRequestBelongsTo());
} else {
list = new ArrayList<RequestEntity>();
}
DropDownChoice<RequestEntity> parent = new DropDownChoice<RequestEntity>(wicketId,
new PropertyModel<RequestEntity>(this, expression), list) {
private static final long serialVersionUID = 1L;
@Override
protected CharSequence getDefaultChoice(String selectedValue) {
return "";
}
};
parent.setOutputMarkupId(true);
return parent;
}
private WebMarkupContainer initReceiptDropDown(String wicketId,
List<String> list, String expression) {
WebMarkupContainer receiptConteiner = new WebMarkupContainer("receiptConteiner");
DropDownChoice<String> types = new DropDownChoice<String>(wicketId,
new PropertyModel<String>(this, expression), list) {
private static final long serialVersionUID = 1L;
@Override
protected CharSequence getDefaultChoice(String selectedValue) {
return "";
}
};
types.setOutputMarkupId(true);
receiptConteiner.add(types);
receiptConteiner.setVisible(director() || admin());
return receiptConteiner;
}
private TextField<String> initInputField(String wicketId, String expression) {
TextField<String> textField = new TextField<String>(wicketId,
new PropertyModel<String>(this, expression));
textField.setOutputMarkupId(true);
return textField;
}
private TextArea<String> initTextArea(String wicketId, String expression) {
TextArea<String> textAria = new TextArea<String>(wicketId,
new PropertyModel<String>(this, expression));
textAria.setOutputMarkupId(true);
return textAria;
}
private boolean authorize(UserEntity loggedUser) {
return loggedUser.getRoleEntity().getRole().equals(Constants.Roles.ENGIN.toString());
}
private List<String> getFieldToValidate() {
if (client()) {
return Arrays.asList(new String[]{"summary","typeEntity","facilityEntity","requestText"});
} else {
return Arrays.asList(new String[]{"summary", "receiptMethod", "typeEntity",
"requestBelongsTo", "facilityEntity", "requestText"});
}
}
}
| [
"dariusdanis@gmail.com"
] | dariusdanis@gmail.com |
bd12f52b928cf9b7d9fbe265f2927510b2f48515 | fa15bd6543befa5935be0bafb6081f8d8009094a | /app/src/main/java/com/example/carl/optimizelistview/NewsBean.java | 6ee4ca13afe7e239674a05025c9b77bb5540335a | [] | no_license | carlcarl001001/OptimmizeListView | f6da522b782801bf3d92fdf1be5aeaff3f007de3 | 36452ecddc6cd01b2f68c961aa4bf5cd2c9e9576 | refs/heads/master | 2022-11-10T06:44:18.799424 | 2020-06-17T07:04:51 | 2020-06-17T07:04:51 | 272,897,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 140 | java | package com.example.carl.optimizelistview;
public class NewsBean {
String newsIconUrl;
String newsTitle;
String newsContent;
}
| [
"carlcarl001@126.com"
] | carlcarl001@126.com |
9f936150ec5067cd710a283e9babe0b1dbbbff2f | 088763643a8d3a7faf8c1d8cdec31e7940ca560d | /app/src/main/java/com/example/android/popularmovies/Trailer.java | 249de1f838c5c1b187eef98b1ad448d900afcb84 | [] | no_license | rayzrtx/PopularMovies | 0d2eb59fcafc685e7e47dc793dc2f78e342680d9 | d7a8b01948653827a7cc8e00b680a3cf316accfc | refs/heads/master | 2020-03-20T05:53:48.586532 | 2018-08-11T19:54:24 | 2018-08-11T19:54:24 | 137,230,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.example.android.popularmovies;
public class Trailer {
private String movieTrailerKey;
private String movieTrailerName;
public Trailer() {
}
public Trailer(String movieTrailerKey, String movieTrailerName) {
this.movieTrailerKey = movieTrailerKey;
this.movieTrailerName = movieTrailerName;
}
public String getMovieTrailerKey() {
return movieTrailerKey;
}
public void setMovieTrailerKey(String movieTrailerKey) {
this.movieTrailerKey = movieTrailerKey;
}
public String getMovieTrailerName() {
return movieTrailerName;
}
public void setMovieTrailerName(String movieTrailerName) {
this.movieTrailerName = movieTrailerName;
}
}
| [
"rayl77@gmail.com"
] | rayl77@gmail.com |
06825e7f97ae5b289924321f3e7749d72acf5c7d | 2f74b4d8c9ff3eea6af4dddfae32ef768928e926 | /src/main/java/solution/offer/Solution10A.java | d1ffa86e852e3c026cf79d6614c771c30cec6ff4 | [] | no_license | LittleWhite2017/leetcode | fe4df51eccb77cc11db9822288cded9ad081c06e | e2577eb0c1ba7180665c137b94f502f23a9c145c | refs/heads/master | 2020-09-05T19:23:05.564326 | 2020-06-15T02:03:34 | 2020-06-15T02:03:34 | 220,191,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package solution.offer;
/**
* 写一个函数,输入 n ,求斐波那契(Fibonacci)数列的第 n 项。斐波那契数列的定义如下:
*
* F(0) = 0, F(1) = 1
* F(N) = F(N - 1) + F(N - 2), 其中 N > 1.
* 斐波那契数列由 0 和 1 开始,之后的斐波那契数就是由之前的两数相加而得出。
*
* 答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1。
*/
public class Solution10A {
public int fib(int n) {
if(n ==0 || n == 1){
return n;
}
int[] val = new int[n];
for(int i =0 ;i < n ;i++){
if(i ==0 || i == 1){
val[i] = i;
}else{
val[i] = (val[i-1] + val[i-2])% 1000000007;
}
}
return (val[n-1] + val[n-2])%1000000007;
}
}
| [
"879041955@qq.com"
] | 879041955@qq.com |
e1e8a40ba6597ed21c01f0ec4142e3f90b0d95cd | 6c57e8b57ee71c6b8a492090ef58655ce1dbea6f | /src/nl/spookystoriesinc/coolgame/objects/DiningTable.java | 73d2715ab86c3773d758cc0f28bf05dee8a7c37f | [] | no_license | lmartos/SoulSurviver | 3e28325db34d6b4b827b3e507f60e46982ea0679 | 5e72eaaab14535f0541d5d9dbd50ed88102926c7 | refs/heads/master | 2020-05-18T22:09:01.861652 | 2015-04-09T07:50:08 | 2015-04-09T07:50:08 | 32,381,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | java | package nl.spookystoriesinc.coolgame.objects;
import android.util.Log;
import nl.spookystoriesinc.coolgame.CoolGame;
import nl.spookystoriesinc.model.GameBoard;
import nl.spookystoriesinc.model.GameObject;
public class DiningTable extends GameObject {
public static final String DININGTABLE_LEFT_IMAGE = "Dining Table Left";
public static final String DININGTABLE_MIDDLE_IMAGE = "Dining Table Middle";
public static final String DININGTABLE_RIGHT_IMAGE = "Dining Table Right";
private String state;
public DiningTable(String state) {
super();
this.state = state;
}
/** Returns the ImageId of the image to show. */
@Override
public String getImageId() {
return state;
}
@Override
public void onTouched(GameBoard gameBoard) {
}
/** Returns the R.drawable generated unique code for the image
* or 0 when not needed*/
@Override
public int getImageIdInt() {
return 0;
}
}
| [
"l-martos@hotmail.com"
] | l-martos@hotmail.com |
cb6af47045caa232665f0de5756f3fee469f9f0d | c7f607090318e6cf83e4ed9c122bf13989673236 | /lib/maven/src/main/java/kuona/maven/analyser/Maven.java | c3c91c1b7cdeeef2775e2b506098e16f27de7e00 | [
"Apache-2.0"
] | permissive | kuona/kuona | 23aa1699fd34f686c4b4e54f72584b4e495af7aa | f26bbb7eee7513bf9be23ee769543937afe8ce4f | refs/heads/master | 2022-06-23T15:28:08.849081 | 2022-06-18T16:28:50 | 2022-06-18T16:28:50 | 68,456,861 | 1 | 2 | Apache-2.0 | 2022-06-12T05:41:43 | 2016-09-17T14:24:32 | JavaScript | UTF-8 | Java | false | false | 700 | java | package kuona.maven.analyser;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.io.PrintStream;
public class Maven {
private final String path;
Maven(String path) {
this.path = path;
}
void run(String command, PrintStream out) {
try {
Process p = Runtime.getRuntime().exec(command, null, new File(path));
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
out.println(line);
}
if (p.isAlive()) {
p.waitFor();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"graham@grahambrooks.com"
] | graham@grahambrooks.com |
36a1b34ec5d18debe1996e101e508ee796b8204d | 6e569ac7a18df0a86a5de3f744b281d98ffca4d0 | /CoreConcepts/src/LongestCommonSubstring.java | 272e385a8ac7c249d29bb32a71cc45ce3adbd610 | [] | no_license | rameshind/Core | 2caaf5f4d92aab30417e61552649e00e93fa8eca | 93e36b2eb80ca4b9ec59a2af49c3fa32785a5f21 | refs/heads/master | 2020-05-31T10:58:37.060277 | 2015-01-27T11:15:23 | 2015-01-27T11:15:23 | 29,052,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java | import java.util.Scanner;
public class LongestCommonSubstring {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String n = in.nextLine();
String text1 = in.nextLine().trim();
String text2 = in.nextLine().trim();
System.out.println(lcs(text1, text2));
in.close();
}
public static String lcs(String a, String b) {
int[][] lengths = new int[a.length() + 1][b.length() + 1];
// row 0 and column 0 are initialized to 0 already
for (int i = 0; i < a.length(); i++)
for (int j = 0; j < b.length(); j++)
if (a.charAt(i) == b.charAt(j))
lengths[i + 1][j + 1] = lengths[i][j] + 1;
else
lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j],
lengths[i][j + 1]);
// read the substring out from the matrix
StringBuffer sb = new StringBuffer();
for (int x = a.length(), y = b.length(); x != 0 && y != 0;) {
if (lengths[x][y] == lengths[x - 1][y])
x--;
else if (lengths[x][y] == lengths[x][y - 1])
y--;
else {
assert a.charAt(x - 1) == b.charAt(y - 1);
sb.append(a.charAt(x - 1));
x--;
y--;
}
}
return sb.reverse().toString();
}
}
| [
"ramesh_ind09@yahoo.com"
] | ramesh_ind09@yahoo.com |
ff5ba4c271d94a51b00a604d824020c547cad5b4 | 47502062029536516161b7fd483acf4aa13ba72e | /src/main/java/com/edu/cauvery/home/Home.java | 24b9e702f64197d7fe25fe309d023b78cecfbc09 | [] | no_license | mlokesh/cauvery | 61a2361fd2bbaee95601167c8f6a7381b80f76bb | b1b50a559f4b5729b86d0d3d12c6e0dc170f2ba1 | refs/heads/master | 2022-06-14T21:16:52.055172 | 2016-10-01T19:13:25 | 2016-10-01T19:13:25 | 38,137,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,838 | java | package com.edu.cauvery.home;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.SubmitLink;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.util.value.ValueMap;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Home extends WebPage {
private static final Logger logger = Logger.getLogger(Home.class.getName());
Form<ValueMap> form = new Form<ValueMap>("inputForm", new CompoundPropertyModel<ValueMap>(new ValueMap()));
private CheckBox testCheckBox;
private Label testCheckBoxLabel;
private TextField<String> urlText;
private FeedbackPanel feedback;
private int counterOne = 0;
private int counterTwo = 0;
private Label label;
public Home() {
add(new Label("message", "Wicket Controls:"));
addLink();
addLinkAjax();
testCheckBox = new CheckBox("testCheckBox");
testCheckBoxLabel = new Label("testCheckBoxLabel", "Check Box: ");
urlText = new TextField<String>("urlText", new Model<String>());
SubmitButton submitButton = new SubmitButton("submitButton");
SubmitLink cancelLink = new SubmitLink("cancelLink");
form.add(testCheckBox);
form.add(testCheckBoxLabel);
form.add(urlText);
form.add(submitButton);
form.add(cancelLink);
add(form);
feedback = new FeedbackPanel("feedback");
add(feedback);
final List<Employee> employeeList = new ArrayList<Employee>();
employeeList.add(new Employee(1, "Test1"));
employeeList.add(new Employee(2, "Test2"));
employeeList.add(new Employee(3, "Test3"));
final ListView<Employee> tables = new ListView<Employee>("tables", employeeList) {
@Override
protected void populateItem(ListItem<Employee> item) {
}
};
}
private class SubmitButton extends Button {
private static final long serialVersionUID = 105579730351611664L;
SubmitButton(String name) {
super(name);
}
@Override
public void onSubmit() {
logger.log(Level.INFO, urlText.getInput());
if (urlText.getModelObject() == null) {
feedback.error("URL can't be null");
}
}
}
private void addLink() {
add(new Link("link") {
@Override
public void onClick() {
counterOne++;
}
});
add(new Label("label", new PropertyModel(this, "counterOne")));
}
private void addLinkAjax() {
add(new AjaxFallbackLink("ajaxlink") {
@Override
public void onClick(final AjaxRequestTarget target) {
counterTwo++;
if (target != null) {
target.addComponent(label);
}
}
});
addLabel();
}
private void addLabel() {
label = new Label("alabel", new PropertyModel(this, "counterTwo"));
label.setOutputMarkupId(true);
add(label);
}
}
| [
"gmlokesh@gmail.com"
] | gmlokesh@gmail.com |
007c720b7e7f85ff303ae38353f3889e2cd9f0ec | aa5322b2c78889a2b0af9e909ca2966be2aa4878 | /commons/src/main/java/org/demosecurity/commons/exception/GeneralExceptionHandler.java | c1e60e01405925eb9ffd94db03efc0d064ebc431 | [] | no_license | NemanjaJoksic/demo-security | ddd32097915b648a2a02541cbd80aee296fa94e7 | 52178ff6558c28416e600b670c4a27eb906055d6 | refs/heads/master | 2023-05-25T03:43:05.162390 | 2019-08-08T15:48:55 | 2019-08-08T15:48:55 | 201,039,922 | 0 | 0 | null | 2023-05-23T20:11:18 | 2019-08-07T11:49:45 | Java | UTF-8 | Java | false | false | 1,240 | 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 org.demosecurity.commons.exception;
import org.demosecurity.commons.model.ApiResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
/**
*
* @author joksin
*/
@ControllerAdvice
public class GeneralExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(GeneralExceptionHandler.class);
@ExceptionHandler(GeneralException.class)
public ResponseEntity handleGenralException(GeneralException ex) {
logger.warn(ex.getMessage(), ex);
return new ResponseEntity(ApiResponse.exception(ex), ex.getHttpStatus());
}
@ExceptionHandler(Exception.class)
public ResponseEntity handleException(Exception ex) {
logger.error(ex.getMessage(), ex);
GeneralException gEx = new GeneralException(ex);
return new ResponseEntity(ApiResponse.exception(gEx), gEx.getHttpStatus());
}
}
| [
"nemanja.joksic@msg-global.com"
] | nemanja.joksic@msg-global.com |
01f1318b0a25fc190edd46f689fa7ebaf26b705f | 7320a31dc65030c1155dfeae9ee7face4114bc9c | /src/main/java/pl/codeprime/repositories/entity/bills/household/to/UtilityBillTO.java | 52020ddf8bfe2feb006650488f1a290f488a9ef2 | [] | no_license | matowp/ManagingHome | f09813583c73ee4105655ab576d20e05f46c41a7 | 6813f69f4da133f3ec4d8d1549ba03655410d534 | refs/heads/master | 2021-08-31T19:15:25.970377 | 2017-12-22T14:13:13 | 2017-12-22T14:13:13 | 115,015,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | java | /**
*
*/
package pl.codeprime.repositories.entity.bills.household.to;
import java.math.BigDecimal;
import java.util.Date;
import pl.codeprime.converters.ObjectConverters;
import pl.codeprime.repositories.entity.bills.household.UtilityBillType;
/**
* @author MOwsians
*
*/
public class UtilityBillTO {
private String description;
private String title;
private Date toDate;
private double amount;
private UtilityBillType type;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Date getToDate() {
return toDate;
}
public void setToDate(Date toDate) {
this.toDate = toDate;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public UtilityBillType getType() {
return type;
}
public void setType(UtilityBillType type) {
this.type = type;
}
public BigDecimal getAmountAsBigDecimal() {
return ObjectConverters.toBigDecimal(getAmount());
}
}
| [
"33481229+wsRTest@users.noreply.github.com"
] | 33481229+wsRTest@users.noreply.github.com |
717914adb26cbb310b53e7e4f37c4c7f77b12423 | 25ba151b6b3fb2d4a8666d576abb1869a45a146e | /SeaJewelResort/src/seajewel/view/StaffLogInForm.java | 8b9dbfd927d08a308ad849cd009efdb26d94bcac | [] | no_license | courtneyzhan/hotelwise | 813aeba5c817b8e33d276bebd0471337eea375c3 | 6015367b7c962842f8d1759abf21d1f4b3d3d990 | refs/heads/master | 2020-06-15T03:52:30.930163 | 2017-05-19T10:59:22 | 2017-05-19T10:59:22 | 75,333,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,190 | 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 seajewel.view;
import seajewel.Hotelwise;
/**
*
* @author Courtney Zhan
*/
public class StaffLogInForm extends javax.swing.JFrame {
/**
* Creates new form StaffLoginForm
*/
public StaffLogInForm() {
initComponents();
incorrectTextField.setVisible(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
usernameTextField = new javax.swing.JTextField();
SignInButton = new javax.swing.JButton();
passwordField = new javax.swing.JPasswordField();
incorrectTextField = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
jLabel1.setText("Staff Log In");
jLabel2.setText("Username:");
jLabel3.setText("Password:");
usernameTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
usernameTextFieldActionPerformed(evt);
}
});
SignInButton.setText("Sign In");
SignInButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SignInButtonActionPerformed(evt);
}
});
passwordField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
passwordFieldActionPerformed(evt);
}
});
incorrectTextField.setEditable(false);
incorrectTextField.setText("The username/password you entered is incorrect");
incorrectTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
incorrectTextFieldActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(SignInButton)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2))
.addGap(48, 48, 48)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(usernameTextField)
.addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(incorrectTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(120, 120, 120))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(25, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(incorrectTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(usernameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(SignInButton)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void usernameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usernameTextFieldActionPerformed
}//GEN-LAST:event_usernameTextFieldActionPerformed
private void SignInButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SignInButtonActionPerformed
incorrectTextField.setVisible(true);
Hotelwise.staffLogin(usernameTextField.getText(), passwordField.getText());
}//GEN-LAST:event_SignInButtonActionPerformed
private void passwordFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passwordFieldActionPerformed
}//GEN-LAST:event_passwordFieldActionPerformed
private void incorrectTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incorrectTextFieldActionPerformed
}//GEN-LAST:event_incorrectTextFieldActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(StaffLogInForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(StaffLogInForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(StaffLogInForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(StaffLogInForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new StaffLogInForm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton SignInButton;
private javax.swing.JTextField incorrectTextField;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPasswordField passwordField;
private javax.swing.JTextField usernameTextField;
// End of variables declaration//GEN-END:variables
void resetFields() {
usernameTextField.setText("");
passwordField.setText("");
}
}
| [
"zhimin@itest2.com"
] | zhimin@itest2.com |
dd5f88b472568e6af7d035c2b152f8ee34c3d345 | 401da88fd445fdd51453fd3ba320985e2420e9da | /lorrinart/src/clientvideo/dao/DaoManager.java | 4de10901249566e1a8484e9371f87afb5bc40bea | [] | no_license | rzerot/lorrinart | 0328bfb0445d5dd9f9f437c75a7f27d3ff1d10a6 | e33e7ccd8f9632d83d2ee4df60a8e141b5ba3576 | refs/heads/master | 2020-12-02T17:42:06.422083 | 2017-07-06T10:21:44 | 2017-07-06T10:21:44 | 96,415,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package clientvideo.dao;
import java.sql.Connection;
import java.sql.SQLException;
public class DaoManager {
protected Connection connection = null;
protected UserDao userDao = null;
public DaoManager(Connection connection) {
this.connection = connection;
}
public UserDao getUserDao() {
if (this.userDao == null) {
this.userDao = new UserDaoImpl(this.connection);
}
return this.userDao;
}
public Object executeAndClose(DaoCommand daoCommand) {
try {
return daoCommand.execute(this);
} finally {
try {
this.connection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| [
"rzerot@gmail.com"
] | rzerot@gmail.com |
26e8e670e35c191962a8bd7156986004d96836ba | d91b3982d752bc5253e018205dad1e7f88ba21a9 | /src/main/java/com/lok/config/RestApplication.java | 51f8a25c1bcd014f04b34e9e53e5b012e7df0158 | [] | no_license | WebApps4u/lockerproject | d786acd48c74ad0446106459afb5904164835b01 | 8b787da33b7ffbf082f7ff78ba8e1c9635490325 | refs/heads/master | 2020-12-25T04:08:08.227552 | 2015-07-02T07:30:19 | 2015-07-02T07:30:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,145 | java | package com.lok.config;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import org.glassfish.jersey.filter.LoggingFilter;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.ServerProperties;
import org.glassfish.jersey.server.TracingConfig;
import org.glassfish.jersey.server.mvc.jsp.JspMvcFeature;
import com.lok.rest.lockerservice.UploadService;
/**
* For servlet 3.0, this class is required to boot rest APIs
* This now extends ResourceConfig to load additional classes
*
* Refer: https://www.packtpub.com/books/content/restful-services-jax-rs-20
* @author USER
*
*/
@ApplicationPath("/rest")
public class RestApplication extends ResourceConfig {
public RestApplication() {
// Resources.
packages(UploadService.class.getPackage().getName());
// MVC.
register(JspMvcFeature.class);
// Logging.
register(LoggingFilter.class);
// Tracing support.
property(ServerProperties.TRACING, TracingConfig.ON_DEMAND.name());
}
}
| [
"deepansh1987@gmail.com"
] | deepansh1987@gmail.com |
2955a156266f7d399e1517bc8776d989e1059100 | 43771396bd3115c7b7a47af33890f6bbb8eba429 | /service-sqlite/src/main/java/com/aprj/controller/api/UserLoginController.java | 90aa43b240981fddbe5c09170593295a5471f268 | [
"Apache-2.0"
] | permissive | SimINTEL/BootcampMicroservice | 09743b2720eff77ba366da9663501bf19a3d1c8f | 5442864d9874b9935972b0b1e452d3b5ab3ce78e | refs/heads/master | 2021-01-19T21:20:18.513430 | 2017-04-19T09:06:48 | 2017-04-19T09:06:48 | 88,643,439 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | package com.aprj.controller.api;
import com.aprj.entities.UserLogin;
import com.aprj.service.impl.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by wyp0596 on 06/03/2017.
*/
@RestController
@RequestMapping("api/user")
public class UserLoginController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private UserService userService;
@GetMapping()
public List<UserLogin> getAllUsers() {
return userService.getAllUsers();
}
@PostMapping
public void createUserLogin(UserLogin userLogin) {
userService.save(userLogin);
}
}
| [
"southdom@southdomdeMacBook-Pro.local"
] | southdom@southdomdeMacBook-Pro.local |
9a49573ba513270dea58a8b635342286410cbda0 | f785756d48532572293fd57f26546a00268d3a2e | /src/ThreadPoolpac/SingleThreadExecutorTest.java | e7a0599ad55a0aa7e4bd18426ccab7d108ebbe6e | [] | no_license | Violetys/code | 92898eecb5d06aeca1f8ff2f58a1ca6dd63f98ec | a7807a2c90e0a5878cca946f54a9c127ee429abd | refs/heads/master | 2020-07-11T22:16:09.336352 | 2020-03-06T07:52:19 | 2020-03-06T07:52:19 | 204,655,056 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package ThreadPoolpac;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class SingleThreadExecutorTest {
public static void main(String[] args) {
/*
* Executors.newSingleThreadExecutor():
* 创建一个单线程化的线程池,它只会用唯一的工作线程来执行任务,
* 保证所有任务按照指定顺序(FIFO, LIFO, 优先级)执行。
*
* */
//创建一个单线程化的线程池
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
for (int i = 0; i < 10; i++) {
final int index = i;
singleThreadExecutor.execute(new Runnable() {
public void run() {
try {
//结果依次输出,相当于顺序执行各个任务
System.out.println(Thread.currentThread().getName()+"正在被执行,打印的值是:"+index);
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
}
}
} | [
"xiongys@esensoft.com"
] | xiongys@esensoft.com |
e8ab65330868e3f1c0cf3a4885404257b78b9c42 | 0076aaffa9ef20b760af79dc7c1a93ff1eaab728 | /src/main/java/com/dyf/myblog/common/utils/SpringUtils.java | 4e8c6ba048ab1434acc2717d46092de25c496c71 | [] | no_license | JupiterDai/MyBlog | 6a45b6f2180da221a698c4c751d002f764b16765 | 1931fbedacc1cefdfa1063253c37ea0df6c02305 | refs/heads/master | 2023-02-24T08:34:42.163317 | 2021-01-28T08:15:18 | 2021-01-28T08:15:18 | 305,309,755 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package com.dyf.myblog.common.utils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
@Component
public class SpringUtils implements ApplicationContextAware {
private static ApplicationContext appContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
appContext = applicationContext;
}
public static <T> T getBean(Class<T> clazz){
return appContext.getBean(clazz);
}
public static DataSource getDataSource() {
return getBean(DataSource.class);
}
}
| [
"13050@LAPTOP-S0B1IMB0"
] | 13050@LAPTOP-S0B1IMB0 |
072011207e14e2b6dd4e0b38369f977eb15e6a8b | 2fb45ee3c05739ad192e73ea07bba09b84c4d83c | /src/main/java/com/asterisk/opensource/config/AmqpConfiguration.java | 0efc40df40ed23e36f7f465bee0768397acc5242 | [] | no_license | gf76866908/hermes | 54604a7c5a76248ec932259efeb75ba148629de1 | c73134e684af38b68b5f153c83dc37363e5cc965 | refs/heads/master | 2021-01-12T00:24:19.574032 | 2017-01-10T15:16:55 | 2017-01-10T15:16:55 | 78,720,571 | 1 | 0 | null | 2017-01-12T07:35:58 | 2017-01-12T07:35:57 | null | UTF-8 | Java | false | false | 219 | java | package com.asterisk.opensource.config;
import org.springframework.context.annotation.Configuration;
/**
* @author donghao
* @Date 17/1/8
* @Time 下午12:23
*/
@Configuration
public class AmqpConfiguration {
}
| [
"1185098948@qq.com"
] | 1185098948@qq.com |
c0fb1fef04214fa7701323abd934669001bab552 | a8368ad53f8360dc373dacba97b356f2410ee748 | /src/main/java/helpers/Manipulador.java | 8d369b7e5b91a9fe5429a13c357b47d727de29b9 | [] | no_license | oliveiraL/monitoria | acd78e0706f2f72e517bfb9a7245963fb5da1375 | dfca9949f5f4db77cf4983afc66a6970a9db875d | refs/heads/master | 2021-01-11T03:46:05.195839 | 2016-11-30T17:00:25 | 2016-11-30T17:00:25 | 71,393,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package helpers;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import javax.faces.context.FacesContext;
public class Manipulador {
public static Properties getProp() throws IOException {
Properties props = new Properties();
String aplicationPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath("");
FileInputStream file = new FileInputStream(
aplicationPath + File.separator +"properties" + File.separator + "sistema.properties");
props.load(file);
return props;
}
public String getRelativePath() throws IOException {
return getProp().getProperty("prop.relativePath");
}
}
| [
"oliveira.soares.l@hotmail.com"
] | oliveira.soares.l@hotmail.com |
7186d9be2d02ed693d3bda64a244f3ad3f928c50 | cecd7a10c4e45466d69e88668a156de65b255bb7 | /src/main/java/tools/ClueFileExcel.java | f6969b41ae63396d76c57a94b4859e2bc6070df9 | [] | no_license | lizhilongYS/Member | 41fcb2bd2e24a6df850680ec72b4c377d8a55103 | 3d3d033c3f8a2ec43d9b039856ce78c5415713ab | refs/heads/master | 2020-03-31T11:22:45.400620 | 2018-10-19T12:01:03 | 2018-10-19T12:01:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,445 | java | package tools;
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.text.SimpleDateFormat;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import entity.Clue;
import entity.User;
/**
* 利用开源组件POI3.0.2动态导出EXCEL文档 转载时请保留以下信息,注明出处!
*
* @author leno
* @version v1.0
* @param <T>
* 应用泛型,代表任意一个符合javabean风格的类
* 注意这里为了简单起见,boolean型的属性xxx的get器方式为getXxx(),而不是isXxx()
* byte[]表jpg格式的图片数据
*/
public class ClueFileExcel {
public void exportExcel(String title, String[] headers, List<Clue> list, String path) {
OutputStream out = null;
try {
out = new FileOutputStream(path);
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// 声明一个工作薄
HSSFWorkbook workbook = new HSSFWorkbook();
// 生成一个表格
HSSFSheet sheet = workbook.createSheet(title);
// 设置表格默认列宽度为15个字节
sheet.setDefaultColumnWidth((short) 15);
// 生成一个样式
HSSFCellStyle style = workbook.createCellStyle();
// 设置这些样式
style.setFillForegroundColor(HSSFColor.SKY_BLUE.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 生成一个字体
HSSFFont font = workbook.createFont();
font.setColor(HSSFColor.VIOLET.index);
font.setFontHeightInPoints((short) 12);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
// 把字体应用到当前的样式
style.setFont(font);
// 生成并设置另一个样式
HSSFCellStyle style2 = workbook.createCellStyle();
style2.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
style2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style2.setBorderRight(HSSFCellStyle.BORDER_THIN);
style2.setBorderTop(HSSFCellStyle.BORDER_THIN);
style2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
// 生成另一个字体
HSSFFont font2 = workbook.createFont();
font2.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
// 把字体应用到当前的样式
style2.setFont(font2);
// 声明一个画图的顶级管理器
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
// 定义注释的大小和位置,详见文档
HSSFComment comment = patriarch.createComment(new HSSFClientAnchor(0, 0, 0, 0, (short) 4, 2, (short) 6, 5));
// 设置注释内容
comment.setString(new HSSFRichTextString("可以在POI中添加注释!"));
// 设置注释作者,当鼠标移动到单元格上是可以在状态栏中看到该内容.
comment.setAuthor("leno");
// 产生表格标题行
HSSFRow row = sheet.createRow(0);
for (short i = 0; i < headers.length; i++) {
HSSFCell cell = row.createCell(i);
cell.setCellStyle(style);
HSSFRichTextString text = new HSSFRichTextString(headers[i]);
cell.setCellValue(text);
}
// 遍历集合数据,产生数据行
Iterator<Clue> u = list.iterator();
int index = 0;
while (u.hasNext()) {
index++;
row = sheet.createRow(index);
Clue clue = u.next();
//System.out.println(clue.getNum());
// 利用反射,根据javabean属性的先后顺序,动态调用getXxx()方法得到属性值
// flag判断是否跳出循环
boolean flag = false;
short k = 0;
for (k = 0; k < headers.length; k++) {
HSSFCell cell = row.createCell(k);
//cell.setCellStyle(style2);
Object value = null;
try {
if (k == 0) {
value = index;
}
if (k == 1) {
value = clue.getNum();
}
if (k == 2) {
value = clue.getRealName();
}
if (k == 3) {
value = clue.getSex();
}
if (k == 4) {
value = clue.getSchool();
}
if (k == 5) {
value = clue.getBtime();
}
if (k == 6) {
value = clue.getEtime() ;
}
if (k == 7) {
value = clue.getGraduateDate() ;
}
if (k == 8) {
value = clue.getPhone();
}
if (k == 9) {
value = clue.getExnum();
}
if (k == 10) {
value = clue.getAdmin().getRealname();
}
if (k == 11) {
boolean Student = clue.isType();
if (Student ) {
value = "是";
}
else
{
value="否";
}
}
// 判断值的类型后进行强制类型转换
String textValue = null;
if (value instanceof Boolean) {
boolean bValue = (Boolean) value;
textValue = "是";
if (!bValue) {
textValue = "否";
}
} else if (value instanceof Date) {
Date date = (Date) value;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
textValue = sdf.format(date);
} else {
// 其它数据类型都当作字符串简单处理
if(value != null) {
textValue = value.toString();
}
}
// 如果不是图片数据,就利用正则表达式判断textValue是否全部由数字组成
if (textValue != null) {
Pattern p = Pattern.compile("^//d+(//.//d+)?$");
Matcher matcher = p.matcher(textValue);
if (matcher.matches()) {
// 是数字当作double处理
cell.setCellValue(Double.parseDouble(textValue));
} else {
HSSFRichTextString richString = new HSSFRichTextString(textValue);
HSSFFont font3 = workbook.createFont();
font3.setColor(HSSFColor.BLUE.index);
richString.applyFont(font3);
cell.setCellValue(richString);
}
}
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
// 清理资源
}
}
}
try {
workbook.write(out);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} | [
"2877913583@qq.com"
] | 2877913583@qq.com |
b64c54725a461fe95b563b8ea43929ec80d837b5 | 0a995fe94a00d601b5ab72a52f0f247c16f1a5ae | /test/CircleTest.java | ccbbd63ae837ec5a53dbb4f96ed33bc9962bed4e | [] | no_license | huynhkthai/ShapeAnimator | 467ba9a69eab8e7b6c19000448caf5e1f71a05bb | 0ca342bc1505e5cd526cf63775f65e1c203f532d | refs/heads/main | 2023-03-04T09:37:16.827780 | 2021-02-21T22:43:41 | 2021-02-21T22:43:41 | 341,019,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,164 | java | import org.junit.Before;
import org.junit.Test;
import cs5004.animator.model.Circle;
import cs5004.animator.model.Shape;
import cs5004.animator.model.ShapeName;
/**
* This is the Junit test class for the circle test class.
*/
public class CircleTest {
private Shape tester;
@Before
public void setUp() {
tester = new Circle("Tester", 0, 0, 10,
0, 100, 100, 200, 200, ShapeName.Circle);
}
@Test(expected = IllegalArgumentException.class)
public void testConstructorInvalidShapeType() {
Shape test = new Circle("Test", 2, 3, 10,
23, 44, 150, 23, 167, ShapeName.Ellipse);
}
@Test(expected = IllegalArgumentException.class)
public void testNegRadius() {
Shape test = new Circle("Test", 3, 4, -10,
1, 10, 100, 30, 150, ShapeName.Circle);
}
//Test RGB value too large
@Test(expected = IllegalArgumentException.class)
public void testConstructorInvalidColor() {
Shape test = new Circle("Test", 5, -12, 50, 23,
1, 55, 300, 23, ShapeName.Circle);
}
@Test(expected = IllegalArgumentException.class)
public void testConstructorInvalidColorNeg() {
Shape test = new Circle("Test", 2, 34, 29, 89,
1, 100, -23, 240, ShapeName.Circle);
}
//Test constructing a rectangle with appear time greater than disappear time
@Test(expected = IllegalArgumentException.class)
public void testConstructorAppear() {
Shape test = new Circle("Test", 3, 4, 10, 20,
10, 1, 100, 30, ShapeName.Circle);
}
@Test(expected = IllegalArgumentException.class)
public void testConstructorNegTime() {
Shape test = new Circle("Test", 3, 4, 10,
-29, 22, 0, 0, 150, ShapeName.Circle);
}
@Test(expected = IllegalArgumentException.class)
public void testColorChangeInvalidTooLarge() {
Shape test = new Circle("Test", 0, 1, 10,
0, 100, 200, 100, 150, ShapeName.Circle);
test.changeColor(300, 200, 150, 10, 100);
}
@Test(expected = IllegalArgumentException.class)
public void testColorChangeInvalidNegative() {
Shape test = new Circle("Test", 0, 1, 10,
0, 100, 200, 100, 150, ShapeName.Circle);
test.changeColor(-150, 200, 150, 10, 100);
}
@Test(expected = IllegalArgumentException.class)
public void testInvalidScale() {
//try scaling with negative factor
tester.scale(-1, 10, 20);
}
@Test(expected = IllegalArgumentException.class)
public void testInvalidScaleTime() {
//try to scale at invalid time
tester.scale(10, 50, 10);
}
@Test(expected = IllegalArgumentException.class)
public void testInvalidScaleNegTime() {
//try to scale at a neg time
tester.scale(10, 25, -90);
}
@Test(expected = IllegalArgumentException.class)
public void testResizeParam1Invalid() {
//try resizing param1 by negative value
tester.resizeP1(-10, 10, 20);
}
@Test(expected = IllegalArgumentException.class)
public void testResizeParam2() {
tester.resizeP2(-10, 10, 20);
}
@Test(expected = IllegalArgumentException.class)
public void testChangeColorSameToFromTime() {
tester.changeColor(50, 150, 250,
10, 10);
}
} | [
"huynh.th@husky.neu.edu"
] | huynh.th@husky.neu.edu |
112d23ae42f88669bc82e0ebb2d8f9643a793431 | 69eb57a3b0de92d689d471f5af83a55c956b00bb | /app/src/main/java/rd/slcs/co/jp/showtabi/common/firebase/PlanRemover.java | d4ae847c492d0dbccc5e0e595181398b89ece9de | [] | no_license | POC-AgileProject/SatouSyota | 7d55719a2f105eabcaacd95603de15126adf4a2a | b2b4dce1db85dea1ad9431c8881a0376d62aa93a | refs/heads/develop | 2020-04-01T19:43:21.317574 | 2019-02-28T02:05:17 | 2019-02-28T02:05:17 | 153,568,752 | 1 | 0 | null | 2019-02-28T02:05:18 | 2018-10-18T05:35:30 | Java | UTF-8 | Java | false | false | 2,482 | java | package rd.slcs.co.jp.showtabi.common.firebase;
import android.support.annotation.NonNull;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import rd.slcs.co.jp.showtabi.common.Const;
import rd.slcs.co.jp.showtabi.common.Env;
import rd.slcs.co.jp.showtabi.object.Event;
import rd.slcs.co.jp.showtabi.object.Photo;
public class PlanRemover {
private final String planKey;
public PlanRemover(String pPlanKey) {
planKey = pPlanKey;
}
public void removePlan(){
DatabaseReference mDatabase;
mDatabase = FirebaseDatabase.getInstance().getReference(Env.DB_USERNAME + "/" + Const.DB_PLANTABLE + "/" + planKey);
mDatabase.removeValue();
removeEventsRelatedPlanKey();
}
/**
* remove event related to Plan key.
*/
private void removeEventsRelatedPlanKey() {
// Firebaseからイベントテーブルのインスタンスを取得
DatabaseReference mDatabase;
mDatabase = FirebaseDatabase.getInstance().getReference(Env.DB_USERNAME + "/" + Const.DB_EVENTTABLE);
// Planキーに合致するクエリを取得
Query query = mDatabase.orderByChild(Const.DB_EVENTTABLE_PLANKEY).equalTo(planKey);
// クエリを使用してデータベースの内容を一度だけ取得する
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot dataSnapshot : snapshot.getChildren()) {
Event event = dataSnapshot.getValue(Event.class);
String eventKey = dataSnapshot.getKey();
// イベントキーが合致するイベントについて削除処理を実行
if (planKey.equals(event.getPlanKey())) {
EventRemover eventRemover = new EventRemover(eventKey);
eventRemover.removeEvent();
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| [
"katachiwotodomete@gmail.com"
] | katachiwotodomete@gmail.com |
ff88ad97dd2e77b5c0eafc68aaf4bffb65d59564 | 7906ac730724e71160520d53bfb6b5fbffa2bca7 | /day03/src/exercise/Shuzu.java | dc028af44953b0b1430adeae825c60744a814c85 | [] | no_license | A207/JiangKui | eefbac5945582c0f91013a8e4954128d9cbd08ec | d64f3ce9ace70292453ce2c11a93667337513392 | refs/heads/master | 2021-01-10T19:17:06.615380 | 2015-07-16T07:48:37 | 2015-07-16T07:48:37 | 38,688,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 700 | java | package exercise;
public class Shuzu
{
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
int[] arr=new int[]{1,3,4,5,5,5,0,0,6,7,7,11,1,3,3,6,0,5};
int[] brr=new int[arr.length];
int index=0;
for(int i=0;i<arr.length;i++)
{
boolean c=true;
for(int j=0;j<index;j++)
{
if(arr[i]==brr[j])
{
c=false;
break;
}
}
if(c==true)
{
brr[index]=arr[i];
index++;
}
}
int[] crr=new int[index];
for(int i=0;i<crr.length;i++)
{
crr[i]=brr[i];
System.out.print(crr[i]+"\t");
}
}
}
| [
"240654807@qq.com"
] | 240654807@qq.com |
0e648111743d4825a4064ec1ecdc346f04863151 | 1316d192556206f57fd76c572b79b2797ded75b2 | /MoodAnalyser.java | 824c9d4e9060926fead48b90b015ff5774908ece | [] | no_license | AnkitaKadam1998/Mood_Analyser | b3da414fdb0d667f54ddc6b25ab56db1d9a1c944 | 82aaca0b33704fafb9a5a49eaa47806c35eb23bd | refs/heads/main | 2023-04-06T13:22:41.376593 | 2021-04-26T18:01:30 | 2021-04-26T18:01:30 | 361,835,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | public class MoodAnalyser {
String message;
public MoodAnalyser() {}
public MoodAnalyser(String message)
{
this.message=message;
}
public String analyseMood()
{
if(message.contains("Sad"))
{
return "SAD";
}
else {
return "HAPPY";
}
}
}
| [
"komal.jadhav0542@gmail.com"
] | komal.jadhav0542@gmail.com |
4d38f1daeaae0ec546cc48c2af344253c2fc1bde | 2af9bf0eaecb96f2cc0d8eb7fc681ce85c9be2a1 | /Coronakit/src/com/iiht/evaluation/coronokit/model/KitDetail.java | 1a0aa46341098e114ea17cce07a1ebae9888cce5 | [] | no_license | phanisree-chava/Test | 22b477fd98541dbdf8a333842f4e6d3860eb9cc6 | 068ef92e7c24cddc8d29ba085ccd23a657ccfb1a | refs/heads/master | 2022-12-03T04:37:24.842005 | 2020-08-23T15:47:10 | 2020-08-23T15:47:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,460 | java | package com.iiht.evaluation.coronokit.model;
public class KitDetail {
private Integer id;
private Integer productId;
private Double amount;
private Integer coronaKitId;
private Integer quantity;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Integer getCoronaKitId() {
return coronaKitId;
}
public void setCoronaKitId(Integer coronaKitId) {
this.coronaKitId = coronaKitId;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public KitDetail(Integer id, Integer productId, Double amount, Integer coronaKitId, Integer quantity) {
super();
this.id = id;
this.productId = productId;
this.amount = amount;
this.coronaKitId = coronaKitId;
this.quantity = quantity;
}
public KitDetail() {
// TODO Auto-generated constructor stub
}
public void Totalamt(Integer quantity,Double amount) {
Double Total = this.getQuantity() *this.getAmount();
}
@Override
public String toString() {
return "KitDetail [id=" + id + ", productId=" + productId + ", amount=" + amount + ", coronaKitId="
+ coronaKitId + ", quantity=" + quantity + "]";
}
} | [
"wellsfargofsd19@iiht.tech"
] | wellsfargofsd19@iiht.tech |
b0069d6c691f164e70e4c753364035dc556a9a71 | dd103e760b4ac65559e17e5c2f37bbec67f11a65 | /backend/src/main/java/org/mjaworski/backend/persistance/repository/impl/ProjectRepositoryImpl.java | 9ffd5fdee7eef6f6c36b3d96a9b81f90ccd2dae6 | [] | no_license | mjaworski96/DoTo | d3995e24fdafd0269e78f88ad0a4abad8a083997 | 2ccba1d7400273dde67c19f219f2644adef4c1df | refs/heads/master | 2023-03-06T06:03:12.578504 | 2021-12-19T15:26:12 | 2021-12-19T15:26:12 | 203,420,018 | 0 | 0 | null | 2023-03-02T00:21:38 | 2019-08-20T17:07:54 | Java | UTF-8 | Java | false | false | 1,339 | java | package org.mjaworski.backend.persistance.repository.impl;
import org.mjaworski.backend.persistance.entity.Project;
import org.mjaworski.backend.persistance.repository.ProjectRepository;
import org.mjaworski.backend.persistance.repository.impl.jpa.ProjectJpaRepository;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public class ProjectRepositoryImpl implements ProjectRepository {
private ProjectJpaRepository projectJpaRepository;
public ProjectRepositoryImpl(ProjectJpaRepository projectJpaRepository) {
this.projectJpaRepository = projectJpaRepository;
}
@Override
public Optional<Project> get(int id) {
return projectJpaRepository.findById(id);
}
@Override
public List<Project> get(int userId, boolean archived, Pageable pageable) {
return projectJpaRepository.get(userId, archived, pageable);
}
@Override
public int getCount(int userId, boolean archived) {
return projectJpaRepository.getCount(userId, archived);
}
@Override
public void save(Project project) {
projectJpaRepository.save(project);
}
@Override
public void delete(Project project) {
projectJpaRepository.delete(project);
}
}
| [
"m.a.jaworski96@gmail.com"
] | m.a.jaworski96@gmail.com |
04df516809b0a5b16f7f0f604b4c78730b97e376 | 6e2b4479addd0965239ba77bb2f704bad9ab40a2 | /usagreement/src/main/java/com/library/util/Storage.java | 6daedec232d5de535f853f939bc3c73f155f631a | [
"Apache-2.0"
] | permissive | 0xFF1E071F/tp808 | 30ea3c380625ef474c8a9803e949a5006bd218b2 | 1440010fdb77be01d5a7a9bbf4cfe49bceb3c8f3 | refs/heads/master | 2023-03-15T06:04:02.115603 | 2020-06-22T01:53:32 | 2020-06-22T01:53:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,384 | java | package com.library.util;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.location.Location;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
/**
* Created by wenzhe on 9/6/17.
*/
public class Storage {
private static final String TAG = "Storage";
public static void writeFile(String path, byte[] data) {
FileOutputStream out = null;
try {
out = new FileOutputStream(path);
out.write(data);
} catch (Exception e) {
Log.e(TAG, "Failed to write data", e);
} finally {
try {
out.close();
} catch (Exception e) {
Log.e(TAG, "Failed to close file after write", e);
}
}
}
public static void writeFile(File file, byte[] data) {
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
out.write(data);
} catch (Exception e) {
Log.e(TAG, "Failed to write data", e);
} finally {
try {
out.close();
} catch (Exception e) {
Log.e(TAG, "Failed to close file after write", e);
}
}
}
// Add the image to media store.
public static Uri addImageToDB(ContentResolver resolver, String title, long date,
Location location, int orientation, long jpegLength,
String path, int width, int height, String mimeType) {
// Insert into MediaStore.
ContentValues values = new ContentValues(11);
values.put(MediaStore.Images.ImageColumns.TITLE, title);
values.put(MediaStore.MediaColumns.WIDTH, width);
values.put(MediaStore.MediaColumns.HEIGHT, height);
if (mimeType.equalsIgnoreCase("jpeg")
|| mimeType.equalsIgnoreCase("image/jpeg")) {
values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME, title + ".jpg");
} else {
values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME, title + ".raw");
}
values.put(MediaStore.Images.ImageColumns.DATE_TAKEN, date);
values.put(MediaStore.Images.ImageColumns.MIME_TYPE, mimeType);
values.put(MediaStore.Images.ImageColumns.ORIENTATION, orientation);
values.put(MediaStore.Images.ImageColumns.DATA, path);
values.put(MediaStore.Images.ImageColumns.SIZE, jpegLength);
if (location != null) {
values.put(MediaStore.Images.ImageColumns.LATITUDE, location.getLatitude());
values.put(MediaStore.Images.ImageColumns.LONGITUDE, location.getLongitude());
}
return insert(resolver, values, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
}
// Add the video to media store.
public static Uri addVideoToDB(ContentResolver resolver, String title, long date,
Location location, long length, String path,
int width, int height, String mimeType) {
// Insert into MediaStore.
ContentValues values = new ContentValues(10);
values.put(MediaStore.Video.VideoColumns.TITLE, title);
values.put(MediaStore.MediaColumns.WIDTH, width);
values.put(MediaStore.MediaColumns.HEIGHT, height);
values.put(MediaStore.Video.VideoColumns.DISPLAY_NAME, title + ".mp4");
values.put(MediaStore.Video.VideoColumns.DATE_TAKEN, date);
values.put(MediaStore.Video.VideoColumns.MIME_TYPE, mimeType);
values.put(MediaStore.Video.VideoColumns.DATA, path);
values.put(MediaStore.Video.VideoColumns.SIZE, length);
if (location != null) {
values.put(MediaStore.Video.VideoColumns.LATITUDE, location.getLatitude());
values.put(MediaStore.Video.VideoColumns.LONGITUDE, location.getLongitude());
}
return insert(resolver, values, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
}
/**
*
* */
private static Uri insert(ContentResolver resolver, ContentValues values, Uri targetUri) {
Uri uri = null;
try {
uri = resolver.insert(targetUri, values);
} catch (Throwable th) {
Log.e(TAG, "Failed to write MediaStore:" + th);
}
return uri;
}
}
| [
"jiji6143@163.com"
] | jiji6143@163.com |
9aca730ba28814fdfc440b8365b55e35f8c45227 | 04b1803adb6653ecb7cb827c4f4aa616afacf629 | /content/public/android/javatests/src/org/chromium/content/browser/input/CursorAnchorInfoControllerTest.java | 0e2e489bc806081165db46341b1af4ee0a661c50 | [
"BSD-3-Clause"
] | permissive | Samsung/Castanets | 240d9338e097b75b3f669604315b06f7cf129d64 | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | refs/heads/castanets_76_dev | 2023-08-31T09:01:04.744346 | 2021-07-30T04:56:25 | 2021-08-11T05:45:21 | 125,484,161 | 58 | 49 | BSD-3-Clause | 2022-10-16T19:31:26 | 2018-03-16T08:07:37 | null | UTF-8 | Java | false | false | 32,533 | java | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.browser.input;
import android.annotation.TargetApi;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.os.Build;
import android.support.test.filters.SmallTest;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.CursorAnchorInfo;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
import org.chromium.content_public.browser.test.util.TestInputMethodManagerWrapper;
/**
* Test for {@link CursorAnchorInfoController}.
*/
@RunWith(ContentJUnit4ClassRunner.class)
@MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP)
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class CursorAnchorInfoControllerTest {
private static final class TestViewDelegate implements CursorAnchorInfoController.ViewDelegate {
public int locationX;
public int locationY;
@Override
public void getLocationOnScreen(View view, int[] location) {
location[0] = locationX;
location[1] = locationY;
}
}
private static final class TestComposingTextDelegate
implements CursorAnchorInfoController.ComposingTextDelegate {
private String mText;
private int mSelectionStart = -1;
private int mSelectionEnd = -1;
private int mComposingTextStart = -1;
private int mComposingTextEnd = -1;
@Override
public CharSequence getText() {
return mText;
}
@Override
public int getSelectionStart() {
return mSelectionStart;
}
@Override
public int getSelectionEnd() {
return mSelectionEnd;
}
@Override
public int getComposingTextStart() {
return mComposingTextStart;
}
@Override
public int getComposingTextEnd() {
return mComposingTextEnd;
}
public void updateTextAndSelection(CursorAnchorInfoController controller,
String text, int compositionStart, int compositionEnd, int selectionStart,
int selectionEnd) {
mText = text;
mSelectionStart = selectionStart;
mSelectionEnd = selectionEnd;
mComposingTextStart = compositionStart;
mComposingTextEnd = compositionEnd;
controller.invalidateLastCursorAnchorInfo();
}
public void clearTextAndSelection(CursorAnchorInfoController controller) {
updateTextAndSelection(controller, null, -1, -1, -1, -1);
}
}
private static class AssertionHelper {
static void assertScaleAndTranslate(float expectedScale, float expectedTranslateX,
float expectedTranslateY, CursorAnchorInfo actual) {
Matrix expectedMatrix = new Matrix();
expectedMatrix.setScale(expectedScale, expectedScale);
expectedMatrix.postTranslate(expectedTranslateX, expectedTranslateY);
Assert.assertEquals(expectedMatrix, actual.getMatrix());
}
static void assertHasInsertionMarker(int expectedFlags, float expectedHorizontal,
float expectedTop, float expectedBaseline, float expectedBottom,
CursorAnchorInfo actual) {
Assert.assertEquals(expectedFlags, actual.getInsertionMarkerFlags());
Assert.assertEquals(expectedHorizontal, actual.getInsertionMarkerHorizontal(), 0);
Assert.assertEquals(expectedTop, actual.getInsertionMarkerTop(), 0);
Assert.assertEquals(expectedBaseline, actual.getInsertionMarkerBaseline(), 0);
Assert.assertEquals(expectedBottom, actual.getInsertionMarkerBottom(), 0);
}
static void assertHasNoInsertionMarker(CursorAnchorInfo actual) {
Assert.assertEquals(0, actual.getInsertionMarkerFlags());
Assert.assertTrue(Float.isNaN(actual.getInsertionMarkerHorizontal()));
Assert.assertTrue(Float.isNaN(actual.getInsertionMarkerTop()));
Assert.assertTrue(Float.isNaN(actual.getInsertionMarkerBaseline()));
Assert.assertTrue(Float.isNaN(actual.getInsertionMarkerBottom()));
}
static void assertComposingText(CharSequence expectedComposingText,
int expectedComposingTextStart, CursorAnchorInfo actual) {
Assert.assertTrue(TextUtils.equals(expectedComposingText, actual.getComposingText()));
Assert.assertEquals(expectedComposingTextStart, actual.getComposingTextStart());
}
static void assertSelection(
int expecteSelectionStart, int expecteSelectionEnd, CursorAnchorInfo actual) {
Assert.assertEquals(expecteSelectionStart, actual.getSelectionStart());
Assert.assertEquals(expecteSelectionEnd, actual.getSelectionEnd());
}
}
@Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testFocusedNodeChanged() {
TestInputMethodManagerWrapper immw = new TestInputMethodManagerWrapper(null);
TestViewDelegate viewDelegate = new TestViewDelegate();
TestComposingTextDelegate composingTextDelegate = new TestComposingTextDelegate();
CursorAnchorInfoController controller = CursorAnchorInfoController.createForTest(
immw, composingTextDelegate, viewDelegate);
View view = null;
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
Assert.assertFalse(
"IC#onRequestCursorUpdates() must be rejected if the focused node is not editable.",
controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
// Make sure that the focused node is considered to be non-editable by default.
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
controller.focusedNodeChanged(false);
composingTextDelegate.clearTextAndSelection(controller);
// Make sure that the controller does not crash even if it is called while the focused node
// is not editable.
controller.setCompositionCharacterBounds(new float[] {30.0f, 1.0f, 32.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "1", 0, 1, 0, 1);
controller.onUpdateFrameInfo(1.0f, 100.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
}
@Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testImmediateMode() {
TestInputMethodManagerWrapper immw = new TestInputMethodManagerWrapper(null);
TestViewDelegate viewDelegate = new TestViewDelegate();
TestComposingTextDelegate composingTextDelegate = new TestComposingTextDelegate();
CursorAnchorInfoController controller = CursorAnchorInfoController.createForTest(
immw, composingTextDelegate, viewDelegate);
View view = null;
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
// Make sure that #updateCursorAnchorInfo() is not be called until the matrix info becomes
// available with #onUpdateFrameInfo().
Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request */, false /* monitor request */, view));
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
Assert.assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Make sure that 2nd call of #onUpdateFrameInfo() is ignored.
controller.onUpdateFrameInfo(2.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that #onUpdateFrameInfo() is immediately called because the matrix info is
// already available.
Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request */, false /* monitor request */, view));
Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Make sure that CURSOR_UPDATE_IMMEDIATE and CURSOR_UPDATE_MONITOR can be specified at
// the same time.
Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request*/, true /* monitor request */, view));
Assert.assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Make sure that CURSOR_UPDATE_IMMEDIATE is cleared if the focused node becomes
// non-editable.
controller.focusedNodeChanged(false);
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request */, false /* monitor request */, view));
controller.focusedNodeChanged(false);
composingTextDelegate.clearTextAndSelection(controller);
controller.onUpdateFrameInfo(1.0f, 100.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that CURSOR_UPDATE_IMMEDIATE can be enabled again.
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
Assert.assertTrue(controller.onRequestCursorUpdates(
true /* immediate request */, false /* monitor request */, view));
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText(null, -1, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(-1, -1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
}
@Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testMonitorMode() {
TestInputMethodManagerWrapper immw = new TestInputMethodManagerWrapper(null);
TestViewDelegate viewDelegate = new TestViewDelegate();
TestComposingTextDelegate composingTextDelegate = new TestComposingTextDelegate();
CursorAnchorInfoController controller = CursorAnchorInfoController.createForTest(
immw, composingTextDelegate, viewDelegate);
View view = null;
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
// Make sure that #updateCursorAnchorInfo() is not be called until the matrix info becomes
// available with #onUpdateFrameInfo().
Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
Assert.assertEquals(0, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Make sure that #updateCursorAnchorInfo() is not be called if any coordinate parameter is
// changed for better performance.
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that #updateCursorAnchorInfo() is called if #setCompositionCharacterBounds()
// is called with a different parameter.
controller.setCompositionCharacterBounds(new float[] {30.0f, 1.0f, 32.0f, 3.0f}, view);
Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Make sure that #updateCursorAnchorInfo() is called if #updateTextAndSelection()
// is called with a different parameter.
composingTextDelegate.updateTextAndSelection(controller, "1", 0, 1, 0, 1);
Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("1", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Make sure that #updateCursorAnchorInfo() is called if #onUpdateFrameInfo()
// is called with a different parameter.
controller.onUpdateFrameInfo(2.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("1", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Make sure that #updateCursorAnchorInfo() is called when the view origin is changed.
viewDelegate.locationX = 7;
viewDelegate.locationY = 9;
controller.onUpdateFrameInfo(2.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(2.0f, 7.0f, 9.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(30.0f, 1.0f, 32.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("1", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Make sure that CURSOR_UPDATE_IMMEDIATE is cleared if the focused node becomes
// non-editable.
controller.focusedNodeChanged(false);
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
controller.focusedNodeChanged(false);
composingTextDelegate.clearTextAndSelection(controller);
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
// Make sure that CURSOR_UPDATE_MONITOR can be enabled again.
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f}, view);
composingTextDelegate.updateTextAndSelection(controller, "0", 0, 1, 0, 1);
Assert.assertEquals(5, immw.getUpdateCursorAnchorInfoCounter());
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 2.0f, 0.0f, 3.0f, view);
Assert.assertEquals(6, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 2.0f,
0.0f, 3.0f, 3.0f, immw.getLastCursorAnchorInfo());
Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
AssertionHelper.assertComposingText("0", 0, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(0, 1, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
}
@Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testSetCompositionCharacterBounds() {
TestInputMethodManagerWrapper immw = new TestInputMethodManagerWrapper(null);
TestViewDelegate viewDelegate = new TestViewDelegate();
TestComposingTextDelegate composingTextDelegate = new TestComposingTextDelegate();
CursorAnchorInfoController controller = CursorAnchorInfoController.createForTest(
immw, composingTextDelegate, viewDelegate);
View view = null;
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
composingTextDelegate.updateTextAndSelection(controller, "01234", 1, 3, 1, 1);
controller.setCompositionCharacterBounds(new float[] {0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 1.1f, 6.0f, 2.9f}, view);
controller.onUpdateFrameInfo(
1.0f, 0.0f, false, false, Float.NaN, Float.NaN, Float.NaN, view);
Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
Assert.assertEquals(new RectF(0.0f, 1.0f, 2.0f, 3.0f),
immw.getLastCursorAnchorInfo().getCharacterBounds(1));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(1));
Assert.assertEquals(new RectF(4.0f, 1.1f, 6.0f, 2.9f),
immw.getLastCursorAnchorInfo().getCharacterBounds(2));
Assert.assertEquals(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION,
immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(2));
Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(3));
Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(3));
AssertionHelper.assertComposingText("12", 1, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(1, 1, immw.getLastCursorAnchorInfo());
}
@Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testUpdateTextAndSelection() {
TestInputMethodManagerWrapper immw = new TestInputMethodManagerWrapper(null);
TestViewDelegate viewDelegate = new TestViewDelegate();
TestComposingTextDelegate composingTextDelegate = new TestComposingTextDelegate();
CursorAnchorInfoController controller = CursorAnchorInfoController.createForTest(
immw, composingTextDelegate, viewDelegate);
View view = null;
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
composingTextDelegate.updateTextAndSelection(controller, "01234", 3, 3, 1, 1);
controller.onUpdateFrameInfo(
1.0f, 0.0f, false, false, Float.NaN, Float.NaN, Float.NaN, view);
Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(0));
Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(0));
Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(1));
Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(1));
Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(2));
Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(2));
Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(3));
Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(3));
Assert.assertEquals(null, immw.getLastCursorAnchorInfo().getCharacterBounds(4));
Assert.assertEquals(0, immw.getLastCursorAnchorInfo().getCharacterBoundsFlags(4));
AssertionHelper.assertComposingText("", 3, immw.getLastCursorAnchorInfo());
AssertionHelper.assertSelection(1, 1, immw.getLastCursorAnchorInfo());
}
@Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testInsertionMarker() {
TestInputMethodManagerWrapper immw = new TestInputMethodManagerWrapper(null);
TestViewDelegate viewDelegate = new TestViewDelegate();
TestComposingTextDelegate composingTextDelegate = new TestComposingTextDelegate();
CursorAnchorInfoController controller = CursorAnchorInfoController.createForTest(
immw, composingTextDelegate, viewDelegate);
View view = null;
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
// Test no insertion marker.
controller.onUpdateFrameInfo(
1.0f, 0.0f, false, false, Float.NaN, Float.NaN, Float.NaN, view);
Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertHasNoInsertionMarker(immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Test a visible insertion marker.
controller.onUpdateFrameInfo(1.0f, 0.0f, true, true, 10.0f, 23.0f, 29.0f, view);
Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION, 10.0f,
23.0f, 29.0f, 29.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// Test a invisible insertion marker.
controller.onUpdateFrameInfo(1.0f, 0.0f, true, false, 10.0f, 23.0f, 29.0f, view);
Assert.assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertHasInsertionMarker(CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION, 10.0f,
23.0f, 29.0f, 29.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
}
@Test
@SmallTest
@Feature({"Input-Text-IME"})
public void testMatrix() {
TestInputMethodManagerWrapper immw = new TestInputMethodManagerWrapper(null);
TestViewDelegate viewDelegate = new TestViewDelegate();
TestComposingTextDelegate composingTextDelegate = new TestComposingTextDelegate();
CursorAnchorInfoController controller = CursorAnchorInfoController.createForTest(
immw, composingTextDelegate, viewDelegate);
View view = null;
controller.focusedNodeChanged(true);
composingTextDelegate.clearTextAndSelection(controller);
Assert.assertTrue(controller.onRequestCursorUpdates(
false /* immediate request */, true /* monitor request */, view));
// Test no transformation
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
controller.onUpdateFrameInfo(
1.0f, 0.0f, false, false, Float.NaN, Float.NaN, Float.NaN, view);
Assert.assertEquals(1, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(1.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// device scale factor == 2.0
viewDelegate.locationX = 0;
viewDelegate.locationY = 0;
controller.onUpdateFrameInfo(
2.0f, 0.0f, false, false, Float.NaN, Float.NaN, Float.NaN, view);
Assert.assertEquals(2, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(2.0f, 0.0f, 0.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// device scale factor == 2.0
// view origin == (10, 141)
viewDelegate.locationX = 10;
viewDelegate.locationY = 141;
controller.onUpdateFrameInfo(
2.0f, 0.0f, false, false, Float.NaN, Float.NaN, Float.NaN, view);
Assert.assertEquals(3, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(
2.0f, 10.0f, 141.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
// device scale factor == 2.0
// content offset Y = 40.0f
// view origin == (10, 141)
viewDelegate.locationX = 10;
viewDelegate.locationY = 141;
controller.onUpdateFrameInfo(
2.0f, 40.0f, false, false, Float.NaN, Float.NaN, Float.NaN, view);
Assert.assertEquals(4, immw.getUpdateCursorAnchorInfoCounter());
AssertionHelper.assertScaleAndTranslate(
2.0f, 10.0f, 181.0f, immw.getLastCursorAnchorInfo());
immw.clearLastCursorAnchorInfo();
}
}
| [
"sunny.nam@samsung.com"
] | sunny.nam@samsung.com |
6e7d26b9824de9ef1ad0492b7ba570ea293085b2 | 3cde0b4dcbb01474bf321d252f4baf6366d449db | /WayFinder-OnYourMarc/src/edu/lehigh/lib/wayfinder/controllers/OnYourMarcControllerWS.java | 4273073ee6dc91158c1e37f9eb887270dbc17480 | [] | no_license | ccc2lu/WayFinder-OnYourMarc | 6deea2cd4ad28448f0f60749cc89c05ec89c5595 | 08072403ff50cbe402c8051fd9b140947db58876 | refs/heads/master | 2021-05-03T13:51:08.390231 | 2018-02-06T20:03:50 | 2018-02-06T20:03:50 | 120,515,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,071 | java | package edu.lehigh.lib.wayfinder.controllers;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Paths;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.marc4j.MarcReader;
import org.marc4j.MarcStreamWriter;
import org.marc4j.MarcWriter;
import org.marc4j.MarcXmlReader;
import org.marc4j.MarcXmlWriter;
import org.marc4j.marc.DataField;
import org.marc4j.marc.MarcFactory;
import org.marc4j.marc.Record;
import edu.lehigh.lib.wayfinder.constants.WayFinderConstants;
@WebServlet("/uploadfile")
@MultipartConfig
public class OnYourMarcControllerWS extends HttpServlet {
protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher rd = null;
rd = request.getRequestDispatcher("WEB-INF/onyourmarcws.jsp");
request.setAttribute("messagestyle","visibility: hidden !important;");
rd.forward(request, response);
}
protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
String description = request.getParameter("description"); // Retrieves <input type="text" name="description">
Part filePart = request.getPart("file"); // Retrieves <input type="file" name="file">
InputStream fileContent = filePart.getInputStream();
Workbook workbook = new XSSFWorkbook(fileContent);
Sheet firstSheet = workbook.getSheetAt(0);
Iterator<Row> iterator = firstSheet.iterator();
//SKIPPING THE FIRST ROW
iterator.next();
MarcFactory factory = MarcFactory.newInstance();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
String fileName = WayFinderConstants.onyourmarcFilesPath + "/" + WayFinderConstants.onyourmarcFilesPrefix + dateFormat.format(new Date()) +".mrc";
File file = new File(fileName);
FileOutputStream fileOutputStream = new FileOutputStream(file);
//MarcWriter writer = null;
//writer = new MarcXmlWriter(fileOutputStream, true);
MarcWriter writer = new MarcStreamWriter(fileOutputStream);
while (iterator.hasNext()) {
Row nextRow = iterator.next();
/*Iterator<Cell> cellIterator = nextRow.cellIterator();
while (cellIterator.hasNext()) {
Cell cell = cellIterator.next();
//DataFormatter df = new DataFormatter();
//String value = df.formatCellValue(cell);
cell.setCellType(CellType.STRING);
String value = cell.getStringCellValue();
System.out.println(value);
}*/
String isbn = null;
String oclc = null;
String vendor = null;
String price = null;
String fundCode = null;
String object = null;
String subObject = null;
//TODO CAN SHORTEN THIS CODE LATER
isbn = getValueFromCell(nextRow.getCell(0), CellType.STRING);
oclc = getValueFromCell(nextRow.getCell(1),CellType.STRING);
vendor = getValueFromCell(nextRow.getCell(2),CellType.STRING);
price = getValueFromCell(nextRow.getCell(3),CellType.NUMERIC);
fundCode = getValueFromCell(nextRow.getCell(4), CellType.STRING);
object = getValueFromCell(nextRow.getCell(5), CellType.STRING);
subObject = getValueFromCell(nextRow.getCell(6), CellType.STRING);
System.out.println("will look up " + isbn);
Client client = ClientBuilder.newClient();
WebTarget webTarget;
//IF SPREADSHEET CONTAINS OCLC NO. USE IT, OTHERWISE USE ISBN
if (oclc != null) {
webTarget = client.target("http://www.worldcat.org/webservices/catalog/content/" + oclc.replaceAll("\\u00A0", "") + "?wskey=QZSNU7WdFZRCu2YW9d0n9DkmHy6zgXT12fa3PICduTwpvMMmu9ndoUP3fn0kqOVWnAIvLlSYHFCocWoP");
System.out.println("http://www.worldcat.org/webservices/catalog/content/" + oclc.trim() + "?wskey=QZSNU7WdFZRCu2YW9d0n9DkmHy6zgXT12fa3PICduTwpvMMmu9ndoUP3fn0kqOVWnAIvLlSYHFCocWoP");
}
else {
webTarget = client.target("http://www.worldcat.org/webservices/catalog/content/isbn/" + isbn.trim() + "?wskey=QZSNU7WdFZRCu2YW9d0n9DkmHy6zgXT12fa3PICduTwpvMMmu9ndoUP3fn0kqOVWnAIvLlSYHFCocWoP");
}
Response r = webTarget.request(MediaType.APPLICATION_XML).get();
System.out.println("THE RESPONSE FROM THE SERVICE WAS " + r.getStatus());
String body = r.readEntity(String.class);
System.out.println(body);
MarcReader reader = null;
InputStream marcin = new ByteArrayInputStream( body.getBytes("UTF-8") );
try {
reader = new MarcXmlReader(marcin);
}
catch(Exception e) {
System.out.println(e.toString());
//continue;
}
Record record = null;
record = reader.next();
//ADD 980 FIELD
DataField df = factory.newDataField("980", ' ', ' ');
//JUST TESTING WITH QUANTITY
//TODO TALK TO DAN ABOUT p and q fields
df.addSubfield(factory.newSubfield('b',fundCode));
df.addSubfield(factory.newSubfield('m',price));
df.addSubfield(factory.newSubfield('o',object));
if (subObject != null) df.addSubfield(factory.newSubfield('n',subObject));
df.addSubfield(factory.newSubfield('p', "1"));
df.addSubfield(factory.newSubfield('q', "1"));
//REMOVE VENDOR FOR NOW PER DAN 12/7/17
//if (vendor != null) df.addSubfield(factory.newSubfield('v', vendor));
record.addVariableField(df);
System.out.println(record.toString());
//WRITE RECORD TO A FILE
writer.write(record);
}
//EMAIL NEW FILE
writer.close();
//BETTER WAY TO RETURN THE FILE?
FileInputStream in = new FileInputStream(fileName);
response.setHeader("Content-Disposition", "attachment; filename='" + fileName + "'");
OutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[4096];
int length;
while ((length = in.read(buffer)) > 0){
outputStream.write(buffer, 0, length);
}
outputStream.flush();
outputStream.close();
}
private String getValueFromCell(Cell cell,CellType cellType) {
if (cell == null) return null;
cell.setCellType(cellType);
//JUST HARDCODING STRING & DOUBLE RIGHT NOW
//TODO
if (cellType == CellType.STRING) {
return cell.getStringCellValue().trim();
}
if (cellType == CellType.NUMERIC) {
return new Double(cell.getNumericCellValue()).toString();
}
return null;
}
}
| [
"ccc2@lehigh.edu"
] | ccc2@lehigh.edu |
ac9e9052e6741170805f4adb68b3ade87a3eb6f9 | 8043ff50ab4f4ed9a3b4742d1b312432b2a0b17c | /app/src/main/java/com/example/hospital/activities/LeitoDadosActivity.java | c31944751432024c905264f9287fe1d59cf22d1a | [] | no_license | ilanmargolis/HospitalAndroid | ee61faa5f4bc4eaf59f5ebeb9d7fa79da8474a41 | 2480a9390bd3904dc65b0f8a7a4e5498d3ec552f | refs/heads/master | 2023-01-24T15:11:38.688795 | 2020-11-27T20:23:22 | 2020-11-27T20:23:22 | 306,441,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,963 | java | package com.example.hospital.activities;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.hospital.R;
import com.example.hospital.config.RetrofitConfig;
import com.example.hospital.controller.LeitoCtrl;
import com.example.hospital.controller.SetorCtrl;
import com.example.hospital.controller.UnidadeCtrl;
import com.example.hospital.model.Leito;
import com.example.hospital.model.Setor;
import com.example.hospital.model.Unidade;
import com.example.hospital.repository.ResultEvent;
import com.example.hospital.util.Utils;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class LeitoDadosActivity extends AppCompatActivity {
private EditText etLeitoCodigo;
private Spinner spLeitoUnidade, spLeitoSetor;
private Button btLeitoOk, btLeitoCancelar;
private Leito leito;
private String msg = null;
private final String tipoOpcao[][] = {{"incluído", "alterado", "excluído"}, {"incluir", "alterar", "excluir"}};
private final static byte CRUD_INC = 0;
private final static byte CRUD_UPD = 1;
private final static byte CRUD_DEL = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_leito_dados);
etLeitoCodigo = (EditText) findViewById(R.id.etLeitoCodigo);
spLeitoUnidade = (Spinner) findViewById(R.id.spLeitoUnidade);
spLeitoSetor = (Spinner) findViewById(R.id.spLeitoSetor);
btLeitoOk = (Button) findViewById(R.id.btLeitoOk);
btLeitoCancelar = (Button) findViewById(R.id.btLeitoCancelar);
if (!carregaSpinner()) {
Toast.makeText(this, "É necessário incluir unidades de atendimento e/ou setor. Verifique se existe algum setor que gera leito!", Toast.LENGTH_LONG).show();
finish();
};
preparaDados();
btLeitoOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String codigoLeito = etLeitoCodigo.getText().toString().trim();
if (codigoLeito.equals("")) {
Toast.makeText(LeitoDadosActivity.this, "É necessário informar o código!", Toast.LENGTH_SHORT).show();
etLeitoCodigo.requestFocus();
} else {
if (leito.getId() == 0) { // inclusão
leito.setCodigo(codigoLeito);
opcaoCrud(CRUD_INC);
} else { // alteração
if (!leito.getCodigo().equalsIgnoreCase(etLeitoCodigo.getText().toString().trim()) ||
!leito.getUnidade().toString().equals(spLeitoUnidade.toString()) ||
!leito.getSetor().toString().equals(spLeitoSetor.toString())) {
leito.setCodigo(codigoLeito);
opcaoCrud(CRUD_UPD);
} else {
Toast.makeText(LeitoDadosActivity.this, "Não houve alteração nos dados!", Toast.LENGTH_SHORT).show();
}
}
finish();
}
}
});
btLeitoCancelar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { // exclusão
Toast.makeText(LeitoDadosActivity.this, "Operação cancelada pelo usuário", Toast.LENGTH_SHORT).show();
finish();
}
});
}
private void preparaDados() {
leito = (Leito) getIntent().getSerializableExtra("leito");
if (leito.getId() == 0) { // inclusão
} else { // alteração e exclusão
etLeitoCodigo.setText(leito.getCodigo());
spLeitoUnidade.setSelection(Utils.getIndex(spLeitoUnidade, leito.getUnidade().getNome()));
spLeitoSetor.setSelection(Utils.getIndex(spLeitoSetor, leito.getSetor().getNome()));
}
}
private boolean carregaSpinner() {
List<Unidade> unidadeList = null;
if (Utils.hasInternet(this)) {
} else {
unidadeList = new UnidadeCtrl(this).getAll();
}
if (unidadeList.size() > 0) {
ArrayAdapter aa = new ArrayAdapter<>(LeitoDadosActivity.this, android.R.layout.simple_spinner_item, unidadeList);
aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spLeitoUnidade.setAdapter(aa);
} else {
return false;
}
spLeitoUnidade.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
leito.setUnidade((Unidade) spLeitoUnidade.getItemAtPosition(position));
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
leito.setUnidade(null);
}
});
List<Setor> setorList = null;
if (Utils.hasInternet(this)) {
} else {
setorList = new SetorCtrl(this).getGeraLeitos();
}
if (setorList.size() > 0) {
ArrayAdapter aa = new ArrayAdapter<>(LeitoDadosActivity.this, android.R.layout.simple_spinner_item, setorList);
aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spLeitoSetor.setAdapter(aa);
} else {
return false;
}
spLeitoSetor.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
leito.setSetor((Setor) spLeitoSetor.getItemAtPosition(position));
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
leito.setSetor(null);
}
});
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.menu_crud, menu);
if (leito.getId() == 0) { // inclusão
btLeitoOk.setText("Incluir");
menu.clear();
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_del:
if (new LeitoCtrl(this).getInternamentoLeito(leito.getId()).size() > 0) {
Toast.makeText(this, "Não é possível excluir esse leito, ela está sendo utilizado no internamento!", Toast.LENGTH_LONG).show();
} else {
new AlertDialog.Builder(this)
.setTitle("Exclusão de leito")
.setMessage("Tem certeza que deseja excluir esse leito?")
.setPositiveButton("sim", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
opcaoCrud(CRUD_DEL);
finish();
}
})
.setNegativeButton("não", null)
.show();
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void opcaoCrud(byte tipoCrud) {
if (Utils.hasInternet(this)) {
crudDados(tipoCrud, new ResultEvent() {
@Override
public <T> void onResult(T result) {
msg = "Leito " + tipoOpcao[0][tipoCrud] + " com sucesso";
}
@Override
public void onFail(String message) {
msg = message;
}
});
} else {
if (tipoCrud == CRUD_INC) {
msg = new LeitoCtrl(LeitoDadosActivity.this).insert(leito);
} else if (tipoCrud == CRUD_UPD) {
msg = new LeitoCtrl(LeitoDadosActivity.this).update(leito);
} else if (tipoCrud == CRUD_DEL) {
msg = new LeitoCtrl(LeitoDadosActivity.this).delete(leito);
}
}
Toast.makeText(LeitoDadosActivity.this, msg, Toast.LENGTH_SHORT).show();
}
private void crudDados(byte tipoCrud, ResultEvent resultEvent) {
Call<Leito> call = null;
if (tipoCrud == CRUD_INC)
call = new RetrofitConfig().getLeitoService().create(leito);
else if (tipoCrud == CRUD_UPD)
call = new RetrofitConfig().getLeitoService().update(leito.getId(), leito);
else if (tipoCrud == CRUD_DEL)
call = new RetrofitConfig().getLeitoService().delete(leito.getId());
call.enqueue(new Callback<Leito>() {
@Override
public void onResponse(Call<Leito> call, Response<Leito> response) {
leito = response.body();
resultEvent.onResult(leito);
}
@Override
public void onFailure(Call<Leito> call, Throwable t) {
resultEvent.onFail("Erro ao " + tipoOpcao[1][tipoCrud] + " leito");
}
});
}
} | [
"ilanmargolis@gmail.com"
] | ilanmargolis@gmail.com |
fa06ac0e316d97a06eb021166f40e22928b9feaa | 6216e7c1ccae3e1ff0c148d833a786a60b541db4 | /app/src/main/java/com/android/nick/geoquiz/TrueFalse.java | 8a4dcc31b8d8a3595a221d9baf3166086be80527 | [] | no_license | xingchueng/GeoQuiz | 14ca73ac6610de597062aff166113fae3044b126 | f70dca717996e1c5c548fbc254d88d44993a0c21 | refs/heads/master | 2020-06-02T03:43:41.740342 | 2015-06-29T08:53:56 | 2015-06-29T08:53:56 | 38,236,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 617 | java | package com.android.nick.geoquiz;
/**
* Created by Nick on 26/6/15.
*/
public class TrueFalse {
private int mQuestion;
private boolean mTrueQuestion;
public TrueFalse(int question, boolean trueQuestion){
mQuestion = question;
mTrueQuestion = trueQuestion;
}
public int getQuestion() {
return mQuestion;
}
public boolean isTrueQuestion() {
return mTrueQuestion;
}
public void setQuestion(int question) {
mQuestion = question;
}
public void setTrueQuestion(boolean trueQuestion) {
mTrueQuestion = trueQuestion;
}
}
| [
"Nick@zhangxings-MacBook-Pro.local"
] | Nick@zhangxings-MacBook-Pro.local |
54885a7ccb32f02de4580b6b9a26c326779a5a43 | f7e817caa22c45493e182bf6d698145e8cb3e005 | /src/com/yz/manager/date/CurrentDate.java | 42deb238eb08f0917c5b31424a3a8d0f2327bad9 | [] | no_license | wingjoy/yzmanager | 40fc3fbd6ffc6170094643e334306ee8fcbfcf21 | f54b1d0272431ba1cabea851d95daf8c0a0b82dc | refs/heads/master | 2021-03-12T23:07:51.797956 | 2013-11-07T16:37:35 | 2013-11-07T16:37:35 | 13,990,442 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,783 | java | package com.yz.manager.date;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public final class CurrentDate {
public static String getCurrentDate() {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sim.format(new Date());
}
public static String getCurrentDate2() {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
return sim.format(new Date());
}
public static String getCurrentDate4() {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
Date date=new Date();
return sim.format(new Timestamp(date.getTime()));
}
public static String getCurrentDate3() {
SimpleDateFormat sim = new SimpleDateFormat("yyyyMMddHHmmss");
return sim.format(new Date());
}
public static int getCurrentYear(){
return Calendar.getInstance().get(Calendar.YEAR);
}
public static int getCurrentMonth(){
return Calendar.getInstance().get(Calendar.MONTH)+1;
}
public static int getCurrentDay(){
return Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
}
public static int getCurrentAPm(){
return Calendar.getInstance().get(Calendar.AM_PM);
}
public static int getCurrentWeek(){
return Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
}
public static Date parseDate(String date){
Date mydate=null;
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
mydate=sim.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return mydate;
}
public static Date parseDate2(String date){
Date mydate=null;
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
mydate=sim.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return mydate;
}
public static Date parseDate3(String date){
Date mydate=null;
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
mydate=sim.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return mydate;
}
public static String parseDate1(String date){
Date mydate=null;
String d=null;
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
mydate=sim.parse(date);
d=sim.format(mydate);
} catch (ParseException e) {
e.printStackTrace();
}
return d;
}
public static String parseDate4(String date){
Date mydate=null;
String d=null;
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
mydate=sim.parse(date);
d=sim.format(mydate);
} catch (ParseException e) {
e.printStackTrace();
}
return d;
}
}
| [
"swbyzx@gmail.com"
] | swbyzx@gmail.com |
f97a60bd9c816df1cae8c91417cd7019f52cfa69 | 38bbb840aa73fab090fe49abeaed231e7b4a3ab4 | /Spring/FoodOrderingManagement/SiparisDatabase/src/main/java/tr/com/siparis/database/model/tatli.java | 219e66db9909eadae51f6ec836e164fef2dc9624 | [] | no_license | serdarkocerr/JavaCalismalari | c8bf35c72fba5dd2ea0189c3228610f4b3d36a54 | 1f4f595607aa6ecb57eb50814f4eae4bf95ce0ca | refs/heads/master | 2022-09-19T04:28:51.682859 | 2022-06-27T12:02:27 | 2022-06-27T12:02:27 | 219,330,674 | 0 | 0 | null | 2022-09-08T01:11:37 | 2019-11-03T16:29:46 | Java | UTF-8 | Java | false | false | 658 | java | package tr.com.siparis.database.model;
public class tatli {
private int tatliid;
private String tatliadi;
public int getTatliid() {
return tatliid;
}
public void setTatliid(int tatliid) {
this.tatliid = tatliid;
}
public String getTatliadi() {
return tatliadi;
}
public void setTatliadi(String tatliadi) {
this.tatliadi = tatliadi;
}
@Override
public String toString() {
return "tatli [tatliid=" + tatliid + ", tatliadi=" + tatliadi + "]";
}
public tatli(int tatliid, String tatliadi) {
super();
this.tatliid = tatliid;
this.tatliadi = tatliadi;
}
public tatli() {
super();
// TODO Auto-generated constructor stub
}
}
| [
"serdarkocerr@gmail.com"
] | serdarkocerr@gmail.com |
521449a3daf319c68e093146672e9f74241789e0 | 951eb16659b5afb62506754a89d71c3f7fd08f16 | /src/main/java/cn/jsprun/domain/Tradeoptionvars.java | 798ea4fcc98501240c1f686d9b027be858cccf31 | [] | no_license | git1024/bbs | a0e319dcf7803d4f67ad9733fb7282b9f009f43a | 009958b03cbf41068fce2d5d524066dfb8411a1a | refs/heads/master | 2021-01-20T17:14:50.949665 | 2016-06-20T10:07:09 | 2016-06-20T10:07:09 | 61,537,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package cn.jsprun.domain;
public class Tradeoptionvars implements java.io.Serializable {
private static final long serialVersionUID = 2596813362018266359L;
private TradeoptionvarsId id;
public Tradeoptionvars() {
}
public Tradeoptionvars(TradeoptionvarsId id) {
this.id = id;
}
public TradeoptionvarsId getId() {
return this.id;
}
public void setId(TradeoptionvarsId id) {
this.id = id;
}
} | [
"yaoyuanliang@jk.cn"
] | yaoyuanliang@jk.cn |
44b0555a6c50e2425062323fb3da4620e1d43aaf | ef6125850fd5bdfb63bcb0a472b77939e278d916 | /app/src/main/java/com/boryana/android/thesis/Models/UsersItem.java | 14dbc9413b24524addd21eb92c0dc36a7b60db8a | [] | no_license | boryanayordanova/android-FindMe | b1ba20e10a6ea7a5f5098f4772fbb7c00ad211a3 | 47db62fb38593ddcbe0ed9ef68438330134ae938 | refs/heads/master | 2023-02-09T06:02:25.315985 | 2021-01-03T19:13:37 | 2021-01-03T19:13:37 | 326,475,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,595 | java | package com.boryana.android.thesis.Models;
/**
* Created by Boryana on 7/17/2016.
*/
public class UsersItem {
private int userId;
private String userName;
private String coor_x;
private String coor_y;
private String rec_date;
private String color;
public UsersItem(int userId, String userName, String coor_x, String coor_y, String rec_date){
this.userId = userId;
this.userName = userName;
this.coor_x = coor_x; // lat
this.coor_y = coor_y; // lon
this.rec_date = rec_date;
}
public String getUserName(){ return this.userName; };
public int getUserId(){ return this.userId; };
public void setColor(String color){this.color = color;}
public String getColor() { return this.color;}
public double distanceToMe(double lat2, double lon2) {
final int R = 6371; // Radius of the earth
Double latDistance = Math.toRadians(lat2 - Double.parseDouble(coor_x));
Double lonDistance = Math.toRadians(lon2 - Double.parseDouble(coor_y));
Double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2)
+ Math.cos(Math.toRadians(Double.parseDouble(coor_x))) * Math.cos(Math.toRadians(lat2))
* Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2);
Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
double distance = R * c * 1000; // convert to meters
distance = Math.pow(distance, 2);
int distanceInMeters = (int)Math.sqrt(distance);
return distanceInMeters/1000.0;
}
public Double getCoor_y() {
if(coor_y.toLowerCase().equals("null")){
return null;
} else
return Double.parseDouble(coor_y);
}
public Double getCoor_x() {
if(coor_x.toLowerCase().equals("null")){
return null;
} else
return Double.parseDouble(coor_x);
}
public String getRec_date() {
return rec_date;
}
public void setRec_date(String rec_date) {
this.rec_date = rec_date;
}
/*
* Calculate distance between two points in latitude and longitude taking
* into account height difference. If you are not interested in height
* difference pass 0.0. Uses Haversine method as its base.
*
* lat1, lon1 Start point
* lat2, lon2 End point
* el1 Start altitude in meters
* el2 End altitude in meters
* @returns Distance in Meters
*/
// public double distanceToMe(double lat1, double lat2, double lon1,
// double lon2, double el1, double el2) { // el1 and el0 will be 0
//
// final int R = 6371; // Radius of the earth
//
// Double latDistance = Math.toRadians(lat2 - lat1);
// Double lonDistance = Math.toRadians(lon2 - lon1);
// Double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2)
// + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2))
// * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2);
// Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
// double distance = R * c * 1000; // convert to meters
//
// double height = el1 - el2;
//
// distance = Math.pow(distance, 2) + Math.pow(height, 2);
//
// return Math.sqrt(distance);
// }
// public void setMakedState(boolean state){ this.isMarked = state;}
// public boolean getMarkedState(){ return this.isMarked;}
// @Override
// public String toString(){
// return ""+this.userId+";";
// }
}
| [
"boryana.yourdanova@gmail.com"
] | boryana.yourdanova@gmail.com |
335a1fe83f2d5bb42c0c1b0e63cf8f3faf31a628 | a260442953d84e672f7f6c83477f3e4dd73e278b | /src/test/java/com/OrangeHRM/CrossBrowserTesting.java | 0355db6b91bd6797e0008ee2adfd1858d9d7c96f | [] | no_license | chaitalianasane247/JD_OrangeHRM_Maven | 3c4e5e3822a3942a061e2fb0ab3572385137f527 | 4a60f2eda20976493f7a9e69bf63f55ba7fc4545 | refs/heads/master | 2023-03-11T19:15:09.036775 | 2021-03-03T08:40:54 | 2021-03-03T08:40:54 | 344,006,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,479 | java | package com.OrangeHRM;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class CrossBrowserTesting extends OrangeHRMTestData {
WebDriver driver;
@BeforeTest
@Parameters("browser")
public void LaunchBrowser(String browser) throws Exception {
if(browser.equalsIgnoreCase("firefox")){
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver();
}
else if(browser.equalsIgnoreCase("chrome")){
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
else if(browser.equalsIgnoreCase("edge")){
WebDriverManager.edgedriver().setup();
driver = new EdgeDriver();
}
else if(browser.equalsIgnoreCase("ie")){
WebDriverManager.iedriver().setup();
driver = new InternetExplorerDriver();
}
else{
//If no browser passed throw exception
throw new Exception("Browser is not correct");
}
}
/*@Test(dataProvider="Login")
public void OrangeHRM_Login(String url,String uname, String upass) {
driver.get(url);
driver.findElement(By.name("txtUsername")).clear();
driver.findElement(By.name("txtUsername")).sendKeys(uname);
driver.findElement(By.name("txtPassword")).clear();
driver.findElement(By.name("txtPassword")).sendKeys(upass);
driver.findElement(By.id("btnLogin")).click();
String Element = driver.findElement(By.linkText("Dashboard")).getText();
System.out.println(Element);
}*/
@Test(dataProvider="Login")
public void OrangeHRM_Login(String uname,String upass) {
driver.get("https://opensource-demo.orangehrmlive.com/index.php/auth/login");
driver.findElement(By.name("txtUsername")).clear();
driver.findElement(By.name("txtUsername")).sendKeys("Admin");
driver.findElement(By.name("txtPassword")).clear();
driver.findElement(By.name("txtPassword")).sendKeys("admin123");
driver.findElement(By.id("btnLogin")).click();
String Element = driver.findElement(By.linkText("Dashboard")).getText();
System.out.println(Element);
}
@AfterTest
public void CloseBrowser() {
driver.quit();
}
}
| [
"anasanechaitali@gmail.com"
] | anasanechaitali@gmail.com |
ca570837fc9718b4def9c41efea418e1c9ad840c | ce5c0f922ef5d2943ea20fa519328289b4424caf | /src/test/java/org/starter_project/mycatalogue/MycatalogueApplicationTests.java | 617541c79d632005396178bfe003ff740b24b79b | [] | no_license | hajah-dev/Products | 56d800f3b49c3cc75077e56318d742271e43333b | b9bc681417031703e9dc51c09b4117b7e3921d6e | refs/heads/master | 2023-01-04T16:44:15.885562 | 2020-11-03T21:54:54 | 2020-11-03T21:54:54 | 309,568,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 237 | java | package org.starter_project.mycatalogue;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MycatalogueApplicationTests {
@Test
void contextLoads() {
}
}
| [
"tsifetrarivo@gmail.com"
] | tsifetrarivo@gmail.com |
c30e1743ba9c30a7e22055d30664d6068a2e2fca | 6253283b67c01a0d7395e38aeeea65e06f62504b | /decompile/app/Mms/src/main/java/com/android/mms/transaction/MessageSender.java | a517b33ef46d124f5a5db768f767626064c22577 | [] | no_license | sufadi/decompile-hw | 2e0457a0a7ade103908a6a41757923a791248215 | 4c3efd95f3e997b44dd4ceec506de6164192eca3 | refs/heads/master | 2023-03-15T15:56:03.968086 | 2017-11-08T03:29:10 | 2017-11-08T03:29:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 171 | java | package com.android.mms.transaction;
import com.google.android.mms.MmsException;
public interface MessageSender {
boolean sendMessage(long j) throws MmsException;
}
| [
"liming@droi.com"
] | liming@droi.com |
7476e3ecf32a1d9c481cac42c52ef26c9b0e6e87 | 416ed26975cc93982e9895da5f2f447383bc5d9f | /main/boofcv-geo/test/boofcv/alg/geo/bundle/TestCalibPoseAndPointRodiguesJacobian.java | c69d4d16dc0cf5331d0070462e057e48f0223ad9 | [
"LicenseRef-scancode-takuya-ooura",
"Apache-2.0"
] | permissive | jmankhan/BoofCV | 4cb99fbe19afcd35197003fc967c998e9c4875de | afbb6b1bf360092b3ee6e3ed5d0d2f9710d0e2da | refs/heads/SNAPSHOT | 2021-01-20T03:29:46.088886 | 2017-05-06T18:13:40 | 2017-05-06T18:13:40 | 89,549,111 | 1 | 0 | null | 2017-04-27T02:54:45 | 2017-04-27T02:54:45 | null | UTF-8 | Java | false | false | 2,692 | java | /*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package boofcv.alg.geo.bundle;
import georegression.struct.se.Se3_F64;
import org.ddogleg.optimization.DerivativeChecker;
import org.junit.Test;
import java.util.List;
import java.util.Random;
import static boofcv.abst.geo.bundle.TestBundleAdjustmentCalibratedDense.createModel;
import static boofcv.abst.geo.bundle.TestBundleAdjustmentCalibratedDense.createObservations;
import static org.junit.Assert.assertTrue;
/**
* @author Peter Abeles
*/
public class TestCalibPoseAndPointRodiguesJacobian {
Random rand = new Random(48854);
int numViews = 2;
int numPoints = 3;
CalibPoseAndPointRodriguesCodec codec = new CalibPoseAndPointRodriguesCodec();
CalibPoseAndPointResiduals func = new CalibPoseAndPointResiduals();
/**
* Check Jacobian against numerical. All views have unknown extrinsic parameters
*/
@Test
public void allUnknown() {
check(false,false);
}
/**
* Check Jacobian against numerical. All views have unknown extrinsic parameters
*/
@Test
public void allKnown() {
check(true, true);
}
private void check( boolean ...known ) {
CalibratedPoseAndPoint model = createModel(numViews,numPoints,rand);
List<ViewPointObservations> observations = createObservations(model,numViews,numPoints);
Se3_F64 extrinsic[] = new Se3_F64[known.length];
for( int i = 0; i < known.length; i++ ) {
model.setViewKnown(i,known[i]);
if( known[i] ) {
Se3_F64 e = new Se3_F64();
e.set(model.getWorldToCamera(i));
extrinsic[i] = e;
}
}
int numViewsUnknown = model.getNumUnknownViews();
codec.configure(numViews,numPoints,numViewsUnknown,known);
func.configure(codec,model,observations);
CalibPoseAndPointRodriguesJacobian alg = new CalibPoseAndPointRodriguesJacobian();
alg.configure(observations,numPoints,extrinsic);
double []param = new double[ codec.getParamLength() ];
codec.encode(model,param);
// DerivativeChecker.jacobianPrint(func, alg, param, 1e-6);
assertTrue(DerivativeChecker.jacobian(func, alg, param, 1e-4));
}
}
| [
"peter.abeles@gmail.com"
] | peter.abeles@gmail.com |
b52442345d41f71779b1da5a54c35a2529e917e2 | ec762c25037dadc0aebdc212cb49f554c510905d | /app/src/main/java/Cabrapan/MiSudoku/GUI/Tablero.java | c71dd21b1ca35f137f171f03c0a604a9cae0eb6b | [] | no_license | PauCabrapan/Sudoku | 78432c2979787ff2e47709e6933aa928cc706ec9 | e6a1de54d9d9c22115bb563473356ea5d4254f57 | refs/heads/master | 2020-07-07T05:09:45.626294 | 2019-09-19T17:31:32 | 2019-09-19T17:31:32 | 203,260,713 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,335 | java | package Cabrapan.MiSudoku.GUI;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import Cabrapan.MiSudoku.Juego;
import Cabrapan.MiSudoku.R;
public class Tablero extends AppCompatActivity {
final static int size = 9; //Tamaño del tablero
private Context context;
private Button btnPista;
private TextView [][] ivCeldas = new TextView[size][size];
private Drawable[] drawCelda = new Drawable[6]; //Estados de la celda
private int xSeleccionado;
private int ySeleccionado;
private Juego juego;
private int errores;
private boolean usoPista;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_board);
Bundle b = getIntent().getExtras();
String dificultad = b.getString("dificultad");
errores = 0;
usoPista = false;
xSeleccionado = 10; //Valor invalido
ySeleccionado = 10; //Valor invalido
context = this;
cargarRecursos();
diseñarTablero();
setListenKeyboard();
juego = new Juego(dificultad);
int [][] newTablero = juego.iniciarJuego();
llenarTablero(newTablero);
btnPista = findViewById(R.id.btnPista);
btnPista.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
iluminar(juego.getPista());
}
});
}
private void iluminar(int[] posicion){
usoPista = true;
ivCeldas[posicion[0]][posicion[1]].setBackground(drawCelda[5]);
setNro(String.valueOf(posicion[2]),posicion[0],posicion[1]);
juego.jugada(String.valueOf(posicion[2]),posicion[0],posicion[1]);
if(juego.esFin())
endGame();
}
private void llenarTablero(int[][] newTablero) {
String aux;
for(int i = 0; i < 9; i++){
for (int j = 0; j < 9; j++){
switch (newTablero[i][j]){
case 1:
ivCeldas[i][j].setText("1");
break;
case 2:
ivCeldas[i][j].setText("2");
break;
case 3:
ivCeldas[i][j].setText("3");
break;
case 4:
ivCeldas[i][j].setText("4");
break;
case 5:
ivCeldas[i][j].setText("5");
break;
case 6:
ivCeldas[i][j].setText("6");
break;
case 7:
ivCeldas[i][j].setText("7");
break;
case 8:
ivCeldas[i][j].setText("8");
break;
case 9:
ivCeldas[i][j].setText("9");
break;
case 0:
ivCeldas[i][j].setText(" ");
break;
}
ivCeldas[i][j].setGravity(Gravity.CENTER);
}
}
}
private void setListenKeyboard() {
TableLayout keyboard = findViewById(R.id.numeros);
ArrayList<View> touchables = keyboard.getTouchables();
for(View t : touchables){
final View tFinal = t;
t.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if ((juego.isEnabled(xSeleccionado, ySeleccionado))) {
int a = v.getId();
Button b = findViewById(a);
CharSequence text = b.getText();
String nro = (text.length() == 0) ? "0" : String.valueOf(text);
boolean esValido = juego.jugada(nro, xSeleccionado, ySeleccionado);
setNro(text, xSeleccionado,ySeleccionado);
if(esValido){
ivCeldas[xSeleccionado][ySeleccionado].setBackground(drawCelda[1]);
if (juego.esFin())
endGame();
}
else {
aumentarErrores();
if(errores>5)
endGame();
ivCeldas[xSeleccionado][ySeleccionado].setBackground(drawCelda[2]);
Toast.makeText(context, "Movimiento inválido", Toast.LENGTH_LONG).show();
}
}
}
});
}
}
private void aumentarErrores() {
errores++;
TextView tvError = findViewById(R.id.tvError);
tvError.setText(String.valueOf(errores));
if(errores == 5){
endGame();
}
}
private void endGame() {
SharedPreferences pref = getSharedPreferences("contadores",MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
int cant;
String title;
if (errores > 4){ //Juego perdido
title = "¡Perdiste!";
//Sumo perdidos
cant = pref.getInt("cPerdidos",0);
editor.putInt("cPerdidos",cant + 1);
//Reinicio racha
editor.putInt("rVictorias",0);
}
else{
title = "¡Ganaste!";
//Sumo ganados
cant = pref.getInt("cGanados",0);
editor.putInt("cGanados",cant + 1);
//Sumo racha
cant = pref.getInt("rVictorias",0);
editor.putInt("rVictorias",cant + 1);
//Si no uso pistas suma sinPista
if(!usoPista){
cant = pref.getInt("csAyuda",0);
editor.putInt("csAyuda",cant+1);
}
}
editor.apply();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(title);
builder.setPositiveButton("Volver al menú", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(context,Principal.class);
startActivity(intent);
}
});
builder.setCancelable(false);
builder.show();
}
private void setNro(CharSequence nro, int xSeleccionado, int ySeleccionado) {
if(nro.length() != 0)
ivCeldas[xSeleccionado][ySeleccionado].setText(nro);
else
ivCeldas[xSeleccionado][ySeleccionado].setText("");
ivCeldas[xSeleccionado][ySeleccionado].setGravity(Gravity.CENTER);
}
protected void cargarRecursos(){
drawCelda[0] = context.getDrawable(R.drawable.celdas);
drawCelda[1] = context.getDrawable(R.drawable.celda_selected);
drawCelda[2] = context.getDrawable(R.drawable.celda_error_selected);
drawCelda[3] = context.getDrawable(R.drawable.celda_error);
drawCelda[4] = context.getDrawable(R.drawable.grupo_selected);
drawCelda[5] = context.getDrawable(R.drawable.pista);
}
protected void diseñarTablero(){
int sizeCelda = Math.round(ScreenWidth()/size);
LinearLayout.LayoutParams lpFila = new LinearLayout.LayoutParams(sizeCelda*size,sizeCelda);
LinearLayout.LayoutParams lpCel = new LinearLayout.LayoutParams(sizeCelda,sizeCelda);
LinearLayout linTablero = findViewById(R.id.tablero);
for (int i = 0; i < size; i++){
LinearLayout linFila = new LinearLayout(context);
for (int j = 0; j < size; j++){
ivCeldas[i][j] = new TextView(context);
ivCeldas[i][j].setBackground(drawCelda[0]);
final int finalI = i;
final int finalJ = j;
final TextView selected = ivCeldas[i][j];
ivCeldas[i][j].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(xSeleccionado != 10 && ySeleccionado != 10) {
unSelectGrupo();
if (ivCeldas[xSeleccionado][ySeleccionado].getBackground() != drawCelda[2])
ivCeldas[xSeleccionado][ySeleccionado].setBackground(drawCelda[0]);
else
ivCeldas[xSeleccionado][ySeleccionado].setBackground(drawCelda[3]);
}
xSeleccionado = finalI;
ySeleccionado = finalJ;
selectGrupo();
if(selected.getBackground() == drawCelda[3])
selected.setBackground(drawCelda[2]);
else
selected.setBackground(drawCelda[1]);
}
});
linFila.addView(ivCeldas[i][j],lpCel);
}
linTablero.addView(linFila,lpFila);
}
}
private void unSelectGrupo() {
HashMap<String,Integer> map = juego.getGrupo(xSeleccionado,ySeleccionado);
int minCol = (map.get("minCol") == null)? 0 : map.get("minCol");
int maxCol = (map.get("maxCol") == null)? 0 : map.get("maxCol");
int minFila = (map.get("minFila") == null)? 0 : map.get("minFila");
int maxFila = (map.get("maxFila") == null)? 0 : map.get("maxFila");
for(int i = minFila; i<=maxFila;i++){
for(int j = minCol;j<=maxCol;j++){
if(i != xSeleccionado || j != ySeleccionado)
ivCeldas[i][j].setBackground(drawCelda[0]);
}
}
}
private void selectGrupo() {
HashMap<String,Integer> map = juego.getGrupo(xSeleccionado,ySeleccionado);
int minCol = (map.get("minCol") == null)? 0 : map.get("minCol");
int maxCol = (map.get("maxCol") == null)? 0 : map.get("maxCol");
int minFila = (map.get("minFila") == null)? 0 : map.get("minFila");
int maxFila = (map.get("maxFila") == null)? 0 : map.get("maxFila");
for(int i = minFila; i<=maxFila;i++){
for(int j = minCol;j<=maxCol;j++){
if(i != xSeleccionado || j != ySeleccionado)
ivCeldas[i][j].setBackground(drawCelda[4]);
}
}
}
private float ScreenWidth() {
Resources resources = context.getResources();
DisplayMetrics dm = resources.getDisplayMetrics();
return dm.widthPixels;
}
}
| [
"pcabrapan@gmail.com"
] | pcabrapan@gmail.com |
818e3fe6ee54670ff91c1916ef6b481e03d14f5e | 2b55631fcefb7b504635d46499c76f9dc737d372 | /src/main/java/com/fayayo/study/kafka/producer/KProducer.java | 85c233dbe282629caee53d91d2e5d7badb943182 | [] | no_license | crelle/study | aa5a1f9b0fe8b3cdeb9f69fe2b4fd4b36bb7f4ca | 715889fd21756edbdccb8de3a89eb25418801753 | refs/heads/master | 2020-04-18T17:47:20.615620 | 2019-01-22T11:57:46 | 2019-01-22T11:57:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,121 | java | package com.fayayo.study.kafka.producer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.producer.*;
import java.util.Properties;
/**
* @author dalizu on 2018/11/6.
* @version v1.0
* @desc 生产者
*/
@Slf4j
public class KProducer {
public static void main(String[] args) throws InterruptedException {
try {
Producer<String, String> producer = createProducer();
sendMessages(producer);
// Allow the producer to complete sending of the messages before program exit.
Thread.sleep(2000);
}catch (Exception e){
e.printStackTrace();
}
}
private static Producer<String, String> createProducer() {
Properties props = new Properties();
props.put("bootstrap.servers", "192.168.88.129:9092");
props.put("acks", "all");//这意味着leader需要等待所有备份都成功写入日志,这种策略会保证只要有一个备份存活就不会丢失数据。这是最强的保证。
props.put("retries", 0);
// Controls how much bytes sender would wait to batch up before publishing to Kafka.
//控制发送者在发布到kafka之前等待批处理的字节数。 满足batch.size和ling.ms之一,producer便开始发送消息
//默认16384 16kb
props.put("batch.size", 16384);
props.put("linger.ms", 1);
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
return new KafkaProducer(props);
}
private static void sendMessages(Producer<String, String> producer) {
System.out.println("start send message......");
String topic = "test-topic";
int partition = 1;//指定分区发送
long record = 1;
for (int i = 1; i <= 200; i++) {
//指定分区发送
/*producer.send(
new ProducerRecord<String, String>(topic, partition,
Long.toString(record),"producer_msg"+Long.toString(record++)),new SendCallBack());*/
//不指定分区,会均匀发送
producer.send(
new ProducerRecord<String, String>(topic,"producer_msg"+Long.toString(record++)),new SendCallBack());
}
System.out.println("start send message......end");
}
/**
*
Future<RecordMetadata> send(ProducerRecord<K, V> producer, Callback callback);
Callback 是一个回调接口,在消息发送完成之后可以回调我们自定义的实现
* */
private static class SendCallBack implements Callback{
@Override
public void onCompletion(RecordMetadata recordMetadata, Exception e) {
if(null!=recordMetadata){
log.info("msg offset,partition,topic"+
recordMetadata.offset(),recordMetadata.partition(),recordMetadata.topic(),recordMetadata);
}else {
System.out.println("发送异常");
}
}
}
}
| [
"535733495@qq.com"
] | 535733495@qq.com |
e8bbb97c52ea3288017843ec2ecccf5775cc197c | 0b7a66259406ae5d934969f06fc031c4f970482e | /itcastTax/src/cn/itcast/nsfw/user/action/UserAction.java | 9a76f52552b47effb54735686a13f7eb70b1e5bd | [] | no_license | dawei134679/ssh_demo | 67ca8a78bd5cd7f36d7efe3724c1f94e0b4f1bb6 | ab266efb019249b09ea60d19cd43dca9346756c1 | refs/heads/master | 2020-03-23T04:48:18.803307 | 2018-07-16T08:02:23 | 2018-07-16T08:02:23 | 141,106,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,330 | java | package cn.itcast.nsfw.user.action;
import java.io.File;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.List;
import java.util.UUID;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.ServletActionContext;
import cn.itcast.core.action.BaseAction;
import cn.itcast.core.exception.ActionException;
import cn.itcast.core.exception.ServiceException;
import cn.itcast.core.util.QueryHelper;
import cn.itcast.nsfw.role.entity.Role;
import cn.itcast.nsfw.role.service.RoleService;
import cn.itcast.nsfw.user.entity.User;
import cn.itcast.nsfw.user.entity.UserRole;
import cn.itcast.nsfw.user.service.UserService;
import com.opensymphony.xwork2.ActionContext;
public class UserAction extends BaseAction {
@Resource
private UserService userService;
@Resource
private RoleService roleService;
private User user;
private File headImg;
private String headImgFileName;
private String headImgContentType;
private File userExcel;
private String userExcelFileName;
private String userExcelContentType;
private String[] roleIds;
private String strName;
//列表
public String listUI() throws ActionException {
try {
QueryHelper queryHelper = new QueryHelper(User.class, "");
if(user != null){
if(StringUtils.isNotBlank(user.getName())){
user.setName(URLDecoder.decode(user.getName(),"utf-8"));
queryHelper.addCondition("name like ?", "%" + user.getName() + "%");
}
}
pageResult = userService.getPageResult(queryHelper, getPageNo(), getPageSize());
} catch (Exception e) {
e.printStackTrace();
}
return "listUI";
}
//跳转到新增页面
public String addUI(){
//加载角色列表
ActionContext.getContext().getContextMap().put("roleList", roleService.findObjects());
strName = user.getName();
user = null;
return "addUI";
}
//保存新增
public String add(){
try {
//保存用户
if(user != null){
//处理用户头像
if(headImg != null){//1、获取头像文件
//2、保存头像文件
String filePath = ServletActionContext.getServletContext().getRealPath("upload/user");
String fileName = UUID.randomUUID().toString().replaceAll("-", "") + headImgFileName.substring(headImgFileName.lastIndexOf("."));
FileUtils.copyFile(headImg, new File(filePath, fileName));
//3、设置用户头像路径
user.setHeadImg("user/" + fileName);
}
userService.saveUserAndRole(user, roleIds);
}
} catch (Exception e) {
e.printStackTrace();
}
return "list";
}
//跳转到编辑页面
public String editUI(){
//加载角色列表
ActionContext.getContext().getContextMap().put("roleList", roleService.findObjects());
if(user != null && StringUtils.isNotBlank(user.getId())){
strName = user.getName();
user = userService.findObjectById(user.getId());
//处理角色回显问题
List<UserRole> list = userService.findUserRolesByUserId(user.getId());
if(list != null && list.size() > 0){
roleIds = new String[list.size()];
int i = 0;
for(UserRole ur : list){
roleIds[i++] = ur.getId().getRole().getRoleId();
}
}
}
return "editUI";
}
//保存编辑
public String edit(){
try {
if(user != null){
//处理用户头像
if(headImg != null){//1、获取头像文件
//2、保存头像文件
String filePath = ServletActionContext.getServletContext().getRealPath("upload/user");
String fileName = UUID.randomUUID().toString().replaceAll("-", "") + headImgFileName.substring(headImgFileName.lastIndexOf("."));
FileUtils.copyFile(headImg, new File(filePath, fileName));
//3、设置用户头像路径
user.setHeadImg("user/" + fileName);
}
userService.updateUserAndRole(user,roleIds);
}
} catch (IOException e) {
e.printStackTrace();
}
return "list";
}
//根据id删除
public String delete(){
if(user != null && StringUtils.isNotBlank(user.getId())){
strName = user.getName();
userService.delete(user.getId());
}
return "list";
}
//批量删除
public String deleteSelected(){
if(selectedRow != null){
strName = user.getName();
for(String id: selectedRow){
userService.delete(id);
}
}
return "list";
}
//导出用户列表
public void exportExcel(){
try {
//1、获取用户列表
//2、输出excel
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("application/x-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + new String("用户列表.xls".getBytes(), "ISO-8859-1"));
ServletOutputStream outputStream = response.getOutputStream();
userService.exportExcel(userService.findObjects(), outputStream);
if (outputStream != null) {
outputStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
//导入用户列表
public String importExcel(){
if(userExcel != null){
//判断是否是excel文件
if(userExcelFileName.matches("^.+\\.(?i)((xls)|(xlsx))$")){
userService.importExcel(userExcel);
}
}
return "list";
}
//校验帐号唯一性
public void verifyAccount(){
try {
//1、获取帐号、id
if(user != null && StringUtils.isNotBlank(user.getAccount())){
String res = "true";
//2、根据帐号、id查询用户记录
List<User> userList = userService.findUsersByAccountAndId(user.getAccount(), user.getId());
if(userList != null && userList.size() > 0){//说明该帐号已经存在
res = "false";
}
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/html;charset=utf-8");
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write(res.getBytes());
outputStream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public File getHeadImg() {
return headImg;
}
public void setHeadImg(File headImg) {
this.headImg = headImg;
}
public String getHeadImgFileName() {
return headImgFileName;
}
public void setHeadImgFileName(String headImgFileName) {
this.headImgFileName = headImgFileName;
}
public String getHeadImgContentType() {
return headImgContentType;
}
public void setHeadImgContentType(String headImgContentType) {
this.headImgContentType = headImgContentType;
}
public File getUserExcel() {
return userExcel;
}
public void setUserExcel(File userExcel) {
this.userExcel = userExcel;
}
public String getUserExcelFileName() {
return userExcelFileName;
}
public void setUserExcelFileName(String userExcelFileName) {
this.userExcelFileName = userExcelFileName;
}
public String getUserExcelContentType() {
return userExcelContentType;
}
public void setUserExcelContentType(String userExcelContentType) {
this.userExcelContentType = userExcelContentType;
}
public String[] getRoleIds() {
return roleIds;
}
public void setRoleIds(String[] roleIds) {
this.roleIds = roleIds;
}
public String getStrName() {
return strName;
}
public void setStrName(String strName) {
this.strName = strName;
}
}
| [
"532231254@qq.com"
] | 532231254@qq.com |
d6d0dd04dde6d2b2097adcca53b0686c73d04463 | de324ef76e710fe4ada1f4609a49c2101cd81feb | /test.java | 67085214e29a0d2a46ab709ccd509b35f728ac6b | [] | no_license | gaurav2330/trapped | 61d4fb70075488cccee65fdb60eecd480756b2b0 | 9fe95a88d14ee0ad56cf2daf96014d5b74edbf52 | refs/heads/master | 2020-07-26T07:21:04.825073 | 2019-09-15T10:21:59 | 2019-09-15T10:21:59 | 208,576,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 456 | java | public class test
{
static int amount=1000;
test()
{
System.out.println("amount= "+amount);
}
test(int a)
{
test.amount+=a;
}
void display()
{
System.out.println("amount= "+amount);
}
public static void main(String[]args)
{
test t1=new test();
test t2=new test(2000);
t2.display();
test t3=new test(400);
t3.display();
}
} | [
"sgrb26@gmail.com"
] | sgrb26@gmail.com |
6980d1bc17d1894f6dafd9d88d5b23bb725712a6 | e9daeea80ddb2fa64b6ba57addf14e363b497a79 | /commonwebitems/src/uk/co/tui/shortlist/view/data/SearchShortlistViewData.java | f4cc4f4df16f7c18df855aac917d65caed600435 | [] | no_license | gousebashashaik/16.2.0.0 | 99922b8d5bf02cde3a8bf24dc7e044852078244f | 4374ee6408d052df512a82e54621facefbf55f32 | refs/heads/master | 2021-01-10T10:51:51.288078 | 2015-09-29T09:30:14 | 2015-09-29T09:30:14 | 43,352,196 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | /**
*
*/
package uk.co.tui.shortlist.view.data;
/**
* @author shwetha.rb
*
*/
public class SearchShortlistViewData
{
private boolean resFlag;
private String packageId;
/**
* @return the packageId
*/
public String getPackageId()
{
return packageId;
}
/**
* @param packageId the packageId to set
*/
public void setPackageId(final String packageId)
{
this.packageId = packageId;
}
/**
* @return the resFlag
*/
public boolean isResFlag()
{
return resFlag;
}
/**
* @param resFlag the resFlag to set
*/
public void setResFlag(final boolean resFlag)
{
this.resFlag = resFlag;
}
}
| [
"gousebasha.s@sonata-software.com"
] | gousebasha.s@sonata-software.com |
5079d004ac7e3eec79706084a56749b5d817c640 | dc7d270be0ddcf7e03b7c269c9ee0b669890c61b | /Movie_Project_stickear/app/src/test/java/com/wardiman/movie_project_stickear/ExampleUnitTest.java | 8ffcffad3a89f14308b025a6b5a846d8020061ed | [] | no_license | Diman12345/Catalog_movieV2 | 63b480fb73ac11558f959655c0426f745ccf94e8 | 40c4e94fd13ee6b384395138c337db2aede1ad68 | refs/heads/main | 2023-01-27T18:27:36.529211 | 2020-12-05T23:26:03 | 2020-12-05T23:26:03 | 318,905,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.wardiman.movie_project_stickear;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"wardimanperdian@gmail.com"
] | wardimanperdian@gmail.com |
d1a8a98eef740b0910dd2bf3815be21c50498f82 | 4e3c5dc1cfd033b0e7c1bea625f9ee64ae12871a | /org/nexage/sourcekit/mraid/internal/MRAIDNativeFeatureManager.java | c9a1e2c88d1b808d0654237ce65983cee3f8f6e7 | [] | no_license | haphan2014/idle_heroes | ced0f6301b7a618e470ebfa722bef3d4becdb6ba | 5bcc66f8e26bf9273a2a8da2913c27a133b7d60a | refs/heads/master | 2021-01-20T05:01:54.157508 | 2017-08-25T14:06:51 | 2017-08-25T14:06:51 | 101,409,563 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 2,116 | java | package org.nexage.sourcekit.mraid.internal;
import android.content.Context;
import android.os.Build.VERSION;
import java.util.ArrayList;
import org.nexage.sourcekit.mraid.MRAIDNativeFeature;
public class MRAIDNativeFeatureManager {
private static final String TAG = "MRAIDNativeFeatureManager";
private Context context;
private ArrayList<String> supportedNativeFeatures;
public MRAIDNativeFeatureManager(Context context, ArrayList<String> supportedNativeFeatures) {
this.context = context;
this.supportedNativeFeatures = supportedNativeFeatures;
}
public boolean isCalendarSupported() {
boolean retval = this.supportedNativeFeatures.contains(MRAIDNativeFeature.CALENDAR) && VERSION.SDK_INT >= 14 && this.context.checkCallingOrSelfPermission("android.permission.WRITE_CALENDAR") == 0;
MRAIDLog.m2730d(TAG, "isCalendarSupported " + retval);
return retval;
}
public boolean isInlineVideoSupported() {
boolean retval = this.supportedNativeFeatures.contains(MRAIDNativeFeature.INLINE_VIDEO);
MRAIDLog.m2730d(TAG, "isInlineVideoSupported " + retval);
return retval;
}
public boolean isSmsSupported() {
boolean retval = this.supportedNativeFeatures.contains(MRAIDNativeFeature.SMS) && this.context.checkCallingOrSelfPermission("android.permission.SEND_SMS") == 0;
MRAIDLog.m2730d(TAG, "isSmsSupported " + retval);
return retval;
}
public boolean isStorePictureSupported() {
boolean retval = this.supportedNativeFeatures.contains(MRAIDNativeFeature.STORE_PICTURE);
MRAIDLog.m2730d(TAG, "isStorePictureSupported " + retval);
return retval;
}
public boolean isTelSupported() {
boolean retval = this.supportedNativeFeatures.contains(MRAIDNativeFeature.TEL) && this.context.checkCallingOrSelfPermission("android.permission.CALL_PHONE") == 0;
MRAIDLog.m2730d(TAG, "isTelSupported " + retval);
return retval;
}
public ArrayList<String> getSupportedNativeFeatures() {
return this.supportedNativeFeatures;
}
}
| [
"hien.bui@vietis.com.vn"
] | hien.bui@vietis.com.vn |
f781540c678bad7f468f13b8dd65d84faa2f2b33 | 5f580a3330e5b10b802ae971e7d64481a8a890d1 | /src/main/java/org/serviceSupportClasses/LatestVersion.java | 9b8323094ac6d081f1fd286fb558dfd115d789f6 | [] | no_license | JayathmaChathurangani/AetherMicroservice | 008e3124ed28a702a42ccff4fb888c4f5c2b1ae8 | 1e6d5520e7a4b2b918651e9c120a4f9f79bcc0a1 | refs/heads/master | 2021-08-28T06:29:28.430371 | 2017-12-11T12:25:23 | 2017-12-11T12:25:23 | 113,855,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,133 | java | package org.serviceSupportClasses;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.util.Booter;
import org.eclipse.aether.resolution.VersionRangeRequest;
import org.eclipse.aether.resolution.VersionRangeResult;
import org.eclipse.aether.version.Version;
public class LatestVersion {
//public static void main( String[] args ) throws Exception{
public static String getVersion( String groupID, String artifactID){
System.out.println( "------------------------------------------------------------" );
System.out.println( LatestVersion.class.getSimpleName() );
RepositorySystem system = Booter.newRepositorySystem();
RepositorySystemSession session = Booter.newRepositorySystemSession( system );
String artifactRef = groupID+":"+artifactID+":[0,)";
Artifact artifact = new DefaultArtifact(artifactRef);
VersionRangeRequest rangeRequest = new VersionRangeRequest();
rangeRequest.setArtifact( artifact );
rangeRequest.setRepositories( Booter.newRepositories( system, session ) );
String ans;
ans = "{\"ErrorMsg\":\""+"Not Found\"}";
try{
VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest );
Version newestVersion = rangeResult.getHighestVersion();
System.out.println( "Newest version " + newestVersion + " from repository "
+ rangeResult.getRepository( newestVersion ) );
ans = "{\"Artifact\":\""+artifactID+"\",";
if(newestVersion!=null){
ans = ans.concat("\"NewestVersion\":\""+newestVersion.toString()+"\"}");
}else{
ans = ans.concat("\"ErrorMsg\":\"NotFound\"}");
}
}catch(Exception e){
//System.out.println("Error is "+ e.getMessage());
ans = "{\"ErrorMsg\":\""+e.getMessage()+"\"}";
return ans;
}
return ans;
}
}
| [
"ejcjayathma@gmail.com"
] | ejcjayathma@gmail.com |
ec147b6efa07496157abd4d718c7d0b7b19176cc | 5de40111bc19bca70554870edd3c4963d88c48d6 | /src/main/java/com/wisdom/blog/service/VoteServiceImpl.java | 00d90fb9f1a549e2c7a9c3b2ae946fa7a003d920 | [] | no_license | Hey-Sir/wisdomblog | 524e95b9618a028d1ba8146cf32ed8d3f754f369 | 180846925337686f23c9983ac28fa68c8b5af406 | refs/heads/master | 2020-03-23T10:01:24.577355 | 2018-10-08T06:56:29 | 2018-10-08T06:56:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | package com.wisdom.blog.service;
import com.wisdom.blog.domain.Vote;
import com.wisdom.blog.repository.VoteRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class VoteServiceImpl implements VoteService {
@Autowired
private VoteRepository voteRepository;
@Override
public Vote getVoteById(Long id) {
return voteRepository.getOne(id);
}
@Override
public void removeVote(Long id) {
voteRepository.deleteById(id);
}
}
| [
"2359477519@qq.com"
] | 2359477519@qq.com |
1c278d7f389470321c7f616b8f666b55c391b327 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-batch/src/main/java/com/amazonaws/services/batch/model/TagResourceResult.java | b66dc43cbf658e4827c1c925d4b2a76ff9ea25c6 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 2,304 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.batch.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/TagResource" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TagResourceResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TagResourceResult == false)
return false;
TagResourceResult other = (TagResourceResult) obj;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
return hashCode;
}
@Override
public TagResourceResult clone() {
try {
return (TagResourceResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
109bbc17c0e57b24aeffeb6f0b096058b8935ace | abe0f101389f4e55bbe0834ff961ce01352c7808 | /src/main/java/Robot.java | 9e4e01d142b8a4b873573739c8a0fb39f8bfdce5 | [
"Apache-2.0"
] | permissive | lamyoung/leetcode | f65efbec9faa5683cc9b312614e1703939421f6e | bee9e97a4d7bd2655371d7b96734b19b5f36e5e4 | refs/heads/master | 2023-03-02T01:40:25.694279 | 2021-02-15T16:32:47 | 2021-02-15T16:32:47 | 278,777,906 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,292 | java | import java.util.HashSet;
public class Robot {
public static void main(String[] args) {
String command = "RRU";
int[][] obstacles = { { 9,4 }};
int x = 1486;
int y = 743;
System.out.println(robot(command, obstacles, x, y));
}
public static boolean robot(String command, int[][] obstacles, int x, int y) {
int rightStep = 0;
for (int commandCount = 0; commandCount < command.length(); commandCount++) {
if ('R' == command.charAt(commandCount)) {
rightStep++;
}
}
int minSize;
if(rightStep == 0) {
minSize = y / command.length();
} else if(rightStep == command.length()) {
minSize = x / rightStep;
} else {
minSize = Math.min(x / rightStep, y / (command.length() - rightStep));
}
int newX = x- minSize * rightStep;
int newY = y- minSize * (command.length() - rightStep);
int xPos = 0, yPos = 0;
HashSet<String> obstaclesSet = getObstaclesPos(rightStep, command, obstacles, x, y);
for (int i = 0; i < command.length(); i++) {
String res = new StringBuilder().append(xPos).append(",").append(yPos).toString();
if (obstaclesSet.contains(res)) {
return false;
}
if (xPos == newX && yPos == newY) {
return true;
}
if ('R' == command.charAt(i)) {
xPos++;
} else {
yPos++;
}
}
if(newX==0 && newY==0) {
return true;
} else {
return false;
}
}
public static HashSet<String> getObstaclesPos(int rightStep, String command, int[][] obstacles, int x, int y) {
HashSet<String> obstaclesSet = new HashSet<>();
for (int obstaclesCount = 0; obstaclesCount < obstacles.length; obstaclesCount++) {
if(obstacles[obstaclesCount][0]>x || obstacles[obstaclesCount][1]>y) {
continue;
}
int minSize;
if(rightStep == 0) {
minSize = obstacles[obstaclesCount][1] / command.length();
} else if(rightStep == command.length()) {
minSize = obstacles[obstaclesCount][0] / rightStep;
} else {
minSize = Math.min(obstacles[obstaclesCount][0] / rightStep, obstacles[obstaclesCount][1] / (command.length() - rightStep));
}
obstaclesSet.add(new StringBuilder().append(obstacles[obstaclesCount][0] - minSize * rightStep)
.append(",")
.append(obstacles[obstaclesCount][1] - minSize * (command.length() - rightStep)).toString());
}
return obstaclesSet;
}
}
| [
"jiangck@163.com"
] | jiangck@163.com |
03dba48abb27af93e2bd4f11e51262abe1d907ad | 6557af1d20c8c1ba5c23261142a423b0b196efdf | /src/br/todolist/manager/AdicionarUsuarioLogica.java | f5e6ae13e6c9b24f6bab6fcdeb544a7e5f2e3dfb | [] | no_license | robsonprod/actionBtodolist | b640dca5d17a1885c0438c7aad3cbe5ae4723d2c | 142bc1239b74e9a132bc0ab4fcea51bc30a446de | refs/heads/master | 2021-05-05T17:49:04.229606 | 2018-01-31T17:50:21 | 2018-01-31T17:50:21 | 103,480,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,341 | java | package br.todolist.manager;
import java.sql.Connection;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import br.todolist.dao.UsuarioDao;
import br.todolist.model.Logica;
import br.todolist.model.Usuario;
public class AdicionarUsuarioLogica implements Logica{
@Override
public boolean executa(HttpServletRequest request, HttpServletResponse response) throws Exception {
String nomeLogin = request.getParameter("nomeLogin");
String senha = request.getParameter("senha");
String cargo = request.getParameter("cargo");
Connection connect = (Connection) request.getAttribute("connect");
UsuarioDao dao = new UsuarioDao(connect);
Usuario usuario = new Usuario();
usuario.setNomeLogin(nomeLogin);
usuario.setSenha(senha);
usuario.setCargo(new Integer(cargo));
if(possuiNomeSenha(usuario)) {
dao.adiciona(usuario);
request.setAttribute("msgUsuario", "Usuario cadastrado com sucesso");
RequestDispatcher rd = request.getRequestDispatcher("/pages/index.jsp");
rd.forward(request, response);
}
return true;
}
public boolean possuiNomeSenha(Usuario usuario) {
return usuario.getNomeLogin() != null || usuario.getNomeLogin().isEmpty() && usuario.getSenha() != null || usuario.getSenha().isEmpty();
}
}
| [
"rbsazevedo@gmail.com"
] | rbsazevedo@gmail.com |
63c2cc646968258d0e1c649cc045531cc24e4344 | a84ff7367347c5b2d26050bd59c685b0cccfdfa8 | /v5/src/tp/pr5/mv/gui/ActionsPanel.java | 3cfcc9a079ba07a5371d4813ed7f76a5eee025ba | [
"MIT"
] | permissive | davbolan/Maquina-Virtual | 70738a5df39425bc6e5ca57e666ca35d45b5980e | a82602d73a0e99b58657cf14c6182d850319c62c | refs/heads/master | 2021-01-13T08:28:33.074835 | 2016-11-18T17:19:22 | 2016-11-18T17:19:22 | 71,844,188 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,615 | java | package tp.pr5.mv.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.border.TitledBorder;
import tp.pr5.mv.Controller;
import tp.pr5.mv.observables.CPUObserver;
/**
* Clase que representa el panel de los botones de la parte superior de la interfaz
* @author Lidia Flores, David Bolanios
*/
@SuppressWarnings("serial")
public class ActionsPanel extends JPanel implements CPUObserver{
private JButton stepButton;
private JButton runButton;
private JButton exitButton;
private JButton pauseButton;
private JButton resetButton;
private JButton undoButton;
private Controller controller;
/**
* Construye un panel de botones
* @param controller el controlador
*/
public ActionsPanel(Controller controller) {
this.controller = controller;
this.controller.registerCPUObserver(this);
initActionsPanel();
}
/**
* Inicializa el panel de los botones
*/
private void initActionsPanel() {
this.setLayout(new BorderLayout());
this.setBorder(new TitledBorder("Acciones"));
initButtons();
}
/**
* Inicializa los botones
*/
private void initButtons() {
JPanel buttonsPanel = new JPanel();
//BOTONES
stepButton = new JButton();
stepButton.setName("ButtonStep");
stepButton.setIcon(new ImageIcon(getClass().getResource("Icons/step.png")));
runButton = new JButton();
runButton.setName("ButtonRun");
runButton.setIcon(new ImageIcon(getClass().getResource("Icons/run.png")));
pauseButton = new JButton();
pauseButton.setName("ButtonPause");
pauseButton.setIcon(new ImageIcon(getClass().getResource("Icons/pause.png")));
pauseButton.setEnabled(false);
resetButton = new JButton();
resetButton.setName("ButtonReset");
resetButton.setIcon(new ImageIcon(getClass().getResource("Icons/reset.png")));
undoButton = new JButton();
undoButton.setName("ButtonUndo");
undoButton.setIcon(new ImageIcon(getClass().getResource("Icons/undo1.png")));
exitButton = new JButton();
exitButton.setName("ButtonExit");
exitButton.setIcon(new ImageIcon(getClass().getResource("Icons/exit.png")));
// AÑADIMOS BOTONES
buttonsPanel.add(stepButton);
buttonsPanel.add(runButton);
buttonsPanel.add(pauseButton);
buttonsPanel.add(resetButton);
buttonsPanel.add(undoButton);
buttonsPanel.add(exitButton);
buttonsPanel.setOpaque(false);
this.add(buttonsPanel, BorderLayout.CENTER);
this.setVisible(true);
fixButtons();
}
/**
* Fija los actionListener de cada boton
*/
private void fixButtons(){
fixStepButton();
fixRunButton();
fixPauseButton();
fixResetButton();
fixQuitButton();
}
/**
* Fija el actionListener del botón STEP
*/
private void fixStepButton() {
stepButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
controller.executeStepCommand();
}
});
}
/**
* Fija el actionListener del botón RUN
*/
private void fixRunButton() {
runButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
new Thread() {
public void run() {
controller.executeRunCommand();
}
}.start();
}
});
}
/**
* Fija el actionListener del botón PAUSE
*/
private void fixPauseButton() {
pauseButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
controller.executePauseCommand();
}
});
}
/**
* Fija el actionListener del botón RESET
*/
private void fixResetButton() {
resetButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
controller.executeResetCommand();
}
});
}
/**
* Fija el actionListener del botón QUIT
*/
private void fixQuitButton() {
exitButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0){
optionExit();
}
});
}
/**
* Muestra una ventana de dialogo preguntando al usuario si quiere salir. Si es asi, se guardan los datos
* y la máquina virtual se cierra.
*/
protected void optionExit() {
int option = JOptionPane.showOptionDialog(null,"¿Quieres salir?", "Exit", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);
if(option == JOptionPane.YES_OPTION){
controller.executeQuitCommand();
System.exit(0);
}
}
/**
* Reactiva los botones correspondientes en caso de error.
*/
@Override
public void raiseError(String message) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
stepButton.setEnabled(true);
runButton.setEnabled(true);
pauseButton.setEnabled(false);
resetButton.setEnabled(true);
}
});
}
/**
* Desactiva los botones correspondientes cuando la CPU finalizado
*/
@Override
public void programEnd(boolean end) {
if(end){
SwingUtilities.invokeLater(new Runnable() {
public void run() {
stepButton.setEnabled(false);
runButton.setEnabled(false);
pauseButton.setEnabled(false);
resetButton.setEnabled(true);
}
});
}
}
/**
* Reactiva los botones correspondientes cuando la CPU ha sido parada
*/
@Override
public void machineStopped() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
stepButton.setEnabled(true);
runButton.setEnabled(true);
pauseButton.setEnabled(false);
resetButton.setEnabled(true);
}
});
}
/**
* Desacctiva los botones correspondientes cuando la CPU empieza a ejecutarse
*/
@Override
public void machineStarted() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
stepButton.setEnabled(false);
runButton.setEnabled(false);
resetButton.setEnabled(false);
pauseButton.setEnabled(true);
}
});
}
/**
* Reactiva los botones correspondientes cuando la CPU ha sido reseteada
*/
@Override
public void onReset() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
stepButton.setEnabled(true);
runButton.setEnabled(true);
pauseButton.setEnabled(false);
}
});
}
/**
* Cambia la fuente de los componentes
* @param font La nueva fuente
* @param i
*/
public void changeColor(Color color) {
this.setBackground(color);
}
@Override
public void requestQuit() {
}
@Override
public void showCPUState(String string) {
}
@Override
public void instructionStarting(String msg) {
}
}
| [
"davidbc930@gmail.com"
] | davidbc930@gmail.com |
7deef3fa34c8fc92ec23c92be299221a026b2609 | da4fa29c53005d3c5ed0be2a849900e293820e58 | /src/main/java/com/bestjlb/demo/config/MySqlJpaConfig.java | 0f108c1c9a2ec11edb4c104ce9a4051f70e18d97 | [] | no_license | yydx811/spring-boot-demo | d15b65b81f69a7b86dbb0317ade053b4184fd2f1 | 4639274684effd7a287d0c5593e91a1885feae19 | refs/heads/master | 2021-05-06T10:20:25.214256 | 2017-12-13T12:36:36 | 2017-12-13T12:36:36 | 114,117,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,747 | java | package com.bestjlb.demo.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
/**
* Created by yydx811 on 2017/10/26.
*/
@Configuration
@EnableJpaRepositories("com.bestjlb.demo.repository")
@EnableTransactionManagement
public class MySqlJpaConfig {
@Autowired
private Environment env;
@Bean
public DataSource dataSource() {
final DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriverClassName(env.getProperty("demo.mysql.driver", "com.mysql.jdbc.Driver"));
dataSource.setUrl(env.getProperty("demo.mysql.url", "jdbc:mysql://10.10.10.10:3306/jlb-server?useSSL=false"));
dataSource.setUsername(env.getProperty("demo.mysql.username", "jlb-test"));
dataSource.setPassword(env.getProperty("demo.mysql.password", "jlb-test-123"));
dataSource.setMaxActive(200);
dataSource.setInitialSize(10);
dataSource.setMinIdle(10);
dataSource.setMaxWait(60 * 1000L);
return dataSource;
}
@Bean
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setDatabase(Database.MYSQL);
vendorAdapter.setGenerateDdl(false);
vendorAdapter.setShowSql(false);
vendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQL5Dialect");
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setDataSource(dataSource());
factory.setPackagesToScan("com.bestjlb.demo.meta");
factory.setJpaVendorAdapter(vendorAdapter);
factory.afterPropertiesSet();
return factory.getObject();
}
@Bean
public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) {
final JpaTransactionManager txManager = new JpaTransactionManager();
txManager.setEntityManagerFactory(emf);
return txManager;
}
}
| [
"yuyang@bestjlb.com"
] | yuyang@bestjlb.com |
145c8d3504580e866af57ca8d2bcfde667f7493b | 76781aad4eb51d45e9a65dd46ae005d34d01f148 | /src/main/java/com/hhg/jerry/p2p/Producer.java | aa1587451344e3af4412b81f86752a3a7e04ad68 | [] | no_license | DimLighter/activemq | 3c12cf968291e711977213e07d6701add7e7cd93 | 04c2959f05fe997a86dfb052df35901e2ef74dd7 | refs/heads/master | 2020-04-01T18:17:55.167362 | 2018-10-17T08:44:15 | 2018-10-17T08:44:15 | 153,483,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | package com.hhg.jerry.p2p;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.*;
/**
* Created by lina on 2018/10/17.
*/
public class Producer {
private static Logger logger = LoggerFactory.getLogger(Producer.class);
private static final String url = "tcp://localhost:61616";
private static final String queueName = "test-queue";
public static void main(String[] args) throws Exception{
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
Connection connection = connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
Destination destination = session.createQueue(queueName);
MessageProducer producer = session.createProducer(destination);
for(int i=0;i<50;i++){
TextMessage textMessage = session.createTextMessage("msg" + i);
producer.send(textMessage);
logger.info("product msg : {}", textMessage.getText());
}
session.commit();
connection.close();
}
}
| [
"waywaitway@163.com"
] | waywaitway@163.com |
61ebec2c6baab3cd732b5989e34a08c1df897018 | b22680a08860f643f31b4bc8197e747fd46f3280 | /ProjetoFinal/Web/Digentrega/src/dca0120/views/SairServlet.java | 1997e8254d49dbfa4ab5333280e13fba41c5f399 | [] | no_license | DenisMedeiros/Delivery-helper-app-for-Android | 210bd1362ba07bba44649a17f2cfccafbc90422b | ec77f85e52604410a41c7fb3f644c5649b46ea7f | refs/heads/master | 2021-06-08T00:42:41.809643 | 2016-12-06T06:04:00 | 2016-12-06T06:04:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,064 | java | package dca0120.views;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import dca0120.utils.TratadorURI;
public class SairServlet extends HttpServlet {
private static final long serialVersionUID = -7552123270167571493L;
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
HttpSession session = request.getSession(true);
session.setAttribute("caixa", null);
session.setAttribute("administrador", null);
session.setAttribute("entregador", null);
session.invalidate();
response.sendRedirect(TratadorURI.getRaizURL(request));
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
}
} | [
"dnsricardo@gmail.com"
] | dnsricardo@gmail.com |
cb1d76980c4d7b34806490bf231a8f5695108169 | 96c441301b4c967dc86fa09474c4df5a11bb558b | /src/main/java/com/ceit/vic/platform/models/Dep_Person.java | f7c4691f84305e24013a2262ff1bd7e09fe603b4 | [] | no_license | yoonsica/platform | 8748c7885e7ef759c8794b781ff27b2a5e9f577a | ca1ee62103e1bb2fb1424ad637543a10e8d00b64 | refs/heads/master | 2020-12-24T15:14:10.578255 | 2014-12-04T13:24:02 | 2014-12-04T13:24:02 | 17,660,090 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 749 | java | package com.ceit.vic.platform.models;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Table
@Entity
public class Dep_Person {
@Id
private int id;
private int depId;
private int personId;
private int mainDep;//是否是主部门 0--兼职部门 1--主部门
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getDepId() {
return depId;
}
public void setDepId(int depId) {
this.depId = depId;
}
public int getPersonId() {
return personId;
}
public void setPersonId(int personId) {
this.personId = personId;
}
public int getMainDep() {
return mainDep;
}
public void setMainDep(int mainDep) {
this.mainDep = mainDep;
}
}
| [
"Administrator@CEIT-PC"
] | Administrator@CEIT-PC |
04dae2c43bbff9c2c705270f2ab888e482dffbe4 | 7f8655f028d5d8b648b26ff7e9b86af7ab8feeb1 | /Uhrzeit/src/GUI/GUI.java | e7edd655ff8b122c6decfc5c88acc1795f19cd2f | [] | no_license | zecosc16/Uhrzeit | 11dee706c54e6da1296b8932355095efd48848b0 | 54ac5885a33f1c0e83ae9cd7526b93174e9d4f95 | refs/heads/master | 2020-05-02T18:47:06.732039 | 2019-03-28T06:29:02 | 2019-03-28T06:29:02 | 178,139,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,280 | 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 GUI;
import GUI.DlgClock;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.time.LocalTime;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import uhrzeit.Clock;
/**
*
* @author oskar
*/
public class GUI extends javax.swing.JFrame {
/**
* Creates new form GUI
*/
public GUI() {
initComponents();
this.setSize(1000, 1000);
this.setTitle("click on empty space to create new clock");
Clock c = new Clock(LocalTime.now());
JLabel l = new JLabel("Lokale Zeit");
l.setFont(new Font("Tahoma", Font.PLAIN, 60));
l.setForeground(Color.white);
p1.add(l);
p1.add(c);
new Thread(c).start();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
p1 = new javax.swing.JPanel();
p2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
p3 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
formComponentResized(evt);
}
});
addWindowStateListener(new java.awt.event.WindowStateListener() {
public void windowStateChanged(java.awt.event.WindowEvent evt) {
formWindowStateChanged(evt);
}
});
getContentPane().setLayout(new java.awt.GridLayout(3, 0));
p1.setBackground(new java.awt.Color(0, 0, 0));
p1.setForeground(new java.awt.Color(255, 255, 255));
p1.setLayout(new java.awt.GridLayout(1, 2));
getContentPane().add(p1);
p2.setBackground(new java.awt.Color(0, 0, 0));
p2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
p2MouseClicked(evt);
}
});
p2.setLayout(new java.awt.GridLayout(1, 2));
jLabel1.setText("jLabel1");
p2.add(jLabel1);
getContentPane().add(p2);
p3.setBackground(new java.awt.Color(0, 0, 0));
p3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
p3MouseClicked(evt);
}
});
p3.setLayout(new java.awt.GridLayout(1, 2));
getContentPane().add(p3);
pack();
}// </editor-fold>//GEN-END:initComponents
private void p2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_p2MouseClicked
this.newClock(p2);
}//GEN-LAST:event_p2MouseClicked
private void p3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_p3MouseClicked
this.newClock(p3);
}//GEN-LAST:event_p3MouseClicked
private void formWindowStateChanged(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowStateChanged
}//GEN-LAST:event_formWindowStateChanged
private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
// TODO add your handling code here:
}//GEN-LAST:event_formComponentResized
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GUI().setVisible(true);
}
});
}
public void newClock(JPanel p) {
p.removeAll();
DlgClock d = new DlgClock(null, true);
d.setVisible(true);
if (d.isOk()) {
JLabel l = new JLabel(d.getCity());
l.setFont(new Font("Tahoma", Font.PLAIN, 60));
l.setForeground(Color.white);
p.add(l);
Clock c = d.getClock();
p.add(c);
new Thread(c).start();
this.validate();
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel p1;
private javax.swing.JPanel p2;
private javax.swing.JPanel p3;
// End of variables declaration//GEN-END:variables
}
| [
"zecosc16@htlkaindorf.at"
] | zecosc16@htlkaindorf.at |
415319deec5ca5ae6fdc297fcacda9ed74060358 | 330d41a4ce8fe37676d08ed3acaea757f037a0f5 | /Lab010/src/RegistrationServlet.java | e9c3d7fa22c4f61ff33e09814ad5866cba34c224 | [] | no_license | DenisStolyarov/Java | 99dd170a67b21b4d7a8a1c3ac438634c03c1990b | dc3d86818cade2bfb8307d063742354a533e6c8d | refs/heads/master | 2021-01-04T09:50:38.672044 | 2020-06-08T16:07:17 | 2020-06-08T16:07:17 | 240,495,836 | 0 | 0 | null | 2020-10-13T22:39:13 | 2020-02-14T11:43:28 | Java | UTF-8 | Java | false | false | 1,330 | java | import DAO.IDAO;
import DAO.MySQLDAO;
import DAO.User;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
public class RegistrationServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
IDAO database = null;
ArrayList<User> users = null;
String log = "";
try {
log = request.getParameter("login");
String pass = request.getParameter("password");
database = new MySQLDAO();
database.InsertUser(log,pass);
}
catch (SQLException e) {
e.printStackTrace();
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
response.addCookie(new Cookie("Login", log));
getServletContext().getRequestDispatcher("/TourList.jsp").forward(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
| [
"you@example.com"
] | you@example.com |
bc485cd78bbd5a1b526f08f1bfd24733e7d80ad8 | 06a5377c306b5d1f91d133e37956628439b54106 | /fx03_scene/src/ex02/MainClass.java | b51b68e6fa862a5548531b48c3eff218d1a9c5d8 | [] | no_license | woojin97318/javafx_basic | b9c8863ce6f9d36c536df14725f176a117e311ee | 7efa3f497f734565c0014fa4c0e72c82987a824a | refs/heads/master | 2023-08-18T02:59:30.509149 | 2021-09-14T06:13:28 | 2021-09-14T06:13:28 | 401,231,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package ex02;
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MainClass extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("eventTest.fxml"));
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
| [
"woojin97318@naver.com"
] | woojin97318@naver.com |
2d3f834056634b989b16e345edfa917a781b5e7b | 30b86c7a3fe6513a8003b5157dffd1f5dda08b38 | /core/src/main/java/org/openstack4j/model/network/ext/LoadBalancerV2.java | c39b44bb046792ed2fb3cdc82f4db163403a9d41 | [
"Apache-2.0"
] | permissive | tanjin861117/openstack4j | c098a25529398855a1391f4d51fc28b687cb8cb6 | b58da68654fc7570a3aee3f1eabdf9aef499a607 | refs/heads/master | 2020-04-06T17:29:04.079837 | 2018-11-13T13:17:20 | 2018-11-13T13:17:20 | 157,660,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,154 | java | package org.openstack4j.model.network.ext;
import org.openstack4j.common.Buildable;
import org.openstack4j.model.ModelEntity;
import org.openstack4j.model.network.ext.builder.LoadBalancerV2Builder;
import org.openstack4j.openstack.networking.domain.ext.ListItem;
import java.util.List;
/**
* An entity used to update an lbaas v2 loadbalancer
* @author emjburns
*/
public interface LoadBalancerV2 extends ModelEntity, Buildable<LoadBalancerV2Builder> {
/**
* @return id. The unique ID for the loadbalancer.
*/
String getId();
/**
* @return tenantId.
* Owner of the loadbalancer. Only an administrative user can specify a tenant ID other than its own.
*/
String getTenantId();
/**
* @return loadbalancer name. Does not have to be unique.
*/
String getName();
/**
* @return Description for the loadbalancer.
*/
String getDescription();
/**
* @return The vip subnet id of the loadbalancer.
*/
String getVipSubnetId();
/**
* @return The vip address of the loadbalancer.
*/
String getVipAddress();
/***
* @return the vip port id of the loadbalancer
*/
String getVipPortId();
/**
* @return The administrative state of the loadbalancer, which is up (true) or
* down (false).
*/
boolean isAdminStateUp();
/**
* @return The listeners of the loadbalancer.
*/
List<ListItem> getListeners();
/**
* @return provisioningStatus.The provisioning status of the loadbalancer. Indicates whether the
* loadbalancer is provisioning.
* Either ACTIVE, PENDING_CREATE or ERROR.
*/
LbProvisioningStatus getProvisioningStatus();
/**
* @return operatingStatus.The operating status of the loadbalancer. Indicates whether the
* loadbalancer is operational.
*/
LbOperatingStatus getOperatingStatus();
/**
* Retrieve provider the load balancer is provisioned with
* @return provider
*/
String getProvider();
}
| [
"tanjin@szzt.com.cn"
] | tanjin@szzt.com.cn |
9b1ceaaab697fad4c68e94934b39ac981e4ab3f0 | 5e52662ad9b612036529a887712ae15c634f8bda | /BalanaPDPInterface/src/main/java/IntentConflict/SampleAttributeFinderModule.java | a5fe1faadcbc8671436cd9296dd9fce7dbe1d1ef | [
"Apache-2.0"
] | permissive | JiniLee/XACML-Server | 3f5c09d02b5d8319c08762af42ea8057fa9a21df | e58c30092adaaf5d3e783d474c8714ea44d9b45c | refs/heads/master | 2020-12-03T00:40:15.489058 | 2017-07-12T08:18:59 | 2017-07-12T08:18:59 | 96,058,936 | 1 | 0 | null | 2017-07-12T08:19:00 | 2017-07-03T01:25:04 | Java | UHC | Java | false | false | 4,195 | java | /*
* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package IntentConflict;
import org.wso2.balana.attr.AttributeValue;
import org.wso2.balana.attr.BagAttribute;
import org.wso2.balana.attr.StringAttribute;
import org.wso2.balana.cond.EvaluationResult;
import org.wso2.balana.ctx.EvaluationCtx;
import org.wso2.balana.finder.AttributeFinderModule;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Sample attribute finder module. Actually this must be the point that calls to K-Market user store
* and retrieve the customer attributes. But here we are not talking any user store and values has
* been hard corded in the source.
*/
public class SampleAttributeFinderModule extends AttributeFinderModule{
private URI defaultSubjectId;
public SampleAttributeFinderModule() {
try {
defaultSubjectId = new URI("urn:oasis:names:tc:xacml:1.0:subject:subject-id");
} catch (URISyntaxException e) {
//ignore
}
}
@Override
public Set<String> getSupportedCategories() {
Set<String> categories = new HashSet<String>();
categories.add("urn:oasis:names:tc:xacml:1.0:subject-category:access-subject");
return categories;
}
@Override
public Set<String> getSupportedIds() {
Set<String> ids = new HashSet<String>();
ids.add("http://selab.hanayng.ac.kr/id/role");
return ids;
}
@Override
public EvaluationResult findAttribute(URI attributeType, URI attributeId, String issuer,
URI category, EvaluationCtx context) {
// System.out.println();
// System.out.println("attributeType: "+attributeType.toString());
// System.out.println("attributeId: "+attributeId.toString());
// System.out.println("issuer: "+issuer);
// System.out.println("category: "+category);
String roleName = null;
List<AttributeValue> attributeValues = new ArrayList<AttributeValue>();
EvaluationResult result = context.getAttribute(attributeType, defaultSubjectId, issuer, category);
if(result != null && result.getAttributeValue() != null && result.getAttributeValue().isBag()){
BagAttribute bagAttribute = (BagAttribute) result.getAttributeValue();
if(bagAttribute.size() > 0){
String userName = ((AttributeValue) bagAttribute.iterator().next()).encode();
// System.out.println("userName: "+userName);
roleName = findRole(userName);
}
}
if (roleName != null) {
//아들 bob은 가족이면서도, father, mother, son, daughter이라는 두개의 역할을 가질 수 있다.
attributeValues.add(new StringAttribute("family"));
attributeValues.add(new StringAttribute(roleName));
}
return new EvaluationResult(new BagAttribute(attributeType, attributeValues));
}
@Override
public boolean isDesignatorSupported() {
return true;
}
private String findRole(String userName){
//father: fred, mother: monica, son: sam, daughter: diana
if(userName.equals("fred")){
return "father";
} else if(userName.equals("monica")){
return "mother";
} else if(userName.equals("sam")){
return "son";
} else if(userName.equals("diana")){
return "daughter";
}
return null;
}
}
| [
"frebern@naver.com"
] | frebern@naver.com |
07e863301ed5053d20f87551e341167395f94116 | 568467945c02aad231d8060c2c2f45d0262918be | /gateway/src/main/java/com/qa/gate/GatewayApplication.java | 906ffad2050f4daefbc75022fcf1d61443694b65 | [] | no_license | JHarry444/Spring-Microservices | 09b35d1f66774d6513b4d3ff644e288b5233d2b8 | af64e0ea1d69ff2219da232bdd32895188cf48e0 | refs/heads/master | 2022-11-20T12:16:28.199260 | 2020-07-27T14:53:02 | 2020-07-27T14:53:02 | 282,928,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.qa.gate;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@SpringBootApplication
@EnableWebMvc
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
}
| [
"jordan.harrison@qa.com"
] | jordan.harrison@qa.com |
dee6adc0c7569e53f1ca7ccd4293fcf99cf835a7 | ff90aedaff2b3adab50e68b2f3eef3a74f3f2b0d | /src/com/google/android/gms/auth/api/signin/zaa.java | f9a7874dfa195719b6e2e1cb43d416732699406f | [] | no_license | rrabit42/Malware_Project_EWHA | cf81ab0d6cdc64cf0fb722e9427f7307da3689ab | 3865c1c393a9873915ec07389afb799573d5d135 | refs/heads/master | 2020-11-24T06:42:17.435890 | 2019-12-16T20:48:04 | 2019-12-16T20:48:04 | 228,010,763 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package com.google.android.gms.auth.api.signin;
import com.google.android.gms.common.api.Scope;
import java.util.Comparator;
| [
"gegiraffe@gmail.com"
] | gegiraffe@gmail.com |
55bad46368107b8d52a9ea373bbf4aa02f299acb | 17e0ef4c6d364b0636be577e6ddff6eb794e73aa | /app/build/generated/source/apt/debug/com/example/kelly/cloudmedia/databinding/ActivityMovieDetailBinding.java | f5cda588c8c0c30fb7c6ecfcf14f508d876a9b2d | [
"Apache-2.0"
] | permissive | zongkaili/CloudMedia | e6d29f7dca6b0cc3321f317db816c18ffc23b6bf | 8380ab96856d593d9b9751e06733c62d7aa11514 | refs/heads/master | 2021-01-12T03:18:21.983039 | 2017-01-06T08:13:29 | 2017-01-06T08:13:29 | 78,187,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,466 | java | package com.example.kelly.cloudmedia.databinding;
import com.example.kelly.cloudmedia.R;
import com.example.kelly.cloudmedia.BR;
import android.view.View;
public class ActivityMovieDetailBinding extends android.databinding.ViewDataBinding {
private static final android.databinding.ViewDataBinding.IncludedLayouts sIncludes;
private static final android.util.SparseIntArray sViewsWithIds;
static {
sIncludes = new android.databinding.ViewDataBinding.IncludedLayouts(10);
sIncludes.setIncludes(1,
new String[] {"header_slide_shape"},
new int[] {4},
new int[] {R.layout.header_slide_shape});
sViewsWithIds = new android.util.SparseIntArray();
sViewsWithIds.put(R.id.nsv_scrollview, 5);
sViewsWithIds.put(R.id.xrv_cast, 6);
sViewsWithIds.put(R.id.rl_title_head, 7);
sViewsWithIds.put(R.id.iv_title_head_bg, 8);
sViewsWithIds.put(R.id.title_tool_bar, 9);
}
// views
public final com.example.kelly.cloudmedia.databinding.HeaderSlideShapeBinding include;
public final android.widget.ImageView ivTitleHeadBg;
public final android.widget.LinearLayout llHeaderView;
private final android.widget.FrameLayout mboundView0;
private final android.widget.TextView mboundView3;
public final com.example.kelly.cloudmedia.view.MyNestedScrollView nsvScrollview;
public final android.widget.RelativeLayout rlTitleHead;
public final android.support.v7.widget.Toolbar titleToolBar;
public final android.widget.TextView tvOneTitle;
public final com.example.xrecyclerview.XRecyclerView xrvCast;
// variables
private com.example.kelly.cloudmedia.bean.MovieDetailBean mMovieDetailBean;
// values
// listeners
// Inverse Binding Event Handlers
public ActivityMovieDetailBinding(android.databinding.DataBindingComponent bindingComponent, View root) {
super(bindingComponent, root, 3);
final Object[] bindings = mapBindings(bindingComponent, root, 10, sIncludes, sViewsWithIds);
this.include = (com.example.kelly.cloudmedia.databinding.HeaderSlideShapeBinding) bindings[4];
this.ivTitleHeadBg = (android.widget.ImageView) bindings[8];
this.llHeaderView = (android.widget.LinearLayout) bindings[1];
this.llHeaderView.setTag(null);
this.mboundView0 = (android.widget.FrameLayout) bindings[0];
this.mboundView0.setTag(null);
this.mboundView3 = (android.widget.TextView) bindings[3];
this.mboundView3.setTag(null);
this.nsvScrollview = (com.example.kelly.cloudmedia.view.MyNestedScrollView) bindings[5];
this.rlTitleHead = (android.widget.RelativeLayout) bindings[7];
this.titleToolBar = (android.support.v7.widget.Toolbar) bindings[9];
this.tvOneTitle = (android.widget.TextView) bindings[2];
this.tvOneTitle.setTag(null);
this.xrvCast = (com.example.xrecyclerview.XRecyclerView) bindings[6];
setRootTag(root);
// listeners
invalidateAll();
}
@Override
public void invalidateAll() {
synchronized(this) {
mDirtyFlags = 0x20L;
}
include.invalidateAll();
requestRebind();
}
@Override
public boolean hasPendingBindings() {
synchronized(this) {
if (mDirtyFlags != 0) {
return true;
}
}
if (include.hasPendingBindings()) {
return true;
}
return false;
}
public boolean setVariable(int variableId, Object variable) {
switch(variableId) {
case BR.movieDetailBean :
setMovieDetailBean((com.example.kelly.cloudmedia.bean.MovieDetailBean) variable);
return true;
case BR.subjectsBean :
return true;
}
return false;
}
public void setSubjectsBean(com.example.kelly.cloudmedia.bean.moviechild.SubjectsBean subjectsBean) {
// not used, ignore
}
public com.example.kelly.cloudmedia.bean.moviechild.SubjectsBean getSubjectsBean() {
return null;
}
public void setMovieDetailBean(com.example.kelly.cloudmedia.bean.MovieDetailBean movieDetailBean) {
updateRegistration(1, movieDetailBean);
this.mMovieDetailBean = movieDetailBean;
synchronized(this) {
mDirtyFlags |= 0x2L;
}
notifyPropertyChanged(BR.movieDetailBean);
super.requestRebind();
}
public com.example.kelly.cloudmedia.bean.MovieDetailBean getMovieDetailBean() {
return mMovieDetailBean;
}
@Override
protected boolean onFieldChange(int localFieldId, Object object, int fieldId) {
switch (localFieldId) {
case 0 :
return onChangeSubjectsBean((com.example.kelly.cloudmedia.bean.moviechild.SubjectsBean) object, fieldId);
case 1 :
return onChangeMovieDetailB((com.example.kelly.cloudmedia.bean.MovieDetailBean) object, fieldId);
case 2 :
return onChangeInclude((com.example.kelly.cloudmedia.databinding.HeaderSlideShapeBinding) object, fieldId);
}
return false;
}
private boolean onChangeSubjectsBean(com.example.kelly.cloudmedia.bean.moviechild.SubjectsBean subjectsBean, int fieldId) {
switch (fieldId) {
case BR._all: {
synchronized(this) {
mDirtyFlags |= 0x1L;
}
return true;
}
}
return false;
}
private boolean onChangeMovieDetailB(com.example.kelly.cloudmedia.bean.MovieDetailBean movieDetailBean, int fieldId) {
switch (fieldId) {
case BR.aka: {
synchronized(this) {
mDirtyFlags |= 0x8L;
}
return true;
}
case BR.summary: {
synchronized(this) {
mDirtyFlags |= 0x10L;
}
return true;
}
case BR._all: {
synchronized(this) {
mDirtyFlags |= 0x2L;
}
return true;
}
}
return false;
}
private boolean onChangeInclude(com.example.kelly.cloudmedia.databinding.HeaderSlideShapeBinding include, int fieldId) {
switch (fieldId) {
case BR._all: {
synchronized(this) {
mDirtyFlags |= 0x4L;
}
return true;
}
}
return false;
}
@Override
protected void executeBindings() {
long dirtyFlags = 0;
synchronized(this) {
dirtyFlags = mDirtyFlags;
mDirtyFlags = 0;
}
java.lang.String summaryMovieDetailBe = null;
com.example.kelly.cloudmedia.bean.MovieDetailBean movieDetailBean = mMovieDetailBean;
java.util.List<java.lang.String> akaMovieDetailBean = null;
java.lang.String stringFormatUtilForm = null;
if ((dirtyFlags & 0x3aL) != 0) {
if ((dirtyFlags & 0x32L) != 0) {
if (movieDetailBean != null) {
// read movieDetailBean.summary
summaryMovieDetailBe = movieDetailBean.getSummary();
}
}
if ((dirtyFlags & 0x2aL) != 0) {
if (movieDetailBean != null) {
// read movieDetailBean.aka
akaMovieDetailBean = movieDetailBean.getAka();
}
// read StringFormatUtil.formatGenres(movieDetailBean.aka)
stringFormatUtilForm = com.example.kelly.cloudmedia.utils.StringFormatUtil.formatGenres(akaMovieDetailBean);
}
}
// batch finished
if ((dirtyFlags & 0x32L) != 0) {
// api target 1
android.databinding.adapters.TextViewBindingAdapter.setText(this.mboundView3, summaryMovieDetailBe);
}
if ((dirtyFlags & 0x2aL) != 0) {
// api target 1
android.databinding.adapters.TextViewBindingAdapter.setText(this.tvOneTitle, stringFormatUtilForm);
}
include.executePendingBindings();
}
// Listener Stub Implementations
// callback impls
// dirty flag
private long mDirtyFlags = 0xffffffffffffffffL;
public static ActivityMovieDetailBinding inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot) {
return inflate(inflater, root, attachToRoot, android.databinding.DataBindingUtil.getDefaultComponent());
}
public static ActivityMovieDetailBinding inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot, android.databinding.DataBindingComponent bindingComponent) {
return android.databinding.DataBindingUtil.<ActivityMovieDetailBinding>inflate(inflater, com.example.kelly.cloudmedia.R.layout.activity_movie_detail, root, attachToRoot, bindingComponent);
}
public static ActivityMovieDetailBinding inflate(android.view.LayoutInflater inflater) {
return inflate(inflater, android.databinding.DataBindingUtil.getDefaultComponent());
}
public static ActivityMovieDetailBinding inflate(android.view.LayoutInflater inflater, android.databinding.DataBindingComponent bindingComponent) {
return bind(inflater.inflate(com.example.kelly.cloudmedia.R.layout.activity_movie_detail, null, false), bindingComponent);
}
public static ActivityMovieDetailBinding bind(android.view.View view) {
return bind(view, android.databinding.DataBindingUtil.getDefaultComponent());
}
public static ActivityMovieDetailBinding bind(android.view.View view, android.databinding.DataBindingComponent bindingComponent) {
if (!"layout/activity_movie_detail_0".equals(view.getTag())) {
throw new RuntimeException("view tag isn't correct on view:" + view.getTag());
}
return new ActivityMovieDetailBinding(bindingComponent, view);
}
/* flag mapping
flag 0 (0x1L): subjectsBean
flag 1 (0x2L): movieDetailBean
flag 2 (0x3L): include
flag 3 (0x4L): movieDetailBean.aka
flag 4 (0x5L): movieDetailBean.summary
flag 5 (0x6L): null
flag mapping end*/
//end
} | [
"15868178140@163.com"
] | 15868178140@163.com |
da80bc32884e6bad4474d905010395d088657e07 | f59f9a03eaf296faa8fad67380e5c90958dbe3cf | /src/main/java/com/whg/ijvm/ch09/heap/constant/ClassRef.java | 304b83085a41b563528375ba84be678e34080e88 | [] | no_license | whg333/ijvm | 479b1ee2328c6b8c663e668b2c38c8423dbb8596 | 28c4b60beaa7412cec59e210e40c366b74aaa939 | refs/heads/master | 2022-06-26T07:47:10.357161 | 2022-05-16T12:25:32 | 2022-05-16T12:25:32 | 208,620,194 | 3 | 2 | null | 2022-06-17T03:37:40 | 2019-09-15T16:09:24 | Java | UTF-8 | Java | false | false | 325 | java | package com.whg.ijvm.ch09.heap.constant;
import com.whg.ijvm.ch09.classfile.constantinfo.member.ClassInfo;
import com.whg.ijvm.ch09.heap.RConstantPool;
public class ClassRef extends SymRef{
public ClassRef(RConstantPool cp, ClassInfo classInfo){
this.cp = cp;
className = classInfo.getName();
}
}
| [
"wanghonggang@hulai.com"
] | wanghonggang@hulai.com |
cc60269abce0bb53fa3f9fbb147270b7a7b005de | 3650c30d9bd86ac78715bc0c8dfb965ef1f34c32 | /jxlvudp/src/main/com/kesun/controller/web/impl/SchoolController.java | 24c4a1cea1bac32fb7c7b325e889300b69e66ace | [] | no_license | Delete502/test1-1 | 5d1a18658433d3dc0223929f88df70f332d48722 | 0f40b8e7d5676710ed188617d1ceb3ee9d7d8ad7 | refs/heads/master | 2020-03-18T11:39:09.998029 | 2018-05-21T12:39:14 | 2018-05-21T12:39:14 | 134,683,714 | 1 | 0 | null | 2018-05-24T08:15:48 | 2018-05-24T08:15:48 | null | UTF-8 | Java | false | false | 1,464 | java | package kesun.controller.web.impl;
import kesun.bll.SuperService;
import kesun.bll.web.impl.SchoolServiceImpl;
import kesun.bll.web.impl.TestServiceImpl;
import kesun.controller.SuperController;
import kesun.util.JSONAndObject;
import org.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
* @Auther 张丽
* @Date 2018/4/25 15:17
* version 1.0.0
*/
@Controller
@RequestMapping("school")
public class SchoolController extends SuperController{
@Resource(name = "bSchool")
private SchoolServiceImpl bll;
public SuperService getService() {
return bll;
}
@RequestMapping("/index")
public String index(){
return "web/school/schoolManage";
}
public Map<String, Object> getConditionParam(JSONObject param) {
if (param==null) return null;//判断条件是否为空param是页面传递的值
Map<String,Object> values=new HashMap<String, Object>();
if (JSONAndObject.GetJsonStringValue(param,"condition")!=null)
{
values.put("id", JSONAndObject.GetJsonStringValue(param,"condition"));
values.put("name",JSONAndObject.GetJsonStringValue(param,"condition"));
}
return values;
}
public Map<String, Object> setFindFilter(JSONObject param) {
return null;
}
}
| [
"1264996650@qq.com"
] | 1264996650@qq.com |
7a3486a4c64500e01b4689345f19b0bd44b7064b | 6ba5cb1945fa8e795fff6fb2795160bcbf488acc | /src/com/homlin/module/shop/dao/impl/TbShopMemberScoreLogDaoImpl.java | 024f299b46f9f11a97d867da6c471cc2f8e2866f | [] | no_license | mike841211/HomShop2 | bd6e4b94d4f49ccf8b975629afebfb2aa3363eef | 8c9bbe3e5680871f0d834e3a787a74513610b5e7 | refs/heads/master | 2020-04-28T12:42:09.862525 | 2015-02-14T07:00:46 | 2015-02-14T07:00:46 | 30,785,211 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java | package com.homlin.module.shop.dao.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.homlin.app.dao.impl.BaseDaoImpl;
import com.homlin.module.shop.dao.TbShopMemberScoreLogDao;
import com.homlin.module.shop.model.TbShopMember;
import com.homlin.module.shop.model.TbShopMemberScoreLog;
import com.homlin.utils.HqlHelper;
import com.homlin.utils.Pager;
@Repository
public class TbShopMemberScoreLogDaoImpl extends BaseDaoImpl<TbShopMemberScoreLog, String> implements TbShopMemberScoreLogDao {
@Override
public Pager getPagedList(TbShopMember queryMember, Pager pager) {
String hql = HqlHelper.selectMap("createDate,id,operator,remark,val,valtype");
hql += " from TbShopMemberScoreLog where tbShopMember=? order by createDate desc";
List<Object> queryParams = new ArrayList<Object>();
queryParams.add(queryMember);
pager.setQueryParams(queryParams.toArray());
pager.setHql(hql);
return findByPage(pager);
}
}
| [
"mike841211@163.com"
] | mike841211@163.com |
7c6b05d51a8685b641242e7c533d4de8a0089cc5 | aa435811a71fd308da4f20751c4d243c26dde672 | /rainbow.db.model/src/de/kupzog/ktable/editors/TableCellEditorDialog.java | 9da2b8ffd510856420c4659436bf834f5c23ba79 | [
"Apache-2.0"
] | permissive | jinghui70/rainbow-old | de88ec2d4c16c0edc4afbfe460eb26c580301c4a | 6193418c9ed755712bc001ea3cd3103eed4da046 | refs/heads/master | 2020-03-28T20:21:32.677644 | 2018-10-08T03:55:49 | 2018-10-08T03:55:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,809 | java | /*
* Copyright (C) 2004 by Friederich Kupzog Elektronik & Software
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
Authors: Friederich Kupzog
Lorenz Maierhofer
fkmk@kupzog.de
www.kupzog.de/fkmk
*/
package de.kupzog.ktable.editors;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import de.kupzog.ktable.KTable;
import de.kupzog.ktable.KTableCellEditor;
/**
* An abstract base implementation for a cell editor that opens a dialog.
* <p>
* Implement the methods <code>getDialog()</code> and
* <code>setupShellProperties()</code> as needed. The dialog is automatically
* opened in blocking mode. The editor is closed when the dialog is closed by
* the user.
*
* @author Lorenz Maierhofer
*/
public abstract class TableCellEditorDialog extends KTableCellEditor {
private Dialog m_Dialog;
@Override
public void open(KTable table, int col, int row, Rectangle rect) {
m_Table = table;
m_Model = table.getModel();
m_Rect = rect;
m_Row = row;
m_Col = col;
if (m_Dialog == null) {
m_Dialog = getDialog(table.getShell());
}
if (m_Dialog != null) {
m_Dialog.create();
m_Dialog.setBlockOnOpen(true);
setupShellProperties(m_Dialog.getShell());
m_Dialog.open();
}
close(false);
}
/**
* @return Returns the dialog that should be shown on editor activation.
*/
public abstract Dialog getDialog(Shell shell);
/**
* Changes the properties of the dialog shell. One could be the bounds of
* the dialog...
* <p>
* Overwrite to change the properties.
*
* @param dialogShell
* The shell of the dialog.
*/
public abstract void setupShellProperties(Shell dialogShell);
/**
* Called when the open-method returns.
*/
@Override
public void close(boolean save) {
super.close(save);
m_Dialog = null;
}
/**
* Sets the bounds of the dialog to the cell bounds. DEFAULT: Ignored. Set
* the required shell properties by overwriting the method
* <code>setupShellProperties(Shell)</code>.
*/
@Override
public void setBounds(Rectangle rect) {
// ignored.
}
/**
* Ignored.
*
* @see de.kupzog.ktable.KTableCellEditor#setContent(java.lang.String)
*/
@Override
public void setContent(Object content) {
}
/**
* Ignored, since it is no longer in use. We use a dialog instead of a
* control!
*/
@Override
protected Control createControl() {
return null;
}
}
| [
"jinghui70@foxmail.com"
] | jinghui70@foxmail.com |
cf031884bfa5850d294e2a20dd4e3af54aba9b5d | a097ae358464a886d216512ea0739157df9ef2fc | /src/ru/job4j/loop/Fitness.java | 3adff705be726dbb972108201fa9b30e36076a1c | [] | no_license | ssstre/job4j_elementary | 893c8cc0225d4f1083e3aabb7799792ed7fd800c | aad35bcc6a42cbf57fc847f2927b93c22b6af0b9 | refs/heads/master | 2022-10-15T15:52:04.368737 | 2020-06-14T16:18:53 | 2020-06-14T16:18:53 | 264,290,382 | 0 | 0 | null | 2020-05-15T20:18:36 | 2020-05-15T20:18:35 | null | UTF-8 | Java | false | false | 256 | java | package ru.job4j.loop;
public class Fitness {
public static int calc(int ivan, int nik) {
int month = 0;
while (ivan <= nik) {
ivan *= 3;
nik *= 2;
month++;
}
return month;
}
}
| [
"65305795+ssstre@users.noreply.github.com"
] | 65305795+ssstre@users.noreply.github.com |
eaaf00e288dd051e5b0fd0463ff44c3d81841ab3 | 1391e285b73912166f391a408064be452146856c | /src/main/java/com/quickcard/domain/entidades/Cronograma.java | d2fbcba32ed1a0c39c613cdd23aa35617ebfac1a | [] | no_license | Phsouza159/api-quickCard | 61d68e0404b85095027d53fa0b58e6371160bb76 | 7a3b8697cbd5f9de51447e517d635751fee2c77c | refs/heads/master | 2023-01-10T07:12:32.368929 | 2019-11-05T06:06:03 | 2019-11-05T06:06:03 | 215,459,882 | 1 | 0 | null | 2023-01-07T10:44:34 | 2019-10-16T04:53:40 | Java | UTF-8 | Java | false | false | 1,626 | java | package com.quickcard.domain.entidades;
public class Cronograma {
public Cronograma() {
}
String nome;
short[] diasSemanas;
int minutosCicloEstudos;
int minutosIntervalos;
String recompensaIntervalo;
int quantidadeCliclos;
String materias;
/*
cronogramaDia:CronogramaDia[];
*/
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public short[] getDiasSemanas() {
return diasSemanas;
}
public void setDiasSemanas(short[] diasSemanas) {
this.diasSemanas = diasSemanas;
}
public int getMinutosCicloEstudos() {
return minutosCicloEstudos;
}
public void setMinutosCicloEstudos(int minutosCicloEstudos) {
this.minutosCicloEstudos = minutosCicloEstudos;
}
public int getMinutosIntervalos() {
return minutosIntervalos;
}
public void setMinutosIntervalos(int minutosIntervalos) {
this.minutosIntervalos = minutosIntervalos;
}
public String getRecompensaIntervalo() {
return recompensaIntervalo;
}
public void setRecompensaIntervalo(String recompensaIntervalo) {
this.recompensaIntervalo = recompensaIntervalo;
}
public int getQuantidadeCliclos() {
return quantidadeCliclos;
}
public void setQuantidadeCliclos(int quantidadeCliclos) {
this.quantidadeCliclos = quantidadeCliclos;
}
public String getMaterias() {
return materias;
}
public void setMaterias(String materias) {
this.materias = materias;
}
}
| [
"pauloh159@live.com"
] | pauloh159@live.com |
59d87144b442ab7a4a065bab43b3b8a0834f519a | 04a311da056540a0784e47a4b3a92c6e77baf469 | /src/main/java/za/ca/cput/ngosa/designpatterns/structural/Proxy/RealVehicle.java | efd7d24632ae395a4562b4f4407f01aa338e751d | [] | no_license | NgosaK/assignment5 | 4ee05232c0d108723b7a3aa75af05a0652b0a487 | 3c1e1e6f5ce32a36a7046235b1144f5aed682df2 | refs/heads/master | 2020-05-18T19:43:21.856382 | 2015-09-13T21:48:46 | 2015-09-13T21:48:46 | 42,414,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package za.ca.cput.ngosa.designpatterns.structural.Proxy;
/**
* Created by User on 2015/03/13.
*/
public class RealVehicle implements Vehicles {
private String plate;
public RealVehicle(String plate)
{
this.plate=plate;
loadPlate(plate);
}
private void loadPlate(String plate)
{
System.out.println("loading "+plate);
}
@Override
public void displayPlate() {
System.out.println("Displaying: "+plate);
}
}
| [
"kangwa.ngosa@yahoo.com"
] | kangwa.ngosa@yahoo.com |
5d0818c1a2dc16d24d054bef60880626701293b8 | 477f90279e0516972a41d40b8ed9ba22f545dbb1 | /src/main/java/fr/ismania/home/utils/HomeLocation.java | aaf11d805611d7047cf10aa76d1b3e697820d9b7 | [] | no_license | IsMania/IsMania_Home | 61743092515c6e8a8e71a0c10d4a776e2f4138db | 15986590f226489026f21c5c34fe29e9dfaedd44 | refs/heads/master | 2020-03-22T11:23:17.881073 | 2018-07-06T13:09:31 | 2018-07-06T13:09:31 | 139,967,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | package fr.ismania.home.utils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
public class HomeLocation {
private Location loc;
private World world;
private String name;
public void setHomeName(String name) {
this.name = name;
}
public void setX(double x) {
this.loc.setX(x);
}
public void setY(double y) {
this.loc.setY(y);
}
public void setZ(double z) {
this.loc.setZ(z);
}
public void setWorld(String name) {
this.world = Bukkit.getWorld(name);
}
public double getX() {
return loc.getX();
}
public double getY() {
return loc.getY();
}
public double getZ() {
return loc.getZ();
}
public World getWorld() {
return world;
}
public String getHomeName() {
return name;
}
}
| [
"aymonlucas@gmail.com"
] | aymonlucas@gmail.com |
c5ab4cfac287887c4f339c0c7309a5dccc33d83c | ec243f47cbef76ce7c0eb80a1c776db2b75e47c7 | /src/shenzhenmiddleschool/Book.java | 3a0344f7566dd33c9f3b21a11fce9685f30dcf98 | [] | no_license | rainbamboooo/SMSAPP | 6509117a6b6645364f12ad518cc79d42bff97c82 | 40e3403087642a8b3e2ed41c1e18ba79cc121cd8 | refs/heads/master | 2021-05-12T15:29:21.944574 | 2018-01-12T00:13:34 | 2018-01-12T00:13:34 | 116,985,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | 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 shenzhenmiddleschool;
/**
*
* @author ted
*/
class Book {
String type;
String name;
int price;
int degree;
Book(String new_type, String new_name, int new_price, int new_degree){
this.type = new_type;
this.name = new_name;
this.price = new_price;
this.degree = new_degree;
}
int GetP(){
return this.price;
}
int GetD(){
return this.degree;
}
String GetT(){
return this.type;
}
String GetN(){
return this.name;
}
}
| [
"rainbamboo554155@hotmail.com"
] | rainbamboo554155@hotmail.com |
b1fffb28de647b5d0a45a54b7b65dc0a7f636408 | ffececfabe5ac37595bafe02883ee240b3e306cf | /QrApp/src/com/testapp/test/BizneInfoActivity.java | e2264e59d229be55e2285b7374b147aabd087366 | [] | no_license | checoalejandro/acostadev | 034423e25c944d7bd07d7d74cd3f8e50d860b7ba | d992993cc3be283b339540af05a5a6fcc78d1e92 | refs/heads/master | 2020-03-26T08:06:41.965981 | 2014-04-25T03:15:15 | 2014-04-25T03:15:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 41,622 | java | package com.testapp.test;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.google.gson.Gson;
import helper.database.DBAdapter;
import helper.json.ActivityGroup;
import helper.json.BizneInfo;
import helper.json.Passport;
import helper.json.PromoList;
import helper.json.PromotionList;
import helper.json.QrScan;
import helper.threads.GetActivity;
import helper.threads.GetActivityGroup;
import helper.threads.GetBestList;
import helper.threads.GetBizInfo;
import helper.threads.GetBizneData;
import helper.threads.GetBizneGroup;
import helper.threads.GetBizneInteractions;
import helper.threads.GetBizneOffers;
import helper.threads.GetBiznePassports;
import helper.threads.GetBizneTips;
import helper.threads.GetOfferGroup;
import helper.threads.GetOnlyBizName;
import helper.threads.GetPrizes;
import helper.threads.GetPromos;
import helper.threads.SendCheckin;
import helper.threads.SendCheckinPromo;
import helper.threads.SendQualityChildValue;
import helper.threads.SendQualityValue;
import helper.threads.SendTip;
import helper.threads.SetFavorite;
import helper.threads.SetLike;
import helper.tools.QrReaderAdapter;
import helper.tools.TextQrReader;
import android.net.Uri;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Typeface;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RatingBar;
import android.widget.ScrollView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
@SuppressLint("SimpleDateFormat")
public class BizneInfoActivity extends Activity {
PromoList promos;
PromotionList promotions;
BizneInfo info;
public Intent callIntent;
int userpoints;
QrReaderAdapter adapterQr = new QrReaderAdapter();
public static QrScan answer;
public static String biznename = "";
public static int promossize;
public static int interactionssize = 0;
public static int tipssize = 0;
public static int promotionssize;
public static int offerssize = 0;
public static int usrpts;
public static int passportsize = 0;
public static double latitude;
public static double longitude;
public static String name;
public static ActivityGroup selected_group = null;
public static String offergroup_name = "";
public static Passport selected_passport;
// public static TextView textview = new TextView(null);
ImageButton btn_prizes;
Button btn_map;
Button btn_tip;
Button btn_like;
Button btn_checkin;
ScrollView scroll;
ScrollView childscroll;
public DBAdapter database = new DBAdapter(this);
Cursor cursor;
volatile public ProgressDialog pd;
public BizneInfoActivity(){
this.promos = GetBizInfo.act.getPrizes();
this.promotions = GetBizInfo.act.getPromotions();
this.info = GetBizInfo.act.getBizneInfo();
this.userpoints = GetBizInfo.act.getUserPoints();
this.biznename = info.getName();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bizne_info);
String data = "&bizid=" + MainActivity.answer.getBizId();
GetBizneTips tips = new GetBizneTips(this);
tips.execute(new String[] {data,"getTips"});
GetBizneOffers offers = new GetBizneOffers(this);
offers.execute(new String[] {data,"getBizneOffers"});
GetBiznePassports passports = new GetBiznePassports(this);
passports.execute(new String[] {data,"getPassports"});
GetBizneInteractions interactions = new GetBizneInteractions(this);
interactions.execute(new String[] {data,"getBizneInteractions"});
setElements();
// BizneInfoActivity.isrunning = true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.bizne_info, menu);
if(info.getTelephone().length() > 0)
menu.add(1, 1, Menu.FIRST, "Llamar");
if(info.getEmail().length() > 0)
menu.add(2, 2, Menu.FIRST, "Enviar Correo");
return true;
}
public void gohome(){
Intent a = new Intent(this,MainActivity.class);
a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(a);
}
public void openMap(){
Intent intent = new Intent(this,BizneMapActivity.class);
startActivity(intent);
}
public void openTipDialog(){
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_tips);
dialog.setTitle("Selecciona una opción");
Button dialogButton = (Button) dialog.findViewById(R.id.dialog_tips_new);
// if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
openNewTipDialog();
dialog.dismiss();
}
});
dialogButton = (Button) dialog.findViewById(R.id.dialog_tips_get);
// if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
viewTips();
dialog.dismiss();
}
});
dialog.show();
}
public void openNewTipDialog(){
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_tip);
dialog.setTitle("Nuevo tip");
RatingBar ratingbar = (RatingBar) dialog.findViewById(R.id.ratingbar);
ratingbar.setStepSize(1);
// Set biz info
final int bizid = MainActivity.answer.getBizId();
final double lat = info.getLatitude();
final double lng = info.getLongitude();
Button close = (Button)dialog.findViewById(R.id.btn_close);
close.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
Button dialogButton = (Button) dialog.findViewById(R.id.btn_send_tip);
// if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
RatingBar ratingbar = (RatingBar) dialog.findViewById(R.id.ratingbar);
ratingbar.setStepSize(1);
EditText text = (EditText) dialog.findViewById(R.id.tip_comment);
final String comment = text.getText().toString();
final int rating = (int) ratingbar.getRating();
sendTip(comment,bizid,lat,lng,rating);
}
});
dialog.show();
}
public void like(){
if(GetBizInfo.act.IsLiked()){
Toast.makeText(this, "Ya te gusta este negocio", Toast.LENGTH_SHORT).show();
return;
}
ProgressDialog pd = ProgressDialog.show(this, "Enviando me gusta", "Espere, por favor", true, false);
database.open();
cursor = database.getAllUsers();
database.close();
String data = "&bizid=" + MainActivity.answer.getBizId() + "&userid=" + cursor.getString(1).toString();
SetLike like = new SetLike(this, pd);
like.execute(new String[] {data,"like"});
}
public void viewTips(){
ProgressDialog pd = ProgressDialog.show(this, "Cargando tips", "Espere, por favor", true, false);
String data = "&bizid=" + MainActivity.answer.getBizId();
GetBizneTips tips = new GetBizneTips(this, pd);
tips.execute(new String[] {data,"getTips"});
}
public void sendTip(String comment,int bizid,double lat, double lng, int rating){
DBAdapter database = new DBAdapter(this);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
database.open();
cursor = database.getAllUsers();
database.close();
String data = "&userid=" + cursor.getString(1).toString()
+ "&comment=" + comment
+ "&bizid=" + bizid
+ "&lat=" + lat
+ "&lng=" + lng
+ "&rating=" + rating
+ "&duration=00:00:00"
+ "&time=" + dateFormat.format(date);
ProgressDialog pd = ProgressDialog.show(this, "Enviando Tip", "Espere, por favor", true, false);
SendTip tip = new SendTip(this, pd);
tip.execute(new String[] {data,"saveTip"});
}
public void setElements(){
// Typeface font_oldsansblack = Typeface.createFromAsset(getAssets(), "gnuolane.ttf");
Button txt_usr_points = (Button)findViewById(R.id.txt_userpoints2);
txt_usr_points.setVisibility(View.VISIBLE);
// txt_usr_points.setTypeface(font_oldsansblack);
txt_usr_points.setText(GetBizInfo.act.getUserPoints() + "");
txt_usr_points.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showItems(1);
}
});
Button txt_usr_prizes = (Button)findViewById(R.id.txt_userprizes2);
txt_usr_prizes.setVisibility(View.VISIBLE);
txt_usr_prizes.setText(GetBizInfo.act.getPrizesCount() + "");
txt_usr_prizes.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
getPrizes();
}
});
btn_checkin = (Button) findViewById(R.id.business_checkin);
btn_checkin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
setCheckin();
}
});
btn_tip = (Button) findViewById(R.id.business_tip);
btn_tip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
openNewTipDialog();
}
});
btn_map = (Button) findViewById(R.id.business_map);
btn_map.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
openMap();
}
});
btn_like = (Button) findViewById(R.id.business_like);
btn_like.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
like();
}
});
ImageButton btn_add_favorite = (ImageButton) findViewById(R.id.btn_add_favorite);
btn_add_favorite.setVisibility(ImageButton.VISIBLE);
btn_add_favorite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
confirmFavorite();
}
});
ImageButton btn_home = (ImageButton) findViewById(R.id.btn_go_home);
btn_home.setVisibility(ImageButton.GONE);
btn_home = (ImageButton) findViewById(R.id.btn_home);
btn_home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
gohome();
}
});
ImageButton back = (ImageButton) findViewById(R.id.btn_back);
// back.setBackgroundResource(R.drawable.btn_back_qrivo);
back.setVisibility(ImageButton.VISIBLE);
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// setGPSLocation();
finish();
}
});
ImageButton btn_scan = (ImageButton) findViewById(R.id.btn_bizinfo_scanqr);
btn_scan.setVisibility(ImageButton.VISIBLE);
btn_scan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
scanQr();
}
});
btn_prizes = (ImageButton) findViewById(R.id.btn_prizes3);
btn_prizes.setVisibility(ImageButton.GONE);
btn_prizes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
goToPrizes();
}
});
LinearLayout ll = (LinearLayout) findViewById(R.id.biz_layout_elements);
TableLayout table = new TableLayout(this);
table.setStretchAllColumns(true);
table.setShrinkAllColumns(true);
TextView tv;
tv = (TextView)findViewById(R.id.bizneinfo_tips_text);
tv.setVisibility(View.VISIBLE);
if(info.getLikes() == 0){
tv.setText("Sé el primero en dar me gusta a este negocio");
}else{
tv.setText("A " + info.getLikes() + " personas les gusta este negocio");
}
tv = (TextView)findViewById(R.id.lbl_bizname);
tv.setVisibility(View.GONE);
tv = (TextView)findViewById(R.id.lbl_name_section);
tv.setText(this.info.getName());
tv = (TextView)findViewById(R.id.lbl_category);
// tv.setTypeface(font_oldsansblack);
tv.setText(this.info.getCategory());
if(info.getCategory() == null){
tv.setVisibility(TextView.GONE);
}else{
if(info.getCategory().equals("")){
tv.setVisibility(TextView.GONE);
}
}
tv = (TextView)findViewById(R.id.lbl_address);
tv.setText(this.info.getAddress() + (this.info.getRegion() != null ?"\n" + this.info.getRegion():""));
// Telephone
Button btn_call = (Button)findViewById(R.id.btn_call);
tv = (TextView)findViewById(R.id.lbl_telephone);
if(info.getTelephone().equals("") || info.getTelephone() == null){
btn_call.setVisibility(Button.GONE);
tv.setVisibility(TextView.GONE);
}
tv.setText(this.info.getTelephone());
btn_call.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showTelephone();
}
});
// E-mail
Button btn_mail = (Button)findViewById(R.id.btn_mail);
tv = (TextView)findViewById(R.id.lbl_email);
tv.setText(this.info.getEmail());
if(info.getEmail().equals("") || info.getEmail() == null){
btn_mail.setVisibility(Button.GONE);
tv.setVisibility(TextView.GONE);
}
btn_mail.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
sendEmail();
}
});
BizneInfoActivity.promotionssize = (this.promotions == null ? 0 : this.promotions.size());
BizneInfoActivity.promossize = (this.promos == null ? 0 : this.promos.size());
BizneInfoActivity.usrpts = this.userpoints;
tv = (TextView)findViewById(R.id.bizneinfo_offers);
tv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showItems(0);
}
});
offerssize = 0;
tv.setText(offerssize + "\nOfertas");
tv.setTextSize(10);
tv.setText("Cargando...");
passportsize = 0;
tv = (TextView)findViewById(R.id.bizneinfo_prizes);
tv.setText(passportsize + "\nPlanes");
tv.setTextSize(10);
tv.setText("Cargando");
tv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showItems(1);
}
});
tv = (TextView)findViewById(R.id.bizinfo_points_text);
tv.setTextAppearance(this, R.style.subtitle);
tv.setText("En este negocio tienes " + userpoints + " puntos.");
tv = (TextView)findViewById(R.id.bizneinfo_points);
tv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showItems(3);
}
});
tv = (TextView)findViewById(R.id.bizneinfo_tips);
tv.setTextSize(10);
tv.setText("Cargando");
tv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showItems(2);
}
});
tv = (TextView)findViewById(R.id.bizneinfo_points);
tv.setTextSize(10);
// tv.setText(usrpts + "\nInteracciones");
tv.setText("Cargando");
TableRow row;
ll = (LinearLayout) findViewById(R.id.biz_promotions);
if(this.promotions != null){
for(int i = 0; i < this.promotions.size(); i++){
row = new TableRow(this);
tv = new TextView(this);
tv.setText(this.promotions.get(i).getPromotion());
row.addView(tv);
table.addView(row);
}
}else{
row = new TableRow(this);
tv = new TextView(this);
// tv.setText("No hay promociones aún");
tv.setVisibility(View.GONE);
row.addView(tv);
table.addView(row);
}
ll.addView(table);
longitude = info.getLongitude();
latitude = info.getLatitude();
name = info.getName();
}
public void goToPrizes(){
database.open();
cursor = database.getAllUsers();
database.close();
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&bizid="+ MainActivity.answer.getBizId() + "&userid=" + cursor.getString(1).toString();
GetPromos getpromos = new GetPromos(this, pd);
getpromos.execute(new String[] {data,"getPromos"});
}
public void callPhone(){
try {
callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+this.info.getTelephone()));
startActivity(callIntent);
} catch (ActivityNotFoundException activityException) {
Log.e("dialing-example", "Call failed", activityException);
}
}
public void showItems(int item){
LinearLayout ll = null;
TextView itemstitle = null;
TextView tv;
ScrollView scroll;
switch(item){
case 0:
scroll = (ScrollView)findViewById(R.id.promos_scroll);
scroll.setVisibility(View.VISIBLE);
scroll = (ScrollView)findViewById(R.id.prizes_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.tips_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.interactions_scroll);
scroll.setVisibility(View.GONE);
tv = (TextView)findViewById(R.id.bizneinfo_offers);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext_selected);
tv = (TextView)findViewById(R.id.comment_instructions);
tv.setVisibility(View.GONE);
tv = (TextView)findViewById(R.id.bizneinfo_prizes);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_tips);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_points);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
// Offers
ll = (LinearLayout) findViewById(R.id.biz_promotions);
ll.setVisibility(LinearLayout.VISIBLE);
if(BizneInfoActivity.offerssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_nooffers);
itemstitle.setVisibility(View.VISIBLE);
}
// Prizes
ll = (LinearLayout) findViewById(R.id.biz_prizes);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.passportsize == 0){
itemstitle = (TextView)findViewById(R.id.txt_noprizes);
itemstitle.setVisibility(View.GONE);
}
// Tips
ll = (LinearLayout) findViewById(R.id.biz_tips);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.tipssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_notips);
itemstitle.setVisibility(View.GONE);
}
// Points
if(BizneInfoActivity.interactionssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_nointeractions);
itemstitle.setVisibility(View.GONE);
}
ll = (LinearLayout) findViewById(R.id.biz_interactions);
ll.setVisibility(LinearLayout.GONE);
break;
case 1:
scroll = (ScrollView)findViewById(R.id.promos_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.prizes_scroll);
scroll.setVisibility(View.VISIBLE);
scroll = (ScrollView)findViewById(R.id.tips_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.interactions_scroll);
scroll.setVisibility(View.GONE);
tv = (TextView)findViewById(R.id.bizneinfo_offers);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_prizes);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext_selected);
tv = (TextView)findViewById(R.id.bizneinfo_tips);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_points);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
// Offers
ll = (LinearLayout) findViewById(R.id.biz_promotions);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.offerssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_nooffers);
itemstitle.setVisibility(View.GONE);
}
// Prizes
ll = (LinearLayout) findViewById(R.id.biz_prizes);
ll.setVisibility(LinearLayout.VISIBLE);
if(BizneInfoActivity.passportsize == 0){
itemstitle = (TextView)findViewById(R.id.txt_noprizes);
itemstitle.setVisibility(View.VISIBLE);
}
// Tips
ll = (LinearLayout) findViewById(R.id.biz_tips);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.tipssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_notips);
itemstitle.setVisibility(View.GONE);
}
// Points
if(BizneInfoActivity.interactionssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_nointeractions);
itemstitle.setVisibility(View.GONE);
}
ll = (LinearLayout) findViewById(R.id.biz_interactions);
ll.setVisibility(LinearLayout.GONE);
break;
case 2:
scroll = (ScrollView)findViewById(R.id.prizes_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.promos_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.tips_scroll);
scroll.setVisibility(View.VISIBLE);
scroll = (ScrollView)findViewById(R.id.interactions_scroll);
scroll.setVisibility(View.GONE);
tv = (TextView)findViewById(R.id.bizneinfo_offers);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_prizes);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_tips);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext_selected);
tv = (TextView)findViewById(R.id.bizneinfo_points);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
// Offers
ll = (LinearLayout) findViewById(R.id.biz_promotions);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.offerssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_nooffers);
itemstitle.setVisibility(View.GONE);
}
// Prizes
ll = (LinearLayout) findViewById(R.id.biz_prizes);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.passportsize == 0){
itemstitle = (TextView)findViewById(R.id.txt_noprizes);
itemstitle.setVisibility(View.GONE);
}
// Tips
ll = (LinearLayout) findViewById(R.id.biz_tips);
ll.setVisibility(LinearLayout.VISIBLE);
if(BizneInfoActivity.tipssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_notips);
itemstitle.setVisibility(View.VISIBLE);
}
if(info.getLikes() == 0){
tv = (TextView)findViewById(R.id.bizneinfo_tips_text);
tv.setVisibility(View.GONE);
}else{
tv = (TextView)findViewById(R.id.bizneinfo_tips_text);
tv.setVisibility(View.VISIBLE);
}
// Points
if(BizneInfoActivity.interactionssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_nointeractions);
itemstitle.setVisibility(View.GONE);
}
ll = (LinearLayout) findViewById(R.id.biz_interactions);
ll.setVisibility(LinearLayout.GONE);
break;
case 3:
scroll = (ScrollView)findViewById(R.id.promos_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.prizes_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.tips_scroll);
scroll.setVisibility(View.GONE);
scroll = (ScrollView)findViewById(R.id.interactions_scroll);
scroll.setVisibility(View.VISIBLE);
tv = (TextView)findViewById(R.id.bizneinfo_offers);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_prizes);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_tips);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext);
tv = (TextView)findViewById(R.id.bizneinfo_points);
tv.setBackgroundResource(R.drawable.rounded_bottom_edittext_selected);
// Offers
ll = (LinearLayout) findViewById(R.id.biz_promotions);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.offerssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_nooffers);
itemstitle.setVisibility(View.GONE);
}
// Prizes
ll = (LinearLayout) findViewById(R.id.biz_prizes);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.passportsize == 0){
itemstitle = (TextView)findViewById(R.id.txt_noprizes);
itemstitle.setVisibility(View.GONE);
}
// Tips
ll = (LinearLayout) findViewById(R.id.biz_tips);
ll.setVisibility(LinearLayout.GONE);
if(BizneInfoActivity.tipssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_notips);
itemstitle.setVisibility(View.GONE);
}
tv = (TextView)findViewById(R.id.bizneinfo_tips_text);
tv.setVisibility(View.GONE);
// Points
if(BizneInfoActivity.interactionssize == 0){
itemstitle = (TextView)findViewById(R.id.txt_nointeractions);
itemstitle.setVisibility(View.VISIBLE);
}
ll = (LinearLayout) findViewById(R.id.biz_interactions);
ll.setVisibility(LinearLayout.VISIBLE);
break;
}
}
public void setCheckin(){
database.open();
cursor = database.getAllUsers();
database.close();
pd = ProgressDialog.show( this, "Enviando información ...", "Espere, por favor", true, false);
String data = "&bizid="+ info.getBizId() +
"&userid=" + cursor.getString(1).toString();
SendCheckin sendcheckin = new SendCheckin(this, pd);
sendcheckin.execute(new String[] {data,"setCheckin"});
}
private void showTelephone(){
// custom dialog
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_bizne_telephone);
// set the custom dialog components - text, image and button
TextView text = (TextView) dialog.findViewById(R.id.txt_telephone);
text.setText("Tel: " + info.getTelephone());
Button call = (Button) dialog.findViewById(R.id.btn_call);
// if button is clicked, close the custom dialog
call.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
callPhone();
}
});
Button close = (Button)dialog.findViewById(R.id.btn_close);
close.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
dialog.show();
}
public void sendEmail(){
if(this.info.getEmail().length() > 0){
try{
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{this.info.getEmail()});
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Selecciona tu cliente de correo :"));
}catch(ActivityNotFoundException activityException){
Log.e("BizneInfo", "Email failed", activityException);
}
}else{
Toast.makeText(this, "El negocio no cuenta con correo electrónico" , Toast.LENGTH_LONG).show();
}
}
public boolean onOptionsItemSelected(MenuItem item)
{
switch(item.getItemId())
{
case 1:
// first we delete the table of users.
callPhone();
return true;
case 2:
sendEmail();
return true;
default:
return false;
}
}
public void confirmFavorite(){
if(!isFavorite()){
AlertDialog.Builder builder =
new AlertDialog.Builder(this);
builder.setMessage("¿Deseas agregar " + info.getName() + " a tus favoritos?")
.setTitle("Agregar a favoritos")
.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Log.i("Dialogos", "Confirmacion Aceptada.");
dialog.cancel();
setFavorite();
}
})
.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Log.i("Dialogos", "Confirmacion Cancelada.");
dialog.cancel();
}
});
builder.show();
}else{
Toast.makeText(this, "Ya está en tus favoritos." , Toast.LENGTH_LONG).show();
}
}
public boolean isFavorite(){
database.open();
cursor = database.getFavorite(MainActivity.answer.getBizId());
database.close();
if(cursor.getCount() > 0){
return true;
}
return false;
}
public void setFavorite(){
database.open();
cursor = database.getAllUsers();
database.close();
pd = ProgressDialog.show( this, "Agregando a favoritos...", "Espere, por favor", true, false);
String data = "&bizid="+ MainActivity.answer.getBizId() + "&userid=" + cursor.getString(1).toString() + "&name=" + info.getName() + "&catid=" + info.getCatId();
SetFavorite setfavorite = new SetFavorite(this, pd,this.info);
setfavorite.execute(new String[] {data,"setFavorite"});
}
private void scanQr(){
Log.d("Socialdeals", "SocialdealsListenerClick-onClick: iniciando qr");
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
this.startActivityForResult(intent, 0);
}
private void getPrizes(){
pd = ProgressDialog.show( this, "Cargando...", "Espere, por favor", true, false);
database.open();
cursor = database.getAllUsers();
database.close();
String data = "&userid=" + cursor.getString(1).toString() + "&bizid="+ info.getBizId();
GetPrizes getfavorites = new GetPrizes(this, pd);
getfavorites.execute(new String[] {data,"getUserBiznePrizes"});
}
public void openActivityGroup(int idg){
ProgressDialog pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&idg=" + idg;
GetActivityGroup getdata = new GetActivityGroup(this, pd);
getdata.execute(new String[] {data,"getActivityGroup"});
}
public void openActivity(int actid){
ProgressDialog pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
DBAdapter db = new DBAdapter(this);
db.open();
Cursor c = db.getAllUsers();
db.close();
String data = "&userid=" + c.getString(1).toString() + "&actid=" + actid;
GetActivity getdata = new GetActivity(this, pd);
getdata.execute(new String[] {data,"getActivity"});
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (resultCode == RESULT_CANCELED) {
// Handle cancel
//finish();
}else{
String result = intent.getStringExtra("SCAN_RESULT");
Gson gson = new Gson();
try{
if(adapterQr.getQr(this, result)){
}else{
answer = gson.fromJson(result, QrScan.class);
if(!answer.type.equals("biznegroup") && !answer.type.equals("qrgame") && !answer.type.equals("bestlist") && !answer.type.equals("qualitygroup")){
try{
database.open();
cursor = database.getAllUsers();
database.close();
String data = "&bizid=" + answer.getBizId() +
"&userid=" + cursor.getString(1).toString();
GetOnlyBizName getinfo = new GetOnlyBizName(this, pd);
getinfo.execute(new String[] {data,"getBizneInfo"});
}catch(Exception e){
Log.d("Qrivo", "GCMConnection-onCreate: Error: "+e.toString());
}
}
// Toast.makeText(this, answer.toString() , Toast.LENGTH_LONG).show();
database.open();
cursor = database.getAllUsers();
database.close();
// If it is an activity...
if(answer.getType() == 0){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
try{
String data = "&bizid=" + answer.getBizId() +
"&userid=" + cursor.getString(1).toString();
GetActivity getactivity = new GetActivity(this, pd );
getactivity.execute(new String[] {data,"loadActivity"});
}catch(Exception e){
Log.d("Qrivo", "GCMConnection-onCreate: Error: "+e.toString());
pd.cancel();
e.printStackTrace();
//finish();
}
// If it is a game...
}else{
if(answer.getType() == 1){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
try{
QrScan qrscan = new QrScan();
qrscan.setQrId(answer.getQrId());
MainActivity.answer = qrscan;
String data = "&qrid="+MainActivity.answer.getQrId();
GetBizInfo getinfo = new GetBizInfo(this, pd,false,true );
getinfo.execute(new String[] {data,"getBizId"});
data = "&qrid="+answer.getQrId() +
"&userid=" + cursor.getString(1).toString();
GetActivity getactivity = new GetActivity(this, pd );
getactivity.execute(new String[] {data,"loadGame"});
}catch(Exception e){
Log.d("Socialdeals", "SetUserCheckIn-onCreate: Error: "+e.toString());
pd.cancel();
e.printStackTrace();
//finish();
}
}else{
if(answer.type.equals("quality")){
pd = ProgressDialog.show( this, "Enviando información ...", "Espere, por favor", true, false);
String data = "&bizid="+answer.getBizId() +
"&value=" + answer.getValue() + "&userid=" + cursor.getString(1).toString();
SendQualityValue sendquality = new SendQualityValue(this, pd);
sendquality.execute(new String[] {data,"saveQuality"});
}else{
if(answer.type.equals("checkin")){
pd = ProgressDialog.show( this, "Enviando información ...", "Espere, por favor", true, false);
String data = "&bizid="+answer.getBizId() +
"&userid=" + cursor.getString(1).toString();
SendCheckin sendcheckin = new SendCheckin(this, pd);
sendcheckin.execute(new String[] {data,"setCheckin"});
}else{
if(answer.type.equals("promotion")){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&bizid="+answer.getBizId() + "&userid=" + cursor.getString(1).toString();
GetPromos getpromos = new GetPromos(this, pd);
getpromos.execute(new String[] {data,"getPromos"});
}else{
if(answer.type.equals("checkinpromotion")){
pd = ProgressDialog.show( this, "Enviando información ...", "Espere, por favor", true, false);
String data = "&bizid="+answer.getBizId() +
"&userid=" + cursor.getString(1).toString();
SendCheckinPromo sendcheckinpromo = new SendCheckinPromo(this, pd);
sendcheckinpromo.execute(new String[] {data,"pointsVisit"});
}else{
if(answer.type.equals("bizneinfo")){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&bizid=" + answer.getBizId() +
"&userid=" + cursor.getString(1).toString();
GetBizInfo getinfo = new GetBizInfo(this, pd);
getinfo.execute(new String[] {data,"getBizneInfo"});
}else{
if(answer.type.equals("bestlist")){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&bestlistid=" + answer.getBestListId() +
"&userid=" + cursor.getString(1).toString();
GetBestList getlist = new GetBestList(this, pd);
getlist.execute(new String[] {data,"getBizneBestList"});
}else{
if(answer.type.equals("qualitygroup")){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&idg=" + answer.getIdGroup() + "&val=" + answer.getValue();
GetBizneGroup getlist = new GetBizneGroup(this, pd);
getlist.execute(new String[] {data,"getBizneGroup"});
}else{
if(answer.type.equals("qualitysubbizne")){
pd = ProgressDialog.show( this, "Enviando información ...", "Espere, por favor", true, false);
String data = "&subbizid="+answer.getSubBizId() +
"&val=" + answer.getValue();
SendQualityChildValue sendquality = new SendQualityChildValue(this, pd);
sendquality.execute(new String[] {data,"setQualityChild"});
}else{
if(answer.type.equals("offergroup")){
pd = ProgressDialog.show( this, "Enviando información ...", "Espere, por favor", true, false);
String data = "&groupid=" + answer.getGroupId();
GetOfferGroup group = new GetOfferGroup(this, pd);
group.execute(new String[] {data,"getOfferGroup"});
}else{
if(answer.type.equals("biznegroup")){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&idg=" + answer.getIdGroup() + "&val=0" + answer.getValue();
GetBizneGroup getlist = new GetBizneGroup(this, pd,true);
getlist.execute(new String[] {data,"getBizneGroup"});
}else{
if(answer.type.equals("androidviewchild")){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&subbizid=" + answer.getSubBizId() + "&bizid=" + answer.getBizId();
GetBizneData getdata = new GetBizneData(this, pd);
getdata.execute(new String[] {data,"getSubBizData"});
}else{
if(answer.type.equals("androidview")){
pd = ProgressDialog.show( this, "Recibiendo información ...", "Espere, por favor", true, false);
String data = "&subbizid=" + answer.getSubBizId() + "&bizid=" + answer.getBizId();
GetBizneData getdata = new GetBizneData(this, pd);
getdata.execute(new String[] {data,"getBizData"});
}else{
if(answer.type.equals("activityqr")){
openActivity(answer.getActivityId());
}else{
if(answer.type.equals("activitygroup")){
openActivityGroup(answer.getIdGroup());
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}catch(Exception e){
TextQrReader textqr = new TextQrReader();
textqr.actionQr(this, result);
}
//GCMConnection.lbl_test.setText(qr.toString());
}
}
}
| [
"checoalejandro@gmail.com"
] | checoalejandro@gmail.com |
f19064490e3aa880b45e3a0785fee041c2f45305 | 8eb14536eb3df9ec6d8010744f92f73f9bafbe0a | /src/gui/App.java | 97e7e682e09ea37174ab86a0e8b46a0f47260750 | [] | no_license | jerrysonguillen/PersonInformationDeskTopAppWithDatabase | b242866ea6cc279cba885123dedc3adf905f0fe0 | 311f9cad3c4126593abae2189676615925eaf318 | refs/heads/master | 2020-06-17T01:54:50.917787 | 2019-09-22T14:25:57 | 2019-09-22T14:25:57 | 195,760,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,522 | java | package gui;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import java.sql.SQLException;
import javax.swing.*;
import javax.swing.border.*;
import controller.Controller;
public class App {
private JFrame frmPersonInformation;
private JTextField txtName;
private JTextField txtNote;
private JTextField txtCNumber;
private JTextField txtOcupation;
private JTextField txtTaxId;
private JFileChooser fileChooser;
private Controller controller;
private TablePanel tablePanel;
private JSplitPane splitPane;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
App window = new App();
window.frmPersonInformation.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public App() {
initialize();
}
private void initialize() {
frmPersonInformation = new JFrame();
frmPersonInformation.setTitle("Person Information");
frmPersonInformation.setMinimumSize(new Dimension(600, 500));
frmPersonInformation.setBounds(100, 100, 600, 500);
frmPersonInformation.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frmPersonInformation.getContentPane().setLayout(new BorderLayout(0, 0));
controller = new Controller();
frmPersonInformation.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent arg0) {
controller.disConnect();
frmPersonInformation.dispose();
System.gc();
}
});
JPanel messagePanel = new JPanel();
messagePanel.setLayout(new BorderLayout());
tablePanel = new TablePanel();
JPanel pnlForm = new JPanel();
pnlForm.setMinimumSize(new Dimension(250, 10));
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, pnlForm, tablePanel);
splitPane.setOneTouchExpandable(true);
frmPersonInformation.getContentPane().add(splitPane, BorderLayout.CENTER);
JToolBar toolBar = new JToolBar();
toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
toolBar.setBorder(BorderFactory.createEtchedBorder());
frmPersonInformation.getContentPane().add(toolBar, BorderLayout.NORTH);
fileChooser = new JFileChooser();
JButton btnSave = new JButton("Save");
btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
connect();
try {
controller.save();
} catch (SQLException e) {
System.out.println(e);
JOptionPane.showMessageDialog(frmPersonInformation, "Unable to save in database", "Error Message",
JOptionPane.ERROR_MESSAGE);
}
}
});
toolBar.add(btnSave);
JButton btnUpdate = new JButton("Update");
btnUpdate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
connect();
try {
controller.update();
} catch (SQLException e) {
e.printStackTrace();
}
}
});
toolBar.add(btnUpdate);
JButton btnRefresh = new JButton("Refresh");
btnRefresh.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
connect();
try {
controller.retrieve();
} catch (SQLException e) {
System.out.println(e);
JOptionPane.showMessageDialog(frmPersonInformation, "Unable to retrieve data in database",
"Error Message", JOptionPane.ERROR_MESSAGE);
}
tablePanel.refresh();
}
});
toolBar.add(btnRefresh);
pnlForm.setPreferredSize(new Dimension(250, 10));
Border innerBorder = BorderFactory.createTitledBorder("Add Person");
Border outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
pnlForm.setBorder(BorderFactory.createCompoundBorder(outerBorder, innerBorder));
GridBagLayout gbl_pnlForm = new GridBagLayout();
gbl_pnlForm.columnWidths = new int[] { 0, 0, 0, 0 };
gbl_pnlForm.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
gbl_pnlForm.columnWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE };
gbl_pnlForm.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
pnlForm.setLayout(gbl_pnlForm);
int gridY = 0;
////////////// first row///////////////
JLabel lblName = new JLabel("Name:");
GridBagConstraints gbc_lblName = new GridBagConstraints();
gbc_lblName.insets = new Insets(0, 0, 5, 5);
gbc_lblName.anchor = GridBagConstraints.EAST;
gbc_lblName.gridx = 1;
gbc_lblName.gridy = gridY;
pnlForm.add(lblName, gbc_lblName);
txtName = new JTextField();
txtName.setPreferredSize(new Dimension(5, 20));
txtName.setSize(new Dimension(10, 0));
GridBagConstraints gbc_txtName = new GridBagConstraints();
gbc_txtName.insets = new Insets(0, 0, 5, 0);
gbc_txtName.anchor = GridBagConstraints.WEST;
gbc_txtName.gridx = 2;
gbc_txtName.gridy = gridY++;
pnlForm.add(txtName, gbc_txtName);
txtName.setColumns(10);
////////////////////// next row /////////////
JLabel lblContactNumber = new JLabel("Contact Number:");
GridBagConstraints gbc_lblContactNumber = new GridBagConstraints();
gbc_lblContactNumber.insets = new Insets(0, 0, 5, 5);
gbc_lblContactNumber.anchor = GridBagConstraints.EAST;
gbc_lblContactNumber.gridx = 1;
gbc_lblContactNumber.gridy = gridY;
pnlForm.add(lblContactNumber, gbc_lblContactNumber);
txtCNumber = new JTextField();
txtCNumber.setPreferredSize(new Dimension(5, 20));
txtCNumber.setSize(new Dimension(10, 0));
GridBagConstraints gbc_txtCNumber = new GridBagConstraints();
gbc_txtCNumber.insets = new Insets(0, 0, 5, 0);
gbc_txtCNumber.anchor = GridBagConstraints.WEST;
gbc_txtCNumber.gridx = 2;
gbc_txtCNumber.gridy = gridY++;
pnlForm.add(txtCNumber, gbc_txtCNumber);
txtCNumber.setColumns(10);
////////////////////// next row/////////////
JLabel lblOcupation = new JLabel("Ocupation:");
GridBagConstraints gbc_lblOcupation = new GridBagConstraints();
gbc_lblOcupation.anchor = GridBagConstraints.EAST;
gbc_lblOcupation.insets = new Insets(0, 0, 5, 5);
gbc_lblOcupation.gridx = 1;
gbc_lblOcupation.gridy = gridY;
pnlForm.add(lblOcupation, gbc_lblOcupation);
txtOcupation = new JTextField();
GridBagConstraints gbc_txtOcupation = new GridBagConstraints();
gbc_txtOcupation.insets = new Insets(0, 0, 5, 0);
gbc_txtOcupation.anchor = GridBagConstraints.WEST;
gbc_txtOcupation.gridx = 2;
gbc_txtOcupation.gridy = gridY++;
pnlForm.add(txtOcupation, gbc_txtOcupation);
txtOcupation.setColumns(10);
JLabel lblAge = new JLabel("Age:");
GridBagConstraints gbc_lblAge = new GridBagConstraints();
gbc_lblAge.anchor = GridBagConstraints.NORTHEAST;
gbc_lblAge.insets = new Insets(0, 0, 5, 5);
gbc_lblAge.gridx = 1;
gbc_lblAge.gridy = gridY;
pnlForm.add(lblAge, gbc_lblAge);
JList<Object> list = new JList<Object>();
list.setPreferredSize(new Dimension(110, 66));
list.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
list.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
list.setAlignmentY(Component.TOP_ALIGNMENT);
list.setAlignmentX(Component.LEFT_ALIGNMENT);
list.setModel(new AbstractListModel<Object>() {
private static final long serialVersionUID = 1L;
String[] values = new String[] { "Under 18", "18 to 65", "65 or over" };
public int getSize() {
return values.length;
}
public Object getElementAt(int index) {
return values[index];
}
});
GridBagConstraints gbc_list = new GridBagConstraints();
gbc_list.anchor = GridBagConstraints.FIRST_LINE_START;
gbc_list.insets = new Insets(0, 0, 5, 0);
gbc_list.weightx = 1.0;
gbc_list.weighty = 0.1;
gbc_list.gridx = 2;
gbc_list.gridy = gridY++;
pnlForm.add(list, gbc_list);
//////////////////// next row///////////////////////////
JLabel lblNote = new JLabel("Note:");
GridBagConstraints gbc_lblNote = new GridBagConstraints();
gbc_lblNote.insets = new Insets(0, 0, 5, 5);
gbc_lblNote.anchor = GridBagConstraints.EAST;
gbc_lblNote.gridx = 1;
gbc_lblNote.gridy = gridY;
pnlForm.add(lblNote, gbc_lblNote);
txtNote = new JTextField();
txtNote.setPreferredSize(new Dimension(5, 20));
txtNote.setSize(new Dimension(10, 0));
GridBagConstraints gbc_txtNote = new GridBagConstraints();
gbc_txtNote.insets = new Insets(0, 0, 5, 0);
gbc_txtNote.anchor = GridBagConstraints.WEST;
gbc_txtNote.gridx = 2;
gbc_txtNote.gridy = gridY++;
pnlForm.add(txtNote, gbc_txtNote);
txtNote.setColumns(10);
///////////////////// next row///////////////
JButton btnOk = new JButton("OK");
JLabel lblEmployment = new JLabel("Employment:");
GridBagConstraints gbc_lblEmployment = new GridBagConstraints();
gbc_lblEmployment.insets = new Insets(0, 0, 5, 5);
gbc_lblEmployment.anchor = GridBagConstraints.EAST;
gbc_lblEmployment.gridx = 1;
gbc_lblEmployment.gridy = gridY;
pnlForm.add(lblEmployment, gbc_lblEmployment);
JComboBox cmbBox = new JComboBox();
cmbBox.setModel(new DefaultComboBoxModel(new String[] { "Employed", "self-Employed", "unEmployed" }));
cmbBox.setEditable(true);
GridBagConstraints gbc_cmbBox = new GridBagConstraints();
gbc_cmbBox.anchor = GridBagConstraints.WEST;
gbc_cmbBox.insets = new Insets(0, 0, 5, 0);
gbc_cmbBox.gridx = 2;
gbc_cmbBox.gridy = gridY++;
pnlForm.add(cmbBox, gbc_cmbBox);
////////////////// next row///////////////////////////////
JLabel lblPHCitizen = new JLabel("PH Citizen:");
GridBagConstraints gbc_lblPHCitizen = new GridBagConstraints();
gbc_lblPHCitizen.anchor = GridBagConstraints.EAST;
gbc_lblPHCitizen.insets = new Insets(0, 0, 5, 5);
gbc_lblPHCitizen.gridx = 1;
gbc_lblPHCitizen.gridy = gridY;
pnlForm.add(lblPHCitizen, gbc_lblPHCitizen);
JCheckBox chckbxUsCitizen = new JCheckBox("");
GridBagConstraints gbc_chckbxUsCitizen = new GridBagConstraints();
gbc_chckbxUsCitizen.anchor = GridBagConstraints.NORTHWEST;
gbc_chckbxUsCitizen.insets = new Insets(0, 0, 5, 0);
gbc_chckbxUsCitizen.gridx = 2;
gbc_chckbxUsCitizen.gridy = gridY++;
pnlForm.add(chckbxUsCitizen, gbc_chckbxUsCitizen);
////////////////////// next row//////////////////////
JLabel lblTaxId = new JLabel("Tax ID:");
lblTaxId.setEnabled(false);
GridBagConstraints gbc_lblTaxId = new GridBagConstraints();
gbc_lblTaxId.anchor = GridBagConstraints.EAST;
gbc_lblTaxId.insets = new Insets(0, 0, 5, 5);
gbc_lblTaxId.gridx = 1;
gbc_lblTaxId.gridy = gridY;
pnlForm.add(lblTaxId, gbc_lblTaxId);
txtTaxId = new JTextField();
txtTaxId.setEnabled(false);
GridBagConstraints gbc_txtTaxId = new GridBagConstraints();
gbc_txtTaxId.anchor = GridBagConstraints.WEST;
gbc_txtTaxId.insets = new Insets(0, 0, 5, 0);
gbc_txtTaxId.gridx = 2;
gbc_txtTaxId.gridy = gridY++;
pnlForm.add(txtTaxId, gbc_txtTaxId);
txtTaxId.setColumns(10);
///////////// next row///////////////
JLabel lblGender = new JLabel("Gender:");
GridBagConstraints gbc_lblGender = new GridBagConstraints();
gbc_lblGender.anchor = GridBagConstraints.EAST;
gbc_lblGender.insets = new Insets(0, 0, 5, 5);
gbc_lblGender.gridx = 1;
gbc_lblGender.gridy = gridY;
ButtonGroup genderGroup = new ButtonGroup();
pnlForm.add(lblGender, gbc_lblGender);
JRadioButton rdbtnMale = new JRadioButton("Male");
rdbtnMale.setSelected(true);
rdbtnMale.setActionCommand("Male");
GridBagConstraints gbc_rdbtnMale = new GridBagConstraints();
gbc_rdbtnMale.anchor = GridBagConstraints.WEST;
gbc_rdbtnMale.insets = new Insets(0, 0, 5, 0);
gbc_rdbtnMale.gridx = 2;
gbc_rdbtnMale.gridy = gridY++;
pnlForm.add(rdbtnMale, gbc_rdbtnMale);
//////////////////// next row////////////////
JRadioButton rdbtnFemale = new JRadioButton("Female");
rdbtnFemale.setActionCommand("Female");
GridBagConstraints gbc_rdbtnFemale = new GridBagConstraints();
gbc_rdbtnFemale.anchor = GridBagConstraints.WEST;
gbc_rdbtnFemale.insets = new Insets(0, 0, 5, 0);
gbc_rdbtnFemale.gridx = 2;
gbc_rdbtnFemale.gridy = gridY++;
genderGroup.add(rdbtnMale);
genderGroup.add(rdbtnFemale);
pnlForm.add(rdbtnFemale, gbc_rdbtnFemale);
/////////////////// next row//////////////////
GridBagConstraints gbc_btnOk = new GridBagConstraints();
gbc_btnOk.anchor = GridBagConstraints.NORTHWEST;
gbc_btnOk.insets = new Insets(0, 0, 0, 0);
gbc_btnOk.weightx = 1.0;
gbc_btnOk.weighty = 2.0;
gbc_btnOk.gridx = 2;
gbc_btnOk.gridy = gridY;
pnlForm.add(btnOk, gbc_btnOk);
btnOk.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent arg0) {
String name = txtName.getText();
String contactNumber = txtCNumber.getText();
String occupation = txtOcupation.getText();
int age = list.getLeadSelectionIndex();
String employment = (String) cmbBox.getSelectedItem();
String gender = genderGroup.getSelection().getActionCommand();
String note = txtNote.getText();
boolean isPH = chckbxUsCitizen.isSelected();
String taxId = txtTaxId.getText();
connect();
controller.addPerson(name, contactNumber, occupation, age, employment, gender, isPH, taxId, note);
tablePanel.refresh();
}
});
new PersonTableModel();
tablePanel.setData(controller.getPeople());
tablePanel.setPersonTableListener(new PersonTableListener() {
public void rowDeleted(int row) {
try {
controller.removePerson(row);
} catch (SQLException e) {
e.printStackTrace();
}
}
});
chckbxUsCitizen.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
boolean isTicked = chckbxUsCitizen.isSelected();
lblTaxId.setEnabled(isTicked);
txtTaxId.setEnabled(isTicked);
}
});
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
JMenuItem exportItem = new JMenuItem("Export Data...");
exportItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (fileChooser.showOpenDialog(exportItem) == JFileChooser.APPROVE_OPTION) {
try {
controller.saveToFile(fileChooser.getSelectedFile());
} catch (IOException e) {
JOptionPane.showMessageDialog(new JButton(), "Could not save data to the file", "Error",
JOptionPane.ERROR_MESSAGE);
}
}
}
});
JMenuItem importItem = new JMenuItem("Import Data...");
importItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK));
exportItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK));
importItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (fileChooser.showOpenDialog(new JButton()) == JFileChooser.APPROVE_OPTION) {
try {
controller.loadFromFile(fileChooser.getSelectedFile());
tablePanel.refresh();
} catch (IOException e) {
JOptionPane.showMessageDialog(new JButton(), "Could not load the data from the file", "Error",
JOptionPane.ERROR_MESSAGE);
}
}
}
});
JMenuItem exitFile = new JMenuItem("Exit");
exitFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int action = JOptionPane.showConfirmDialog(new JButton(), "Do you really want to exit this application",
"Confirm Exit", JOptionPane.OK_CANCEL_OPTION);
if (action == JOptionPane.OK_OPTION) {
WindowListener[] windowListeners = frmPersonInformation.getWindowListeners();
for (WindowListener listener : windowListeners) {
listener.windowClosing(new WindowEvent(frmPersonInformation, 0));
}
}
}
});
fileMenu.add(exportItem);
fileMenu.add(importItem);
fileMenu.addSeparator();
fileMenu.add(exitFile);
menuBar.add(fileMenu);
JMenu windowMenu = new JMenu("Window");
JMenu showItem = new JMenu("Show");
JCheckBoxMenuItem showItemForm = new JCheckBoxMenuItem("PersonForm");
showItemForm.setSelected(true);
showItem.add(showItemForm);
windowMenu.add(showItem);
menuBar.add(windowMenu);
frmPersonInformation.setJMenuBar(menuBar);
fileMenu.setMnemonic(KeyEvent.VK_F);
exitFile.setMnemonic(KeyEvent.VK_X);
exitFile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));
showItemForm.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ev.getSource();
if (menuItem.isSelected()) {
splitPane.setDividerLocation((int) pnlForm.getMinimumSize().getWidth());
}
pnlForm.setVisible(menuItem.isSelected());
}
});
}
public void connect() {
try {
controller.connect();
} catch (Exception e) {
JOptionPane.showMessageDialog(frmPersonInformation, "Unable to connect to database", "Error Message",
JOptionPane.ERROR_MESSAGE);
}
}
}
| [
"jerrysonguillen@gmail.com"
] | jerrysonguillen@gmail.com |
376a08fc2aa87f61e114ab5b59795336b51d335d | 846b5ce4853fa29392e169749d19fc3fa1c42d75 | /Board.java | 77eda9f8b833c04daf60891d4737b75de7737dbf | [] | no_license | anna-tang/CIS120-Connect-4 | bb1d4a4b4ec7ac381870e8065f65a8794ad13a46 | 747e02d7cf66a7c0dedede36d756f04127d2e6f0 | refs/heads/master | 2020-12-24T20:32:58.831703 | 2016-05-18T22:42:38 | 2016-05-18T22:42:38 | 59,154,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,883 | java | import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.*;
@SuppressWarnings("serial")
public class Board extends JPanel{
private Marker marker;
// 2-D array representing the contents of each cell
private Cell[][] board_contents;
public boolean playing = false;
private Cell curr_player;
private int curr_row;
private int curr_col;
private JLabel status;
private JFrame frame;
private Score score;
public static int rwins;
public static int ywins;
// Board constant dimensions
public static final int NUM_COLS = 7;
public static final int NUM_ROWS = 6;
public static final int BOARD_SIZE = 700;
public static final int CELL_SIZE = 100;
public static final int GRID_WIDTH = 8;
public Board(JLabel status, JFrame frame) {
setBorder(BorderFactory.createLineBorder(Color.BLUE));
setFocusable(true);
try { score = new Score(); }
catch (Exception ex) { }
addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (playing) {
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
if (marker.index == 0) { }
else {
marker.index -= 1;
marker.pos_x -= 100;
repaint();
}
}
else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
if (marker.index == 6) { }
else {
marker.index += 1;
marker.pos_x += 100;
repaint();
}
}
else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
// move game piece into position
curr_col = marker.index;
for (int i = NUM_ROWS - 1; i >= 0; i--) {
if (board_contents[i][curr_col] == Cell.EMPTY) {
curr_row = i;
if (curr_player == Cell.RED) {
board_contents[curr_row][curr_col] = Cell.RED;
repaint();
if (isVictory(board_contents, curr_player, curr_row, curr_col)) {
playing = false;
rwins++;
status.setText("Player 1 wins! \t\t"
+ " Player 1: " + Integer.toString(rwins)
+ "\t\t Player 2: " + Integer.toString(ywins));
try {
score.addScore(frame, board_contents, curr_player);
score.writeScores();
}
catch (Exception ex) { }
break;
}
// Checks for tie, high score
else if (isTie(board_contents)) {
playing = false;
status.setText("It's a tie! \t\t"
+ " Player 1: " + Integer.toString(rwins)
+ "\t\t Player 2: " + Integer.toString(ywins));
try {
score.displayScores(frame);
}
catch (Exception ex) { }
break;
}
//update(curr_player, board_contents, curr_row, curr_col);
curr_player = Cell.YELLOW;
status.setText("It's Player 2's turn! \t\t"
+ " Player 1: " + Integer.toString(rwins)
+ "\t Player 2: " + Integer.toString(ywins));
break;
}
else {
board_contents[curr_row][curr_col] = Cell.YELLOW;
repaint();
if (isVictory(board_contents, curr_player, curr_row, curr_col)) {
playing = false;
ywins++;
status.setText("Player 2 wins! \t\t"
+ " Player 1: " + Integer.toString(rwins)
+ "\t\t Player 2: " + Integer.toString(ywins));
try {
score.addScore(frame, board_contents, curr_player);
score.writeScores();
}
catch (Exception ex) { }
break;
}
// Checks for tie, high score
else if (isTie(board_contents)) {
playing = false;
status.setText("It's a tie! \t\t"
+ " Player 1: " + Integer.toString(rwins)
+ "\t\t Player 2: " + Integer.toString(ywins));
try {
score.displayScores(frame);
}
catch (Exception ex) { }
break;
}
//update(curr_player, board_contents, curr_row, curr_col);
curr_player = Cell.RED;
status.setText("It's Player 1's turn! \t\t"
+ " Player 1: " + Integer.toString(rwins)
+ "\t\t Player 2: " + Integer.toString(ywins));
break;
}
}
}
}
}
}
});
this.status = status;
}
/**
* (Re-)set the game to its initial state.
*/
public void restart() {
marker = new Marker();
board_contents = new Cell[NUM_ROWS][NUM_COLS];
for (int row = 0; row < NUM_ROWS; row++) {
for (int col = 0; col < NUM_COLS; col++) {
board_contents[row][col] = Cell.EMPTY;
}
}
repaint();
playing = true;
curr_player = Cell.RED;
status.setText("It's Player 1's turn! \t\t Player 1: " +
Integer.toString(rwins) + "\t\t Player 2: " + Integer.toString(ywins));
// Make sure that this component has the keyboard focus
requestFocusInWindow();
}
/**
* Checks for victory from current peg's position
* In 8 directions: 2 vertical, 2 horizontal, and 4 diagonal
*/
public static boolean isVictory(Cell[][] board_contents, Cell curr_player, int curr_row, int curr_col) {
// vertical down
if (curr_row + 3 < 6) {
if (board_contents[curr_row + 1][curr_col] == curr_player &&
board_contents[curr_row + 2][curr_col] == curr_player &&
board_contents[curr_row + 3][curr_col] == curr_player) {
return true;
}
}
// check entire row
int count = 0;
for (int col = 0; col < NUM_COLS; col++) {
if (board_contents[curr_row][col] == curr_player) {
count++;
if (count == 4) { return true; }
}
else {
count = 0;
}
}
// check up-left to down-right diagonals
// first diagonal
if (curr_row - 3 >= 0 && curr_col - 3 >= 0) {
if (board_contents[curr_row - 1][curr_col - 1] == curr_player &&
board_contents[curr_row - 2][curr_col - 2] == curr_player &&
board_contents[curr_row - 3][curr_col - 3] == curr_player) {
return true;
}
}
// second diagonal
if (curr_row - 2 >= 0 && curr_col - 2 >= 0 && curr_row + 1 < 6 && curr_col + 1 < 7) {
if (board_contents[curr_row + 1][curr_col + 1] == curr_player &&
board_contents[curr_row - 1][curr_col - 1] == curr_player &&
board_contents[curr_row - 2][curr_col - 2] == curr_player) {
return true;
}
}
// third diagonal
if (curr_row - 1 >= 0 && curr_col - 1 >= 0 && curr_row + 2 < 6 && curr_col + 2 < 7) {
if (board_contents[curr_row + 2][curr_col + 2] == curr_player &&
board_contents[curr_row + 1][curr_col + 1] == curr_player &&
board_contents[curr_row - 1][curr_col - 1] == curr_player) {
return true;
}
}
// fourth diagonal
if (curr_row + 3 < 6 && curr_col + 3 < 7) {
if (board_contents[curr_row + 1][curr_col + 1] == curr_player &&
board_contents[curr_row + 2][curr_col + 2] == curr_player &&
board_contents[curr_row + 3][curr_col + 3] == curr_player) {
return true;
}
}
// check down-left to up-right diagonals
// first diagonal
if (curr_row + 3 < 6 && curr_col - 3 >= 0) {
if (board_contents[curr_row + 1][curr_col - 1] == curr_player &&
board_contents[curr_row + 2][curr_col - 2] == curr_player &&
board_contents[curr_row + 3][curr_col - 3] == curr_player) {
return true;
}
}
// second diagonal
if (curr_row - 1 >= 0 && curr_col - 2 >= 0 && curr_row + 2 < 6 && curr_col + 1 < 7) {
if (board_contents[curr_row - 1][curr_col + 1] == curr_player &&
board_contents[curr_row + 1][curr_col - 1] == curr_player &&
board_contents[curr_row + 2][curr_col - 2] == curr_player) {
return true;
}
}
// third diagonal
if (curr_row - 2 >= 0 && curr_col - 1 >= 0 && curr_row + 1 < 6 && curr_col + 2 < 7) {
if (board_contents[curr_row - 2][curr_col + 2] == curr_player &&
board_contents[curr_row - 1][curr_col + 1] == curr_player &&
board_contents[curr_row + 1][curr_col - 1] == curr_player) {
return true;
}
}
// fourth diagonal
if (curr_row - 3 >= 0 && curr_col + 3 < 7) {
if (board_contents[curr_row - 1][curr_col + 1] == curr_player &&
board_contents[curr_row - 2][curr_col + 2] == curr_player &&
board_contents[curr_row - 3][curr_col + 3] == curr_player) {
return true;
}
}
// no victories
return false;
}
/**
* Checks for a tie
* (If there are no empty cells left)
*/
public static boolean isTie(Cell[][] board_contents) {
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 7; j++) {
if (board_contents[i][j] == Cell.EMPTY) { return false; }
}
}
return true;
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
setBackground(Color.LIGHT_GRAY);
// draw marker
marker.draw(g);
// draw gridlines
g.setColor(Color.BLUE);
for (int row = 0; row < NUM_ROWS; row++) {
g.fillRoundRect(0, CELL_SIZE * row - GRID_WIDTH/2 + 100,
BOARD_SIZE-1, GRID_WIDTH, GRID_WIDTH, GRID_WIDTH);
}
for (int col = 0; col < NUM_COLS; col++) {
g.fillRoundRect(CELL_SIZE * col - GRID_WIDTH/2, 100, GRID_WIDTH,
BOARD_SIZE - 101, GRID_WIDTH, GRID_WIDTH);
}
// iterate through board and draw red/yellow pieces as needed
for (int row = 0; row < NUM_ROWS; row++) {
for (int col = 0; col < NUM_COLS; col++) {
int x = col * 100 + 13;
int y = row * 100 + 110;
int circle_size = 75;
if (board_contents[row][col] == Cell.RED) {
g.setColor(Color.RED);
g.fillOval(x, y, circle_size, circle_size);
}
else if (board_contents[row][col] == Cell.YELLOW) {
g.setColor(Color.YELLOW);
g.fillOval(x, y, circle_size, circle_size);
}
}
}
}
@Override
public Dimension getPreferredSize() {
return new Dimension(BOARD_SIZE, BOARD_SIZE);
}
}
| [
"annaxtang@gmail.com"
] | annaxtang@gmail.com |
4922766ac1b4ed2a2fe0c5d64e84228da678fbf6 | 07f4b7f79de2dd784ae06cc80e1109b4d553772d | /woody-ding/src/main/java/com/woody/framework/ws/cxfspring/client/mobileInfo/MobileCodeWSHttpPost.java | 75291274e2e8da2885f9242f859ca4a01d701308 | [] | no_license | stevenchen1976/fine-woody | 7911c30794a3985cb4efbc454b577675214688c1 | 7ddc865b3c865cad8aecf0b3f4fc15bf3dff9ac2 | refs/heads/master | 2021-10-10T22:23:40.772607 | 2019-01-18T09:34:17 | 2019-01-18T09:34:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java |
package com.woody.framework.ws.cxfspring.client.mobileInfo;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*
*/
@WebService(name = "MobileCodeWSHttpPost", targetNamespace = "http://WebXml.com.cn/")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
ObjectFactory.class
})
public interface MobileCodeWSHttpPost {
/**
* <br /><h3>获得国内手机号码归属地省份、地区和手机卡类型信息</h3><p>输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID) 免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)。</p><br />
*
* @param mobileCode
* @param userID
* @return
* returns java.lang.String
*/
@WebMethod
@WebResult(name = "string", targetNamespace = "http://WebXml.com.cn/", partName = "Body")
public String getMobileCodeInfo(
@WebParam(name = "string", targetNamespace = "http://www.w3.org/2001/XMLSchema", partName = "mobileCode")
String mobileCode,
@WebParam(name = "string", targetNamespace = "http://www.w3.org/2001/XMLSchema", partName = "userID")
String userID);
/**
* <br /><h3>获得国内手机号码归属地数据库信息</h3><p>输入参数:无;返回数据:一维字符串数组(省份 城市 记录数量)。</p><br />
*
* @return
* returns com.woody.framework.ws.cxfspring.client.mobileInfo.ArrayOfString
*/
@WebMethod
@WebResult(name = "ArrayOfString", targetNamespace = "http://WebXml.com.cn/", partName = "Body")
public ArrayOfString getDatabaseInfo();
}
| [
"1093520060@qq.com"
] | 1093520060@qq.com |
3f12b2823a1ea0cdc6908a0ef20b5bce5b834739 | f0568343ecd32379a6a2d598bda93fa419847584 | /modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201308/ForecastError.java | 422b536a4f982f23064cf94aca58246d8e0ec3d1 | [
"Apache-2.0"
] | permissive | frankzwang/googleads-java-lib | bd098b7b61622bd50352ccca815c4de15c45a545 | 0cf942d2558754589a12b4d9daa5902d7499e43f | refs/heads/master | 2021-01-20T23:20:53.380875 | 2014-07-02T19:14:30 | 2014-07-02T19:14:30 | 21,526,492 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,568 | java |
package com.google.api.ads.dfp.jaxws.v201308;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
*
* Errors that can result from a forecast request.
*
*
* <p>Java class for ForecastError complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ForecastError">
* <complexContent>
* <extension base="{https://www.google.com/apis/ads/publisher/v201308}ApiError">
* <sequence>
* <element name="reason" type="{https://www.google.com/apis/ads/publisher/v201308}ForecastError.Reason" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ForecastError", propOrder = {
"reason"
})
public class ForecastError
extends ApiError
{
protected ForecastErrorReason reason;
/**
* Gets the value of the reason property.
*
* @return
* possible object is
* {@link ForecastErrorReason }
*
*/
public ForecastErrorReason getReason() {
return reason;
}
/**
* Sets the value of the reason property.
*
* @param value
* allowed object is
* {@link ForecastErrorReason }
*
*/
public void setReason(ForecastErrorReason value) {
this.reason = value;
}
}
| [
"jradcliff@google.com"
] | jradcliff@google.com |
685e64e42b7af2a2ebdd3dd1527edaa714bd1a19 | f82dbcf84bd6ccfc3478a67c1f8b4b8572e658ca | /src/main/java/com/zcy/message/entity/Page.java | f0d4e81f3c54bd59dc5ed311543e843635686d02 | [] | no_license | Azcy/MybatisDemo | 272a0fdf0d78ee2dc2270fd72406794f3fa6b823 | 3f195bb9e37ee0a9f0a7bfc86359c5abb371b280 | refs/heads/master | 2021-07-03T02:26:53.084217 | 2017-09-24T15:43:52 | 2017-09-24T15:43:52 | 104,197,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,812 | java | package com.zcy.message.entity;
/**
* 分页对应的实体类
*/
public class Page {
/**
* 总条数
*/
private int totalNumber;
/**
* 当前第几页
*/
private int currentPage;
/**
* 总页数
*/
private int totalPage;
/**
* 每页显示条数
*/
private int pageNumber = 5;
/**
* 数据库中limit的参数,从第几条开始取
*/
private int dbIndex;
/**
* 数据库中limit的参数,一共取多少条
*/
private int dbNumber;
/**
* 根据当前对象中属性值计算并设置相关属性值
*/
public void count() {
// 计算总页数
int totalPageTemp = this.totalNumber / this.pageNumber;
int plus = (this.totalNumber % this.pageNumber) == 0 ? 0 : 1;
totalPageTemp = totalPageTemp + plus;
if(totalPageTemp <= 0) {
totalPageTemp = 1;
}
this.totalPage = totalPageTemp;
// 设置当前页数
// 总页数小于当前页数,应将当前页数设置为总页数
if(this.totalPage < this.currentPage) {
this.currentPage = this.totalPage;
}
// 当前页数小于1设置为1
if(this.currentPage < 1) {
this.currentPage = 1;
}
// 设置limit的参数
this.dbIndex = (this.currentPage - 1) * this.pageNumber;
this.dbNumber = this.pageNumber;
}
public int getTotalNumber() {
return totalNumber;
}
public void setTotalNumber(int totalNumber) {
this.totalNumber = totalNumber;
this.count();
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getPageNumber() {
return pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
this.count();
}
public int getDbIndex() {
return dbIndex;
}
public void setDbIndex(int dbIndex) {
this.dbIndex = dbIndex;
}
public int getDbNumber() {
return dbNumber;
}
public void setDbNumber(int dbNumber) {
this.dbNumber = dbNumber;
}
@Override
public String toString() {
return "Page{" +
"totalNumber=" + totalNumber +
", currentPage=" + currentPage +
", totalPage=" + totalPage +
", pageNumber=" + pageNumber +
", dbIndex=" + dbIndex +
", dbNumber=" + dbNumber +
'}';
}
}
| [
"kowj728138@hotmail.com"
] | kowj728138@hotmail.com |
b4f096864a5131de399b0c2f61c09c19ce49440f | a9ca9a5a65419d03d7e86bf72ec0340cf22bff6b | /src/main/java/com/daoImpl/CartDaoImpl.java | 4c38bfe73c65c4151a7869fcca654606b39c8a15 | [] | no_license | chetan68/springapp | b8001b9b5cf28e87bd012f30c44032efc8c5ed1f | aeaa0925dafb2fe9737f39dcbb186826841c5122 | refs/heads/master | 2020-01-27T10:01:35.879213 | 2016-08-20T06:39:45 | 2016-08-20T06:39:45 | 66,132,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,206 | java | package com.daoImpl;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.model.Cart;
import com.model.Product;
import com.dao.CartDao;
@Repository
public class CartDaoImpl implements CartDao {
@Autowired
private SessionFactory sessionFactory;
@Transactional
public Cart getCartById(int id)
{
Session session = sessionFactory.openSession();
Cart cart = (Cart) session.load(Cart.class, id);
return cart;
}
@Transactional
public int insertRow(Cart ct) {
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.persist(ct);
tx.commit();
session.close();
return 1;
}
@SuppressWarnings("unchecked")
@Transactional
public List<Cart> getCartList(int registerid){
Session session = sessionFactory.openSession();
List<Cart> clist = session.createQuery("from Cart where registerid = " + registerid + " and cartstatus='pending'").list();
return clist;
}
}
| [
"chetan.java5@gmail.com"
] | chetan.java5@gmail.com |
1e0b469d64d2ab02c309fc98c4ef2f31b0568472 | 8b410c0f1faf7f962b855c41781d0c3784f2c73d | /src/main/java/com/newyeargift/service/impl/SweetServiceFileImpl.java | 57721c4b4c750a1bb00794de61cb8561b36ae965 | [] | no_license | VladGrin/NewYearGift | 771765ec5831ea64b1f5b0859258c6e41845daf3 | bbc1e2189026f0a53f49f8b10aa425a2aa8cca86 | refs/heads/master | 2020-04-09T12:03:45.499524 | 2018-12-21T14:05:57 | 2018-12-21T14:05:57 | 160,334,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,114 | java | package com.newyeargift.service.impl;
import com.newyeargift.model.sweets.Caramel;
import com.newyeargift.model.sweets.Chocolate;
import com.newyeargift.model.sweets.Jelly;
import com.newyeargift.model.sweets.Praline;
import com.newyeargift.repository.SweetRepository;
import com.newyeargift.repository.impl.SweetRepositoryImpl;
import com.newyeargift.service.SweetService;
import java.util.List;
public class SweetServiceFileImpl implements SweetService {
private SweetRepository sweetRepository = new SweetRepositoryImpl();
@Override
public List<Caramel> findAllCaramels() {
return sweetRepository.findAllCaramels();
}
@Override
public List<Chocolate> findAllChocolate() {
return sweetRepository.findAllChocolate();
}
@Override
public List<Jelly> findAllJelly() {
return sweetRepository.findAllJelly();
}
@Override
public List<Praline> findAllPraline() {
return sweetRepository.findAllPraline();
}
@Override
public void saveResultToFile(String result) {
sweetRepository.saveResultToFile(result);
}
}
| [
"vlad5855051@gmail.com"
] | vlad5855051@gmail.com |
ee0ad8eb18f5ecfe0da7e3c9491c650d38dcfc9f | 7de6ad085079553c845b59cdfb44cb4439359a90 | /src/main/java/com/shopper/model/ProductInfo.java | 76aca3a8eeba853fd9a455eecd8fcdbae616601c | [] | no_license | bvbsatish/ShoppingCart | 9bf07ac9609d88e318d0c3d93d5d2bde8c04202c | 1f7d588265783bfadce5be809c428d3de3345dd1 | refs/heads/master | 2022-12-22T13:20:54.988760 | 2019-09-05T10:14:47 | 2019-09-05T10:14:47 | 206,533,736 | 0 | 0 | null | 2022-12-16T11:17:55 | 2019-09-05T10:10:27 | HTML | UTF-8 | Java | false | false | 2,162 | java | package com.shopper.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name="product")
public class ProductInfo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GenericGenerator(name="product" , strategy="increment")
@GeneratedValue(generator="product")
@Column(name = "Product_Id")
private Long productId;
@Column(name = "Name")
private String name;
@Column(name = "Price")
private Double price;
@Column(name = "Available")
private Integer available;
@Column(name = "Description")
private String description;
@Column(name = "Manufacturer")
private String manufacturer;
@Column(name = "quantity")
private Long Qty;
@Column(name = "brand")
private String Brand ;
@Column(name = "product_code")
private String ProductCode ;
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Integer getAvailable() {
return available;
}
public void setAvailable(Integer available) {
this.available = available;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public Long getQty() {
return Qty;
}
public void setQty(Long qty) {
Qty = qty;
}
public String getBrand() {
return Brand;
}
public void setBrand(String brand) {
Brand = brand;
}
public String getProdctCode() {
return ProductCode;
}
public void setProdctCode(String prodctCode) {
ProductCode = prodctCode;
}
}
| [
"satishkumar0571@gmail.com"
] | satishkumar0571@gmail.com |
b9140c6281f5edc8b19090b92044c996ca32050c | 93e266cb81908ef660fc19575551faf0c5cb6e41 | /java/src/evaluacion1/VentanaActionListenerComun.java | 0b62de40d19155a9f138fed0c8c812a8ae912492 | [] | no_license | AmaroMartinez/git | 16c6752ffafc2b3bc67f7c1e544e3ebbea57dd98 | 3675e5cc396221d9ed0e858ac79a92f0d0c98ee0 | refs/heads/master | 2020-04-11T03:37:49.306076 | 2019-04-03T12:20:42 | 2019-04-03T12:20:42 | 161,483,725 | 2 | 0 | null | null | null | null | ISO-8859-10 | Java | false | false | 2,894 | java | package evaluacion1;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.SwingConstants;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPasswordField;
public class VentanaActionListenerComun extends JFrame implements ActionListener{
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JTextField textusuario;
private JLabel lblusuario;
private JLabel lblresultado;
private JPanel panel;
private JLabel lblpassword;
private JPasswordField pwdpassword;
private JButton btnok;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
VentanaActionListenerComun frame = new VentanaActionListenerComun();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public VentanaActionListenerComun() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 559, 127);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
panel = new JPanel();
contentPane.add(panel, BorderLayout.NORTH);
lblusuario = new JLabel("Usuario:");
panel.add(lblusuario);
textusuario = new JTextField();
textusuario.addActionListener(this);
textusuario.setText("Usuario");
textusuario.setHorizontalAlignment(SwingConstants.LEFT);
textusuario.setColumns(10);
panel.add(textusuario);
lblresultado = new JLabel("Anonimo");
lblresultado.setHorizontalAlignment(SwingConstants.CENTER);
lblresultado.setFont(new Font("Tahoma", Font.PLAIN, 18));
contentPane.add(lblresultado, BorderLayout.SOUTH);
lblpassword = new JLabel("Password:");
panel.add(lblpassword);
pwdpassword = new JPasswordField();
pwdpassword.addActionListener(this);
pwdpassword.setColumns(10);
pwdpassword.setText("1dw3");
panel.add(pwdpassword);
btnok = new JButton("Ok");
btnok.addActionListener(this);
panel.add(btnok);
}
@Override
public void actionPerformed(ActionEvent e) {
String usuario = textusuario.getText();
String password = new String(pwdpassword.getPassword());
String mensaje;
if (usuario.equals("1dw3") && password.equals("1dw3")) {
mensaje = "Bienvenido " + usuario;
lblresultado.setText(mensaje);
} else {
mensaje = "Usuario o contraseņa no validos ";
lblresultado.setText(mensaje);
}
}
}
| [
"amaromartinezangulo@gmail.com"
] | amaromartinezangulo@gmail.com |
24b91f0bc3068f576530a2f53c426031eca256af | 6c28eca2c33a275fb0008a51b8e5776a82f5904d | /Code/Hierarchy/src/net/unconventionalthinking/hierarchy/grammar/node/AExpressionThrowStatement.java | 1dd99b54fa0d8cf2cc2edff3e7adbb6d8b826e43 | [] | no_license | UnconventionalThinking/hierarchy | 17dc9e224595f13702b9763829e12fbce2c48cfe | de8590a29c19202c01d1a6e62ca92e91aa9fc6ab | refs/heads/master | 2021-01-19T21:28:29.793371 | 2014-12-19T03:16:24 | 2014-12-19T03:16:24 | 13,262,291 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,443 | java | /* Copyright 2012, 2013 Unconventional Thinking
*
* This file is part of Hierarchy.
*
* Hierarchy 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.
*
* Hierarchy 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 Hierarchy.
* If not, see <http://www.gnu.org/licenses/>.
*/
/* This file was generated by SableCC (http://www.sablecc.org/). */
package net.unconventionalthinking.hierarchy.grammar.node;
import net.unconventionalthinking.hierarchy.grammar.analysis.*;
@SuppressWarnings("nls")
public final class AExpressionThrowStatement extends PThrowStatement
{
private TThrow _throw_;
private PExpression _expression_;
private TSemi _semi_;
public AExpressionThrowStatement()
{
// Constructor
}
public AExpressionThrowStatement(
@SuppressWarnings("hiding") TThrow _throw_,
@SuppressWarnings("hiding") PExpression _expression_,
@SuppressWarnings("hiding") TSemi _semi_)
{
// Constructor
setThrow(_throw_);
setExpression(_expression_);
setSemi(_semi_);
}
@Override
public Object clone()
{
return new AExpressionThrowStatement(
cloneNode(this._throw_),
cloneNode(this._expression_),
cloneNode(this._semi_));
}
public void apply(Switch sw)
{
((Analysis) sw).caseAExpressionThrowStatement(this);
}
public TThrow getThrow()
{
return this._throw_;
}
public void setThrow(TThrow node)
{
if(this._throw_ != null)
{
this._throw_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._throw_ = node;
}
public PExpression getExpression()
{
return this._expression_;
}
public void setExpression(PExpression node)
{
if(this._expression_ != null)
{
this._expression_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._expression_ = node;
}
public TSemi getSemi()
{
return this._semi_;
}
public void setSemi(TSemi node)
{
if(this._semi_ != null)
{
this._semi_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._semi_ = node;
}
@Override
public String toString()
{
return ""
+ toString(this._throw_)
+ toString(this._expression_)
+ toString(this._semi_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._throw_ == child)
{
this._throw_ = null;
return;
}
if(this._expression_ == child)
{
this._expression_ = null;
return;
}
if(this._semi_ == child)
{
this._semi_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._throw_ == oldChild)
{
setThrow((TThrow) newChild);
return;
}
if(this._expression_ == oldChild)
{
setExpression((PExpression) newChild);
return;
}
if(this._semi_ == oldChild)
{
setSemi((TSemi) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}
| [
"github@unconventionalthinking.com"
] | github@unconventionalthinking.com |
244811d1413ec3d65a66502133b9b8bee8da99b8 | a6f6c459f5ff305ba86fccf126ec811b94d761d5 | /yto/yto-bm-api/src/main/java/com/etai/yto/model/integral/IntegralRuleInfoModel.java | a6a5f948eec3c2e83f0408b414e518263b4ea420 | [] | no_license | hanlin16/zhitong | bd9bd424490225cf7293e51225e95d5c0bf1c939 | 26319b4d352a2b2bf870e0bf0bc3553e6a0805b1 | refs/heads/master | 2020-04-12T02:45:04.039848 | 2018-12-19T05:56:40 | 2018-12-19T05:56:40 | 162,252,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,057 | java | package com.etai.yto.model.integral;
import java.io.Serializable;
/**
* 积分信息
* @author king
*
*/
public class IntegralRuleInfoModel implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private int id; //主键
private String partyCode; //当事人编码
private String name; //当事人名字
private String partyPhoneNo; //当事人手机号
private int integralIncome; //收入积分
private int integralUsable; //可用积分
private int integralPayout; //已提积分
private int integralLock; //冻结积分
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPartyCode() {
return partyCode;
}
public void setPartyCode(String partyCode) {
this.partyCode = partyCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPartyPhoneNo() {
return partyPhoneNo;
}
public void setPartyPhoneNo(String partyPhoneNo) {
this.partyPhoneNo = partyPhoneNo;
}
public int getIntegralIncome() {
return integralIncome;
}
public void setIntegralIncome(int integralIncome) {
this.integralIncome = integralIncome;
}
public int getIntegralUsable() {
return integralUsable;
}
public void setIntegralUsable(int integralUsable) {
this.integralUsable = integralUsable;
}
public int getIntegralPayout() {
return integralPayout;
}
public void setIntegralPayout(int integralPayout) {
this.integralPayout = integralPayout;
}
public int getIntegralLock() {
return integralLock;
}
public void setIntegralLock(int integralLock) {
this.integralLock = integralLock;
}
@Override
public String toString() {
return "IntegralRuleInfoModel [id=" + id + ", partyCode=" + partyCode + ", name=" + name + ", partyPhoneNo="
+ partyPhoneNo + ", integralIncome=" + integralIncome + ", integralUsable=" + integralUsable
+ ", integralPayout=" + integralPayout + ", integralLock=" + integralLock + "]";
}
}
| [
"liuxuedong@ddyunf.com"
] | liuxuedong@ddyunf.com |
85f0430c05edd1f80dc543a12766541e3d8f6166 | cabb06c897a7b05b08d0f462ae6d3b54a309c95d | /objectbox-java/src/main/java/io/objectbox/reactive/DataSubscriptionImpl.java | ced207000e400e67e54cb54e1c9b8b839d06a39a | [
"Apache-2.0"
] | permissive | ptjuanramos/objectbox-java | 5f2c8a780ca239e52a48d6d447b5cedf6132c4dd | 92e5f702a2935917fa7e7b8d616a68626487fa64 | refs/heads/master | 2020-03-18T09:49:35.985590 | 2018-05-24T14:47:31 | 2018-05-24T14:47:31 | 134,581,938 | 0 | 0 | null | 2018-05-23T14:30:06 | 2018-05-23T14:30:05 | null | UTF-8 | Java | false | false | 1,638 | java | /*
* Copyright 2017 ObjectBox Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.objectbox.reactive;
import javax.annotation.Nullable;
class DataSubscriptionImpl<T> implements DataSubscription {
private volatile boolean canceled;
private DataPublisher<T> publisher;
private Object publisherParam;
private DataObserver<T> observer;
DataSubscriptionImpl(DataPublisher<T> publisher, @Nullable Object publisherParam, DataObserver<T> observer) {
this.publisher = publisher;
this.publisherParam = publisherParam;
this.observer = observer;
}
@Override
public synchronized void cancel() {
canceled = true;
if (publisher != null) {
publisher.unsubscribe(observer, publisherParam);
// Clear out all references, so apps can hold on to subscription object without leaking
publisher = null;
observer = null;
publisherParam = null;
}
}
public boolean isCanceled() {
return canceled;
}
}
| [
"ptjuanramos@gmail.com"
] | ptjuanramos@gmail.com |
da6335ccd6549ee0e23ea9c4f52309214c751f19 | 73a3069b83d3e81616c72b423a63c7dc662adf16 | /src/main/java/pl/kubaretip/cpo/api/repository/CategoryRepository.java | d19dad630389f9cf73208918d76466ec6503c4a0 | [] | no_license | kubAretip/company-products-orders-api | 5481fee75b5113248386173208c02d8e81136182 | 5a24e04fab2cdcf0c74bcfb754bccc1c7819af2e | refs/heads/master | 2023-03-14T04:20:47.295528 | 2021-03-11T18:59:49 | 2021-03-11T18:59:49 | 334,909,907 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | package pl.kubaretip.cpo.api.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import pl.kubaretip.cpo.api.domain.Category;
import java.util.List;
import java.util.Optional;
public interface CategoryRepository extends JpaRepository<Category, Long> {
@Query("SELECT c FROM Category c WHERE c.id=:id AND c.deleted = false")
Optional<Category> findById(@Param("id") long categoryId);
@Query("SELECT " +
"CASE WHEN COUNT(c) > 0 THEN true ELSE false END " +
"FROM Category c " +
"WHERE upper(c.name) = upper(:name) AND c.deleted = false")
boolean existsByName(@Param("name") String categoryName);
@Query("SELECT c FROM Category c WHERE UPPER(c.name) = UPPER(:name) and c.deleted = false")
Optional<Category> findByName(@Param("name") String categoryName);
@Query("SELECT c FROM Category c WHERE c.deleted = false")
List<Category> findAll();
}
| [
"pitjakub@gmail.com"
] | pitjakub@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.