blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
85744e68c04380743c3b400059acd14f8259d223
0f67dcb88d6e5889b0493a8d41645677bd041e0b
/Percipio/src/com/percipio/simple/WritingExcelSheet.java
0a5e0604271a91297ab15f653f231b16a06b5dcb
[]
no_license
cloakedsec/java-core-libs-spring-mvc
b80c3e98a11d41a93d494858762f4e3e61b1e298
7f7929845d07a142a5d8edfee777d0b44e0e6b1d
refs/heads/main
2023-03-04T03:41:08.067048
2021-02-16T10:27:53
2021-02-16T10:27:53
339,340,292
0
0
null
2021-02-16T09:06:09
2021-02-16T09:05:59
null
UTF-8
Java
false
false
805
java
package com.percipio.simple; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class WritingExcelSheet { public static void main(String[] args) throws IOException { File src = new File("D:\\workspace\\Percipio\\Files\\Data.xlsx"); FileInputStream fis = new FileInputStream(src); XSSFWorkbook wb = new XSSFWorkbook(fis); XSSFSheet sheet1 = wb.getSheetAt(0); // first cell sheet1.getRow(0).createCell(2).setCellValue("Pass"); // second cell sheet1.getRow(1).createCell(2).setCellValue("Fail"); FileOutputStream fout = new FileOutputStream(src); wb.write(fout); wb.close(); fis.close(); } }
a3de822cae59d2da3953cf241e01d1a8e09ed2b2
8e7854c4511b10ce35b459b73b412ddf8c554a08
/src/main/java/com/company/homemaking/consumer/entity/Coupon.java
611110a2abd404ba0051ec57f3607465c5cb2244
[]
no_license
DongbinHu/homemaking
7959e0470838af0f276540a3b58cc1a3328047cf
5c611d3bf0b9810a27389890c702de261d23b9d1
refs/heads/main
2023-08-16T00:45:20.623127
2023-08-08T09:24:19
2023-08-08T09:24:19
263,874,923
0
0
null
null
null
null
UTF-8
Java
false
false
1,625
java
package com.company.homemaking.consumer.entity; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.annotation.TableId; import java.time.LocalDateTime; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * <p> * 优惠券表 * </p> * * @author liubangzi * @since 2020-05-14 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("tb_coupon") public class Coupon extends Model<Coupon> { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 名称 */ private String name; /** * 面值 */ private BigDecimal value; /** * 编码 */ private String code; /** * 验证码 */ private String checkCode; /** * 使用说明 */ private String description; /** * 0-面值代金券/1-计次劵 */ private Integer type; /** * 0-不可用/1-可用/2-已使用/3-已过期/4-已注销 */ private Integer status; /** * 创建时间 */ private LocalDateTime createDate; /** * 状态修改时间 */ private LocalDateTime updateDate; /** * 是否删除(0正常/1已删除) */ private Boolean ifDelete; @Override protected Serializable pkVal() { return this.id; } }
0acea535d15e9b65f1303971049dcf540583f0f2
e0f032ca16b6398d810f194eae0479438b707cb0
/app/src/main/java/com/example/administrator/otostore/Activity/WalletChangeActivity.java
9c57f4743604e12c23fcf3a49435e4bee04800b0
[]
no_license
liang979zhang/OTOStore
fe9350ff9f15238ed46000a94b52ec6fb3f3e583
fc5970b03e640c68fc116694ee43671888c1a31e
refs/heads/master
2020-03-27T10:08:03.442791
2018-08-28T05:44:54
2018-08-28T05:44:54
146,397,530
0
0
null
null
null
null
UTF-8
Java
false
false
24,527
java
package com.example.administrator.otostore.Activity; import android.content.Context; import android.os.Bundle; import android.support.design.widget.CoordinatorLayout; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.adorkable.iosdialog.ActionSheetDialog; import com.apkfuns.logutils.LogUtils; import com.example.administrator.otostore.Bean.BankCarSelectBean; import com.example.administrator.otostore.Bean.CategroyBean; import com.example.administrator.otostore.Bean.MessageEvent; import com.example.administrator.otostore.Bean.MyEventCode; import com.example.administrator.otostore.Bean.SelectFriendsUserIdBean; import com.example.administrator.otostore.R; import com.example.administrator.otostore.RxJavaUtils.RetrofitHttpUtil; import com.example.administrator.otostore.Utils.GsonUtil; import com.example.administrator.otostore.Utils.MD5Utils; import com.example.administrator.otostore.Utils.SPUtils; import com.mchsdk.paysdk.retrofitutils.rxjava.observable.SchedulerTransformer; import com.mchsdk.paysdk.retrofitutils.rxjava.observer.BaseObserver; import org.greenrobot.eventbus.EventBus; import java.math.BigDecimal; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class WalletChangeActivity extends BaseActivity { @BindView(R.id.jinfenduihuanpas) EditText jinfenduihuanpas; @BindView(R.id.jinfenduihuaninput) EditText jinfenduihuaninput; @BindView(R.id.jifenduihuanok) Button jifenduihuanok; @BindView(R.id.jinfenduihuan) LinearLayout jinfenduihuan; @BindView(R.id.jinfenzhuanzhanguser) TextView jinfenzhuanzhanguser; @BindView(R.id.jinfenzhuanzhangpas) EditText jinfenzhuanzhangpas; @BindView(R.id.jinfenzhuanzhanginput) EditText jinfenzhuanzhanginput; @BindView(R.id.jinfenzhuanzhangremark) EditText jinfenzhuanzhangremark; @BindView(R.id.jinfenzhuanzhangok) Button jinfenzhuanzhangok; @BindView(R.id.jinfenzhuanzhang) LinearLayout jinfenzhuanzhang; @BindView(R.id.yuerzhuanzhanguser) TextView yuerzhuanzhanguser; @BindView(R.id.yuerzhuanzhangpas) EditText yuerzhuanzhangpas; @BindView(R.id.yuerzhuanzhanginput) EditText yuerzhuanzhanginput; @BindView(R.id.yuerzhuanzhangremark) EditText yuerzhuanzhangremark; @BindView(R.id.yuerzhuanzhangok) Button yuerzhuanzhangok; @BindView(R.id.yuerzhuanzhang) LinearLayout yuerzhuanzhang; @BindView(R.id.yuertixianuser) TextView yuertixianuser; @BindView(R.id.yuertixianpas) EditText yuertixianpas; @BindView(R.id.yuertixianinput) EditText yuertixianinput; @BindView(R.id.yuertixianremark) EditText yuertixianremark; @BindView(R.id.yuertixianok) Button yuertixianok; @BindView(R.id.yuertixian) LinearLayout yuertixian; private Context context; private String type; private Long bankselectid; private Long selectfriendsid; @Override public int getContentViewResId() { context = this; return R.layout.activity_wallet_change; } @Override public void initView() { Bundle bundle = getIntent().getExtras(); type = bundle.getString("WalletType"); if (type.equals("1")) { setcenterTitle("积分兑换"); jinfenduihuan.setVisibility(View.VISIBLE); } else if (type.equals("2")) { setcenterTitle("积分转账"); jinfenzhuanzhang.setVisibility(View.VISIBLE); } else if (type.equals("3")) { setcenterTitle("余额转账"); yuerzhuanzhang.setVisibility(View.VISIBLE); } else if (type.equals("4")) { setcenterTitle("余额提现"); yuertixian.setVisibility(View.VISIBLE); } } @Override public void leftbarclick() { super.leftbarclick(); finish(); } @Override public void initData() { } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TODO: add setContentView(...) invocation ButterKnife.bind(this); } @OnClick({R.id.jifenduihuanok, R.id.jinfenduihuan, R.id.jinfenzhuanzhangok, R.id.yuerzhuanzhangok, R.id.yuertixianok, R.id.jinfenzhuanzhanguser, R.id.yuerzhuanzhanguser, R.id.yuertixianuser }) public void onViewClicked(View view) { switch (view.getId()) { case R.id.yuerzhuanzhanguser: GetUserFriends(); LogUtils.d("1111111111"); break; case R.id.jinfenzhuanzhanguser: LogUtils.d("2222222222"); GetUserFriends(); break; case R.id.yuertixianuser: GetUserBankCardLst(); LogUtils.d("33333333333333"); break; case R.id.jifenduihuanok: if (isemepty(jinfenduihuanpas)) { showToast("请输入密码"); } else if (isemepty(jinfenduihuaninput)) { showToast("输入积分"); } else { DoIntegralExch(Integer.valueOf(getEdit(jinfenduihuaninput)), MD5Utils.encodeMD52(getEdit(jinfenduihuanpas))); } break; case R.id.jinfenduihuan: break; case R.id.jinfenzhuanzhangok: if (isemepty(jinfenzhuanzhanguser)) { showToast("收款用户不能为空"); } else if (isemepty(jinfenzhuanzhanginput)) { showToast("输入数值不能为空"); } else if (isemepty(jinfenzhuanzhangpas)) { showToast("密码不能为空"); } else { BonusTransfer(selectfriendsid, Integer.valueOf(getEdit(jinfenzhuanzhanginput)), MD5Utils.encodeMD52(getEdit(jinfenzhuanzhangpas)), getEdit(jinfenzhuanzhangremark)); } break; case R.id.yuerzhuanzhangok: if (isemepty(yuerzhuanzhanguser)) { showToast("收款用户不能为空"); } else if (isemepty(yuerzhuanzhanginput)) { showToast("输入数值不能为空"); } else if (isemepty(yuerzhuanzhangpas)) { showToast("密码不能为空"); } else { BalanceTransfer(selectfriendsid, BigDecimal.valueOf(Double.valueOf(getEdit(yuerzhuanzhanginput))), MD5Utils.encodeMD52(getEdit(yuerzhuanzhangpas)), getEdit(yuerzhuanzhangremark)); } break; case R.id.yuertixianok: if (isemepty(yuertixianuser)) { showToast("收款用户不能为空"); } else if (isemepty(yuertixianinput)) { showToast("输入数值不能为空"); } else if (isemepty(yuertixianpas)) { showToast("密码不能为空"); } else { DoWithDraw(bankselectid, BigDecimal.valueOf(Double.valueOf(getEdit(yuertixianinput))), MD5Utils.encodeMD52(getEdit(yuertixianpas)), getEdit(yuertixianremark)); } break; } } private boolean isemepty(TextView textView) { return textView.getText().toString().trim().isEmpty(); } private void DoWithDraw(Long BankCardID, BigDecimal WithDrawAmt, String PayPwd, String Remark) { RetrofitHttpUtil.getApiService() .DoWithDraw("", Long.valueOf(SPUtils.getUserId(context)), BankCardID, WithDrawAmt, PayPwd, Remark) .compose(SchedulerTransformer.<String>transformer()) .subscribe(new BaseObserver<String>() { @Override protected void onSuccess(String s) { LogUtils.d(s); CategroyBean bean = GsonUtil.parseJsonWithGson(s, CategroyBean.class); if (bean.getResult().equals("1")) { showToast("提现成功"); EventBus.getDefault().post(new MessageEvent(MyEventCode.CODE_B, "DuiHuanSucccess")); finish(); } else if (bean.getResult().equals("0")) { showToast("用户钱包不存在"); } else if (bean.getResult().equals("2")) { showToast("用户钱包尚未激活,请先激活钱包"); } else if (bean.getResult().equals("3")) { showToast("用户钱包已冻结,暂不允许使用"); } else if (bean.getResult().equals("4")) { showToast(",用户钱包已暂停使用,恢复之前不能使用"); } else if (bean.getResult().equals("5")) { showToast("用户支付密码尚未设置"); } else if (bean.getResult().equals("6")) { showToast("用户支付密码错误"); } else if (bean.getResult().equals("7")) { showToast("提现金额须为大于0的整数"); } else if (bean.getResult().equals("8")) { showToast("钱包余额扣除手续费后不足提现"); } else if (bean.getResult().equals("9")) { showToast("当前用户的银行卡不存在"); } else if (bean.getResult().equals("10")) { showToast("钱包不存在"); } else if (bean.getResult().equals("11")) { showToast(",插入余额明细失败"); } else if (bean.getResult().equals("12")) { showToast("变更钱包余额失败"); } else if (bean.getResult().equals("13")) { showToast("生成提现单失败"); } } }); } private void BalanceTransfer(long ToUserID, BigDecimal TransferAmt, String PayPwd, String Remark) { RetrofitHttpUtil.getApiService() .BalanceTransfer("", ToUserID, Long.valueOf(SPUtils.getUserId(context)), TransferAmt, PayPwd, Remark) .compose(SchedulerTransformer.<String>transformer()) .subscribe(new BaseObserver<String>() { @Override protected void onSuccess(String s) { LogUtils.d(s); CategroyBean bean = GsonUtil.parseJsonWithGson(s, CategroyBean.class); if (bean.getResult().equals("1")) { showToast("转账成功"); EventBus.getDefault().post(new MessageEvent(MyEventCode.CODE_B, "DuiHuanSucccess")); finish(); } else if (bean.getResult().equals("0")) { showToast("转入用户和转出用户不能相同;"); } else if (bean.getResult().equals("2")) { showToast("转入用户的钱包不存在;"); } else if (bean.getResult().equals("3")) { showToast("转入用户钱包尚未激活,请先激活钱包"); } else if (bean.getResult().equals("4")) { showToast("转入用户钱包已冻结,暂不允许使用"); } else if (bean.getResult().equals("5")) { showToast("转入用户钱包已暂停使用,恢复之前不能使用"); } else if (bean.getResult().equals("6")) { showToast("转出用户的钱包不存在"); } else if (bean.getResult().equals("7")) { showToast("转出用户钱包尚未激活,请先激活钱包"); } else if (bean.getResult().equals("8")) { showToast("转出用户钱包已冻结,暂不允许使用"); } else if (bean.getResult().equals("9")) { showToast("用户钱包已暂停使用,恢复之前不能使用"); } else if (bean.getResult().equals("10")) { showToast("用户支付密码尚未设置"); } else if (bean.getResult().equals("11")) { showToast("用户支付密码错误"); } else if (bean.getResult().equals("12")) { showToast("转出用户钱包余额不足"); } else if (bean.getResult().equals("13")) { showToast("钱包不存在"); } else if (bean.getResult().equals("14")) { showToast("插入余额明细失败"); } else if (bean.getResult().equals("15")) { showToast("变更钱包余额失败"); } else if (bean.getResult().equals("16")) { showToast("生成转账单失败"); } } }); } private String getEdit(TextView textView) { return textView.getText().toString().trim(); } private void BonusTransfer(long ToUserID, int TransferBonus, String PayPwd, String Remark) { RetrofitHttpUtil.getApiService() .BonusTransfer("", ToUserID, Long.valueOf(SPUtils.getUserId(context)), TransferBonus, PayPwd, Remark) .compose(SchedulerTransformer.<String>transformer()) .subscribe(new BaseObserver<String>() { @Override protected void onSuccess(String s) { LogUtils.d(s); CategroyBean bean = GsonUtil.parseJsonWithGson(s, CategroyBean.class); if (bean.getResult().equals("1")) { showToast("转账成功"); EventBus.getDefault().post(new MessageEvent(MyEventCode.CODE_B, "DuiHuanSucccess")); finish(); } else if (bean.getResult().equals("0")) { showToast("转入用户和转出用户不能相同;"); } else if (bean.getResult().equals("2")) { showToast("转入用户的钱包不存在;"); } else if (bean.getResult().equals("3")) { showToast("转入用户钱包尚未激活,请先激活钱包"); } else if (bean.getResult().equals("4")) { showToast("转入用户钱包已冻结,暂不允许使用"); } else if (bean.getResult().equals("5")) { showToast("转入用户钱包已暂停使用,恢复之前不能使用"); } else if (bean.getResult().equals("6")) { showToast("转出用户的钱包不存在"); } else if (bean.getResult().equals("7")) { showToast("转出用户钱包尚未激活,请先激活钱包"); } else if (bean.getResult().equals("8")) { showToast("转出用户钱包已冻结,暂不允许使用"); } else if (bean.getResult().equals("9")) { showToast("转出用户钱包已暂停使用,恢复之前不能使用"); } else if (bean.getResult().equals("10")) { showToast("转出用户支付密码尚未设置"); } else if (bean.getResult().equals("11")) { showToast("转出用户支付密码错误"); } else if (bean.getResult().equals("12")) { showToast("转出用户钱包余额不足"); } else if (bean.getResult().equals("13")) { showToast("钱包不存在"); } else if (bean.getResult().equals("14")) { showToast("插入转出/转入积分明细失败"); } else if (bean.getResult().equals("15")) { showToast("变更转出/转入钱包积分失败"); } else if (bean.getResult().equals("16")) { showToast("生成转账单失败"); } } }); } private void DoIntegralExch(int ExchAmt, String pass) { String remark = "积分兑换"; RetrofitHttpUtil.getApiService() .DoIntegralExch("", Long.valueOf(SPUtils.getUserId(context)), ExchAmt, pass, remark).compose(SchedulerTransformer.<String>transformer()) .subscribe(new BaseObserver<String>() { @Override protected void onSuccess(String s) { LogUtils.d(s); CategroyBean bean = GsonUtil.parseJsonWithGson(s, CategroyBean.class); if (bean.getResult().equals("1")) { showToast("积分兑换成功"); EventBus.getDefault().post(new MessageEvent(MyEventCode.CODE_B, "DuiHuanSucccess")); finish(); } else if (bean.getResult().equals("0")) { showToast("用户钱包不存在;"); } else if (bean.getResult().equals("2")) { showToast("用户钱包尚未激活,请先激活钱包;"); } else if (bean.getResult().equals("3")) { showToast("用户钱包已冻结,暂不允许使用"); } else if (bean.getResult().equals("4")) { showToast("用户钱包已暂停使用,恢复之前不能使用"); } else if (bean.getResult().equals("5")) { showToast("用户支付密码尚未设置"); } else if (bean.getResult().equals("6")) { showToast("用户支付密码错误"); } else if (bean.getResult().equals("7")) { showToast("兑换金额须为大于0的整数"); } else if (bean.getResult().equals("8")) { showToast("钱包剩余积分不足兑换"); } else if (bean.getResult().equals("9")) { showToast("钱包不存在"); } else if (bean.getResult().equals("10")) { showToast("插入积分/余额明细失败"); } else if (bean.getResult().equals("11")) { showToast("变更钱包积分/余额失败"); } else if (bean.getResult().equals("12")) { showToast("生成兑换单失败"); } } }); } private void GetUserFriends() { RetrofitHttpUtil.getApiService() .GetUserFriends("", SPUtils.getUserId(context)) .compose(SchedulerTransformer.<String>transformer()) .subscribe(new BaseObserver<String>() { @Override protected void onSuccess(String s) { LogUtils.d(s); if (!s.equals("")) { final List<SelectFriendsUserIdBean> beans = GsonUtil.parseJsonArrayWithGson(s, SelectFriendsUserIdBean.class); int slectnum = beans.size(); ActionSheetDialog sheetDialog = new ActionSheetDialog(context); sheetDialog.builder().setTitle("请选择好友").setCancelable(false).setCanceledOnTouchOutside(false); for (int i = 0; i < slectnum; i++) { sheetDialog.builder().addSheetItem(beans.get(i).getNickName(), ActionSheetDialog.SheetItemColor.Blue, new ActionSheetDialog.OnSheetItemClickListener() { @Override public void onClick(int which) { LogUtils.d("测试的" + which); selectfriendsid = Long.valueOf(beans.get(which - 1).getFriendUserID()); if (type.equals("2")) { jinfenzhuanzhanguser.setText(beans.get(which - 1).getNickName()); } else if (type.equals("3")) { yuerzhuanzhanguser.setText(beans.get(which - 1).getNickName()); } } }); } sheetDialog.builder().show(); } else { showToast("请添加好友"); } } }); } private void GetUserBankCardLst() { RetrofitHttpUtil.getApiService() .GetUserBankCardLst("", SPUtils.getUserId(context)) .compose(SchedulerTransformer.<String>transformer()) .subscribe(new BaseObserver<String>() { @Override protected void onSuccess(String s) { LogUtils.d(s); if (!s.equals("")) { final List<BankCarSelectBean> beans = GsonUtil.parseJsonArrayWithGson(s, BankCarSelectBean.class); int slectnum = beans.size(); ActionSheetDialog sheetDialog = new ActionSheetDialog(context); sheetDialog.builder().setTitle("请选择银行卡").setCancelable(false).setCanceledOnTouchOutside(false); for (int i = 0; i < slectnum; i++) { sheetDialog.builder().addSheetItem(beans.get(i).getBankName(), ActionSheetDialog.SheetItemColor.Blue, new ActionSheetDialog.OnSheetItemClickListener() { @Override public void onClick(int which) { LogUtils.d("测试的" + which); bankselectid = Long.valueOf(beans.get(which - 1).getBankCardID()); yuertixianuser.setText(beans.get(which - 1).getBankName()); } }); } sheetDialog.builder().show(); // for (int i = 0; i < beans.size(); i++) { // sheetDialog.builder().addSheetItem(beans.get(i).getBankName(), ActionSheetDialog.SheetItemColor.Blue, new ActionSheetDialog.OnSheetItemClickListener() { // @Override // public void onClick(int which) { // LogUtils.d(which+"测试"); // bankselectid=Long.valueOf(beans.get(which).getBankCardID()); // yuertixianuser.setText(beans.get(which).getBankName()); // } // }); // sheetDialog.builder().show(); // } }else { showToast("请添加银行卡"); } } }); } }
f1fc9afd620a52e121ff096b5147a24cc81bb799
c445642bc151f20c600e742d5cbee08b40b70eb6
/INDICIA/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/legacy/coreui/R.java
8d172bf969d0b30f5b57b47ca51a3c79ceac212c
[]
no_license
nazmulkhanliton/INDICIA_Android_Project_Update
5050e64e2a6fc295ae7eb29b47b9652b308f400d
a785732af857f5705125a429ecd1051d02b0fb05
refs/heads/main
2023-08-27T01:23:50.252895
2021-10-11T13:19:04
2021-10-11T13:19:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,395
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.legacy.coreui; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f040028; public static final int coordinatorLayoutStyle = 0x7f0400a7; public static final int font = 0x7f0400e8; public static final int fontProviderAuthority = 0x7f0400ea; public static final int fontProviderCerts = 0x7f0400eb; public static final int fontProviderFetchStrategy = 0x7f0400ec; public static final int fontProviderFetchTimeout = 0x7f0400ed; public static final int fontProviderPackage = 0x7f0400ee; public static final int fontProviderQuery = 0x7f0400ef; public static final int fontStyle = 0x7f0400f0; public static final int fontVariationSettings = 0x7f0400f1; public static final int fontWeight = 0x7f0400f2; public static final int keylines = 0x7f04011f; public static final int layout_anchor = 0x7f040125; public static final int layout_anchorGravity = 0x7f040126; public static final int layout_behavior = 0x7f040127; public static final int layout_dodgeInsetEdges = 0x7f040153; public static final int layout_insetEdge = 0x7f04015c; public static final int layout_keyline = 0x7f04015d; public static final int statusBarBackground = 0x7f0401c4; public static final int ttcIndex = 0x7f040228; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f06006f; public static final int notification_icon_bg_color = 0x7f060070; public static final int ripple_material_light = 0x7f06007b; public static final int secondary_text_default_material_light = 0x7f06007d; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f070053; public static final int compat_button_inset_vertical_material = 0x7f070054; public static final int compat_button_padding_horizontal_material = 0x7f070055; public static final int compat_button_padding_vertical_material = 0x7f070056; public static final int compat_control_corner_material = 0x7f070057; public static final int compat_notification_large_icon_max_height = 0x7f070058; public static final int compat_notification_large_icon_max_width = 0x7f070059; public static final int notification_action_icon_size = 0x7f0700c5; public static final int notification_action_text_size = 0x7f0700c6; public static final int notification_big_circle_margin = 0x7f0700c7; public static final int notification_content_margin_start = 0x7f0700c8; public static final int notification_large_icon_height = 0x7f0700c9; public static final int notification_large_icon_width = 0x7f0700ca; public static final int notification_main_column_padding_top = 0x7f0700cb; public static final int notification_media_narrow_margin = 0x7f0700cc; public static final int notification_right_icon_size = 0x7f0700cd; public static final int notification_right_side_padding_top = 0x7f0700ce; public static final int notification_small_icon_background_padding = 0x7f0700cf; public static final int notification_small_icon_size_as_large = 0x7f0700d0; public static final int notification_subtext_size = 0x7f0700d1; public static final int notification_top_pad = 0x7f0700d2; public static final int notification_top_pad_large_text = 0x7f0700d3; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f080089; public static final int notification_bg = 0x7f08008a; public static final int notification_bg_low = 0x7f08008b; public static final int notification_bg_low_normal = 0x7f08008c; public static final int notification_bg_low_pressed = 0x7f08008d; public static final int notification_bg_normal = 0x7f08008e; public static final int notification_bg_normal_pressed = 0x7f08008f; public static final int notification_icon_background = 0x7f080090; public static final int notification_template_icon_bg = 0x7f080091; public static final int notification_template_icon_low_bg = 0x7f080092; public static final int notification_tile_bg = 0x7f080093; public static final int notify_panel_notification_icon_bg = 0x7f080094; } public static final class id { private id() {} public static final int action_container = 0x7f0a002f; public static final int action_divider = 0x7f0a0031; public static final int action_image = 0x7f0a0032; public static final int action_text = 0x7f0a0038; public static final int actions = 0x7f0a0039; public static final int async = 0x7f0a003f; public static final int blocking = 0x7f0a0043; public static final int bottom = 0x7f0a0044; public static final int chronometer = 0x7f0a0057; public static final int end = 0x7f0a0073; public static final int forever = 0x7f0a007f; public static final int icon = 0x7f0a008b; public static final int icon_group = 0x7f0a008c; public static final int info = 0x7f0a0091; public static final int italic = 0x7f0a0093; public static final int left = 0x7f0a0097; public static final int line1 = 0x7f0a0098; public static final int line3 = 0x7f0a0099; public static final int none = 0x7f0a00b6; public static final int normal = 0x7f0a00b7; public static final int notification_background = 0x7f0a00b8; public static final int notification_main_column = 0x7f0a00b9; public static final int notification_main_column_container = 0x7f0a00ba; public static final int right = 0x7f0a00c8; public static final int right_icon = 0x7f0a00c9; public static final int right_side = 0x7f0a00ca; public static final int start = 0x7f0a00f1; public static final int tag_transition_group = 0x7f0a00fc; public static final int tag_unhandled_key_event_manager = 0x7f0a00fd; public static final int tag_unhandled_key_listeners = 0x7f0a00fe; public static final int text = 0x7f0a00ff; public static final int text2 = 0x7f0a0100; public static final int time = 0x7f0a011a; public static final int title = 0x7f0a011b; public static final int top = 0x7f0a011e; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f0b000f; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0d003d; public static final int notification_action_tombstone = 0x7f0d003e; public static final int notification_template_custom_big = 0x7f0d0045; public static final int notification_template_icon_group = 0x7f0d0046; public static final int notification_template_part_chronometer = 0x7f0d004a; public static final int notification_template_part_time = 0x7f0d004b; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f11002d; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f120116; public static final int TextAppearance_Compat_Notification_Info = 0x7f120117; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f120119; public static final int TextAppearance_Compat_Notification_Time = 0x7f12011c; public static final int TextAppearance_Compat_Notification_Title = 0x7f12011e; public static final int Widget_Compat_NotificationActionContainer = 0x7f1201c8; public static final int Widget_Compat_NotificationActionText = 0x7f1201c9; public static final int Widget_Support_CoordinatorLayout = 0x7f1201f8; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f040028 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] CoordinatorLayout = { 0x7f04011f, 0x7f0401c4 }; public static final int CoordinatorLayout_keylines = 0; public static final int CoordinatorLayout_statusBarBackground = 1; public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f040125, 0x7f040126, 0x7f040127, 0x7f040153, 0x7f04015c, 0x7f04015d }; public static final int CoordinatorLayout_Layout_android_layout_gravity = 0; public static final int CoordinatorLayout_Layout_layout_anchor = 1; public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2; public static final int CoordinatorLayout_Layout_layout_behavior = 3; public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4; public static final int CoordinatorLayout_Layout_layout_insetEdge = 5; public static final int CoordinatorLayout_Layout_layout_keyline = 6; public static final int[] FontFamily = { 0x7f0400ea, 0x7f0400eb, 0x7f0400ec, 0x7f0400ed, 0x7f0400ee, 0x7f0400ef }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0400e8, 0x7f0400f0, 0x7f0400f1, 0x7f0400f2, 0x7f040228 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
33ae5b6b20d0760c33cdbdb990d35d54eeb0bf59
e3119649e51648f890a77e787bed1d7b7d0a87a2
/Punto5.java
265732694c8be74d6fdcbca7eaa51e47e2fd4438
[]
no_license
FelipeCardona194/TallerDeRepaso
95ea502414e8762058fb446c79e04825de0fb5b1
990fa27b8bebf1ea2adb5f20cef38b85342d666f
refs/heads/main
2023-03-02T21:31:58.377827
2021-02-13T22:25:19
2021-02-13T22:25:19
338,681,985
0
0
null
null
null
null
UTF-8
Java
false
false
834
java
package com.mycompany.breve; import java.util.ArrayList; import javax.swing.JOptionPane; public class Punto5 { public static void main(String[] args) { ArrayList <String> Listado = new ArrayList <String>(); int num = Integer.parseInt(JOptionPane.showInputDialog(null, "Digte el numero que desea calcular")); int Factorial = 1; String ListadoX = "1"; for (int s = 2; s <= num; s++){ Factorial = Factorial * s; } for (int s = 1; s <= num; s++){ Listado.add ("" + s); } for (int s = 1; s < num; s++){ ListadoX += "x" + Listado.get (s); } JOptionPane.showMessageDialog(null, "El factorial de "+ num +" = "+ num + "! = "+ ListadoX + " = "+ Factorial); } }
2a6782d95a65fbc0ffb34a2b3db67790431d7f1b
7da2d12538ded6ba4f7c71c93a7e4aa1cafe44b1
/src/main/java/br/com/pedroyodasaito/softdesign/api/v1/controller/ContabilizaController.java
3ce9e1bee9c9a92998e511b8bd4afff5b1d87b16
[ "MIT" ]
permissive
pysjabr77/softdesign
d13a91a522b4349f2cb37f5b9cd5a6c882621577
ab6f1ec045f6580b6b5ddef8ddf1ca1427991782
refs/heads/main
2023-06-26T18:11:00.863027
2021-07-26T23:58:13
2021-07-26T23:58:13
387,588,774
0
0
null
null
null
null
UTF-8
Java
false
false
880
java
package br.com.pedroyodasaito.softdesign.api.v1.controller; import br.com.pedroyodasaito.softdesign.api.v1.dto.contabiliza.ContabilizacaoDTO; import br.com.pedroyodasaito.softdesign.service.ContabilizaService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/v1/contabiliza") public class ContabilizaController { private final ContabilizaService service; public ContabilizaController(ContabilizaService service) { this.service = service; } @GetMapping("{sessaoId}") public ContabilizacaoDTO obterContabilizacaoDaVotacao(@PathVariable Integer sessaoId){ return service.contabilizarVotacao(sessaoId); } }
0e874aab3ef9be2b46ca427fa263e510f766d3c3
d66be5471ac454345de8f118ab3aa3fe55c0e1ee
/sandbox-apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/OfferingClientLiveTest.java
6c7751909e638df12cf8bdfd6ed110ca5ada4cb7
[ "Apache-2.0" ]
permissive
adiantum/jclouds
3405b8daf75b8b45e95a24ff64fda6dc3eca9ed6
1cfbdf00f37fddf04249feedd6fc18ee122bdb72
refs/heads/master
2021-01-18T06:02:46.877904
2011-04-05T07:14:18
2011-04-05T07:14:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,966
java
/** * * Copyright (C) 2010 Cloud Conscious, LLC. <[email protected]> * * ==================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ==================================================================== */ package org.jclouds.cloudstack.features; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import java.util.Set; import org.jclouds.cloudstack.domain.DiskOffering; import org.jclouds.cloudstack.domain.NetworkOffering; import org.jclouds.cloudstack.domain.ServiceOffering; import org.jclouds.cloudstack.domain.StorageType; import org.jclouds.cloudstack.domain.TrafficType; import org.jclouds.cloudstack.options.ListDiskOfferingsOptions; import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions; import org.jclouds.cloudstack.options.ListServiceOfferingsOptions; import org.testng.annotations.Test; import com.google.common.collect.Iterables; /** * Tests behavior of {@code OfferingClient} * * @author Adrian Cole */ @Test(groups = "live", sequential = true, testName = "OfferingClientLiveTest") public class OfferingClientLiveTest extends BaseCloudStackClientLiveTest { public void testListDiskOfferings() throws Exception { Set<DiskOffering> response = client.getOfferingClient().listDiskOfferings(); assert null != response; long offeringCount = response.size(); assertTrue(offeringCount >= 0); for (DiskOffering offering : response) { DiskOffering newDetails = Iterables.getOnlyElement(client.getOfferingClient().listDiskOfferings( ListDiskOfferingsOptions.Builder.id(offering.getId()))); assertEquals(offering, newDetails); assertEquals(offering, client.getOfferingClient().getDiskOffering(offering.getId())); assert offering.getId() > 0 : offering; assert offering.getName() != null : offering; assert offering.getCreated() != null : offering; assert offering.getDisplayText() != null : offering; assert offering.getDiskSize() > 0 || (offering.getDiskSize() == 0 && offering.isCustomized()) : offering; assert offering.getTags() != null : offering; } } public void testListServiceOfferings() throws Exception { Set<ServiceOffering> response = client.getOfferingClient().listServiceOfferings(); assert null != response; long offeringCount = response.size(); assertTrue(offeringCount >= 0); for (ServiceOffering offering : response) { ServiceOffering newDetails = Iterables.getOnlyElement(client.getOfferingClient().listServiceOfferings( ListServiceOfferingsOptions.Builder.id(offering.getId()))); assertEquals(offering, newDetails); assert offering.getId() > 0 : offering; assert offering.getName() != null : offering; assert offering.getCreated() != null : offering; assert offering.getDisplayText() != null : offering; assert offering.getCpuNumber() > 0 : offering; assert offering.getCpuSpeed() > 0 : offering; assert offering.getMemory() > 0 : offering; assert offering.getStorageType() != null && StorageType.UNRECOGNIZED != offering.getStorageType() : offering; assert offering.getTags() != null : offering; } } public void testListNetworkOfferings() throws Exception { Set<NetworkOffering> response = client.getOfferingClient().listNetworkOfferings(); assert null != response; long offeringCount = response.size(); assertTrue(offeringCount >= 0); for (NetworkOffering offering : response) { NetworkOffering newDetails = Iterables.getOnlyElement(client.getOfferingClient().listNetworkOfferings( ListNetworkOfferingsOptions.Builder.id(offering.getId()))); assertEquals(offering, newDetails); assertEquals(offering, client.getOfferingClient().getNetworkOffering(offering.getId())); assert offering.getId() > 0 : offering; assert offering.getName() != null : offering; assert offering.getDisplayText() != null : offering; assert offering.getMaxConnections() == null || offering.getMaxConnections() > 0 : offering; assert offering.getTrafficType() != null && TrafficType.UNRECOGNIZED != offering.getTrafficType() : offering; assert offering.getTags() != null : offering; } } }
a53149e20b10c23e7d6696955cca596bb58a5d87
01e6d1818d905cec5e57644b791ed4d8344bd4f4
/app/src/main/java/com/haohao/xubei/ui/module/user/contract/UserPayContract.java
680ad22462f8daa1905741e715a5cb4b9fc3cfe7
[]
no_license
tracyly/XuBei
672ee01ab716107893410a677f0a11c8f3ed7b14
a637719b9191c436a3da223f17cb7f8437de06ed
refs/heads/master
2022-10-20T18:41:31.680719
2020-06-15T12:08:03
2020-06-15T12:08:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package com.haohao.xubei.ui.module.user.contract; import com.haohao.xubei.ui.module.base.IABaseContract; import java.util.ArrayList; /** * 订单支付 * date:2017/12/4 14:58 * author:Seraph * **/ public interface UserPayContract extends IABaseContract { interface View extends IBaseView { void selectPayType(String payType); void initView(ArrayList<String> amountList); } abstract class Presenter extends ABasePresenter<View> { } }
e0c00383d234e50b70c7f59e05dcbd7ee3265afb
c7fe7d0e49e82b3d80023a317a6abc8a60dd7526
/labs/lab3-paxos/src/dslabs/paxos/PaxosLogSlotStatus.java
a057ffcad5d8892e7969a0bf1e52677cb169ce00
[]
no_license
louy2/dslabs-handout
ed389a79ef2d4876f20fe997aea3537f89ca89fa
2817e1d25e00201e0cad9a9ede64f669c057b528
refs/heads/master
2020-06-12T17:28:28.001620
2019-06-29T06:25:32
2019-06-29T06:26:23
194,372,203
0
1
null
null
null
null
UTF-8
Java
false
false
361
java
package dslabs.paxos; public enum PaxosLogSlotStatus { EMPTY, // no command is known by the server for this slot ACCEPTED, // a command has been tentatively accepted by this server CHOSEN, // the server knows a command to be permanently chosen for this slot CLEARED; // the command in this slot has been garbage-collected at the server }
80f3ba677854cd840264f970e3ae289c818e959c
21a7663c063e29eb94fc08354acf300dcca801a1
/NorthDakota/src/org/one2team/highcharts/server/JSMLabels.java
b444f43ab2dccf147ee7d7fea14dbb349f131950
[ "Apache-2.0" ]
permissive
nabind/prism_test
91c9279aa23708ab29c9bac45f829a84f545e612
9b42b56cd3c108e8d4664aad4b96ed2c7d0f8e97
refs/heads/master
2020-06-18T17:56:19.875694
2016-11-29T23:44:10
2016-11-29T23:44:10
75,132,070
0
0
null
null
null
null
UTF-8
Java
false
false
1,490
java
package org.one2team.highcharts.server; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.one2team.highcharts.shared.Labels; import org.one2team.highcharts.shared.Style; import org.one2team.utils.JSMArray; @XmlAccessorType(XmlAccessType.NONE) @XmlType(namespace="chart-options") public class JSMLabels extends JSMBaseObject implements Labels { public JSMLabels () { } @SuppressWarnings("unchecked") @XmlTransient public JSMArray<Items> getItems () { if (items == null) items = new JSMArray<Items> (); return (JSMArray<Items>) items; } @XmlAccessorType(XmlAccessType.NONE) @XmlType(namespace="labels") public static class JSMItems implements Items { public JSMItems () { this.style = new JSMStyle (); } public String getHtml () { return this.html; } public Items setHtml (String html) { this.html = html; return this; } public Style getStyle () { return style; } public Items center (int centerPosition, double top) { getStyle ().setProperty ("left", centerPosition - (getHtml ().length () * 6) / 2 + "px"); getStyle ().setProperty ("top", top + "px"); return this; } private String html; private Style style; } @XmlTransient private Object items; }
e264847242a1cbefa74173f04fb0298c8e1e783b
b50cb4f1a1681ecf79c5fe6e58cc807708b1f772
/core/src/main/java/com/wuxp/payment/PlatformPaymentService.java
9c8de68789f74ea877938438631b32b6c347e5a8
[]
no_license
fengwuxp/fengwuxp-payment-plugins
34d23a4c52a2aca21ab9f1eea0a38cbaf0a7e829
36fd73b97d6d40a2e5939167ccb35f878a40ba31
refs/heads/master
2020-12-15T14:54:19.295053
2020-07-15T07:03:36
2020-07-15T07:03:36
235,146,484
1
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.wuxp.payment; import com.wuxp.payment.model.PlatformPaymentIdentity; /** * 平台支付服务,不同的支付平台可以实现对应的接口 * @author wxup */ public interface PlatformPaymentService extends PlatformPaymentIdentity, PaymentPlugin, PaymentNotifyProcessor { /** * 是否启用 * * @return */ default boolean isEnabled(){ return false; }; }
aa6ba71bb8b4d2f2a7d635be1a1586dcf71a6a51
bf475ac367e6e8948a080ddf97fe18533524f7b3
/app/src/main/java/com/example/android/instantloan/ContactUs.java
561a62d6e12ce91d3889be9ba11b31085577d6c9
[]
no_license
munthamaduguabdulkhadeer/MoneyLending
209822d1d58a72e2b20817ac180acbc75dd4f323
1da1a712744e25f1ca5786c8a085524fb435a814
refs/heads/master
2020-11-25T23:39:07.881279
2019-12-18T17:41:17
2019-12-18T17:41:17
228,891,613
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.example.android.instantloan; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class ContactUs extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contact_us); } }
2120129f3d382807e59efa262ae2a7cc2d01d1e1
1a4770c215544028bad90c8f673ba3d9e24f03ad
/second/quark/src/main/java/com/bumptech/glide/b/d/a/d.java
39c071e0958157a7e981c1f086dbfcf34afd69b2
[]
no_license
zhang1998/browser
e480fbd6a43e0a4886fc83ea402f8fbe5f7c7fce
4eee43a9d36ebb4573537eddb27061c67d84c7ba
refs/heads/master
2021-05-03T06:32:24.361277
2018-02-10T10:35:36
2018-02-10T10:35:36
120,590,649
8
10
null
null
null
null
UTF-8
Java
false
false
4,940
java
package com.bumptech.glide.b.d.a; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.support.v4.os.e; import android.util.Log; import com.bumptech.glide.b.b.au; import com.bumptech.glide.b.l; import com.bumptech.glide.b.m; import com.bumptech.glide.b.o; import com.bumptech.glide.util.f; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; /* compiled from: ProGuard */ public final class d implements o<Bitmap> { public static final l<Integer> a = l.a("com.bumptech.glide.load.resource.bitmap.BitmapEncoder.CompressionQuality", Integer.valueOf(90)); public static final l<CompressFormat> b = l.a("com.bumptech.glide.load.resource.bitmap.BitmapEncoder.CompressionFormat"); private static boolean a(au<Bitmap> auVar, File file, m mVar) { CompressFormat compressFormat; boolean z; Throwable th; Bitmap bitmap = (Bitmap) auVar.b(); CompressFormat compressFormat2 = (CompressFormat) mVar.a(b); if (compressFormat2 != null) { compressFormat = compressFormat2; } else if (bitmap.hasAlpha()) { compressFormat = CompressFormat.PNG; } else { compressFormat = CompressFormat.JPEG; } e.a("encode: [" + bitmap.getWidth() + "x" + bitmap.getHeight() + "] " + compressFormat); try { long a = f.a(); int intValue = ((Integer) mVar.a(a)).intValue(); OutputStream fileOutputStream; try { fileOutputStream = new FileOutputStream(file); try { bitmap.compress(compressFormat, intValue, fileOutputStream); fileOutputStream.close(); try { fileOutputStream.close(); z = true; } catch (IOException e) { z = true; } } catch (IOException e2) { try { Log.isLoggable("BitmapEncoder", 3); if (fileOutputStream == null) { z = false; } else { try { fileOutputStream.close(); z = false; } catch (IOException e3) { z = false; } } if (Log.isLoggable("BitmapEncoder", 2)) { new StringBuilder("Compressed with type: ").append(compressFormat).append(" of size ").append(com.bumptech.glide.util.l.a(bitmap)).append(" in ").append(f.a(a)).append(", options format: ").append(mVar.a(b)).append(", hasAlpha: ").append(bitmap.hasAlpha()); } e.a(); return z; } catch (Throwable th2) { th = th2; if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException e4) { } } throw th; } } } catch (IOException e5) { fileOutputStream = null; Log.isLoggable("BitmapEncoder", 3); if (fileOutputStream == null) { fileOutputStream.close(); z = false; } else { z = false; } if (Log.isLoggable("BitmapEncoder", 2)) { new StringBuilder("Compressed with type: ").append(compressFormat).append(" of size ").append(com.bumptech.glide.util.l.a(bitmap)).append(" in ").append(f.a(a)).append(", options format: ").append(mVar.a(b)).append(", hasAlpha: ").append(bitmap.hasAlpha()); } e.a(); return z; } catch (Throwable th3) { th = th3; fileOutputStream = null; if (fileOutputStream != null) { fileOutputStream.close(); } throw th; } if (Log.isLoggable("BitmapEncoder", 2)) { new StringBuilder("Compressed with type: ").append(compressFormat).append(" of size ").append(com.bumptech.glide.util.l.a(bitmap)).append(" in ").append(f.a(a)).append(", options format: ").append(mVar.a(b)).append(", hasAlpha: ").append(bitmap.hasAlpha()); } e.a(); return z; } catch (Throwable th4) { e.a(); } } public final com.bumptech.glide.b.d a(m mVar) { return com.bumptech.glide.b.d.TRANSFORMED; } }
eb205c44eb18c465712440d726081edc9bb25493
085df6882712fe8c345fb943ce418ceb399461a1
/app/src/main/java/com/imagecompressor/imagecompressor/MainActivity.java
507e85d1081ba91c0d067c44f198ce32ffffdce9
[]
no_license
shikha1992/ImageCompressor
25f30ac65d5ae5da730ee61537a2a12f439d98d7
e5b5ef9a5609741625049d57e0ec9ae9abc9237a
refs/heads/master
2020-08-09T15:00:31.352970
2019-10-10T07:05:45
2019-10-10T07:05:45
214,111,287
0
0
null
null
null
null
UTF-8
Java
false
false
15,093
java
package com.imagecompressor.imagecompressor; import android.Manifest; import android.app.ProgressDialog; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.amazonaws.mobileconnectors.s3.transferutility.TransferListener; import com.amazonaws.mobileconnectors.s3.transferutility.TransferObserver; import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; import com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility; import org.json.JSONException; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; import java.util.Random; import id.zelory.compressor.Compressor; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.functions.Consumer; import io.reactivex.schedulers.Schedulers; // import id.zelory.compressor.Compressor; // import io.reactivex.android.schedulers.AndroidSchedulers; // import io.reactivex.schedulers.Schedulers; public class MainActivity extends AppCompatActivity { private static final int PICK_IMAGE_REQUEST = 1; private ImageView actualImageView; private ImageView compressedImageView; private TextView actualSizeTextView; private TextView compressedSizeTextView; private File actualImage; private File compressedImage; TransferObserver observerthumb_user=null; ProgressDialog progressDialog; private TransferUtility transferUtility; Util util; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); util = new Util(); transferUtility = util.getTransferUtility(this); actualImageView = (ImageView) findViewById(R.id.actual_image); compressedImageView = (ImageView) findViewById(R.id.compressed_image); actualSizeTextView = (TextView) findViewById(R.id.actual_size); compressedSizeTextView = (TextView) findViewById(R.id.compressed_size); actualImageView.setBackgroundColor(getRandomColor()); clearImage(); } public void chooseImage(View view) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // // String messagesPermission1 = Manifest.permission.CAMERA; // // String messagesPermission2 = Manifest.permission.READ_EXTERNAL_STORAGE; // String messagesPermission3 = Manifest.permission.WRITE_EXTERNAL_STORAGE; // int hasaccesslocation4 = checkSelfPermission(messagesPermission1); // int hasaccesslocation3 = checkSelfPermission(messagesPermission2); // int hasaccesslocation2 =checkSelfPermission(messagesPermission3); // // List<String> permissions = new ArrayList<String>(); // if (hasaccesslocation4 != PackageManager.PERMISSION_GRANTED ||hasaccesslocation3 != PackageManager.PERMISSION_GRANTED ||hasaccesslocation2 != PackageManager.PERMISSION_GRANTED ) { // requestPermissions(new String[]{Manifest.permission.CAMERA,Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); // // return; // } // } // else { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, PICK_IMAGE_REQUEST); // } } public void compressImage(View view) { if (actualImage == null) { showError("Please choose an image!"); } else { // Compress image in main thread //compressedImage = new Compressor(this).compressToFile(actualImage); //setCompressedImage(); // Compress image to bitmap in main thread //compressedImageView.setImageBitmap(new Compressor(this).compressToBitmap(actualImage)); // Compress image using RxJava in background thread new Compressor(this) .compressToFileAsFlowable(actualImage) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer<File>() { @Override public void accept(File file) { compressedImage = file; setCompressedImage(); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) { throwable.printStackTrace(); showError(throwable.getMessage()); } }); } } public void customCompressImage(View view) { if (actualImage == null) { showError("Please choose an image!"); } else { // Compress image in main thread using custom Compressor try { compressedImage = new Compressor(this) .setMaxWidth(640) .setMaxHeight(480) .setQuality(50) .setCompressFormat(Bitmap.CompressFormat.WEBP) .setDestinationDirectoryPath(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES).getAbsolutePath()) .compressToFile(actualImage); setCompressedImage(); } catch (IOException e) { e.printStackTrace(); showError(e.getMessage()); } // Compress image using RxJava in background thread with custom Compressor /*new Compressor(this) .setMaxWidth(640) .setMaxHeight(480) .setQuality(75) .setCompressFormat(Bitmap.CompressFormat.WEBP) .setDestinationDirectoryPath(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES).getAbsolutePath()) .compressToFileAsFlowable(actualImage) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer<File>() { @Override public void accept(File file) { compressedImage = file; setCompressedImage(); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) { throwable.printStackTrace(); showError(throwable.getMessage()); } });*/ } } private void setCompressedImage() { compressedImageView.setImageBitmap(BitmapFactory.decodeFile(compressedImage.getAbsolutePath())); compressedSizeTextView.setText(String.format("Size : %s", getReadableFileSize(compressedImage.length()))); uploadThumbUserImg(compressedImage); Toast.makeText(this, "Compressed image save in " + compressedImage.getPath(), Toast.LENGTH_LONG).show(); Log.d("Compressor", "Compressed image save in " + compressedImage.getPath()); } private void clearImage() { actualImageView.setBackgroundColor(getRandomColor()); compressedImageView.setImageDrawable(null); compressedImageView.setBackgroundColor(getRandomColor()); compressedSizeTextView.setText("Size : -"); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK) { if (data == null) { showError("Failed to open picture!"); return; } try { actualImage = FileUtil.from(this, data.getData()); actualImageView.setImageBitmap(BitmapFactory.decodeFile(actualImage.getAbsolutePath())); actualSizeTextView.setText(String.format("Size : %s", getReadableFileSize(actualImage.length()))); clearImage(); } catch (IOException e) { showError("Failed to read picture data!"); e.printStackTrace(); } } } private Bitmap decodeFile(File f) { Bitmap b = null; //Decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; FileInputStream fis = null; try { fis = new FileInputStream(f); BitmapFactory.decodeStream(fis, null, o); fis.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } int IMAGE_MAX_SIZE = 1024; int scale = 1; if (o.outHeight > IMAGE_MAX_SIZE || o.outWidth > IMAGE_MAX_SIZE) { scale = (int) Math.pow(2, (int) Math.ceil(Math.log(IMAGE_MAX_SIZE / (double) Math.max(o.outHeight, o.outWidth)) / Math.log(0.5))); } //Decode with inSampleSize BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize = scale; try { fis = new FileInputStream(f); b = BitmapFactory.decodeStream(fis, null, o2); fis.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // Log.d(TAG, "Width :" + b.getWidth() + " Height :" + b.getHeight()); File destFile = new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + ".png"); try { FileOutputStream out = new FileOutputStream(destFile); b.compress(Bitmap.CompressFormat.PNG, 100, out); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } return b; } public void uploadThumbUserImg(File compressedImage) { if(observerthumb_user!=null){ observerthumb_user.cleanTransferListener(); } Bitmap bmp = decodeFile(compressedImage); ByteArrayOutputStream out = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.JPEG, 50, out); Bitmap decoded = BitmapFactory.decodeStream(new ByteArrayInputStream(out.toByteArray())); if(decoded.getWidth()>1200) { decoded.compress(Bitmap.CompressFormat.JPEG, 50, out); } else { decoded.compress(Bitmap.CompressFormat.JPEG, 80, out); } File destination = new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + ".jpg"); FileOutputStream fo; try { destination.createNewFile(); fo = new FileOutputStream(destination); fo.write(out.toByteArray()); fo.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } observerthumb_user = transferUtility.upload("dailydeedclient", destination.getName(), destination); if(progressDialog!=null){ if(progressDialog.isShowing()){ progressDialog.dismiss(); } } progressDialog = new ProgressDialog(this); progressDialog.setMax(100); progressDialog.setMessage("Picture Uploading"); progressDialog.show(); progressDialog.setCancelable(true); String file_key = observerthumb_user.getKey(); observerthumb_user.setTransferListener(new UploadListenerThumb(file_key)); } private class UploadListenerThumb implements TransferListener { String file_key_name = ""; public UploadListenerThumb( String file_key ) { this.file_key_name = file_key; } // Simply updates the UI list when notified. @Override public void onError(int id, Exception e) { Log.e("err1:", e.toString()); if(progressDialog!=null) { progressDialog.dismiss(); } observerthumb_user.cleanTransferListener(); } @Override public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) { } @Override public void onStateChanged(int id, TransferState newState) { Log.e("state1: ",newState.toString()); if(newState.toString().equals("COMPLETED")) { if(progressDialog!=null) { progressDialog.dismiss(); } // Log.e("key: ",(String) transferRecordMaps.get(pos).get("key")); // Log.e("url1: ","https://s3-ap-southeast-1.amazonaws.com/beleadr/"+file_key_name); String imagee = "https://s3.amazonaws.com/dailydeedclient/"+file_key_name; Log.e("imageeee",imagee); observerthumb_user.cleanTransferListener(); // try { // uploadimage(); // } catch (JSONException e) { // e.printStackTrace(); // } } } } public void showError(String errorMessage) { Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT).show(); } private int getRandomColor() { Random rand = new Random(); return Color.argb(100, rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); } public String getReadableFileSize(long size) { if (size <= 0) { return "0"; } final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"}; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } }
9d2a2db7d08ad2b45ec6d5695614b1d8a9fa864b
bc6186f609e99fc22840ae2282efa45fc7257145
/petstore/petstore-api/src/main/java/com/demo/PetstoreApi.java
48534083c0c71f92981fb997157833598c24536d
[]
no_license
tayaee/learning
f19052a2b4ddfa9210580ff0c3114024ac8ba935
c93ca384b18ace94a250e60af5f5c34f9917e747
refs/heads/master
2020-03-17T22:37:35.820204
2018-06-04T01:55:39
2018-06-04T01:55:39
134,011,813
0
0
null
2018-05-20T06:16:10
2018-05-18T23:06:32
null
UTF-8
Java
false
false
393
java
package com.demo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class PetstoreApi { static final String VERSION = "v2"; private static Logger LOGGER = LoggerFactory.getLogger(PetstoreApi.class); static String getVersion() { return VERSION; } public static void main(String[] args) { LOGGER.info("Hello World " + getVersion()); } }
1e180f80ede2af62e4c11a5edbeb3a03ad4e554d
fbe57162b93d834e559f259424b79d514122fa51
/src/main/java/th/ac/kmitl/atm/DataSourceDB.java
71c47a6b3a12616676a959f3e1185750990bf508
[]
no_license
Panida-Ths/atm-spring-annotation
635bd72f1b8378148a67402e91cbf3b1616d2e32
ac5a1b01a7d75bbf4058c65de0c85938c2431b00
refs/heads/master
2022-12-24T02:04:15.639498
2020-10-09T09:48:53
2020-10-09T09:48:53
302,599,795
0
0
null
null
null
null
UTF-8
Java
false
false
577
java
package th.ac.kmitl.atm; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; import java.util.HashMap; import java.util.Map; @Component public class DataSourceDB implements DataSource { public Map<Integer,Customer> readCustomers() { Map<Integer,Customer> customers = new HashMap<>(); customers.put(1,new Customer(1,"Peter",1234,1000)); customers.put(2,new Customer(2,"Katherine",2345,2000)); customers.put(3,new Customer(3,"Chris",3456,3000)); return customers; } }
5fb2690ce57641e3123816e0bbbe2ad5488044ab
e18ef8c77bb505cd3aba4b5658d75e7db94c108d
/real-world application/jigsaw/.svn/pristine/5f/5fb2690ce57641e3123816e0bbbe2ad5488044ab.svn-base
93c4e39edc27e653673a865933c4a07168d4ed72
[ "BSD-3-Clause", "NCSA", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
huangshiyou/JMCR
54416032536d37d860f3fdb68d57b527c81fe838
814cc5d7684762cbe7e2ad4b4de8ec4f9f7bf5e7
refs/heads/master
2021-01-20T22:12:05.484099
2018-05-14T21:46:13
2018-05-14T21:46:13
101,805,192
1
0
null
2017-12-01T23:27:59
2017-08-29T20:43:15
Java
UTF-8
Java
false
false
10,513
// PushCacheFilter.java // $Id: PushCacheFilter.java,v 1.2 2010/06/15 17:53:11 smhuang Exp $ // (c) COPYRIGHT MIT, INRIA and Keio, 2001. // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.www.protocol.http.cache.push; import java.net.URL; import org.w3c.www.http.HTTP; import org.w3c.www.protocol.http.Reply; import org.w3c.www.protocol.http.Request; import org.w3c.www.protocol.http.HttpException; import org.w3c.www.protocol.http.HttpManager; import org.w3c.www.protocol.http.PropRequestFilterException; import org.w3c.www.protocol.http.cache.CacheFilter; import org.w3c.www.protocol.http.cache.CacheSweeper; import org.w3c.www.protocol.http.cache.CachedResource; import org.w3c.www.protocol.http.cache.EntityCachedResource; import org.w3c.www.protocol.http.cache.InvalidCacheException; import org.w3c.www.protocol.http.cache.CacheState; import org.w3c.www.protocol.http.cache.CacheValidator; import org.w3c.www.protocol.http.cache.CacheSerializer; import org.w3c.www.protocol.http.cache.ActiveStream; /** * PushCacheFilter * Based heavily on (much code stolen from) CacheFilter * The important differences are in the initialization where the * PushCacheListener is started, and in ingoingFilter where if * the requested resource is present in the cache and is a PUSH * resource, then the resource is returned immediately without * checking for expiry etc. This allows us to insert pages from * "virtual" web sites such as http://www.push.data/sensor1.html * * @author Paul Henshaw, The Fantastic Corporation, [email protected] * @version $Revision: 1.2 $ * $Id: PushCacheFilter.java,v 1.2 2010/06/15 17:53:11 smhuang Exp $ */ public class PushCacheFilter extends CacheFilter { /** * Property name used to acquire port number for {@link PushCacheListener} * value is "org.w3c.www.protocol.http.cache.push.portnumber"; */ public static final String PORT_NUM_P = "org.w3c.www.protocol.http.cache.push.portnumber"; /** * Default port number to use if property value is not supplied * value is 9876 */ public static final int DEFAULT_PORT_NUM=9876; /** * Access to PushCacheStore */ public PushCacheStore getPushCacheStore() { return((PushCacheStore)super.getStore()); } /** * check if we can use the cache or not for this request * It marks the request as being not cachable if false. * @param a request, the incoming client-side request * @return a boolean, true if we can use the cache */ public boolean canUseCache(Request req) { return true; } /** * The request pre-processing hook. * Before each request is launched, all filters will be called back through * this method. They will generally set up additional request header * fields to enhance the request. * @param request The request that is about to be launched. * @return An instance of Reply if the filter could handle the request, * or <strong>null</strong> if processing should continue normally. * @exception HttpException If the filter is supposed to fulfill the * request, but some error happened during that processing. */ public Reply ingoingFilter(Request request) throws HttpException { // can we use the cache? if (!canUseCache(request)) { if (debug) { trace(request, "*** Can't use cache"); } // we will invalidate this resource, will do that only // on real entity resource, not on negotiated ones if (connected) { CachedResource res = null; EntityCachedResource invalidRes = null; try { String requrl = request.getURL().toExternalForm(); res = store.getCachedResourceReference(requrl); if (res != null) { invalidRes = (EntityCachedResource) res.lookupResource(request); } } catch (InvalidCacheException ex) { invalidRes = null; } if (invalidRes != null) { invalidRes.setWillRevalidate(true); } request.setState(STATE_NOCACHE, Boolean.TRUE); return null; } else { // disconnected, abort now! Reply reply = request.makeReply(HTTP.GATEWAY_TIMEOUT); reply.setContent("The cache cannot be use for " + "<p><code>"+request.getMethod()+"</code> " + "<strong>"+request.getURL()+"</strong>" + ". <p>It is disconnected."); return reply; } } // let's try to get the resource! String requrl = request.getURL().toExternalForm(); // in the pre-cache, wait for full download // FIXME should be better than this behaviour... // see EntityCachedResource perform's FIXME ;) if (precache.containsKey(requrl)) { if (debug) System.out.println("*** Already downloading: "+ requrl); try { CachedResource cr = (CachedResource)precache.get(requrl); return cr.perform(request); } catch (Exception ex) { // there was a problem with the previous request, // it may be better to do it by ourself } } CachedResource res = null; try { res = store.getCachedResourceReference(requrl); } catch (InvalidCacheException ex) { res = null; } // Is this a push resource ? try { if(PushCacheManager.instance().isPushResource(res)) { EntityCachedResource ecr=(EntityCachedResource) res.lookupResource(request); if(ecr!=null) { Reply reply = ecr.perform(request); return reply; } } } catch(Exception e) { e.printStackTrace(); } // /PSLH // are we disconnected? if (request.checkOnlyIfCached() || !connected ) { // and no entries... EntityCachedResource ecr = null; if (res != null) { ecr = (EntityCachedResource) res.lookupResource(request); } if ((res == null) || (ecr == null)) { if ( debug ) trace(request, "unavailable (disconnected)."); Reply reply = request.makeReply(HTTP.GATEWAY_TIMEOUT); reply.setContent("The cache doesn't have an entry for " + "<p><strong>"+request.getURL()+"</strong>" + ". <p>And it is disconnected."); return reply; } // yeah! if (debug) { trace(request, (connected) ? " hit - only if cached" : " hit while disconneced" ); } if (!validator.isValid(ecr, request)) { addWarning(request, WARN_STALE); } addWarning(request, WARN_DISCONNECTED); Reply reply = ecr.perform(request); // Add any warnings collected during processing to the reply: setWarnings(request, reply); //FIXME request.setState(STATE_HOW, HOW_HIT); return reply; } // in connected mode, we should now take care of revalidation and such if (res != null) { // if not fully loaded, ask for a revalidation FIXME if ((res.getLoadState() == CachedResource.STATE_LOAD_PARTIAL) || (res.getLoadState() == CachedResource.STATE_LOAD_ERROR)) { setRequestRevalidation(res, request); return null; } if ( validator.isValid(res, request) ) { try { store.updateResourceGeneration(res); } catch (InvalidCacheException ex) { // should be ok so... } //FIXME request.setState(STATE_HOW, HOW_HIT); Reply rep = res.perform(request); return rep; } else { if (debug) { System.out.println("*** Revalidation asked for " + requrl); } // ask for a revalidation setRequestRevalidation(res, request); return null; } } // lock here while we are waiting for the download while (uritable.containsKey(requrl)) { synchronized (uritable) { try { uritable.wait(); } catch (InterruptedException ex) {} } if (precache.containsKey(requrl)) { if (debug) System.out.println("*** Already downloading: "+ requrl); CachedResource cr = (CachedResource)precache.get(requrl); return cr.perform(request); } uritable.put(requrl, requrl); } return null; } /** * Almost identical to CacheFilter.initialize, but creates a * PushCacheStore instead of a CacheStore and additionaly * starts the PushCacheListener */ public void initialize(HttpManager manager) throws PropRequestFilterException { try { String validator_c; String sweeper_c; String serializer_c; props = manager.getProperties(); shared = props.getBoolean(SHARED_P, false); connected = props.getBoolean(CACHE_CONNECTED_P, true); debug = props.getBoolean(DEBUG_P, false); // now create the add-on classes validator_c = props.getString(VALIDATOR_P, "org.w3c.www.protocol.http.cache.SimpleCacheValidator"); sweeper_c = props.getString(SWEEPER_P, "org.w3c.www.protocol.http.cache.SimpleCacheSweeper"); serializer_c = props.getString(SERIALIZER_P, "org.w3c.www.protocol.http.cache.SimpleCacheSerializer"); try { Class c; c = Class.forName(validator_c); validator = (CacheValidator) c.newInstance(); //Added by Jeff Huang //TODO: FIXIT validator.initialize(this); c = Class.forName(sweeper_c); sweeper = (CacheSweeper) c.newInstance(); sweeper.initialize(this); c = Class.forName(serializer_c); serializer = (CacheSerializer) c.newInstance(); } catch (Exception ex) { // a fatal error! The cache won't be loaded... ex.printStackTrace(); throw new PropRequestFilterException("Unable to start cache"); } // now create the store as we have the basic things here store = new PushCacheStore(); try { store.initialize(this); } catch (InvalidCacheException ex) { // hum no worky, should do some action there! if (debug) { ex.printStackTrace(); } } // now start the sweeper sweeper.start(); // Start the ActiveStream handler: ActiveStream.initialize(); // Register for property changes: props.registerObserver(this); // Now, we are ready, register that filter: manager.setFilter(this); // // Create and start a PushCacheListener // int portNum=props.getInteger(PORT_NUM_P,DEFAULT_PORT_NUM); PushCacheListener listener=new PushCacheListener(portNum); listener.start(); // // Register this filter with the PushCacheManager // PushCacheManager.instance().registerFilter(this); } catch(Exception e) { e.printStackTrace(); } } }
398d62b49a3f103423287a9966cb313b098886f0
c8e22f68f3b4d3ff58077e98fdc3e386edddca28
/Drink1.java
a73517216634add5f24232bd4da6bf89c353baab
[]
no_license
jiu1209/java.sample2
ecf90c842bed18cec7883818ad41a926a35deca9
ef32dc169198372dbb53b73e89f7f51337f14d73
refs/heads/master
2023-01-04T01:50:39.232218
2020-11-01T07:49:12
2020-11-01T07:49:12
303,072,905
0
0
null
null
null
null
UTF-8
Java
false
false
1,450
java
import java.io.*; public class Drink1 { public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { System.out.println("飲み物は何が好きですか?"); System.out.println("1 オレンジジュース"); System.out.println("2 コーヒー"); System.out.println("3 ミルク"); System.out.println("4 どちらでもない"); System.out.println("1,2,3,4のどれかを選んでください。"); String line = reader.readLine(); int n = Integer.parseInt(line); switch (n) { case 1: System.out.println("オレンジジュースです。"); break; case 2: System.out.println("コーヒーです。"); break; case 3: System.out.println("ミルクです。"); break; default: System.out.println("どちらでもありません。"); break; } } catch (IOException e) { System.out.println(e); } catch (NumberFormatException e) { System.out.println("数字の形式が正しくありません。"); } } }
17c7ff2b052ed090ed8de3d0444b9eeae7b606cf
840d3b0052743882665b5a450104fdd9f3014a2f
/JAVA/maps/src/com/ustglobal/maps/Student.java
52a580bccba169b71f4ae15614f15bee2c9c4bf9
[]
no_license
apoorva-1997/USTGlobal-16Sep19-Apoorva-N
8c0fcf96648df332762d6ca42174fda9f007b039
b3a1d7e144714df7eb08c024b009ce1ebdcc1c03
refs/heads/master
2023-01-23T16:14:51.603522
2019-12-21T13:21:18
2019-12-21T13:21:18
215,540,109
1
0
null
2023-01-07T17:57:17
2019-10-16T12:14:44
CSS
UTF-8
Java
false
false
224
java
package com.ustglobal.maps; public class Student { int id; String name; double marks; public Student(int id, String name, double marks) { super(); this.id = id; this.name = name; this.marks = marks; } }
ab41a27bd766d6ab589a48926d7c19d65a31a7cd
1c58a5cd41d9a2ee25502464087ef653bcc25109
/jedis/src/main/java/com/yl/test/TestDemo02.java
6f6190590432fff29c676a8f39ef9782d237c82c
[]
no_license
yanlele1994/testcode
a98675f44da462411de75f955d71502106f60455
30aea487466f648b7fad2699167c3fbfd12f4a5c
refs/heads/master
2023-06-26T23:31:51.782877
2021-07-27T13:50:07
2021-07-27T13:50:07
389,978,313
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package com.yl.test; import com.yl.utils.RedisUtils; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; public class TestDemo02 { public static void main(String[] args) { JedisPool jedisPool = RedisUtils.open("192.168.195.128", 6379); Jedis jedis = jedisPool.getResource(); jedis.flushDB(); String str1 = jedis.set("str1", "aaa"); System.out.println(str1); String v = jedis.get("str1"); System.out.println(v); jedis.close(); } }
337c7fe78f655eb4ecc3880caba2d53c937a64db
bdd11dcb99895d14385cb1b716091a4dd1342408
/eclipse-workspace/Servlet3.0Example/src/com/newpackage/MyServlet.java
b8b2dd558ac5cce2d4cd06a60d6c16dec4290f43
[]
no_license
Solankinikhil/DailyWork
0c3b1b4f0d477b55d290de89fb7db5d8658c979d
9a1e261e50e1a6292e5275027e7a5ce88cde23b9
refs/heads/master
2021-01-05T13:25:45.111641
2020-03-13T10:56:32
2020-03-13T10:56:32
241,034,104
0
0
null
null
null
null
UTF-8
Java
false
false
894
java
package com.newpackage; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class MyServlet */ @WebServlet("/MyServlet") public class MyServlet extends HttpServlet { public void task2() { System.out.println("from task2"); } public MyServlet() { System.out.println("from constructor"); } @Override public void init() throws ServletException { System.out.println("From init method"); } @Override protected void service(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { System.out.println("From service method"); task2(); } @Override public void destroy() { System.out.println("From destroy method"); } }
4f5e58e3b2e8d30478553614403502290d46e27c
62510fa67d0ca78082109a861b6948206252c885
/hihope_neptune-oh_hid/00_src/v0.3/third_party/icu/ohos_icu4j/src/main/java/ohos/global/icu/number/CurrencyPrecision.java
c3727c6fcc30376422a2b353bd58b320c76df596
[ "Apache-2.0", "LicenseRef-scancode-unicode", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "ICU" ]
permissive
dawmlight/vendor_oh_fun
a869e7efb761e54a62f509b25921e019e237219b
bc9fb50920f06cd4c27399f60076f5793043c77d
refs/heads/master
2023-08-05T09:25:33.485332
2021-09-10T10:57:48
2021-09-10T10:57:48
406,236,565
1
0
null
null
null
null
UTF-8
Java
false
false
1,721
java
/* GENERATED SOURCE. DO NOT MODIFY. */ // © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html#License package ohos.global.icu.number; import ohos.global.icu.util.Currency; /** * A class that defines a rounding strategy parameterized by a currency to be used when formatting * numbers in NumberFormatter. * * <p> * To create a CurrencyPrecision, use one of the factory methods on Precision. * * @see NumberFormatter * @hide exposed on OHOS */ public abstract class CurrencyPrecision extends Precision { /* package-private */ CurrencyPrecision() { } /** * Associates a currency with this rounding strategy. * * <p> * <strong>Calling this method is <em>not required</em></strong>, because the currency specified in * unit() or via a CurrencyAmount passed into format(Measure) is automatically applied to currency * rounding strategies. However, this method enables you to override that automatic association. * * <p> * This method also enables numbers to be formatted using currency rounding rules without explicitly * using a currency format. * * @param currency * The currency to associate with this rounding strategy. * @return A Precision for chaining or passing to the NumberFormatter rounding() setter. * @throws IllegalArgumentException for null Currency * @see NumberFormatter */ public Precision withCurrency(Currency currency) { if (currency != null) { return constructFromCurrency(this, currency); } else { throw new IllegalArgumentException("Currency must not be null"); } }; }
ec226b4b022155ac7ed54c8e818c3f6b1f239463
4afc19759978bc82f2750592bf8981a78624a1d8
/entrega4miniFramework/Parte2/miniFramework-Parte2/src/ds/calculator/Division.java
0741997da9f0fd66fde27833d0f7c6a37265cb70
[]
no_license
braissg13/JavaUvigo
d66fa4ad281182c1dd69db21022298360a35daad
f5b49c5c15be7293f08552c2aae6ff10ef1ac0ef
refs/heads/master
2021-01-11T20:12:23.903737
2017-01-15T22:50:56
2017-01-15T22:50:56
79,064,678
0
0
null
null
null
null
UTF-8
Java
false
false
938
java
package ds.calculator; import java.util.Arrays; import java.util.List; import ds.miniframework.Aplicacion; import ds.miniframework.Operacion; public class Division extends Operacion{ public Division() { super("Division", Arrays.asList(new String[] {"dividendo", "divisor"})); // TODO Auto-generated constructor stub } public String operar(List<String> listaParametros) { Aplicacion ap = new Calculadora(); Division div = new Division(); div.addObserver(ap); div.notifyObservers(0); long data = System.currentTimeMillis(); Double resultado; resultado = (Double.parseDouble(listaParametros.get(0)) / Double.parseDouble(listaParametros.get(1))); long actual = System.currentTimeMillis()-data; if (actual>1){ System.out.println("En ejecucion durante..."+actual+"ms"); div.notifyObservers(1); } div.notifyObservers(2); return "" + resultado; } }
250ce1d115f721a831e46d84521a8cde257d2d40
bbdc9ef799d0069bd72ca0374585dae2cad497bd
/cj_test/src/com/igeek/service/impl/SpecialServiceImpl.java
2c0b5da436481304198626722c5343b71545968c
[]
no_license
xiaohe1008/chenProject
926c0011268c7b783fab91f3d6ec81434f2d8d46
f0f775a2b4a78ac0a98ba198739e71f47877d11e
refs/heads/master
2020-08-18T22:12:47.055736
2019-10-18T03:18:29
2019-10-18T03:18:29
215,840,340
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package com.igeek.service.impl; import java.util.List; import com.igeek.dao.ISpecialDao; import com.igeek.factory.DaoFactory; import com.igeek.pojo.Special; import com.igeek.service.ISpecialService; /** * 专辑的业务层实现类 * @author Administrator * */ public class SpecialServiceImpl implements ISpecialService { private ISpecialDao specialDao = DaoFactory.getProxyDao(ISpecialDao.class); @Override public List<Special> findAll() { return specialDao.findAll(); } @Override public Special findById(int specialId) { return specialDao.findById(specialId); } @Override public List<Special> findByName(String specialName) { return specialDao.findByName(specialName); } }
967e0f5e0666f57cd18aa35b445a253f64b533f0
b3203715a5a988c17d2103284ad5da03f1baf8af
/src/main/java/org/jhipster/myapp/ApplicationWebXml.java
a9000508b620bf04c738de25d8600d2728b7f23c
[]
no_license
omsab/Microservices-Demo
897f6d771f47c97f9420ba37afe641183ce369ae
07946680561600b5110d90b77a517fb6f5e1960a
refs/heads/master
2022-12-31T08:18:31.183959
2019-01-03T13:29:20
2019-01-03T13:29:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
830
java
package org.jhipster.myapp; import org.jhipster.myapp.config.DefaultProfileUtil; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; /** * This is a helper Java class that provides an alternative to creating a web.xml. * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc. */ public class ApplicationWebXml extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { /** * set a default to use when no profile is configured. */ DefaultProfileUtil.addDefaultProfile(application.application()); return application.sources(JeeGatewayApp.class); } }
c052b6583dda815611b321bd6c70a933367e38cb
cf729a7079373dc301d83d6b15e2451c1f105a77
/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201509/express/KeywordGroup.java
c8b1e552c923564dab177aeddf38263215efceea
[]
no_license
cvsogor/Google-AdWords
044a5627835b92c6535f807ea1eba60c398e5c38
fe7bfa2ff3104c77757a13b93c1a22f46e98337a
refs/heads/master
2023-03-23T05:49:33.827251
2021-03-17T14:35:13
2021-03-17T14:35:13
348,719,387
0
0
null
null
null
null
UTF-8
Java
false
false
1,650
java
package com.google.api.ads.adwords.jaxws.v201509.express; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import com.google.api.ads.adwords.jaxws.v201509.cm.Criterion; /** * * A {@link Criterion} for keyword groups. * <span class="constraint AdxEnabled">This is disabled for AdX when it is contained within Operators: ADD, SET.</span> * * * <p>Java class for KeywordGroup complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="KeywordGroup"> * &lt;complexContent> * &lt;extension base="{https://adwords.google.com/api/adwords/cm/v201509}Criterion"> * &lt;sequence> * &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "KeywordGroup", propOrder = { "name" }) public class KeywordGroup extends Criterion { protected String name; /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } }
5cbf0a6d71a8702b27341154b0d30a7ace0d5c0e
22562b1e394f4d9be0b9f666ce28c430ab350c32
/teste/src/main/java/services/JantarService.java
5504d7e77ac47aa81daf4d2af9d3b7c1ebea854b
[]
no_license
polianacorreia/delivery
ec29e7215c097eeceda6929efbdb52f67745cd62
ab6a1e3447ffad8efd40b0af963568dceb378a0e
refs/heads/master
2020-03-25T11:00:15.653814
2018-12-11T20:13:22
2018-12-11T20:13:22
143,715,211
0
0
null
null
null
null
UTF-8
Java
false
false
1,398
java
package services; import java.io.Serializable; import java.util.List; import javax.inject.Inject; import DAO.JantarDAO; import Poo.ed.Jantar; import util.TransacionalCdi; public class JantarService implements Serializable, Service<Jantar> { /** * */ private static final long serialVersionUID = -7803325791425670859L; @Inject private JantarDAO userDAO; /* (non-Javadoc) * @see br.edu.ifpb.esperanca.daw2.services.Service#save(br.edu.ifpb.esperanca.daw2.ifoto.entities.Usuario) */ @TransacionalCdi public void save(Jantar user) { userDAO.save(user); } /* (non-Javadoc) * @see br.edu.ifpb.esperanca.daw2.services.Service#update(br.edu.ifpb.esperanca.daw2.ifoto.entities.Usuario, boolean) */ @TransacionalCdi public void update(Jantar user) { userDAO.update(user); } /* (non-Javadoc) * @see br.edu.ifpb.esperanca.daw2.services.Service#delete(br.edu.ifpb.esperanca.daw2.ifoto.entities.Usuario) */ @TransacionalCdi public void remove(Jantar user) { userDAO.remove(user); } /* (non-Javadoc) * @see br.edu.ifpb.esperanca.daw2.services.Service#getByID(long) */ public Jantar getByID(long userId) { return userDAO.getByID(userId); } /* (non-Javadoc) * @see br.edu.ifpb.esperanca.daw2.services.Service#getAll() */ public List<Jantar> getAll() { return userDAO.getAll(); } }
[ "Aluno@DESKTOP-LDNVJ6K" ]
Aluno@DESKTOP-LDNVJ6K
624d572530c6033441933d2d675ecaabfc9bb623
6d6fe7d140bcc1841633e543e1ac70fbe4f3ef63
/Practica_4_EXTRA/garciavian0Extra/practicaExtra/src/icc/impresoraBinaria/ImpresoraBinaria.java
c7240a24debec48227ca66240cf9a3fad516b4f5
[]
no_license
IanGarciaUnam/EndSemester
1d8bdb7ff2f65fa4bea15144a19897c64e17902b
142994e2ce0518612986f339c76e4091574a92c5
refs/heads/master
2022-04-01T18:13:41.291016
2020-01-12T19:04:57
2020-01-12T19:04:57
224,110,691
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package icc.impresoraBinaria; /** * * @author IanGarcia */ public class ImpresoraBinaria{ private ImpresoraBinaria(){} /** * Imprime un numero en bits * @param i numero a imprimir. */ public static void imprime(int i){ System.out.println(Integer.toBinaryString(i)); } /** * Imprime un numero en bits * @param d numero a imprimir. */ public static void imprime(double d){ System.out.println(Long.toBinaryString(Double.doubleToLongBits(d))); } }
6196b084e34a5623102dbc84949b591ef8d9d070
f4a2e6193611874c184e89a850becc23d89e48a6
/src/main/java/com/jhipster/clx/domain/User.java
710f4f040fde783f2b2e5e12c23e3de86f418cff
[]
no_license
mfang360/jhipster-sample-application
43f54858a0e1cfc420a0fbcd954dcdff2aba2891
37354f81c06eb24e2f9862758b69ec5cbf158502
refs/heads/master
2022-12-21T10:00:08.602231
2020-01-17T08:59:27
2020-01-17T08:59:27
234,510,261
0
0
null
2022-12-16T04:43:29
2020-01-17T08:59:14
Java
UTF-8
Java
false
false
5,500
java
package com.jhipster.clx.domain; import com.jhipster.clx.config.Constants; import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.commons.lang3.StringUtils; import org.hibernate.annotations.BatchSize; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import java.io.Serializable; import java.time.Instant; import java.util.HashSet; import java.util.Locale; import java.util.Set; /** * A user. */ @Entity @Table(name = "jhi_user") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class User extends AbstractAuditingEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @Pattern(regexp = Constants.LOGIN_REGEX) @Size(min = 1, max = 50) @Column(length = 50, unique = true, nullable = false) private String login; @JsonIgnore @NotNull @Size(min = 60, max = 60) @Column(name = "password_hash", length = 60, nullable = false) private String password; @Size(max = 50) @Column(name = "first_name", length = 50) private String firstName; @Size(max = 50) @Column(name = "last_name", length = 50) private String lastName; @Email @Size(min = 5, max = 254) @Column(length = 254, unique = true) private String email; @NotNull @Column(nullable = false) private boolean activated = false; @Size(min = 2, max = 10) @Column(name = "lang_key", length = 10) private String langKey; @Size(max = 256) @Column(name = "image_url", length = 256) private String imageUrl; @Size(max = 20) @Column(name = "activation_key", length = 20) @JsonIgnore private String activationKey; @Size(max = 20) @Column(name = "reset_key", length = 20) @JsonIgnore private String resetKey; @Column(name = "reset_date") private Instant resetDate = null; @JsonIgnore @ManyToMany @JoinTable( name = "jhi_user_authority", joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "authority_name", referencedColumnName = "name")}) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @BatchSize(size = 20) private Set<Authority> authorities = new HashSet<>(); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getLogin() { return login; } // Lowercase the login before saving it in database public void setLogin(String login) { this.login = StringUtils.lowerCase(login, Locale.ENGLISH); } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public boolean getActivated() { return activated; } public void setActivated(boolean activated) { this.activated = activated; } public String getActivationKey() { return activationKey; } public void setActivationKey(String activationKey) { this.activationKey = activationKey; } public String getResetKey() { return resetKey; } public void setResetKey(String resetKey) { this.resetKey = resetKey; } public Instant getResetDate() { return resetDate; } public void setResetDate(Instant resetDate) { this.resetDate = resetDate; } public String getLangKey() { return langKey; } public void setLangKey(String langKey) { this.langKey = langKey; } public Set<Authority> getAuthorities() { return authorities; } public void setAuthorities(Set<Authority> authorities) { this.authorities = authorities; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof User)) { return false; } return id != null && id.equals(((User) o).id); } @Override public int hashCode() { return 31; } @Override public String toString() { return "User{" + "login='" + login + '\'' + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", imageUrl='" + imageUrl + '\'' + ", activated='" + activated + '\'' + ", langKey='" + langKey + '\'' + ", activationKey='" + activationKey + '\'' + "}"; } }
743fa1172739360d27955f1159eb7441426ab16a
8614888f18608b8474b73cf38f21d7dd4b3e58c8
/oauth/src/main/java/org/miage/oauth/entity/User.java
b9814bda19c636ec899e449c75393bd23fa8d537
[]
no_license
AnthonyPellizzeri/SpringM2
dbc713c925ff1a1cc06de3bcb12a68b461cdaae6
f98019da3a09877b67fb378b923f0691d1ea2d78
refs/heads/main
2023-04-04T16:36:32.523368
2021-04-11T21:51:07
2021-04-11T21:51:07
349,227,538
0
0
null
null
null
null
UTF-8
Java
false
false
1,973
java
package org.miage.oauth.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import javax.persistence.*; import java.io.Serializable; import java.util.Collection; import java.util.Set; import static javax.persistence.EnumType.STRING; @Entity @Data @NoArgsConstructor @AllArgsConstructor @Table(name = "user_account") public class User implements UserDetails, Serializable { private static final long serialVersionUID = 8765432234567L; @Id private String id; @Column(unique = true) private String username; private String password; private boolean enabled; @Column(name = "account_locked") private boolean accountNonLocked; @Column(name = "account_expired") private boolean accountNonExpired; @Column(name = "credentials_expired") private boolean credentialsNonExpired; @Enumerated(STRING) private Role role; @Override public boolean isAccountNonExpired() { return !accountNonExpired; } @Override public boolean isCredentialsNonExpired() { return !credentialsNonExpired; } @Override public boolean isAccountNonLocked() { return !accountNonLocked; } public void setAccountNonExpired(boolean accountNonExpired) { this.accountNonExpired = !accountNonExpired; } public void setCredentialsNonExpired(boolean credentialsNonExpired) { this.credentialsNonExpired = !credentialsNonExpired; } public void setAccountNonLocked(boolean accountNonLocked) { this.accountNonLocked = !accountNonLocked; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return Set.of(new SimpleGrantedAuthority(role.getValue())); } }
b700085650496b0af71dc9cf61303fd68848313b
cb73d0ff543d8294545c09783bf3c45bced7e0c6
/dristhi-app/src/main/java/org/ei/drishti/view/dialog/SortOption.java
fa33bcdde36d76e29935068c26588cabbbc0d854
[ "Apache-2.0" ]
permissive
nbvsrk/opensrp-client
ac07635dc0fd428259faa7d241e0841537917211
a6d1c18a21b1cdcceb8fc438ab8a8f374607c7ed
refs/heads/master
2021-01-17T23:00:36.561168
2015-03-25T05:40:36
2015-03-25T05:40:36
33,240,944
1
0
null
2015-04-01T10:13:25
2015-04-01T10:13:25
null
UTF-8
Java
false
false
220
java
package org.ei.drishti.view.dialog; import org.ei.drishti.view.contract.SmartRegisterClients; public interface SortOption extends DialogOption { public SmartRegisterClients sort(SmartRegisterClients allClients); }
27159d3659fd4d83a7e40e1c84bc580d62473062
968bfcf50f8b89f889398380f1363b5b45dd717e
/android/app/src/main/java/com/nsu_parking_demo_26526/MainActivity.java
5cdd9732ed5156c7dacb379ce8d362b8ef04254c
[]
no_license
crowdbotics-apps/nsu-parking-demo-26526
15993e49d5fe18a09c378e60b7f069358642dd53
f36082b4fad1f83f2406dea52638f59a1fdbedb5
refs/heads/master
2023-05-04T08:13:57.967590
2021-05-10T23:47:45
2021-05-10T23:47:45
366,203,168
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.nsu_parking_demo_26526; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "nsu_parking_demo_26526"; } }
932bac60c34b80fcf460c4fcc3db394ae7abd9cd
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/JavaProgramData/61/1522.java
f1b04db76a70b97a90c0751d8ce839a5ada35755
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
652
java
package <missing>; public class GlobalMembers { public static int pb(int m) { int[] sz = new int[100000]; sz[1] = 1; sz[2] = 1; for (int i = 3;i <= m;i++) { sz[i] = sz[i - 1] + sz[i - 2]; } return sz[m]; } public static int Main() { int i; int a; int n; int k; int[] s = new int[1000]; String tempVar = ConsoleInput.scanfRead(); if (tempVar != null) { k = Integer.parseInt(tempVar); } for (i = 0;i < k;i++) { String tempVar2 = ConsoleInput.scanfRead(); if (tempVar2 != null) { n = Integer.parseInt(tempVar2); } s[i] = pb(n); } for (i = 0;i < k;i++) { System.out.printf("%d\n",s[i]); } return 0; } }
1c4153a1a4cfc9022c635a853237709fe7f9c4e0
bf377c647c451edeccf720d3a66157b174eb1741
/app/src/main/java/com/openld/roundcornerdemmo/utils/DisplayUtils.java
47fa5037271506db10097d8a655110c4c441e296
[]
no_license
leidongld/RoundCornerDemmo
38e1273543ed565b5c6203aa4f76871bff8ce4e9
02ae441839b65f4ef7b8f3fa164580ef8c64fba8
refs/heads/master
2022-11-07T11:13:58.453091
2020-06-09T14:25:41
2020-06-09T14:25:41
271,024,496
5
0
null
null
null
null
UTF-8
Java
false
false
1,319
java
package com.openld.roundcornerdemmo.utils; import android.content.Context; /** * author: lllddd * created on: 2020/6/9 10:26 * description: */ public class DisplayUtils { /** * px 转 dp * * @param context * @param px * @return */ public static int px2dp(Context context, float px) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (px / scale + 0.5F); } /** * dp 转 px * * @param context * @param dp * @return */ public static int dp2px(Context context, float dp) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dp * scale + 0.5F); } /** * px 转 sp * @param context * @param px * @return */ public static int px2sp(Context context, float px) { final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; return (int) (px / fontScale + 0.5F); } /** * sp 转 px * * @param context * @param sp * @return */ public static int sp2px(Context context, float sp) { final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; return (int) (sp * fontScale + 0.5F); } }
d55fb1a123fd27eb5fdeb04230c5636e8a29d178
27e2c0a9d0e30433d1153fabcaa7ac339755b1fe
/Delhi-info/src/history/User.java
2507e5aca12852074cd7350b02bbfd23882c4fbb
[]
no_license
SIDDIQUISAZID/Delhi-info
7eaa70546b1c35716f5badb097d71cbee77cff53
baa466b8700982e81e8db049d446f735fd89db5c
refs/heads/master
2021-01-21T13:08:26.506450
2017-05-21T06:27:26
2017-05-21T06:27:26
91,808,174
0
0
null
null
null
null
UTF-8
Java
false
false
728
java
package history; public class User { String name,location,place,aboutplace,popularity; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getPlace() { return place; } public void setPlace(String place) { this.place = place; } public String getAboutplace() { return aboutplace; } public void setAboutplace(String aboutplace) { this.aboutplace = aboutplace; } public String getPopularity() { return popularity; } public void setPopularity(String pouplarity) { this.popularity = pouplarity; } }
6e0db926c5d4bcadc7076b9a050d915b9e0463a6
d8636158357c9dc6140ea20ad723de63114567e1
/sms/src/main/java/sms/model/StudentService.java
eb5764e80947b55f278650a3f7aba99ead5bdec2
[]
no_license
SAIF0206/SpringFrameWorkBasic
98b071ad08fe9e49a5506c354a4c97acb7141e01
98a8b0b645709e44f32ce0e394ee8446db24db3b
refs/heads/master
2020-09-25T23:12:42.306546
2019-12-11T05:15:51
2019-12-11T05:15:51
226,109,141
0
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
package sms.model; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class StudentService { @Autowired private StudentRepository studentRepo; @Autowired private StudentGradeRepository studentGardeRepo; public List<Student> listStudent(){ return (List<Student>)studentRepo.findAll(); } public Student getStudentName(int id) { return studentRepo.findById(id).get(); } public ArrayList<StudentGrade> getStudentName(Student student) { return studentGardeRepo.findByStudent(student); } //@Autowired //private StudentGradeRepository gradeRepo; @Autowired CourseRepository courseRepo; public ArrayList<Course> listcourse(){ return (ArrayList<Course>) courseRepo.findAll(); } // public long queryStudentGrades(int courseID, String Course, int units, String grade) { // String query = "SELECT sg.id , sg.course,sg.grade, c.courseName, c.courseUnit" + "From StudentGrade sg and " // } }
b0d96512b96b41198ea3a6122421280083e07c28
84977be791b912c6ed0c7da3c3ca0c1e7a9b1220
/src/main/java/com/skycloud/management/portal/admin/customer/utils/UtilCommon.java
ac3a1464fc13e6140a0f2c9ba6ef577b19f53b77
[]
no_license
henrylv206/UCFCloudPortal
1503b9e7a66103684444b78935882973306d9744
0283d6c4d1ac9f3de67ea579a8f77c3331fcc897
refs/heads/master
2020-12-30T10:50:05.608675
2014-07-22T07:33:54
2014-07-22T07:33:54
21,964,181
0
1
null
null
null
null
UTF-8
Java
false
false
983
java
package com.skycloud.management.portal.admin.customer.utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class UtilCommon { public static String getSerial(Date date, int index) { long msel = date.getTime(); SimpleDateFormat fm = new SimpleDateFormat("MMddyyyyHHmmssSS"); msel += index; date.setTime(msel); String serials = fm.format(date); return serials; } // ����Ƿ���ͼƬ��ʽ public static boolean checkIsImage(String imgStr) { boolean flag = false; if (imgStr != null) { if (imgStr.equalsIgnoreCase(".gif") || imgStr.equalsIgnoreCase(".jpg") || imgStr.equalsIgnoreCase(".jpeg") || imgStr.equalsIgnoreCase(".png") || imgStr.equalsIgnoreCase(".txt")) { flag = true; } } return flag; } public static Date StrToDate(String str) throws ParseException{ return new SimpleDateFormat("MM/dd/yyyy").parse(str); } }
6fbb5412539fb5dcd3eb61f5734b10e18197008a
124a30d827fc5dd9563e96541ce876ae66bab18b
/src/system/presentation/client_view/Controller.java
20c198b381673ea79706272a8963d26edab63839
[]
no_license
basungo98/LoanSystem
f9dd1edde2316a891e4377f991a2b4c6e538fd83
3364a0acdb6e529c46f684ab187021528619d500
refs/heads/main
2023-08-16T14:16:02.424003
2021-10-01T17:10:27
2021-10-01T17:10:27
411,812,105
0
0
null
null
null
null
UTF-8
Java
false
false
3,642
java
package system.presentation.client_view; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import system.Application; import system.logic.Canton; import system.logic.Client; import system.logic.District; import system.logic.Province; import system.logic.Service; public class Controller { Model model; View view; public Controller(Model model, View view) { this.model = model; this.view = view; model.setClient(new Client()); model.setClients(new ArrayList<>()); view.setModel(model); view.setController(this); view.baseConfiguration(); } public Province getProvince(String provinceName) { try { return Service.instance().getProvince(provinceName); } catch (Exception ex) { return new Province(); } } public Canton getCanton(String provinceName, String cantonName) { try { List<Canton> cantons = getCantons(provinceName); return cantons.stream().filter(c->c.getName().equals(cantonName)).findFirst().orElse(null); } catch (Exception ex) { return new Canton(); } } public District getDistrict(String provinceName, String cantonName, String districtName) { try { List<District> districts = getDistricts(provinceName, cantonName); return districts.stream().filter(c->c.getName().equals(districtName)).findFirst().orElse(null); } catch (Exception ex) { return new District(); } } public List<Province> getProvinces() { try { return Service.instance().getProvinces(); } catch (Exception ex) { return Arrays.asList(new Province()); } } public List<Canton> getCantons(String provinceName) { try { Province province = Service.instance().getProvince(provinceName); return province.getCantons(); } catch (Exception ex) { return Arrays.asList(new Canton()); } } public List<District> getDistricts(String provinceName, String cantonName) { try { Province province = Service.instance().getProvince(provinceName); Canton canton = province.getCantons().stream().filter(c->c.getName().equals(cantonName)).findFirst().orElse(null); return canton.getDistricts(); } catch (Exception ex) { return Arrays.asList(new District()); } } public void addClient(Client cliente){ try { Service.instance().addClient(cliente); Service.instance().store(); model.setClient(new Client()); model.setClients(Arrays.asList(cliente)); model.commit(); } catch (Exception ex) { } } public void getClient(String id){ try { Client cliente = Service.instance().getClient(id); model.setClient(cliente); model.setClients(Arrays.asList(cliente)); model.commit(); } catch (Exception ex) { model.setClient(new Client()); model.setClients(new ArrayList<>()); model.commit(); } } public void show(){ this.view.setVisible(true); } public void hide(){ this.view.setVisible(false); } public void exit(){ Service.instance().store(); } public void showLoanView(){ this.hide(); Application.LOAN_VIEW.show(); } }
f72046227cfc374b6c4725561b96bd51a75fe0ef
cf1280ce698ffbc88b15725a7f352aa472485887
/src/com/rabitmq/chatapp/classes/User.java
25bdb312a0df4a531831d6c98c5f025c58924d2c
[]
no_license
christophezei/WhatChattRabbitmq
29a6232d027b93d7fdc7648dbb6e4128b2c189c1
b8ab9090daea2c306709b5f1e1009ea08f11ef64
refs/heads/master
2021-04-13T10:21:25.174350
2020-03-22T19:19:54
2020-03-22T19:19:54
249,155,173
0
0
null
null
null
null
UTF-8
Java
false
false
5,097
java
package com.rabitmq.chatapp.classes; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.concurrent.TimeoutException; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.DeliverCallback; import com.rabitmq.chatapp.classes.Client.MessageType; import com.rabitmq.interfaces.IUser; import com.rabitmq.models.MessageModel; public class User implements IUser { @Override public ConnectionFactory connectToServer(ConnectionFactory factory){ factory = new ConnectionFactory(); factory.setHost("localhost"); return factory; } @Override public synchronized void produceMessage(String exchangeName, MessageModel message, String exchangeType, ConnectionFactory factory) throws IOException, TimeoutException { try (Connection connection = factory.newConnection(); Channel channel = connection.createChannel()) { channel.exchangeDeclare(exchangeName, exchangeType); String messageContent; String routingKey = null; MessageType messageType = MessageType.NONE; if(message.getMessageType() == messageType) { routingKey = "NONE"; messageContent = message.getMessageSender() + message.getMessageBody(); channel.basicPublish(exchangeName,routingKey, null, messageContent.getBytes(StandardCharsets.UTF_8)); }else { if(message.getMessageType() == MessageType.BROADCAST) { routingKey = message.getMessageReceiver(); }else if(message.getMessageType() == MessageType.PRIVATE) { messageContent = message.getMessageBody(); String[] parts = messageContent.split(" "); routingKey = parts[0].substring(1); String messageBody = parts[1]; channel.basicPublish(exchangeName,routingKey, null, messageBody.getBytes(StandardCharsets.UTF_8)); } messageContent = "[" + message.getSentTime()+ "]" + message.getMessageSender() + ":" + message.getMessageBody(); channel.basicPublish(exchangeName,routingKey, null, messageContent.getBytes(StandardCharsets.UTF_8)); } } } @Override public void consumeMessage(ConnectionFactory factory,String exchangeName, String exchangeType,MessageModel message) throws IOException, TimeoutException { Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.exchangeDeclare(exchangeName, exchangeType); String queueName = channel.queueDeclare().getQueue(); channel.queueBind(queueName, exchangeName, "BROADCAST"); channel.queueBind(queueName, exchangeName,"NONE"); DeliverCallback deliverCallback = (consumerTag, delivery) -> { String messageBody = new String(delivery.getBody(), "UTF-8"); System.out.println(messageBody); }; channel.basicConsume(queueName, true, deliverCallback, consumerTag -> { }); } @Override public void initMyOwenChannelBindingForPrivComunucation(ConnectionFactory factory,String exchangeName, String exchangeType,MessageModel message) throws IOException, TimeoutException { Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.exchangeDeclare(exchangeName, exchangeType); String queueName = channel.queueDeclare().getQueue(); channel.queueBind(queueName, exchangeName, message.getMessageSender()); DeliverCallback deliverCallback = (consumerTag, delivery) -> { String messageBody = new String(delivery.getBody(), "UTF-8"); System.out.println(messageBody); }; channel.basicConsume(queueName, true, deliverCallback, consumerTag -> { }); } @Override public synchronized void writeToFile(String message) { String userHome = createDirectory(); File log = new File(userHome + "/History.txt"); try { PrintWriter writer = new PrintWriter(new FileWriter(log, true)); writer.println(message); writer.close(); } catch (IOException e) { e.printStackTrace(); } } @Override public String retreiveHistory(String absolutePath) { String history = null; try { history = new String(Files.readAllBytes(Paths.get(absolutePath)), StandardCharsets.UTF_8); } catch (IOException e) { // can print any error } return history; } private String createDirectory() { boolean success = false; String dir = System.getProperty("user.home"); String fullPath = dir + "/WhatChatMqHistory"; File directory = new File(fullPath); if (directory.exists() && directory.isDirectory()) { //System.out.println("Directory already exists ..."); } else { //System.out.println("Directory not exists, creating now"); success = directory.mkdir(); } return fullPath; } }
1ca1009a538ef2abaab85031fc923920c4d1eacb
ab951ec371fc7b27fbb61283c6545b7a46fff619
/vaadin/Runner.java
2a65439562b267ccabee779dac9bb0132760913f
[]
no_license
nmerouze/blockcampparis09
a79510fc24e87d2f64ae289b6fb4634c581a20ec
48342cbb14418a35deb7a00f0a15a732ee948b93
refs/heads/master
2016-09-06T00:07:55.978194
2009-11-28T20:14:49
2009-11-28T20:14:49
388,621
1
0
null
null
null
null
UTF-8
Java
false
false
655
java
import java.util.ArrayList; import java.util.List; import org.jruby.embed.ScriptingContainer; import com.vaadin.Application; public class Runner extends Application { @Override public void init() { ScriptingContainer container = new ScriptingContainer(); List<String> loadPaths = new ArrayList<String>(); loadPaths.add(this.getContext().getBaseDirectory().getAbsolutePath()); container.getProvider().setLoadPaths(loadPaths); Object receiver = container.runScriptlet("require 'main'; Vaadin"); Object[] args = new Object[1]; args[0] = this; container.callMethod(receiver, "application=", args, Object.class); } }
1b6f6c5997f8af409f11d78d441c801d49d1f7ee
cbd205983456f11ef963db4b8bc2485e449870af
/app/src/main/java/yagotome/testepraticomobile/fragment/VideoFragment.java
89242f17404d0525d132d8bdcadc224ffe420bf0
[]
no_license
yagotome/TestePraticoMobile
d00794600167ec22e361e05f2cfa1b48491956bc
e733f090f2b0b9812f07b0b6186738a5190f7d31
refs/heads/master
2021-01-21T12:59:23.601394
2016-04-13T02:56:53
2016-04-13T02:56:53
55,816,055
0
0
null
null
null
null
UTF-8
Java
false
false
1,659
java
package yagotome.testepraticomobile.fragment; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.devbrackets.android.exomedia.EMVideoView; import yagotome.testepraticomobile.R; import yagotome.testepraticomobile.activity.BaseActivity; import yagotome.testepraticomobile.domain.Video; /** * */ public class VideoFragment extends BaseFragment implements MediaPlayer.OnPreparedListener { private static final String TAG = "VideoFragment"; private Video video; private EMVideoView emVideoView; public VideoFragment() { } public static VideoFragment newInstance(Video video) { VideoFragment fragment = new VideoFragment(); fragment.video = video; return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_video, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setupVideoView(); } private void setupVideoView() { assert (getView() != null); emVideoView = (EMVideoView)getView().findViewById(R.id.video_play_activity_video_view); emVideoView.setOnPreparedListener(this); emVideoView.setVideoURI(Uri.parse(video.getUri())); } @Override public void onPrepared(MediaPlayer mp) { emVideoView.start(); } }
c6bb9aa396df4ded34f7ded725043b8e3f130582
41760a8dfd14b925f0f1c79b12a7acd76d2f6338
/slick2d-core/src/main/java/org/newdawn/slick/GameContainer.java
eacbd8cd4988d7ea5c6d546101674c7e68f66ee3
[ "BSD-3-Clause" ]
permissive
vertingo/slick2d-maven
5f81af6955819c72d8764d92124d630786dfb464
45fbe42573c87183c76a20a6f6ec4019989e16f6
refs/heads/master
2020-04-12T17:08:39.296310
2018-12-20T22:46:42
2018-12-20T22:46:42
162,636,031
0
0
BSD-3-Clause
2018-12-20T22:05:47
2018-12-20T22:05:47
null
UTF-8
Java
false
false
23,601
java
package org.newdawn.slick; import java.io.IOException; import java.util.Properties; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.input.Cursor; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Drawable; import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.PixelFormat; import org.newdawn.slick.gui.GUIContext; import org.newdawn.slick.openal.SoundStore; import org.newdawn.slick.opengl.CursorLoader; import org.newdawn.slick.opengl.ImageData; import org.newdawn.slick.opengl.renderer.Renderer; import org.newdawn.slick.opengl.renderer.SGL; import org.newdawn.slick.util.Log; import org.newdawn.slick.util.ResourceLoader; /** * A generic game container that handles the game loop, fps recording and * managing the input system * * @author kevin */ public abstract class GameContainer implements GUIContext { /** The renderer to use for all GL operations */ protected static SGL GL = Renderer.get(); /** The shared drawable if any */ protected static Drawable SHARED_DRAWABLE; /** The time the last frame was rendered */ protected long lastFrame; /** The last time the FPS recorded */ protected long lastFPS; /** The last recorded FPS */ protected int recordedFPS; /** The current count of FPS */ protected int fps; /** True if we're currently running the game loop */ protected boolean running = true; /** The width of the display */ protected int width; /** The height of the display */ protected int height; /** The game being managed */ protected Game game; /** The default font to use in the graphics context */ private Font defaultFont; /** The graphics context to be passed to the game */ private Graphics graphics; /** The input system to pass to the game */ protected Input input; /** The FPS we want to lock to */ protected int targetFPS = -1; /** True if we should show the fps */ private boolean showFPS = true; /** The minimum logic update interval */ protected long minimumLogicInterval = 1; /** The stored delta */ protected long storedDelta; /** The maximum logic update interval */ protected long maximumLogicInterval = 0; /** The last game started */ protected Game lastGame; /** True if we should clear the screen each frame */ protected boolean clearEachFrame = true; /** True if the game is paused */ protected boolean paused; /** True if we should force exit */ protected boolean forceExit = true; /** True if vsync has been requested */ protected boolean vsync; /** Smoothed deltas requested */ protected boolean smoothDeltas; /** The number of samples we'll attempt through hardware */ protected int samples; /** True if this context supports multisample */ protected boolean supportsMultiSample; /** True if we should render when not focused */ protected boolean alwaysRender; /** True if we require stencil bits */ protected static boolean stencil; /** * Create a new game container wrapping a given game * * @param game The game to be wrapped */ protected GameContainer(Game game) { this.game = game; lastFrame = getTime(); getBuildVersion(); Log.checkVerboseLogSetting(); } public static void enableStencil() { stencil = true; } /** * Set the default font that will be intialised in the graphics held in this container * * @param font The font to use as default */ public void setDefaultFont(Font font) { if (font != null) { this.defaultFont = font; } else { Log.warn("Please provide a non null font"); } } /** * Indicate whether we want to try to use fullscreen multisampling. This will * give antialiasing across the whole scene using a hardware feature. * * @param samples The number of samples to attempt (2 is safe) */ public void setMultiSample(int samples) { this.samples = samples; } /** * Check if this hardware can support multi-sampling * * @return True if the hardware supports multi-sampling */ public boolean supportsMultiSample() { return supportsMultiSample; } /** * The number of samples we're attempting to performing using * hardware multisampling * * @return The number of samples requested */ public int getSamples() { return samples; } /** * Indicate if we should force exitting the VM at the end * of the game (default = true) * * @param forceExit True if we should force the VM exit */ public void setForceExit(boolean forceExit) { this.forceExit = forceExit; } /** * Indicate if we want to smooth deltas. This feature will report * a delta based on the FPS not the time passed. This works well with * vsync. * * @param smoothDeltas True if we should report smooth deltas */ public void setSmoothDeltas(boolean smoothDeltas) { this.smoothDeltas = smoothDeltas; } /** * Check if the display is in fullscreen mode * * @return True if the display is in fullscreen mode */ public boolean isFullscreen() { return false; } /** * Get the aspect ratio of the screen * * @return The aspect ratio of the display */ public float getAspectRatio() { return getWidth() / getHeight(); } /** * Indicate whether we want to be in fullscreen mode. Note that the current * display mode must be valid as a fullscreen mode for this to work * * @param fullscreen True if we want to be in fullscreen mode * @throws SlickException Indicates we failed to change the display mode */ public void setFullscreen(boolean fullscreen) throws SlickException { } /** * Enable shared OpenGL context. After calling this all containers created * will shared a single parent context * * @throws SlickException Indicates a failure to create the shared drawable */ public static void enableSharedContext() throws SlickException { try { SHARED_DRAWABLE = new Pbuffer(64, 64, new PixelFormat(8, 0, 0), null); } catch (LWJGLException e) { throw new SlickException("Unable to create the pbuffer used for shard context, buffers not supported", e); } } /** * Get the context shared by all containers * * @return The context shared by all the containers or null if shared context isn't enabled */ public static Drawable getSharedContext() { return SHARED_DRAWABLE; } /** * Indicate if we should clear the screen at the beginning of each frame. If you're * rendering to the whole screen each frame then setting this to false can give * some performance improvements * * @param clear True if the the screen should be cleared each frame */ public void setClearEachFrame(boolean clear) { this.clearEachFrame = clear; } /** * Renitialise the game and the context in which it's being rendered * * @throws SlickException Indicates a failure rerun initialisation routines */ public void reinit() throws SlickException { } /** * Pause the game - i.e. suspend updates */ public void pause() { setPaused(true); } /** * Resumt the game - i.e. continue updates */ public void resume() { setPaused(false); } /** * Check if the container is currently paused. * * @return True if the container is paused */ public boolean isPaused() { return paused; } /** * Indicates if the game should be paused, i.e. if updates * should be propogated through to the game. * * @param paused True if the game should be paused */ public void setPaused(boolean paused) { this.paused = paused; } /** * True if this container should render when it has focus * * @return True if this container should render when it has focus */ public boolean getAlwaysRender () { return alwaysRender; } /** * Indicate whether we want this container to render when it has focus * * @param alwaysRender True if this container should render when it has focus */ public void setAlwaysRender (boolean alwaysRender) { this.alwaysRender = alwaysRender; } /** * Get the build number of slick * * @return The build number of slick */ public static int getBuildVersion() { try { Properties props = new Properties(); props.load(ResourceLoader.getResourceAsStream("version")); int build = Integer.parseInt(props.getProperty("build")); Log.info("Slick Build #"+build); return build; } catch (Exception e) { Log.error("Unable to determine Slick build number"); return -1; } } /** * Get the default system font * * @return The default system font */ public Font getDefaultFont() { return defaultFont; } /** * Check if sound effects are enabled * * @return True if sound effects are enabled */ public boolean isSoundOn() { return SoundStore.get().soundsOn(); } /** * Check if music is enabled * * @return True if music is enabled */ public boolean isMusicOn() { return SoundStore.get().musicOn(); } /** * Indicate whether music should be enabled * * @param on True if music should be enabled */ public void setMusicOn(boolean on) { SoundStore.get().setMusicOn(on); } /** * Indicate whether sound effects should be enabled * * @param on True if sound effects should be enabled */ public void setSoundOn(boolean on) { SoundStore.get().setSoundsOn(on); } /** * Retrieve the current default volume for music * @return the current default volume for music */ public float getMusicVolume() { return SoundStore.get().getMusicVolume(); } /** * Retrieve the current default volume for sound fx * @return the current default volume for sound fx */ public float getSoundVolume() { return SoundStore.get().getSoundVolume(); } /** * Set the default volume for sound fx * @param volume the new default value for sound fx volume */ public void setSoundVolume(float volume) { SoundStore.get().setSoundVolume(volume); } /** * Set the default volume for music * @param volume the new default value for music volume */ public void setMusicVolume(float volume) { SoundStore.get().setMusicVolume(volume); } /** * Get the width of the standard screen resolution * * @return The screen width */ public abstract int getScreenWidth(); /** * Get the height of the standard screen resolution * * @return The screen height */ public abstract int getScreenHeight(); /** * Get the width of the game canvas * * @return The width of the game canvas */ public int getWidth() { return width; } /** * Get the height of the game canvas * * @return The height of the game canvas */ public int getHeight() { return height; } /** * Set the icon to be displayed if possible in this type of * container * * @param ref The reference to the icon to be displayed * @throws SlickException Indicates a failure to load the icon */ public abstract void setIcon(String ref) throws SlickException; /** * Set the icons to be used for this application. Note that the size of the icon * defines how it will be used. Important ones to note * * Windows window icon must be 16x16 * Windows alt-tab icon must be 24x24 or 32x32 depending on Windows version (XP=32) * * @param refs The reference to the icon to be displayed * @throws SlickException Indicates a failure to load the icon */ public abstract void setIcons(String[] refs) throws SlickException; /** * Get the accurate system time * * @return The system time in milliseconds */ public long getTime() { return (Sys.getTime() * 1000) / Sys.getTimerResolution(); } /** * Sleep for a given period * * @param milliseconds The period to sleep for in milliseconds */ public void sleep(int milliseconds) { long target = getTime()+milliseconds; while (getTime() < target) { try { Thread.sleep(1); } catch (Exception e) {} } } /** * Set the mouse cursor to be displayed - this is a hardware cursor and hence * shouldn't have any impact on FPS. * * @param ref The location of the image to be loaded for the cursor * @param hotSpotX The x coordinate of the hotspot within the cursor image * @param hotSpotY The y coordinate of the hotspot within the cursor image * @throws SlickException Indicates a failure to load the cursor image or create the hardware cursor */ public abstract void setMouseCursor(String ref, int hotSpotX, int hotSpotY) throws SlickException; /** * Set the mouse cursor to be displayed - this is a hardware cursor and hence * shouldn't have any impact on FPS. * * @param data The image data from which the cursor can be construted * @param hotSpotX The x coordinate of the hotspot within the cursor image * @param hotSpotY The y coordinate of the hotspot within the cursor image * @throws SlickException Indicates a failure to load the cursor image or create the hardware cursor */ public abstract void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException; /** * Set the mouse cursor based on the contents of the image. Note that this will not take * account of render state type changes to images (rotation and such). If these effects * are required it is recommended that an offscreen buffer be used to produce an appropriate * image. An offscreen buffer will always be used to produce the new cursor and as such * this operation an be very expensive * * @param image The image to use as the cursor * @param hotSpotX The x coordinate of the hotspot within the cursor image * @param hotSpotY The y coordinate of the hotspot within the cursor image * @throws SlickException Indicates a failure to load the cursor image or create the hardware cursor */ public abstract void setMouseCursor(Image image, int hotSpotX, int hotSpotY) throws SlickException; /** * Set the mouse cursor to be displayed - this is a hardware cursor and hence * shouldn't have any impact on FPS. * * @param cursor The cursor to use * @param hotSpotX The x coordinate of the hotspot within the cursor image * @param hotSpotY The y coordinate of the hotspot within the cursor image * @throws SlickException Indicates a failure to load the cursor image or create the hardware cursor */ public abstract void setMouseCursor(Cursor cursor, int hotSpotX, int hotSpotY) throws SlickException; /** * Get a cursor based on a image reference on the classpath. The image * is assumed to be a set/strip of cursor animation frames running from top to * bottom. * * @param ref The reference to the image to be loaded * @param x The x-coordinate of the cursor hotspot (left -> right) * @param y The y-coordinate of the cursor hotspot (bottom -> top) * @param width The x width of the cursor * @param height The y height of the cursor * @param cursorDelays image delays between changing frames in animation * * @throws SlickException Indicates a failure to load the image or a failure to create the hardware cursor */ public void setAnimatedMouseCursor(String ref, int x, int y, int width, int height, int[] cursorDelays) throws SlickException { try { Cursor cursor; cursor = CursorLoader.get().getAnimatedCursor(ref, x, y, width, height, cursorDelays); setMouseCursor(cursor, x, y); } catch (IOException e) { throw new SlickException("Failed to set mouse cursor", e); } catch (LWJGLException e) { throw new SlickException("Failed to set mouse cursor", e); } } /** * Set the default mouse cursor - i.e. the original cursor before any native * cursor was set */ public abstract void setDefaultMouseCursor(); /** * Get the input system * * @return The input system available to this game container */ public Input getInput() { return input; } /** * Get the current recorded FPS (frames per second) * * @return The current FPS */ public int getFPS() { return recordedFPS; } /** * Indicate whether mouse cursor should be grabbed or not * * @param grabbed True if mouse cursor should be grabbed */ public abstract void setMouseGrabbed(boolean grabbed); /** * Check if the mouse cursor is current grabbed. This will cause it not * to be seen. * * @return True if the mouse is currently grabbed */ public abstract boolean isMouseGrabbed(); /** * Retrieve the time taken to render the last frame, i.e. the change in time - delta. * * @return The time taken to render the last frame */ protected int getDelta() { long time = getTime(); int delta = (int) (time - lastFrame); lastFrame = time; return delta; } /** * Updated the FPS counter */ protected void updateFPS() { if (getTime() - lastFPS > 1000) { lastFPS = getTime(); recordedFPS = fps; fps = 0; } fps++; } /** * Set the minimum amount of time in milliseonds that has to * pass before update() is called on the container game. This gives * a way to limit logic updates compared to renders. * * @param interval The minimum interval between logic updates */ public void setMinimumLogicUpdateInterval(int interval) { minimumLogicInterval = interval; } /** * Set the maximum amount of time in milliseconds that can passed * into the update method. Useful for collision detection without * sweeping. * * @param interval The maximum interval between logic updates */ public void setMaximumLogicUpdateInterval(int interval) { maximumLogicInterval = interval; } /** * Update and render the game * * @param delta The change in time since last update and render * @throws SlickException Indicates an internal fault to the game. */ protected void updateAndRender(int delta) throws SlickException { if (smoothDeltas) { if (getFPS() != 0) { delta = 1000 / getFPS(); } } input.poll(width, height); Music.poll(delta); if (!paused) { storedDelta += delta; if (storedDelta >= minimumLogicInterval) { try { if (maximumLogicInterval != 0) { long cycles = storedDelta / maximumLogicInterval; for (int i=0;i<cycles;i++) { game.update(this, (int) maximumLogicInterval); } int remainder = (int) (storedDelta % maximumLogicInterval); if (remainder > minimumLogicInterval) { game.update(this, (int) (remainder % maximumLogicInterval)); storedDelta = 0; } else { storedDelta = remainder; } } else { game.update(this, (int) storedDelta); storedDelta = 0; } } catch (Throwable e) { Log.error(e); throw new SlickException("Game.update() failure - check the game code."); } } } else { game.update(this, 0); } if (hasFocus() || getAlwaysRender()) { if (clearEachFrame) { GL.glClear(SGL.GL_COLOR_BUFFER_BIT | SGL.GL_DEPTH_BUFFER_BIT); } GL.glLoadIdentity(); graphics.resetTransform(); graphics.resetFont(); graphics.resetLineWidth(); graphics.setAntiAlias(false); try { game.render(this, graphics); } catch (Throwable e) { Log.error(e); throw new SlickException("Game.render() failure - check the game code."); } graphics.resetTransform(); if (showFPS) { defaultFont.drawString(10, 10, "FPS: "+recordedFPS); } GL.flush(); } if (targetFPS != -1) { Display.sync(targetFPS); } } /** * Indicate if the display should update only when the game is visible * (the default is true) * * @param updateOnlyWhenVisible True if we should updated only when the display is visible */ public void setUpdateOnlyWhenVisible(boolean updateOnlyWhenVisible) { } /** * Check if this game is only updating when visible to the user (default = true) * * @return True if the game is only updated when the display is visible */ public boolean isUpdatingOnlyWhenVisible() { return true; } /** * Initialise the GL context */ protected void initGL() { Log.info("Starting display "+width+"x"+height); GL.initDisplay(width, height); if (input == null) { input = new Input(height); } input.init(height); // no need to remove listeners? //input.removeAllListeners(); if (game instanceof InputListener) { input.removeListener((InputListener) game); input.addListener((InputListener) game); } if (graphics != null) { graphics.setDimensions(getWidth(), getHeight()); } lastGame = game; } /** * Initialise the system components, OpenGL and OpenAL. * * @throws SlickException Indicates a failure to create a native handler */ protected void initSystem() throws SlickException { initGL(); setMusicVolume(1.0f); setSoundVolume(1.0f); graphics = new Graphics(width, height); defaultFont = graphics.getFont(); } /** * Enter the orthographic mode */ protected void enterOrtho() { enterOrtho(width, height); } /** * Indicate whether the container should show the FPS * * @param show True if the container should show the FPS */ public void setShowFPS(boolean show) { showFPS = show; } /** * Check if the FPS is currently showing * * @return True if the FPS is showing */ public boolean isShowingFPS() { return showFPS; } /** * Set the target fps we're hoping to get * * @param fps The target fps we're hoping to get */ public void setTargetFrameRate(int fps) { targetFPS = fps; } /** * Indicate whether the display should be synced to the * vertical refresh (stops tearing) * * @param vsync True if we want to sync to vertical refresh */ public void setVSync(boolean vsync) { this.vsync = vsync; Display.setVSyncEnabled(vsync); } /** * True if vsync is requested * * @return True if vsync is requested */ public boolean isVSyncRequested() { return vsync; } /** * True if the game is running * * @return True if the game is running */ protected boolean running() { return running; } /** * Inidcate we want verbose logging * * @param verbose True if we want verbose logging (INFO and DEBUG) */ public void setVerbose(boolean verbose) { Log.setVerbose(verbose); } /** * Cause the game to exit and shutdown cleanly */ public void exit() { running = false; } /** * Check if the game currently has focus * * @return True if the game currently has focus */ public abstract boolean hasFocus(); /** * Get the graphics context used by this container. Note that this * value may vary over the life time of the game. * * @return The graphics context used by this container */ public Graphics getGraphics() { return graphics; } /** * Enter the orthographic mode * * @param xsize The size of the panel being used * @param ysize The size of the panel being used */ protected void enterOrtho(int xsize, int ysize) { GL.enterOrtho(xsize, ysize); } }
e173d3ad5b2b402448c5ed9def70a979c36668a3
32b9d8cc999aa1e2c7b4075ed32727e772a3ae1c
/morning-common/src/main/java/org/pussinboots/morning/common/exception/BaseException.java
56ba6c94acf80850a4caba663c51ab064b723eae
[]
no_license
HinsYang/Morning
33b6706901fd92bd891d260403ff551dfa68fbae
cd115ac3a2b0bfcadd7305abf2b520d0e7290f33
refs/heads/master
2021-05-11T23:59:28.069375
2019-02-19T17:53:05
2019-02-19T17:53:05
171,512,823
0
1
null
null
null
null
UTF-8
Java
false
false
801
java
package org.pussinboots.morning.common.exception; /** * * 项目名称:morning-common * 类名称:BaseException * 类描述:BaseException 统一异常基类 * 创建人:yeungchihang * 创建时间:2017年3月31日 下午12:06:06 * */ public class BaseException extends RuntimeException { private static final long serialVersionUID = 1L; public BaseException() { super(); } public BaseException(Throwable cause) { super(cause); } public BaseException(String message) { super(message); } public BaseException(String message, Throwable cause) { super(message, cause); } public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } }
c3c4b71553c26af82781c56d3cc73504a99540e1
6c581f6164eebe845a848e8c2d9f8315f7e264fd
/org.abchip.mimo.biz.asf.plugins/plugins/mimo/src/main/java/org/abchip/mimo/biz/asf/plugins/entity/EcoreUtils.java
845dbf3dfd6bd7d5f69eed32b9a7f9e4dda3dfee
[]
no_license
abchip/mimo-biz20
7a0b110fd40733a7f3049d1871ef9559bc08db5c
a3cffeccb98d200ff2ecd629942b4279364d3373
refs/heads/master
2023-03-22T22:54:03.865399
2021-03-18T20:35:52
2021-03-18T20:35:52
245,134,382
0
0
null
null
null
null
UTF-8
Java
false
false
16,219
java
/** * Copyright (c) 2017, 2021 ABChip and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * */ package org.abchip.mimo.biz.asf.plugins.entity; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeSet; import org.abchip.mimo.biz.BizPackage; import org.abchip.mimo.entity.EntityPackage; import org.abchip.mimo.entity.Frame; import org.abchip.mimo.entity.Slot; import org.abchip.mimo.util.Logs; import org.abchip.mimo.util.Strings; import org.apache.ofbiz.base.util.UtilProperties; import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.model.ModelEntity; import org.apache.ofbiz.entity.model.ModelField; import org.apache.ofbiz.entity.model.ModelField.EncryptMethod; import org.apache.ofbiz.entity.model.ModelFieldType; import org.apache.ofbiz.widget.model.FieldInfo; import org.apache.ofbiz.widget.model.ModelForm; import org.apache.ofbiz.widget.model.ModelFormField; import org.apache.ofbiz.widget.model.ModelFormField.DropDownField; import org.apache.ofbiz.widget.model.ModelFormField.OptionSource; import org.apache.ofbiz.widget.model.ModelFormField.SingleOption; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EAnnotation; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EEnumLiteral; import org.eclipse.emf.ecore.EGenericType; import org.eclipse.emf.ecore.EModelElement; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.EcoreFactory; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.util.EcoreUtil; import org.osgi.service.log.Logger; public class EcoreUtils { private static final Logger LOGGER = Logs.getLogger(EcoreUtils.class); public static EClass copy(EClass eClass) { return EcoreUtil.copy(eClass); } public static EAnnotation copy(EAnnotation eAnnotation) { return EcoreUtil.copy(eAnnotation); } public static EStructuralFeature copy(EStructuralFeature eFeature) { return EcoreUtil.copy(eFeature); } public static EOperation copy(EOperation eOperation) { return EcoreUtil.copy(eOperation); } public static String packageToName(EPackage ePackage) { StringBuffer sb = new StringBuffer(); URI uri = URI.createURI(ePackage.getNsURI()); sb.append("org.abchip.mimo"); sb.append(uri.path().replaceAll("\\/", "\\.")); return sb.toString(); } public static EPackage buildEPackage(EPackage eRootPackage, String packageName) { EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; EPackage ePackage = ecoreFactory.createEPackage(); ePackage.setName(packageName); ePackage.setNsPrefix(eRootPackage.getNsPrefix() + "-" + packageName); ePackage.setNsPrefix("biz-" + packageName); ePackage.setNsURI(eRootPackage.getNsURI() + "/" + packageName); return ePackage; } public static EClass buildEntityTypeEClass(Delegator delegator, List<ModelForm> forms, ModelEntity modelEntity) throws GenericEntityException { EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; EClass eClass = ecoreFactory.createEClass(); setEntityCommon(delegator, modelEntity, eClass); EGenericType eGenericType = ecoreFactory.createEGenericType(); eGenericType.setEClassifier(EntityPackage.eINSTANCE.getEntityType()); eClass.getEGenericSuperTypes().add(eGenericType); eClass.getESuperTypes().add(EntityPackage.eINSTANCE.getEntityInfo()); for (String fieldName : getOwnedAttributeNames(modelEntity)) { ModelField modelField = modelEntity.getField(fieldName); EAttribute eAttribute = buildAttribute(delegator, forms, modelField); eClass.getEStructuralFeatures().add(eAttribute); } return eClass; } public static EClass buildEntityTypedEClass(Delegator delegator, List<ModelForm> forms, EClass entityType, ModelEntity modelEntity) throws GenericEntityException { EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; EClass eClass = ecoreFactory.createEClass(); setEntityCommon(delegator, modelEntity, eClass); EGenericType eGenericType = ecoreFactory.createEGenericType(); eGenericType.setEClassifier(EntityPackage.eINSTANCE.getEntityTyped()); EGenericType eGenericType2 = ecoreFactory.createEGenericType(); eGenericType2.setEClassifier(entityType); eGenericType.getETypeArguments().add(eGenericType2); eClass.getEGenericSuperTypes().add(eGenericType); eClass.getESuperTypes().add(EntityPackage.eINSTANCE.getEntityInfo()); for (String fieldName : getOwnedAttributeNames(modelEntity)) { ModelField modelField = modelEntity.getField(fieldName); EAttribute eAttribute = buildAttribute(delegator, forms, modelField); eClass.getEStructuralFeatures().add(eAttribute); } return eClass; } public static EClass buildEntityEClass(Delegator delegator, List<ModelForm> forms, ModelEntity modelEntity) throws GenericEntityException { EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; EClass eClass = ecoreFactory.createEClass(); setEntityCommon(delegator, modelEntity, eClass); eClass.getESuperTypes().add(EntityPackage.eINSTANCE.getEntityIdentifiable()); eClass.getESuperTypes().add(EntityPackage.eINSTANCE.getEntityInfo()); for (String fieldName : getOwnedAttributeNames(modelEntity)) { ModelField modelField = modelEntity.getField(fieldName); EAttribute eAttribute = buildAttribute(delegator, forms, modelField); eClass.getEStructuralFeatures().add(eAttribute); } return eClass; } public static EClass buildEntityNoteEClass(Delegator delegator, List<ModelForm> forms, ModelEntity modelEntity) { EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; EClass eClass = ecoreFactory.createEClass(); setEntityCommon(delegator, modelEntity, eClass); eClass.getESuperTypes().add(BizPackage.eINSTANCE.getBizEntityNote()); for (String fieldName : getOwnedAttributeNames(modelEntity)) { ModelField modelField = modelEntity.getField(fieldName); if (modelField.getName().equals("noteId")) continue; if (modelField.getName().equals("note")) continue; EAttribute eAttribute = buildAttribute(delegator, forms, modelField); eClass.getEStructuralFeatures().add(eAttribute); } return eClass; } public static EEnum buildEnum(EPackage ePackage, Map<String, ? extends Object> context, ModelFormField formField) { EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; EEnum eEnum = ecoreFactory.createEEnum(); eEnum.setName(Strings.firstToUpper(formField.getName())); FieldInfo fieldInfo = formField.getFieldInfo(); String resource = Strings.firstToUpper(ePackage.getName()); if (resource.equals("Humanres")) resource = "HumanRes"; resource = resource + "UiLabels"; if (fieldInfo instanceof ModelFormField.DropDownField) { ModelFormField.DropDownField dropDown = (DropDownField) fieldInfo; for (OptionSource optionSource : dropDown.getOptionSources()) { if (optionSource instanceof ModelFormField.SingleOption) { ModelFormField.SingleOption singleOption = (SingleOption) optionSource; EEnumLiteral literal = ecoreFactory.createEEnumLiteral(); literal.setLiteral(singleOption.getKey().getOriginal()); String description = singleOption.getDescription().getOriginal(); String name = description.split("\\.")[1]; name = name.substring(0, name.length() - 1); try { String message = UtilProperties.getMessage(resource, name, context, Locale.ENGLISH); message = message.replaceAll("-", "_"); literal.setName(message); } catch (Exception e) { LOGGER.error(e.getMessage()); } eEnum.getELiterals().add(literal); } } } if (eEnum.getELiterals().isEmpty()) return null; else return eEnum; } private static void setEntityCommon(Delegator delegator, ModelEntity modelEntity, EClass eClass) { eClass.setName(modelEntity.getEntityName()); if (modelEntity.getDescription() != null && !modelEntity.getDescription().trim().isEmpty() && !modelEntity.getDescription().trim().equalsIgnoreCase("NONE")) addAnnotationKey(eClass, Frame.NS_PREFIX_FRAME, "help", modelEntity.getDescription().trim()); if (modelEntity.getTitle() != null && !modelEntity.getTitle().trim().isEmpty() && !modelEntity.getTitle().replaceAll(" ", "").equalsIgnoreCase(modelEntity.getEntityName())) addAnnotationKey(eClass, Frame.NS_PREFIX_FRAME, "title", modelEntity.getTitle().trim()); if (modelEntity.getDefaultResourceName() != null && !modelEntity.getDefaultResourceName().trim().isEmpty() && !modelEntity.getDefaultResourceName().replaceAll(" ", "").equalsIgnoreCase(modelEntity.getEntityName() + "Labels")) addAnnotationKey(eClass, Frame.NS_PREFIX_FRAME, "dictionary", modelEntity.getDefaultResourceName().trim()); } public static void addAnnotationKey(EModelElement modelElement, String prefix, String key, String value) { EAnnotation eAnnotation = modelElement.getEAnnotation(prefix); if (eAnnotation == null) { eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); eAnnotation.setSource(prefix); modelElement.getEAnnotations().add(eAnnotation); } eAnnotation.getDetails().put(key, value); } public static String getAnnotationValue(EModelElement modelElement, String prefix, String key) { EAnnotation eAnnotation = modelElement.getEAnnotation(prefix); if (eAnnotation == null) return null; return eAnnotation.getDetails().get(key); } public static Set<String> getOwnedAttributeNames(ModelEntity modelEntity) { Set<String> atts = new TreeSet<String>(); for (String attName : modelEntity.getPkFieldNames()) { if (EntityPackage.eINSTANCE.getEntityIdentifiable().getEStructuralFeature(attName) != null) continue; atts.add(attName); } for (String attName : modelEntity.getNoPkFieldNames()) { if (EntityPackage.eINSTANCE.getEntityIdentifiable().getEStructuralFeature(attName) != null) continue; if (EntityPackage.eINSTANCE.getEntityInfo().getEStructuralFeature(attName) != null) continue; atts.add(attName); } return atts; } public static EAttribute buildAttribute(Delegator delegator, List<ModelForm> forms, ModelField modelField) { EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE; EAttribute eAttribute = ecoreFactory.createEAttribute(); eAttribute.setName(modelField.getName()); if (modelField.getIsPk()) { if (modelField.getModelEntity().getPksSize() == 1) eAttribute.setID(true); else addAnnotationKey(eAttribute, Slot.NS_PREFIX_SLOT, "key", "true"); } if (modelField.getIsNotNull()) eAttribute.setLowerBound(1); if (modelField.getEnableAuditLog()) addAnnotationKey(eAttribute, Slot.NS_PREFIX_SLOT, "audit", "true"); if (modelField.getEncryptMethod() != EncryptMethod.FALSE) addAnnotationKey(eAttribute, Slot.NS_PREFIX_SLOT, "encrypt", modelField.getEncryptMethod().name()); if (modelField.getDescription() != null && !modelField.getDescription().trim().isEmpty()) { addAnnotationKey(eAttribute, Slot.NS_PREFIX_SLOT, "help", modelField.getDescription().trim()); // TODO if (modelField.getDescription().trim().toLowerCase().contains("calculated")) { // System.out.println(modelField.getModelEntity().getEntityName() + "." + // modelField.getName()); // System.out.println(modelField.getDescription()); } } // String description = // UtilHelpText.getEntityFieldDescription(modelField.getModelEntity().getEntityName(), // modelField.getName(), delegator, Locale.US); // if (!description.isEmpty()) // addAnnotationKey(eAttribute, Slot.NS_PREFIX_SLOT, "help", description); if (modelField.getIsAutoCreatedInternal()) "".toString(); if (modelField.getFieldSet() != null && !modelField.getFieldSet().trim().isEmpty()) "".toString(); if (modelField.getValidators() != null && !modelField.getValidators().isEmpty()) "".toString(); setClassifier(delegator, forms, eAttribute, modelField); return eAttribute; } public static void setClassifier(Delegator delegator, List<ModelForm> forms, EAttribute eAttribute, ModelField modelField) { ModelFieldType modelFieldType = delegator.getModelFieldTypeReader(modelField.getModelEntity()).getModelFieldType(modelField.getType()); switch (modelField.getType()) { case "name": case "description": case "credit-card-number": case "credit-card-date": case "email": case "comment": case "tel-number": case "url": addAnnotationKey(eAttribute, Slot.NS_PREFIX_FORMAT, "type", modelField.getType()); eAttribute.setEType(EcorePackage.eINSTANCE.getEString()); break; // string case "id-ne": case "id-long-ne": case "id-vlong-ne": case "id": case "id-long": case "id-vlong": case "blob": case "long-varchar": case "short-varchar": case "value": case "very-short": case "very-long": addAnnotationLength(eAttribute, modelFieldType); eAttribute.setEType(EcorePackage.eINSTANCE.getEString()); break; // big decimal case "currency-amount": case "currency-precise": case "fixed-point": addAnnotationKey(eAttribute, Slot.NS_PREFIX_FORMAT, "type", modelField.getType()); addAnnotationLength(eAttribute, modelFieldType); eAttribute.setEType(EcorePackage.eINSTANCE.getEBigDecimal()); break; // date case "date-time": case "date": case "time": eAttribute.setEType(EcorePackage.eINSTANCE.getEDate()); break; // long case "numeric": eAttribute.setEType(EcorePackage.eINSTANCE.getELong()); addAnnotationLength(eAttribute, modelFieldType); break; // object case "object": eAttribute.setEType(EcorePackage.eINSTANCE.getEJavaObject()); break; // byte array case "byte-array": eAttribute.setEType(EcorePackage.eINSTANCE.getEByteArray()); break; // double case "floating-point": eAttribute.setEType(EcorePackage.eINSTANCE.getEDouble()); addAnnotationLength(eAttribute, modelFieldType); break; // char case "indicator": { setClassifierIndicator(forms, eAttribute, modelField); break; } default: LOGGER.warn("Unknown field type {}", modelField); return; } } private static void addAnnotationLength(EAttribute eAttribute, ModelFieldType modelFieldType) { if (modelFieldType == null) return; if (modelFieldType.getSqlType().contains("(")) { int x = modelFieldType.getSqlType().indexOf("("); int y = modelFieldType.getSqlType().indexOf(")"); String token = modelFieldType.getSqlType().substring(x + 1, y); String tokens[] = token.split(","); if (tokens.length > 1) { addAnnotationKey(eAttribute, Slot.NS_PREFIX_FORMAT, "precision", tokens[0].trim()); addAnnotationKey(eAttribute, Slot.NS_PREFIX_FORMAT, "scale", tokens[1].trim()); } else addAnnotationKey(eAttribute, Slot.NS_PREFIX_FORMAT, "length", tokens[0].trim()); } } private static void setClassifierIndicator(List<ModelForm> forms, EAttribute eAttribute, ModelField modelField) { ModelFormField formField = null; for (ModelForm form : FormUtils.searchForm(forms, modelField.getModelEntity().getEntityName())) { formField = FormUtils.searchField(form, modelField.getName()); if (formField != null) break; } boolean isBoolean = FormUtils.isBoolean(modelField, formField); boolean allowEmpty = FormUtils.allowEmpty(modelField, formField); Object defaulValue = FormUtils.getDefaultValue(modelField, formField); if (!allowEmpty) eAttribute.setLowerBound(1); if (isBoolean) { if (!allowEmpty) eAttribute.setEType(EcorePackage.eINSTANCE.getEBoolean()); else eAttribute.setEType(EcorePackage.eINSTANCE.getEBooleanObject()); if (defaulValue == Boolean.TRUE) eAttribute.setDefaultValue(defaulValue); } else { // TODO create Enum addAnnotationKey(eAttribute, Slot.NS_PREFIX_FORMAT, "type", modelField.getType()); eAttribute.setEType(EcorePackage.eINSTANCE.getEString()); eAttribute.setDefaultValue(defaulValue); } } }
c6b89cc24445315f7ca07e9f039c93937dd8079d
526c41ac02d7054354d064cfca539f33ef6cd289
/app/src/main/java/com/bharatiyajob/bharatiyajob/User/CandidateNotification/notification_list/CandidateNotificationFragment.java
da03be351b3518182ed58a44b747ccf2abf30799
[]
no_license
pankaj1920/BharatiyaJob
b4883904b551431f0bc0eaadfd7f0af417b231db
db4605ad684ff7b70c61906181d9f20376e2f62b
refs/heads/master
2023-02-06T04:31:27.870135
2020-12-23T01:29:57
2020-12-23T01:29:57
294,958,518
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package com.bharatiyajob.bharatiyajob.User.CandidateNotification.notification_list; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.bharatiyajob.bharatiyajob.R; public class CandidateNotificationFragment extends Fragment { public CandidateNotificationFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_candidate_notification, container, false); } }
7c1b4155ddc142096dc571f19753432d331bc90b
489ab0d1ed57f90c3c72f3e645cd64d45efa7313
/src/_04_popcorn/popcorn_runner.java
29251feb0e6fb608ff7fbf43c61f5b287fe83ca3
[]
no_license
League-Level1-Student/level1-module1-williamyufan
576785300b703d05e73f35470f6b8ca9df7a262f
88709dcd3905e318e9e4ee10ee89224ddf7295a3
refs/heads/master
2020-07-08T13:47:12.040147
2019-12-12T04:00:11
2019-12-12T04:00:11
203,693,056
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package _04_popcorn; import javax.swing.JOptionPane; public class popcorn_runner { public static void main(String[] args) { String y= JOptionPane.showInputDialog("What flavor do you want?"); String j=JOptionPane.showInputDialog("How many minutes do you want the popcorn to be cocked?"); int u=Integer.parseInt(j); Popcorn n=new Popcorn(y); Microwave b=new Microwave(); b.putInMicrowave(n); b.setTime(u); b.startMicrowave(); } }
3ffe9aa011a2b3766cbf77d67433c12a98b07ba5
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Gson-15/com.google.gson.stream.JsonWriter/BBC-F0-opt-90/11/com/google/gson/stream/JsonWriter_ESTest_scaffolding.java
a2e4c7e98c26e17a8ed57b1513f27967165075a6
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
3,181
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Wed Oct 20 23:47:18 GMT 2021 */ package com.google.gson.stream; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class JsonWriter_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "com.google.gson.stream.JsonWriter"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { /*No java.lang.System property to set*/ } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(JsonWriter_ESTest_scaffolding.class.getClassLoader() , "com.google.gson.stream.JsonWriter" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(JsonWriter_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "com.google.gson.stream.JsonWriter" ); } }
2335e36ebffd3953254e410bd12c84610fd6e630
525bef1c13d03393ec176faf7ea0b5025abe85c7
/work/jspc/java/org/jivesoftware/openfire/admin/group_002dsummary_jsp.java
9ab250a00b036d2c5d6b56a5a693667f8f75e29d
[]
no_license
UniqueJoker11/openfire
b3d5a6c8b8f62376975252f4168fbd9a337a1ef6
10dc456abe50e85688ad3033bf7ca705fdbc70f4
refs/heads/master
2016-09-12T10:14:57.417200
2016-04-28T08:39:02
2016-04-28T08:39:02
57,284,626
0
0
null
null
null
null
UTF-8
Java
false
false
37,326
java
/* * Generated by the Jasper component of Apache Tomcat * Version: JspC/ApacheTomcat8 * Generated at: 2016-04-28 05:15:33 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.jivesoftware.openfire.admin; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import org.jivesoftware.util.*; import java.util.*; import org.jivesoftware.openfire.group.*; import java.net.URLEncoder; public final class group_002dsummary_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.release(); } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\n\n\n\n\n\n\n"); org.jivesoftware.util.WebManager webManager = null; webManager = (org.jivesoftware.util.WebManager) _jspx_page_context.getAttribute("webManager", javax.servlet.jsp.PageContext.PAGE_SCOPE); if (webManager == null){ webManager = new org.jivesoftware.util.WebManager(); _jspx_page_context.setAttribute("webManager", webManager, javax.servlet.jsp.PageContext.PAGE_SCOPE); } out.write('\n'); webManager.init(request, response, session, application, out ); out.write("\n\n<html>\n <head>\n <title>"); if (_jspx_meth_fmt_005fmessage_005f0(_jspx_page_context)) return; out.write("</title>\n <meta name=\"pageID\" content=\"group-summary\"/>\n <meta name=\"helpPage\" content=\"about_users_and_groups.html\"/>\n </head>\n <body>\n\n"); // Get parameters int start = ParamUtils.getIntParameter(request,"start",0); int range = ParamUtils.getIntParameter(request,"range",webManager.getRowsPerPage("group-summary", 15)); if (request.getParameter("range") != null) { webManager.setRowsPerPage("group-summary", range); } int groupCount = webManager.getGroupManager().getGroupCount(); Collection<Group> groups = webManager.getGroupManager().getGroups(start, range); String search = null; if (webManager.getGroupManager().isSearchSupported() && request.getParameter("search") != null && !request.getParameter("search").trim().equals("")) { search = request.getParameter("search"); // Santize variables to prevent vulnerabilities search = StringUtils.escapeHTMLTags(search); // Use the search terms to get the list of groups and group count. groups = webManager.getGroupManager().search(search, start, range); // Get the count as a search for *all* groups. That will let us do pagination even // though it's a bummer to execute the search twice. groupCount = webManager.getGroupManager().search(search).size(); } // paginator vars int numPages = (int)Math.ceil((double)groupCount/(double)range); int curPage = (start/range) + 1; out.write('\n'); out.write('\n'); if (request.getParameter("deletesuccess") != null) { out.write("\n\n <div class=\"jive-success\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tbody>\n <tr><td class=\"jive-icon\"><img src=\"images/success-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\n <td class=\"jive-icon-label\">\n "); if (_jspx_meth_fmt_005fmessage_005f1(_jspx_page_context)) return; out.write("\n </td></tr>\n </tbody>\n </table>\n </div><br>\n\n"); } out.write('\n'); out.write('\n'); if (webManager.getGroupManager().isSearchSupported()) { out.write("\n\n<form action=\"group-summary.jsp\" method=\"get\" name=\"searchForm\">\n<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n <tr>\n <td valign=\"bottom\">\n"); if (_jspx_meth_fmt_005fmessage_005f2(_jspx_page_context)) return; out.write(" <b>"); out.print( groupCount ); out.write("</b>\n"); if (numPages > 1) { out.write("\n\n , "); if (_jspx_meth_fmt_005fmessage_005f3(_jspx_page_context)) return; out.write(' '); out.print( LocaleUtils.getLocalizedNumber(start+1) ); out.write('-'); out.print( LocaleUtils.getLocalizedNumber(start+range > groupCount ? groupCount:start+range) ); out.write('\n'); out.write('\n'); } out.write("\n </td>\n <td align=\"right\" valign=\"bottom\">\n "); if (_jspx_meth_fmt_005fmessage_005f4(_jspx_page_context)) return; out.write(": <input type=\"text\" size=\"30\" maxlength=\"150\" name=\"search\" value=\""); out.print( ((search!=null) ? search : "") ); out.write("\">\n </td>\n </tr>\n</table>\n</form>\n\n<script language=\"JavaScript\" type=\"text/javascript\">\ndocument.searchForm.search.focus();\n</script>\n\n"); } // Otherwise, searching is not supported. else { out.write("\n <p>\n "); if (_jspx_meth_fmt_005fmessage_005f5(_jspx_page_context)) return; out.write(" <b>"); out.print( groupCount ); out.write("</b>\n "); if (numPages > 1) { out.write("\n\n , "); if (_jspx_meth_fmt_005fmessage_005f6(_jspx_page_context)) return; out.write(' '); out.print( (start+1) ); out.write('-'); out.print( (start+range) ); out.write("\n\n "); } out.write("\n </p>\n"); } out.write('\n'); out.write('\n'); if (numPages > 1) { out.write("\n\n <p>\n "); if (_jspx_meth_fmt_005fmessage_005f7(_jspx_page_context)) return; out.write("\n [\n "); for (int i=0; i<numPages; i++) { String sep = ((i+1)<numPages) ? " " : ""; boolean isCurrent = (i+1) == curPage; out.write("\n <a href=\"group-summary.jsp?start="); out.print( (i*range) ); out.print( search!=null? "&search=" + URLEncoder.encode(search, "UTF-8") : ""); out.write("\"\n class=\""); out.print( ((isCurrent) ? "jive-current" : "") ); out.write("\"\n >"); out.print( (i+1) ); out.write("</a>"); out.print( sep ); out.write("\n\n "); } out.write("\n ]\n </p>\n\n"); } out.write("\n\n<div class=\"jive-table\">\n<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n<thead>\n <tr>\n <th>&nbsp;</th>\n <th nowrap>"); if (_jspx_meth_fmt_005fmessage_005f8(_jspx_page_context)) return; out.write("</th>\n <th nowrap>"); if (_jspx_meth_fmt_005fmessage_005f9(_jspx_page_context)) return; out.write("</th>\n <th nowrap>"); if (_jspx_meth_fmt_005fmessage_005f10(_jspx_page_context)) return; out.write("</th>\n "); // Only show edit and delete options if the groups aren't read-only. if (!webManager.getGroupManager().isReadOnly()) { out.write("\n <th nowrap>"); if (_jspx_meth_fmt_005fmessage_005f11(_jspx_page_context)) return; out.write("</th>\n <th nowrap>"); if (_jspx_meth_fmt_005fmessage_005f12(_jspx_page_context)) return; out.write("</th>\n "); } out.write("\n </tr>\n</thead>\n<tbody>\n\n"); // Print the list of groups if (groups.isEmpty()) { out.write("\n <tr>\n <td align=\"center\" colspan=\"6\">\n "); if (_jspx_meth_fmt_005fmessage_005f13(_jspx_page_context)) return; out.write("\n </td>\n </tr>\n\n"); } int i = start; for (Group group : groups) { String groupName = URLEncoder.encode(group.getName(), "UTF-8"); i++; out.write("\n <tr class=\"jive-"); out.print( (((i%2)==0) ? "even" : "odd") ); out.write("\">\n <td width=\"1%\" valign=\"top\">\n "); out.print( i ); out.write("\n </td>\n <td width=\"60%\">\n <a href=\"group-edit.jsp?group="); out.print( groupName ); out.write('"'); out.write('>'); out.print( StringUtils.escapeHTMLTags(group.getName()) ); out.write("</a>\n "); if (group.getDescription() != null) { out.write("\n <br>\n <span class=\"jive-description\">\n "); out.print( StringUtils.escapeHTMLTags(group.getDescription()) ); out.write("\n </span>\n "); } out.write("\n </td>\n <td width=\"10%\" align=\"center\">\n "); out.print( group.getMembers().size() ); out.write("\n </td>\n <td width=\"10%\" align=\"center\">\n "); out.print( group.getAdmins().size() ); out.write("\n </td>\n "); // Only show edit and delete options if the groups aren't read-only. if (!webManager.getGroupManager().isReadOnly()) { out.write("\n <td width=\"1%\" align=\"center\">\n <a href=\"group-edit.jsp?group="); out.print( groupName ); out.write("\"\n title="); if (_jspx_meth_fmt_005fmessage_005f14(_jspx_page_context)) return; out.write("\n ><img src=\"images/edit-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></a>\n </td>\n <td width=\"1%\" align=\"center\" style=\"border-right:1px #ccc solid;\">\n <a href=\"group-delete.jsp?group="); out.print( groupName ); out.write("\"\n title="); if (_jspx_meth_fmt_005fmessage_005f15(_jspx_page_context)) return; out.write("\n ><img src=\"images/delete-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></a>\n </td>\n "); } out.write("\n </tr>\n\n"); } out.write("\n</tbody>\n</table>\n</div>\n\n"); if (numPages > 1) { out.write("\n <br>\n <p>\n "); if (_jspx_meth_fmt_005fmessage_005f16(_jspx_page_context)) return; out.write("\n [\n "); for (i=0; i<numPages; i++) { String sep = ((i+1)<numPages) ? " " : ""; boolean isCurrent = (i+1) == curPage; out.write("\n <a href=\"group-summary.jsp?start="); out.print( (i*range) ); out.print( search!=null? "&search=" + URLEncoder.encode(search, "UTF-8") : ""); out.write("\"\n class=\""); out.print( ((isCurrent) ? "jive-current" : "") ); out.write("\"\n >"); out.print( (i+1) ); out.write("</a>"); out.print( sep ); out.write("\n\n "); } out.write("\n ]\n </p>\n\n"); } out.write("\n\n </body>\n</html>\n"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } private boolean _jspx_meth_fmt_005fmessage_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f0 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f0.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f0.setParent(null); // /group-summary.jsp(35,15) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f0.setKey("group.summary.title"); int _jspx_eval_fmt_005fmessage_005f0 = _jspx_th_fmt_005fmessage_005f0.doStartTag(); if (_jspx_th_fmt_005fmessage_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f0); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f0); return false; } private boolean _jspx_meth_fmt_005fmessage_005f1(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f1 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f1.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f1.setParent(null); // /group-summary.jsp(78,8) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f1.setKey("group.summary.delete_group"); int _jspx_eval_fmt_005fmessage_005f1 = _jspx_th_fmt_005fmessage_005f1.doStartTag(); if (_jspx_th_fmt_005fmessage_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f1); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f1); return false; } private boolean _jspx_meth_fmt_005fmessage_005f2(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f2 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f2.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f2.setParent(null); // /group-summary.jsp(92,0) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f2.setKey("group.summary.total_group"); int _jspx_eval_fmt_005fmessage_005f2 = _jspx_th_fmt_005fmessage_005f2.doStartTag(); if (_jspx_th_fmt_005fmessage_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f2); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f2); return false; } private boolean _jspx_meth_fmt_005fmessage_005f3(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f3 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f3.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f3.setParent(null); // /group-summary.jsp(95,6) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f3.setKey("global.showing"); int _jspx_eval_fmt_005fmessage_005f3 = _jspx_th_fmt_005fmessage_005f3.doStartTag(); if (_jspx_th_fmt_005fmessage_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f3); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f3); return false; } private boolean _jspx_meth_fmt_005fmessage_005f4(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f4 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f4.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f4.setParent(null); // /group-summary.jsp(100,3) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f4.setKey("group.summary.search"); int _jspx_eval_fmt_005fmessage_005f4 = _jspx_th_fmt_005fmessage_005f4.doStartTag(); if (_jspx_th_fmt_005fmessage_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f4); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f4); return false; } private boolean _jspx_meth_fmt_005fmessage_005f5(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f5 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f5.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f5.setParent(null); // /group-summary.jsp(115,4) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f5.setKey("group.summary.total_group"); int _jspx_eval_fmt_005fmessage_005f5 = _jspx_th_fmt_005fmessage_005f5.doStartTag(); if (_jspx_th_fmt_005fmessage_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f5); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f5); return false; } private boolean _jspx_meth_fmt_005fmessage_005f6(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f6 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f6.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f6.setParent(null); // /group-summary.jsp(118,10) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f6.setKey("global.showing"); int _jspx_eval_fmt_005fmessage_005f6 = _jspx_th_fmt_005fmessage_005f6.doStartTag(); if (_jspx_th_fmt_005fmessage_005f6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f6); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f6); return false; } private boolean _jspx_meth_fmt_005fmessage_005f7(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f7 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f7.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f7.setParent(null); // /group-summary.jsp(127,4) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f7.setKey("global.pages"); int _jspx_eval_fmt_005fmessage_005f7 = _jspx_th_fmt_005fmessage_005f7.doStartTag(); if (_jspx_th_fmt_005fmessage_005f7.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f7); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f7); return false; } private boolean _jspx_meth_fmt_005fmessage_005f8(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f8 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f8.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f8.setParent(null); // /group-summary.jsp(148,19) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f8.setKey("group.summary.page_name"); int _jspx_eval_fmt_005fmessage_005f8 = _jspx_th_fmt_005fmessage_005f8.doStartTag(); if (_jspx_th_fmt_005fmessage_005f8.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f8); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f8); return false; } private boolean _jspx_meth_fmt_005fmessage_005f9(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f9 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f9.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f9.setParent(null); // /group-summary.jsp(149,19) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f9.setKey("group.summary.page_member"); int _jspx_eval_fmt_005fmessage_005f9 = _jspx_th_fmt_005fmessage_005f9.doStartTag(); if (_jspx_th_fmt_005fmessage_005f9.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f9); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f9); return false; } private boolean _jspx_meth_fmt_005fmessage_005f10(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f10 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f10.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f10.setParent(null); // /group-summary.jsp(150,19) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f10.setKey("group.summary.page_admin"); int _jspx_eval_fmt_005fmessage_005f10 = _jspx_th_fmt_005fmessage_005f10.doStartTag(); if (_jspx_th_fmt_005fmessage_005f10.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f10); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f10); return false; } private boolean _jspx_meth_fmt_005fmessage_005f11(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f11 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f11.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f11.setParent(null); // /group-summary.jsp(153,19) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f11.setKey("group.summary.page_edit"); int _jspx_eval_fmt_005fmessage_005f11 = _jspx_th_fmt_005fmessage_005f11.doStartTag(); if (_jspx_th_fmt_005fmessage_005f11.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f11); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f11); return false; } private boolean _jspx_meth_fmt_005fmessage_005f12(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f12 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f12.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f12.setParent(null); // /group-summary.jsp(154,19) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f12.setKey("global.delete"); int _jspx_eval_fmt_005fmessage_005f12 = _jspx_th_fmt_005fmessage_005f12.doStartTag(); if (_jspx_th_fmt_005fmessage_005f12.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f12); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f12); return false; } private boolean _jspx_meth_fmt_005fmessage_005f13(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f13 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f13.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f13.setParent(null); // /group-summary.jsp(165,12) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f13.setKey("group.summary.no_groups"); int _jspx_eval_fmt_005fmessage_005f13 = _jspx_th_fmt_005fmessage_005f13.doStartTag(); if (_jspx_th_fmt_005fmessage_005f13.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f13); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f13); return false; } private boolean _jspx_meth_fmt_005fmessage_005f14(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f14 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f14.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f14.setParent(null); // /group-summary.jsp(199,19) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f14.setKey("global.click_edit"); int _jspx_eval_fmt_005fmessage_005f14 = _jspx_th_fmt_005fmessage_005f14.doStartTag(); if (_jspx_th_fmt_005fmessage_005f14.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f14); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f14); return false; } private boolean _jspx_meth_fmt_005fmessage_005f15(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f15 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f15.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f15.setParent(null); // /group-summary.jsp(204,19) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f15.setKey("global.click_delete"); int _jspx_eval_fmt_005fmessage_005f15 = _jspx_th_fmt_005fmessage_005f15.doStartTag(); if (_jspx_th_fmt_005fmessage_005f15.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f15); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f15); return false; } private boolean _jspx_meth_fmt_005fmessage_005f16(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f16 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f16.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f16.setParent(null); // /group-summary.jsp(220,4) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f16.setKey("global.pages"); int _jspx_eval_fmt_005fmessage_005f16 = _jspx_th_fmt_005fmessage_005f16.doStartTag(); if (_jspx_th_fmt_005fmessage_005f16.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f16); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f16); return false; } }
255761c1d12d200fcff3d185739fe34a86ca9738
ee731d0acfb6dc9465d6842245ba91a02ef93fcc
/date-time/src/date1/DateDemo3.java
8d97e7c2c5c82f6756739105d1db132dfc69a156
[]
no_license
siwolsmu89/J_HTA_java_workspace
6a668c421c5ada7b792be0ee0a94b3232bd109ca
43b0bae8e5b7cb68513d8670b136f098d7b8a4e1
refs/heads/master
2022-11-18T17:23:29.458359
2020-07-20T08:57:02
2020-07-20T08:57:02
258,408,262
2
0
null
null
null
null
UTF-8
Java
false
false
1,134
java
package date1; import java.text.SimpleDateFormat; import java.util.Date; public class DateDemo3 { public static void main(String[] args) { /* * Date를 지정된 형식의 문자열로 변환하기 */ Date today = new Date(); SimpleDateFormat df = new SimpleDateFormat("yyyy년 M월 d일(EEEE) Hmss"); String formatedText = df.format(today); System.out.println(formatedText); } /* * 패턴 출력내용 출력값 비고 * --------------------------------------------------------- * yyyy 년 2020 * MM 월 04 1~9월을 01~09로 표시 * M 월 4 1~9월을 1~9로 표시 (10월부터는 10~12로 표시됨) * dd 일 06 * d 일 6 * yyyy-MM-dd 2020-04-06 * yyyy.M.d. 2020.4.6. * yyyy년 M월 d일 2020년 4월 6일 * * EEEE 요일 월요일 영어로는 Monday * E, EEE 요일 월 영어로는 M, MON * a 오전/오후 오전 * H, HH 24시간제(0~23시) 1, 01 * h, hh 12시간제(1~12시) 1, 01 * m, mm 분(0~59) 1, 01 * s, ss 초(0~59) 1, 01 * */ }
213b0bac288603f01a7a9483a4d7d82818a31592
c08bed806e621d9c0813ec3f2e8fd4566ece9ad6
/src/com/makina/collect/android/activities/FormEntryActivity.java
601f8343fd9f149dc87ce29d437ebf0bfc6ca01a
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "Apache-2.0" ]
permissive
guisalmon/ODK_collect
b3ae726dabdf0639e8c71d279cae87f225f8c5a7
f6a807e8b9eb7d4e043a1c182e441e0b3fd5e493
refs/heads/master
2021-01-17T06:19:11.012426
2013-07-22T16:13:37
2013-07-22T16:13:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
84,170
java
/* * Copyright (C) 2009 University of Washington * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.makina.collect.android.activities; import java.io.File; import java.io.FileFilter; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.LinkedHashMap; import java.util.Locale; import org.javarosa.core.model.FormIndex; import org.javarosa.core.model.data.IAnswerData; import org.javarosa.form.api.FormEntryCaption; import org.javarosa.form.api.FormEntryController; import org.javarosa.form.api.FormEntryPrompt; import org.javarosa.model.xform.XFormsModule; import org.javarosa.xpath.XPathTypeMismatchException; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.BaseColumns; import android.provider.MediaStore.MediaColumns; import android.text.InputFilter; import android.text.Spanned; import android.util.DisplayMetrics; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.GestureDetector; import android.view.GestureDetector.OnGestureListener; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; import android.view.animation.AnimationUtils; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; import com.makina.collect.android.R; import com.makina.collect.android.application.Collect; import com.makina.collect.android.listeners.AdvanceToNextListener; import com.makina.collect.android.listeners.FormLoaderListener; import com.makina.collect.android.listeners.FormSavedListener; import com.makina.collect.android.listeners.WidgetAnsweredListener; import com.makina.collect.android.logic.FormController; import com.makina.collect.android.logic.FormController.FailedConstraint; import com.makina.collect.android.logic.PropertyManager; import com.makina.collect.android.preferences.AdminPreferencesActivity; import com.makina.collect.android.preferences.PreferencesActivity; import com.makina.collect.android.provider.FormsProviderAPI.FormsColumns; import com.makina.collect.android.provider.InstanceProviderAPI; import com.makina.collect.android.provider.InstanceProviderAPI.InstanceColumns; import com.makina.collect.android.tasks.FormLoaderTask; import com.makina.collect.android.tasks.SaveToDiskTask; import com.makina.collect.android.utilities.FileUtils; import com.makina.collect.android.utilities.MediaUtils; import com.makina.collect.android.views.ODKView; import com.makina.collect.android.widgets.QuestionWidget; /** * FormEntryActivity is responsible for displaying questions, animating * transitions between questions, and allowing the user to enter data. * * @author Carl Hartung ([email protected]) */ public class FormEntryActivity extends SherlockActivity implements AnimationListener, FormLoaderListener, FormSavedListener, AdvanceToNextListener, OnGestureListener, WidgetAnsweredListener { private static final String t = "FormEntryActivity"; // save with every swipe forward or back. Timings indicate this takes .25 // seconds. // if it ever becomes an issue, this value can be changed to save every n'th // screen. private static final int SAVEPOINT_INTERVAL = 1; // Defines for FormEntryActivity private static final boolean EXIT = true; private static final boolean DO_NOT_EXIT = false; private static final boolean EVALUATE_CONSTRAINTS = true; private static final boolean DO_NOT_EVALUATE_CONSTRAINTS = false; // Request codes for returning data from specified intent. public static final int IMAGE_CAPTURE = 1; public static final int BARCODE_CAPTURE = 2; public static final int AUDIO_CAPTURE = 3; public static final int VIDEO_CAPTURE = 4; public static final int LOCATION_CAPTURE = 5; public static final int HIERARCHY_ACTIVITY = 6; public static final int IMAGE_CHOOSER = 7; public static final int AUDIO_CHOOSER = 8; public static final int VIDEO_CHOOSER = 9; public static final int EX_STRING_CAPTURE = 10; public static final int EX_INT_CAPTURE = 11; public static final int EX_DECIMAL_CAPTURE = 12; public static final int DRAW_IMAGE = 13; public static final int SIGNATURE_CAPTURE = 14; public static final int ANNOTATE_IMAGE = 15; // Extra returned from gp activity public static final String LOCATION_RESULT = "LOCATION_RESULT"; public static final String KEY_INSTANCES = "instances"; public static final String KEY_SUCCESS = "success"; public static final String KEY_ERROR = "error"; // Identifies the gp of the form used to launch form entry public static final String KEY_FORMPATH = "formpath"; // Identifies whether this is a new form, or reloading a form after a screen // rotation (or similar) private static final String NEWFORM = "newform"; // these are only processed if we shut down and are restoring after an // external intent fires public static final String KEY_INSTANCEPATH = "instancepath"; public static final String KEY_XPATH = "xpath"; public static final String KEY_XPATH_WAITING_FOR_DATA = "xpathwaiting"; private static final int MENU_LANGUAGES = Menu.FIRST; private static final int MENU_HIERARCHY_VIEW = Menu.FIRST + 1; private static final int MENU_SAVE = Menu.FIRST + 2; private static final int PROGRESS_DIALOG = 1; private static final int SAVING_DIALOG = 2; // Random ID private static final int DELETE_REPEAT = 654321; private String mFormPath; private GestureDetector mGestureDetector; private Animation mInAnimation; private Animation mOutAnimation; private ScrollView mStaleView = null; private LinearLayout mQuestionHolder; private ScrollView mCurrentView; private AlertDialog mAlertDialog; private ProgressDialog mProgressDialog; private String mErrorMessage; private Menu menu; private int mY; // used to limit forward/backward swipes to one per question private boolean mBeenSwiped = false; private int viewCount = 0; private FormLoaderTask mFormLoaderTask; private SaveToDiskTask mSaveToDiskTask; private ImageButton mNextButton; private ImageButton mBackButton; private boolean mAnswersChanged; private boolean mToFormChooser; enum AnimationType { LEFT, RIGHT, FADE, NONE } private SharedPreferences mAdminPreferences; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i("FormEntryActivity", "onCreate"); // must be at the beginning of any activity that can be called from an // external intent try { Collect.createODKDirs(); } catch (RuntimeException e) { createErrorDialog(e.getMessage(), EXIT); return; } setContentView(R.layout.form_entry); setTitle(getString(R.string.loading_form)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); Intent intent = getIntent(); if (intent != null && intent.getExtras() != null) { if (intent.hasExtra("newForm")){ mToFormChooser = true; } }else{ mToFormChooser = false; } mBeenSwiped = false; mAlertDialog = null; mCurrentView = null; mInAnimation = null; mOutAnimation = null; mGestureDetector = new GestureDetector(this); mQuestionHolder = (LinearLayout) findViewById(R.id.questionholder); // get admin preference settings mAdminPreferences = getSharedPreferences( AdminPreferencesActivity.ADMIN_PREFERENCES, 0); mNextButton = (ImageButton) findViewById(R.id.form_forward_button); mNextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mBeenSwiped = true; showNextView(); } }); mBackButton = (ImageButton) findViewById(R.id.form_back_button); mBackButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mBeenSwiped = true; showPreviousView(); } }); // Load JavaRosa modules. needed to restore forms. new XFormsModule().registerModule(); // needed to override rms property manager org.javarosa.core.services.PropertyManager .setPropertyManager(new PropertyManager(getApplicationContext())); String startingXPath = null; String waitingXPath = null; String instancePath = null; Boolean newForm = true; if (savedInstanceState != null) { if (savedInstanceState.containsKey(KEY_FORMPATH)) { mFormPath = savedInstanceState.getString(KEY_FORMPATH); } if (savedInstanceState.containsKey(KEY_INSTANCEPATH)) { instancePath = savedInstanceState.getString(KEY_INSTANCEPATH); } if (savedInstanceState.containsKey(KEY_XPATH)) { startingXPath = savedInstanceState.getString(KEY_XPATH); Log.i(t, "startingXPath is: " + startingXPath); } if (savedInstanceState.containsKey(KEY_XPATH_WAITING_FOR_DATA)) { waitingXPath = savedInstanceState .getString(KEY_XPATH_WAITING_FOR_DATA); Log.i(t, "waitingXPath is: " + waitingXPath); } if (savedInstanceState.containsKey(NEWFORM)) { newForm = savedInstanceState.getBoolean(NEWFORM, true); } if (savedInstanceState.containsKey(KEY_ERROR)) { mErrorMessage = savedInstanceState.getString(KEY_ERROR); } } // If a parse error message is showing then nothing else is loaded // Dialogs mid form just disappear on rotation. if (mErrorMessage != null) { createErrorDialog(mErrorMessage, EXIT); return; } // Check to see if this is a screen flip or a new form load. Object data = getLastNonConfigurationInstance(); if (data instanceof FormLoaderTask) { mFormLoaderTask = (FormLoaderTask) data; } else if (data instanceof SaveToDiskTask) { mSaveToDiskTask = (SaveToDiskTask) data; } else if (data == null) { if (!newForm) { if (Collect.getInstance().getFormController() != null) { refreshCurrentView(); } else { Log.w(t, "Reloading form and restoring state."); // we need to launch the form loader to load the form // controller... mFormLoaderTask = new FormLoaderTask(instancePath, startingXPath, waitingXPath); Collect.getInstance().getActivityLogger() .logAction(this, "formReloaded", mFormPath); // TODO: this doesn' work (dialog does not get removed): // showDialog(PROGRESS_DIALOG); // show dialog before we execute... mFormLoaderTask.execute(mFormPath); } return; } // Not a restart from a screen orientation change (or other). Collect.getInstance().setFormController(null); if (intent != null) { Uri uri = intent.getData(); if (getContentResolver().getType(uri) == InstanceColumns.CONTENT_ITEM_TYPE) { // get the formId and version for this instance... String jrFormId = null; String jrVersion = null; { Cursor instanceCursor = null; try { instanceCursor = getContentResolver().query(uri, null, null, null, null); if (instanceCursor.getCount() != 1) { this.createErrorDialog("Bad URI: " + uri, EXIT); return; } else { instanceCursor.moveToFirst(); instancePath = instanceCursor .getString(instanceCursor .getColumnIndex(InstanceColumns.INSTANCE_FILE_PATH)); Collect.getInstance() .getActivityLogger() .logAction(this, "instanceLoaded", instancePath); jrFormId = instanceCursor .getString(instanceCursor .getColumnIndex(InstanceColumns.JR_FORM_ID)); int idxJrVersion = instanceCursor .getColumnIndex(InstanceColumns.JR_VERSION); jrVersion = instanceCursor.isNull(idxJrVersion) ? null : instanceCursor .getString(idxJrVersion); } } finally { if (instanceCursor != null) { instanceCursor.close(); } } } String[] selectionArgs; String selection; if (jrVersion == null) { selectionArgs = new String[] { jrFormId }; selection = FormsColumns.JR_FORM_ID + "=? AND " + FormsColumns.JR_VERSION + " IS NULL"; } else { selectionArgs = new String[] { jrFormId, jrVersion }; selection = FormsColumns.JR_FORM_ID + "=? AND " + FormsColumns.JR_VERSION + "=?"; } { Cursor formCursor = null; try { formCursor = getContentResolver().query( FormsColumns.CONTENT_URI, null, selection, selectionArgs, null); if (formCursor.getCount() == 1) { formCursor.moveToFirst(); mFormPath = formCursor .getString(formCursor .getColumnIndex(FormsColumns.FORM_FILE_PATH)); } else if (formCursor.getCount() < 1) { this.createErrorDialog( getString( R.string.parent_form_not_present, jrFormId) + ((jrVersion == null) ? "" : "\n" + getString(R.string.version) + " " + jrVersion), EXIT); return; } else if (formCursor.getCount() > 1) { // still take the first entry, but warn that // there are multiple rows. // user will need to hand-edit the SQLite // database to fix it. formCursor.moveToFirst(); mFormPath = formCursor .getString(formCursor .getColumnIndex(FormsColumns.FORM_FILE_PATH)); this.createErrorDialog( "Multiple matching form definitions exist", DO_NOT_EXIT); } } finally { if (formCursor != null) { formCursor.close(); } } } } else if (getContentResolver().getType(uri) == FormsColumns.CONTENT_ITEM_TYPE) { Cursor c = null; try { c = getContentResolver().query(uri, null, null, null, null); if (c.getCount() != 1) { this.createErrorDialog("Bad URI: " + uri, EXIT); return; } else { c.moveToFirst(); mFormPath = c .getString(c .getColumnIndex(FormsColumns.FORM_FILE_PATH)); // This is the fill-blank-form code path. // See if there is a savepoint for this form that // has never been // explicitly saved // by the user. If there is, open this savepoint // (resume this filled-in // form). // Savepoints for forms that were explicitly saved // will be recovered // when that // explicitly saved instance is edited via // edit-saved-form. final String filePrefix = mFormPath.substring( mFormPath.lastIndexOf('/') + 1, mFormPath.lastIndexOf('.')) + "_"; final String fileSuffix = ".xml.save"; File cacheDir = new File(Collect.CACHE_PATH); File[] files = cacheDir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { String name = pathname.getName(); return name.startsWith(filePrefix) && name.endsWith(fileSuffix); } }); // see if any of these savepoints are for a // filled-in form that has never been // explicitly saved by the user... for (int i = 0; i < files.length; ++i) { File candidate = files[i]; String instanceDirName = candidate.getName() .substring( 0, candidate.getName().length() - fileSuffix.length()); File instanceDir = new File( Collect.INSTANCES_PATH + File.separator + instanceDirName); File instanceFile = new File(instanceDir, instanceDirName + ".xml"); if (instanceDir.exists() && instanceDir.isDirectory() && !instanceFile.exists()) { // yes! -- use this savepoint file instancePath = instanceFile .getAbsolutePath(); break; } } } } finally { if (c != null) { c.close(); } } } else { Log.e(t, "unrecognized URI"); this.createErrorDialog("unrecognized URI: " + uri, EXIT); return; } mFormLoaderTask = new FormLoaderTask(instancePath, null, null); Collect.getInstance().getActivityLogger() .logAction(this, "formLoaded", mFormPath); showDialog(PROGRESS_DIALOG); // show dialog before we execute... mFormLoaderTask.execute(mFormPath); } } } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_FORMPATH, mFormPath); FormController formController = Collect.getInstance() .getFormController(); if (formController != null) { outState.putString(KEY_INSTANCEPATH, formController .getInstancePath().getAbsolutePath()); outState.putString(KEY_XPATH, formController.getXPath(formController.getFormIndex())); FormIndex waiting = formController.getIndexWaitingForData(); if (waiting != null) { outState.putString(KEY_XPATH_WAITING_FOR_DATA, formController.getXPath(waiting)); } // save the instance to a temp path... SaveToDiskTask.blockingExportTempData(); } outState.putBoolean(NEWFORM, false); outState.putString(KEY_ERROR, mErrorMessage); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); FormController formController = Collect.getInstance() .getFormController(); if (formController == null) { // we must be in the midst of a reload of the FormController. // try to save this callback data to the FormLoaderTask if (mFormLoaderTask != null && mFormLoaderTask.getStatus() != AsyncTask.Status.FINISHED) { mFormLoaderTask.setActivityResult(requestCode, resultCode, intent); } else { Log.e(t, "Got an activityResult without any pending form loader"); } return; } if (resultCode == RESULT_CANCELED) { // request was canceled... if (requestCode != HIERARCHY_ACTIVITY) { ((ODKView) mCurrentView).cancelWaitingForBinaryData(); } return; } switch (requestCode) { case BARCODE_CAPTURE: String sb = intent.getStringExtra("SCAN_RESULT"); ((ODKView) mCurrentView).setBinaryData(sb); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case EX_STRING_CAPTURE: String sv = intent.getStringExtra("value"); ((ODKView) mCurrentView).setBinaryData(sv); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case EX_INT_CAPTURE: Integer iv = intent.getIntExtra("value", 0); ((ODKView) mCurrentView).setBinaryData(iv); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case EX_DECIMAL_CAPTURE: Double dv = intent.getDoubleExtra("value", 0.0); ((ODKView) mCurrentView).setBinaryData(dv); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case DRAW_IMAGE: case ANNOTATE_IMAGE: case SIGNATURE_CAPTURE: case IMAGE_CAPTURE: /* * We saved the image to the tempfile_path, but we really want it to * be in: /sdcard/odk/instances/[current instnace]/something.jpg so * we move it there before inserting it into the content provider. * Once the android image capture bug gets fixed, (read, we move on * from Android 1.6) we want to handle images the audio and video */ // The intent is empty, but we know we saved the image to the temp // file File fi = new File(Collect.TMPFILE_PATH); String mInstanceFolder = formController.getInstancePath() .getParent(); String s = mInstanceFolder + File.separator + System.currentTimeMillis() + ".jpg"; File nf = new File(s); if (!fi.renameTo(nf)) { Log.e(t, "Failed to rename " + fi.getAbsolutePath()); } else { Log.i(t, "renamed " + fi.getAbsolutePath() + " to " + nf.getAbsolutePath()); } ((ODKView) mCurrentView).setBinaryData(nf); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case IMAGE_CHOOSER: /* * We have a saved image somewhere, but we really want it to be in: * /sdcard/odk/instances/[current instnace]/something.jpg so we move * it there before inserting it into the content provider. Once the * android image capture bug gets fixed, (read, we move on from * Android 1.6) we want to handle images the audio and video */ // get gp of chosen file String sourceImagePath = null; Uri selectedImage = intent.getData(); if (selectedImage.toString().startsWith("file")) { sourceImagePath = selectedImage.toString().substring(6); } else { String[] projection = { MediaColumns.DATA }; Cursor cursor = null; try { cursor = getContentResolver().query(selectedImage, projection, null, null, null); int column_index = cursor .getColumnIndexOrThrow(MediaColumns.DATA); cursor.moveToFirst(); sourceImagePath = cursor.getString(column_index); } finally { if (cursor != null) { cursor.close(); } } } // Copy file to sdcard String mInstanceFolder1 = formController.getInstancePath() .getParent(); String destImagePath = mInstanceFolder1 + File.separator + System.currentTimeMillis() + ".jpg"; File source = new File(sourceImagePath); File newImage = new File(destImagePath); FileUtils.copyFile(source, newImage); ((ODKView) mCurrentView).setBinaryData(newImage); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); if (formController.indexIsInFieldList()){ updateView(); } break; case AUDIO_CAPTURE: case VIDEO_CAPTURE: case AUDIO_CHOOSER: case VIDEO_CHOOSER: // For audio/video capture/chooser, we get the URI from the content // provider // then the widget copies the file and makes a new entry in the // content provider. Uri media = intent.getData(); ((ODKView) mCurrentView).setBinaryData(media); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); if (formController.indexIsInFieldList()){ updateView(); } break; case LOCATION_CAPTURE: String sl = intent.getStringExtra(LOCATION_RESULT); ((ODKView) mCurrentView).setBinaryData(sl); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case HIERARCHY_ACTIVITY: // We may have jumped to a new index in hierarchy activity, so // refresh break; } refreshCurrentView(); } /** * Refreshes the current view. the controller and the displayed view can get * out of sync due to dialogs and restarts caused by screen orientation * changes, so they're resynchronized here. */ public void refreshCurrentView() { FormController formController = Collect.getInstance() .getFormController(); int event = formController.getEvent(); // When we refresh, repeat dialog state isn't maintained, so step back // to the previous // question. // Also, if we're within a group labeled 'field list', step back to the // beginning of that // group. // That is, skip backwards over repeat prompts, groups that are not // field-lists, // repeat events, and indexes in field-lists that is not the containing // group. if (event == FormEntryController.EVENT_PROMPT_NEW_REPEAT) { createRepeatDialog(); } else { ScrollView current = createView(event, false); showView(current, AnimationType.FADE); } //update menu cause of sherlock bar supportInvalidateOptionsMenu(); } @Override public boolean onCreateOptionsMenu(Menu menu) { System.out.println("FormEntryActivity : onCreateOptionsMenu"); getSupportMenuInflater().inflate(R.menu.menu_form_entry, menu); menu.add(0, 0, 0, getString(R.string.refresh)).setIcon( R.drawable.ic_menu_refresh).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); this.menu = menu; return super.onCreateOptionsMenu(menu); } @Override public boolean onPrepareOptionsMenu(Menu menu) { FormController formController = Collect.getInstance() .getFormController(); Collect.getInstance().getActivityLogger() .logInstanceAction(this, "onPrepareOptionsMenu", "show"); menu.removeItem(MENU_LANGUAGES); menu.removeItem(MENU_HIERARCHY_VIEW); menu.removeItem(MENU_SAVE); if (mAdminPreferences.getBoolean( AdminPreferencesActivity.KEY_CHANGE_LANGUAGE, true)) { boolean enabled = false; if (formController != null) enabled = (formController.getLanguages() == null || formController .getLanguages().length == 1) ? false : true; menu.add(0, MENU_LANGUAGES, 0, getString(R.string.change_language)) .setIcon(R.drawable.ic_menu_start_conversation) .setEnabled(enabled); } return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { FormController formController = Collect.getInstance() .getFormController(); switch (item.getItemId()) { case 0: Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onOptionsItemSelected", "Refresh ODKView"); if (mCurrentView != null){ updateView(); } return true; case MENU_LANGUAGES: Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onOptionsItemSelected", "MENU_LANGUAGES"); createLanguageDialog(); return true; case R.id.save_form: Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onOptionsItemSelected", "MENU_SAVE"); // don't exit saveDataToDisk(DO_NOT_EXIT, isInstanceComplete(false), null); return true; case R.id.hierachy_view: Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onOptionsItemSelected", "MENU_HIERARCHY_VIEW"); if (formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } Intent i = new Intent(this, FormHierarchyActivity.class); startActivityForResult(i, HIERARCHY_ACTIVITY); return true; case R.id.preferences_entry: Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onOptionsItemSelected", "MENU_PREFERENCES"); Intent pref = new Intent(this, PreferencesActivity.class); startActivity(pref); return true; case android.R.id.home: // This is called when the Home (Up) button is pressed // in the Action Bar. Collect.getInstance().getActivityLogger() .logInstanceAction(this, "onKeyDown.KEYCODE_BACK", "quit"); createQuitDialog(); return true; } return super.onOptionsItemSelected(item); } /** * Attempt to save the answer(s) in the current screen to into the data * model. * * @param evaluateConstraints * @return false if any error occurs while saving (constraint violated, * etc...), true otherwise. */ private boolean saveAnswersForCurrentScreen(boolean evaluateConstraints) { FormController formController = Collect.getInstance() .getFormController(); // only try to save if the current event is a question or a field-list // group if (formController.currentPromptIsQuestion()) { LinkedHashMap<FormIndex, IAnswerData> answers = ((ODKView) mCurrentView) .getAnswers(); FailedConstraint constraint = formController.saveAllScreenAnswers( answers, evaluateConstraints); if (constraint != null) { createConstraintToast(constraint.index, constraint.status); return false; } } return true; } /** * Clears the answer on the screen. */ private void clearAnswer(QuestionWidget qw) { if ( qw.getAnswer() != null) { qw.clearAnswer(); } } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); Collect.getInstance().getActivityLogger() .logInstanceAction(this, "onCreateContextMenu", "show"); FormController formController = Collect.getInstance() .getFormController(); menu.add(0, v.getId(), 0, getString(R.string.clear_answer)); if (formController.indexContainsRepeatableGroup()) { menu.add(0, DELETE_REPEAT, 0, getString(R.string.delete_repeat)); } menu.setHeaderTitle(getString(R.string.edit_prompt)); } @Override public boolean onContextItemSelected(android.view.MenuItem item) { /* * We don't have the right view here, so we store the View's ID as the * item ID and loop through the possible views to find the one the user * clicked on. */ for (QuestionWidget qw : ((ODKView) mCurrentView).getWidgets()) { if (item.getItemId() == qw.getId()) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onContextItemSelected", "createClearDialog", qw.getPrompt().getIndex()); createClearDialog(qw); } } if (item.getItemId() == DELETE_REPEAT) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onContextItemSelected", "createDeleteRepeatConfirmDialog"); createDeleteRepeatConfirmDialog(); } return super.onContextItemSelected(item); } /** * If we're loading, then we pass the loading thread to our next instance. */ @Override public Object onRetainNonConfigurationInstance() { FormController formController = Collect.getInstance() .getFormController(); // if a form is loading, pass the loader task if (mFormLoaderTask != null && mFormLoaderTask.getStatus() != AsyncTask.Status.FINISHED) return mFormLoaderTask; // if a form is writing to disk, pass the save to disk task if (mSaveToDiskTask != null && mSaveToDiskTask.getStatus() != AsyncTask.Status.FINISHED) return mSaveToDiskTask; // mFormEntryController is static so we don't need to pass it. if (formController != null && formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } return null; } /** * Creates a view given the View type and an event * * @param event * @param advancingPage * -- true if this results from advancing through the form * @return newly created View */ private ScrollView createView(int event, boolean advancingPage) { FormController formController = Collect.getInstance() .getFormController(); setTitle(getString(R.string.app_name) + " > " + formController.getFormTitle()); switch (event) { case FormEntryController.EVENT_BEGINNING_OF_FORM: ScrollView startView = (ScrollView) View .inflate(this, R.layout.form_entry_start, null); setTitle(getString(R.string.app_name) + " > " + formController.getFormTitle()); Drawable image = null; File mediaFolder = formController.getMediaFolder(); String mediaDir = mediaFolder.getAbsolutePath(); BitmapDrawable bitImage = null; // attempt to load the form-specific logo... // this is arbitrarily silly bitImage = new BitmapDrawable(mediaDir + File.separator + "form_logo.png"); if (bitImage != null && bitImage.getBitmap() != null && bitImage.getIntrinsicHeight() > 0 && bitImage.getIntrinsicWidth() > 0) { image = bitImage; } if (image == null) { // show the opendatakit zig... // image = // getResources().getDrawable(R.drawable.opendatakit_zig); ((ImageView) startView.findViewById(R.id.form_start_bling)) .setVisibility(View.GONE); } else { ImageView v = ((ImageView) startView .findViewById(R.id.form_start_bling)); v.setImageDrawable(image); v.setContentDescription(formController.getFormTitle()); } // change start screen based on navigation prefs String navigationChoice = PreferenceManager.getDefaultSharedPreferences(this).getString(PreferencesActivity.KEY_NAVIGATION, PreferencesActivity.KEY_NAVIGATION); Boolean useSwipe = false; Boolean useButtons = false; ImageView ia = ((ImageView) startView.findViewById(R.id.image_advance)); TextView d = ((TextView) startView.findViewById(R.id.description)); if (navigationChoice != null) { if (navigationChoice.contains(PreferencesActivity.NAVIGATION_SWIPE)) { useSwipe = true; } if (navigationChoice.contains(PreferencesActivity.NAVIGATION_BUTTONS)) { useButtons = true; } } if (useSwipe && !useButtons) { d.setText(getString(R.string.swipe_instructions, formController.getFormTitle())); } else if (useButtons && !useSwipe) { ia.setVisibility(View.GONE); d.setText(getString(R.string.buttons_instructions, formController.getFormTitle())); } else { d.setText(getString(R.string.swipe_buttons_instructions, formController.getFormTitle())); } if (mBackButton.isShown()) { mBackButton.setEnabled(false); } if (mNextButton.isShown()) { mNextButton.setEnabled(true); } return startView; case FormEntryController.EVENT_END_OF_FORM: ScrollView endView = (ScrollView) View.inflate(this, R.layout.form_entry_end, null); ((TextView) endView.findViewById(R.id.description)) .setText(getString(R.string.save_enter_data_description, formController.getFormTitle())); // checkbox for if finished or ready to send final CheckBox instanceComplete = ((CheckBox) endView .findViewById(R.id.mark_finished)); instanceComplete.setChecked(isInstanceComplete(true)); if (!mAdminPreferences.getBoolean( AdminPreferencesActivity.KEY_MARK_AS_FINALIZED, true)) { instanceComplete.setVisibility(View.GONE); } // edittext to change the displayed name of the instance final EditText saveAs = (EditText) endView .findViewById(R.id.save_name); // disallow carriage returns in the name InputFilter returnFilter = new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { for (int i = start; i < end; i++) { if (Character.getType((source.charAt(i))) == Character.CONTROL) { return ""; } } return null; } }; saveAs.setFilters(new InputFilter[] { returnFilter }); String saveName = formController.getSubmissionMetadata().instanceName; if (saveName == null) { //TODO Default saveAs text should be previous save name // no meta/instanceName field in the form -- see if we have a // name for this instance from a previous save attempt... if (getContentResolver().getType(getIntent().getData()) == InstanceColumns.CONTENT_ITEM_TYPE) { Uri instanceUri = getIntent().getData(); Cursor instance = null; try { instance = getContentResolver().query(instanceUri, null, null, null, null); if (instance.getCount() == 1) { instance.moveToFirst(); saveName = instance .getString(instance .getColumnIndex(InstanceColumns.DISPLAY_NAME)); } } finally { if (instance != null) { instance.close(); } } } // present the prompt to allow user to name the form TextView sa = (TextView) endView .findViewById(R.id.save_form_as); sa.setVisibility(View.VISIBLE); // TODO if savename != null don"t need to initialize it if (saveName == null || saveName.length() == 0){ saveName = formController.getFormTitle(); } saveAs.setText(saveName); saveAs.setEnabled(true); saveAs.setVisibility(View.VISIBLE); } else { // if instanceName is defined in form, this is the name -- no // revisions // display only the name, not the prompt, and disable edits TextView sa = (TextView) endView .findViewById(R.id.save_form_as); sa.setVisibility(View.GONE); saveAs.setText(saveName); saveAs.setEnabled(false); saveAs.setBackgroundColor(Color.WHITE); saveAs.setVisibility(View.VISIBLE); } // override the visibility settings based upon admin preferences if (!mAdminPreferences.getBoolean( AdminPreferencesActivity.KEY_SAVE_AS, true)) { saveAs.setVisibility(View.GONE); TextView sa = (TextView) endView .findViewById(R.id.save_form_as); sa.setVisibility(View.GONE); } // Create 'save' button ((Button) endView.findViewById(R.id.save_exit_button)) .setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Collect.getInstance() .getActivityLogger() .logInstanceAction( this, "createView.saveAndExit", instanceComplete.isChecked() ? "saveAsComplete" : "saveIncomplete"); // Form is marked as 'saved' here. if (saveAs.getText().length() < 1) { Toast.makeText(FormEntryActivity.this, R.string.save_as_error, Toast.LENGTH_SHORT).show(); } else { saveDataToDisk(EXIT, instanceComplete .isChecked(), saveAs.getText() .toString()); } } }); if (mBackButton.isShown()) { mBackButton.setEnabled(true); } if (mNextButton.isShown()) { mNextButton.setEnabled(false); } return endView; case FormEntryController.EVENT_QUESTION: case FormEntryController.EVENT_GROUP: case FormEntryController.EVENT_REPEAT: ODKView odkv = null; // should only be a group here if the event_group is a field-list try { FormEntryPrompt[] prompts = formController.getQuestionPrompts(); FormEntryCaption[] groups = formController .getGroupsForCurrentIndex(); odkv = new ODKView(this, this, formController.getQuestionPrompts(), groups, advancingPage); Log.i(t, "created view for group " + (groups.length > 0 ? groups[groups.length - 1] .getLongText() : "[top]") + " " + (prompts.length > 0 ? prompts[0] .getQuestionText() : "[no question]")); } catch (RuntimeException e) { createErrorDialog(e.getMessage(), EXIT); e.printStackTrace(); // this is badness to avoid a crash. event = formController.stepToNextScreenEvent(); return createView(event, advancingPage); } // Makes a "clear answer" menu pop up on long-click for (QuestionWidget qw : odkv.getWidgets()) { if (!qw.getPrompt().isReadOnly()) { registerForContextMenu(qw); } } if (mBackButton.isShown() && mNextButton.isShown()) { mBackButton.setEnabled(true); mNextButton.setEnabled(true); } return odkv; default: createErrorDialog("Internal error: step to prompt failed", EXIT); Log.e(t, "Attempted to create a view that does not exist."); // this is badness to avoid a crash. event = formController.stepToNextScreenEvent(); return createView(event, advancingPage); } } @Override public boolean dispatchTouchEvent(MotionEvent mv) { boolean handled = mGestureDetector.onTouchEvent(mv); if (!handled) { return super.dispatchTouchEvent(mv); } return handled; // this is always true } /** * Determines what should be displayed on the screen. Possible options are: * a question, an ask repeat dialog, or the submit screen. Also saves * answers to the data model after checking constraints. */ private void showNextView() { FormController formController = Collect.getInstance() .getFormController(); if (formController.currentPromptIsQuestion()) { if (!saveAnswersForCurrentScreen(EVALUATE_CONSTRAINTS)) { // A constraint was violated so a dialog should be showing. mBeenSwiped = false; return; } } ScrollView next; int event = formController.stepToNextScreenEvent(); switch (event) { case FormEntryController.EVENT_QUESTION: case FormEntryController.EVENT_GROUP: // create a savepoint if ((++viewCount) % SAVEPOINT_INTERVAL == 0) { SaveToDiskTask.blockingExportTempData(); } next = createView(event, true); showView(next, AnimationType.RIGHT); break; case FormEntryController.EVENT_END_OF_FORM: case FormEntryController.EVENT_REPEAT: next = createView(event, true); showView(next, AnimationType.RIGHT); break; case FormEntryController.EVENT_PROMPT_NEW_REPEAT: createRepeatDialog(); break; case FormEntryController.EVENT_REPEAT_JUNCTURE: Log.i(t, "repeat juncture: " + formController.getFormIndex().getReference()); // skip repeat junctures until we implement them break; default: Log.w(t, "JavaRosa added a new EVENT type and didn't tell us... shame on them."); break; } } @Override public void updateView() { Log.i(getClass().getName(), "UpdateView " + Boolean.toString(mAnswersChanged)); FormController formController = Collect.getInstance() .getFormController(); if (formController.indexIsInFieldList()&&mAnswersChanged){ if (formController.currentPromptIsQuestion()) { if (!saveAnswersForCurrentScreen(EVALUATE_CONSTRAINTS)) { // A constraint was violated so a dialog should be showing. return; } } ScrollView view = mCurrentView; mY = view.getScrollY(); ScrollView newView; int event = formController.getEvent(); switch (event) { case FormEntryController.EVENT_QUESTION: case FormEntryController.EVENT_GROUP: // create a savepoint if ((++viewCount) % SAVEPOINT_INTERVAL == 0) { SaveToDiskTask.blockingExportTempData(); } newView = createView(event, true); showView(newView, AnimationType.NONE); break; case FormEntryController.EVENT_END_OF_FORM: case FormEntryController.EVENT_REPEAT: newView = createView(event, true); showView(newView, AnimationType.NONE); break; case FormEntryController.EVENT_PROMPT_NEW_REPEAT: createRepeatDialog(); break; case FormEntryController.EVENT_REPEAT_JUNCTURE: Log.i(t, "repeat juncture: " + formController.getFormIndex().getReference()); // skip repeat junctures until we implement them break; default: Log.w(t, "JavaRosa added a new EVENT type and didn't tell us... shame on them."); break; } } } /** * Determines what should be displayed between a question, or the start * screen and displays the appropriate view. Also saves answers to the data * model without checking constraints. */ private void showPreviousView() { FormController formController = Collect.getInstance() .getFormController(); // The answer is saved on a back swipe, but question constraints are // ignored. if (formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } if (formController.getEvent() != FormEntryController.EVENT_BEGINNING_OF_FORM) { int event = formController.stepToPreviousScreenEvent(); if (event == FormEntryController.EVENT_BEGINNING_OF_FORM || event == FormEntryController.EVENT_GROUP || event == FormEntryController.EVENT_QUESTION) { // create savepoint if ((++viewCount) % SAVEPOINT_INTERVAL == 0) { SaveToDiskTask.blockingExportTempData(); } } ScrollView next = createView(event, false); showView(next, AnimationType.LEFT); } else { mBeenSwiped = false; } } /** * Displays the View specified by the parameter 'next', animating both the * current view and next appropriately given the AnimationType. Also updates * the progress bar. */ public void showView(ScrollView next, AnimationType from) { if (from != AnimationType.NONE){ // disable notifications... if (mInAnimation != null) { mInAnimation.setAnimationListener(null); } if (mOutAnimation != null) { mOutAnimation.setAnimationListener(null); } // logging of the view being shown is already done, as this was handled // by createView() switch (from) { case RIGHT: mInAnimation = AnimationUtils.loadAnimation(this, R.anim.push_left_in); mOutAnimation = AnimationUtils.loadAnimation(this, R.anim.push_left_out); break; case LEFT: mInAnimation = AnimationUtils.loadAnimation(this, R.anim.push_right_in); mOutAnimation = AnimationUtils.loadAnimation(this, R.anim.push_right_out); break; case FADE: mInAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_in); mOutAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_out); break; } // complete setup for animations... mInAnimation.setAnimationListener(this); mOutAnimation.setAnimationListener(this); }else{ mInAnimation = null; mOutAnimation = null; } // drop keyboard before transition... if (mCurrentView != null) { InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(mCurrentView.getWindowToken(), 0); } RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); // adjust which view is in the layout container... mStaleView = mCurrentView; mCurrentView = next; mQuestionHolder.addView(mCurrentView, lp); mAnimationCompletionSet = 0; if (mStaleView != null) { if (from != AnimationType.NONE){ // start OutAnimation for transition... mStaleView.startAnimation(mOutAnimation); } // and remove the old view (MUST occur after start of animation!!!) mQuestionHolder.removeView(mStaleView); } else { mAnimationCompletionSet = 2; } // start InAnimation for transition... if (from != AnimationType.NONE){ mCurrentView.startAnimation(mInAnimation); } String logString = ""; switch (from) { case RIGHT: logString = "next"; break; case LEFT: logString = "previous"; break; case FADE: logString = "refresh"; break; case NONE: logString = "update"; break; } Log.e("FormEntryActivity", "scroll y : "+mY); mCurrentView.post(new Runnable() { public void run() { mCurrentView.scrollTo(0, mY); } }); Collect.getInstance().getActivityLogger() .logInstanceAction(this, "showView", logString); } // Hopefully someday we can use managed dialogs when the bugs are fixed /* * Ideally, we'd like to use Android to manage dialogs with onCreateDialog() * and onPrepareDialog(), but dialogs with dynamic content are broken in 1.5 * (cupcake). We do use managed dialogs for our static loading * ProgressDialog. The main issue we noticed and are waiting to see fixed * is: onPrepareDialog() is not called after a screen orientation change. * http://code.google.com/p/android/issues/detail?id=1639 */ // /** * Creates and displays a dialog displaying the violated constraint. */ private void createConstraintToast(FormIndex index, int saveStatus) { FormController formController = Collect.getInstance() .getFormController(); String constraintText = formController.getQuestionPrompt(index) .getConstraintText(); switch (saveStatus) { case FormEntryController.ANSWER_CONSTRAINT_VIOLATED: Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createConstraintToast.ANSWER_CONSTRAINT_VIOLATED", "show", index); if (constraintText == null) { constraintText = formController.getQuestionPrompt(index) .getSpecialFormQuestionText("constraintMsg"); if (constraintText == null) { constraintText = getString(R.string.invalid_answer_error); } } break; case FormEntryController.ANSWER_REQUIRED_BUT_EMPTY: Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createConstraintToast.ANSWER_REQUIRED_BUT_EMPTY", "show", index); constraintText = formController.getQuestionPrompt(index) .getSpecialFormQuestionText("requiredMsg"); if (constraintText == null) { constraintText = getString(R.string.required_answer_error); } break; } showCustomToast(constraintText, Toast.LENGTH_SHORT); } /** * Creates a toast with the specified message. * * @param message */ private void showCustomToast(String message, int duration) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.toast_view, null); // set the text in the view TextView tv = (TextView) view.findViewById(R.id.message); tv.setText(message); Toast t = new Toast(this); t.setView(view); t.setDuration(duration); t.setGravity(Gravity.CENTER, 0, 0); t.show(); } /** * Creates and displays a dialog asking the user if they'd like to create a * repeat of the current group. */ private void createRepeatDialog() { FormController formController = Collect.getInstance() .getFormController(); Collect.getInstance().getActivityLogger() .logInstanceAction(this, "createRepeatDialog", "show"); mAlertDialog = new AlertDialog.Builder(this).create(); mAlertDialog.setIcon(android.R.drawable.ic_dialog_info); DialogInterface.OnClickListener repeatListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int i) { FormController formController = Collect.getInstance() .getFormController(); switch (i) { case DialogInterface.BUTTON1: // yes, repeat Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createRepeatDialog", "addRepeat"); try { formController.newRepeat(); } catch (XPathTypeMismatchException e) { FormEntryActivity.this.createErrorDialog( e.getMessage(), EXIT); return; } if (!formController.indexIsInFieldList()) { // we are at a REPEAT event that does not have a // field-list appearance // step to the next visible field... // which could be the start of a new repeat group... showNextView(); } else { // we are at a REPEAT event that has a field-list // appearance // just display this REPEAT event's group. refreshCurrentView(); } break; case DialogInterface.BUTTON2: // no, no repeat Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createRepeatDialog", "showNext"); showNextView(); break; } } }; if (formController.getLastRepeatCount() > 0) { mAlertDialog.setTitle(getString(R.string.leaving_repeat_ask)); mAlertDialog.setMessage(getString(R.string.add_another_repeat, formController.getLastGroupText())); mAlertDialog.setButton(getString(R.string.add_another), repeatListener); mAlertDialog.setButton2(getString(R.string.leave_repeat_yes), repeatListener); } else { mAlertDialog.setTitle(getString(R.string.entering_repeat_ask)); mAlertDialog.setMessage(getString(R.string.add_repeat, formController.getLastGroupText())); mAlertDialog.setButton(getString(R.string.entering_repeat), repeatListener); mAlertDialog.setButton2(getString(R.string.add_repeat_no), repeatListener); } mAlertDialog.setCancelable(false); mBeenSwiped = false; mAlertDialog.show(); } /** * Creates and displays dialog with the given errorMsg. */ private void createErrorDialog(String errorMsg, final boolean shouldExit) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createErrorDialog", "show." + Boolean.toString(shouldExit)); mErrorMessage = errorMsg; mAlertDialog = new AlertDialog.Builder(this).create(); mAlertDialog.setIcon(android.R.drawable.ic_dialog_info); mAlertDialog.setTitle(getString(R.string.error_occured)); mAlertDialog.setMessage(errorMsg); DialogInterface.OnClickListener errorListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int i) { switch (i) { case DialogInterface.BUTTON1: Collect.getInstance().getActivityLogger() .logInstanceAction(this, "createErrorDialog", "OK"); if (shouldExit) { finish(); } break; } } }; mAlertDialog.setCancelable(false); mAlertDialog.setButton(getString(R.string.ok), errorListener); mBeenSwiped = false; mAlertDialog.show(); } /** * Creates a confirm/cancel dialog for deleting repeats. */ private void createDeleteRepeatConfirmDialog() { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createDeleteRepeatConfirmDialog", "show"); FormController formController = Collect.getInstance() .getFormController(); mAlertDialog = new AlertDialog.Builder(this).create(); mAlertDialog.setIcon(android.R.drawable.ic_dialog_info); String name = formController.getLastRepeatedGroupName(); int repeatcount = formController.getLastRepeatedGroupRepeatCount(); if (repeatcount != -1) { name += " (" + (repeatcount + 1) + ")"; } mAlertDialog.setTitle(getString(R.string.delete_repeat_ask)); mAlertDialog .setMessage(getString(R.string.delete_repeat_confirm, name)); DialogInterface.OnClickListener quitListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int i) { FormController formController = Collect.getInstance() .getFormController(); switch (i) { case DialogInterface.BUTTON1: // yes Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createDeleteRepeatConfirmDialog", "OK"); formController.deleteRepeat(); showPreviousView(); break; case DialogInterface.BUTTON2: // no Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createDeleteRepeatConfirmDialog", "cancel"); break; } } }; mAlertDialog.setCancelable(false); mAlertDialog.setButton(getString(R.string.discard_group), quitListener); mAlertDialog.setButton2(getString(R.string.delete_repeat_no), quitListener); mAlertDialog.show(); } /** * Saves data and writes it to disk. If exit is set, program will exit after * save completes. Complete indicates whether the user has marked the * instances as complete. If updatedSaveName is non-null, the instances * content provider is updated with the new name */ private boolean saveDataToDisk(boolean exit, boolean complete, String updatedSaveName) { // save current answer if (!saveAnswersForCurrentScreen(complete)) { Toast.makeText(this, getString(R.string.data_saved_error), Toast.LENGTH_SHORT).show(); return false; } mSaveToDiskTask = new SaveToDiskTask(getIntent().getData(), exit, complete, updatedSaveName); mSaveToDiskTask.setFormSavedListener(this); showDialog(SAVING_DIALOG); // show dialog before we execute... mSaveToDiskTask.execute(); return true; } /** * Create a dialog with options to save and exit, save, or quit without * saving */ private void createQuitDialog() { FormController formController = Collect.getInstance() .getFormController(); String[] items; if (mAdminPreferences.getBoolean(AdminPreferencesActivity.KEY_SAVE_MID, true)) { String[] two = { getString(R.string.keep_changes), getString(R.string.do_not_save) }; items = two; } else { String[] one = { getString(R.string.do_not_save) }; items = one; } Collect.getInstance().getActivityLogger() .logInstanceAction(this, "createQuitDialog", "show"); mAlertDialog = new AlertDialog.Builder(this) .setIcon(android.R.drawable.ic_dialog_info) .setTitle( getString(R.string.quit_application, formController.getFormTitle())) .setNeutralButton(getString(R.string.do_not_exit), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createQuitDialog", "cancel"); dialog.cancel(); } }) .setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: // save and exit // this is slightly complicated because if the // option is disabled in // the admin menu, then case 0 actually becomes // 'discard and exit' // whereas if it's enabled it's 'save and exit' if (mAdminPreferences .getBoolean( AdminPreferencesActivity.KEY_SAVE_MID, true)) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createQuitDialog", "saveAndExit"); saveDataToDisk(EXIT, isInstanceComplete(false), null); } else { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createQuitDialog", "discardAndExit"); removeTempInstance(); finishReturnInstance(); } break; case 1: // discard changes and exit Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createQuitDialog", "discardAndExit"); removeTempInstance(); finishReturnInstance(); break; case 2:// do nothing Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createQuitDialog", "cancel"); break; } } }).create(); mAlertDialog.show(); } /** * this method cleans up unneeded files when the user selects 'discard and * exit' */ private void removeTempInstance() { FormController formController = Collect.getInstance() .getFormController(); // attempt to remove any scratch file File temp = SaveToDiskTask.savepointFile(formController .getInstancePath()); if (temp.exists()) { temp.delete(); } String selection = InstanceColumns.INSTANCE_FILE_PATH + "=?"; String[] selectionArgs = { formController.getInstancePath() .getAbsolutePath() }; boolean erase = false; { Cursor c = null; try { c = getContentResolver().query(InstanceColumns.CONTENT_URI, null, selection, selectionArgs, null); erase = (c.getCount() < 1); } finally { if (c != null) { c.close(); } } } // if it's not already saved, erase everything if (erase) { // delete media first String instanceFolder = formController.getInstancePath() .getParent(); Log.i(t, "attempting to delete: " + instanceFolder); int images = MediaUtils .deleteImagesInFolderFromMediaProvider(formController .getInstancePath().getParentFile()); int audio = MediaUtils .deleteAudioInFolderFromMediaProvider(formController .getInstancePath().getParentFile()); int video = MediaUtils .deleteVideoInFolderFromMediaProvider(formController .getInstancePath().getParentFile()); Log.i(t, "removed from content providers: " + images + " image files, " + audio + " audio files," + " and " + video + " video files."); File f = new File(instanceFolder); if (f.exists() && f.isDirectory()) { for (File del : f.listFiles()) { Log.i(t, "deleting file: " + del.getAbsolutePath()); del.delete(); } f.delete(); } } } /** * Confirm clear answer dialog */ private void createClearDialog(final QuestionWidget qw) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createClearDialog", "show", qw.getPrompt().getIndex()); mAlertDialog = new AlertDialog.Builder(this).create(); mAlertDialog.setIcon(android.R.drawable.ic_dialog_info); mAlertDialog.setTitle(getString(R.string.clear_answer_ask)); String question = qw.getPrompt().getLongText(); if (question == null) { question = ""; } if (question.length() > 50) { question = question.substring(0, 50) + "..."; } mAlertDialog.setMessage(getString(R.string.clearanswer_confirm, question)); DialogInterface.OnClickListener quitListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int i) { switch (i) { case DialogInterface.BUTTON1: // yes Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createClearDialog", "clearAnswer", qw.getPrompt().getIndex()); clearAnswer(qw); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case DialogInterface.BUTTON2: // no Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createClearDialog", "cancel", qw.getPrompt().getIndex()); break; } } }; mAlertDialog.setCancelable(false); mAlertDialog .setButton(getString(R.string.discard_answer), quitListener); mAlertDialog.setButton2(getString(R.string.clear_answer_no), quitListener); mAlertDialog.show(); } /** * Creates and displays a dialog allowing the user to set the language for * the form. */ private void createLanguageDialog() { Collect.getInstance().getActivityLogger() .logInstanceAction(this, "createLanguageDialog", "show"); FormController formController = Collect.getInstance() .getFormController(); final String[] languages = formController.getLanguages(); int selected = -1; if (languages != null) { String language = formController.getLanguage(); for (int i = 0; i < languages.length; i++) { if (language.equals(languages[i])) { selected = i; } } } mAlertDialog = new AlertDialog.Builder(this) .setSingleChoiceItems(languages, selected, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { FormController formController = Collect .getInstance().getFormController(); // Update the language in the content provider // when selecting a new // language ContentValues values = new ContentValues(); values.put(FormsColumns.LANGUAGE, languages[whichButton]); String selection = FormsColumns.FORM_FILE_PATH + "=?"; String selectArgs[] = { mFormPath }; int updated = getContentResolver().update( FormsColumns.CONTENT_URI, values, selection, selectArgs); Log.i(t, "Updated language to: " + languages[whichButton] + " in " + updated + " rows"); Collect.getInstance() .getActivityLogger() .logInstanceAction( this, "createLanguageDialog", "changeLanguage." + languages[whichButton]); formController .setLanguage(languages[whichButton]); dialog.dismiss(); if (formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } refreshCurrentView(); } }) .setTitle(getString(R.string.change_language)) .setNegativeButton(getString(R.string.do_not_change), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "createLanguageDialog", "cancel"); } }).create(); mAlertDialog.show(); } /** * We use Android's dialog management for loading/saving progress dialogs */ @Override protected Dialog onCreateDialog(int id) { switch (id) { case PROGRESS_DIALOG: Log.e(t, "Creating PROGRESS_DIALOG"); Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onCreateDialog.PROGRESS_DIALOG", "show"); mProgressDialog = new ProgressDialog(this); DialogInterface.OnClickListener loadingButtonListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onCreateDialog.PROGRESS_DIALOG", "cancel"); dialog.dismiss(); mFormLoaderTask.setFormLoaderListener(null); FormLoaderTask t = mFormLoaderTask; mFormLoaderTask = null; t.cancel(true); t.destroy(); finish(); } }; mProgressDialog.setIcon(android.R.drawable.ic_dialog_info); mProgressDialog.setTitle(getString(R.string.loading_form)); mProgressDialog.setMessage(getString(R.string.please_wait)); mProgressDialog.setIndeterminate(true); mProgressDialog.setCancelable(false); mProgressDialog.setButton(getString(R.string.cancel_loading_form), loadingButtonListener); return mProgressDialog; case SAVING_DIALOG: Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onCreateDialog.SAVING_DIALOG", "show"); mProgressDialog = new ProgressDialog(this); DialogInterface.OnClickListener savingButtonListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onCreateDialog.SAVING_DIALOG", "cancel"); dialog.dismiss(); mSaveToDiskTask.setFormSavedListener(null); SaveToDiskTask t = mSaveToDiskTask; mSaveToDiskTask = null; t.cancel(true); } }; mProgressDialog.setIcon(android.R.drawable.ic_dialog_info); mProgressDialog.setTitle(getString(R.string.saving_form)); mProgressDialog.setMessage(getString(R.string.please_wait)); mProgressDialog.setIndeterminate(true); mProgressDialog.setCancelable(false); mProgressDialog.setButton(getString(R.string.cancel), savingButtonListener); mProgressDialog.setButton(getString(R.string.cancel_saving_form), savingButtonListener); return mProgressDialog; } return null; } /** * Dismiss any showing dialogs that we manually manage. */ private void dismissDialogs() { Log.e(t, "Dismiss dialogs"); if (mAlertDialog != null && mAlertDialog.isShowing()) { mAlertDialog.dismiss(); } } @Override protected void onPause() { FormController formController = Collect.getInstance() .getFormController(); dismissDialogs(); // make sure we're not already saving to disk. if we are, currentPrompt // is getting constantly updated if (mSaveToDiskTask == null || mSaveToDiskTask.getStatus() == AsyncTask.Status.FINISHED) { if (mCurrentView != null && formController != null && formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } } super.onPause(); } @Override protected void onResume() { super.onResume(); FormController formController = Collect.getInstance() .getFormController(); Collect.getInstance().getActivityLogger().open(); if (mFormLoaderTask != null) { mFormLoaderTask.setFormLoaderListener(this); if (formController == null && mFormLoaderTask.getStatus() == AsyncTask.Status.FINISHED) { FormController fec = mFormLoaderTask.getFormController(); if (fec != null) { loadingComplete(mFormLoaderTask); } else { dismissDialog(PROGRESS_DIALOG); FormLoaderTask t = mFormLoaderTask; mFormLoaderTask = null; t.cancel(true); t.destroy(); // there is no formController -- fire MainMenu activity? startActivity(new Intent(this, MainMenuActivity.class)); } } } else { refreshCurrentView(); } if (mSaveToDiskTask != null) { mSaveToDiskTask.setFormSavedListener(this); } if (mErrorMessage != null && (mAlertDialog != null && !mAlertDialog.isShowing())) { createErrorDialog(mErrorMessage, EXIT); return; } // only check the buttons if it's enabled in preferences SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(this); String navigation = sharedPreferences.getString(PreferencesActivity.KEY_NAVIGATION, PreferencesActivity.KEY_NAVIGATION); Boolean showButtons = false; if (navigation.contains(PreferencesActivity.NAVIGATION_BUTTONS)) { showButtons = true; } if (showButtons) { mBackButton.setVisibility(View.VISIBLE); mNextButton.setVisibility(View.VISIBLE); } else { mBackButton.setVisibility(View.GONE); mNextButton.setVisibility(View.GONE); } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: Collect.getInstance().getActivityLogger() .logInstanceAction(this, "onKeyDown.KEYCODE_BACK", "quit"); createQuitDialog(); return true; case KeyEvent.KEYCODE_DPAD_RIGHT: if (event.isAltPressed() && !mBeenSwiped) { mBeenSwiped = true; Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onKeyDown.KEYCODE_DPAD_RIGHT", "showNext"); showNextView(); return true; } break; case KeyEvent.KEYCODE_DPAD_LEFT: if (event.isAltPressed() && !mBeenSwiped) { mBeenSwiped = true; Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onKeyDown.KEYCODE_DPAD_LEFT", "showPrevious"); showPreviousView(); return true; } break; } return super.onKeyDown(keyCode, event); } @Override protected void onDestroy() { if (mFormLoaderTask != null) { mFormLoaderTask.setFormLoaderListener(null); // We have to call cancel to terminate the thread, otherwise it // lives on and retains the FEC in memory. // but only if it's done, otherwise the thread never returns if (mFormLoaderTask.getStatus() == AsyncTask.Status.FINISHED) { FormLoaderTask t = mFormLoaderTask; mFormLoaderTask = null; t.cancel(true); t.destroy(); } } if (mSaveToDiskTask != null) { mSaveToDiskTask.setFormSavedListener(null); // We have to call cancel to terminate the thread, otherwise it // lives on and retains the FEC in memory. if (mSaveToDiskTask.getStatus() == AsyncTask.Status.FINISHED) { mSaveToDiskTask.cancel(true); mSaveToDiskTask = null; } } super.onDestroy(); } private int mAnimationCompletionSet = 0; private void afterAllAnimations() { Log.i(t, "afterAllAnimations"); if (mStaleView != null) { if (mStaleView instanceof ODKView) { // http://code.google.com/p/android/issues/detail?id=8488 ((ODKView) mStaleView).recycleDrawables(); } mStaleView = null; } if (mCurrentView instanceof ODKView) { ((ODKView) mCurrentView).setFocus(this); } mBeenSwiped = false; } @Override public void onAnimationEnd(Animation animation) { Log.i(t, "onAnimationEnd " + ((animation == mInAnimation) ? "in" : ((animation == mOutAnimation) ? "out" : "other"))); if (mInAnimation == animation) { mAnimationCompletionSet |= 1; } else if (mOutAnimation == animation) { mAnimationCompletionSet |= 2; } else { Log.e(t, "Unexpected animation"); } if (mAnimationCompletionSet == 3) { this.afterAllAnimations(); } } @Override public void onAnimationRepeat(Animation animation) { // Added by AnimationListener interface. Log.i(t, "onAnimationRepeat " + ((animation == mInAnimation) ? "in" : ((animation == mOutAnimation) ? "out" : "other"))); } @Override public void onAnimationStart(Animation animation) { // Added by AnimationListener interface. Log.i(t, "onAnimationStart " + ((animation == mInAnimation) ? "in" : ((animation == mOutAnimation) ? "out" : "other"))); } /** * loadingComplete() is called by FormLoaderTask once it has finished * loading a form. */ @Override public void loadingComplete(FormLoaderTask task) { dismissDialog(PROGRESS_DIALOG); FormController formController = task.getFormController(); boolean pendingActivityResult = task.hasPendingActivityResult(); boolean hasUsedSavepoint = task.hasUsedSavepoint(); int requestCode = task.getRequestCode(); // these are bogus if // pendingActivityResult is // false int resultCode = task.getResultCode(); Intent intent = task.getIntent(); mFormLoaderTask.setFormLoaderListener(null); FormLoaderTask t = mFormLoaderTask; mFormLoaderTask = null; t.cancel(true); t.destroy(); Collect.getInstance().setFormController(formController); //updateMenu // Set the language if one has already been set in the past String[] languageTest = formController.getLanguages(); if (languageTest != null) { String defaultLanguage = formController.getLanguage(); String newLanguage = ""; String selection = FormsColumns.FORM_FILE_PATH + "=?"; String selectArgs[] = { mFormPath }; Cursor c = null; try { c = getContentResolver().query(FormsColumns.CONTENT_URI, null, selection, selectArgs, null); if (c.getCount() == 1) { c.moveToFirst(); newLanguage = c.getString(c .getColumnIndex(FormsColumns.LANGUAGE)); } } finally { if (c != null) { c.close(); } } // if somehow we end up with a bad language, set it to the default try { formController.setLanguage(newLanguage); } catch (Exception e) { formController.setLanguage(defaultLanguage); } } if (pendingActivityResult) { // set the current view to whatever group we were at... refreshCurrentView(); // process the pending activity request... onActivityResult(requestCode, resultCode, intent); return; } // it can be a normal flow for a pending activity result to restore from // a savepoint // (the call flow handled by the above if statement). For all other use // cases, the // user should be notified, as it means they wandered off doing other // things then // returned to ODK Collect and chose Edit Saved Form, but that the // savepoint for that // form is newer than the last saved version of their form data. if (hasUsedSavepoint) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(FormEntryActivity.this, getString(R.string.savepoint_used), Toast.LENGTH_LONG).show(); } }); } // Set saved answer path if (formController.getInstancePath() == null) { // Create new answer folder. String time = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.ENGLISH).format(Calendar.getInstance().getTime()); String file = mFormPath.substring(mFormPath.lastIndexOf('/') + 1, mFormPath.lastIndexOf('.')); String path = Collect.INSTANCES_PATH + File.separator + file + "_" + time; if (FileUtils.createFolder(path)) { formController.setInstancePath(new File(path + File.separator + file + "_" + time + ".xml")); } } else { Intent reqIntent = getIntent(); boolean showFirst = reqIntent.getBooleanExtra("start", false); if (!showFirst) { // we've just loaded a saved form, so start in the hierarchy // view Intent i = new Intent(this, FormHierarchyActivity.class); i.putExtra("isSavedForm", true); if (mToFormChooser){ i.putExtra("toFormChooser", true); } startActivity(i); return; // so we don't show the intro screen before jumping to // the hierarchy } } refreshCurrentView(); } /** * called by the FormLoaderTask if something goes wrong. */ @Override public void loadingError(String errorMsg) { dismissDialog(PROGRESS_DIALOG); if (errorMsg != null) { createErrorDialog(errorMsg, EXIT); } else { createErrorDialog(getString(R.string.parse_error), EXIT); } } /** * Called by SavetoDiskTask if everything saves correctly. */ @Override public void savingComplete(int saveStatus) { dismissDialog(SAVING_DIALOG); switch (saveStatus) { case SaveToDiskTask.SAVED: Toast.makeText(this, getString(R.string.data_saved_ok), Toast.LENGTH_SHORT).show(); sendSavedBroadcast(); break; case SaveToDiskTask.SAVED_AND_EXIT: Toast.makeText(this, getString(R.string.data_saved_ok), Toast.LENGTH_SHORT).show(); sendSavedBroadcast(); finishReturnInstance(); break; case SaveToDiskTask.SAVE_ERROR: Toast.makeText(this, getString(R.string.data_saved_error), Toast.LENGTH_LONG).show(); break; case FormEntryController.ANSWER_CONSTRAINT_VIOLATED: case FormEntryController.ANSWER_REQUIRED_BUT_EMPTY: refreshCurrentView(); // an answer constraint was violated, so do a 'swipe' to the next // question to display the proper toast(s) next(); break; } } /** * Attempts to save an answer to the specified index. * * @param answer * @param index * @param evaluateConstraints * @return status as determined in FormEntryController */ public int saveAnswer(IAnswerData answer, FormIndex index, boolean evaluateConstraints) { FormController formController = Collect.getInstance() .getFormController(); if (evaluateConstraints) { return formController.answerQuestion(index, answer); } else { formController.saveAnswer(index, answer); return FormEntryController.ANSWER_OK; } } /** * Checks the database to determine if the current instance being edited has * already been 'marked completed'. A form can be 'unmarked' complete and * then resaved. * * @return true if form has been marked completed, false otherwise. */ private boolean isInstanceComplete(boolean end) { FormController formController = Collect.getInstance() .getFormController(); // default to false if we're mid form boolean complete = false; // if we're at the end of the form, then check the preferences if (end) { // First get the value from the preferences SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(this); complete = sharedPreferences.getBoolean( PreferencesActivity.KEY_COMPLETED_DEFAULT, true); } // Then see if we've already marked this form as complete before String selection = InstanceColumns.INSTANCE_FILE_PATH + "=?"; String[] selectionArgs = { formController.getInstancePath() .getAbsolutePath() }; Cursor c = null; try { c = getContentResolver().query(InstanceColumns.CONTENT_URI, null, selection, selectionArgs, null); if (c != null && c.getCount() > 0) { c.moveToFirst(); String status = c.getString(c .getColumnIndex(InstanceColumns.STATUS)); if (InstanceProviderAPI.STATUS_COMPLETE.compareTo(status) == 0) { complete = true; } } } finally { if (c != null) { c.close(); } } return complete; } public void next() { if (!mBeenSwiped) { mBeenSwiped = true; showNextView(); } } /** * Returns the instance that was just filled out to the calling activity, if * requested. */ private void finishReturnInstance() { FormController formController = Collect.getInstance() .getFormController(); String action = getIntent().getAction(); if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_EDIT.equals(action)) { // caller is waiting on a picked form String selection = InstanceColumns.INSTANCE_FILE_PATH + "=?"; String[] selectionArgs = { formController.getInstancePath() .getAbsolutePath() }; Cursor c = null; try { c = getContentResolver().query(InstanceColumns.CONTENT_URI, null, selection, selectionArgs, null); if (c.getCount() > 0) { // should only be one... c.moveToFirst(); String id = c.getString(c .getColumnIndex(BaseColumns._ID)); Uri instance = Uri.withAppendedPath( InstanceColumns.CONTENT_URI, id); setResult(RESULT_OK, new Intent().setData(instance)); } } finally { if (c != null) { c.close(); } } } finish(); } @Override public boolean onDown(MotionEvent e) { return false; } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // only check the swipe if it's enabled in preferences SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(this); String navigation = sharedPreferences.getString(PreferencesActivity.KEY_NAVIGATION, PreferencesActivity.NAVIGATION_SWIPE); Boolean doSwipe = false; if (navigation.contains(PreferencesActivity.NAVIGATION_SWIPE)) { doSwipe = true; } if (doSwipe) { // Looks for user swipes. If the user has swiped, move to the // appropriate screen. // for all screens a swipe is left/right of at least // .25" and up/down of less than .25" // OR left/right of > .5" DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int xPixelLimit = (int) (dm.xdpi * .25); int yPixelLimit = (int) (dm.ydpi * .25); if (mCurrentView instanceof ODKView) { if (((ODKView) mCurrentView).suppressFlingGesture(e1, e2, velocityX, velocityY)) { return false; } } if (mBeenSwiped) { return false; } if ((Math.abs(e1.getX() - e2.getX()) > xPixelLimit && Math.abs(e1 .getY() - e2.getY()) < yPixelLimit) || Math.abs(e1.getX() - e2.getX()) > xPixelLimit * 2) { mBeenSwiped = true; if (velocityX > 0) { if (e1.getX() > e2.getX()) { Log.e(t, "showNextView VelocityX is bogus! " + e1.getX() + " > " + e2.getX()); Collect.getInstance().getActivityLogger() .logInstanceAction(this, "onFling", "showNext"); showNextView(); } else { Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onFling", "showPrevious"); showPreviousView(); } } else { if (e1.getX() < e2.getX()) { Log.e(t, "showPreviousView VelocityX is bogus! " + e1.getX() + " < " + e2.getX()); Collect.getInstance() .getActivityLogger() .logInstanceAction(this, "onFling", "showPrevious"); showPreviousView(); } else { Collect.getInstance().getActivityLogger() .logInstanceAction(this, "onFling", "showNext"); showNextView(); } } return true; } } return false; } @Override public void onLongPress(MotionEvent e) { } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { // The onFling() captures the 'up' event so our view thinks it gets long // pressed. // We don't wnat that, so cancel it. mCurrentView.cancelLongPress(); return false; } @Override public void onShowPress(MotionEvent e) { } @Override public boolean onSingleTapUp(MotionEvent e) { return false; } @Override public void advance() { next(); } @Override protected void onStart() { super.onStart(); Collect.getInstance().getActivityLogger().logOnStart(this); } @Override protected void onStop() { Collect.getInstance().getActivityLogger().logOnStop(this); super.onStop(); } private void sendSavedBroadcast() { Intent i = new Intent(); i.setAction("com.makina.collect.android.FormSaved"); this.sendBroadcast(i); } @Override public void setAnswerChange(boolean hasChanged) { Log.i(getClass().getName(), "setAnswerChange " + Boolean.toString(hasChanged)); mAnswersChanged = hasChanged; } }
cd6de4deef56a3c3f88d208138520929daceb24c
baab4eb5021030f232069929af22848c4ea3d45a
/packages/expo-updates/android/src/androidTest/java/expo/modules/updates/db/UpdatesDatabaseTest.java
729efaf035a39405393c647b64922f63bca515c1
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
permissive
cjthompson/expo
4fff17572b1d8340b267580632eb70caa92292ea
bfbe1f016a1e0f80c058074b1aa79f36954390b9
refs/heads/master
2022-11-06T22:28:14.707730
2020-07-16T23:53:34
2020-07-16T23:54:10
280,328,674
0
0
NOASSERTION
2020-07-17T04:47:03
2020-07-17T04:47:03
null
UTF-8
Java
false
false
4,902
java
package expo.modules.updates.db; import android.content.Context; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.UUID; import androidx.room.Room; import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import expo.modules.updates.db.UpdatesDatabase; import expo.modules.updates.db.dao.AssetDao; import expo.modules.updates.db.dao.UpdateDao; import expo.modules.updates.db.entity.AssetEntity; import expo.modules.updates.db.entity.UpdateEntity; @RunWith(AndroidJUnit4ClassRunner.class) public class UpdatesDatabaseTest { private UpdatesDatabase db; private UpdateDao updateDao; private AssetDao assetDao; @Before public void createDb() { Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); db = Room.inMemoryDatabaseBuilder(context, UpdatesDatabase.class).build(); updateDao = db.updateDao(); assetDao = db.assetDao(); } @After public void closeDb() { db.close(); } @Test public void testInsertUpdate() { UUID uuid = UUID.randomUUID(); Date date = new Date(); String runtimeVersion = "1.0"; String projectId = "https://exp.host/@esamelson/test-project"; UpdateEntity testUpdate = new UpdateEntity(uuid, date, runtimeVersion, projectId); updateDao.insertUpdate(testUpdate); UpdateEntity byId = updateDao.loadUpdateWithId(uuid); Assert.assertNotNull(byId); Assert.assertEquals(uuid, byId.id); Assert.assertEquals(date, byId.commitTime); Assert.assertEquals(runtimeVersion, byId.runtimeVersion); Assert.assertEquals(projectId, byId.projectIdentifier); updateDao.deleteUpdates(Arrays.asList(testUpdate)); Assert.assertEquals(0, updateDao.loadAllUpdates().size()); } @Test public void testMarkUpdateReady() { UUID uuid = UUID.randomUUID(); Date date = new Date(); String runtimeVersion = "1.0"; String projectId = "https://exp.host/@esamelson/test-project"; UpdateEntity testUpdate = new UpdateEntity(uuid, date, runtimeVersion, projectId); updateDao.insertUpdate(testUpdate); Assert.assertEquals(0, updateDao.loadLaunchableUpdates().size()); updateDao.markUpdateFinished(testUpdate); Assert.assertEquals(1, updateDao.loadLaunchableUpdates().size()); updateDao.deleteUpdates(Arrays.asList(testUpdate)); Assert.assertEquals(0, updateDao.loadAllUpdates().size()); } @Test public void testDeleteUnusedAssets() { String runtimeVersion = "1.0"; String projectId = "https://exp.host/@esamelson/test-project"; UpdateEntity update1 = new UpdateEntity(UUID.randomUUID(), new Date(), runtimeVersion, projectId); AssetEntity asset1 = new AssetEntity("asset1", "png"); AssetEntity commonAsset = new AssetEntity("commonAsset", "png"); updateDao.insertUpdate(update1); assetDao.insertAssets(Arrays.asList(asset1, commonAsset), update1); UpdateEntity update2 = new UpdateEntity(UUID.randomUUID(), new Date(), runtimeVersion, projectId); AssetEntity asset2 = new AssetEntity("asset2", "png"); updateDao.insertUpdate(update2); assetDao.insertAssets(Arrays.asList(asset2), update2); assetDao.addExistingAssetToUpdate(update2, commonAsset, false); UpdateEntity update3 = new UpdateEntity(UUID.randomUUID(), new Date(), runtimeVersion, projectId); AssetEntity asset3 = new AssetEntity("asset3", "png"); updateDao.insertUpdate(update3); assetDao.insertAssets(Arrays.asList(asset3), update3); assetDao.addExistingAssetToUpdate(update3, commonAsset, false); // update 1 will be deleted // update 2 will have keep = false // update 3 will have keep = true updateDao.deleteUpdates(Arrays.asList(update1)); updateDao.markUpdateFinished(update3); // check that test has been properly set up List<UpdateEntity> allUpdates = updateDao.loadAllUpdates(); Assert.assertEquals(2, allUpdates.size()); for (UpdateEntity update : allUpdates) { if (update.id.equals(update2.id)) { Assert.assertFalse(update.keep); } else { Assert.assertTrue(update.keep); } } Assert.assertNotNull(assetDao.loadAssetWithKey("asset1")); Assert.assertNotNull(assetDao.loadAssetWithKey("asset2")); Assert.assertNotNull(assetDao.loadAssetWithKey("asset3")); Assert.assertNotNull(assetDao.loadAssetWithKey("commonAsset")); assetDao.deleteUnusedAssets(); Assert.assertNull(assetDao.loadAssetWithKey("asset1")); Assert.assertNull(assetDao.loadAssetWithKey("asset2")); Assert.assertNotNull(assetDao.loadAssetWithKey("asset3")); Assert.assertNotNull(assetDao.loadAssetWithKey("commonAsset")); } }
ac4c20db5b99815760eb04b7468a914be38fcd3e
cc32a64afed91f7186c009d3d1247370a904be1c
/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UnknownContentCodeEnumFactory.java
d30bf34f13cb0b49eecc7dcfc6b087b9fd75aebc
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
rmoult01/hapi_fhir_mir_1
5dc5966ce06738872d8e0ddb667d513df76bb3d1
93270786e2d30185c41987038f878943cd736e34
refs/heads/master
2021-07-20T15:58:24.384813
2017-10-30T14:36:18
2017-10-30T14:36:18
106,035,744
1
0
null
null
null
null
UTF-8
Java
false
false
2,796
java
package org.hl7.fhir.dstu3.model.codesystems; /* Copyright (c) 2011+, HL7, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of HL7 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1 import org.hl7.fhir.dstu3.model.EnumFactory; public class UnknownContentCodeEnumFactory implements EnumFactory<UnknownContentCode> { public UnknownContentCode fromCode(String codeString) throws IllegalArgumentException { if (codeString == null || "".equals(codeString)) return null; if ("no".equals(codeString)) return UnknownContentCode.NO; if ("extensions".equals(codeString)) return UnknownContentCode.EXTENSIONS; if ("elements".equals(codeString)) return UnknownContentCode.ELEMENTS; if ("both".equals(codeString)) return UnknownContentCode.BOTH; throw new IllegalArgumentException("Unknown UnknownContentCode code '"+codeString+"'"); } public String toCode(UnknownContentCode code) { if (code == UnknownContentCode.NO) return "no"; if (code == UnknownContentCode.EXTENSIONS) return "extensions"; if (code == UnknownContentCode.ELEMENTS) return "elements"; if (code == UnknownContentCode.BOTH) return "both"; return "?"; } public String toSystem(UnknownContentCode code) { return code.getSystem(); } }
b3271d6f33b73a83f946360f3112d0745d205659
5b8337c39cea735e3817ee6f6e6e4a0115c7487c
/sources/p043io/reactivex/internal/operators/observable/ObservableRange.java
c9c1befda08d2bd15c360d815e124b7e7e602c39
[]
no_license
karthik990/G_Farm_Application
0a096d334b33800e7d8b4b4c850c45b8b005ccb1
53d1cc82199f23517af599f5329aa4289067f4aa
refs/heads/master
2022-12-05T06:48:10.513509
2020-08-10T14:46:48
2020-08-10T14:46:48
286,496,946
1
0
null
null
null
null
UTF-8
Java
false
false
2,687
java
package p043io.reactivex.internal.operators.observable; import p043io.reactivex.Observable; import p043io.reactivex.Observer; import p043io.reactivex.internal.observers.BasicIntQueueDisposable; /* renamed from: io.reactivex.internal.operators.observable.ObservableRange */ public final class ObservableRange extends Observable<Integer> { private final long end; private final int start; /* renamed from: io.reactivex.internal.operators.observable.ObservableRange$RangeDisposable */ static final class RangeDisposable extends BasicIntQueueDisposable<Integer> { private static final long serialVersionUID = 396518478098735504L; final Observer<? super Integer> actual; final long end; boolean fused; long index; RangeDisposable(Observer<? super Integer> observer, long j, long j2) { this.actual = observer; this.index = j; this.end = j2; } /* access modifiers changed from: 0000 */ public void run() { if (!this.fused) { Observer<? super Integer> observer = this.actual; long j = this.end; for (long j2 = this.index; j2 != j && get() == 0; j2++) { observer.onNext(Integer.valueOf((int) j2)); } if (get() == 0) { lazySet(1); observer.onComplete(); } } } public Integer poll() throws Exception { long j = this.index; if (j != this.end) { this.index = 1 + j; return Integer.valueOf((int) j); } lazySet(1); return null; } public boolean isEmpty() { return this.index == this.end; } public void clear() { this.index = this.end; lazySet(1); } public void dispose() { set(1); } public boolean isDisposed() { return get() != 0; } public int requestFusion(int i) { if ((i & 1) == 0) { return 0; } this.fused = true; return 1; } } public ObservableRange(int i, int i2) { this.start = i; this.end = ((long) i) + ((long) i2); } /* access modifiers changed from: protected */ public void subscribeActual(Observer<? super Integer> observer) { RangeDisposable rangeDisposable = new RangeDisposable(observer, (long) this.start, this.end); observer.onSubscribe(rangeDisposable); rangeDisposable.run(); } }
62a9ff092dee831183912bb178861bcdab343216
4368858c518f7df7eaa189786ea1e8ef96a03881
/webservice_mail-1.0/WStest/src/mail/ValidateEmailAddress.java
b20fd956b3fa1269138330aaa4235ed55f4ae066
[]
no_license
LeeDianchao/webservice_mail-1.0
fd44870e1296eda2bd1c659ef1831dbc3c535345
6ab97c0d506c65c5eca22e5bd3ed8c4be5d7fe27
refs/heads/master
2020-04-05T05:07:08.588828
2018-11-07T17:20:57
2018-11-07T17:20:57
156,581,540
0
0
null
null
null
null
GB18030
Java
false
false
1,434
java
package mail; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>anonymous complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="url" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "url" }) @XmlRootElement(name = "validateEmailAddress") public class ValidateEmailAddress { @XmlElement(required = true) protected String url; /** * 获取url属性的值。 * * @return * possible object is * {@link String } * */ public String getUrl() { return url; } /** * 设置url属性的值。 * * @param value * allowed object is * {@link String } * */ public void setUrl(String value) { this.url = value; } }
99e28b51008acff27a5674c47dcd6cd38a67575e
8a0263000145cbb73e63368eb5b137f3af57cf78
/src/com/fantastic/web/dao/controller/TradiaAuthenticationSuccessHandler.java
f655a665c3138adacffa7e8384f3a5aefd7b4616
[]
no_license
joshua5263/Tradia
06fdc78205184f39162b383366d2855125549375
6c1ab4143cc1a6319a18e54a3864121971ba1a32
refs/heads/master
2021-01-13T16:10:09.625737
2015-09-01T04:59:11
2015-09-01T04:59:11
40,282,910
0
0
null
null
null
null
UHC
Java
false
false
1,822
java
package com.fantastic.web.dao.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.web.DefaultRedirectStrategy; import org.springframework.security.web.RedirectStrategy; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import com.fantastic.web.dao.MemberDao; import com.fantastic.web.vo.Member; public class TradiaAuthenticationSuccessHandler implements AuthenticationSuccessHandler { private MemberDao memberDao; @Autowired public void setMemberDao(MemberDao memberDao) { this.memberDao = memberDao; } @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { //로그인 한 유저 아이디 가져오기 String uid = authentication.getName(); //유저의 DefaultRole을 가져오기 위해 Member vo와 Dao import Member m = memberDao.getMember(uid); //유저의 DefaultRole을 type이라는 변수에 담기 String type = m.getLevels(); //일반 유저일 경우 로그인 성공 시 이동할 타겟 페이지 String targetUrl = "/selectpreferlocation/selectpreferlocation"; //역할에 따라 로그인 성공 시 이동할 타겟 페이지 조건문으로 설정 if(type.equals("ROLE_Admin")){ targetUrl = "/main/travelMain"; } //RedirectStrategy를 통해 페이지 이동시키기 RedirectStrategy redirectStrategy = new DefaultRedirectStrategy(); redirectStrategy.sendRedirect(request, response, targetUrl); } }
[ "CEO@CEO_Park" ]
CEO@CEO_Park
5e40b48331c0dc4ec4b1820a09164b9109481a3e
e8e748cda5fe567637403da01c3f2658174fd579
/app/src/main/java/com/t3h/whiyew/appt3h/abstractclass/WakeLocker.java
76f17acd9b5645116ca65bdf7ec4857119bdff21
[]
no_license
dragoon1251996/AppT3h_
82b265fa29248d44a4e30bd485e9779778be03c6
684907ca59ab95878508075811140f6d752c4ebb
refs/heads/master
2021-01-19T17:33:18.409204
2017-04-15T06:45:14
2017-04-15T06:45:14
88,328,793
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.t3h.whiyew.appt3h.abstractclass; import android.content.Context; import android.os.PowerManager; public abstract class WakeLocker { private static PowerManager.WakeLock wakeLock; public static void acquire(Context ctx) { if (wakeLock != null) wakeLock.release(); PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE); wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, ""); wakeLock.acquire(); } public static void release() { if (wakeLock != null) wakeLock.release(); wakeLock = null; } }
73b78fea87e0e143f0c326b92c6efb9f946694b9
4c6b527307881d13804ead88aa53cb04845f5f8c
/lib/objectify-2.2.1/src/com/googlecode/objectify/ObjectifyOpts.java
f4a5fd6d52899f7d8519f7dbc699e43242790100
[ "MIT" ]
permissive
sflores/Prendamigo
f49c6d8dc4b51c00e5e7b330555f7442836f1c1d
764b1831f2cfdcc43cee830ec2d3f2dc46de1baf
refs/heads/master
2021-03-13T00:06:27.153098
2011-01-15T00:44:34
2011-01-15T00:44:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,395
java
package com.googlecode.objectify; import com.google.appengine.api.datastore.ReadPolicy.Consistency; /** * <p>The options available when creating an Objectify instance.</p> * * <p>The default options are:</p> * * <ul> * <li>Do NOT begin a transaction.</li> * <li>Do NOT use a session cache.</li> * <li>DO use a global cache.</li> * <li>Use STRONG consistency.</li> * <li>Apply no deadline to calls.</li> * </ul> * * @author Jeff Schnitzer <[email protected]> */ public class ObjectifyOpts { boolean beginTransaction; boolean sessionCache = false; boolean globalCache = true; Consistency consistency = Consistency.STRONG; Double deadline; /** Gets the current value of beginTransaction */ public boolean getBeginTransaction() { return this.beginTransaction; } /** * Sets whether or not the Objectify instance will start a transaction. If * true, the instance will hold a transaction that must be rolled back or * committed. */ public ObjectifyOpts setBeginTransaction(boolean value) { this.beginTransaction = value; return this; } /** Gets whether or not the Objectify instance will maintain a session cache */ public boolean getSessionCache() { return this.sessionCache; } /** * Sets whether or not the Objectify instance will maintain a session cache. * If true, all entities fetched from the datastore (or the 2nd level memcache) * will be stored as-is in a hashmap within the Objectify instance. Repeated * get()s or queries for the same entity will return the same object. */ public ObjectifyOpts setSessionCache(boolean value) { this.sessionCache = value; return this; } /** Gets whether or not the Objectify instance will use a 2nd-level memcache */ public boolean getGlobalCache() { return this.globalCache; } /** * Sets whether or not the Objectify instance will use a 2nd-level memcache. * If true, Objectify will obey the @Cached annotation on entity classes, * saving entity data to the GAE memcache service. Fetches from the datastore * for @Cached entities will look in the memcache service first. This cache * is shared across all versions of your application across the entire GAE * cluster. */ public ObjectifyOpts setGlobalCache(boolean value) { this.globalCache = value; return this; } /** Gets the initial consistency setting for the Objectify instance */ public Consistency getConsistency() { return this.consistency; } /** * Sets the initial consistency value for the Objectify instance. See the * <a href="http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/ReadPolicy.Consistency.html">Appengine Docs</a> * for an explanation of Consistency. */ public ObjectifyOpts setConsistency(Consistency value) { if (value == null) throw new IllegalArgumentException("Consistency cannot be null"); this.consistency = value; return this; } /** Gets the deadline for datastore calls, in seconds */ public Double getDeadline() { return this.deadline; } /** * Sets a limit, in seconds, for datastore calls. If datastore calls take longer * than this amount, an exception will be thrown. * * @param value can be null to indicate no deadline (other than the standard whole * request deadline of 30s). */ public ObjectifyOpts setDeadline(Double value) { this.deadline = value; return this; } }
99592a4a6b24a513bae5619b39321d9276af7fb2
ddf0d861a600e9271198ed43be705debae15bafd
/CompetitiveProgrammingSolution/Implementation/MXMEDIAN.java
f4718cd0e54b0629eb572e776371aa54b504fa30
[]
no_license
bibhuty-did-this/MyCodes
79feea385b055edc776d4a9d5aedbb79a9eb55f4
2b8c1d4bd3088fc28820145e3953af79417c387f
refs/heads/master
2023-02-28T09:20:36.500579
2021-02-07T17:17:54
2021-02-07T17:17:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
682
java
/** * Author: o_panda_o * Email: [email protected] */ import java.util.Arrays; import java.util.Scanner; public class MXMEDIAN { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t=in.nextInt(); while(t-->0){ int n=in.nextInt(); int a[]=new int[2*n+1]; for(int i=1;i<=2*n;++i) a[i]=in.nextInt(); Arrays.sort(a,1,2*n+1); System.out.println(a[n+(n+1)/2]); for(int i=1;i<=n;++i){ System.out.print(a[i]+" "+a[n+i]+" "); } System.out.println(); } } }
3c04dd9f8b7ae9c1f0adbcbb345266e5917bc5a4
b92fccda5916202f4a26e4da4a0ee349c9674682
/app/src/main/java/com/example/gridview/ThanhvienActivity.java
306ea342041f4bc1c78b65dfa9fb92a7c339654a
[]
no_license
Thuan-167/baibaocao
e08c549521ca0409ed85404a9903b77af8c8afd9
8a303352aa1dd61d197cd9063f6e326590325db2
refs/heads/master
2023-02-11T23:15:17.730480
2020-12-30T07:50:22
2020-12-30T07:50:22
325,485,772
0
0
null
null
null
null
UTF-8
Java
false
false
834
java
package com.example.gridview; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; public class ThanhvienActivity extends AppCompatActivity { private Button button2; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.thanhvien); button2=(Button) findViewById(R.id.button2); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(ThanhvienActivity.this, MainActivity.class); startActivity(intent); } }); } }
2906e3a792aa694547e1021308bc3712346d067c
13c711fed6fbc21dfc1ae491c34338f30d98420c
/src/main/java/com/imooc/sell/VO/ProductInfoVO.java
af838391996824d1fd9a31f8bbf3db9d876231dd
[]
no_license
HeKinKin/Sell
c0e383ac97e3bf36d36a68cd246cf512887c66fb
ba7c3e421e08b8fc551bcff6101b4c75580d67d0
refs/heads/master
2020-04-26T01:58:28.382580
2019-03-01T02:45:51
2019-03-01T02:45:51
173,220,941
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package com.imooc.sell.VO; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.math.BigDecimal; /** * 商品详情 * @author hexin * @date 2019/02/26 */ @Data public class ProductInfoVO { @JsonProperty("id") private String productId; @JsonProperty("name") private String productName; @JsonProperty("price") private BigDecimal productPrice; @JsonProperty("description") private String productDescription; @JsonProperty("icon") private String productIcon; }
d2f7dbebe10c0446344dcf86967012392cff2b4e
97ead6dfbe1a6b569be08f7cd247161bc0a73121
/io/src/main/java/com/redshape/io/net/auth/impl/providers/SimpleProvider.java
24df4ccac120d6cefec76fbfeac3eb71d02e8356
[ "Apache-2.0" ]
permissive
Redshape/Redshape-AS
19f54bc0d54061b0302a7b3f63e600afb01168ea
cf3492919a35b868bc7045b35d38e74a3a2b8c01
refs/heads/master
2021-01-17T05:17:31.881177
2012-09-05T13:49:50
2012-09-05T13:49:50
1,390,510
0
0
null
null
null
null
UTF-8
Java
false
false
457
java
package com.redshape.io.net.auth.impl.providers; import com.redshape.io.net.auth.AbstractCredentialsProvider; /** * Created by IntelliJ IDEA. * User: user * Date: Nov 12, 2010 * Time: 1:06:38 PM * To change this template use File | Settings | File Templates. */ public class SimpleProvider extends AbstractCredentialsProvider { public SimpleProvider() { super(); } public boolean isInitialized() { return true; } }
6249e31c248bb4e391f3b4dc8c930356eebaf633
a14d6f062012132b46138efffd1eb11bfe568aa7
/test/unitTests/ControllerTest.java
6e718adec097ac1aea322643aa91d1c3c5903a22
[]
no_license
benetal/SudokuSolver_Alan_David
f40fe62f8384df3aff20d1cffc96f08b11ccd510
d108437d5b1ab58f3b6dd61f6a661ca587282eac
refs/heads/master
2022-10-28T21:41:32.781723
2020-06-11T16:33:26
2020-06-11T16:33:26
268,727,761
0
0
null
null
null
null
UTF-8
Java
false
false
141
java
package unitTests; import org.junit.jupiter.api.Test; class ControllerTest { @Test void testIfJsonFileOutputIsTrue() { } }
8cc264e373507894412815c1fcaa9bfca5a37890
072b24fa9a8d5bae5d1c2be04322c21d3b644c40
/week-09/day-02/Frontend/src/main/java/com/api/frontend/models/ErrorMessage.java
4c50911987089f2d9d54cd1fcfa59e981db85a0f
[]
no_license
green-fox-academy/aurelreli
82d78271e6eb3a839a338020ede6cb555d3f51e3
765baf2a305e8884b8f38245cac846d755dedd2b
refs/heads/master
2022-12-17T21:09:34.794554
2020-09-18T15:28:13
2020-09-18T15:28:13
279,875,920
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package com.api.frontend.models; public class ErrorMessage { private String error; public ErrorMessage(String message) { this.error = message; } public String getError() { return error; } public void setError(String error) { this.error = error; } }
cd10c6329a85a6f9658dd667a8f0feca8aa62c4a
2e570d6dcabfd987a6413dc84e3015073d9f918c
/src/DVD.java
cab0c64fc82f9ca361d3e03f869ab1331e210bd2
[]
no_license
iskandarbestprogrammer/universalPult1
d5ec459d54a97efc27917187f5f287c31616eb4b
b2976c183030bca209df182b65662b2d7869267f
refs/heads/master
2021-09-28T00:53:12.032817
2018-11-13T00:33:56
2018-11-13T00:33:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
140
java
public class DVD extends Device { public DVD(String name, String model,boolean zustand ){ super ( name, model,false); } }
902e41bbffe365f65cfbdfcbb371625faad427c0
e9d3f2be6be67823129bf7b30c01dd896043b41c
/kr.re.etri.tpl/src/kr/re/etri/tpl/script/actions/RulerBreakpointAction.java
8db6d29b884b000cd485bb9ec5634a5855e22b01
[]
no_license
OPRoS/TaskEditor
d248e131b0d7bac0002c41f52a9c6baea1096e86
5c3827868d8f77f02375910b38772127ba841d18
refs/heads/master
2020-04-05T08:19:46.058409
2013-08-27T05:31:01
2013-08-27T05:31:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
136
java
package kr.re.etri.tpl.script.actions; import org.eclipse.jface.action.Action; public class RulerBreakpointAction extends Action { }
3804b8390a2677d082fcfd1b4b80cfa51bbe663f
893f83189700fefeba216e6899d42097cc0bec70
/clones/clones/src/main/java/weka/filters/unsupervised/attribute/NumericToNominal.java
926c8210295468f9e1fe226ce6a66a4b4819fcff
[ "MIT" ]
permissive
pseudoPixels/SciWorCS
79249198b3dd2a2653d4401d0f028f2180338371
e1738c8b838c71b18598ceca29d7c487c76f876b
refs/heads/master
2021-06-10T01:08:30.242094
2018-12-06T18:53:34
2018-12-06T18:53:34
140,774,351
0
1
MIT
2021-06-01T22:23:47
2018-07-12T23:33:53
Python
UTF-8
Java
false
false
13,230
java
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * NumericToNominal.java * Copyright (C) 2006 University of Waikato, Hamilton, New Zealand */ package weka.filters.unsupervised.attribute; import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; import java.util.Vector; import weka.core.Attribute; import weka.core.Capabilities; import weka.core.Capabilities.Capability; import weka.core.FastVector; import weka.core.Instance; import weka.core.Instances; import weka.core.Option; import weka.core.Range; import weka.core.RevisionUtils; import weka.core.SparseInstance; import weka.core.Utils; import weka.filters.SimpleBatchFilter; /** * <!-- globalinfo-start --> A filter for turning numeric attributes into * nominal ones. Unlike discretization, it just takes all numeric values and * adds them to the list of nominal values of that attribute. Useful after CSV * imports, to enforce certain attributes to become nominal, e.g., the class * attribute, containing values from 1 to 5. * <p/> * <!-- globalinfo-end --> * * <!-- options-start --> Valid options are: * <p/> * * <pre> * -R &lt;col1,col2-col4,...&gt; * Specifies list of columns to Discretize. First and last are valid indexes. * (default: first-last) * </pre> * * <pre> * -V * Invert matching sense of column indexes. * </pre> * * <!-- options-end --> * * @author fracpete (fracpete at waikato dot ac dot nz) * @version $Revision: 10988 $ */ public class NumericToNominal extends SimpleBatchFilter { /** for serialization */ private static final long serialVersionUID = -6614630932899796239L; /** the maximum number of decimals to use */ protected final static int MAX_DECIMALS = 6; /** Stores which columns to turn into nominals */ protected Range m_Cols = new Range("first-last"); /** The default columns to turn into nominals */ protected String m_DefaultCols = "first-last"; /** * Returns a string describing this filter * * @return a description of the filter suitable for displaying in the * explorer/experimenter gui */ @Override public String globalInfo() { return "A filter for turning numeric attributes into nominal ones. Unlike " + "discretization, it just takes all numeric values and adds them to " + "the list of nominal values of that attribute. Useful after CSV " + "imports, to enforce certain attributes to become nominal, e.g., " + "the class attribute, containing values from 1 to 5."; } /** * Gets an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration listOptions() { Vector result = new Vector(); result.addElement(new Option( "\tSpecifies list of columns to Discretize. First" + " and last are valid indexes.\n" + "\t(default: first-last)", "R", 1, "-R <col1,col2-col4,...>")); result.addElement(new Option( "\tInvert matching sense of column indexes.", "V", 0, "-V")); return result.elements(); } /** * Parses a given list of options. * <p/> * * <!-- options-start --> Valid options are: * <p/> * * <pre> * -R &lt;col1,col2-col4,...&gt; * Specifies list of columns to Discretize. First and last are valid indexes. * (default: first-last) * </pre> * * <pre> * -V * Invert matching sense of column indexes. * </pre> * * <!-- options-end --> * * @param options the list of options as an array of strings * @throws Exception if an option is not supported */ @Override public void setOptions(String[] options) throws Exception { String tmpStr; super.setOptions(options); setInvertSelection(Utils.getFlag('V', options)); tmpStr = Utils.getOption('R', options); if (tmpStr.length() != 0) { setAttributeIndices(tmpStr); } else { setAttributeIndices(m_DefaultCols); } if (getInputFormat() != null) { setInputFormat(getInputFormat()); } } /** * Gets the current settings of the filter. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { int i; Vector result; String[] options; result = new Vector(); options = super.getOptions(); for (i = 0; i < options.length; i++) { result.add(options[i]); } if (!getAttributeIndices().equals("")) { result.add("-R"); result.add(getAttributeIndices()); } if (getInvertSelection()) { result.add("-V"); } return (String[]) result.toArray(new String[result.size()]); } /** * Returns the tip text for this property * * @return tip text for this property suitable for displaying in the * explorer/experimenter gui */ public String invertSelectionTipText() { return "Set attribute selection mode. If false, only selected" + " (numeric) attributes in the range will be 'nominalized'; if" + " true, only non-selected attributes will be 'nominalized'."; } /** * Gets whether the supplied columns are to be worked on or the others. * * @return true if the supplied columns will be worked on */ public boolean getInvertSelection() { return m_Cols.getInvert(); } /** * Sets whether selected columns should be worked on or all the others apart * from these. If true all the other columns are considered for * "nominalization". * * @param value the new invert setting */ public void setInvertSelection(boolean value) { m_Cols.setInvert(value); } /** * Returns the tip text for this property * * @return tip text for this property suitable for displaying in the * explorer/experimenter gui */ public String attributeIndicesTipText() { return "Specify range of attributes to act on." + " This is a comma separated list of attribute indices, with" + " \"first\" and \"last\" valid values. Specify an inclusive" + " range with \"-\". E.g: \"first-3,5,6-10,last\"."; } /** * Gets the current range selection * * @return a string containing a comma separated list of ranges */ public String getAttributeIndices() { return m_Cols.getRanges(); } /** * Sets which attributes are to be "nominalized" (only numeric attributes * among the selection will be transformed). * * @param value a string representing the list of attributes. Since the string * will typically come from a user, attributes are indexed from 1. <br> * eg: first-3,5,6-last * @throws IllegalArgumentException if an invalid range list is supplied */ public void setAttributeIndices(String value) { m_Cols.setRanges(value); } /** * Sets which attributes are to be transoformed to nominal. (only numeric * attributes among the selection will be transformed). * * @param value an array containing indexes of attributes to nominalize. Since * the array will typically come from a program, attributes are * indexed from 0. * @throws IllegalArgumentException if an invalid set of ranges is supplied */ public void setAttributeIndicesArray(int[] value) { setAttributeIndices(Range.indicesToRangeList(value)); } /** * Returns the Capabilities of this filter. * * @return the capabilities of this object * @see Capabilities */ @Override public Capabilities getCapabilities() { Capabilities result = super.getCapabilities(); result.disableAll(); // attributes result.enableAllAttributes(); result.enable(Capability.MISSING_VALUES); // class result.enableAllClasses(); result.enable(Capability.MISSING_CLASS_VALUES); result.enable(Capability.NO_CLASS); return result; } /** * Determines the output format based on the input format and returns this. In * case the output format cannot be returned immediately, i.e., * immediateOutputFormat() returns false, then this method will be called from * batchFinished(). * * @param inputFormat the input format to base the output format on * @return the output format * @throws Exception in case the determination goes wrong * @see #hasImmediateOutputFormat() * @see #batchFinished() */ @Override protected Instances determineOutputFormat(Instances inputFormat) throws Exception { Instances data; Instances result; FastVector atts; FastVector values; HashSet hash; int i; int n; boolean isDate; Instance inst; Vector sorted; m_Cols.setUpper(inputFormat.numAttributes() - 1); data = new Instances(inputFormat); atts = new FastVector(); for (i = 0; i < data.numAttributes(); i++) { if (!m_Cols.isInRange(i) || !data.attribute(i).isNumeric()) { atts.addElement(data.attribute(i)); continue; } // date attribute? isDate = (data.attribute(i).type() == Attribute.DATE); // determine all available attribtues in dataset hash = new HashSet(); for (n = 0; n < data.numInstances(); n++) { inst = data.instance(n); if (inst.isMissing(i)) { continue; } if (isDate) { hash.add(inst.stringValue(i)); } else { hash.add(new Double(inst.value(i))); } } // sort values sorted = new Vector(); for (Object o : hash) { sorted.add(o); } Collections.sort(sorted); // create attribute from sorted values values = new FastVector(); for (Object o : sorted) { if (isDate) { values.addElement( o.toString()); } else { values.addElement( Utils.doubleToString(((Double) o).doubleValue(), MAX_DECIMALS)); } } Attribute newAtt = new Attribute(data.attribute(i).name(), values); newAtt.setWeight(data.attribute(i).weight()); atts.addElement(newAtt); } result = new Instances(inputFormat.relationName(), atts, 0); result.setClassIndex(inputFormat.classIndex()); return result; } /** * Processes the given data (may change the provided dataset) and returns the * modified version. This method is called in batchFinished(). * * @param instances the data to process * @return the modified data * @throws Exception in case the processing goes wrong * @see #batchFinished() */ @Override protected Instances process(Instances instances) throws Exception { Instances result; int i; int n; double[] values; String value; Instance inst; Instance newInst; // we need the complete input data! if (!isFirstBatchDone()) { setOutputFormat(determineOutputFormat(getInputFormat())); } result = new Instances(getOutputFormat()); for (i = 0; i < instances.numInstances(); i++) { inst = instances.instance(i); values = inst.toDoubleArray(); for (n = 0; n < values.length; n++) { if (!m_Cols.isInRange(n) || !instances.attribute(n).isNumeric() || inst.isMissing(n)) { continue; } // get index of value if (instances.attribute(n).type() == Attribute.DATE) { value = inst.stringValue(n); } else { value = Utils.doubleToString(inst.value(n), MAX_DECIMALS); } int index = result.attribute(n).indexOfValue(value); if (index == -1) { values[n] = Instance.missingValue(); } else { values[n] = index; } } // generate new instance if (inst instanceof SparseInstance) { newInst = new SparseInstance(inst.weight(), values); } else { newInst = new Instance(inst.weight(), values); } // copy possible string, relational values newInst.setDataset(getOutputFormat()); copyValues(newInst, false, inst.dataset(), getOutputFormat()); result.add(newInst); } return result; } /** * Returns the revision string. * * @return the revision */ @Override public String getRevision() { return RevisionUtils.extract("$Revision: 10988 $"); } /** * Runs the filter with the given parameters. Use -h to list options. * * @param args the commandline options */ public static void main(String[] args) { runFilter(new NumericToNominal(), args); } }
08e3d19602e801ffbba1edf410a9c9f87cdddd3e
81d770f03b6bd67750bd161938e7ad13ce62e7e0
/src/main/java/com/store/storeapp/StoreappApplication.java
35a336d69825202c995aa45795b4d91173ac0287
[]
no_license
peterReilly11/storeapp
a4edaccb6740708934299202f458e6f5947e6192
727a9e7d3a9e953a071b4dc5c3252597ecc412c6
refs/heads/master
2023-04-04T07:55:36.302147
2021-04-16T20:48:00
2021-04-16T20:48:00
317,007,218
0
0
null
2021-04-16T20:48:01
2020-11-29T17:39:00
TypeScript
UTF-8
Java
false
false
1,613
java
package com.store.storeapp; /*import com.store.storeapp.model.Cart; import com.store.storeapp.model.CartItem; import java.util.Date; import java.util.stream.Stream; import com.store.storeapp.repository.CartItemRepository; import com.store.storeapp.repository.CartRepository; import com.store.storeapp.service.CartItemService; import com.store.storeapp.service.CartService; import org.springframework.boot.ApplicationRunner;*/ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; // import org.springframework.context.annotation.Bean; @SpringBootApplication public class StoreappApplication { public static void main(String[] args) { SpringApplication.run(StoreappApplication.class, args); } /* @Bean ApplicationRunner init(CartService cartService, CartItemService cartItemService, CartRepository cartRepository, CartItemRepository cartItemRepository) { Cart cart = cartService.createCart(); cart.setDeliveryCity("Chicago"); cart.setOrderPlaced(false); cart.setEmail("[email protected]"); Stream.of("Andromeda Galaxy", "Milky Way", "Earth").forEach(name -> { CartItem cartItem = new CartItem(); cartItem.setCart(cart); cartItem.setDateTimeCreated(new Date()); cartItem.setItemName(name); cartItem.setItemDescription(name + " Description"); cartItem.setItemURL(name + ".com"); cart.addCartItem(cartItem); }); cartService.putCart(cart); return args -> { cartRepository.findAll().forEach(System.out::println); cartItemRepository.findAll().forEach(System.out::println); }; } */ }
67f47e46f90790e601b285428f8f7baadeeeeba6
3b38f0b0d968f650a88f8cd5efb4d5e3e846a034
/src/main/java/br/com/sirius/gerador/repository/GeradorLicencaRepository.java
e2bd725aec7babaa3cf1738ccc8d450b68f8ee95
[]
no_license
juniormoraisjr/projetoGeradorLicenca
3392e710f47adf137224a0ed8aa344c5dc65b23e
0d7151e6f02cbcae654476a7c721ae28d236ba7e
refs/heads/master
2020-04-20T03:02:33.909414
2019-03-18T18:22:33
2019-03-18T18:22:33
168,586,973
0
1
null
null
null
null
UTF-8
Java
false
false
271
java
package br.com.sirius.gerador.repository; import org.springframework.data.mongodb.repository.MongoRepository; import br.com.sirius.gerador.repository.entity.GeradorLicenca; public interface GeradorLicencaRepository extends MongoRepository<GeradorLicenca, String> { }
226cd95b06c2da60be39b5dd739c62e659a35bfb
8a787e93fea9c334122441717f15bd2f772e3843
/odfdom/src/main/java/org/odftoolkit/odfdom/dom/element/style/StyleListLevelPropertiesElement.java
564406526550eb1291e974f49759e90466b27bd7
[ "Apache-2.0", "BSD-3-Clause", "MIT", "W3C", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference" ]
permissive
apache/odftoolkit
296ea9335bfdd78aa94829c915a6e9c24e5b5166
99975f3be40fc1c428167a3db7a9a63038acfa9f
refs/heads/trunk
2023-07-02T16:30:24.946067
2018-10-02T11:11:40
2018-10-02T11:11:40
5,212,656
39
45
Apache-2.0
2018-04-11T11:57:17
2012-07-28T07:00:12
Java
UTF-8
Java
false
false
17,051
java
/************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved. * * Use is subject to license terms. * * 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. You can also * obtain a copy of the License at http://odftoolkit.org/docs/license.txt * * 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. * ************************************************************************/ /* * This file is automatically generated. * Don't edit manually. */ package org.odftoolkit.odfdom.dom.element.style; import org.odftoolkit.odfdom.pkg.OdfElement; import org.odftoolkit.odfdom.dom.style.props.OdfStyleProperty; import org.odftoolkit.odfdom.dom.style.props.OdfStylePropertiesSet; import org.odftoolkit.odfdom.pkg.ElementVisitor; import org.odftoolkit.odfdom.pkg.OdfFileDom; import org.odftoolkit.odfdom.pkg.OdfName; import org.odftoolkit.odfdom.dom.OdfDocumentNamespace; import org.odftoolkit.odfdom.dom.DefaultElementVisitor; import org.odftoolkit.odfdom.dom.attribute.fo.FoHeightAttribute; import org.odftoolkit.odfdom.dom.attribute.fo.FoTextAlignAttribute; import org.odftoolkit.odfdom.dom.attribute.fo.FoWidthAttribute; import org.odftoolkit.odfdom.dom.attribute.style.StyleFontNameAttribute; import org.odftoolkit.odfdom.dom.attribute.style.StyleVerticalPosAttribute; import org.odftoolkit.odfdom.dom.attribute.style.StyleVerticalRelAttribute; import org.odftoolkit.odfdom.dom.attribute.svg.SvgYAttribute; import org.odftoolkit.odfdom.dom.attribute.text.TextListLevelPositionAndSpaceModeAttribute; import org.odftoolkit.odfdom.dom.attribute.text.TextMinLabelDistanceAttribute; import org.odftoolkit.odfdom.dom.attribute.text.TextMinLabelWidthAttribute; import org.odftoolkit.odfdom.dom.attribute.text.TextSpaceBeforeAttribute; import org.odftoolkit.odfdom.dom.element.OdfStylePropertiesBase; /** * DOM implementation of OpenDocument element {@odf.element style:list-level-properties}. * */ public class StyleListLevelPropertiesElement extends OdfStylePropertiesBase { public static final OdfName ELEMENT_NAME = OdfName.newName(OdfDocumentNamespace.STYLE, "list-level-properties"); /** * Create the instance of <code>StyleListLevelPropertiesElement</code> * * @param ownerDoc The type is <code>OdfFileDom</code> */ public StyleListLevelPropertiesElement(OdfFileDom ownerDoc) { super(ownerDoc, ELEMENT_NAME); } /** * Get the element name * * @return return <code>OdfName</code> the name of element {@odf.element style:list-level-properties}. */ public OdfName getOdfName() { return ELEMENT_NAME; } public final static OdfStyleProperty Height = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.FO, "height")); public final static OdfStyleProperty TextAlign = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.FO, "text-align")); public final static OdfStyleProperty Width = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.FO, "width")); public final static OdfStyleProperty FontName = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.STYLE, "font-name")); public final static OdfStyleProperty VerticalPos = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.STYLE, "vertical-pos")); public final static OdfStyleProperty VerticalRel = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.STYLE, "vertical-rel")); public final static OdfStyleProperty Y = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.SVG, "y")); public final static OdfStyleProperty ListLevelPositionAndSpaceMode = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.TEXT, "list-level-position-and-space-mode")); public final static OdfStyleProperty MinLabelDistance = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.TEXT, "min-label-distance")); public final static OdfStyleProperty MinLabelWidth = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.TEXT, "min-label-width")); public final static OdfStyleProperty SpaceBefore = OdfStyleProperty.get(OdfStylePropertiesSet.ListLevelProperties, OdfName.newName(OdfDocumentNamespace.TEXT, "space-before")); /** * Receives the value of the ODFDOM attribute representation <code>FoHeightAttribute</code> , See {@odf.attribute fo:height} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getFoHeightAttribute() { FoHeightAttribute attr = (FoHeightAttribute) getOdfAttribute(OdfDocumentNamespace.FO, "height"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>FoHeightAttribute</code> , See {@odf.attribute fo:height} * * @param foHeightValue The type is <code>String</code> */ public void setFoHeightAttribute(String foHeightValue) { FoHeightAttribute attr = new FoHeightAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(foHeightValue); } /** * Receives the value of the ODFDOM attribute representation <code>FoTextAlignAttribute</code> , See {@odf.attribute fo:text-align} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getFoTextAlignAttribute() { FoTextAlignAttribute attr = (FoTextAlignAttribute) getOdfAttribute(OdfDocumentNamespace.FO, "text-align"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>FoTextAlignAttribute</code> , See {@odf.attribute fo:text-align} * * @param foTextAlignValue The type is <code>String</code> */ public void setFoTextAlignAttribute(String foTextAlignValue) { FoTextAlignAttribute attr = new FoTextAlignAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(foTextAlignValue); } /** * Receives the value of the ODFDOM attribute representation <code>FoWidthAttribute</code> , See {@odf.attribute fo:width} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getFoWidthAttribute() { FoWidthAttribute attr = (FoWidthAttribute) getOdfAttribute(OdfDocumentNamespace.FO, "width"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>FoWidthAttribute</code> , See {@odf.attribute fo:width} * * @param foWidthValue The type is <code>String</code> */ public void setFoWidthAttribute(String foWidthValue) { FoWidthAttribute attr = new FoWidthAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(foWidthValue); } /** * Receives the value of the ODFDOM attribute representation <code>StyleFontNameAttribute</code> , See {@odf.attribute style:font-name} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getStyleFontNameAttribute() { StyleFontNameAttribute attr = (StyleFontNameAttribute) getOdfAttribute(OdfDocumentNamespace.STYLE, "font-name"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>StyleFontNameAttribute</code> , See {@odf.attribute style:font-name} * * @param styleFontNameValue The type is <code>String</code> */ public void setStyleFontNameAttribute(String styleFontNameValue) { StyleFontNameAttribute attr = new StyleFontNameAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(styleFontNameValue); } /** * Receives the value of the ODFDOM attribute representation <code>StyleVerticalPosAttribute</code> , See {@odf.attribute style:vertical-pos} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getStyleVerticalPosAttribute() { StyleVerticalPosAttribute attr = (StyleVerticalPosAttribute) getOdfAttribute(OdfDocumentNamespace.STYLE, "vertical-pos"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>StyleVerticalPosAttribute</code> , See {@odf.attribute style:vertical-pos} * * @param styleVerticalPosValue The type is <code>String</code> */ public void setStyleVerticalPosAttribute(String styleVerticalPosValue) { StyleVerticalPosAttribute attr = new StyleVerticalPosAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(styleVerticalPosValue); } /** * Receives the value of the ODFDOM attribute representation <code>StyleVerticalRelAttribute</code> , See {@odf.attribute style:vertical-rel} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getStyleVerticalRelAttribute() { StyleVerticalRelAttribute attr = (StyleVerticalRelAttribute) getOdfAttribute(OdfDocumentNamespace.STYLE, "vertical-rel"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>StyleVerticalRelAttribute</code> , See {@odf.attribute style:vertical-rel} * * @param styleVerticalRelValue The type is <code>String</code> */ public void setStyleVerticalRelAttribute(String styleVerticalRelValue) { StyleVerticalRelAttribute attr = new StyleVerticalRelAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(styleVerticalRelValue); } /** * Receives the value of the ODFDOM attribute representation <code>SvgYAttribute</code> , See {@odf.attribute svg:y} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getSvgYAttribute() { SvgYAttribute attr = (SvgYAttribute) getOdfAttribute(OdfDocumentNamespace.SVG, "y"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>SvgYAttribute</code> , See {@odf.attribute svg:y} * * @param svgYValue The type is <code>String</code> */ public void setSvgYAttribute(String svgYValue) { SvgYAttribute attr = new SvgYAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(svgYValue); } /** * Receives the value of the ODFDOM attribute representation <code>TextListLevelPositionAndSpaceModeAttribute</code> , See {@odf.attribute text:list-level-position-and-space-mode} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextListLevelPositionAndSpaceModeAttribute() { TextListLevelPositionAndSpaceModeAttribute attr = (TextListLevelPositionAndSpaceModeAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "list-level-position-and-space-mode"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextListLevelPositionAndSpaceModeAttribute</code> , See {@odf.attribute text:list-level-position-and-space-mode} * * @param textListLevelPositionAndSpaceModeValue The type is <code>String</code> */ public void setTextListLevelPositionAndSpaceModeAttribute(String textListLevelPositionAndSpaceModeValue) { TextListLevelPositionAndSpaceModeAttribute attr = new TextListLevelPositionAndSpaceModeAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textListLevelPositionAndSpaceModeValue); } /** * Receives the value of the ODFDOM attribute representation <code>TextMinLabelDistanceAttribute</code> , See {@odf.attribute text:min-label-distance} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextMinLabelDistanceAttribute() { TextMinLabelDistanceAttribute attr = (TextMinLabelDistanceAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "min-label-distance"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextMinLabelDistanceAttribute</code> , See {@odf.attribute text:min-label-distance} * * @param textMinLabelDistanceValue The type is <code>String</code> */ public void setTextMinLabelDistanceAttribute(String textMinLabelDistanceValue) { TextMinLabelDistanceAttribute attr = new TextMinLabelDistanceAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textMinLabelDistanceValue); } /** * Receives the value of the ODFDOM attribute representation <code>TextMinLabelWidthAttribute</code> , See {@odf.attribute text:min-label-width} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextMinLabelWidthAttribute() { TextMinLabelWidthAttribute attr = (TextMinLabelWidthAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "min-label-width"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextMinLabelWidthAttribute</code> , See {@odf.attribute text:min-label-width} * * @param textMinLabelWidthValue The type is <code>String</code> */ public void setTextMinLabelWidthAttribute(String textMinLabelWidthValue) { TextMinLabelWidthAttribute attr = new TextMinLabelWidthAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textMinLabelWidthValue); } /** * Receives the value of the ODFDOM attribute representation <code>TextSpaceBeforeAttribute</code> , See {@odf.attribute text:space-before} * * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set and no default value defined. */ public String getTextSpaceBeforeAttribute() { TextSpaceBeforeAttribute attr = (TextSpaceBeforeAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "space-before"); if (attr != null) { return String.valueOf(attr.getValue()); } return null; } /** * Sets the value of ODFDOM attribute representation <code>TextSpaceBeforeAttribute</code> , See {@odf.attribute text:space-before} * * @param textSpaceBeforeValue The type is <code>String</code> */ public void setTextSpaceBeforeAttribute(String textSpaceBeforeValue) { TextSpaceBeforeAttribute attr = new TextSpaceBeforeAttribute((OdfFileDom) this.ownerDocument); setOdfAttribute(attr); attr.setValue(textSpaceBeforeValue); } /** * Create child element {@odf.element style:list-level-label-alignment}. * * @param textLabelFollowedByValue the <code>String</code> value of <code>TextLabelFollowedByAttribute</code>, see {@odf.attribute text:label-followed-by} at specification * Child element is new in Odf 1.2 * * @return the element {@odf.element style:list-level-label-alignment} */ public StyleListLevelLabelAlignmentElement newStyleListLevelLabelAlignmentElement(String textLabelFollowedByValue) { StyleListLevelLabelAlignmentElement styleListLevelLabelAlignment = ((OdfFileDom) this.ownerDocument).newOdfElement(StyleListLevelLabelAlignmentElement.class); styleListLevelLabelAlignment.setTextLabelFollowedByAttribute(textLabelFollowedByValue); this.appendChild(styleListLevelLabelAlignment); return styleListLevelLabelAlignment; } @Override public void accept(ElementVisitor visitor) { if (visitor instanceof DefaultElementVisitor) { DefaultElementVisitor defaultVisitor = (DefaultElementVisitor) visitor; defaultVisitor.visit(this); } else { visitor.visit(this); } } }
bf2387efc8a9e3bca220e297313037b44657fec6
396384ae649e04f1644730d8f8b8bb5ac36b1cab
/iot_spring/src/main/java/com/iot/spring/dao/NaverTransDAO.java
fd59cf3506e662d9c7bf1a04d498bfa92e13f303
[]
no_license
jiyungg/Spring
8aff80d511080f7c81f0f27cb8213f54bc89eb78
f5ffc4bd4ea88680a0a077d857054a1f4edcd25d
refs/heads/master
2021-09-06T21:25:23.850934
2018-02-11T16:45:47
2018-02-11T16:45:47
119,961,831
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package com.iot.spring.dao; import java.io.IOException; public interface NaverTransDAO { public String getText(String text)throws IOException ; }
[ "DJA@DJA-PC" ]
DJA@DJA-PC
f2a7627abbc89bf151af7f888043c7a7154409f7
c988bae694f2da6805fdd650f2018e0da1a0a867
/Network/AddUser_hanwei/src/edu/cornell/opencomm/network/sp11/NetworkServices.java
54bc06914c2621ddf91ac7993f591a52908fc061
[]
no_license
moki80/OpenCommAndroid
b51254be041cd505e260fffe128c7b1c43fdba02
dcacf6def62eb79899375b521b260b8cf2e28864
refs/heads/master
2021-01-23T12:05:46.811360
2011-09-03T15:45:11
2011-09-03T15:45:11
1,588,908
1
0
null
null
null
null
UTF-8
Java
false
false
231
java
package edu.cornell.opencomm.network.sp11; public class NetworkServices { public static final String KEY_ADDUSERNAME = "addUsername"; public static final String ACTION_ADDUSER = "edu.cornell.opencomm.network.ACTION_ADDUSER"; }
37da3b3cdff87dd970c4f5e74412276e986fcbab
e8bab894e6fc517b7de14ae93e6ecafd5ba69880
/src/com/launcher/simulator/Simulator.java
1f20b3e8194cb2050220ca4df03756f25f702ebe
[]
no_license
HRossouw42/avaj-launcher
a4adb9291ae8332624693f0a4314108ab0370734
37479bc1c1ac0f5c2fdb964ad0c9ff5458bf9b81
refs/heads/master
2020-06-09T18:35:43.959455
2019-07-08T08:39:46
2019-07-08T08:39:46
193,485,515
0
1
null
null
null
null
UTF-8
Java
false
false
3,176
java
package com.launcher.simulator; import com.launcher.simulator.vehicles.AircraftFactory; import com.launcher.simulator.vehicles.Flyable; import com.launcher.weather.WeatherTower; import java.io.*; import java.util.ArrayList; import java.util.List; public class Simulator { private static WeatherTower weatherTower; private static List<Flyable> flyablesList = new ArrayList<>(); public static void main(String[] args) throws FileNotFoundException { System.out.println("Scanning Simulations File"); if (args.length != 1) { System.out.println("Failed"); return; } //clears file first PrintWriter pw = new PrintWriter("simulation.txt"); pw.close(); // The name of the file to open. // In this case the first argument in java starts at [0] System.out.println("Reading from file: " + args[0]); String fileName = args[0]; try { BufferedReader reader = new BufferedReader(new FileReader(fileName)); String line = reader.readLine(); if (line != null) { weatherTower = new WeatherTower(); //System.out.println("New WeatherTower: " + weatherTower); int simulations = Integer.parseInt(line.split(" ")[0]); if (simulations < 0) { //System.out.println("Simulation count " + simulations + " invalid."); System.exit(1); } //System.out.println("Simulation count " + simulations); while ((line = reader.readLine()) != null) { Flyable flyable = AircraftFactory.newAircraft( line.split(" ")[0], line.split(" ")[1], Integer.parseInt(line.split(" ")[2]), Integer.parseInt(line.split(" ")[3]), Integer.parseInt(line.split(" ")[4])); flyablesList.add(flyable); //System.out.println(flyablesList); } for (Flyable flyable : flyablesList) { //System.out.println(flyable); flyable.registerTower(weatherTower); } for (int i = 1; i <= simulations; i++) { System.out.println("Simulation # " + i); weatherTower.writeToFile("write", "Simulation # " + i + "\n"); weatherTower.changeWeather(); } reader.close(); } } catch (FileNotFoundException ex) { System.out.println( "Unable to open file '" + fileName + "'"); } catch (IOException ex) { System.out.println( "Error reading file '" + fileName + "'"); } catch (ArrayIndexOutOfBoundsException e) { System.out.println( "Choose a simulation file" ); } finally { System.out.println("Simulations ended."); } } }
ebb7c141f95ba5da4ef879149bbb5f41913ec89b
777ef1c11b577a9029995ac05fa36747c0d227d1
/src/main/java/com/slabs/insight/repository/EmployeeRepository.java
05564c58c783dd04b631d26dff79382fb6b7a5d0
[]
no_license
sunieldalal/insightapp
94bb498c2b8044ef7ace365a154de9a34a48ab96
d85753fa18410d25df0ff18e5abe19dec3b0214e
refs/heads/master
2020-04-06T06:04:34.852571
2017-07-19T05:56:42
2017-07-19T05:56:42
73,662,291
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package com.slabs.insight.repository; import java.util.List; import com.slabs.insight.domain.Employee; public interface EmployeeRepository { Employee createEmployee(Employee Employee); Employee getEmployeeById(Long IdPersonId); List<Employee> getAllEmployees(); Employee updateEmployee(Employee Employee); boolean deleteEmployeeById(Long IdPersonId); }
ef323bce5cbe249a08f8aff4ee85ca0ea53526fc
9be0fb0644ee8088b21942155a826bb03aa6f212
/manager/src/main/java/com/hmxy/manager/service/shareMeet/impl/SharerMeettingServiceImpl.java
6076c4ed2f8cb6ec44902092b2cea87252e601da
[]
no_license
youzizzz/hmxy-manager
03600210c741046b4c41f55942498f9ab05bfc5d
e856aa213ea8469f266715f79420a786cd509d09
refs/heads/master
2020-04-04T16:17:51.268223
2018-11-16T08:45:51
2018-11-16T08:45:51
156,072,090
0
0
null
null
null
null
UTF-8
Java
false
false
2,245
java
package com.hmxy.manager.service.shareMeet.impl; import com.hmxy.dto.SharerMeettingDTO; import com.hmxy.http.HttpStatusEnum; import com.hmxy.http.Response; import com.hmxy.manager.dao.shareMeet.SysSharerMeettingDao; import com.hmxy.manager.service.shareMeet.SharerMeettingService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @discripeion: * @author: liangj * @date: 2018/11/13 17:26 */ @Service public class SharerMeettingServiceImpl implements SharerMeettingService { @Autowired private SysSharerMeettingDao sysSharerMeettingDao; @Override public Response<String> sharerMeettingAdd(SharerMeettingDTO sharerMeettingDTO) { Map<String,Object> map = new HashMap<String,Object>(); if (StringUtils.isNotBlank(sharerMeettingDTO.getSharerId())){ map.put("sharerId",sharerMeettingDTO.getSharerId()); } else { return new Response<String>().setStatusCode(HttpStatusEnum.error.getCode()).setMessage("分享者不能为空"); } if (StringUtils.isNotBlank(sharerMeettingDTO.getMettingId())){ map.put("mettingId",sharerMeettingDTO.getMettingId()); } else { return new Response<String>().setStatusCode(HttpStatusEnum.error.getCode()).setMessage("分享会不能为空"); } List<SharerMeettingDTO> list = new ArrayList<SharerMeettingDTO>(); list = sysSharerMeettingDao.getSharerMeettingList(map); if(null!=list&&list.size()>0){ return new Response<String>().setStatusCode(HttpStatusEnum.error.getCode()).setMessage("已经用此分享者"); } int count = 0; count = sysSharerMeettingDao.sharerMeettingAdd(sharerMeettingDTO); if(count<1){ return new Response<String>().setStatusCode(HttpStatusEnum.error.getCode()).setMessage("新增分享者和分享会信息失败"); } return new Response<String>().setStatusCode(HttpStatusEnum.success.getCode()).setMessage("新增分享者和分享会信息成功"); } }
bd4708d0bf90596f8992e885562703b572cb990d
ed4990af4e69d4df49a69394afdc144610aabefc
/Flappy bird/src/ShadowFlap.java
3ef84362a6932a40b1e341885aec69d4a0759ec4
[]
no_license
naveenkr20/Flappy-Bird
e8cb7299dbaae33ca31dcc062872901984a8c0f5
3ba76237ceeb2a3afdef51a545ec9c79fa63ff27
refs/heads/main
2023-08-27T08:33:49.077521
2021-11-09T02:01:13
2021-11-09T02:01:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,989
java
import bagel.*; import bagel.util.Rectangle; import java.util.ArrayList; import java.util.Random; /** * Skeleton Code for SWEN20003 Project 2, Semester 2, 2021 * * Please filling your name below * @author YD :) */ public class ShadowFlap extends AbstractGame { //attributes private final Image BACKGROUND_IMAGE_LVL0 = new Image("res/level-0/background.png"); private final String INSTRUCTION_MSG = "PRESS SPACE TO START"; private final String GAME_OVER_MSG = "GAME OVER!"; private final String CONGRATS_MSG = "CONGRATULATIONS!"; private final String SCORE_MSG = "SCORE: "; private final String FINAL_SCORE_MSG = "FINAL SCORE: "; private final int FONT_SIZE = 48; private final Font FONT = new Font("res/font/slkscr.ttf", FONT_SIZE); private final int SCORE_MSG_OFFSET = 75; private final double Y_COORDINATE = 350; private Bird bird; private int score; private boolean gameOn; private boolean win; private final Image PLASTIC = new Image("res/level/plasticPipe.png"); private final Image STEEL = new Image("res/level-1/steelPipe.png"); private final Image ROCK = new Image("res/level-1/rock.png"); private final Image BOMB = new Image("res/level-1/bomb.png"); private boolean isLevelUp = false; private ArrayList<PipeSets> plasticPipeSets = new ArrayList<>(); // level 0 private ArrayList<PipeSets> pipeSets = new ArrayList<>();// level 1 private int timeScale = 1; private final int MAX_SCALE = 5; private final int MIN_SCALE = 1; private LifeBar lifebar; private final int LEVEL_1_LIFE = 6; private boolean flameCollision = false; private int frameCount = 0; private final double SWITCH_FRAME = 100; private final double LEVEL_UP_FRAME = 150; private final double LEVEL_UP_SCORE = 10; private final double WIN_SCORE = 30; private final double SCORE_POSITION = 100; private final String LEVEL_UP = "LEVEL-UP!"; private boolean levelUp = false; private int levelUpCount = 100; private final Image LEVEL1_BACKGROUND = new Image("res/level-1/background.png"); private final double GENERATE_WEAPON = 200; private ArrayList<Weapon> weapons = new ArrayList<>(); private final double THE_SCALE = 1.5; /** * The constructor of ShadowFlap */ //constructor for the ShadowFlap public ShadowFlap() { super(1024, 768, "ShadowFlap"); bird = new Bird(); lifebar = new LifeBar(); // score = 0; gameOn = false; win = false; } /** * The main method * @param args the inputs */ public static void main(String[] args) { ShadowFlap game = new ShadowFlap(); game.run(); } /** * Performs a state update. * allows the game to exit when the escape key is pressed. * @param input input of pressing keys */ @Override public void update(Input input) { // render game background based on the level if (!isLevelUp) { BACKGROUND_IMAGE_LVL0 .draw(Window.getWidth()/2, Window.getHeight()/2); } else {LEVEL1_BACKGROUND .draw(Window.getWidth()/2, Window.getHeight()/2);} if (input.wasPressed(Keys.ESCAPE)) {Window.close();} // before the game start if (!gameOn) { renderInstructionScreen(input); } // when the bird has no life, game over if ((lifebar.getLife()) == 0) { renderGameOverScreen(); } // if bird goes out of the bound, // reset the bird position and lose one life if (birdOutOfBound()) { if ((lifebar.getLife()) > 0) { lifebar.setLife(lifebar.getLife()-1); bird.setY(Y_COORDINATE); } } // render win screen if win condition detected if(win) { renderWinScreen(); } // when game is ongoing if (gameOn && !(lifebar.getLife() == 0) && !win) { // game at level 0 stage if (!levelUp) { updateScale(input); // add plastic pipes if (frameCount % (int)(SWITCH_FRAME/Math.pow(THE_SCALE, timeScale-1)) == 0) { plasticPipeSets .add(new PlasticPipeSet(PLASTIC, isLevelUp)); } frameCount ++; //update bird, pipes and life information bird.update(input); Rectangle birdBox = bird.getBox(); updatePipeSets(plasticPipeSets, birdBox); lifebar.renderLifeBar(); } // game at level 1 stage if (isLevelUp) { updateScale(input); // add random pipes if (frameCount % (int) (SWITCH_FRAME/Math.pow(THE_SCALE, timeScale-1)) == 0) { randomAddPipe(); } // generate random weapons if (frameCount % (int) (GENERATE_WEAPON/Math.pow(THE_SCALE, timeScale-1)) == 0) { randomAddWeapon(); } frameCount += 1; //update bird, pipes, weapons and life information bird.update(input); Rectangle birdBox = bird.getBox(); updateWeapons(birdBox, input); updatePipeSets(pipeSets, birdBox); lifebar.renderLifeBar(); } } // render level up screen between level 0 game and level 1 game if (levelUp && !isLevelUp) { renderLevelUpScreen(); levelUpCount ++; if (levelUpCount == LEVEL_UP_FRAME) { resetGame(); } } } //methods /** * Method to add new pipes randomly */ public void randomAddPipe() { Random random = new Random(); if (random.nextBoolean()) { pipeSets.add(new SteelPipeSet(STEEL, isLevelUp)); } else { pipeSets.add(new PlasticPipeSet(PLASTIC, isLevelUp)); } } /** * Method to add new weapons randomly */ public void randomAddWeapon() { Random random = new Random(); if (random.nextBoolean()) { weapons.add(new Rock(ROCK)); } else { weapons.add(new Bomb(BOMB)); } } /** * Method to update the timescale * * @param input the input of pressing keys */ public void updateScale(Input input) { if ((input.wasPressed(Keys.L)) && (timeScale < MAX_SCALE)){ timeScale += 1; } if ((input.wasPressed(Keys.K)) && (timeScale > MIN_SCALE)){ timeScale -= 1; } } /** * This method is used to update pipes and bird's life information * * @param pipeSets the arraylist of pipeSets * @param birdBox bird as a rectangle */ // based on birds and pipes, update conditions of birds, // pipes and bird's life public void updatePipeSets(ArrayList<PipeSets> pipeSets, Rectangle birdBox) { // for all pipes, if the pipe collides with the bird, // update pipe and life information for (PipeSets pipeSet : pipeSets) { pipeSet.update(timeScale); Rectangle topPipeBox = pipeSet.getTopBox(); Rectangle bottomPipeBox = pipeSet.getBottomBox(); boolean pipeCollision = detectCollision(birdBox, topPipeBox, bottomPipeBox); // only if they collide and they are valid for collision if (pipeCollision && !pipeSet.getIsCollide()) { lifebar.setLife(lifebar.getLife() - 1); pipeSet.setIsCollide(true); pipeSet.setIsPass(true); } //update score updateScore(pipeSet); // when the pipes are steel, // if the pipe flame collides with the bird, // update the pipe and life information if (pipeSet.getPIPE_IMAGE().equals(STEEL)) { SteelPipeSet steelPipe = (SteelPipeSet) pipeSet; Rectangle topFlameBox = steelPipe.getTopFlame(); Rectangle bottomFlameBox = steelPipe.getBottomFlame(); if (steelPipe.getFrameCount() % 20 == 0) { flameCollision = detectCollision (birdBox, topFlameBox, bottomFlameBox); // only if they collide and they are valid for collision // if (flameCollision) { } // if (flameCollision && !steelPipe.isCollideWithFlame() && !steelPipe.getIsCollide()) { lifebar.setLife(lifebar.getLife() - 1); steelPipe.setCollideWithFlame(true); steelPipe.setIsCollide(true); steelPipe.setIsPass(true); } } } //update score //updateScore(pipeSet); } } /** * This method update score of the game * @param pipeSet the pipes */ //update score for the game public void updateScore(PipeSets pipeSet) { // when the bird passes the pipe and the pipe // hasn't been passed yet, add one score if ((bird.getX() > pipeSet.getTopBox().right()) && (!pipeSet.getIsPass())) { score += 1; pipeSet.setIsPass(true); } // show score on screen String scoreMSG = SCORE_MSG + score; FONT.drawString(scoreMSG,SCORE_POSITION, SCORE_POSITION); // level up if (score == LEVEL_UP_SCORE && !isLevelUp) { levelUp = true; } // win if (score == WIN_SCORE) { win = true; } } /** * This method reset the game when the game levels up */ public void resetGame() { isLevelUp = true; gameOn = false; bird.setLevelUp(true); timeScale = 1; lifebar.setMaxLife(LEVEL_1_LIFE); lifebar.setLife(LEVEL_1_LIFE); score = 0; frameCount = 0; bird.setY(Y_COORDINATE); } /** * This method render level up screen */ //render level up screen at the centre public void renderLevelUpScreen() { FONT.drawString(LEVEL_UP, (Window.getWidth()/2.0-(FONT.getWidth(LEVEL_UP)/2.0)), (Window.getHeight()/2.0-(FONT_SIZE/2.0))); } /** * This method update weapons's relations with the bird * @param birdBox the bird as a box * @param input input by pressing keys */ // update weapons' relations with the bird public void updateWeapons(Rectangle birdBox, Input input) { for(Weapon weapon: weapons) { weapon.update(input, bird, timeScale); Rectangle weaponBox = weapon.getBox(); if (birdBox.intersects(weaponBox) && !weapon.isPickedUp()) { if(!bird.isHoldWeapon()) { bird.setHoldWeapon(true); weapon.setPickedUp(true); } } checkWeaponPipeCollision(weapon); } } /** * This method chech if the weapon hit the pipe * @param weapon weapon */ // check if the weapon hit pipes and update their corresponding information public void checkWeaponPipeCollision(Weapon weapon) { Rectangle weaponBox = weapon.getBox(); // check actions between weapons and pipes for(PipeSets pipe: pipeSets) { Rectangle topPipeBox = pipe.getTopBox(); Rectangle bottomPipeBox = pipe.getBottomBox(); // when the weapon is valid if (!weapon.isDisappear() && weapon.isShoot()) { boolean weaponCollision = detectCollision(weaponBox, topPipeBox, bottomPipeBox); // when a rock hit plastic pipes, // the rock and pipes disappear and add score if (weapon.getWEAPON_IMAGE().equals(ROCK) && pipe.getPIPE_IMAGE().equals(PLASTIC) && weaponCollision) { weapon.setDisappear(true); pipe.setIsCollide(true); pipe.setIsPass(true); score += 1; } // when a rock hit steel pipes, the rock disappears if (weapon.getWEAPON_IMAGE().equals(ROCK) && pipe.getPIPE_IMAGE().equals(STEEL) && weaponCollision) { weapon.setDisappear(true); } //when a bomb hit any pipes, //the bomb and pipes disappear and add score if (weapon.getWEAPON_IMAGE().equals(BOMB) && weaponCollision) { weapon.setDisappear(true); pipe.setIsCollide(true); pipe.setIsPass(true); score += 1; } } } } // below methods were written by Betty, from project-1 solution /** * This method detect if the bird is out of bound * @return boolean This return if the bird is out of bound or not */ // detect if the bird is out of bound public boolean birdOutOfBound() { return (bird.getY() > Window.getHeight()) || (bird.getY() < 0); } /** * This method draw the instruction screen * @param input input of pressing keys */ // render instruction screen public void renderInstructionScreen(Input input) { // paint the instruction on screen FONT.drawString(INSTRUCTION_MSG, (Window.getWidth()/2.0-(FONT.getWidth(INSTRUCTION_MSG)/2.0)), (Window.getHeight()/2.0-(FONT_SIZE/2.0))); if (input.wasPressed(Keys.SPACE)) { gameOn = true; } } /** * This method draw the game over screen */ // render game over screen public void renderGameOverScreen() { FONT.drawString(GAME_OVER_MSG, (Window.getWidth()/2.0-(FONT.getWidth(GAME_OVER_MSG)/2.0)), (Window.getHeight()/2.0-(FONT_SIZE/2.0))); String finalScoreMsg = FINAL_SCORE_MSG + score; FONT.drawString(finalScoreMsg, (Window.getWidth()/2.0-(FONT.getWidth(finalScoreMsg)/2.0)), (Window.getHeight()/2.0-(FONT_SIZE/2.0))+SCORE_MSG_OFFSET); } /** * This method draw the win screen */ // render win screen public void renderWinScreen() { FONT.drawString(CONGRATS_MSG, (Window.getWidth()/2.0-(FONT.getWidth(CONGRATS_MSG)/2.0)), (Window.getHeight()/2.0-(FONT_SIZE/2.0))); String finalScoreMsg = FINAL_SCORE_MSG + score; FONT.drawString(finalScoreMsg, (Window.getWidth()/2.0-(FONT.getWidth(finalScoreMsg)/2.0)), (Window.getHeight()/2.0-(FONT_SIZE/2.0))+SCORE_MSG_OFFSET); } /** * this method check if a object collides with other two objects * @param theBox the object * @param object1 one of the other two object * @param object2 one of the other two object * @return bollean This returns if the object * have collision with the other two objects */ // detect if one object collides with other two objects public boolean detectCollision(Rectangle theBox, Rectangle object1, Rectangle object2) { // check for collision return theBox.intersects(object1) || theBox.intersects(object2); } }
35bbbe801cf3b0aea2054b9516cc7b270c0666a5
eb545aabffbbd6f1a4aa9b44f82e2b9bf877b72d
/src/com/ym/iadpush/manage/services/tissue/IMenuMgr.java
44c7e3af582df2818538ac5f0a9f260055d3edbc
[]
no_license
wangshuodong/lj_estate_manage
b0f005687667ee52c2dbfe2fb883fab91516b475
d6578662f9845f7c507709d59af0d543cc1dd3eb
refs/heads/master
2021-07-23T23:45:00.780154
2017-11-05T13:57:44
2017-11-05T13:57:44
105,353,557
1
0
null
null
null
null
UTF-8
Java
false
false
616
java
package com.ym.iadpush.manage.services.tissue; import java.util.List; import java.util.Map; import com.ym.iadpush.manage.entity.SysMenus; public interface IMenuMgr { public List<SysMenus> getAllMenus(Map<String, Object> paramsMap); public int updateMenu(SysMenus menu); public int insertMenu(SysMenus menu); public int deleteMenu(int menuId); public List<Map<String,String>> getParentMenus(); public SysMenus selectByPrimaryKey(Integer menuId); public int selectTotalRecord(Map<String, Object> paramsMap); public int countByMenuName(String menuName); }
c2118fa2cb81608bfc2a41efcce3f1d9bd07a730
578282fda3816b99896672483bdb1741bbe4944c
/pmalek_project/src/main/java/com/project/pmalek_project/repository/model/BookOrder.java
d24cc3e1124d8cd706e26f56903ab2d3a4956293
[]
no_license
Pawelkrs90/UMCS_DB_SPRING_PROJEKT1
811b3e44dbca5e8ead9dd28077aecd868a9e0a8e
99b34ffa59a8094cc7ded9896905defbe7b8a35e
refs/heads/master
2021-04-15T04:09:35.789091
2018-03-21T15:48:41
2018-03-21T15:48:41
126,164,228
0
0
null
null
null
null
UTF-8
Java
false
false
1,755
java
package com.project.pmalek_project.repository.model; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import lombok.ToString; import java.sql.Date; import java.sql.ResultSet; import java.sql.SQLException; import java.time.LocalDate; //@Getter //@Setter //@NoArgsConstructor //@AllArgsConstructor @ToString public class BookOrder { private Long id; private Long bookId; private Long userId; private LocalDate bookingDate; private String type; public interface Type{ public static final String RENT = "R"; public static final String BUY = "B"; public static final String DESTROY = "D"; } public BookOrder() { } public BookOrder(Long id, Long bookId, Long userId, LocalDate bookingDate, String type) { this.id = id; this.bookId = bookId; this.userId = userId; this.bookingDate = bookingDate; this.type = type; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getBookId() { return bookId; } public void setBookId(Long bookId) { this.bookId = bookId; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public LocalDate getBookingDate() { return bookingDate; } public void setBookingDate(LocalDate bookingDate) { this.bookingDate = bookingDate; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
385b19c182c1f25e3396e4fef38667703bbe5896
3bc62f2a6d32df436e99507fa315938bc16652b1
/web/jslint/src/main/java/com/intellij/lang/javascript/linter/jslint/JSLintConfigurable.java
65978b49ca715487ae6e221013e218a51d8c51eb
[ "Apache-2.0" ]
permissive
JetBrains/intellij-obsolete-plugins
7abf3f10603e7fe42b9982b49171de839870e535
3e388a1f9ae5195dc538df0d3008841c61f11aef
refs/heads/master
2023-09-04T05:22:46.470136
2023-06-11T16:42:37
2023-06-11T16:42:37
184,035,533
19
29
Apache-2.0
2023-07-30T14:23:05
2019-04-29T08:54:54
Java
UTF-8
Java
false
false
899
java
package com.intellij.lang.javascript.linter.jslint; import com.intellij.lang.javascript.linter.JSLinterBaseView; import com.intellij.lang.javascript.linter.JSLinterConfigurable; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; /** * @author Sergey Simonchik */ public class JSLintConfigurable extends JSLinterConfigurable<JSLintState> { public JSLintConfigurable(@NotNull Project project) { super(project, JSLintConfiguration.class, false); } @Nls @Override public String getDisplayName() { return JSLintBundle.message("settings.javascript.linters.jslint.configurable.name"); } @NotNull @Override public String getId() { return "Settings.JavaScript.Linters.JSLint"; } @NotNull @Override protected JSLinterBaseView<JSLintState> createView() { return new JSLintView(); } }
08e659cc4754871563181aa2c63825f032038126
81a392df9154206216bf954a8650240428123e0c
/src/main/java/fr/ippon/contest/puissance4/checker/VerticalChecker.java
2dc08e36137158f3ec4836d43dd1d6bae10e1373
[]
no_license
jlamby/finna-be-wallhack
5fceff1dbca32bc7c95d17baff9f8b2441fd0f11
b1b4688437afdd9755848e36fa7ed8d138ff9581
refs/heads/master
2016-09-06T09:29:46.305377
2015-03-25T15:00:00
2015-03-25T15:00:00
32,525,035
1
0
null
null
null
null
UTF-8
Java
false
false
673
java
package fr.ippon.contest.puissance4.checker; import java.util.ArrayList; import java.util.List; import fr.ippon.contest.puissance4.GameConstants; import fr.ippon.contest.puissance4.Puissance4; /** * @author jlamby * */ public class VerticalChecker extends BaseChecker { public VerticalChecker(Puissance4 game) { super(game); } @Override public boolean check(int startLine, int startRow) { List<Character> slice = new ArrayList<>(); for (int lineIndex = 0; lineIndex < GameConstants.MAX_LINES; lineIndex++) { slice.add(game.getOccupant(lineIndex, startRow)); } return checkSlice(slice); } }
9f2f44a5f74de27ea8cb62816c4f1adef1361f13
2b18d962352d1adf2f1ee0f1e7e02492b77f6f52
/src/main/java/com/caozhihu/tmall/service/UserService.java
26c5307ec59c10270caf748bba24c66251c39e98
[]
no_license
jmfnku/Tmall_SSM
1f7f26d79ed512e5fffd5a05a56878bb8ee96739
773fec9b1e69556252b9fe82ed4f5e38a0c3e285
refs/heads/master
2020-12-31T23:24:21.721346
2020-02-15T12:20:47
2020-02-15T12:20:47
239,074,667
0
1
null
2020-02-08T05:26:40
2020-02-08T05:26:39
null
UTF-8
Java
false
false
247
java
package com.caozhihu.tmall.service; import com.caozhihu.tmall.pojo.User; import java.util.List; public interface UserService { void add(User c); void delete(int id); void update(User u); User get(int id); List list(); }
8937e4ecfbd7279bf4a4e4fbe086acc31e2f3cab
88b9ac0589e8f20a8889df43e050308553b6dd0c
/app/src/main/java/com/funlisten/service/net/ZYOkHttpNetManager.java
58328b339b8401dfd02e01370e0b2141ed8a79bf
[]
no_license
zhouyongyang122/funListening
2efda77e40ea38ae4ba073b06bf987bd288a3c2b
1521174eba0ee9991c3d766a17d143f90c709ab8
refs/heads/master
2021-01-01T04:08:49.491994
2017-11-02T03:55:23
2017-11-02T03:55:23
97,130,090
0
1
null
null
null
null
UTF-8
Java
false
false
4,606
java
package com.funlisten.service.net; import android.text.TextUtils; import com.funlisten.utils.ZYLog; import com.google.gson.Gson; import java.io.IOException; import java.util.Map; import java.util.concurrent.TimeUnit; import okhttp3.Call; import okhttp3.Callback; import okhttp3.FormBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; /** * Created by ZY on 17/4/13. */ public class ZYOkHttpNetManager { private static ZYOkHttpNetManager instance; private OkHttpClient mOkHttpClient; private boolean isCancle; private ZYOkHttpNetManager() { mOkHttpClient = new OkHttpClient.Builder() .connectTimeout(3000, TimeUnit.MILLISECONDS) .build(); } public static ZYOkHttpNetManager getInstance() { if (instance == null) { instance = new ZYOkHttpNetManager(); } return instance; } public void reset() { isCancle = false; } public void requestGet(final Class classBean, String url, final OkHttpNetListener listener) { if (TextUtils.isEmpty(url) || listener == null) { return; } try { final Request request = new Request.Builder() .url(url) .get() .build(); Call call = mOkHttpClient.newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { ZYLog.e(ZYOkHttpNetManager.class.getSimpleName(), "onFailure: " + e.getMessage()); if (listener != null && !isCancle) { listener.onFailure("网络异常,请重新尝试"); } } @Override public void onResponse(Call call, Response response) throws IOException { if (listener != null && !isCancle) { try { listener.onSuccess(new Gson().fromJson(response.body().toString(), classBean)); } catch (Exception e) { ZYLog.e(ZYOkHttpNetManager.class.getSimpleName(), "onResponse-error: " + e.getMessage()); listener.onFailure("网络异常,请重新尝试"); } } } }); } catch (Exception e) { } } public void requestPost(final Class classBean, String url, Map<String, String> params, final OkHttpNetListener listener) { if (TextUtils.isEmpty(url) || listener == null) { return; } try { FormBody.Builder bodyBuilder = new FormBody.Builder(); for (Map.Entry<String, String> entry : params.entrySet()) { if (entry.getValue() != null) { bodyBuilder.add(entry.getKey(), entry.getValue()); } } Request request = new Request.Builder() .url(url) .post(bodyBuilder.build()) .build(); Call call = mOkHttpClient.newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { ZYLog.e(ZYOkHttpNetManager.class.getSimpleName(), "onFailure: " + e.getMessage()); if (listener != null && !isCancle) { listener.onFailure("网络异常,请重新尝试"); } } @Override public void onResponse(Call call, Response response) throws IOException { if (listener != null && !isCancle) { try { String result = response.body().string(); listener.onSuccess(new Gson().fromJson(result, classBean)); } catch (Exception e) { ZYLog.e(ZYOkHttpNetManager.class.getSimpleName(), "onResponse-error: " + e.getMessage()); listener.onFailure("网络异常,请重新尝试"); } } } }); } catch (Exception e) { } } public void cancle() { isCancle = true; mOkHttpClient.dispatcher().cancelAll(); } public interface OkHttpNetListener<T> { void onFailure(String message); void onSuccess(T response); } }
b9141d0ada8341f441c15f3c5a5e69e993389de5
08093efebfe14bd0dccde51ad1f32378ba66edb7
/proyecto1/BarnesNobleDB.java
4a87589499760aa25f08b26e45fb8fbe7f299972
[]
no_license
Davidgarciacornejo01/sistemas-basados-conocimiento-DavidGarcia
414de0384f722a15feff570dc85ccd7c756e1655
debfdae884a4ba8537332b3b48efb1bbddd77c94
refs/heads/main
2023-06-11T20:56:01.855778
2021-06-20T03:29:32
2021-06-20T03:29:32
368,671,875
0
0
null
null
null
null
UTF-8
Java
false
false
7,588
java
package examples.proyecto1; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.*; public class BarnesNobleDB { // Librería de MySQL public String driver = "com.mysql.jdbc.Driver"; // Nombre de la base de datos public String database = "barnes_noble"; // Host public String hostname = "localhost"; // Puerto public String port = "3306"; // Ruta de nuestra base de datos (desactivamos el uso de SSL con "?useSSL=false") public String url = "jdbc:mysql://" + hostname + ":" + port + "/" + database + "?useSSL=false"; // Nombre de usuario public String username = "root"; // Clave de usuario public String password = ""; public Connection conexion = null; public BarnesNobleDB(){ conectarMySQL(); } public Connection conectarMySQL() { try { Class.forName(driver); conexion = DriverManager.getConnection(url, username, password); statement = conexion.createStatement(); //System.out.println("conectado"); } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); System.out.println("no se conecto"); } return conexion; } Statement statement; public void setProductos(String nombre, String tipo, String precio,String elementosDisponibles) { try { statement.executeUpdate("insert into productos(nombre,tipo,precio,elementos_disponibles) values('"+nombre+"','"+tipo+"',"+precio+","+elementosDisponibles+")"); System.out.println("insertado"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String getProdutos() { PreparedStatement preparedStatement; ResultSet resultSet; String sql="select * from productos"; String cadena=""; try { preparedStatement=conexion.prepareStatement(sql); resultSet=preparedStatement.executeQuery(); //Object[][] object=new Object[100][5]; //int contador=0; while(resultSet.next()) { /* System.out.println( "nombre: "+resultSet.getObject(1)+" tipo: "+ resultSet.getObject(2)+" precio: "+ resultSet.getObject(3)+" elementos disponibles: "+ resultSet.getObject(4));*/ cadena=cadena +":"+ resultSet.getObject(1) +","+ resultSet.getObject(2) +","+ resultSet.getObject(3) +","+ resultSet.getObject(4)+","+resultSet.getObject(5); //Administrador administrador=new Administrador(); //administrador.pasarDatos(object); } return cadena; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public void updateProductos(int elementos_disponibles,String id, String tipo) { try { statement.executeUpdate("update productos set elementos_disponibles="+elementos_disponibles+" where id_productos="+id+" and tipo='"+tipo+"'"); System.out.println("actualizado"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String[] buscarProducto(String nombre) { PreparedStatement preparedStatement; ResultSet resultSet; String sql="select * from productos where nombre='"+nombre+"'"; String[] array=new String[5]; try { preparedStatement=conexion.prepareStatement(sql); resultSet=preparedStatement.executeQuery(); while(resultSet.next()) { /* System.out.println( "id: "+resultSet.getObject(1)+" nombre: "+resultSet.getObject(2)+" tipo: "+ resultSet.getObject(3)+" precio: "+ resultSet.getObject(4)+" elementos disponibles: "+ resultSet.getObject(5));*/ array[0]=new String(); array[0] = resultSet.getObject(1).toString(); array[1]=new String(); array[1] = resultSet.getObject(2).toString(); array[2]=new String(); array[2] = resultSet.getObject(3).toString(); array[3]=new String(); array[3] = resultSet.getObject(4).toString(); array[4]=new String(); array[4] = resultSet.getObject(5).toString(); } return array; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public int dameContador(){ return contadorObjetos; } public void fijamosContador(int contador){ contadorObjetos=contador; } int contadorObjetos=0; public String[][] dameProductos(){ PreparedStatement preparedStatement; ResultSet resultSet; String sql="select * from productos"; String[][] matriz=new String[300][5]; int contador=0; try { preparedStatement=conexion.prepareStatement(sql); resultSet=preparedStatement.executeQuery(); while(resultSet.next()) { /* System.out.println( "id: "+resultSet.getObject(1)+" nombre: "+resultSet.getObject(2)+" tipo: "+ resultSet.getObject(3)+" precio: "+ resultSet.getObject(4)+" elementos disponibles: "+ resultSet.getObject(5));*/ matriz[contador][0]=new String(); matriz[contador][0] = resultSet.getObject(1).toString(); matriz[contador][1]=new String(); matriz[contador][1] = resultSet.getObject(2).toString(); matriz[contador][2]=new String(); matriz[contador][2] = resultSet.getObject(3).toString(); matriz[contador][3]=new String(); matriz[contador][3] = resultSet.getObject(4).toString(); matriz[contador][4]=new String(); matriz[contador++][4] = resultSet.getObject(5).toString(); } fijamosContador(contador); return matriz; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public void mostrarLista(){ PreparedStatement preparedStatement; ResultSet resultSet; String sql="select * from productos"; try { preparedStatement=conexion.prepareStatement(sql); resultSet=preparedStatement.executeQuery(); while(resultSet.next()) { System.out.println( "id: "+resultSet.getObject(1)+" nombre: "+resultSet.getObject(2)+" tipo: "+ resultSet.getObject(3)+" precio: "+ resultSet.getObject(4)+" elementos disponibles: "+ resultSet.getObject(5)); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
b1f59cc71b4fd04f0322d0d8698cfe0ced7ec0bd
ff9e7ded0a566940aa7fab4f528d50b97cf84e66
/app/src/main/java/bj/vinylbrowser/utils/UtilsModule.java
2071055a3beacda17c3132835d34f64a2ff2d453
[ "MIT" ]
permissive
jbmlaird/DiscogsBrowser
e840a4b89de636d8f9b0ac875e7cc3a6f119fe79
23facb4e1ab156508e934ebc1fcd1d57b3255aba
refs/heads/master
2021-01-19T21:16:16.373854
2018-04-12T21:23:49
2018-04-12T21:23:49
82,479,889
24
2
null
2017-05-22T10:57:25
2017-02-19T18:25:27
Java
UTF-8
Java
false
false
875
java
package bj.vinylbrowser.utils; import bj.vinylbrowser.wrappers.DateUtilsWrapper; import bj.vinylbrowser.wrappers.SimpleDateFormatWrapper; import dagger.Module; import dagger.Provides; /** * Created by Josh Laird on 14/05/2017. */ @Module public class UtilsModule { @Provides protected ImageViewAnimator provideImageViewAnimator() { return new ImageViewAnimator(); } @Provides protected ArtistsBeautifier provideArtistsBeautifier() { return new ArtistsBeautifier(); } @Provides protected DiscogsScraper provideDiscogsScraper() { return new DiscogsScraper(); } @Provides protected DateFormatter provideDateFormatter(DateUtilsWrapper dateUtilsWrapper, SimpleDateFormatWrapper simpleDateFormatWrapper) { return new DateFormatter(dateUtilsWrapper, simpleDateFormatWrapper); } }
3eb898c029b0ee4bc1fd70d68d4a3fd9acdf98cb
c18ca0ee85f21ef5e9890db9bb70ab8bb114200a
/JAVA Prgramming/cam3/src/de/must/wuic/Inlay.java
cb6bbc89f127eed3bcac3f2abede7e81b6e08faa
[]
no_license
f1lm/MS-2014-Boise-State-University
a3032b8b9e13303cdb3b4cb0001eddfd0d1cbffe
9d87f14e48a5c51a8a3ebfb0e010a493faf70576
refs/heads/master
2020-04-15T15:17:48.031552
2015-03-18T01:37:30
2015-03-18T01:37:30
32,502,472
1
1
null
2015-03-19T05:19:57
2015-03-19T05:19:56
null
UTF-8
Java
false
false
3,445
java
/* * Copyright (c) 2004 Christoph Mueller. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY CHRISTOPH MUELLER ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CHRISTOPH MUELLER OR * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ package de.must.wuic; import java.awt.event.ActionListener; import javax.swing.JPanel; /** * Super class for all GUI sectors to be placed into ContainerFrames * @author Christoph Mueller */ public abstract class Inlay extends JPanel implements ActionListener { protected ContainerFrame ownerFrame; private String helpTopic; private String helpTarget; public Inlay(ContainerFrame ownerFrame) { this.ownerFrame = ownerFrame; } /** * Sets the component's context help. * @param helpTopic the context help's topic * @param helpTarget the context help's target */ public void setHelpContext(String helpTopic) { this.helpTopic = helpTopic; } /** * Sets the component's context help. * @param helpTopic the context help's topic * @param helpTarget the context help's target */ public void setHelpContext(String helpTopic, String helpTarget) { this.helpTopic = helpTopic; this.helpTarget = helpTarget; } /** * Returns the topic of the component's help context * @return the topic of the component's help context */ public String getHelpTopic() { return helpTopic; } /** * Returns the target of the component's help context * @return the target of the component's help context */ public String getHelpTarget() { return helpTarget; } /** * Returns a text in the corresponding language according to the locale * specific resource bundle of the package. * @param resourceKey the key of the resource to retrieve * @return the resource */ protected String getTranslation(String resourceKey) { return ownerFrame.getTranslation(resourceKey); } /** * Sets the message to be read by the user, which is presented in the status * label in this context. * @param message the message for the user */ protected void setMessage(String message) { ownerFrame.setMessage(message); } /** * Sets the message to be read by the user, it is not reseted by * generalActionEnding when action completed. Thus, the user is able to notify * the message without pressing a confirmation button. * @param messageToKeep the message for the user */ protected void setMessageToKeep(String messageToKeep) { ownerFrame.setMessageToKeep(messageToKeep); } }
0436f6b5257b23d49ac529aa490b42c7586260f3
a66d5eb37789895ac8c5bd247c0b7d02387b5ffe
/restli-client-testutils/src/test/java/com/linkedin/restli/client/testutils/test/TestMockResponseBuilder.java
3ab2bb19b067db83b6140a46799865b75dd6b16c
[ "Apache-2.0" ]
permissive
pdeloulay/rest.li
a4c01aca74d0a4d828c92accf83642d904260ff5
14da8444a00bd1bc6dffa6e20a072a9a5bd59448
refs/heads/master
2021-01-14T18:40:43.642717
2014-04-25T23:04:53
2014-04-25T23:04:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,788
java
/* Copyright (c) 2014 LinkedIn Corp. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.linkedin.restli.client.testutils.test; import com.linkedin.restli.client.Response; import com.linkedin.restli.client.RestLiResponseException; import com.linkedin.restli.client.testutils.MockResponseBuilder; import com.linkedin.restli.common.RestConstants; import com.linkedin.restli.examples.greetings.api.Greeting; import com.linkedin.restli.internal.common.AllProtocolVersions; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.easymock.EasyMock; import org.testng.Assert; import org.testng.annotations.Test; /** * @author kparikh */ public class TestMockResponseBuilder { @Test public void testBuild() { MockResponseBuilder<Greeting> mockResponseBuilder = new MockResponseBuilder<Greeting>(); Greeting greeting = new Greeting().setId(1L).setMessage("message"); Map<String, String> headers = Collections.singletonMap("foo", "bar"); RestLiResponseException restLiResponseException = EasyMock.createMock(RestLiResponseException.class); EasyMock.expect(restLiResponseException.getErrorSource()).andReturn("foo").once(); EasyMock.replay(restLiResponseException); // build a response object using all the setters. This response does not make sense logically but the goal here // is to test that the builder is working correctly. mockResponseBuilder .setEntity(greeting) .setHeaders(headers) .setId("1") .setStatus(200) .setRestLiResponseException(restLiResponseException); Response<Greeting> response = mockResponseBuilder.build(); // when we build the Response the ID is put into the headers Map<String, String> builtHeaders = new HashMap<String, String>(headers); builtHeaders.put(RestConstants.HEADER_ID, "1"); builtHeaders.put(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION, AllProtocolVersions.BASELINE_PROTOCOL_VERSION.toString()); Assert.assertEquals(response.getEntity(), greeting); Assert.assertEquals(response.getHeaders(), builtHeaders); Assert.assertEquals(response.getStatus(), 200); Assert.assertEquals(response.getId(), "1"); Assert.assertEquals(response.getError().getErrorSource(), "foo"); } }
17b971de6757e425bc3a1fefc74f42a0ac4a3695
bd338733a8cb5df8cd3cba62359eb57a4cce4307
/sp04-orderservice/src/main/java/com/example/sp04/Sp04OrderserviceApplication.java
ada5c4aed97fa1d24999ae69ccc911537797c282
[]
no_license
DregonTO/DREGON
f6d3433545da8b2e8a378d6fc5d89768827d8ce6
3ddd165e4e535eaf0144a14be61016593c5b7bce
refs/heads/master
2021-07-11T04:05:09.959196
2020-07-18T04:01:49
2020-07-18T04:01:49
174,089,204
0
0
null
2020-07-18T04:13:44
2019-03-06T06:55:08
Java
UTF-8
Java
false
false
780
java
package com.example.sp04; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.openfeign.EnableFeignClients; //@EnableCircuitBreaker //@EnableDiscoveryClient //@SpringBootApplication @SpringCloudApplication @EnableFeignClients public class Sp04OrderserviceApplication { public static void main(String[] args) { SpringApplication.run(Sp04OrderserviceApplication.class, args); } }
a630ae4b6e49b642da151f0691e86175b7953346
4d4cc1d1ddadcf1b416a9c3d9b69046e9d4b2f20
/src/com/sys/action/school/ClassRoomAction.java
90aabb8624559fcd17ebfb7cc07fc41ec48b69ba
[]
no_license
zfaster/schoolFriend
9ba36780f708e6ed11012ef226504b37e5a0d953
cf64a7f467178cd1eddb64adcb3300fa238db931
refs/heads/master
2021-01-18T22:20:55.814645
2017-04-03T07:09:19
2017-04-03T07:09:19
87,046,727
0
0
null
null
null
null
UTF-8
Java
false
false
1,790
java
package com.sys.action.school; import com.sys.bean.school.ClassRoom; import com.sys.bean.school.Student; import com.sys.service.base.DAO; import com.sys.web.action.BaseAction; import org.apache.commons.io.FileUtils; import org.apache.struts2.ServletActionContext; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import javax.annotation.Resource; import java.io.File; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.UUID; @Controller @Scope("prototype") public class ClassRoomAction extends BaseAction<ClassRoom> { private String actionPath = "control/school/classRoom"; private String roomName; @Override public String execute() throws Exception { LinkedHashMap<String, String> orderBy = new LinkedHashMap<String, String>(); orderBy.put("id", "desc"); StringBuffer whereSql = new StringBuffer(" 1 = 1 "); List<Object> params = new ArrayList<Object>(); if(roomName != null && !"".equals(roomName)){ whereSql.append("and o.name like ? "); params.add("%"+roomName+"%"); } pm = baseService.findScrollData( orderBy,whereSql.toString(),params.toArray()); setPageInfo(); return SUCCESS; } @Resource(name="classRoomService") public void setBaseService(DAO baseService) { this.baseService = baseService; } public String getActionPath() { return actionPath; } public void setActionPath(String actionPath) { this.actionPath = actionPath; } public String getRoomName() { return roomName; } public void setRoomName(String roomName) { try { this.roomName = new String(roomName.getBytes("iso8859-1"),"utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } }
df4328703f95c18a533821a0f53d1c60cbdc8272
169f4b4cb60dc918bf0d8b8db1a7efdf5d4ebc23
/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/QueryWatchesResponse.java
958efe3e652894e8b40472a93cb2684ece94ccbb
[ "Apache-2.0" ]
permissive
PyJava1984/elasticsearch-java
387d2212cc0784c06d1a8af0d284f4ee2b1cf9b4
5c7c24d9dd33de37e00ca183b32ec5cb17ea8b17
refs/heads/main
2023-08-28T17:35:38.220152
2021-10-18T19:21:23
2021-10-18T19:21:23
419,573,301
1
0
null
null
null
null
UTF-8
Java
false
false
5,460
java
/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. 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. */ //---------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- package co.elastic.clients.elasticsearch.watcher; import co.elastic.clients.json.DelegatingDeserializer; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; import co.elastic.clients.json.JsonpSerializable; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ModelTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.Integer; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; // typedef: watcher.query_watches.Response @JsonpDeserializable public final class QueryWatchesResponse implements JsonpSerializable { private final int count; private final List<QueryWatch> watches; // --------------------------------------------------------------------------------------------- public QueryWatchesResponse(Builder builder) { this.count = Objects.requireNonNull(builder.count, "count"); this.watches = ModelTypeHelper.unmodifiableNonNull(builder.watches, "watches"); } public QueryWatchesResponse(Function<Builder, Builder> fn) { this(fn.apply(new Builder())); } /** * Required - API name: {@code count} */ public int count() { return this.count; } /** * Required - API name: {@code watches} */ public List<QueryWatch> watches() { return this.watches; } /** * Serialize this object to JSON. */ public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); generator.writeEnd(); } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("count"); generator.write(this.count); generator.writeKey("watches"); generator.writeStartArray(); for (QueryWatch item0 : this.watches) { item0.serialize(generator, mapper); } generator.writeEnd(); } // --------------------------------------------------------------------------------------------- /** * Builder for {@link QueryWatchesResponse}. */ public static class Builder implements ObjectBuilder<QueryWatchesResponse> { private Integer count; private List<QueryWatch> watches; /** * Required - API name: {@code count} */ public Builder count(int value) { this.count = value; return this; } /** * Required - API name: {@code watches} */ public Builder watches(List<QueryWatch> value) { this.watches = value; return this; } /** * Required - API name: {@code watches} */ public Builder watches(QueryWatch... value) { this.watches = Arrays.asList(value); return this; } /** * Add a value to {@link #watches(List)}, creating the list if needed. */ public Builder addWatches(QueryWatch value) { if (this.watches == null) { this.watches = new ArrayList<>(); } this.watches.add(value); return this; } /** * Set {@link #watches(List)} to a singleton list. */ public Builder watches(Function<QueryWatch.Builder, ObjectBuilder<QueryWatch>> fn) { return this.watches(fn.apply(new QueryWatch.Builder()).build()); } /** * Add a value to {@link #watches(List)}, creating the list if needed. */ public Builder addWatches(Function<QueryWatch.Builder, ObjectBuilder<QueryWatch>> fn) { return this.addWatches(fn.apply(new QueryWatch.Builder()).build()); } /** * Builds a {@link QueryWatchesResponse}. * * @throws NullPointerException * if some of the required fields are null. */ public QueryWatchesResponse build() { return new QueryWatchesResponse(this); } } // --------------------------------------------------------------------------------------------- /** * Json deserializer for {@link QueryWatchesResponse} */ public static final JsonpDeserializer<QueryWatchesResponse> _DESERIALIZER = ObjectBuilderDeserializer .lazy(Builder::new, QueryWatchesResponse::setupQueryWatchesResponseDeserializer, Builder::build); protected static void setupQueryWatchesResponseDeserializer( DelegatingDeserializer<QueryWatchesResponse.Builder> op) { op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); op.add(Builder::watches, JsonpDeserializer.arrayDeserializer(QueryWatch._DESERIALIZER), "watches"); } }
f79f346cbb4fd2d3eddd83bc8c89112c5606defb
35abb8d8d40fe8ddf00931b106c10110cf66525c
/app/src/main/java/com/domain/apps/snapadeal/unbescape/json/JsonEscapeUtil.java
cd02ecd636bbb0eaf75867f6de40fb42143b4d0c
[]
no_license
tj4752/Snap_A_Deal
1cb01c087945256b0754a46db5f3b239e0ee75ed
259ec8fee8de98ab15687c34a70dfd79b341a0c4
refs/heads/master
2022-09-23T20:42:14.623867
2020-06-02T10:37:12
2020-06-02T10:37:12
268,166,866
0
0
null
null
null
null
UTF-8
Java
false
false
27,000
java
/* * ============================================================================= * * Copyright (c) 2014, The UNBESCAPE team (http://www.unbescape.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 com.domain.apps.snapadeal.unbescape.json; import java.io.IOException; import java.io.Writer; import java.util.Arrays; /** * <p> * Internal class in charge of performing the real escape/unescape operations. * </p> * * @author Daniel Fern&aacute;ndez * @since 1.0.0 */ final class JsonEscapeUtil { /* * JSON ESCAPE/UNESCAPE OPERATIONS * ------------------------------- * * See: http://www.ietf.org/rfc/rfc4627.txt * http://timelessrepo.com/json-isnt-a-javascript-subset * http://benalman.com/news/2010/03/theres-no-such-thing-as-a-json/ * * (Note that, in the following examples, and in order to avoid escape problems during the compilation * of this class, the backslash symbol is replaced by '%') * * - SINGLE ESCAPE CHARACTERS (SECs): * U+0008 -> %b * U+0009 -> %t * U+000A -> %n * U+000C -> %f * U+000D -> %r * U+0022 -> %" * U+005C -> %% * U+002F -> %/ [ONLY USED WHEN / APPEARS IN </, IN ORDER TO AVOID ISSUES INSIDE <script> TAGS] * - UNICODE ESCAPE [UHEXA] * Characters <= U+FFFF: %u???? * Characters > U+FFFF : %u????%u???? (surrogate character pair) * %u{?*} [NOT USED - Possible syntax for ECMAScript 6] * * * ------------------------ * NOTE: JSON is NOT equivalent to the JavaScript Object Literal notation. JSON is just a format for * data interchange that happens to have a syntax that is ALMOST A SUBSET of the JavaScript Object * Literal notation (U+2028 and U+2029 LineTerminators are allowed in JSON but not in JavaScript). * ------------------------ * */ /* * Prefixes defined for use in escape and unescape operations */ private static final char ESCAPE_PREFIX = '\\'; private static final char ESCAPE_UHEXA_PREFIX2 = 'u'; private static final char[] ESCAPE_UHEXA_PREFIX = "\\u".toCharArray(); /* * Structured for holding the 'escape level' assigned to chars (not codepoints) up to ESCAPE_LEVELS_LEN. * - The last position of the ESCAPE_LEVELS array will be used for determining the level of all * codepoints >= (ESCAPE_LEVELS_LEN - 1) */ private static final char ESCAPE_LEVELS_LEN = 0x9f + 2; // Last relevant char to be indexed is 0x9f private static final byte[] ESCAPE_LEVELS; /* * Small utility char arrays for hexadecimal conversion. */ private static char[] HEXA_CHARS_UPPER = "0123456789ABCDEF".toCharArray(); private static char[] HEXA_CHARS_LOWER = "0123456789abcdef".toCharArray(); /* * Structures for holding the Single Escape Characters */ private static int SEC_CHARS_LEN = '\\' + 1; // 0x5C + 1 = 0x5D private static char SEC_CHARS_NO_SEC = '*'; private static char[] SEC_CHARS; static { /* * Initialize Single Escape Characters */ SEC_CHARS = new char[SEC_CHARS_LEN]; Arrays.fill(SEC_CHARS, SEC_CHARS_NO_SEC); SEC_CHARS[0x08] = 'b'; SEC_CHARS[0x09] = 't'; SEC_CHARS[0x0A] = 'n'; SEC_CHARS[0x0C] = 'f'; SEC_CHARS[0x0D] = 'r'; SEC_CHARS[0x22] = '"'; SEC_CHARS[0x5C] = '\\'; // slash (solidus) character: will only be escaped if in '</' SEC_CHARS[0x2F] = '/'; /* * Initialization of escape levels. * Defined levels : * * - Level 1 : Basic escape set * - Level 2 : Basic escape set plus all non-ASCII * - Level 3 : All non-alphanumeric characters * - Level 4 : All characters * */ ESCAPE_LEVELS = new byte[ESCAPE_LEVELS_LEN]; /* * Everything is level 3 unless contrary indication. */ Arrays.fill(ESCAPE_LEVELS, (byte) 3); /* * Everything non-ASCII is level 2 unless contrary indication. */ for (char c = 0x80; c < ESCAPE_LEVELS_LEN; c++) { ESCAPE_LEVELS[c] = 2; } /* * Alphanumeric characters are level 4. */ for (char c = 'A'; c <= 'Z'; c++) { ESCAPE_LEVELS[c] = 4; } for (char c = 'a'; c <= 'z'; c++) { ESCAPE_LEVELS[c] = 4; } for (char c = '0'; c <= '9'; c++) { ESCAPE_LEVELS[c] = 4; } /* * Simple Escape Character will be level 1 (always escaped) */ ESCAPE_LEVELS[0x08] = 1; ESCAPE_LEVELS[0x09] = 1; ESCAPE_LEVELS[0x0A] = 1; ESCAPE_LEVELS[0x0C] = 1; ESCAPE_LEVELS[0x0D] = 1; ESCAPE_LEVELS[0x22] = 1; ESCAPE_LEVELS[0x5C] = 1; // slash (solidus) character: will only be escaped if in '</', but we signal it as level 1 anyway ESCAPE_LEVELS[0x2F] = 1; /* * JSON defines one ranges of non-displayable, control characters: U+0000 to U+001F. * Additionally, the U+007F to U+009F range is also escaped (which is allowed). */ for (char c = 0x00; c <= 0x1F; c++) { ESCAPE_LEVELS[c] = 1; } for (char c = 0x7F; c <= 0x9F; c++) { ESCAPE_LEVELS[c] = 1; } } private JsonEscapeUtil() { super(); } static char[] toUHexa(final int codepoint) { final char[] result = new char[4]; result[3] = HEXA_CHARS_UPPER[codepoint % 0x10]; result[2] = HEXA_CHARS_UPPER[(codepoint >>> 4) % 0x10]; result[1] = HEXA_CHARS_UPPER[(codepoint >>> 8) % 0x10]; result[0] = HEXA_CHARS_UPPER[(codepoint >>> 12) % 0x10]; return result; } /* * Perform an escape operation, based on String, according to the specified level and type. */ static String escape(final String text, final JsonEscapeType escapeType, final JsonEscapeLevel escapeLevel) { if (text == null) { return null; } final int level = escapeLevel.getEscapeLevel(); final boolean useSECs = escapeType.getUseSECs(); StringBuilder strBuilder = null; final int offset = 0; final int max = text.length(); int readOffset = offset; for (int i = offset; i < max; i++) { final int codepoint = Character.codePointAt(text, i); /* * Shortcut: most characters will be ASCII/Alphanumeric, and we won't need to do anything at * all for them */ if (codepoint <= (ESCAPE_LEVELS_LEN - 2) && level < ESCAPE_LEVELS[codepoint]) { continue; } /* * Check whether the character is a slash (solidus). In such case, only escape if it * appears after a '<' ('</') or level >= 3 (non alphanumeric) */ if (codepoint == '/' && level < 3 && (i == offset || text.charAt(i - 1) != '<')) { continue; } /* * Shortcut: we might not want to escape non-ASCII chars at all either. */ if (codepoint > (ESCAPE_LEVELS_LEN - 2) && level < ESCAPE_LEVELS[ESCAPE_LEVELS_LEN - 1]) { if (Character.charCount(codepoint) > 1) { // This is to compensate that we are actually escaping two char[] positions with a single codepoint. i++; } continue; } /* * At this point we know for sure we will need some kind of escape, so we * can increase the offset and initialize the string builder if needed, along with * copying to it all the contents pending up to this point. */ if (strBuilder == null) { strBuilder = new StringBuilder(max + 20); } if (i - readOffset > 0) { strBuilder.append(text, readOffset, i); } if (Character.charCount(codepoint) > 1) { // This is to compensate that we are actually reading two char[] positions with a single codepoint. i++; } readOffset = i + 1; /* * ----------------------------------------------------------------------------------------- * * Peform the real escape, attending the different combinations of SECs and UHEXA * * ----------------------------------------------------------------------------------------- */ if (useSECs && codepoint < SEC_CHARS_LEN) { // We will try to use a SEC final char sec = SEC_CHARS[codepoint]; if (sec != SEC_CHARS_NO_SEC) { // SEC found! just write it and go for the next char strBuilder.append(ESCAPE_PREFIX); strBuilder.append(sec); continue; } } /* * No SEC-escape was possible, so we need uhexa escape. */ if (Character.charCount(codepoint) > 1) { final char[] codepointChars = Character.toChars(codepoint); strBuilder.append(ESCAPE_UHEXA_PREFIX); strBuilder.append(toUHexa(codepointChars[0])); strBuilder.append(ESCAPE_UHEXA_PREFIX); strBuilder.append(toUHexa(codepointChars[1])); continue; } strBuilder.append(ESCAPE_UHEXA_PREFIX); strBuilder.append(toUHexa(codepoint)); } /* * ----------------------------------------------------------------------------------------------- * Final cleaning: return the original String object if no escape was actually needed. Otherwise * append the remaining unescaped text to the string builder and return. * ----------------------------------------------------------------------------------------------- */ if (strBuilder == null) { return text; } if (max - readOffset > 0) { strBuilder.append(text, readOffset, max); } return strBuilder.toString(); } /* * Perform an escape operation, based on char[], according to the specified level and type. */ static void escape(final char[] text, final int offset, final int len, final Writer writer, final JsonEscapeType escapeType, final JsonEscapeLevel escapeLevel) throws IOException { if (text == null || text.length == 0) { return; } final int level = escapeLevel.getEscapeLevel(); final boolean useSECs = escapeType.getUseSECs(); final int max = (offset + len); int readOffset = offset; for (int i = offset; i < max; i++) { final int codepoint = Character.codePointAt(text, i); /* * Shortcut: most characters will be ASCII/Alphanumeric, and we won't need to do anything at * all for them */ if (codepoint <= (ESCAPE_LEVELS_LEN - 2) && level < ESCAPE_LEVELS[codepoint]) { continue; } /* * Check whether the character is a slash (solidus). In such case, only escape if it * appears after a '<' ('</') or level >= 3 (non alphanumeric) */ if (codepoint == '/' && level < 3 && (i == offset || text[i - 1] != '<')) { continue; } /* * Shortcut: we might not want to escape non-ASCII chars at all either. */ if (codepoint > (ESCAPE_LEVELS_LEN - 2) && level < ESCAPE_LEVELS[ESCAPE_LEVELS_LEN - 1]) { if (Character.charCount(codepoint) > 1) { // This is to compensate that we are actually escaping two char[] positions with a single codepoint. i++; } continue; } /* * At this point we know for sure we will need some kind of escape, so we * can write all the contents pending up to this point. */ if (i - readOffset > 0) { writer.write(text, readOffset, (i - readOffset)); } if (Character.charCount(codepoint) > 1) { // This is to compensate that we are actually reading two char[] positions with a single codepoint. i++; } readOffset = i + 1; /* * ----------------------------------------------------------------------------------------- * * Peform the real escape, attending the different combinations of SECs and UHEXA * * ----------------------------------------------------------------------------------------- */ if (useSECs && codepoint < SEC_CHARS_LEN) { // We will try to use a SEC final char sec = SEC_CHARS[codepoint]; if (sec != SEC_CHARS_NO_SEC) { // SEC found! just write it and go for the next char writer.write(ESCAPE_PREFIX); writer.write(sec); continue; } } /* * No SEC-escape was possible, so we need uhexa escape. */ if (Character.charCount(codepoint) > 1) { final char[] codepointChars = Character.toChars(codepoint); writer.write(ESCAPE_UHEXA_PREFIX); writer.write(toUHexa(codepointChars[0])); writer.write(ESCAPE_UHEXA_PREFIX); writer.write(toUHexa(codepointChars[1])); continue; } writer.write(ESCAPE_UHEXA_PREFIX); writer.write(toUHexa(codepoint)); } /* * ----------------------------------------------------------------------------------------------- * Final cleaning: return the original String object if no escape was actually needed. Otherwise * append the remaining unescaped text to the string builder and return. * ----------------------------------------------------------------------------------------------- */ if (max - readOffset > 0) { writer.write(text, readOffset, (max - readOffset)); } } /* * This methods (the two versions) are used instead of Integer.parseInt(str,radix) in order to avoid the need * to create substrings of the text being unescaped to feed such method. * - No need to check all chars are within the radix limits - reference parsing code will already have done so. */ static int parseIntFromReference(final String text, final int start, final int end, final int radix) { int result = 0; for (int i = start; i < end; i++) { final char c = text.charAt(i); int n = -1; for (int j = 0; j < HEXA_CHARS_UPPER.length; j++) { if (c == HEXA_CHARS_UPPER[j] || c == HEXA_CHARS_LOWER[j]) { n = j; break; } } result = (radix * result) + n; } return result; } static int parseIntFromReference(final char[] text, final int start, final int end, final int radix) { int result = 0; for (int i = start; i < end; i++) { final char c = text[i]; int n = -1; for (int j = 0; j < HEXA_CHARS_UPPER.length; j++) { if (c == HEXA_CHARS_UPPER[j] || c == HEXA_CHARS_LOWER[j]) { n = j; break; } } result = (radix * result) + n; } return result; } /* * Perform an unescape operation based on String. */ static String unescape(final String text) { if (text == null) { return null; } StringBuilder strBuilder = null; final int offset = 0; final int max = text.length(); int readOffset = offset; int referenceOffset = offset; for (int i = offset; i < max; i++) { final char c = text.charAt(i); /* * Check the need for an unescape operation at this point */ if (c != ESCAPE_PREFIX || (i + 1) >= max) { continue; } int codepoint = -1; if (c == ESCAPE_PREFIX) { final char c1 = text.charAt(i + 1); switch (c1) { case 'b': codepoint = 0x08; referenceOffset = i + 1; break; case 't': codepoint = 0x09; referenceOffset = i + 1; break; case 'n': codepoint = 0x0A; referenceOffset = i + 1; break; case 'f': codepoint = 0x0C; referenceOffset = i + 1; break; case 'r': codepoint = 0x0D; referenceOffset = i + 1; break; case '"': codepoint = 0x22; referenceOffset = i + 1; break; case '\\': codepoint = 0x5C; referenceOffset = i + 1; break; case '/': codepoint = 0x2F; referenceOffset = i + 1; break; } if (codepoint == -1) { if (c1 == ESCAPE_UHEXA_PREFIX2) { // This can be a uhexa escape, we need exactly four more characters int f = i + 2; while (f < (i + 6) && f < max) { final char cf = text.charAt(f); if (!((cf >= '0' && cf <= '9') || (cf >= 'A' && cf <= 'F') || (cf >= 'a' && cf <= 'f'))) { break; } f++; } if ((f - (i + 2)) < 4) { // We weren't able to consume the required four hexa chars, leave it as slash+'u', which // is invalid, and let the corresponding JSON parser fail. i++; continue; } codepoint = parseIntFromReference(text, i + 2, f, 16); // Fast-forward to the first char after the parsed codepoint referenceOffset = f - 1; // Don't continue here, just let the unescape code below do its job } else { // Other escape sequences are not allowed by JSON. So we leave it as is // and expect the corresponding JSON parser to fail. i++; continue; } } } /* * At this point we know for sure we will need some kind of unescape, so we * can increase the offset and initialize the string builder if needed, along with * copying to it all the contents pending up to this point. */ if (strBuilder == null) { strBuilder = new StringBuilder(max + 5); } if (i - readOffset > 0) { strBuilder.append(text, readOffset, i); } i = referenceOffset; readOffset = i + 1; /* * -------------------------- * * Peform the real unescape * * -------------------------- */ if (codepoint > '\uFFFF') { strBuilder.append(Character.toChars(codepoint)); } else { strBuilder.append((char) codepoint); } } /* * ----------------------------------------------------------------------------------------------- * Final cleaning: return the original String object if no unescape was actually needed. Otherwise * append the remaining escaped text to the string builder and return. * ----------------------------------------------------------------------------------------------- */ if (strBuilder == null) { return text; } if (max - readOffset > 0) { strBuilder.append(text, readOffset, max); } return strBuilder.toString(); } /* * Perform an unescape operation based on char[]. */ static void unescape(final char[] text, final int offset, final int len, final Writer writer) throws IOException { if (text == null) { return; } final int max = (offset + len); int readOffset = offset; int referenceOffset = offset; for (int i = offset; i < max; i++) { final char c = text[i]; /* * Check the need for an unescape operation at this point */ if (c != ESCAPE_PREFIX || (i + 1) >= max) { continue; } int codepoint = -1; if (c == ESCAPE_PREFIX) { final char c1 = text[i + 1]; switch (c1) { case 'b': codepoint = 0x08; referenceOffset = i + 1; break; case 't': codepoint = 0x09; referenceOffset = i + 1; break; case 'n': codepoint = 0x0A; referenceOffset = i + 1; break; case 'f': codepoint = 0x0C; referenceOffset = i + 1; break; case 'r': codepoint = 0x0D; referenceOffset = i + 1; break; case '"': codepoint = 0x22; referenceOffset = i + 1; break; case '\\': codepoint = 0x5C; referenceOffset = i + 1; break; case '/': codepoint = 0x2F; referenceOffset = i + 1; break; } if (codepoint == -1) { if (c1 == ESCAPE_UHEXA_PREFIX2) { // This can be a uhexa escape, we need exactly four more characters int f = i + 2; while (f < (i + 6) && f < max) { final char cf = text[f]; if (!((cf >= '0' && cf <= '9') || (cf >= 'A' && cf <= 'F') || (cf >= 'a' && cf <= 'f'))) { break; } f++; } if ((f - (i + 2)) < 4) { // We weren't able to consume the required four hexa chars, leave it as slash+'u', which // is invalid, and let the corresponding JSON parser fail. i++; continue; } codepoint = parseIntFromReference(text, i + 2, f, 16); // Fast-forward to the first char after the parsed codepoint referenceOffset = f - 1; // Don't continue here, just let the unescape code below do its job } else { // Other escape sequences are not allowed by JSON. So we leave it as is // and expect the corresponding JSON parser to fail. i++; continue; } } } /* * At this point we know for sure we will need some kind of unescape, so we * write all the contents pending up to this point. */ if (i - readOffset > 0) { writer.write(text, readOffset, (i - readOffset)); } i = referenceOffset; readOffset = i + 1; /* * -------------------------- * * Peform the real unescape * * -------------------------- */ if (codepoint > '\uFFFF') { writer.write(Character.toChars(codepoint)); } else { writer.write((char) codepoint); } } /* * ----------------------------------------------------------------------------------------------- * Final cleaning: writer the remaining escaped text and return. * ----------------------------------------------------------------------------------------------- */ if (max - readOffset > 0) { writer.write(text, readOffset, (max - readOffset)); } } }
af688ef6d05b71996744d58f11d96641954694ee
dd82a2b15ab9e5df9432c607b02145c4cd2e5967
/app/src/androidTest/java/com/example/surbhimiglani/glidedemo/ExampleInstrumentedTest.java
ffb3933fee62b457fdd99a1d68dd161b44e8d278
[]
no_license
surbhimiglani/GlideDemo
278708e1ef091220b935293c16d43c37439382c1
74cd106974640ca6562dbb47a5c3d02c3a14666a
refs/heads/master
2020-03-27T12:23:00.596230
2018-08-29T04:09:30
2018-08-29T04:09:30
146,543,371
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package com.example.surbhimiglani.glidedemo; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.surbhimiglani.glidedemo", appContext.getPackageName()); } }
15fc546f73b54d5332d832c79b7d6935700bf5dd
ab6a72d62499a444d04ed2e172760418e270d9e9
/final/gra2/Bot.java
f9b1bd79dc25df124b78154f38e62287a475be58
[]
no_license
olislawiec/igudab
09f7bab25446b78eecaab8f9cdc1d208db858544
adc7db764de56f4065ebad0cc508c8a417a3e457
refs/heads/master
2021-01-10T05:54:39.947595
2014-11-21T11:07:45
2014-11-21T11:07:45
48,026,594
0
0
null
null
null
null
UTF-8
Java
false
false
5,367
java
package gra2; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.DataInputStream; import java.io.IOException; import java.net.Socket; import javax.script.ScriptEngineManager; import javax.script.ScriptEngine; import javax.script.ScriptException; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.text.JTextComponent; import javax.swing.JLabel; import java.io.PrintStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.StringReader; import java.net.UnknownHostException; public class Bot implements Runnable { // The client socket private static Socket clientSocket1 = null; // The output stream private static PrintStream os1 = null; // The input stream private static DataInputStream is1 = null; private static BufferedReader inputLine1 = null; public static String texter1 = ""; public static int intTexter1 = 0; public static String host1 = ""; public static int portNumber1 = 8969; public static boolean closed1 = false; public static BufferedReader send(String msgFromClientToServer) { try { StringReader sr = new StringReader(msgFromClientToServer); BufferedReader br = new BufferedReader(sr); os1.println(br.readLine()); System.out.println(br.readLine() + "_syso5_sender"); return br; } catch (Exception e) { System.out.println("send(String msgFromClientToServer): " + e); e.printStackTrace(); } return null; } public static void main(String[] args) { try { clientSocket1 = new Socket(host1, portNumber1); inputLine1 = new BufferedReader(new InputStreamReader(System.in)); os1 = new PrintStream(clientSocket1.getOutputStream()); // to: // klient->serwer is1 = new DataInputStream(clientSocket1.getInputStream());// to: // serwer->klient } catch (UnknownHostException e) { System.err.println("Don't know about host " + host1); } catch (IOException e) { System.err .println("Couldn't get I/O for the connection to the host " + host1); System.exit(-3); } /* * If everything has been initialized then we want to write some data to * the socket we have opened a connection to on the port portNumber. */ if (clientSocket1 != null && os1 != null && is1 != null) { try { /* Create a thread to read from the server. */ new Thread(new Bot()).start(); while (!isClosed()) { os1.println(inputLine1.readLine().trim()); System.out.println(inputLine1.readLine()); // send("D1,2"); // send("BC"); System.out.println("petla"); // System.out.println(inputLine.readLine().trim()+"_syso1"); } System.out.println("po petli"); /* * Close the output stream, close the input stream, close the * socket. */ os1.close(); is1.close(); clientSocket1.close(); } catch (IOException e) { System.err.println("IOException: " + e); } } } @Override public void run() { /* * Keep on reading from the socket till we receive "Bye" from the * server. Once we received that then we want to break. */ String responseLine1 = ""; try { while ((responseLine1 = is1.readLine()) != null) { System.out.println(responseLine1 + "_syso3"); if (responseLine1.startsWith("H") && responseLine1.length() > 4) { String[] sparePart = splited(withoutRegx(lineWithoutLetter(responseLine1))); /* * for(int i=0; i<=sparePart.length-1;i++) { * System.out.println(sparePart[i]); } */ send("D1,2"); if (responseLine1.startsWith("H")) { send("BC"); } // System.out.println(responseLine1 + "_syso2"); // ekranLabelSetter(responseLineWithoutLetter); } else { send("D3,4"); send("BC"); } if (responseLine1.indexOf("Q ") != -1) { break; } if (responseLine1.indexOf("Server too busy. Try later.") != (-2)) { setClosed(false); } if (responseLine1.startsWith("BA")) { System.out.println("_syso4_widacBA?"); } } setClosed(true); } catch (IOException e) { System.err.println("IOException: " + e); } } public static String toStr(int x) { return Integer.toString(x); } public static int toInt(String xs) { return Integer.parseInt(xs); } /* * public void ekranCardsDealer(String[] respo) { if (respo.length < 5 && * respo.length > 3) { card1.setText(respo[0]); card2.setText(respo[1]); * card3.setText(respo[2]); card4.setText(respo[3]); } } */ public String[] splited(String splitMe) { String[] respo; respo = splitMe.split(","); return respo; } public String withoutRegx(String splitMe) { String[] regX; regX = splitMe.split(";"); return regX[0]; } public String lineWithoutLetter(String res) { String responseLineWithoutLetter = ""; responseLineWithoutLetter = res.substring(1); return responseLineWithoutLetter; } private static boolean isClosed() { // TODO Auto-generated method stub return closed1; } private void setClosed(boolean b) { closed1 = true; } }
fdf1a7e3b5aa5c5c2efd48a85a81e5f56bcf372c
1b0f4dee2b239eccb0dc62057712804bd9d0178b
/src/test/java/com/xx_dev/apn/proxy/test/TestRemoteRuleGen.java
abf33bbdb5c1d69a99f3cb6653affac01d9e0a4b
[]
no_license
luwenbin006/apn-proxy
bc8dc1bdcf903d64b557ef1953bcb8dfd7494f59
97f1bdbed7d723472210a81e96db9bd7084fd743
refs/heads/master
2020-12-25T14:07:44.450697
2016-02-25T08:21:36
2016-02-25T08:21:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,287
java
/* * Copyright (c) 2014 The APN-PROXY Project * * The APN-PROXY Project 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 com.xx_dev.apn.proxy.test; import org.junit.Test; import java.io.FileNotFoundException; import java.util.Scanner; /** * @author xmx * @version $Id: com.xx_dev.apn.proxy.test.TestRemoteRuleGen 2014-12-31 18:38 (xmx) Exp $ */ public class TestRemoteRuleGen { @Test public void test() throws FileNotFoundException { Scanner in = new Scanner(TestRemoteRuleGen.class.getResourceAsStream("/domains.txt"), "UTF-8"); while (in.hasNextLine()) { String line = in.nextLine(); System.err.println("\t\t\t<original-host>"+line+"</original-host>"); } in.close(); } }
9a974735440adb9701d3bc6918b567c439fe563c
60f3386750a82dc3bb787ca599a80b5b5bd61964
/class11/Recap.java
beda0c7c27bbe154af6acce0f28f3db6cdc3c6fa
[]
no_license
hmusoev90/Java-withSyntax-
e97bad59da2ae2cba914019093cad8dacb2fc6b8
1811db89a576e42f2ebd1f9f5e34e415bd469443
refs/heads/master
2022-12-10T05:52:13.693205
2020-08-22T18:30:10
2020-08-22T18:30:10
286,250,350
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package com.syntax.class11; public class Recap { public static void main(String[] args) { int[] grades = new int[5]; int size = grades.length; System.out.println("Array size:" + size); grades[3] = 47; grades[2] = 94; grades[4] = 100; grades[0] = 70; grades[1] = 85; // What is the average of the class? int total = 0; for (int i = 0; i <= grades.length - 1; i++) { total += grades[i]; } System.out.println("Average:" + total / grades.length); } }
[ "hmusoev90" ]
hmusoev90
b118fad44c5e03ff258a7cbf892ec24e86d49449
eab78489b4e4b59741c83e1ac26fec50bf146cd5
/core/java/src/mu/seccyber/core/web/OptRoutable.java
f956dfcc2dea4635752612246d32fb1f71ca0797
[]
no_license
AndreasKralj/SECMizzouCyberChallenge
e65758994de78437628a50d03c6ddf2dede11fad
c3efbd5fac5b4b68d7e5b05711fb25942b519972
refs/heads/master
2020-03-09T06:47:00.989573
2018-04-10T13:04:04
2018-04-10T13:04:04
128,648,136
0
0
null
null
null
null
UTF-8
Java
false
false
2,954
java
package mu.seccyber.core.web; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier; import com.fasterxml.jackson.databind.module.SimpleModule; import mu.seccyber.core.opt.Optimizer; import mu.seccyber.core.policy.PolicyHandler; import mu.seccyber.core.web.impl.Action; import org.restlet.resource.Post; import org.restlet.resource.ServerResource; import java.io.IOException; import java.util.List; /** * Created by dmitriichemodanov on 4/8/18. */ public class OptRoutable extends ServerResource { private static Optimizer opt = new Optimizer(); @Post("json") public String composeActions(String json) { try { List<Action> actions = jsonToActions(json); //Compose SC int[] actionsToApply = composeActionsInt(actions); for (int i=0; i< actionsToApply.length; i++) actions.get(i).setApply(actionsToApply[i] == 1); return actionToJson(actions); } catch (Exception ex) { ex.printStackTrace(); return ("{\"ERROR\" : \"exception during security action composition: " + ex.getMessage() + "\"}"); } } private int[] composeActionsInt(List<Action> acts) { double[] risks = new double[acts.size()]; double[] exec_times = new double[acts.size()]; for(int i=0; i<acts.size(); i++) { risks[i] = acts.get(i).getRisk(); exec_times[i] = acts.get(i).getExecTime(); } return opt.composeActions(acts.size(), risks, exec_times, PolicyHandler.getInstance().getRiskLvl()); } public static List<Action> jsonToActions(String json) throws IOException { /* SimpleModule module = new SimpleModule(); module.setDeserializerModifier(new BeanDeserializerModifier() { @Override public JsonDeserializer<?> modifyDeserializer( DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer) { if (beanDesc.getBeanClass() == YourClass.class) { return new YourClassDeserializer(deserializer); } return deserializer; }}); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(module); objectMapper.readValue(json, classType); */ System.out.println("Next JSON obtained: " + json); ObjectMapper mapper = new ObjectMapper(); //deserialize JSON objects return mapper.readValue(json, mapper.getTypeFactory().constructCollectionType(List.class, Action.class)); } public static String actionToJson(List<Action> acts) throws IOException { return new ObjectMapper().writeValueAsString(acts); } }
e9b1909c1435ac908a98f083b1990a1aafe25f51
9bd18af7626c9e09e409f9760d065e415d970a96
/gulimall-common/src/main/java/com/wxx/common/utils/RRException.java
f8ef000a0c86ddf668a07a1c5ec808268f2919e5
[ "Apache-2.0" ]
permissive
haywood2018/gulimall
4f46d15d90809a60fc4f023c63c48957706193a8
4457f8026001a68380067eacf3b53992a6e35533
refs/heads/master
2023-04-25T08:08:59.900206
2020-11-15T08:49:04
2020-11-15T08:49:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
977
java
/** * Copyright (c) 2016-2019 人人开源 All rights reserved. * * https://www.renren.io * * 版权所有,侵权必究! */ package com.wxx.common.utils; /** * 自定义异常 * * @author Mark [email protected] */ public class RRException extends RuntimeException { private static final long serialVersionUID = 1L; private String msg; private int code = 500; public RRException(String msg) { super(msg); this.msg = msg; } public RRException(String msg, Throwable e) { super(msg, e); this.msg = msg; } public RRException(String msg, int code) { super(msg); this.msg = msg; this.code = code; } public RRException(String msg, int code, Throwable e) { super(msg, e); this.msg = msg; this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } }
5c8b186ed5df52801b76c942b32cf2a76ef9bcea
ca217730cff9435b03347587d61d2ef28b478f7e
/old/models/SCPModelRemoteDoorPC.java
883c4942637032a341b3c19eaa8e730728d9257d
[]
no_license
Ordinastie/SCPCraft
e8c4c78cc86ac0e7f364156058f35ce30adf059d
547a204bb14fc33adefb9926baca2f5188d89421
refs/heads/master
2023-07-18T19:50:59.231189
2014-03-21T23:59:54
2014-03-21T23:59:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,421
java
package SCPCraft.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import SCPCraft.mod_Others; public class SCPModelRemoteDoorPC extends ModelBase { //fields ModelRenderer Shape3; ModelRenderer Shape1; ModelRenderer Shape2; public SCPModelRemoteDoorPC() { textureWidth = 64; textureHeight = 64; Shape3 = new ModelRenderer(this, 0, 0); Shape3.addBox(0F, 0F, 0F, 14, 18, 12); Shape3.setRotationPoint(-7F, 6F, -6F); Shape3.setTextureSize(64, 64); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape1 = new ModelRenderer(this, 1, 32); Shape1.addBox(0F, 0F, 0F, 14, 16, 6); Shape1.setRotationPoint(-7F, -10F, 0F); Shape1.setTextureSize(64, 64); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 1, 1); Shape2.addBox(0F, 0F, 0F, 1, 2, 1); Shape2.setTextureSize(64, 64); Shape2.mirror = true; if(mod_Others.remoteDoorActivate) { Shape2.setRotationPoint(3F, 4F, -4F); } else if(!mod_Others.remoteDoorActivate) { Shape2.setRotationPoint(5F, 4F, -4F); } setRotation(Shape2, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Shape3.render(f5); Shape1.render(f5); Shape2.render(f5); if(mod_Others.remoteDoorActivate) { Shape2.setRotationPoint(3F, 4F, -4F); } else if(!mod_Others.remoteDoorActivate) { Shape2.setRotationPoint(5F, 4F, -4F); } } public void renderModel(float f1) { Shape3.render(f1); Shape1.render(f1); Shape2.render(f1); if(mod_Others.remoteDoorActivate) { Shape2.setRotationPoint(3F, 4F, -4F); } else if(!mod_Others.remoteDoorActivate) { Shape2.setRotationPoint(5F, 4F, -4F); } } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); if(mod_Others.remoteDoorActivate) { Shape2.setRotationPoint(3F, 4F, -4F); } else if(!mod_Others.remoteDoorActivate) { Shape2.setRotationPoint(5F, 4F, -4F); } } }
a6c0f0cb857654c1291c694a851e13c41393d189
314b079fde501bf5d671e2d725f2f149e47765b3
/mysite-database/src/main/java/com/hehe/mysite/database/pojo/ConfigSms.java
5130373cc37155a339a5914512cfd2d8f601e85c
[]
no_license
TrickstTT/mysite
86bd9707a28158e54b20f48974affdeaf375cc5c
b0b93a419551ad0a76dec360dcfc7aa51fa6955a
refs/heads/master
2021-05-11T03:52:11.149796
2018-01-19T02:03:03
2018-01-19T02:03:03
117,926,543
0
0
null
null
null
null
UTF-8
Java
false
false
3,139
java
package com.hehe.mysite.database.pojo; import javax.persistence.*; @Table(name = "config_sms") public class ConfigSms { /** * 编号 */ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private String id; /** * AccessId */ @Column(name = "sms_access_id") private String smsAccessId; /** * AccessKey */ @Column(name = "sms_access_key") private String smsAccessKey; /** * MNSEndpoint */ @Column(name = "sms_mns_endpoint") private String smsMnsEndpoint; /** * 主题 */ @Column(name = "sms_topic") private String smsTopic; /** * 签名 */ @Column(name = "sms_sign_name") private String smsSignName; /** * 测试手机 */ @Column(name = "test_number") private String testNumber; /** * 获取编号 * * @return id - 编号 */ public String getId() { return id; } /** * 设置编号 * * @param id 编号 */ public void setId(String id) { this.id = id; } /** * 获取AccessId * * @return sms_access_id - AccessId */ public String getSmsAccessId() { return smsAccessId; } /** * 设置AccessId * * @param smsAccessId AccessId */ public void setSmsAccessId(String smsAccessId) { this.smsAccessId = smsAccessId; } /** * 获取AccessKey * * @return sms_access_key - AccessKey */ public String getSmsAccessKey() { return smsAccessKey; } /** * 设置AccessKey * * @param smsAccessKey AccessKey */ public void setSmsAccessKey(String smsAccessKey) { this.smsAccessKey = smsAccessKey; } /** * 获取MNSEndpoint * * @return sms_mns_endpoint - MNSEndpoint */ public String getSmsMnsEndpoint() { return smsMnsEndpoint; } /** * 设置MNSEndpoint * * @param smsMnsEndpoint MNSEndpoint */ public void setSmsMnsEndpoint(String smsMnsEndpoint) { this.smsMnsEndpoint = smsMnsEndpoint; } /** * 获取主题 * * @return sms_topic - 主题 */ public String getSmsTopic() { return smsTopic; } /** * 设置主题 * * @param smsTopic 主题 */ public void setSmsTopic(String smsTopic) { this.smsTopic = smsTopic; } /** * 获取签名 * * @return sms_sign_name - 签名 */ public String getSmsSignName() { return smsSignName; } /** * 设置签名 * * @param smsSignName 签名 */ public void setSmsSignName(String smsSignName) { this.smsSignName = smsSignName; } /** * 获取测试手机 * * @return test_number - 测试手机 */ public String getTestNumber() { return testNumber; } /** * 设置测试手机 * * @param testNumber 测试手机 */ public void setTestNumber(String testNumber) { this.testNumber = testNumber; } }
a11e2ece389a81082c58a8d5cc1e29c2d1dfb3fc
6dfb6c4621216986b3d4698a39a2cfe42a995931
/Parte03/src/parte03/Emprestimo.java
811bbdcc847916d5547050090a30d0c43ab04e67
[]
no_license
babqs/Trabalho-de-Engenharia-de-Software-II
a0ed0477e5f701a35581045a324c4999709a1867
932ebe9f0ed349463e2d9cdb7bde22688c516a55
refs/heads/main
2023-03-08T00:15:08.064192
2021-02-23T01:14:31
2021-02-23T01:14:31
308,756,262
0
0
null
null
null
null
UTF-8
Java
false
false
2,209
java
package parte03; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; public class Emprestimo { Date dataEmprestimo = new Date(); Date dataPrevista = new Date(); Date data_aux = new Date(); String nome; //Cada emprestimo tem um conjutno de itens List<Item> item = new ArrayList<Item>(); int emprestimo = 0; public Date getDataEmprestimo() { return dataEmprestimo; } public void setDataEmprestimo(Date dataEmprestimo) { this.dataEmprestimo = dataEmprestimo; } // Metodo responsável por realizar o empréstimo public boolean emprestar(List<Livro> livros) { // TODO Auto-generated method stub int aux; //Para o numero de livros a ser emprestado for (int i = 0; i < livros.size(); i++) //Adiciona um novo item no cojunto de items, e passa o livro a ser associado a ele { item.add(new Item(livros.get(i))); } //Chama o metodo para calcular a data de devolução caso tenha pelo menos um livro que possa ser emprestado CalculaDataDevolucao(); System.out.print("\nNumero de Livros Emprestados: " + this.emprestimo); System.out.print("\nData de Empréstimo: " + this.dataEmprestimo); System.out.print("\nData de Devolução: " + this.dataPrevista); return true; } private Date CalculaDataDevolucao() { Date date = new Date(); for (int j = 0; j < item.size(); j++) { data_aux = item.get(j).calculaDataDevolucao(date); if (dataPrevista.compareTo(data_aux) < 0) { dataPrevista = data_aux; } } if (item.size() > 2) { int tam = item.size() - 2; Calendar calendar = Calendar.getInstance(); calendar.setTime(dataPrevista); calendar.add(Calendar.DATE, (tam * 2)); dataPrevista = calendar.getTime(); } for (int j = 0; j < item.size(); j++) { item.get(j).setDataDevolucao(dataPrevista); } return dataPrevista; } }
5399ad473e996382fc15cb0006901040c1723942
ff0c33ccd3bbb8a080041fbdbb79e29989691747
/java.base/java/lang/reflect/Modifier.java
0bcfa7b971f0e2097ba8ae41da5c0894cfc0e90d
[]
no_license
jiecai58/jdk15
7d0f2e518e3f6669eb9ebb804f3c89bbfb2b51f0
b04691a72e51947df1b25c31175071f011cb9bbe
refs/heads/main
2023-02-25T00:30:30.407901
2021-01-29T04:48:33
2021-01-29T04:48:33
330,704,930
0
1
null
null
null
null
UTF-8
Java
false
false
15,802
java
/* * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package java.lang.reflect; import java.util.StringJoiner; /** * The Modifier class provides {@code static} methods and * constants to decode class and member access modifiers. The sets of * modifiers are represented as integers with distinct bit positions * representing different modifiers. The values for the constants * representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of * <cite>The Java Virtual Machine Specification</cite>. * * @see Class#getModifiers() * @see Member#getModifiers() * * @author Nakul Saraiya * @author Kenneth Russell * @since 1.1 */ public class Modifier { /** * Do not call. */ private Modifier() {throw new AssertionError();} /** * Return {@code true} if the integer argument includes the * {@code public} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code public} modifier; {@code false} otherwise. */ public static boolean isPublic(int mod) { return (mod & PUBLIC) != 0; } /** * Return {@code true} if the integer argument includes the * {@code private} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code private} modifier; {@code false} otherwise. */ public static boolean isPrivate(int mod) { return (mod & PRIVATE) != 0; } /** * Return {@code true} if the integer argument includes the * {@code protected} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code protected} modifier; {@code false} otherwise. */ public static boolean isProtected(int mod) { return (mod & PROTECTED) != 0; } /** * Return {@code true} if the integer argument includes the * {@code static} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code static} modifier; {@code false} otherwise. */ public static boolean isStatic(int mod) { return (mod & STATIC) != 0; } /** * Return {@code true} if the integer argument includes the * {@code final} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code final} modifier; {@code false} otherwise. */ public static boolean isFinal(int mod) { return (mod & FINAL) != 0; } /** * Return {@code true} if the integer argument includes the * {@code synchronized} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code synchronized} modifier; {@code false} otherwise. */ public static boolean isSynchronized(int mod) { return (mod & SYNCHRONIZED) != 0; } /** * Return {@code true} if the integer argument includes the * {@code volatile} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code volatile} modifier; {@code false} otherwise. */ public static boolean isVolatile(int mod) { return (mod & VOLATILE) != 0; } /** * Return {@code true} if the integer argument includes the * {@code transient} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code transient} modifier; {@code false} otherwise. */ public static boolean isTransient(int mod) { return (mod & TRANSIENT) != 0; } /** * Return {@code true} if the integer argument includes the * {@code native} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code native} modifier; {@code false} otherwise. */ public static boolean isNative(int mod) { return (mod & NATIVE) != 0; } /** * Return {@code true} if the integer argument includes the * {@code interface} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code interface} modifier; {@code false} otherwise. */ public static boolean isInterface(int mod) { return (mod & INTERFACE) != 0; } /** * Return {@code true} if the integer argument includes the * {@code abstract} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code abstract} modifier; {@code false} otherwise. */ public static boolean isAbstract(int mod) { return (mod & ABSTRACT) != 0; } /** * Return {@code true} if the integer argument includes the * {@code strictfp} modifier, {@code false} otherwise. * * @param mod a set of modifiers * @return {@code true} if {@code mod} includes the * {@code strictfp} modifier; {@code false} otherwise. */ public static boolean isStrict(int mod) { return (mod & STRICT) != 0; } /** * Return a string describing the access modifier flags in * the specified modifier. For example: * <blockquote><pre> * public final synchronized strictfp * </pre></blockquote> * The modifier names are returned in an order consistent with the * suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of * <cite>The Java Language Specification</cite>. * The full modifier ordering used by this method is: * <blockquote> {@code * public protected private abstract static final transient * volatile synchronized native strictfp * interface } </blockquote> * The {@code interface} modifier discussed in this class is * not a true modifier in the Java language and it appears after * all other modifiers listed by this method. This method may * return a string of modifiers that are not valid modifiers of a * Java entity; in other words, no checking is done on the * possible validity of the combination of modifiers represented * by the input. * * Note that to perform such checking for a known kind of entity, * such as a constructor or method, first AND the argument of * {@code toString} with the appropriate mask from a method like * {@link #constructorModifiers} or {@link #methodModifiers}. * * @param mod a set of modifiers * @return a string representation of the set of modifiers * represented by {@code mod} */ public static String toString(int mod) { StringJoiner sj = new StringJoiner(" "); if ((mod & PUBLIC) != 0) sj.add("public"); if ((mod & PROTECTED) != 0) sj.add("protected"); if ((mod & PRIVATE) != 0) sj.add("private"); /* Canonical order */ if ((mod & ABSTRACT) != 0) sj.add("abstract"); if ((mod & STATIC) != 0) sj.add("static"); if ((mod & FINAL) != 0) sj.add("final"); if ((mod & TRANSIENT) != 0) sj.add("transient"); if ((mod & VOLATILE) != 0) sj.add("volatile"); if ((mod & SYNCHRONIZED) != 0) sj.add("synchronized"); if ((mod & NATIVE) != 0) sj.add("native"); if ((mod & STRICT) != 0) sj.add("strictfp"); if ((mod & INTERFACE) != 0) sj.add("interface"); return sj.toString(); } /* * Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of * <cite>The Java Virtual Machine Specification</cite> */ /** * The {@code int} value representing the {@code public} * modifier. */ public static final int PUBLIC = 0x00000001; /** * The {@code int} value representing the {@code private} * modifier. */ public static final int PRIVATE = 0x00000002; /** * The {@code int} value representing the {@code protected} * modifier. */ public static final int PROTECTED = 0x00000004; /** * The {@code int} value representing the {@code static} * modifier. */ public static final int STATIC = 0x00000008; /** * The {@code int} value representing the {@code final} * modifier. */ public static final int FINAL = 0x00000010; /** * The {@code int} value representing the {@code synchronized} * modifier. */ public static final int SYNCHRONIZED = 0x00000020; /** * The {@code int} value representing the {@code volatile} * modifier. */ public static final int VOLATILE = 0x00000040; /** * The {@code int} value representing the {@code transient} * modifier. */ public static final int TRANSIENT = 0x00000080; /** * The {@code int} value representing the {@code native} * modifier. */ public static final int NATIVE = 0x00000100; /** * The {@code int} value representing the {@code interface} * modifier. */ public static final int INTERFACE = 0x00000200; /** * The {@code int} value representing the {@code abstract} * modifier. */ public static final int ABSTRACT = 0x00000400; /** * The {@code int} value representing the {@code strictfp} * modifier. */ public static final int STRICT = 0x00000800; // Bits not (yet) exposed in the public API either because they // have different meanings for fields and methods and there is no // way to distinguish between the two in this class, or because // they are not Java programming language keywords static final int BRIDGE = 0x00000040; static final int VARARGS = 0x00000080; static final int SYNTHETIC = 0x00001000; static final int ANNOTATION = 0x00002000; static final int ENUM = 0x00004000; static final int MANDATED = 0x00008000; static boolean isSynthetic(int mod) { return (mod & SYNTHETIC) != 0; } static boolean isMandated(int mod) { return (mod & MANDATED) != 0; } // Note on the FOO_MODIFIERS fields and fooModifiers() methods: // the sets of modifiers are not guaranteed to be constants // across time and Java SE releases. Therefore, it would not be // appropriate to expose an external interface to this information // that would allow the values to be treated as Java-level // constants since the values could be constant folded and updates // to the sets of modifiers missed. Thus, the fooModifiers() // methods return an unchanging values for a given release, but a // value that can potentially change over time. /** * The Java source modifiers that can be applied to a class. * @jls 8.1.1 Class Modifiers */ private static final int CLASS_MODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC | Modifier.FINAL | Modifier.STRICT; /** * The Java source modifiers that can be applied to an interface. * @jls 9.1.1 Interface Modifiers */ private static final int INTERFACE_MODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC | Modifier.STRICT; /** * The Java source modifiers that can be applied to a constructor. * @jls 8.8.3 Constructor Modifiers */ private static final int CONSTRUCTOR_MODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE; /** * The Java source modifiers that can be applied to a method. * @jls 8.4.3 Method Modifiers */ private static final int METHOD_MODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC | Modifier.FINAL | Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.STRICT; /** * The Java source modifiers that can be applied to a field. * @jls 8.3.1 Field Modifiers */ private static final int FIELD_MODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL | Modifier.TRANSIENT | Modifier.VOLATILE; /** * The Java source modifiers that can be applied to a method or constructor parameter. * @jls 8.4.1 Formal Parameters */ private static final int PARAMETER_MODIFIERS = Modifier.FINAL; static final int ACCESS_MODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE; /** * Return an {@code int} value OR-ing together the source language * modifiers that can be applied to a class. * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a class. * * @jls 8.1.1 Class Modifiers * @since 1.7 */ public static int classModifiers() { return CLASS_MODIFIERS; } /** * Return an {@code int} value OR-ing together the source language * modifiers that can be applied to an interface. * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to an interface. * * @jls 9.1.1 Interface Modifiers * @since 1.7 */ public static int interfaceModifiers() { return INTERFACE_MODIFIERS; } /** * Return an {@code int} value OR-ing together the source language * modifiers that can be applied to a constructor. * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a constructor. * * @jls 8.8.3 Constructor Modifiers * @since 1.7 */ public static int constructorModifiers() { return CONSTRUCTOR_MODIFIERS; } /** * Return an {@code int} value OR-ing together the source language * modifiers that can be applied to a method. * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a method. * * @jls 8.4.3 Method Modifiers * @since 1.7 */ public static int methodModifiers() { return METHOD_MODIFIERS; } /** * Return an {@code int} value OR-ing together the source language * modifiers that can be applied to a field. * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a field. * * @jls 8.3.1 Field Modifiers * @since 1.7 */ public static int fieldModifiers() { return FIELD_MODIFIERS; } /** * Return an {@code int} value OR-ing together the source language * modifiers that can be applied to a parameter. * @return an {@code int} value OR-ing together the source language * modifiers that can be applied to a parameter. * * @jls 8.4.1 Formal Parameters * @since 1.8 */ public static int parameterModifiers() { return PARAMETER_MODIFIERS; } }
a741a5ea661c803a3fdde32c72b2148ad576d28a
5024c8aab5936941dbffa81eb4002f71759d2732
/ChatClient/MouseConnectEvent.java
5eb2e6f965257a3e1349de85e5a2ce816c6802b2
[]
no_license
Palethorn/JChat
e1c0e1b82235856dc448a020d60d542edeb115d8
37d0fff874acec2db9c6220523f14d67df523bf3
refs/heads/master
2016-09-10T08:22:20.159153
2012-07-07T11:20:24
2012-07-07T11:20:24
3,113,143
2
0
null
null
null
null
UTF-8
Java
false
false
867
java
package app.ChatClient; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; public class MouseConnectEvent implements MouseListener { Singleton singleton; public MouseConnectEvent() { singleton = Singleton.Instance(); } @Override public void mouseClicked(MouseEvent e) { singleton.dispatchConnectEvent(); } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } }