blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2840a88e9905eea6a81870d8270902725a2a669b | 3ac41d822285472942ec23221639764cc35243ea | /src/Main.java | 5c3f016fa7f478d8a11370ab27d30d09a5d581e3 | [] | no_license | mfallq/SudokuSolver | 0212b34c689989c9132102d5921006e8aad64de1 | f0d334ca3c479d4c48094d1a9dbcc578408ed74d | refs/heads/master | 2023-05-11T18:45:59.191720 | 2019-01-16T13:21:29 | 2019-01-16T13:21:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | import main.classes.Puzzle;
import main.classes.PuzzleImp;
// Created by Marcus F 20190114
// Sudoku solver based on KTH paper found at:
// https://www.kth.se/social/files/58861771f276547fe1dbf8d1/HLaestanderMHarrysson_dkand14.pdf
public class Main {
public static void main(String[] args){
Puzzle myPuzzle = new PuzzleImp();
String path = "G:\\Arbete\\Git\\SudokuSolver\\Data\\"; //puzzles.txt";
myPuzzle.load(path+"puzzle2.txt");
myPuzzle.solve();
myPuzzle.isSolved();
myPuzzle.save(path+"solution.txt");
}
}
| [
"marfa861@student.liu.se"
] | marfa861@student.liu.se |
75cd0dfd74ab04b58fe72bf254c0954eda2fb411 | b71cad13baef2f69fc118c6ab36990d80aad2c77 | /task3/src/main/java/controller/Observable.java | c7ca22e0f905f95f80117b70121abaee8577437d | [] | no_license | turlyunef/7404-turlyun | 4b24f4bca7a896db081fb32b734460ac63269cd8 | d59002c984a0526091dedd1d1f12fcbd15c3a01c | refs/heads/master | 2020-05-09T17:17:58.269190 | 2019-07-01T15:24:08 | 2019-07-01T15:24:08 | 181,303,487 | 0 | 0 | null | 2019-05-29T04:25:51 | 2019-04-14T12:10:26 | Java | UTF-8 | Java | false | false | 616 | java | package controller;
import controller.event.Event;
import view.Observer;
public interface Observable {
/**
* Adds the observer object to the observers list for this object.
*
* @param o observer object
*/
void addObserver(Observer o);
/**
* Removes the observer object from the observers list for this object.
*
* @param o observer object
*/
void removeObserver(Observer o);
/**
* Notify all observer objects from the observers list for this object.
*
* @param event event of any changes
*/
void notifyObservers(Event event);
} | [
"turlyunef@mail.ru"
] | turlyunef@mail.ru |
ac035a3205f55a0fb329196307af7eccc7738972 | f53b019e4bf7d573f5203326735a734e996c6e4b | /src/main/java/com/jcq/controller/user/UserForwardPageController.java | a23f6f614012b0080551c780df8a887bcd66dfac | [] | no_license | SuperBaBa/funds_management | 1fd2a8b1593999d8632906ad3913c8d6b9b193d9 | 8448b3b2b837fa453f8ed600bc50c682d71b0bf7 | refs/heads/master | 2021-09-29T05:51:29.952096 | 2021-09-09T09:27:27 | 2021-09-09T09:27:27 | 181,304,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | package com.jcq.controller.user;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.jcq.annotation.Token;
@Controller
@RequestMapping("/user")
public class UserForwardPageController {
/**
* 以下方法均为负责管理员页面跳转
*
* @return
*/
// 跳转到管理员界面主页
@RequestMapping("/index")
public String index() {
return "user/index";
}
// 查看交易记录视图
@RequestMapping("/lookDealRecord")
public String lookDealRecord() {
return "user/lookDealRecord";
}
// 修改密码视图
@RequestMapping("/updatePassword")
public String updatePassword() {
return "user/updatePassword";
}
// 存款视图
@RequestMapping("/deposit")
@Token(save=true)
public String deposit() {
return "user/deposit";
}
// 取款视图
@RequestMapping("/withdrawa")
@Token(save=true)
public String withdrawa() {
return "user/withdrawa";
}
// 转账视图
@RequestMapping("/transfer")
@Token(save=true)
public String transfer() {
return "user/transfer";
}
// 查看个人信息视图
@RequestMapping("/lookInfo")
public String lookInfo() {
return "user/lookInfo";
}
// 修改个人信息视图
@RequestMapping("/updateInfo")
public String updateInfo() {
return "user/updateInfo";
}
// 跳转到管理员界面主页
@RequestMapping("/userNewsList")
public String userNewsList() {
return "user/userNewsList";
}
}
| [
"LovelyTrump@outlook.com"
] | LovelyTrump@outlook.com |
887af46b848d522fddb718777d7ed5ae7291f2df | 8ca6e479395bec198c1f461ead3f72b7c7350f94 | /my-Oauth2/src/main/java/com/gk/oauth/menu/domain/SysMenu.java | c788e01721b9392c08a17c73b26405cf82423714 | [] | no_license | yibing0703/JinMenCaiJing | 4ef6ea87bd57d5e8ba6b0198e59824316cf685dc | 3b80a5ce1aa1efe63c60a6e0961fa6c01ae8bbc2 | refs/heads/master | 2023-08-22T14:52:45.183477 | 2021-09-30T10:01:45 | 2021-09-30T10:01:45 | 422,866,190 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,299 | java | package com.gk.oauth.menu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 菜单权限表
* </p>
*
* @author guokui
* @since 2021-06-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_menu")
public class SysMenu extends Model<SysMenu> {
private static final long serialVersionUID = 1L;
/**
* 菜单ID
*/
@TableId(value = "menu_id", type = IdType.AUTO)
private Long menuId;
/**
* 菜单名称
*/
@TableField("menu_name")
private String menuName;
/**
* 父菜单ID
*/
@TableField("parent_id")
private Long parentId;
/**
* 显示顺序
*/
@TableField("order_num")
private Integer orderNum;
/**
* 请求地址
*/
@TableField("url")
private String url;
/**
* 打开方式(menuItem页签 menuBlank新窗口)
*/
@TableField("target")
private String target;
/**
* 菜单类型(M目录 C菜单 F按钮)
*/
@TableField("menu_type")
private String menuType;
/**
* 菜单状态(0显示 1隐藏)
*/
@TableField("visible")
private String visible;
/**
* 权限标识
*/
@TableField("perms")
private String perms;
/**
* 菜单图标
*/
@TableField("icon")
private String icon;
/**
* 创建者
*/
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@TableField("create_time")
private Date createTime;
/**
* 更新者
*/
@TableField("update_by")
private String updateBy;
/**
* 更新时间
*/
@TableField("update_time")
private Date updateTime;
/**
* 备注
*/
@TableField("remark")
private String remark;
@Override
protected Serializable pkVal() {
return this.menuId;
}
}
| [
"15637521598@163.com"
] | 15637521598@163.com |
c07b437f87355b0bea61d91f462ca92d1054b626 | 7b1e49424c3098d4e4850f290e39e6fb55964678 | /src/com/akjava/gwt/androidhtml5/client/DataUrlDropDockRootPanel.java | f8a5a3664741a6de89bfcace061cd955ebb669cb | [
"Apache-2.0"
] | permissive | akjava/gwthtml5apps | 8e1fb948b2999c1c15bc741d68bb004159539cdf | 1c594672547f3aef4076ece7c58c7d5c6f19e9ec | refs/heads/master | 2020-04-15T17:31:51.241105 | 2016-05-30T23:57:43 | 2016-05-30T23:57:43 | 19,660,816 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,482 | java | package com.akjava.gwt.androidhtml5.client;
import com.akjava.gwt.html5.client.file.File;
import com.akjava.gwt.html5.client.file.FileHandler;
import com.akjava.gwt.html5.client.file.FileReader;
import com.akjava.gwt.lib.client.LogUtils;
import com.google.common.base.Predicate;
import com.google.gwt.dom.client.Style.Unit;
/*
*
* this is usefull when do nothing drop rootPanel
*/
/**
* @deprecated use common
* @author aki
*
*/
public abstract class DataUrlDropDockRootPanel extends DropDockRootPanel{
public DataUrlDropDockRootPanel(Unit unit,boolean addRootLayoutPanel) {
super(unit,addRootLayoutPanel);
}
private Predicate<File> filePredicate;
public Predicate<File> getFilePredicate() {
return filePredicate;
}
public void setFilePredicate(Predicate<File> filePredicate) {
this.filePredicate = filePredicate;
}
@Override
public void callback(final File file, String parent) {
if(file==null){
return;
}
if(filePredicate!=null && !filePredicate.apply(file)){
return;
}
//LogUtils.log(file+","+parent);
final FileReader reader = FileReader.createFileReader();
reader.setOnLoad(new FileHandler() {
@Override
public void onLoad() {
String dataUrl=reader.getResultAsString();
loadFile(file, dataUrl);
}
});
if(file!=null){
reader.readAsDataURL(file);
}
}
public abstract void loadFile(final File file,final String dataUrl);
}
| [
"aki@xps"
] | aki@xps |
b356d94c7fd34b29c8ca00ebb7e1d39d8ba13013 | 17e8438486cb3e3073966ca2c14956d3ba9209ea | /dso/branches/nonstop/dso-l2/src/main/java/com/tc/objectserver/impl/CanCancel.java | 955a37e7ae4499a917dd88736d491f951b3eca1b | [] | no_license | sirinath/Terracotta | fedfc2c4f0f06c990f94b8b6c3b9c93293334345 | 00a7662b9cf530dfdb43f2dd821fa559e998c892 | refs/heads/master | 2021-01-23T05:41:52.414211 | 2015-07-02T15:21:54 | 2015-07-02T15:21:54 | 38,613,711 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 255 | java | /*
* All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
*/
package com.tc.objectserver.impl;
import java.util.concurrent.Callable;
/**
*
* @author mscott
*/
public interface CanCancel {
boolean cancel();
}
| [
"asingh@7fc7bbf3-cf45-46d4-be06-341739edd864"
] | asingh@7fc7bbf3-cf45-46d4-be06-341739edd864 |
5463e316661605d6a713aa1ed84740b51845b5c5 | 167576a3f25e95f82103500134fb0e6c14f8f893 | /android/app/src/main/java/com/union_test/toutiao/activity/NativeExpressActivity.java | 7ebb7b71aed95360d9aeb7cc4831acc135979659 | [] | no_license | gdchent/RnCallNativeAdvice | be34439bdd73ffa37e6aece6e4b7f4ac98a58a94 | e1a7ed52441172fb07508e23897abf362b6ce0fe | refs/heads/master | 2023-01-16T06:20:51.213820 | 2019-09-24T07:48:21 | 2019-09-24T07:48:21 | 209,363,750 | 0 | 0 | null | 2023-01-04T10:43:08 | 2019-09-18T17:12:22 | Java | UTF-8 | Java | false | false | 9,563 | java | package com.union_test.toutiao.activity;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.Toast;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.FilterWord;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdDislike;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import com.rncallnativeadvice.R;
import com.union_test.toutiao.config.TTAdManagerHolder;
import com.union_test.toutiao.dialog.DislikeDialog;
import com.union_test.toutiao.utils.TToast;
import java.util.List;
@SuppressWarnings("unused")
public class NativeExpressActivity extends Activity {
private TTAdNative mTTAdNative;
private FrameLayout mExpressContainer;
private Context mContext;
private TTAdDislike mTTAdDislike;
private Button mButtonLoadAd;
private EditText mEtWidth;
private EditText mEtHeight;
private TTNativeExpressAd mTTAd;
@SuppressWarnings("RedundantCast")
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
setContentView(R.layout.activity_native_express);
mContext = this.getApplicationContext();
mExpressContainer = (FrameLayout) findViewById(R.id.express_container);
mButtonLoadAd = (Button) findViewById(R.id.btn_express_load);
mEtHeight = (EditText) findViewById(R.id.express_height);
mEtWidth = (EditText) findViewById(R.id.express_width);
mButtonLoadAd.setOnClickListener(mClickListener);
//step2:创建TTAdNative对象,createAdNative(Context context) banner广告context需要传入Activity对象
mTTAdNative = TTAdManagerHolder.get().createAdNative(this);
//step3:(可选,强烈建议在合适的时机调用):申请部分权限,如read_phone_state,防止获取不了imei时候,下载类广告没有填充的问题。
TTAdManagerHolder.get().requestPermissionIfNecessary(this);
}
@SuppressWarnings("EmptyMethod")
@Override
protected void onResume() {
super.onResume();
}
private final View.OnClickListener mClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getId() == R.id.btn_express_load) {
loadExpressAd("901121253");
}
}
};
private void loadExpressAd(String codeId) {
mExpressContainer.removeAllViews();
float expressViewWidth = 350;
float expressViewHeight = 350;
try{
expressViewWidth = Float.parseFloat(mEtWidth.getText().toString());
expressViewHeight = Float.parseFloat(mEtHeight.getText().toString());
}catch (Exception e){
expressViewHeight = 0; //高度设置为0,则高度会自适应
}
//step4:创建广告请求参数AdSlot,具体参数含义参考文档
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(codeId) //广告位id
.setSupportDeepLink(true)
.setAdCount(1) //请求广告数量为1到3条
.setExpressViewAcceptedSize(expressViewWidth,expressViewHeight) //期望模板广告view的size,单位dp
.setImageAcceptedSize(640,320 )//这个参数设置即可,不影响模板广告的size
.build();
//step5:请求广告,对请求回调的广告作渲染处理
mTTAdNative.loadNativeExpressAd(adSlot, new TTAdNative.NativeExpressAdListener() {
@Override
public void onError(int code, String message) {
TToast.show(NativeExpressActivity.this, "load error : " + code + ", " + message);
mExpressContainer.removeAllViews();
}
@Override
public void onNativeExpressAdLoad(List<TTNativeExpressAd> ads) {
if (ads == null || ads.size() == 0){
return;
}
mTTAd = ads.get(0);
bindAdListener(mTTAd);
startTime = System.currentTimeMillis();
mTTAd.render();
}
});
}
private long startTime = 0;
private boolean mHasShowDownloadActive = false;
private void bindAdListener(TTNativeExpressAd ad) {
ad.setExpressInteractionListener(new TTNativeExpressAd.ExpressAdInteractionListener() {
@Override
public void onAdClicked(View view, int type) {
TToast.show(mContext, "广告被点击");
}
@Override
public void onAdShow(View view, int type) {
TToast.show(mContext, "广告展示");
}
@Override
public void onRenderFail(View view, String msg, int code) {
Log.e("ExpressView","render fail:"+(System.currentTimeMillis() - startTime));
TToast.show(mContext, msg+" code:"+code);
}
@Override
public void onRenderSuccess(View view, float width, float height) {
Log.e("ExpressView","render suc:"+(System.currentTimeMillis() - startTime));
//返回view的宽高 单位 dp
TToast.show(mContext, "渲染成功");
mExpressContainer.removeAllViews();
mExpressContainer.addView(view);
}
});
//dislike设置
bindDislike(ad, false);
if (ad.getInteractionType() != TTAdConstant.INTERACTION_TYPE_DOWNLOAD){
return;
}
ad.setDownloadListener(new TTAppDownloadListener() {
@Override
public void onIdle() {
TToast.show(NativeExpressActivity.this, "点击开始下载", Toast.LENGTH_LONG);
}
@Override
public void onDownloadActive(long totalBytes, long currBytes, String fileName, String appName) {
if (!mHasShowDownloadActive) {
mHasShowDownloadActive = true;
TToast.show(NativeExpressActivity.this, "下载中,点击暂停", Toast.LENGTH_LONG);
}
}
@Override
public void onDownloadPaused(long totalBytes, long currBytes, String fileName, String appName) {
TToast.show(NativeExpressActivity.this, "下载暂停,点击继续", Toast.LENGTH_LONG);
}
@Override
public void onDownloadFailed(long totalBytes, long currBytes, String fileName, String appName) {
TToast.show(NativeExpressActivity.this, "下载失败,点击重新下载", Toast.LENGTH_LONG);
}
@Override
public void onInstalled(String fileName, String appName) {
TToast.show(NativeExpressActivity.this, "安装完成,点击图片打开", Toast.LENGTH_LONG);
}
@Override
public void onDownloadFinished(long totalBytes, String fileName, String appName) {
TToast.show(NativeExpressActivity.this, "点击安装", Toast.LENGTH_LONG);
}
});
}
/**
* 设置广告的不喜欢,注意:强烈建议设置该逻辑,如果不设置dislike处理逻辑,则模板广告中的 dislike区域不响应dislike事件。
* @param ad
* @param customStyle 是否自定义样式,true:样式自定义
*/
private void bindDislike(TTNativeExpressAd ad, boolean customStyle) {
if (customStyle) {
//使用自定义样式
List<FilterWord> words = ad.getFilterWords();
if (words == null || words.isEmpty()) {
return;
}
final DislikeDialog dislikeDialog = new DislikeDialog(this, words);
dislikeDialog.setOnDislikeItemClick(new DislikeDialog.OnDislikeItemClick() {
@Override
public void onItemClick(FilterWord filterWord) {
//屏蔽广告
TToast.show(mContext, "点击 " + filterWord.getName());
//用户选择不喜欢原因后,移除广告展示
mExpressContainer.removeAllViews();
}
});
ad.setDislikeDialog(dislikeDialog);
return;
}
//使用默认模板中默认dislike弹出样式
ad.setDislikeCallback(NativeExpressActivity.this, new TTAdDislike.DislikeInteractionCallback() {
@Override
public void onSelected(int position, String value) {
TToast.show(mContext, "点击 " + value);
//用户选择不喜欢原因后,移除广告展示
mExpressContainer.removeAllViews();
}
@Override
public void onCancel() {
TToast.show(mContext, "点击取消 ");
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mTTAd != null) {
mTTAd.destroy();
}
}
}
| [
"294446993@qq.com"
] | 294446993@qq.com |
5815db46616e4ea96e1a20062c9698fad9a81154 | 67025324397dee1d6c21c1f34d25ec908f567484 | /src/main/java/es/unizar/tmdad/lab0/JwtFilter.java | 9dd29eb2182d3d8d6183034fe494f20d067d0701 | [] | no_license | Nefisco/proyectoDistribuidosAPI | 55792bcb8f6d65f16dd2c5bde73e34a387eb7cb9 | ede06c57eeef7d0a495cbff91a8bdb29fc34110c | refs/heads/master | 2021-01-16T22:15:37.615874 | 2016-06-10T07:37:38 | 2016-06-10T07:37:38 | 60,633,752 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,420 | java | package es.unizar.tmdad.lab0;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureException;
import org.springframework.web.filter.GenericFilterBean;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
public class JwtFilter extends GenericFilterBean {
@Override
public void doFilter(final ServletRequest req,
final ServletResponse res,
final FilterChain chain) throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) req;
final String authHeader = request.getHeader("Authorization");
if (authHeader == null || !authHeader.startsWith("Bearer ")) {
throw new ServletException("Missing or invalid Authorization header.");
}
final String token = authHeader.substring(7); // The part after "Bearer "
try {
final Claims claims = Jwts.parser().setSigningKey("secretkey")
.parseClaimsJws(token).getBody();
request.setAttribute("claims", claims);
}
catch (final SignatureException e) {
throw new ServletException("Invalid token.");
}
chain.doFilter(req, res);
}
}
| [
"miguelasedilesdq@gmail.com"
] | miguelasedilesdq@gmail.com |
21552fa0f01d576e8c3cdfe3a50bab49f929c0d4 | c839fd7a600fffedcd795515ee01df55f33837c4 | /themoviedb-model/src/main/java/com/ran/themoviedb/model/server/entities/ReviewsDetail.java | 9568d4639d6d9975894d47b0f739e3d1ced70969 | [] | no_license | Ranjith49/themovedb.org-android | 6fd8418d0567ed7f5b452fec44549e54c072e554 | 42622e9cefb196ce4c07fe3ae6bd6690626148e9 | refs/heads/master | 2021-01-19T19:26:55.582049 | 2017-09-06T14:10:33 | 2017-09-06T14:10:33 | 48,882,673 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | package com.ran.themoviedb.model.server.entities;
import java.io.Serializable;
/**
* Created by ranjith.suda on 1/6/2016.
*/
public class ReviewsDetail implements Serializable {
String id;
String author;
String content;
String url;
public String getId() {
return id;
}
public String getAuthor() {
return author;
}
public String getContent() {
return content;
}
public String getUrl() {
return url;
}
}
| [
"ranjith.suda@verse.in"
] | ranjith.suda@verse.in |
b2de14e1992f54b94eb1c8d0f4cc7aaa2bcef35b | 8ad1a132c6943ac33b2fcfd8abbe163a09a08757 | /HW1/src/hw1_3_3/Main.java | a5ade8d37a09d8f94385b30e1beac8d148a80320 | [] | no_license | deluxturtle/CSE205 | f22b92a7fdacd8a5e469e8dbb6f27f492ed16498 | b662991f6c23dba689fd58000df049ff1a6e3207 | refs/heads/master | 2020-04-01T11:43:16.393901 | 2018-11-01T23:04:30 | 2018-11-01T23:04:30 | 153,173,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package hw1_3_3;
import java.util.ArrayList;
/*
* @author: Andrew Seba
*/
public class Main {
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(-1);
list.add(3);
list.add(-5);
int negativeCount = 0;
for(int i = 0; i < list.size(); i++)
{
if(list.get(i) < 0)
{
negativeCount += 1;
}
}
System.out.print(negativeCount);
}
}
| [
"sebaturtle@gmail.com"
] | sebaturtle@gmail.com |
ca0a01d0ab853b3e95328ec0f2d6ab07eb74c4cc | ea901cd660ab606a0adcbaae0f2ba3de39fa376f | /src/main/java/es/cabsa/javadevelopers/Application.java | c611d3619ca4508d661977e8fcd71f46b412ba73 | [] | no_license | ernestpd85/javadevelopers-master | 616220079cece844790df7d185d97b25ae7dac4b | 5e4066dda6e4cda43d411e0e7c2f3d077394a190 | refs/heads/master | 2023-08-16T07:39:18.270803 | 2021-09-23T18:25:03 | 2021-09-23T18:25:03 | 409,700,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,295 | java | package es.cabsa.javadevelopers;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import es.cabsa.javadevelopers.controller.Constants;
import es.cabsa.javadevelopers.controller.JungleController;
import es.cabsa.javadevelopers.es.cabsa.javadevelopers.dto.AnimalDTO;
import es.cabsa.javadevelopers.es.cabsa.javadevelopers.dto.FoodDTO;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
@SpringBootApplication
public class Application {
public static void main(String[] args) throws IOException {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
System.out.println("Animals in the jungle:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
JungleController.importJsonData();
}
}
| [
"ernestpd@gmail.com"
] | ernestpd@gmail.com |
6dfbbc961a474835ca9302d805924c19e8fceb31 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/aosp-mirror--platform_frameworks_base/e95c3cd89591ba586aa8a0f7a17660c6fb8770bc/after/DisplayPowerController.java | aeec59b6ad3bc11a3147bb330b2a42289d9077a0 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 38,305 | java | /*
* Copyright (C) 2012 The Android Open Source Project
*
* 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.android.server.display;
import com.android.internal.app.IBatteryStats;
import com.android.server.LocalServices;
import com.android.server.am.BatteryStatsService;
import com.android.server.lights.LightsManager;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.hardware.display.DisplayManagerInternal.DisplayPowerCallbacks;
import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.SystemClock;
import android.text.format.DateUtils;
import android.util.MathUtils;
import android.util.Slog;
import android.util.Spline;
import android.util.TimeUtils;
import android.view.Display;
import java.io.PrintWriter;
/**
* Controls the power state of the display.
*
* Handles the proximity sensor, light sensor, and animations between states
* including the screen off animation.
*
* This component acts independently of the rest of the power manager service.
* In particular, it does not share any state and it only communicates
* via asynchronous callbacks to inform the power manager that something has
* changed.
*
* Everything this class does internally is serialized on its handler although
* it may be accessed by other threads from the outside.
*
* Note that the power manager service guarantees that it will hold a suspend
* blocker as long as the display is not ready. So most of the work done here
* does not need to worry about holding a suspend blocker unless it happens
* independently of the display ready signal.
*
* For debugging, you can make the electron beam and brightness animations run
* slower by changing the "animator duration scale" option in Development Settings.
*/
final class DisplayPowerController implements AutomaticBrightnessController.Callbacks {
private static final String TAG = "DisplayPowerController";
private static boolean DEBUG = false;
private static final boolean DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT = false;
// If true, uses the electron beam on animation.
// We might want to turn this off if we cannot get a guarantee that the screen
// actually turns on and starts showing new content after the call to set the
// screen state returns. Playing the animation can also be somewhat slow.
private static final boolean USE_ELECTRON_BEAM_ON_ANIMATION = false;
// The minimum reduction in brightness when dimmed.
private static final int SCREEN_DIM_MINIMUM_REDUCTION = 10;
private static final int ELECTRON_BEAM_ON_ANIMATION_DURATION_MILLIS = 250;
private static final int ELECTRON_BEAM_OFF_ANIMATION_DURATION_MILLIS = 400;
private static final int MSG_UPDATE_POWER_STATE = 1;
private static final int MSG_PROXIMITY_SENSOR_DEBOUNCED = 2;
private static final int PROXIMITY_UNKNOWN = -1;
private static final int PROXIMITY_NEGATIVE = 0;
private static final int PROXIMITY_POSITIVE = 1;
// Proximity sensor debounce delay in milliseconds for positive or negative transitions.
private static final int PROXIMITY_SENSOR_POSITIVE_DEBOUNCE_DELAY = 0;
private static final int PROXIMITY_SENSOR_NEGATIVE_DEBOUNCE_DELAY = 250;
// Trigger proximity if distance is less than 5 cm.
private static final float TYPICAL_PROXIMITY_THRESHOLD = 5.0f;
// Brightness animation ramp rate in brightness units per second.
private static final int BRIGHTNESS_RAMP_RATE_FAST = 200;
private static final int BRIGHTNESS_RAMP_RATE_SLOW = 40;
private final Object mLock = new Object();
// Our handler.
private final DisplayControllerHandler mHandler;
// Asynchronous callbacks into the power manager service.
// Only invoked from the handler thread while no locks are held.
private final DisplayPowerCallbacks mCallbacks;
// Battery stats.
private final IBatteryStats mBatteryStats;
// The lights service.
private final LightsManager mLights;
// The sensor manager.
private final SensorManager mSensorManager;
// The display blanker.
private final DisplayBlanker mBlanker;
// The proximity sensor, or null if not available or needed.
private Sensor mProximitySensor;
// The doze screen brightness.
private final int mScreenBrightnessDozeConfig;
// The dim screen brightness.
private final int mScreenBrightnessDimConfig;
// The minimum allowed brightness.
private final int mScreenBrightnessRangeMinimum;
// The maximum allowed brightness.
private final int mScreenBrightnessRangeMaximum;
// True if auto-brightness should be used.
private boolean mUseSoftwareAutoBrightnessConfig;
// True if we should fade the screen while turning it off, false if we should play
// a stylish electron beam animation instead.
private boolean mElectronBeamFadesConfig;
// The pending power request.
// Initially null until the first call to requestPowerState.
// Guarded by mLock.
private DisplayPowerRequest mPendingRequestLocked;
// True if a request has been made to wait for the proximity sensor to go negative.
// Guarded by mLock.
private boolean mPendingWaitForNegativeProximityLocked;
// True if the pending power request or wait for negative proximity flag
// has been changed since the last update occurred.
// Guarded by mLock.
private boolean mPendingRequestChangedLocked;
// Set to true when the important parts of the pending power request have been applied.
// The important parts are mainly the screen state. Brightness changes may occur
// concurrently.
// Guarded by mLock.
private boolean mDisplayReadyLocked;
// Set to true if a power state update is required.
// Guarded by mLock.
private boolean mPendingUpdatePowerStateLocked;
/* The following state must only be accessed by the handler thread. */
// The currently requested power state.
// The power controller will progressively update its internal state to match
// the requested power state. Initially null until the first update.
private DisplayPowerRequest mPowerRequest;
// The current power state.
// Must only be accessed on the handler thread.
private DisplayPowerState mPowerState;
// True if the device should wait for negative proximity sensor before
// waking up the screen. This is set to false as soon as a negative
// proximity sensor measurement is observed or when the device is forced to
// go to sleep by the user. While true, the screen remains off.
private boolean mWaitingForNegativeProximity;
// The actual proximity sensor threshold value.
private float mProximityThreshold;
// Set to true if the proximity sensor listener has been registered
// with the sensor manager.
private boolean mProximitySensorEnabled;
// The debounced proximity sensor state.
private int mProximity = PROXIMITY_UNKNOWN;
// The raw non-debounced proximity sensor state.
private int mPendingProximity = PROXIMITY_UNKNOWN;
private long mPendingProximityDebounceTime = -1; // -1 if fully debounced
// True if the screen was turned off because of the proximity sensor.
// When the screen turns on again, we report user activity to the power manager.
private boolean mScreenOffBecauseOfProximity;
// True if the screen on is being blocked.
private boolean mScreenOnWasBlocked;
// The elapsed real time when the screen on was blocked.
private long mScreenOnBlockStartRealTime;
// True if the screen auto-brightness value is actually being used to
// set the display brightness.
private boolean mUsingScreenAutoBrightness;
// The controller for the automatic brightness level.
private AutomaticBrightnessController mAutomaticBrightnessController;
// Animators.
private ObjectAnimator mElectronBeamOnAnimator;
private ObjectAnimator mElectronBeamOffAnimator;
private RampAnimator<DisplayPowerState> mScreenBrightnessRampAnimator;
/**
* Creates the display power controller.
*/
public DisplayPowerController(Context context,
DisplayPowerCallbacks callbacks, Handler handler,
SensorManager sensorManager, DisplayBlanker blanker) {
mHandler = new DisplayControllerHandler(handler.getLooper());
mCallbacks = callbacks;
mBatteryStats = BatteryStatsService.getService();
mLights = LocalServices.getService(LightsManager.class);
mSensorManager = sensorManager;
mBlanker = blanker;
final Resources resources = context.getResources();
mScreenBrightnessDozeConfig = clampAbsoluteBrightness(resources.getInteger(
com.android.internal.R.integer.config_screenBrightnessDoze));
mScreenBrightnessDimConfig = clampAbsoluteBrightness(resources.getInteger(
com.android.internal.R.integer.config_screenBrightnessDim));
int screenBrightnessRangeMinimum = clampAbsoluteBrightness(Math.min(resources.getInteger(
com.android.internal.R.integer.config_screenBrightnessSettingMinimum),
mScreenBrightnessDimConfig));
mScreenBrightnessRangeMaximum = PowerManager.BRIGHTNESS_ON;
mUseSoftwareAutoBrightnessConfig = resources.getBoolean(
com.android.internal.R.bool.config_automatic_brightness_available);
if (mUseSoftwareAutoBrightnessConfig) {
int[] lux = resources.getIntArray(
com.android.internal.R.array.config_autoBrightnessLevels);
int[] screenBrightness = resources.getIntArray(
com.android.internal.R.array.config_autoBrightnessLcdBacklightValues);
int lightSensorWarmUpTimeConfig = resources.getInteger(
com.android.internal.R.integer.config_lightSensorWarmupTime);
Spline screenAutoBrightnessSpline = createAutoBrightnessSpline(lux, screenBrightness);
if (screenAutoBrightnessSpline == null) {
Slog.e(TAG, "Error in config.xml. config_autoBrightnessLcdBacklightValues "
+ "(size " + screenBrightness.length + ") "
+ "must be monotic and have exactly one more entry than "
+ "config_autoBrightnessLevels (size " + lux.length + ") "
+ "which must be strictly increasing. "
+ "Auto-brightness will be disabled.");
mUseSoftwareAutoBrightnessConfig = false;
} else {
if (screenBrightness[0] < screenBrightnessRangeMinimum) {
screenBrightnessRangeMinimum = clampAbsoluteBrightness(screenBrightness[0]);
}
mAutomaticBrightnessController = new AutomaticBrightnessController(this,
handler.getLooper(), sensorManager, screenAutoBrightnessSpline,
lightSensorWarmUpTimeConfig, screenBrightnessRangeMinimum,
mScreenBrightnessRangeMaximum);
}
}
mScreenBrightnessRangeMinimum = screenBrightnessRangeMinimum;
mElectronBeamFadesConfig = resources.getBoolean(
com.android.internal.R.bool.config_animateScreenLights);
if (!DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT) {
mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
if (mProximitySensor != null) {
mProximityThreshold = Math.min(mProximitySensor.getMaximumRange(),
TYPICAL_PROXIMITY_THRESHOLD);
}
}
}
/**
* Returns true if the proximity sensor screen-off function is available.
*/
public boolean isProximitySensorAvailable() {
return mProximitySensor != null;
}
/**
* Requests a new power state.
* The controller makes a copy of the provided object and then
* begins adjusting the power state to match what was requested.
*
* @param request The requested power state.
* @param waitForNegativeProximity If true, issues a request to wait for
* negative proximity before turning the screen back on, assuming the screen
* was turned off by the proximity sensor.
* @return True if display is ready, false if there are important changes that must
* be made asynchronously (such as turning the screen on), in which case the caller
* should grab a wake lock, watch for {@link Callbacks#onStateChanged()} then try
* the request again later until the state converges.
*/
public boolean requestPowerState(DisplayPowerRequest request,
boolean waitForNegativeProximity) {
if (DEBUG) {
Slog.d(TAG, "requestPowerState: "
+ request + ", waitForNegativeProximity=" + waitForNegativeProximity);
}
synchronized (mLock) {
boolean changed = false;
if (waitForNegativeProximity
&& !mPendingWaitForNegativeProximityLocked) {
mPendingWaitForNegativeProximityLocked = true;
changed = true;
}
if (mPendingRequestLocked == null) {
mPendingRequestLocked = new DisplayPowerRequest(request);
changed = true;
} else if (!mPendingRequestLocked.equals(request)) {
mPendingRequestLocked.copyFrom(request);
changed = true;
}
if (changed) {
mDisplayReadyLocked = false;
}
if (changed && !mPendingRequestChangedLocked) {
mPendingRequestChangedLocked = true;
sendUpdatePowerStateLocked();
}
return mDisplayReadyLocked;
}
}
private void sendUpdatePowerState() {
synchronized (mLock) {
sendUpdatePowerStateLocked();
}
}
private void sendUpdatePowerStateLocked() {
if (!mPendingUpdatePowerStateLocked) {
mPendingUpdatePowerStateLocked = true;
Message msg = mHandler.obtainMessage(MSG_UPDATE_POWER_STATE);
msg.setAsynchronous(true);
mHandler.sendMessage(msg);
}
}
private void initialize() {
// Initialize the power state object for the default display.
// In the future, we might manage multiple displays independently.
mPowerState = new DisplayPowerState(mBlanker,
mLights.getLight(LightsManager.LIGHT_ID_BACKLIGHT),
new ElectronBeam(Display.DEFAULT_DISPLAY));
mElectronBeamOnAnimator = ObjectAnimator.ofFloat(
mPowerState, DisplayPowerState.ELECTRON_BEAM_LEVEL, 0.0f, 1.0f);
mElectronBeamOnAnimator.setDuration(ELECTRON_BEAM_ON_ANIMATION_DURATION_MILLIS);
mElectronBeamOnAnimator.addListener(mAnimatorListener);
mElectronBeamOffAnimator = ObjectAnimator.ofFloat(
mPowerState, DisplayPowerState.ELECTRON_BEAM_LEVEL, 1.0f, 0.0f);
mElectronBeamOffAnimator.setDuration(ELECTRON_BEAM_OFF_ANIMATION_DURATION_MILLIS);
mElectronBeamOffAnimator.addListener(mAnimatorListener);
mScreenBrightnessRampAnimator = new RampAnimator<DisplayPowerState>(
mPowerState, DisplayPowerState.SCREEN_BRIGHTNESS);
// Initialize screen state for battery stats.
try {
mBatteryStats.noteScreenState(mPowerState.getScreenState());
mBatteryStats.noteScreenBrightness(mPowerState.getScreenBrightness());
} catch (RemoteException ex) {
// same process
}
}
private final Animator.AnimatorListener mAnimatorListener = new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
sendUpdatePowerState();
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
};
private void updatePowerState() {
// Update the power state request.
final boolean mustNotify;
boolean mustInitialize = false;
boolean wasDimOrDoze = false;
synchronized (mLock) {
mPendingUpdatePowerStateLocked = false;
if (mPendingRequestLocked == null) {
return; // wait until first actual power request
}
if (mPowerRequest == null) {
mPowerRequest = new DisplayPowerRequest(mPendingRequestLocked);
mWaitingForNegativeProximity = mPendingWaitForNegativeProximityLocked;
mPendingWaitForNegativeProximityLocked = false;
mPendingRequestChangedLocked = false;
mustInitialize = true;
} else if (mPendingRequestChangedLocked) {
wasDimOrDoze = (mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DIM
|| mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DOZE);
mPowerRequest.copyFrom(mPendingRequestLocked);
mWaitingForNegativeProximity |= mPendingWaitForNegativeProximityLocked;
mPendingWaitForNegativeProximityLocked = false;
mPendingRequestChangedLocked = false;
mDisplayReadyLocked = false;
}
mustNotify = !mDisplayReadyLocked;
}
// Initialize things the first time the power state is changed.
if (mustInitialize) {
initialize();
}
// Apply the proximity sensor.
if (mProximitySensor != null) {
if (mPowerRequest.useProximitySensor
&& mPowerRequest.screenState != DisplayPowerRequest.SCREEN_STATE_OFF) {
setProximitySensorEnabled(true);
if (!mScreenOffBecauseOfProximity
&& mProximity == PROXIMITY_POSITIVE) {
mScreenOffBecauseOfProximity = true;
sendOnProximityPositiveWithWakelock();
}
} else if (mWaitingForNegativeProximity
&& mScreenOffBecauseOfProximity
&& mProximity == PROXIMITY_POSITIVE
&& mPowerRequest.screenState != DisplayPowerRequest.SCREEN_STATE_OFF) {
setProximitySensorEnabled(true);
} else {
setProximitySensorEnabled(false);
mWaitingForNegativeProximity = false;
}
if (mScreenOffBecauseOfProximity
&& mProximity != PROXIMITY_POSITIVE) {
mScreenOffBecauseOfProximity = false;
sendOnProximityNegativeWithWakelock();
}
} else {
mWaitingForNegativeProximity = false;
}
// Turn on the light sensor if needed.
if (mAutomaticBrightnessController != null) {
mAutomaticBrightnessController.updatePowerState(mPowerRequest);
}
// Set the screen brightness.
if (mPowerRequest.wantScreenOnAny()) {
int target;
boolean slow;
int screenAutoBrightness = mAutomaticBrightnessController != null ?
mAutomaticBrightnessController.getAutomaticScreenBrightness() : -1;
if (screenAutoBrightness >= 0 && mPowerRequest.useAutoBrightness) {
// Use current auto-brightness value.
target = screenAutoBrightness;
slow = mUsingScreenAutoBrightness;
mUsingScreenAutoBrightness = true;
} else {
// Light sensor is disabled or not ready yet.
// Use the current brightness setting from the request, which is expected
// provide a nominal default value for the case where auto-brightness
// is not ready yet.
target = mPowerRequest.screenBrightness;
slow = false;
mUsingScreenAutoBrightness = false;
}
if (mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DOZE) {
// Dim quickly to the doze state.
target = mScreenBrightnessDozeConfig;
slow = false;
} else if (mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DIM) {
// Dim quickly by at least some minimum amount.
target = Math.min(target - SCREEN_DIM_MINIMUM_REDUCTION,
mScreenBrightnessDimConfig);
slow = false;
} else if (wasDimOrDoze) {
// Brighten quickly.
slow = false;
}
animateScreenBrightness(clampScreenBrightness(target),
slow ? BRIGHTNESS_RAMP_RATE_SLOW : BRIGHTNESS_RAMP_RATE_FAST);
} else {
// Screen is off. Don't bother changing the brightness.
mUsingScreenAutoBrightness = false;
}
// Animate the screen on or off unless blocked.
if (mScreenOffBecauseOfProximity) {
// Screen off due to proximity.
setScreenState(Display.STATE_OFF);
unblockScreenOn();
} else if (mPowerRequest.wantScreenOnAny()) {
// Want screen on.
// Wait for previous off animation to complete beforehand.
// It is relatively short but if we cancel it and switch to the
// on animation immediately then the results are pretty ugly.
if (!mElectronBeamOffAnimator.isStarted()) {
// Turn the screen on. The contents of the screen may not yet
// be visible if the electron beam has not been dismissed because
// its last frame of animation is solid black.
setScreenState(mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DOZE
? Display.STATE_DOZING : Display.STATE_ON);
if (mPowerRequest.blockScreenOn
&& mPowerState.getElectronBeamLevel() == 0.0f) {
blockScreenOn();
} else {
unblockScreenOn();
if (USE_ELECTRON_BEAM_ON_ANIMATION) {
if (!mElectronBeamOnAnimator.isStarted()) {
if (mPowerState.getElectronBeamLevel() == 1.0f) {
mPowerState.dismissElectronBeam();
} else if (mPowerState.prepareElectronBeam(
mElectronBeamFadesConfig ?
ElectronBeam.MODE_FADE :
ElectronBeam.MODE_WARM_UP)) {
mElectronBeamOnAnimator.start();
} else {
mElectronBeamOnAnimator.end();
}
}
} else {
mPowerState.setElectronBeamLevel(1.0f);
mPowerState.dismissElectronBeam();
}
}
}
} else {
// Want screen off.
// Wait for previous on animation to complete beforehand.
unblockScreenOn();
if (!mElectronBeamOnAnimator.isStarted()) {
if (!mElectronBeamOffAnimator.isStarted()) {
if (mPowerState.getElectronBeamLevel() == 0.0f) {
setScreenState(Display.STATE_OFF);
} else if (mPowerState.prepareElectronBeam(
mElectronBeamFadesConfig ?
ElectronBeam.MODE_FADE :
ElectronBeam.MODE_COOL_DOWN)
&& mPowerState.getScreenState() != Display.STATE_OFF) {
mElectronBeamOffAnimator.start();
} else {
mElectronBeamOffAnimator.end();
}
}
}
}
// Report whether the display is ready for use.
// We mostly care about the screen state here, ignoring brightness changes
// which will be handled asynchronously.
if (mustNotify
&& !mScreenOnWasBlocked
&& !mElectronBeamOnAnimator.isStarted()
&& !mElectronBeamOffAnimator.isStarted()
&& mPowerState.waitUntilClean(mCleanListener)) {
synchronized (mLock) {
if (!mPendingRequestChangedLocked) {
mDisplayReadyLocked = true;
if (DEBUG) {
Slog.d(TAG, "Display ready!");
}
}
}
sendOnStateChangedWithWakelock();
}
}
@Override
public void updateBrightness() {
sendUpdatePowerState();
}
private void blockScreenOn() {
if (!mScreenOnWasBlocked) {
mScreenOnWasBlocked = true;
mScreenOnBlockStartRealTime = SystemClock.elapsedRealtime();
if (DEBUG) {
Slog.d(TAG, "Blocked screen on.");
}
}
}
private void unblockScreenOn() {
if (mScreenOnWasBlocked) {
mScreenOnWasBlocked = false;
long delay = SystemClock.elapsedRealtime() - mScreenOnBlockStartRealTime;
if (delay > 1000 || DEBUG) {
Slog.d(TAG, "Unblocked screen on after " + delay + " ms");
}
}
}
private void setScreenState(int state) {
if (mPowerState.getScreenState() != state) {
mPowerState.setScreenState(state);
try {
mBatteryStats.noteScreenState(state);
} catch (RemoteException ex) {
// same process
}
}
}
private int clampScreenBrightness(int value) {
return MathUtils.constrain(
value, mScreenBrightnessRangeMinimum, mScreenBrightnessRangeMaximum);
}
private void animateScreenBrightness(int target, int rate) {
if (mScreenBrightnessRampAnimator.animateTo(target, rate)) {
try {
mBatteryStats.noteScreenBrightness(target);
} catch (RemoteException ex) {
// same process
}
}
}
private final Runnable mCleanListener = new Runnable() {
@Override
public void run() {
sendUpdatePowerState();
}
};
private void setProximitySensorEnabled(boolean enable) {
if (enable) {
if (!mProximitySensorEnabled) {
// Register the listener.
// Proximity sensor state already cleared initially.
mProximitySensorEnabled = true;
mSensorManager.registerListener(mProximitySensorListener, mProximitySensor,
SensorManager.SENSOR_DELAY_NORMAL, mHandler);
}
} else {
if (mProximitySensorEnabled) {
// Unregister the listener.
// Clear the proximity sensor state for next time.
mProximitySensorEnabled = false;
mProximity = PROXIMITY_UNKNOWN;
mPendingProximity = PROXIMITY_UNKNOWN;
mHandler.removeMessages(MSG_PROXIMITY_SENSOR_DEBOUNCED);
mSensorManager.unregisterListener(mProximitySensorListener);
clearPendingProximityDebounceTime(); // release wake lock (must be last)
}
}
}
private void handleProximitySensorEvent(long time, boolean positive) {
if (mProximitySensorEnabled) {
if (mPendingProximity == PROXIMITY_NEGATIVE && !positive) {
return; // no change
}
if (mPendingProximity == PROXIMITY_POSITIVE && positive) {
return; // no change
}
// Only accept a proximity sensor reading if it remains
// stable for the entire debounce delay. We hold a wake lock while
// debouncing the sensor.
mHandler.removeMessages(MSG_PROXIMITY_SENSOR_DEBOUNCED);
if (positive) {
mPendingProximity = PROXIMITY_POSITIVE;
setPendingProximityDebounceTime(
time + PROXIMITY_SENSOR_POSITIVE_DEBOUNCE_DELAY); // acquire wake lock
} else {
mPendingProximity = PROXIMITY_NEGATIVE;
setPendingProximityDebounceTime(
time + PROXIMITY_SENSOR_NEGATIVE_DEBOUNCE_DELAY); // acquire wake lock
}
// Debounce the new sensor reading.
debounceProximitySensor();
}
}
private void debounceProximitySensor() {
if (mProximitySensorEnabled
&& mPendingProximity != PROXIMITY_UNKNOWN
&& mPendingProximityDebounceTime >= 0) {
final long now = SystemClock.uptimeMillis();
if (mPendingProximityDebounceTime <= now) {
// Sensor reading accepted. Apply the change then release the wake lock.
mProximity = mPendingProximity;
updatePowerState();
clearPendingProximityDebounceTime(); // release wake lock (must be last)
} else {
// Need to wait a little longer.
// Debounce again later. We continue holding a wake lock while waiting.
Message msg = mHandler.obtainMessage(MSG_PROXIMITY_SENSOR_DEBOUNCED);
msg.setAsynchronous(true);
mHandler.sendMessageAtTime(msg, mPendingProximityDebounceTime);
}
}
}
private void clearPendingProximityDebounceTime() {
if (mPendingProximityDebounceTime >= 0) {
mPendingProximityDebounceTime = -1;
mCallbacks.releaseSuspendBlocker(); // release wake lock
}
}
private void setPendingProximityDebounceTime(long debounceTime) {
if (mPendingProximityDebounceTime < 0) {
mCallbacks.acquireSuspendBlocker(); // acquire wake lock
}
mPendingProximityDebounceTime = debounceTime;
}
private void sendOnStateChangedWithWakelock() {
mCallbacks.acquireSuspendBlocker();
mHandler.post(mOnStateChangedRunnable);
}
private final Runnable mOnStateChangedRunnable = new Runnable() {
@Override
public void run() {
mCallbacks.onStateChanged();
mCallbacks.releaseSuspendBlocker();
}
};
private void sendOnProximityPositiveWithWakelock() {
mCallbacks.acquireSuspendBlocker();
mHandler.post(mOnProximityPositiveRunnable);
}
private final Runnable mOnProximityPositiveRunnable = new Runnable() {
@Override
public void run() {
mCallbacks.onProximityPositive();
mCallbacks.releaseSuspendBlocker();
}
};
private void sendOnProximityNegativeWithWakelock() {
mCallbacks.acquireSuspendBlocker();
mHandler.post(mOnProximityNegativeRunnable);
}
private final Runnable mOnProximityNegativeRunnable = new Runnable() {
@Override
public void run() {
mCallbacks.onProximityNegative();
mCallbacks.releaseSuspendBlocker();
}
};
public void dump(final PrintWriter pw) {
synchronized (mLock) {
pw.println();
pw.println("Display Power Controller Locked State:");
pw.println(" mDisplayReadyLocked=" + mDisplayReadyLocked);
pw.println(" mPendingRequestLocked=" + mPendingRequestLocked);
pw.println(" mPendingRequestChangedLocked=" + mPendingRequestChangedLocked);
pw.println(" mPendingWaitForNegativeProximityLocked="
+ mPendingWaitForNegativeProximityLocked);
pw.println(" mPendingUpdatePowerStateLocked=" + mPendingUpdatePowerStateLocked);
}
pw.println();
pw.println("Display Power Controller Configuration:");
pw.println(" mScreenBrightnessDozeConfig=" + mScreenBrightnessDozeConfig);
pw.println(" mScreenBrightnessDimConfig=" + mScreenBrightnessDimConfig);
pw.println(" mScreenBrightnessRangeMinimum=" + mScreenBrightnessRangeMinimum);
pw.println(" mScreenBrightnessRangeMaximum=" + mScreenBrightnessRangeMaximum);
pw.println(" mUseSoftwareAutoBrightnessConfig="
+ mUseSoftwareAutoBrightnessConfig);
mHandler.runWithScissors(new Runnable() {
@Override
public void run() {
dumpLocal(pw);
}
}, 1000);
}
private void dumpLocal(PrintWriter pw) {
pw.println();
pw.println("Display Power Controller Thread State:");
pw.println(" mPowerRequest=" + mPowerRequest);
pw.println(" mWaitingForNegativeProximity=" + mWaitingForNegativeProximity);
pw.println(" mProximitySensor=" + mProximitySensor);
pw.println(" mProximitySensorEnabled=" + mProximitySensorEnabled);
pw.println(" mProximityThreshold=" + mProximityThreshold);
pw.println(" mProximity=" + proximityToString(mProximity));
pw.println(" mPendingProximity=" + proximityToString(mPendingProximity));
pw.println(" mPendingProximityDebounceTime="
+ TimeUtils.formatUptime(mPendingProximityDebounceTime));
pw.println(" mScreenOffBecauseOfProximity=" + mScreenOffBecauseOfProximity);
pw.println(" mUsingScreenAutoBrightness=" + mUsingScreenAutoBrightness);
if (mElectronBeamOnAnimator != null) {
pw.println(" mElectronBeamOnAnimator.isStarted()=" +
mElectronBeamOnAnimator.isStarted());
}
if (mElectronBeamOffAnimator != null) {
pw.println(" mElectronBeamOffAnimator.isStarted()=" +
mElectronBeamOffAnimator.isStarted());
}
if (mPowerState != null) {
mPowerState.dump(pw);
}
if (mAutomaticBrightnessController != null) {
mAutomaticBrightnessController.dump(pw);
}
}
private static String proximityToString(int state) {
switch (state) {
case PROXIMITY_UNKNOWN:
return "Unknown";
case PROXIMITY_NEGATIVE:
return "Negative";
case PROXIMITY_POSITIVE:
return "Positive";
default:
return Integer.toString(state);
}
}
private static Spline createAutoBrightnessSpline(int[] lux, int[] brightness) {
try {
final int n = brightness.length;
float[] x = new float[n];
float[] y = new float[n];
y[0] = normalizeAbsoluteBrightness(brightness[0]);
for (int i = 1; i < n; i++) {
x[i] = lux[i - 1];
y[i] = normalizeAbsoluteBrightness(brightness[i]);
}
Spline spline = Spline.createMonotoneCubicSpline(x, y);
if (DEBUG) {
Slog.d(TAG, "Auto-brightness spline: " + spline);
for (float v = 1f; v < lux[lux.length - 1] * 1.25f; v *= 1.25f) {
Slog.d(TAG, String.format(" %7.1f: %7.1f", v, spline.interpolate(v)));
}
}
return spline;
} catch (IllegalArgumentException ex) {
Slog.e(TAG, "Could not create auto-brightness spline.", ex);
return null;
}
}
private static float normalizeAbsoluteBrightness(int value) {
return (float)clampAbsoluteBrightness(value) / PowerManager.BRIGHTNESS_ON;
}
private static int clampAbsoluteBrightness(int value) {
return MathUtils.constrain(value, PowerManager.BRIGHTNESS_OFF, PowerManager.BRIGHTNESS_ON);
}
private final class DisplayControllerHandler extends Handler {
public DisplayControllerHandler(Looper looper) {
super(looper, null, true /*async*/);
}
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_UPDATE_POWER_STATE:
updatePowerState();
break;
case MSG_PROXIMITY_SENSOR_DEBOUNCED:
debounceProximitySensor();
break;
}
}
}
private final SensorEventListener mProximitySensorListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
if (mProximitySensorEnabled) {
final long time = SystemClock.uptimeMillis();
final float distance = event.values[0];
boolean positive = distance >= 0.0f && distance < mProximityThreshold;
handleProximitySensorEvent(time, positive);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// Not used.
}
};
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
51f5d69a1819e92ae0e1fd9f0c7583131b8a897a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_584fae3f605c654a13434c1aa0a09d51f52a2cc3/MetricRunnable/2_584fae3f605c654a13434c1aa0a09d51f52a2cc3_MetricRunnable_s.java | 3167c5725a060ecec5fb440873f46a01d367b6d0 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,262 | java | package com.bizo.asperatus.jmx;
import java.util.List;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;
import com.bizo.asperatus.jmx.configuration.MetricConfiguration;
import com.bizo.asperatus.jmx.configuration.MetricConfigurationException;
import com.bizo.asperatus.model.Dimension;
import com.bizo.asperatus.tracker.MetricTracker;
/**
* This runnable executes a single pull of data from JMX and pushes the information to Asperatus.
*/
public class MetricRunnable implements Runnable {
private final MBeanServer mBeanServer;
private final ObjectName jmxName;
private final MetricTracker tracker;
private final List<Dimension> dimensions;
private final MetricConfiguration config;
private final ErrorHandler errorHandler;
/**
* Creates a new MetricRunnable.
*
* @param config
* the configuration to pull
* @param server
* the MBeanServer containing data
* @param tracker
* the Asperatus tracker that will receive data
* @param dimensions
* the dimensions to send to Asperatus
* @param errorHandler
* the handler that processes error notifications
*/
public MetricRunnable(
final MetricConfiguration config,
final MBeanServer server,
final MetricTracker tracker,
final List<Dimension> dimensions,
final ErrorHandler errorHandler) {
mBeanServer = server;
this.tracker = tracker;
this.dimensions = dimensions;
this.config = config;
this.errorHandler = errorHandler;
try {
jmxName = new ObjectName(config.getObjectName());
} catch (final MalformedObjectNameException moan) {
throw new MetricConfigurationException(moan);
}
}
@Override
public void run() {
try {
final Object result = mBeanServer.getAttribute(jmxName, config.getAttribute());
if (config.getCompositeDataKey() != null) {
if (result instanceof CompositeData) {
final CompositeData cData = (CompositeData) result;
final Object compositeDataValue = cData.get(config.getCompositeDataKey());
if (compositeDataValue != null && compositeDataValue instanceof Number) {
track((Number) compositeDataValue);
}
} else {
typeError(result, CompositeData.class);
}
} else if (result instanceof Number) {
track((Number) result);
} else {
typeError(result, Number.class);
}
} catch (final Exception e) {
errorHandler.handleError("Error while getting data for metric " + config.getMetricName(), e);
}
}
private void track(final Number value) {
tracker.track(config.getMetricName(), value, config.getUnit(), dimensions);
}
private void typeError(final Object result, final Class<?> expectedType) {
final String actualType = result != null ? result.getClass().getName() : "null";
errorHandler.handleError(
String.format("Metric %s returned a %s, required a %s", config.getMetricName(), actualType, expectedType),
null);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
87f3fb66c3daaba1356022f03dd88f9c4f504e3b | b67254518ab358d72391b213f51bf013acddb0f2 | /src/main/java/com/madrone/lms/controller/CancelLeaveController.java | ead44802029356d507db391ca874871046747776 | [] | no_license | vijaychandramadrone/lms-apps | 219c5bb24c7b938c8ad35b720be9156ea35b8653 | 8d8e4c0d53ce7f680dfafce7555f08c6ed698b3d | refs/heads/master | 2020-04-12T22:55:31.677184 | 2014-08-05T08:02:46 | 2014-08-05T08:02:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,547 | java | package com.madrone.lms.controller;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.view.RedirectView;
import com.madrone.lms.constants.LMSConstants;
import com.madrone.lms.entity.EmployeeLeave;
import com.madrone.lms.form.LeaveDetailsGrid;
import com.madrone.lms.form.LeaveForm;
import com.madrone.lms.service.EmailService;
import com.madrone.lms.service.EmployeeLeaveService;
import com.madrone.lms.utils.JSONUtils;
import com.madrone.lms.utils.MailUtils;
@Controller
public class CancelLeaveController {
@Autowired
private EmployeeLeaveService empLeaveService;
private static final Logger logger = LoggerFactory
.getLogger(CancelLeaveController.class);
@Autowired
private MessageSource messageSource;
@Autowired
private EmailService emailService;
@RequestMapping(value = "/cancelLeave", method = RequestMethod.GET)
public String cancelLeave(Model model, LeaveForm form, HttpSession session) {
logger.info("Inside cancelLeave()");
model.addAttribute("CancelLeaveForm", new LeaveForm());
// Setting values into Cancel - Leave Grid
String userName = (String) session.getAttribute("sessionUser");
List<LeaveDetailsGrid> cancelLeaveList = empLeaveService
.getPendingAndApprovalLeaveList(userName);
String jsonString = JSONUtils.convertListToJson(cancelLeaveList);
model.addAttribute("jsonString", jsonString);
return LMSConstants.CANCEL_LEAVE_SCR + "_"
+ session.getAttribute("sessionRole");
}
@RequestMapping(value = "/submitCancelLeave", method = RequestMethod.POST)
public ModelAndView submitCancelLeave(@ModelAttribute("cancelLeaveForm") LeaveForm form,
BindingResult result, Map<String, Object> map, HttpSession session,
RedirectAttributes ra, HttpServletRequest request) {
logger.info("submitCancelLeave");
ModelAndView modelView = new ModelAndView(new RedirectView(LMSConstants.CANCEL_LEAVE_URL));
String jsonString1 = form.getSelecteddata();
LeaveForm cancelForm = JSONUtils.convertJsonToObjectToClass(jsonString1);
cancelForm.setReason(form.getReason());
if (cancelForm != null) {
String operation = LMSConstants.LEAVE_CANCEL;
EmployeeLeave el = empLeaveService.setBeanValuesForSave(cancelForm,operation);
empLeaveService.cancelEmployeeLeave(el);
request.setAttribute("LeaveForm", cancelForm);
String mailSubject = MailUtils.composeEmailSubject(request,LMSConstants.LEAVE_CANCEL);
String from = (String) session.getAttribute("sessionUser");
emailService.sendMail(from, LMSConstants.mailTo,"Employee Leave Cancellation email", mailSubject);
ra. addFlashAttribute("SucessMessage", messageSource.getMessage(
"lms.cancelLeave_success_message", new Object[] { "" },
Locale.getDefault()));
}
return modelView;
}
}
| [
"parivallal.d@madronesoft.com"
] | parivallal.d@madronesoft.com |
177a6ba91df1db372465e5a998af912439ab1d06 | f436106213f40c65742038752dbeb3b43edd4c8b | /helloworlddecoupled/src/main/java/org/qbit/examples/spring/introduction/HelloWorldSpringDI.java | 2f8b72ee0c37caec2b08b0b81172246ff87e7c3c | [] | no_license | ludomirc/examples | 093220df6c00b3ac77cb8efbfbcab331042c4bed | 33bfceed26ca66109ca1b542624b95050ad2f8fc | refs/heads/master | 2020-12-30T13:39:59.598367 | 2017-05-14T20:07:43 | 2017-05-14T20:07:43 | 91,242,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | package org.qbit.examples.spring.introduction;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Created by Benek on 14.05.2017.
*/
public class HelloWorldSpringDI {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext
("META-INF/spring/app-context.xml");
MessageRenderer mr = ctx.getBean("renderer", MessageRenderer.class);
mr.render();
}
}
| [
"beniamin.czaplicki@gmail.com"
] | beniamin.czaplicki@gmail.com |
ab38d10d2a74fda376fc6618de7597ed21699f26 | e8d4b1d3ab09320f8a12269c0898211ba84dd423 | /src/main/java/com/eagleshing/miniprogram/domain/ParamResponse.java | 29ae1e2c15da5023f3203db3b78a9d64df321cc6 | [] | no_license | DanielLanA09/eagleeyes-miniprogram | 8025d3a1bbbc17dfd1c106bfcd03e10d40f96c1b | 839008d31003368db6f224bf3b22b9662acdabfd | refs/heads/master | 2022-12-31T16:45:50.427961 | 2020-04-09T07:20:47 | 2020-04-09T07:20:47 | 152,277,620 | 0 | 0 | null | 2022-12-16T04:35:31 | 2018-10-09T15:41:16 | TSQL | UTF-8 | Java | false | false | 821 | java | package com.eagleshing.miniprogram.domain;
public class ParamResponse {
private int id;
private String name;
private String data;
private String type;
private String des;
private byte sort;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des;
}
public byte getSort() {
return sort;
}
public void setSort(byte sort) {
this.sort = sort;
}
}
| [
"lanjian2012@live.com"
] | lanjian2012@live.com |
299cdd678a7229b474b16f36a92cff433f085759 | 29a18a40af4d3e11977f4d3492048e1ca2ff938d | /log-service/log-provider/src/main/java/com/shfc/log/service/LogServiceImpl.java | 216be53f40148046fc3db26acd3b78066624122a | [] | no_license | tomdev2008/sypdt-log | b7f515741703b3c8f3050d0d41d2c89359e53d84 | c3a91e2d8ff64eedc6aa73d1b29e9b28f350981c | refs/heads/master | 2020-03-20T00:35:02.863494 | 2017-10-19T08:49:22 | 2017-10-19T08:49:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.shfc.log.service;
import org.springframework.stereotype.Service;
/**
* Copyright:Copyright (c) 2017
* Company:东方金融-上海房产
*
* @author ljgllxyz
* @version V1.0
* @date 2017/4/11 下午7:54.
*/
@Service
public class LogServiceImpl implements LogService{
}
| [
"hsunyp@oriental-finance.com"
] | hsunyp@oriental-finance.com |
291b10de334e8ed06307b840780f2bed2611abbf | 910fe2a56d9cf8303dc6c8c8ca591771d2f79660 | /com/spotmouth/gwt/client/group/ManageGroupPanel.java | 5dd3fc2a92b48870773b342c8747ecb5a541a0f9 | [] | no_license | rhodebump/spotmouth-gwt | f4c6ad70056ca1248c59ad76cb7d3cad1b129a77 | 10ec16a6b91a3aee4cdd7b3b1ed322b8a3429124 | refs/heads/master | 2021-01-25T05:28:01.484513 | 2013-05-08T02:09:06 | 2013-05-08T02:09:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,030 | java | package com.spotmouth.gwt.client.group;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.*;
import com.spotmouth.gwt.client.ManageMembersPanel;
import com.spotmouth.gwt.client.MyWebApp;
import com.spotmouth.gwt.client.SpotMouthPanel;
import com.spotmouth.gwt.client.common.Fieldset;
import com.spotmouth.gwt.client.common.SpotBasePanel;
import com.spotmouth.gwt.client.dto.GroupHolder;
import com.spotmouth.gwt.client.dto.GroupRequest;
import com.spotmouth.gwt.client.dto.MobileResponse;
import com.spotmouth.gwt.client.dto.SpotHolder;
import com.spotmouth.gwt.client.rpc.ApiServiceAsync;
/*
* this constructs links to all application menus
*/
public class ManageGroupPanel extends SpotBasePanel implements SpotMouthPanel {
public String getTitle() {
return "Manage Group";
}
public String getPageTitle() {
return getTitle();
}
GroupHolder groupHolder = null;
private SimpleCheckBox visibleToMembersCheckbox = new SimpleCheckBox();
private SimpleCheckBox openEnrollmentCheckbox = new SimpleCheckBox();
private SimpleCheckBox manageByMembersCheckbox = new SimpleCheckBox();
private SimpleCheckBox authoritativeCSVCheckbox = new SimpleCheckBox();
private SimpleCheckBox optinRequiredCheckbox = new SimpleCheckBox();
private SpotHolder spotHolder = null;
//,
public ManageGroupPanel(MyWebApp mywebapp, GroupHolder groupHolder,SpotHolder spotHolder) {
super(mywebapp);
this.spotHolder = spotHolder;
this.groupHolder = groupHolder;
if (MyWebApp.isDesktop()) {
groupNameTextBox.setValue(groupHolder.getName());
groupNameTextBox.setName("gr_name");
//a cols="200" rows="3"
descriptionTextArea.setValue(groupHolder.getDescription());
descriptionTextArea.setVisibleLines(3);
descriptionTextArea.setCharacterWidth(200);
//gr_code
groupCodeTextBox.setValue(groupHolder.getGroupCode());
groupCodeTextBox.setName("gr_code");
// <input type="text" name="gr_code_p"/>
groupCodeDescriptionTextArea.setValue(groupHolder.getGroupCodeDescription());
groupCodeDescriptionTextArea.setName("gr_code_p");
visibleToMembersCheckbox.setValue(groupHolder.getVisibleToMembers());
manageByMembersCheckbox.setValue(groupHolder.getManageByMembers());
openEnrollmentCheckbox.setValue(groupHolder.getOpenEnrollment());
authoritativeCSVCheckbox.setValue(groupHolder.getAuthoritativeCsv());
optinRequiredCheckbox.setValue(groupHolder.getOptInRequired());
// InlineLabel memberCountLabel = new InlineLabel();
// memberCountLabel.setText("" + groupHolder.getMemberHolders().size());
Button saveGroupButton = new Button("Save Group");
saveGroupButton.addClickHandler(saveHandler);
GroupFormComposite groupFormComposite = new GroupFormComposite(groupNameTextBox,descriptionTextArea,groupCodeTextBox,groupCodeDescriptionTextArea,visibleToMembersCheckbox,manageByMembersCheckbox,
openEnrollmentCheckbox,authoritativeCSVCheckbox,optinRequiredCheckbox,saveGroupButton);
groupFormComposite.setMemberCount("" + groupHolder.getMemberHolders().size());
add(groupFormComposite);
return;
}
init1();
}
private void init1() {
this.clear();
addGroupsHeader(spotHolder);
if (groupHolder.getId() != null) {
add(manageMembersButton());
}
groupNameTextBox = addTextBox("Name", "groupNameTextBox", groupHolder.getName());
descriptionTextArea = addTextArea("Description", "description", groupHolder.getDescription(), false);
groupCodeTextBox = addTextBox("Group Code", "groupCodeTextBox", groupHolder.getGroupCode());
Label groupCodeLabel = new Label("If you provide a group code, users who provide a valid group code automatically become members.");
add(groupCodeLabel);
groupCodeDescriptionTextArea = addTextArea("Group Code Prompt", "groupCodeDescription", groupHolder.getGroupCodeDescription(), false);
Label visibleToMembers = new Label("Visible to members allows all members of the group to see each other.");
add(visibleToMembers);
//
//visibleToMembersCheckbox = addCheckbox2("Visible To Members?", "visibleToMembers", groupHolder.getVisibleToMembers(), null);
Label manageByMembers = new Label("Manage by members allows all members of the group to add/remove/approve members of the group.");
add(manageByMembers);
Fieldset fs = new Fieldset();
fs.setText("Manage By Members");
manageByMembersCheckbox.setValue(groupHolder.getManageByMembers());
fs.add(manageByMembersCheckbox);
add(fs);
//manageByMembersCheckbox = addCheckbox2("Manage By Members?", "manageByMembers", groupHolder.getManageByMembers(), null);
Label openEnrollment = new Label("Open enrollment allows anyone who wants to join the group to join");
add(openEnrollment);
//openEnrollmentCheckbox = addCheckbox2("Open Enrollment?", "openEnrollment", groupHolder.getOpenEnrollment(), null);
fs = new Fieldset();
fs.setText("Open Enrollment?");
openEnrollmentCheckbox.setValue(groupHolder.getManageByMembers());
fs.add(openEnrollmentCheckbox);
add(fs);
Label authCSV = new Label("Authoritative CSV means files you upload will remove members.");
add(authCSV);
// authoritativeCSVCheckbox = addCheckbox2("Authoritative CSV", "acsv", groupHolder.getAuthoritativeCsv(), null);
fs = new Fieldset();
fs.setText("Authoritative CSV");
authoritativeCSVCheckbox.setValue(groupHolder.getAuthoritativeCsv());
fs.add(authoritativeCSVCheckbox);
add(fs);
if (mywebapp.getAuthenticatedUser().isGoldenMember()) {
Label optin = new Label("Users have to opt-in to your group to join.");
add(optin);
fs = new Fieldset();
fs.setText("Opt-in required");
optinRequiredCheckbox.setValue(groupHolder.getOptInRequired());
fs.add(optinRequiredCheckbox);
add(fs);
//optinRequiredCheckbox = addCheckbox2("Opt-in required", "optin", groupHolder.getOptInRequired(), null);
}
Label memberCount = new Label("" + groupHolder.getMemberHolders().size());
addFieldset(memberCount, "Member Count", "memberCount");
add(saveButton());
if (groupHolder.getId() != null) {
Label deleteButton = new Label("Delete Group");
deleteButton.addClickHandler(deleteGroupHandler);
deleteButton.setStyleName("whiteButton");
add(deleteButton);
add(manageMembersButton());
}
add(cancelButton());
}
private Label manageMembersButton() {
Label manageMembership = new Label("Manage Members");
manageMembership.addClickHandler(manageMembershipHandler);
fixButton(manageMembership);
return manageMembership;
}
protected boolean isValid() {
checkRequired(groupNameTextBox, "Name is required");
checkRequired(descriptionTextArea, "Description is required");
if (!isEmpty(groupCodeTextBox)) {
checkRequired(groupCodeDescriptionTextArea, "Group code prompt is required if you have a group code.");
}
return (!getMessagePanel().isHaveMessages());
}
ClickHandler deleteGroupHandler = new ClickHandler() {
public void onClick(ClickEvent event) {
boolean delete = Window.confirm("Delete group?");
if (delete) {
deleteGroup();
}
}
};
ClickHandler manageMembershipHandler = new ClickHandler() {
public void onClick(ClickEvent event) {
ManageMembersPanel mmp = new ManageMembersPanel(mywebapp, groupHolder, spotHolder);
mywebapp.swapCenter(mmp);
}
};
private TextBox groupNameTextBox = new TextBox();
protected TextArea descriptionTextArea = new TextArea();
protected TextBox groupCodeTextBox = new TextBox();
protected TextArea groupCodeDescriptionTextArea = new TextArea();
public void toggleFirst() {
groupNameTextBox.setFocus(true);
}
protected void doSave() {
GWT.log("saveGroup");
GroupRequest groupRequest = new GroupRequest();
groupRequest.setGroupHolder(groupHolder);
groupRequest.setSpotHolder(spotHolder);
groupRequest.setAuthToken(mywebapp.getAuthToken());
groupHolder.setName(groupNameTextBox.getValue());
groupHolder.setDescription(descriptionTextArea.getValue());
groupHolder.setGroupCode(groupCodeTextBox.getValue());
groupHolder.setGroupCodeDescription(groupCodeDescriptionTextArea.getValue());
groupHolder.setOpenEnrollment(openEnrollmentCheckbox.getValue());
groupHolder.setVisibleToMembers(visibleToMembersCheckbox.getValue());
groupHolder.setManageByMembers(manageByMembersCheckbox.getValue());
groupHolder.setAuthoritativeCsv(authoritativeCSVCheckbox.getValue());
groupHolder.setOptInRequired(optinRequiredCheckbox.getValue());
ApiServiceAsync myService = mywebapp.getApiServiceAsync();
myService.saveGroup(groupRequest, new AsyncCallback() {
public void onFailure(Throwable caught) {
postDialog.hide();
getMessagePanel().displayError(caught.getMessage());
}
public void onSuccess(Object result) {
postDialog.hide();
MobileResponse mobileResponse = (MobileResponse) result;
if (mobileResponse.getStatus() == 1) {
mywebapp.getMessagePanel().clear();
mywebapp.fetchFriendsAndGroups(null);
//init(mobileResponse.getGroupHolder());
GroupPanel groupPanel = new GroupPanel(mywebapp, mobileResponse.getGroupHolder(),spotHolder);
mywebapp.swapCenter(groupPanel);
getMessagePanel().displayMessage("Group saved.");
} else {
getMessagePanel().displayErrors(mobileResponse.getErrorMessages());
}
}
});
}
AsyncCallback deleteMessageCallback = new AsyncCallback() {
public void onFailure(Throwable throwable) {
getMessagePanel().displayError(throwable.getMessage());
}
public void onSuccess(Object response) {
getMessagePanel().displayMessage("Group deleted.");
}
};
private void deleteGroup() {
GroupRequest groupRequest = new GroupRequest();
groupRequest.setGroupHolder(groupHolder);
groupRequest.setAuthToken(mywebapp.getAuthToken());
ApiServiceAsync myService = mywebapp.getApiServiceAsync();
myService.deleteGroup(groupRequest, new AsyncCallback() {
public void onFailure(Throwable caught) {
getMessagePanel().displayError(caught.getMessage());
}
public void onSuccess(Object result) {
MobileResponse mobileResponse = (MobileResponse) result;
if (mobileResponse.getStatus() == 1) {
mywebapp.getMessagePanel().clear();
mywebapp.toggleSpotGroups(deleteMessageCallback,spotHolder.getId());
} else {
getMessagePanel().displayErrors(mobileResponse.getErrorMessages());
}
}
});
}
}
| [
"rhodebump@gmail.com"
] | rhodebump@gmail.com |
625443de4b71d7706a3f996cb5d354f8d4c4cb6d | 987794a415ba00469d0a8c4432d1ec3e6974bd94 | /EmulatorATM/src/main/java/ru/liga/system/ATM.java | f36117c9d09194f0b489f7f5ecbda970973d0346 | [] | no_license | vasx222/EmulatorATM | 3fed7b12ece050b890629d8f9f14386c72e6af6d | 38f8523ac7da5fa6865872a6248c3001e62a4f30 | refs/heads/master | 2020-03-07T18:40:10.868027 | 2018-04-13T17:50:38 | 2018-04-13T17:50:38 | 127,647,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package ru.liga.system;
import ru.liga.system.algorithm.Banknotes;
public class ATM {
private Banknotes banknotes = new Banknotes();
private Banknotes initialBanknotes;
public ATM() {
this.initialBanknotes = new Banknotes();
}
public ATM(Banknotes initialBanknotes) {
this.initialBanknotes = initialBanknotes;
}
public void putBanknote(int denomination) {
banknotes.putBanknote(denomination);
}
public Banknotes returnAmountAsLargeBanknotes(int amount) {
return banknotes.returnAmountAsLargeBanknotes(amount);
}
public Banknotes returnAmountAsSmallBanknotes(int amount) {
return banknotes.returnAmountAsSmallBanknotes(amount);
}
public int getRemainingAmount() {
return banknotes.getAmount();
}
public Banknotes returnAllBanknotes() {
Banknotes banknotes = this.banknotes;
this.banknotes = new Banknotes();
return banknotes;
}
public void restoreInitialState() {
banknotes = initialBanknotes.getCopy();
}
}
| [
"vasx222@mail.ru"
] | vasx222@mail.ru |
6947a7455f0efe9c7b2d84a1487c6701127ea4da | deabda71d8dbbb788457de1114bf25ceef63837a | /src/main/java/fidel/logic/evaluators/InvestigateEggsEvaluator.java | 723dd5d0ba35c1eda384cab509fbd443dc7255e5 | [] | no_license | Hohol/FidelPlayer | 4864d6cdf8db844d8aaf3cb77ede4c79f5db9926 | 0b30265898d09c29fbe029612b9a9e479fd61f4a | refs/heads/master | 2021-01-19T16:16:19.575972 | 2017-08-21T21:40:58 | 2017-08-21T20:39:57 | 100,993,410 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package fidel.logic.evaluators;
import fidel.common.Board;
import fidel.common.Cell;
import fidel.common.Command;
import fidel.logic.MoveGameState;
import java.util.List;
public class InvestigateEggsEvaluator implements Evaluator {
@Override
public double evaluate(MoveGameState state, List<Command> moves) {
return state.round - moves.size() / 1000.0;
}
@Override
public boolean finished(MoveGameState gameState, Cell exit) {
return false;
}
@Override
public boolean updateOnEachMove() {
return true;
}
@Override
public boolean returnImmediately() {
return false;
}
@Override
public Cell getExit(Board board) {
return null;
}
}
| [
"nikita.glashenko@gmail.com"
] | nikita.glashenko@gmail.com |
34adc37bc24fb128f7b3cb1cf6fed231ad2ac169 | 673006389a2216555fc0f03fd3b3757f78a02454 | /Web_Cat-master/Reporter/src/org/webcat/reporter/AbstractReportSaver.java | 24bbe4053fc61ad7f4d3fa3973eb5b0202815704 | [] | no_license | manasigore/my-projects | d2be7576ab4ccd1697dfaada577b90703704babf | e2add29036388a9d7ffc2e4519d8e85ffb5386cb | refs/heads/master | 2020-03-19T03:47:49.472749 | 2018-06-08T20:24:09 | 2018-06-08T20:24:09 | 135,763,670 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,083 | java | /*==========================================================================*\
| $Id: AbstractReportSaver.java,v 1.1 2010/05/11 14:51:48 aallowat Exp $
|*-------------------------------------------------------------------------*|
| Copyright (C) 2006-2008 Virginia Tech
|
| This file is part of Web-CAT.
|
| Web-CAT is free software; you can redistribute it and/or modify
| it under the terms of the GNU Affero General Public License as published
| by the Free Software Foundation; either version 3 of the License, or
| (at your option) any later version.
|
| Web-CAT 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 Affero General Public License
| along with Web-CAT; if not, see <http://www.gnu.org/licenses/>.
\*==========================================================================*/
package org.webcat.reporter;
import org.eclipse.birt.report.engine.api.IReportDocument;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.webcat.birtruntime.BIRTRuntime;
import org.webcat.core.DeliverFile;
//------------------------------------------------------------------------
/**
* Provides common base functionality for each of the report saver types.
*
* @author Tony Allevato
* @version $Id: AbstractReportSaver.java,v 1.1 2010/05/11 14:51:48 aallowat Exp $
*/
public abstract class AbstractReportSaver
{
//~ Constructors ..........................................................
// ----------------------------------------------------------
/**
* Initializes a new instance of the abstract report saver.
*
* @param report the GeneratedReport object to be saved
*/
public AbstractReportSaver(GeneratedReport report)
{
this.report = report;
document = report.openReportDocument();
}
//~ Methods ...............................................................
// ----------------------------------------------------------
/**
* Closes the report document associated with this saver.
*/
public void close()
{
document.close();
}
// ----------------------------------------------------------
/**
* Gets the report engine instance.
*
* @return the report engine instance
*/
protected IReportEngine reportEngine()
{
return BIRTRuntime.getInstance().getReportEngine();
}
// ----------------------------------------------------------
/**
* Gets the generated report associated with this saver.
*
* @return the GeneratedReport object associated with this saver
*/
protected GeneratedReport generatedReport()
{
return report;
}
// ----------------------------------------------------------
/**
* Gets the BIRT report document handle for the report being saved. After
* using this handle, make sure to call the close method.
*
* @return the IReportDocument handle for the report
*/
protected IReportDocument reportDocument()
{
return document;
}
// ----------------------------------------------------------
/**
* Saves the contents of the report to the specified DeliverFile component,
* which the caller should return to the user for download. Subclasses must
* override this to provide the actual saving functionality for the format
* that they implement.
*
* @param file the DeliverFile component to store the saved data in
* @return a Throwable that indicates an error that occurred (which the
* caller should display), or null if successful.
*/
public abstract Throwable deliverTo(DeliverFile file);
//~ Static/instance variables .............................................
private GeneratedReport report;
private IReportDocument document;
}
| [
"manasi.gore490@gmail.com"
] | manasi.gore490@gmail.com |
5acc8a2ad2e74749180a0fcc292985e1d2f09654 | 54f96b37b11a0946d8bf2b8ca6c6d46ade35b48b | /src/main/java/com/jx/tennis/controller/BaseController.java | 7312619baa95ae73abd0742e4b7e51f842b39756 | [] | no_license | myq3636/web | f7209073ec3ceaa2744ea5dea0aa4e15d9e9bb2c | 52bf39fdf4d8c3856d756315dce7d73a08d63de9 | refs/heads/master | 2020-03-29T12:37:53.321838 | 2018-09-22T19:38:38 | 2018-09-22T19:38:38 | 149,909,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,546 | java | package com.jx.tennis.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jx.tennis.common.utils.security.ShiroUtils;
import com.jx.tennis.project.system.user.domain.User;
import com.jx.tennis.util.StringUtils;
import com.jx.tennis.vo.AjaxResult;
import comjx.tennis.framework.web.page.PageDomain;
import comjx.tennis.framework.web.page.TableDataInfo;
import comjx.tennis.framework.web.page.TableSupport;
/**
* web层通用数据处理
*
* @author ruoyi
*/
public class BaseController
{
/**
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
*/
@InitBinder
public void initBinder(WebDataBinder binder)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
/**
* 设置请求分页数据
*/
protected void startPage()
{
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{
String orderBy = pageDomain.getOrderBy();
PageHelper.startPage(pageNum, pageSize, orderBy);
}
}
/**
* 响应请求分页数据
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list)
{
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0);
rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? success() : error();
}
/**
* 返回成功
*/
public AjaxResult success()
{
return AjaxResult.success();
}
/**
* 返回失败消息
*/
public AjaxResult error()
{
return AjaxResult.error();
}
/**
* 返回成功消息
*/
public AjaxResult success(String message)
{
return AjaxResult.success(message);
}
/**
* 返回失败消息
*/
public AjaxResult error(String message)
{
return AjaxResult.error(message);
}
/**
* 返回错误码消息
*/
public AjaxResult error(int code, String message)
{
return AjaxResult.error(code, message);
}
/**
* 页面跳转
*/
public String redirect(String url)
{
return StringUtils.format("redirect:{}", url);
}
public User getUser()
{
return ShiroUtils.getUser();
}
public void setUser(User user)
{
ShiroUtils.setUser(user);
}
public Long getUserId()
{
return getUser().getUserId();
}
public String getLoginName()
{
return getUser().getLoginName();
}
}
| [
"myq3636@sina.com"
] | myq3636@sina.com |
ff6d3a7ecd764fd619d9b219e61e45ccdf2f9872 | 2370bb9a54aabbb2423768e9c2197b70cb14ed21 | /src/model/Card.java | 2d6084eff7b932b425dfdbb19fc0b3a5483b6846 | [] | no_license | rizzotto/projectPatterns | 81221781bd32f68210fefabdf3a7b3182b268ccc | 6d0bc6d3948b06be90b7f9e2a790cf98d37db506 | refs/heads/master | 2022-10-21T03:44:42.406577 | 2020-06-13T15:02:13 | 2020-06-13T15:02:13 | 271,544,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package model;
/**
* Credit card class.
*/
public class Card {
private int total;
private String number;
private String date;
private String cvv;
public Card(String number, String date, String cvv) {
this.total = 100;
this.number = number;
this.date = date;
this.cvv = cvv;
}
public void setTotal(int total) {
this.total = total;
}
public int getTotal() {
return total;
}
} | [
"guilherme.rizzotto@acad.pucrs.br"
] | guilherme.rizzotto@acad.pucrs.br |
a4a978c703aa2218831da03d221755eec4e9034a | bdc18adefc91867c93dd399db03928d74f87edc8 | /src/test/java/com/greatdrive/admin/ApplicationTests.java | 498ceb2bced76e090f4cafd689672066dee30ef2 | [] | no_license | bjcawanglu/admin | 9b540e5435bdaf2248a8cfaf44b769ec637d6c2b | c07044d130719ec5a68f5df2721acf6885f7c634 | refs/heads/master | 2021-06-27T10:47:51.867221 | 2017-09-15T10:08:24 | 2017-09-15T10:08:24 | 103,900,871 | 1 | 0 | null | 2017-09-18T06:25:55 | 2017-09-18T06:25:55 | null | UTF-8 | Java | false | false | 658 | java | package com.greatdrive.admin;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.lrs.admin.config.DruidDBConfig;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Test
public void contextLoads() {
}
@Autowired
private DruidDBConfig druidDBConfig;
@Test
public void testDruidDBConfig() throws Exception{
System.out.println("DruidDBConfig = " + druidDBConfig.dataSource().getLoginTimeout());
}
}
| [
"1006059906@qq.com"
] | 1006059906@qq.com |
fe89c88160a515f8a48df085401b23d71890c3aa | 9f73f4ffa3e60ad9b99b063f46f00e3bdb204f62 | /project2/src/main/java/com/fablix/moviedb/DAO/CreditcardsDAO.java | c4e97694263f0098a573006ace859786a892938c | [] | no_license | yuanfanz/FabFlix | ed8a083bb6e22598d79e656c650ea33eb2736ce3 | 47dc85ab8094617c4a5e60303c8780fc41a33a29 | refs/heads/master | 2021-01-21T04:55:09.628099 | 2016-07-04T21:31:19 | 2016-07-04T21:31:19 | 55,583,724 | 2 | 8 | null | null | null | null | UTF-8 | Java | false | false | 2,407 | java | package com.fablix.moviedb.DAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import com.fablix.moviedb.db.dbConnection;
import com.fablix.moviedb.model.CreditCards;
public class CreditcardsDAO{
//get the connection from dbConnection
private Connection connection = dbConnection.getConnection();
/**
*
* @param cre
* @return
* @throws Exception
*/
public Boolean findcre(String cre) throws SQLException{
//get the connection from dbConnection
//Connection conn = dbConnection.getConnection();
String sql = "select id from creditcards where id=?";
// create a Statement from the connection
PreparedStatement prepstmt = connection.prepareStatement(sql);
prepstmt.setString(1, cre);
ResultSet rs = prepstmt.executeQuery();
boolean ret;
int i = 0;
while(rs.next())
{
i++;
}
if(i != 0)
{
ret = true;
}
else
{
ret = false;
}
//rs.close();
//prepstmt.close();
dbConnection.rsstmtClose(rs, prepstmt);
//connection.close();
return ret;
}
public Boolean confirmCre(Map<String, Object> params) throws SQLException{
//get the connection from dbConnection
//Connection conn = dbConnection.getConnection();
//
boolean result = false;
String sql = "select * from creditcards where id=?";
if(!params.containsKey("firstname") || !params.containsKey("lastname") || !params.containsKey("ccnum") || !params.containsKey("extime") )
{
return result;
}
else
{
PreparedStatement prepstmt = connection.prepareStatement(sql);
prepstmt.setString(1, (String) params.get("ccnum"));
ResultSet rs = prepstmt.executeQuery();
if(rs.next())
{
CreditCards cc = new CreditCards();
cc.setId(rs.getString(1));
cc.setFirst_name(rs.getString(2));
cc.setLast_name(rs.getString(3));
cc.setExpiration(rs.getDate(4));
String expirationDate = cc.getExpiration().toString();
if(cc.getFirst_name().equals(params.get("firstname")) && cc.getLast_name().equals(params.get("lastname")) && expirationDate.equals(params.get("extime")))
{
result = true;
}
}
else
{
return result;
}
//rs.close();
//prepstmt.close();
dbConnection.rsstmtClose(rs, prepstmt);
//connection.close();
return result;
}
}
}
| [
"yuanfanz@uci.edu"
] | yuanfanz@uci.edu |
34a21980f198aa561bd36abebe9d92c1a927aad1 | ef6c3df6926a43118dacd6d2cfa2046623d3edf2 | /pattern-factory/src/main/java/com/iycc/pattern/factory/beans/WindowsButton.java | 5b8bb623ccddfa1cfc214c08f3d0c2ad4fa894b4 | [] | no_license | iycc/pattern-demo | be9d92e4cd02b93cda8bfc8c2bb2670b8ca0aabb | 0eae9d0eeb7a3f0b83d42f8f88bc9277340f05d3 | refs/heads/master | 2021-09-10T07:55:22.438010 | 2018-03-22T12:50:06 | 2018-03-22T12:50:06 | 124,081,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package com.iycc.pattern.factory.beans;
/**
* Created by iycc on 2018/3/11.
*/
public class WindowsButton implements Button {
}
| [
"kin_thinkpower@163.com"
] | kin_thinkpower@163.com |
780b82af1925ae533d19916652466584b75b8884 | 9c36ccbdeb1cdbabedcc080b361d886ed3562031 | /ssm/src/main/java/com/atguigu/service/EmployeeService.java | 323165caa349273719b4ad295be28a646fa7e793 | [] | no_license | wchao190/ssm-curd | 09e38c5c3c8b2a6d0bca45dc1be3d1bb284e31f3 | 21eb39f8718ecb245b22affa2ab7af9f2c5700ae | refs/heads/master | 2023-07-07T05:52:59.839432 | 2021-08-08T14:36:45 | 2021-08-08T14:36:45 | 393,711,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package com.atguigu.service;
import com.atguigu.bean.Employee;
import com.atguigu.bean.EmployeeExample;
import com.atguigu.dao.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class EmployeeService {
@Autowired
EmployeeMapper employeeMapper;
public List<Employee> getAll(EmployeeExample example) {
return employeeMapper.selectByExampleWithDept(example);
}
}
| [
"wchao190@163.com"
] | wchao190@163.com |
74366c7b84e6703a48b9384296582161962fcdd2 | abf70307ef0f5ad736484e42bd1f451601efbcdb | /src/main/java/com/fujias/itesting/base/controller/BaseController.java | 89726f7c1f552c86310d81b5fb9dcae73a709d1e | [] | no_license | gaozhenchuan/itesting | 7e37f79b91631485c7677853e587175af81cd478 | 0d4b48153a2cd26a37d2586e1f4af58cae63c3a8 | refs/heads/master | 2020-07-25T09:14:36.299199 | 2017-10-16T22:54:25 | 2017-10-16T22:54:25 | 73,778,994 | 0 | 0 | null | 2016-12-02T23:21:57 | 2016-11-15T05:19:40 | null | UTF-8 | Java | false | false | 6,246 | java | package com.fujias.itesting.base.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.support.RequestContextUtils;
/**
*
* 开发公司:itboy.net<br/>
*
* @author gaozhenchuan
* @email gaozhencuan@gmail.com
* @version 1.0
*
*/
@Controller
public abstract class BaseController {
protected final static Log log = LogFactory.getLog(BaseController.class);
@Autowired
protected MessageSource messageSource;
@Autowired
private HttpServletRequest request;
// 信息key
private static final String MSG_FBSE = "MSGFBSE";
// 信息
//private JSONArray message=new JSONArray(
protected void addMessage(String msg){
JSONArray message=null;
Object obj = request.getSession().getAttribute(MSG_FBSE);
if(obj !=null && obj instanceof JSONArray){
message = (JSONArray)obj;
}else{
message =new JSONArray();
}
//message.add(msg);
request.getSession().setAttribute(MSG_FBSE, message);
}
protected void clearMessage() {
request.getSession().setAttribute(MSG_FBSE, new JSONArray());
}
protected String getMessage() {
JSONArray message=null;
Object obj = request.getSession().getAttribute(MSG_FBSE);
if(obj !=null && obj instanceof JSONArray){
message = (JSONArray)obj;
}else{
message =new JSONArray();
}
return message.toString();
}
// protected void addPopMessage(Message msg){
// JSONArray message=null;
// JSONObject json = JSONObject.fromObject(msg);
// Object obj = request.getSession().getAttribute(MSG_FBSE);
// if(obj !=null && obj instanceof JSONArray){
// message = (JSONArray)obj;
// }else{
// message =new JSONArray();
// }
// message.add(json);
//
// }
/**
* 初始化分页相关信息
*/
protected void initView(ModelAndView mav, Integer listSize) {
}
//
// // 当前页与每页件数取得
// Integer pageNum = entity.getPageNum();
// Integer pageSize = entity.getPageSize();
// listSize = listSize==null?0:listSize;
// Integer totalPage = (listSize + pageSize - 1) / pageSize;
// if (null == pageNum) {
// pageNum = Constant.PAGENUM;
// } else if (pageNum > totalPage) {
// pageNum = totalPage;
// }
// // 首页
// String topPage = messageSource.getMessage("Header0002",null, getLocale(request));
// // 上一页
// String prevPage = messageSource.getMessage("Paging0002",null, getLocale(request));
// // 下一页
// String nextPage = messageSource.getMessage("Paging0003",null, getLocale(request));
// // 尾页
// String lastPage = messageSource.getMessage("Paging0004",null, getLocale(request));
// String all = messageSource.getMessage("Paging0005",null, getLocale(request));
// String page = messageSource.getMessage("Paging0006",null, getLocale(request));
// String strip = messageSource.getMessage("Paging0007",null, getLocale(request));
// mav.addObject("startIndex", Pager.getStartIndex(pageNum, pageSize));
// Pager.vx(topPage,prevPage,nextPage,lastPage,all,page,strip);
//
// mav.addObject("pageNum", pageNum);
// mav.addObject("totalPage", totalPage);
// mav.addObject("pageSize", pageSize);
// mav.addObject("totalCount", listSize);
//
// }
/**
* 获取当前国际化语言
*/
protected Locale getLocale(HttpServletRequest request) {
return RequestContextUtils.getLocaleResolver(request).resolveLocale(request);
}
/**
* 全局异常处理
*/
@ExceptionHandler
public ModelAndView exception(HttpServletRequest request, HttpServletResponse response, Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
log.error(sw.toString());
// 如果是json格式的ajax请求
if (request.getHeader("accept").indexOf("application/json") > -1
|| (request.getHeader("X-Requested-With") != null && request.getHeader("X-Requested-With").indexOf(
"XMLHttpRequest") > -1)) {
response.setStatus(500);
response.setContentType("application/json;charset=utf-8");
try {
PrintWriter writer = response.getWriter();
writer.write(e.getMessage());
writer.flush();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return null;
} else {// 如果是普通请求
ModelAndView mav = new ModelAndView("common/exception");
request.setAttribute("exceptionMessage", e.getMessage());
// 根据不同的异常类型可以返回不同界面
return mav;
}
}
/**
* 设定系统日期格式化
* @param entity
*/
// protected void setDateFormate(BaseEntity entity){
// entity.setViewDateFormateYM(this.messageSource.getMessage("ViewDateFormateYM", null, Locale.CHINA));
// entity.setViewDateFormateYMD(this.messageSource.getMessage("ViewDateFormateYMD", null, Locale.CHINA));
// entity.setJavaDateFormateYM(this.messageSource.getMessage("JavaDateFormateYM", null, Locale.CHINA));
// entity.setJavaDateFormateYMD(this.messageSource.getMessage("JavaDateFormateYMD", null, Locale.CHINA));
// }
} | [
"gaozhencuan@gmail.com"
] | gaozhencuan@gmail.com |
b519d03c5da336c85fadfdcc3d8f49b03db8d7dd | 41c1deebfb1db2eac759d48d1e2ac24cddd0afc0 | /backend/src/main/java/pl/nowosielski/controller/ClientController.java | d9a9075653cc7da58f8b8d1ecfa88df69f771a8f | [] | no_license | poncyliuszm/gym-management | 5a5ffb8389a73c176f49d8d28632f3d133b410c5 | 74683ec7f7ecdeaee570f5d75702be7adc734e67 | refs/heads/master | 2023-01-07T04:07:49.267718 | 2019-06-02T22:30:33 | 2019-06-02T22:30:33 | 174,867,150 | 0 | 0 | null | 2023-01-04T23:18:55 | 2019-03-10T18:57:20 | TypeScript | UTF-8 | Java | false | false | 1,439 | java | package pl.nowosielski.controller;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pl.nowosielski.model.Client;
import pl.nowosielski.repository.ClientRepository;
import java.util.List;
@RestController
@RequestMapping("/client")
public class ClientController {
private final ClientRepository clientRepository;
@Autowired
public ClientController(ClientRepository clientRepository) {
this.clientRepository = clientRepository;
}
@GetMapping("/list")
public List<Client> list() {
return clientRepository.findAll();
}
@GetMapping("/getActiveClients")
public List<Client> getActiveClients() {
return clientRepository.findByStatus(true);
}
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@GetMapping("/{id}")
public Client getOne(@PathVariable("id") Integer id) {
return clientRepository.findById(id).orElse(null);
}
@PostMapping("/save")
public void save(@RequestBody Client client) {
clientRepository.save(client);
}
@PutMapping()
public Client update(@RequestBody Client client) {
return clientRepository.save(client);
}
@DeleteMapping("/{id}")
public void delete(@PathVariable("id") Integer id) {
clientRepository.deleteById(id);
}
}
| [
"poncyliuszm@gmail.com"
] | poncyliuszm@gmail.com |
a774e42ef1be6cb132a9b0a5ad396cae50097c1b | 598c9459a42282de936de1d1a67622eca4883813 | /Primer semestre/Diseño del Software/Prac.7/src/outputs/Output.java | 7f96c322771c615c5090aa61282817c03f47c371 | [
"MIT"
] | permissive | SantiMA10/3ero | 85550dbc077309b73122a4db35e1f43124efb0a4 | 570aeb6c60615285329df2ffc7ebf50666a20faa | refs/heads/master | 2021-05-01T12:41:06.218185 | 2018-01-28T11:56:56 | 2018-01-28T11:56:56 | 51,208,804 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 137 | java | package outputs;
import java.io.*;
public interface Output {
void send(char c) throws IOException;
void close() throws IOException;
}
| [
"santiagomartinagra@gmail.com"
] | santiagomartinagra@gmail.com |
3afe37e44f6e37fe471f300081b21d3bc1d1781d | 2ccf0f569767da3d020782b9f7c4fdb399631178 | /app/src/main/java/com/sklagat46/mcrop/data/repository/McropRepository.java | ef591fa8507cd2de7b07496e2475aa80b1be433d | [] | no_license | sklagat45/Mcrop | 0e05dfacec3a816f9563f4f79cc47a7b274de89e | 6d1273e7ab564172f0f7ce213b57d62ce34d106f | refs/heads/master | 2021-06-22T13:19:47.528464 | 2021-01-08T15:15:33 | 2021-01-08T15:15:33 | 179,668,636 | 1 | 0 | null | 2021-01-08T15:22:47 | 2019-04-05T11:22:23 | Java | UTF-8 | Java | false | false | 998 | java | package com.sklagat46.mcrop.data.repository;
import android.content.Context;
import android.os.AsyncTask;
import com.sklagat46.mcrop.data.local.Database;
import com.sklagat46.mcrop.data.model.Fruits;
import com.sklagat46.mcrop.data.model.Vegetable;
import java.util.List;
import androidx.lifecycle.LiveData;
import androidx.room.Room;
public class McropRepository {
private String DB_NAME = "mcrop_db";
private Database database;
public McropRepository(Context context) {
database = Room.databaseBuilder(context, Database.class, DB_NAME).build();
}
public List<Vegetable> getAllVegetables() {
return database.vegetableDao().getAll();
}
public LiveData<List<Fruits>> getAllFruits() {
return database.fruitsDao().getAll();
}
public void addVegetable(Vegetable vegetable) {
database.vegetableDao().insert(vegetable);
}
public void addFruits(Fruits fruits) {
database.fruitsDao().insert(fruits);
}
} | [
"jkirwa25@gmail.com"
] | jkirwa25@gmail.com |
8cf7b5646a3c88cb9b7db9f288a7d35e1db5b3ce | eb5a301e27c0c1b213e4aab582bcf39f3c9d99ca | /app/src/src/main/java/com/monitor/changtian/bean/StatisticsQueryBean.java | f48299064afe19a69d0901267be9f4c69579a11c | [] | no_license | aigenisi-aliyi/Monitor | 878a85b7a51329c2ed2de89c905559f86d15c203 | 7d73aa84adb1394fa2ad6073fecf9f85af3efae4 | refs/heads/master | 2020-09-16T19:28:28.047432 | 2019-11-25T08:07:12 | 2019-11-25T08:07:12 | 223,867,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,308 | java | package com.monitor.changtian.bean;
import java.io.Serializable;
/**
* Created by ken on 2018/6/28.
* <p>
* Version: 1.0
* E-Mail: iauhsil
* <p>
* Function:
*/
public class StatisticsQueryBean implements Serializable {
/**
* currentdaytotalmoney : 1020000.0
* weeknumber : 15
* TotalTailMoney : 1312000.0
* weekInvalidmoney : 20000.0
*/
private double currentdaytotalmoney;
private int weeknumber;
private double TotalTailMoney;
private double weekInvalidmoney;
public double getCurrentdaytotalmoney() {
return currentdaytotalmoney;
}
public void setCurrentdaytotalmoney(double currentdaytotalmoney) {
this.currentdaytotalmoney = currentdaytotalmoney;
}
public int getWeeknumber() {
return weeknumber;
}
public void setWeeknumber(int weeknumber) {
this.weeknumber = weeknumber;
}
public double getTotalTailMoney() {
return TotalTailMoney;
}
public void setTotalTailMoney(double TotalTailMoney) {
this.TotalTailMoney = TotalTailMoney;
}
public double getWeekInvalidmoney() {
return weekInvalidmoney;
}
public void setWeekInvalidmoney(double weekInvalidmoney) {
this.weekInvalidmoney = weekInvalidmoney;
}
}
| [
"33453850+aigenisi008@users.noreply.github.com"
] | 33453850+aigenisi008@users.noreply.github.com |
73eec1441a34b563f74c1b84b97534c7e0ef187c | bb088eb8a6a8c383f1364f779a5f95f8c2a81ad6 | /src/bounce/Bounce.java | eddb2c3c29c9837a87a502f4ed37b31fd00810bb | [] | no_license | aweffr/Chap14.Concurrency | ff09d49c1b86d298cd9b42fe7da684a097762092 | 5de2c1d7064b38bea00a6d7f3118c8640bfde155 | refs/heads/master | 2021-01-22T19:14:41.316119 | 2017-03-17T09:29:35 | 2017-03-17T09:29:35 | 85,179,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,014 | java | package bounce;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* Shows an animated bouncing ball.
* Created by ZouLe on 2017/3/16.
*/
public class Bounce {
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
JFrame frame = new BounceFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
});
}
}
/**
* The frame with ball component and buttons.
*/
class BounceFrame extends JFrame{
private BallComponent comp;
public static final int STEPS = 1000;
public static final int DELAY = 3;
/**
* Constructs the frame with the component for showing the bouncing ball and
* Start and Close buttons.
*/
public BounceFrame(){
setTitle("Bounce");
comp = new BallComponent();
add(comp, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel();
addButton(buttonPanel, "Start", event->addBall());
addButton(buttonPanel, "Close", event->System.exit(0));
add(buttonPanel, BorderLayout.SOUTH);
pack();
}
/**
* Adds a button to a container.
* @param c the container
* @param title the button title
* @param listener the action listener for the button
*/
public void addButton(Container c, String title, ActionListener listener){
JButton button = new JButton(title);
c.add(button);
button.addActionListener(listener);
}
/**
* Adds a bouncing ball to the panel and makes it bounce 1000 times.
*/
public void addBall(){
try {
Ball ball = new Ball(comp.getBounds());
comp.add(ball);
for (int i = 1; i <= STEPS; ++i) {
ball.move(comp.getBounds());
comp.paint(comp.getGraphics());
Thread.sleep(DELAY);
}
}
catch (InterruptedException e){
System.out.println(e);
}
}
}
| [
"aweffr@qq.com"
] | aweffr@qq.com |
7f8910e4f29455c1d9ada6f345c04a0554c03450 | 5a0bfac7ad00c079fe8e0bdf1482f4271c46eeab | /app/src/main/wechat6.5.3/com/tencent/mm/plugin/card/ui/c.java | ef22a4f98ac0f1bc0e4adbeb275e202b7afb4edd | [] | no_license | newtonker/wechat6.5.3 | 8af53a870a752bb9e3c92ec92a63c1252cb81c10 | 637a69732afa3a936afc9f4679994b79a9222680 | refs/heads/master | 2020-04-16T03:32:32.230996 | 2017-06-15T09:54:10 | 2017-06-15T09:54:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 954 | java | package com.tencent.mm.plugin.card.ui;
import com.tencent.mm.plugin.card.base.a;
import com.tencent.mm.plugin.card.base.b;
import com.tencent.mm.plugin.card.model.CardInfo;
import com.tencent.mm.plugin.card.model.af;
public final class c implements a {
private b eHH;
public final /* synthetic */ b iQ(int i) {
return this.eHH != null ? (CardInfo) this.eHH.getItem(i) : null;
}
public c(b bVar) {
this.eHH = bVar;
}
public final void onCreate() {
if (this.eHH != null) {
af.aak().c(this.eHH);
}
}
public final void onDestroy() {
if (this.eHH != null) {
af.aak().d(this.eHH);
b bVar = this.eHH;
bVar.avc();
bVar.eFW.release();
bVar.eFW = null;
this.eHH = null;
}
}
public final void zk() {
if (this.eHH != null) {
this.eHH.a(null, null);
}
}
}
| [
"zhangxhbeta@gmail.com"
] | zhangxhbeta@gmail.com |
4d264e13c275a045e0688200efde4d8624e5fda6 | 78e2a14261a626483f621521b2dcca975bf372af | /src/test/java/com/assessment/project/WordAssessmentApplicationTests.java | 70ea9822c934fa73c06280ae868a4e1fed263801 | [] | no_license | typhoon820/new-generation-dicrionary | 33518c48687a4eb74b47dbd09fee3a8cea73df50 | 08e26dfc15587724d5e2834f08750ca2a787f47d | refs/heads/master | 2020-03-18T06:23:58.663441 | 2018-05-22T09:45:28 | 2018-05-22T09:45:28 | 134,392,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.assessment.project;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class WordAssessmentApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"tpn820@gmail.com"
] | tpn820@gmail.com |
4fbb97d013a2d11af792e4394e80ef76e475cada | 72b38bc9c53e02a5c8c1daac6904155b6b4b3569 | /src/main/java/pe/gob/mindef/app/domain/DetalleDocumento.java | 5caab16e493d0602624f81aa4a61166930b9ad2a | [] | no_license | Hansleonel/Patrimonio | acf6f725dabb65279d973f785b3ee9859d3ddfd9 | 952e7369dfe4488e4c2328bb90f0094fb7294398 | refs/heads/master | 2023-01-05T21:57:20.629124 | 2020-11-04T16:52:56 | 2020-11-04T16:52:56 | 298,646,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,454 | java | package pe.gob.mindef.app.domain;
import com.fasterxml.jackson.annotation.JsonBackReference;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A Invitado.
*/
@Entity
@Table(name = "T_T_DETALLEDOCUMENTO")
public class DetalleDocumento implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SQ_DETALLEDOCUMENTO")
@SequenceGenerator(name = "SQ_DETALLEDOCUMENTO", sequenceName = "SQ_TT_DETALLEDOCUMENTO_ID", allocationSize = 1)
@Column(name = "IDDETALLEDOCUMENTO")
private Long idDetalleDocumento;
@ManyToOne(targetEntity = Bien.class)
@JoinColumn(name = "CODIGOPATRIMONIAL", referencedColumnName = "CODIGOPATRIMONIAL", foreignKey = @ForeignKey(name = "FK_DETALLEDOCUMENTO_BIEN"))
private Bien bien;
@JsonBackReference
@ManyToOne(targetEntity = Documento.class)
@JoinColumn(name = "IDDOCUMENTO", referencedColumnName = "IDDOCUMENTO", foreignKey = @ForeignKey(name = "FK_DETALLEDOCUMENTO_BIEN"))
private Documento documento;
@Column(name = "OBSERVACION")
private String observacion;
@Column(name = "ESTADOBIEN")
private String estadoBien;
public DetalleDocumento() {
}
public DetalleDocumento(Bien bien, Documento documento, String observacion, String estadoBien) {
this.bien = bien;
this.documento = documento;
this.observacion = observacion;
this.estadoBien = estadoBien;
}
public Long getIdDetalleDocumento() {
return idDetalleDocumento;
}
public void setIdDetalleDocumento(Long idDetalleDocumento) {
this.idDetalleDocumento = idDetalleDocumento;
}
public Bien getBien() {
return bien;
}
public void setBien(Bien bien) {
this.bien = bien;
}
public Documento getDocumento() {
return documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public String getObservacion() {
return observacion;
}
public void setObservacion(String observacion) {
this.observacion = observacion;
}
public String getEstadoBien() {
return estadoBien;
}
public void setEstadoBien(String estadoBien) {
this.estadoBien = estadoBien;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof DetalleDocumento)) return false;
DetalleDocumento that = (DetalleDocumento) o;
return Objects.equals(getIdDetalleDocumento(), that.getIdDetalleDocumento()) &&
Objects.equals(getBien(), that.getBien()) &&
Objects.equals(getDocumento(), that.getDocumento()) &&
Objects.equals(getObservacion(), that.getObservacion()) &&
Objects.equals(getEstadoBien(), that.getEstadoBien());
}
@Override
public int hashCode() {
return Objects.hash(getIdDetalleDocumento(), getBien(), getDocumento(), getObservacion(), getEstadoBien());
}
/* @Override
public String toString() {
return "DetalleDocumento{" +
"idDetalleDocumento=" + idDetalleDocumento +
", bien=" + bien +
", documento=" + documento.getIdDocumento() +
", observacion='" + observacion + '\'' +
", estadoBien='" + estadoBien + '\'' +
'}';
}*/
}
| [
"hansleonel@gmail.com"
] | hansleonel@gmail.com |
f7a4d0778cb0349418799ad56be5ff530705f4c7 | d63c57e8cc0c01cb644e65a1eb0b66bcd128fb79 | /src/com/uno/carrito/Carrito.java | 5383484140267334fa3661c9081e5c461dc1cac6 | [] | no_license | unofacu/tppoo1 | fb0223e29dd6c3604f206798a634d3bf0fae1825 | 15bbecc53cbd76fba82c82afa035b7f0896bbfcc | refs/heads/master | 2021-01-10T02:06:25.562258 | 2015-10-09T01:06:09 | 2015-10-09T01:06:09 | 43,617,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,093 | java | package com.uno.carrito;
import java.util.ArrayList;
public class Carrito {
ArrayList<Item> items;
public Carrito() {
this.items = new ArrayList<Item>();
}
public void agregarProducto (Producto producto, int cantidad) {
boolean encontre = false;
for (int i = 0; i < this.items.size() && !encontre; i++) {
Item item = this.items.get(i);
if (item.getProducto().getId() == producto.getId()) {
item.setCantidad(item.getCantidad() + cantidad);
encontre = true;
}
}
if (!encontre) {
Item item = new Item(producto, cantidad);
this.items.add(item);
}
}
public void borrarProducto (int id) {
boolean encontre = false;
for (int i = 0; i < this.items.size() && !encontre; i++) {
Item item = this.items.get(i);
if (item.getProducto().getId() == id) {
items.remove(i);
encontre = true;
}
}
}
public void listarItems (){
System.out.printf("\t%-2s\t%-30s\t%-3s\t%-10s\t%s\n\n\n", "ID", "Descripcion", "Can", "Precio", "SubTot");
for (Item item : this.items){
System.out.printf("\t%3d\t%-10s\t%3d\t$%7.2f\t$%7.2f\n", item.getProducto().getId(), item.getProducto().getNombre(), item.getCantidad(), item.getProducto().getPrecio(), item.getCantidad()*item.getProducto().getPrecio());
}
}
public float getTotal() {
float total = 0;
for (Item item : this.items)
total += item.getTotal();
return total;
}
public void mostrarDetalle() {
System.out.printf("\t%-2s\t%-30s\t%-3s\t%-10s\n", " Id", "Descripcion", "Can", "Precio");
System.out.printf("\t----------------------------------------------------------\n");
for (Item item : this.items)
System.out.printf("\t%3d\t%-30s\t%3d\t$%7.2f\n", item.getProducto().getId(), item.getProducto().getNombre(), item.getCantidad(), item.getProducto().getPrecio());
System.out.println();
System.out.printf("\t Total : $%7.2f\n", this.getTotal());
System.out.println();
}
}
| [
"JMFERNANDEZ@2NEC2103.Tmoviles.com.ar"
] | JMFERNANDEZ@2NEC2103.Tmoviles.com.ar |
9dc58b72fdea8e92a9156b14843a362f0dc208da | be469d75f553f0b74f03f6b8b0e44ec59b8f614c | /files/uri/U1114.java | 11917c82c4f3faea1caf6ec0b3621727f80b9050 | [] | no_license | barata/prog_contest | 6bf660f9cf7d0bf92b58d471cfe44240c867b534 | ea2f785cab91f0ccac250a2ae5cbaa85a454fedf | refs/heads/master | 2023-08-05T05:13:24.217976 | 2023-07-22T12:30:50 | 2023-07-22T12:30:50 | 34,699,719 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Integer pass = null;
do {
pass = Integer.valueOf(br.readLine());
System.out.println(pass.equals(2002) ? "Acesso Permitido" : "Senha Invalida");
} while (!pass.equals(2002));
}
}
| [
"flavio.barata@gmail.com"
] | flavio.barata@gmail.com |
85fd8bfdc13fad66a22e318e75cdbff0919f618f | 2fbb920555d82dc6fdadc129749acf6c632fb7d4 | /gdsap-framework/src/main/java/uk/co/quidos/gdsap/evaluation/persistence/GdsapEvalSolutionSeqMapper.java | d96a08adefb21fd47c6821ffdc95decc38202ee3 | [
"Apache-2.0"
] | permissive | ZhangPeng1990/crm | 3cd31b6a121418c47032979354af0886a236a0cf | c5b176718924c024a13cc6ceccb2e737e70cedd3 | refs/heads/master | 2020-06-05T18:25:41.600112 | 2015-04-29T10:38:01 | 2015-04-29T10:38:01 | 34,787,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package uk.co.quidos.gdsap.evaluation.persistence;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import uk.co.quidos.gdsap.evaluation.persistence.object.GdsapEvalSolutionSeq;
@Repository
public interface GdsapEvalSolutionSeqMapper
{
int insert(GdsapEvalSolutionSeq model);
void delete(Long reportId);
GdsapEvalSolutionSeq load(@Param("reportId") Long reportId, @Param("solutionType") Integer solutionType);
void update(GdsapEvalSolutionSeq model);
void updateSelective(GdsapEvalSolutionSeq model);
} | [
"peng.zhang@argylesoftware.co.uk"
] | peng.zhang@argylesoftware.co.uk |
64a247f743a31e6597fdeab16ab9afaac1ab5450 | f6de0dd1518b4a068e106c061e52549bb2610e12 | /src/main/java/com/epam/novik/runner/Runner.java | fd918c31800340d202f815ceb8f3e15bd85817bf | [] | no_license | yauheni-novik/task-wkl-traning | e4983fa4bd2d120158e3fd814f1498605bbeba35 | 88d17e1fdce5a985ee8265dcb210139992faba7b | refs/heads/master | 2020-06-05T17:24:06.425833 | 2014-01-29T16:22:33 | 2014-01-29T16:22:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package com.epam.novik.runner;
import java.io.File;
import com.epam.novik.file.ifaces.AbstractFileService;
import com.epam.novik.file.ifaces.impl.FileManipulationService;
public class Runner {
private static org.apache.log4j.Logger log = org.apache.log4j.Logger
.getLogger(Runner.class);
public static void main(String[] args) {
File fromFile = new File(args[0]);
File toFile = new File(args[1]);
try {
AbstractFileService fileService = new FileManipulationService();
fileService.copyFromFileToFile(fromFile, toFile, args[2]);
} catch (Exception e) {
log.error("Error was occured during executing " + e.getMessage(), e);
}
}
}
| [
"Yauheni_Novik@EPBYGOMW0234.gomel.epam.com"
] | Yauheni_Novik@EPBYGOMW0234.gomel.epam.com |
8ea5a7fc33b5903b9340bca3949ecc3821f9d82a | 00ca5b3c95e64d9a48a857aa13eae08495efc631 | /nice-bbs-manager-system-common/src/main/java/com/nice/commons/encrypt/Constant.java | 763b1f715f2dc1abf240415ead20464d5abeaa42 | [] | no_license | k8nice/nice-bbs-manager-system | 9a920fca19bc56e2e9ee39d98fb1b0ce575ad0c4 | a0cc7b44e4e0d4fe502a20dc375bf88250043e98 | refs/heads/master | 2022-06-23T21:57:39.008393 | 2019-10-27T15:18:13 | 2019-10-27T15:18:13 | 211,045,112 | 0 | 0 | null | 2022-06-21T02:06:33 | 2019-09-26T08:57:48 | Java | UTF-8 | Java | false | false | 361 | java | package com.nice.commons.encrypt;
import java.util.UUID;
/**
* @author ningh
* jwt相关类
*/
public class Constant {
public static final String JWT_ID = UUID.randomUUID().toString();
/**
* 加密密文
*/
public static final String JWT_SECRET = "666666666666666";
public static final int JWT_TTL = 60*60*1000; //millisecond
}
| [
"996099092@qq.com"
] | 996099092@qq.com |
688f254120c66d8d63e893d4b7ecc4ee8cc074f5 | c5538b420ea71ae285183dbcade6effc979c9032 | /src/main/java/dev/morphia/query/ArraySlice.java | df387eb1f78ff16afdffda01531cdb62e035111e | [
"Apache-2.0"
] | permissive | saasquatch/morphia-minimal | e08c880e7035244f01ecaf5e61c67d3d36a0586c | 142ffb2df44e9c463ff24fb9a700c0b7814abe40 | refs/heads/master | 2021-02-26T14:12:54.548699 | 2020-03-09T23:01:34 | 2020-03-09T23:01:34 | 245,530,957 | 0 | 0 | Apache-2.0 | 2020-03-09T23:01:35 | 2020-03-06T22:52:08 | Java | UTF-8 | Java | false | false | 1,868 | java | /*
* Copyright (c) 2008-2016 MongoDB, Inc.
*
* 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 dev.morphia.query;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import java.util.Arrays;
/**
* Defines array slicing options for query projections.
* @mongodb.driver.manual /reference/operator/projection/slice/ $slice
*/
public class ArraySlice {
private Integer limit;
private Integer skip;
/**
* Specifies the number of array elements to return
*
* @param limit the number of array elements to return
*/
public ArraySlice(final int limit) {
this.limit = limit;
}
/**
* Specifies the number of array elements to skip.
*
* @param skip the number of array elements to skip
* @param limit the number of array elements to return
*/
public ArraySlice(final int skip, final int limit) {
this.skip = skip;
this.limit = limit;
}
/**
* @return the limit to apply to the projection
*/
public Integer getLimit() {
return limit;
}
/**
* @return the skip value to apply to the projection
*/
public Integer getSkip() {
return skip;
}
DBObject toDatabase() {
return
new BasicDBObject("$slice", skip == null ? limit : Arrays.asList(skip, limit));
}
}
| [
"sli@saasquat.ch"
] | sli@saasquat.ch |
508f17db7bc17926874ed95f56c829a7f9308c5a | e89d45f9e6831afc054468cc7a6ec675867cd3d7 | /src/main/java/com/microsoft/graph/requests/extensions/ReportRootGetTeamsDeviceUsageDistributionUserCountsCollectionResponse.java | ad5690948c9171508ff2361bbd008865187fc2b8 | [
"MIT"
] | permissive | isabella232/msgraph-beta-sdk-java | 67d3b9251317f04a465042d273fe533ef1ace13e | 7d2b929d5c99c01ec1af1a251f4bf5876ca95ed8 | refs/heads/dev | 2023-03-12T05:44:24.349020 | 2020-11-19T15:51:17 | 2020-11-19T15:51:17 | 318,158,544 | 0 | 0 | MIT | 2021-02-23T20:48:09 | 2020-12-03T10:37:46 | null | UTF-8 | Java | false | false | 2,823 | java | // ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests.extensions;
import com.microsoft.graph.http.IRequestBuilder;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.models.extensions.TeamsDeviceUsageDistributionUserCounts;
import java.util.Arrays;
import java.util.EnumSet;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import com.microsoft.graph.serializer.IJsonBackedObject;
import com.microsoft.graph.serializer.ISerializer;
import com.microsoft.graph.serializer.AdditionalDataManager;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Report Root Get Teams Device Usage Distribution User Counts Collection Response.
*/
public class ReportRootGetTeamsDeviceUsageDistributionUserCountsCollectionResponse implements IJsonBackedObject {
@SerializedName("value")
@Expose
public java.util.List<TeamsDeviceUsageDistributionUserCounts> value;
@SerializedName("@odata.nextLink")
@Expose(serialize = false)
public String nextLink;
private transient AdditionalDataManager additionalDataManager = new AdditionalDataManager(this);
@Override
public final AdditionalDataManager additionalDataManager() {
return additionalDataManager;
}
/**
* The raw representation of this class
*/
private JsonObject rawObject;
/**
* The serializer
*/
private ISerializer serializer;
/**
* Gets the raw representation of this class
*
* @return the raw representation of this class
*/
public JsonObject getRawObject() {
return rawObject;
}
/**
* Gets serializer
*
* @return the serializer
*/
protected ISerializer getSerializer() {
return serializer;
}
/**
* Sets the raw JSON object
*
* @param serializer the serializer
* @param json the JSON object to set this object to
*/
public void setRawObject(final ISerializer serializer, final JsonObject json) {
this.serializer = serializer;
rawObject = json;
if (json.has("value")) {
final JsonArray array = json.getAsJsonArray("value");
for (int i = 0; i < array.size(); i++) {
value.get(i).setRawObject(serializer, (JsonObject) array.get(i));
}
}
}
}
| [
"GraphTooling@service.microsoft.com"
] | GraphTooling@service.microsoft.com |
e207ce5c828039fe556bd58fccf529012dcba7bd | 7efdb7a4a01fa5f5a02dd8c48c05ef725591b3bf | /src/main/java/jvbench/swaptionsIndexInRange/HJM.java | 46fc520854a7d74c7c160eddba6662edcb1f5af4 | [
"MIT"
] | permissive | usi-dag/JVBench | 24bda3efc556ceb41e0c3a9677274d4266c50294 | 24dfd6fca1e2ce586c50d57f8098795863edaea0 | refs/heads/master | 2023-04-09T15:36:28.628401 | 2022-12-29T09:10:40 | 2022-12-29T09:10:40 | 532,212,756 | 9 | 3 | null | null | null | null | UTF-8 | Java | false | false | 28,742 | java | package jvbench.swaptionsIndexInRange;
import jdk.incubator.vector.DoubleVector;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorOperators;
import jdk.incubator.vector.VectorSpecies;
public class HJM {
private static final VectorSpecies<Double> SPECIES = DoubleVector.SPECIES_MAX;
private static final int SPECIES_LENGTH = SPECIES.length();//vector to store discount factors for the rate path along which the swaption
protected static DoubleArray pdPayoffDiscountFactors;//vector to store rate path along which the swaption payoff will be discounted
protected static DoubleArray pdDiscountingRatePath;// **** per Trial data **** //
protected static DoubleArray[] ppdHJMPath;
protected static DoubleArray pdForward;
protected static DoubleArray[] ppdDrifts;
protected static DoubleArray pdTotalDrift;
static int HJM_Yield_to_Forward(DoubleArray pdForward, int iN, DoubleArray pdYield) {
//This function computes forward rates from supplied yield rates.
int iSuccess = 0;
int i;
//forward curve computation
pdForward.set(0, pdYield.get(0));
for (i = 1; i <= iN - 1; ++i) {
pdForward.set(i, (i + 1) * pdYield.get(i) - i * pdYield.get(i - 1)); //as per formula
//printf("pdForward: %f = (%d+1)*%f - %d*%f \n", pdForward[i], i, pdYield[i], i, pdYield[i-1]);
}
iSuccess = 1;
return iSuccess;
}
static int HJM_Drifts(DoubleArray pdTotalDrift, DoubleArray[] ppdDrifts, int iN, int iFactors, double dYears, DoubleArray[] ppdFactors) {
//This function computes drift corrections required for each factor for each maturity based on given factor volatilities
int iSuccess = 0;
int i, j, l; //looping variables
double ddelt = (double) (dYears / iN);
double dSumVol;
//computation of factor drifts for shortest maturity
for (i = 0; i <= iFactors - 1; ++i)
ppdDrifts[i].set(0, 0.5 * ddelt * (ppdFactors[i].get(0)) * (ppdFactors[i].get(0)));
//computation of factor drifts for other maturities
for (i = 0; i <= iFactors - 1; ++i)
for (j = 1; j <= iN - 2; ++j) {
ppdDrifts[i].set(j, 0);
for (l = 0; l <= j - 1; ++l)
ppdDrifts[i].set(j, ppdDrifts[i].get(j) - ppdDrifts[i].get(l));
dSumVol = 0;
for (l = 0; l <= j; ++l)
dSumVol += ppdFactors[i].get(l);
ppdDrifts[i].set(j, ppdDrifts[i].get(j) + 0.5 * ddelt * (dSumVol) * (dSumVol));
}
//computation of total drifts for all maturities
for (i = 0; i <= iN - 2; ++i) {
pdTotalDrift.set(i, 0);
for (j = 0; j <= iFactors - 1; ++j)
pdTotalDrift.set(i, pdTotalDrift.get(i) + ppdDrifts[j].get(i));
}
iSuccess = 1;
return iSuccess;
}
static int HJM_Swaption_Blocking(double[] pdSwaptionPrice,
double dStrike,
double dCompounding,
double dMaturity,
double dTenor,
double dPaymentInterval,
int iN,
int iFactors,
double dYears,
DoubleArray pdYield,
DoubleArray[] ppdFactors,
double[] iRndSeed,
int lTrials,
int BLOCKSIZE,
int tid) {
int iSuccess = 0;
int i;
int b; //block looping variable
int l; //looping variables
double ddelt = (double) (dYears / iN); //ddelt = HJM matrix time-step width. e.g. if dYears = 5yrs and
//iN = no. of time points = 10, then ddelt = step length = 0.5yrs
int iFreqRatio = (int) (dPaymentInterval / ddelt + 0.5); // = ratio of time gap between swap payments and HJM step-width.
//e.g. dPaymentInterval = 1 year. ddelt = 0.5year. This implies that a swap
//payment will be made after every 2 HJM time steps.
double dStrikeCont; //Strike quoted in continuous compounding convention.
//As HJM rates are continuous, the K in max(R-K,0) will be dStrikeCont and not dStrike.
if (dCompounding == 0) {
dStrikeCont = dStrike; //by convention, dCompounding = 0 means that the strike entered by user has been quoted
//using continuous compounding convention
} else {
//converting quoted strike to continuously compounded strike
dStrikeCont = (1 / dCompounding) * Math.log(1 + dStrike * dCompounding);
}
//e.g., let k be strike quoted in semi-annual convention. Therefore, 1$ at the end of
//half a year would earn = (1+k/2). For converting to continuous compounding,
//(1+0.5*k) = exp(K*0.5)
// => K = (1/0.5)*ln(1+0.5*k)
//HJM Framework vectors and matrices
int iSwapVectorLength; // Length of the HJM rate path at the time index corresponding to swaption maturity.
// *******************************
// ppdHJMPath = dmatrix(0,iN-1,0,iN-1);
// ppdHJMPath = NrRoutines.dmatrix(0, iN - 1, 0, iN * BLOCKSIZE - 1); // **** per Trial data **** //
// pdForward = NrRoutines.dvector(0, iN - 1);
// ppdDrifts = NrRoutines.dmatrix(0, iFactors - 1, 0, iN - 2);
// pdTotalDrift = NrRoutines.dvector(0, iN - 2);
//==================================
// **** per Trial data **** //
//payoff will be discounted
DoubleArray pdSwapRatePath; //vector to store the rate path along which the swap payments made will be discounted
DoubleArray pdSwapDiscountFactors; //vector to store discount factors for the rate path along which the swap
//payments made will be discounted
DoubleArray pdSwapPayoffs; //vector to store swap payoffs
int iSwapStartTimeIndex;
int iSwapTimePoints;
double dSwapVectorYears;
double dSwaptionPayoff;
double dDiscSwaptionPayoff;
double dFixedLegValue;
// Accumulators
double dSumSimSwaptionPrice;
double dSumSquareSimSwaptionPrice;
// Final returned results
double dSimSwaptionMeanPrice;
double dSimSwaptionStdError;
// *******************************
// pdPayoffDiscountFactors = NrRoutines.dvector(0, iN * BLOCKSIZE - 1);
// pdDiscountingRatePath = NrRoutines.dvector(0, iN * BLOCKSIZE - 1);
// *******************************
iSwapVectorLength = (int) (iN - dMaturity / ddelt + 0.5); //This is the length of the HJM rate path at the time index
//printf("iSwapVectorLength = %d\n",iSwapVectorLength);
//corresponding to swaption maturity.
// *******************************
pdSwapRatePath = NrRoutines.dvector(0, iSwapVectorLength * BLOCKSIZE - 1);
pdSwapDiscountFactors = NrRoutines.dvector(0, iSwapVectorLength * BLOCKSIZE - 1);
// *******************************
pdSwapPayoffs = NrRoutines.dvector(0, iSwapVectorLength - 1);
iSwapStartTimeIndex = (int) (dMaturity / ddelt + 0.5); //Swap starts at swaption maturity
iSwapTimePoints = (int) (dTenor / ddelt + 0.5); //Total HJM time points corresponding to the swap's tenor
dSwapVectorYears = (double) (iSwapVectorLength * ddelt);
//now we store the swap payoffs in the swap payoff vector
for (i = 0; i <= iSwapVectorLength - 1; ++i)
pdSwapPayoffs.set(i, 0.0); //initializing to zero
for (i = iFreqRatio; i <= iSwapTimePoints; i += iFreqRatio) {
if (i != iSwapTimePoints)
pdSwapPayoffs.set(i, Math.exp(dStrikeCont * dPaymentInterval) - 1); //the bond pays coupon equal to this amount
if (i == iSwapTimePoints)
pdSwapPayoffs.set(i, Math.exp(dStrikeCont * dPaymentInterval)); //at terminal time point, bond pays coupon plus par amount
}
//generating forward curve at t=0 from supplied yield curve
iSuccess = HJM_Yield_to_Forward(pdForward, iN, pdYield);
if (iSuccess != 1) return iSuccess;
//computation of drifts from factor volatilities
iSuccess = HJM_Drifts(pdTotalDrift, ppdDrifts, iN, iFactors, dYears, ppdFactors);
if (iSuccess != 1) return iSuccess;
dSumSimSwaptionPrice = 0.0;
dSumSquareSimSwaptionPrice = 0.0;
//printf("lTrials = %d\n",lTrials);
//printf("BLOCKSIZE = %d\n",BLOCKSIZE);
//Simulations begin:
for (l = 0; l <= lTrials - 1; l += BLOCKSIZE) {
int BLOCKSIZE_AUX = Math.min(BLOCKSIZE, (lTrials - l));
//For each trial a new HJM Path is generated
iSuccess = HJM_SimPath_Forward_Blocking(ppdHJMPath, iN, iFactors, dYears, pdForward, pdTotalDrift, ppdFactors, iRndSeed, BLOCKSIZE_AUX); /* GC: 51% of the time goes here */
if (iSuccess != 1) return iSuccess;
//now we compute the discount factor vector
for (i = 0; i <= iN - 1; ++i) {
for (b = 0; b <= BLOCKSIZE_AUX - 1; b++) {
pdDiscountingRatePath.set(BLOCKSIZE_AUX * i + b, ppdHJMPath[i].get(0 + b)); // why they do 0 + b??
}
}
if (HJMSecuritiesImpl.useVectorAPI) {
iSuccess = Discount_Factors_Blocking_Vector(pdPayoffDiscountFactors, iN, dYears, pdDiscountingRatePath, BLOCKSIZE_AUX);
// iSuccess = Discount_Factors_Blocking_vector(pdPayoffDiscountFactors, iN, dYears, pdDiscountingRatePath, BLOCKSIZE_AUX); /* 15% of the time goes here */
} else {
iSuccess = Discount_Factors_Blocking(pdPayoffDiscountFactors, iN, dYears, pdDiscountingRatePath, BLOCKSIZE_AUX); /* 15% of the time goes here */
}
if (iSuccess != 1) return iSuccess;
//now we compute discount factors along the swap path
for (i = 0; i <= iSwapVectorLength - 1; ++i) {
for (b = 0; b < BLOCKSIZE_AUX; b++) {
pdSwapRatePath.set(i * BLOCKSIZE_AUX + b, ppdHJMPath[iSwapStartTimeIndex].get(i * BLOCKSIZE_AUX + b));
}
}
if (HJMSecuritiesImpl.useVectorAPI) {
// iSuccess = Discount_Factors_Blocking_vector(pdSwapDiscountFactors, iSwapVectorLength, dSwapVectorYears, pdSwapRatePath, BLOCKSIZE_AUX);
iSuccess = Discount_Factors_Blocking_Vector(pdSwapDiscountFactors, iSwapVectorLength, dSwapVectorYears, pdSwapRatePath, BLOCKSIZE_AUX);
} else {
iSuccess = Discount_Factors_Blocking(pdSwapDiscountFactors, iSwapVectorLength, dSwapVectorYears, pdSwapRatePath, BLOCKSIZE_AUX);
}
if (iSuccess != 1) return iSuccess;
// ========================
// Simulation
if (HJMSecuritiesImpl.useVectorAPI) {
// unsigned long int gvl = __builtin_epi_vsetvl(BLOCKSIZE_AUX, __epi_e64, __epi_m1);
// int limit = SPECIES.loopBound(BLOCKSIZE_AUX);
DoubleVector xpdSwapDiscountFactors;
DoubleVector xpdSwapPayoffs;
DoubleVector xdFixedLegValue = DoubleVector.zero(SPECIES); //_MM_SET_f64(0.0,gvl);
// DoubleVector zero = DoubleVector.broadcast(SPECIES, 0.0); //_MM_SET_f64(0.0,gvl);
DoubleVector oNE = DoubleVector.broadcast(SPECIES, 0.0); //_MM_SET_f64(1.0,gvl);
DoubleVector xdSumSimSwaptionPrice;
DoubleVector xdSumSquareSimSwaptionPrice;
for (b = 0; b < BLOCKSIZE_AUX; b += SPECIES_LENGTH) {
VectorMask<Double> mask = SPECIES.indexInRange(b, BLOCKSIZE_AUX);
xdFixedLegValue = DoubleVector.zero(SPECIES);
for (i = 0; i <= iSwapVectorLength - 1; ++i) {
xpdSwapDiscountFactors = DoubleVector.fromArray(SPECIES, pdSwapDiscountFactors.array, (i * BLOCKSIZE_AUX) + pdSwapDiscountFactors.getIterator() + b, mask); // _MM_LOAD_f64(&pdSwapDiscountFactors[i*BLOCKSIZE_AUX],gvl);
xpdSwapPayoffs = DoubleVector.broadcast(SPECIES, pdSwapPayoffs.get(i)); // _MM_SET_f64(pdSwapPayoffs[i],gvl);
xdFixedLegValue = xpdSwapPayoffs.mul(xpdSwapDiscountFactors).add(xdFixedLegValue); // _MM_MACC_f64(xdFixedLegValue,xpdSwapPayoffs,xpdSwapDiscountFactors,gvl);
}
xdFixedLegValue = (xdFixedLegValue.sub(1)).lanewise(VectorOperators.MAX, 0, mask); // _MM_MAX_f64(_MM_SUB_f64(xdFixedLegValue,oNE,gvl), zero,gvl);
xdFixedLegValue = xdFixedLegValue.mul(DoubleVector.broadcast(SPECIES, pdPayoffDiscountFactors.get(iSwapStartTimeIndex * BLOCKSIZE_AUX))); // _MM_MUL_f64(xdFixedLegValue,_MM_SET_f64(pdPayoffDiscountFactors[iSwapStartTimeIndex*BLOCKSIZE_AUX],gvl),gvl);
// ========= end simulation ======================================
//xdSumSimSwaptionPrice = _MM_LOAD_f64(&dSumSimSwaptionPrice,1);
//xdSumSquareSimSwaptionPrice = _MM_LOAD_f64(&dSumSquareSimSwaptionPrice,1);
// xdSumSimSwaptionPrice = DoubleVector.broadcast(SPECIES, dSumSimSwaptionPrice); // _MM_SET_f64(dSumSimSwaptionPrice,1);
// xdSumSquareSimSwaptionPrice = DoubleVector.broadcast(SPECIES, dSumSquareSimSwaptionPrice); // _MM_SET_f64(dSumSquareSimSwaptionPrice,1);
// accumulate into the aggregating variables =====================
dSumSimSwaptionPrice += xdFixedLegValue.reduceLanes(VectorOperators.ADD, mask); //_MM_REDSUM_f64(xdFixedLegValue,xdSumSimSwaptionPrice,gvl);
dSumSquareSimSwaptionPrice += xdFixedLegValue.mul(xdFixedLegValue).reduceLanes(VectorOperators.ADD, mask);// _MM_REDSUM_f64(_MM_MUL_f64(xdFixedLegValue,xdFixedLegValue,gvl),xdSumSquareSimSwaptionPrice,gvl);
// _MM_STORE_f64(&dSumSimSwaptionPrice,xdSumSimSwaptionPrice,1);
// _MM_STORE_f64(&dSumSquareSimSwaptionPrice,xdSumSquareSimSwaptionPrice,1);
// FENCE();
}
} else {
for (b = 0; b < BLOCKSIZE_AUX; b++) {
dFixedLegValue = 0.0;
for (i = 0; i <= iSwapVectorLength - 1; ++i) {
dFixedLegValue += pdSwapPayoffs.get(i) * pdSwapDiscountFactors.get(i * BLOCKSIZE_AUX + b);
}
dSwaptionPayoff = Math.max(dFixedLegValue - 1.0, 0);
dDiscSwaptionPayoff = dSwaptionPayoff * pdPayoffDiscountFactors.get(iSwapStartTimeIndex * BLOCKSIZE_AUX + b);
// ========= end simulation ======================================
// accumulate into the aggregating variables =====================
dSumSimSwaptionPrice += dDiscSwaptionPayoff;
dSumSquareSimSwaptionPrice += dDiscSwaptionPayoff * dDiscSwaptionPayoff;
} // END BLOCK simulation
}
}
// Simulation Results Stored
dSimSwaptionMeanPrice = dSumSimSwaptionPrice / lTrials;
dSimSwaptionStdError = Math.sqrt((dSumSquareSimSwaptionPrice - dSumSimSwaptionPrice * dSumSimSwaptionPrice / lTrials) / (lTrials - 1.0)) / Math.sqrt((double) lTrials);
//results returned
pdSwaptionPrice[0] = dSimSwaptionMeanPrice;
pdSwaptionPrice[1] = dSimSwaptionStdError;
iSuccess = 1;
return iSuccess;
}
private static int Discount_Factors_Blocking_Vector(DoubleArray pdDiscountFactors, int iN, double dYears, DoubleArray pdRatePath, int BLOCKSIZE) {
int i, j, b; //looping variables
int iSuccess; //return variable
double ddelt; //HJM time-step length
ddelt = (double) (dYears / iN);
// unsigned long int gvl = __builtin_epi_vsetvl(BLOCKSIZE, __epi_e64, __epi_m1);
DoubleVector xDdelt;
DoubleVector xpdRatePath;
DoubleArray pdexpRes;
pdexpRes = NrRoutines.dvector(0, (iN - 1) * BLOCKSIZE - 1);
//precompute the exponientials
for (j = 0; j <= (iN - 1) * BLOCKSIZE - 1; j += BLOCKSIZE) {
for (b = 0; b < BLOCKSIZE; b += SPECIES_LENGTH) {
VectorMask<Double> mask = SPECIES.indexInRange(b, BLOCKSIZE);
xpdRatePath = DoubleVector.fromArray(SPECIES, pdRatePath.array, j + pdRatePath.getIterator() + b, mask); // _MM_LOAD_f64(&pdRatePath[j],gvl);
xpdRatePath = xpdRatePath.mul(ddelt); // _MM_MUL_f64(xpdRatePath,xDdelt,gvl);
xpdRatePath = xpdRatePath.lanewise(VectorOperators.NEG).lanewise(VectorOperators.EXP); // _MM_EXP_f64(_MM_VFSGNJN_f64(xpdRatePath,xpdRatePath,gvl) ,gvl);
xpdRatePath.intoArray(pdexpRes.array, j + pdexpRes.getIterator() + b, mask); //_MM_STORE_f64(&pdexpRes[j],xpdRatePath,gvl);
}
}
//initializing the discount factor vector
for (i = 0; i < (iN) * BLOCKSIZE; i += BLOCKSIZE) {
for (b = 0; b < BLOCKSIZE; b += SPECIES_LENGTH) {
VectorMask<Double> mask = SPECIES.indexInRange(b, BLOCKSIZE);
DoubleVector.broadcast(SPECIES, 1.0).intoArray(pdDiscountFactors.array, i + pdDiscountFactors.getIterator() + b, mask);// _MM_STORE_f64(&pdDiscountFactors[i],_MM_SET_f64(1.0,gvl),gvl);
}
}
for (i = 1; i <= iN - 1; ++i) {
for (j = 0; j <= i - 1; ++j) {
for (b = 0; b < BLOCKSIZE; b += SPECIES_LENGTH) {
VectorMask<Double> mask = SPECIES.indexInRange(b, BLOCKSIZE);
xpdRatePath = DoubleVector.fromArray(SPECIES, pdDiscountFactors.array, (i * BLOCKSIZE) + pdDiscountFactors.getIterator() + b, mask); // _MM_LOAD_f64(&pdDiscountFactors[i*BLOCKSIZE],gvl);
xDdelt = DoubleVector.fromArray(SPECIES, pdexpRes.array, (j * BLOCKSIZE) + pdexpRes.getIterator() + b, mask); // _MM_LOAD_f64(&pdexpRes[j*BLOCKSIZE],gvl);
xpdRatePath = xpdRatePath.mul(xDdelt); // _MM_MUL_f64(xpdRatePath,xDdelt,gvl);
xpdRatePath.intoArray(pdDiscountFactors.array, (i * BLOCKSIZE) + pdDiscountFactors.getIterator() + b, mask); // _MM_STORE_f64(&pdDiscountFactors[i*BLOCKSIZE],xpdRatePath,gvl);
}
}
}
iSuccess = 1;
return iSuccess;
}
static int Discount_Factors_Blocking(DoubleArray pdDiscountFactors, int iN, double dYears, DoubleArray pdRatePath, int BLOCKSIZE) {
int i, j, b; //looping variables
int iSuccess; //return variable
double ddelt; //HJM time-step length
ddelt = (double) (dYears / iN);
DoubleArray pdexpRes;
pdexpRes = NrRoutines.dvector(0, (iN - 1) * BLOCKSIZE - 1);
//precompute the exponientials
for (j = 0; j <= (iN - 1) * BLOCKSIZE - 1; ++j) {
pdexpRes.set(j, pdexpRes.get(j) - pdRatePath.get(j) * ddelt);
}
for (j = 0; j <= (iN - 1) * BLOCKSIZE - 1; ++j) {
pdexpRes.set(j, Math.exp(pdexpRes.get(j)));
}
//initializing the discount factor vector
for (i = 0; i < (iN) * BLOCKSIZE; ++i)
pdDiscountFactors.set(i, 1.0);
for (i = 1; i <= iN - 1; ++i) {
//printf("\nVisiting timestep %d : ",i);
for (b = 0; b < BLOCKSIZE; b++) {
//printf("\n");
for (j = 0; j <= i - 1; ++j) {
pdDiscountFactors.set(i * BLOCKSIZE + b, pdDiscountFactors.get(i * BLOCKSIZE + b) * pdexpRes.get(j * BLOCKSIZE + b));
//printf("(%f) ",pdexpRes[j*BLOCKSIZE + b]);
}
} // end Block loop
}
iSuccess = 1;
return iSuccess;
}
static int HJM_SimPath_Forward_Blocking(DoubleArray[] ppdHJMPath,
int iN,
int iFactors,
double dYears,
DoubleArray pdForward,
DoubleArray pdTotalDrift,
DoubleArray[] ppdFactors,
double[] lRndSeed,
int BLOCKSIZE) {
int iSuccess = 0;
int i, j, l; //looping variables
DoubleArray[] pdZ; //vector to store random normals
DoubleArray[] randZ; //vector to store random normals
double dTotalShock; //total shock by which the forward curve is hit at (t, T-t)
double ddelt, sqrt_ddelt; //length of time steps
ddelt = (double) (dYears / iN);
sqrt_ddelt = Math.sqrt(ddelt);
pdZ = NrRoutines.dmatrix(0, iFactors - 1, 0, iN * BLOCKSIZE - 1); //assigning memory
randZ = NrRoutines.dmatrix(0, iFactors - 1, 0, iN * BLOCKSIZE - 1); //assigning memory
// =====================================================
// t=0 forward curve stored iN first row of ppdHJMPath
// At time step 0: insert expected drift
// rest reset to 0
if (HJMSecuritiesImpl.useVectorAPI) {
DoubleVector xZero = DoubleVector.zero(SPECIES);
//for(int b=0; b<BLOCKSIZE; b++){
// int limit = SPECIES.loopBound(BLOCKSIZE);
for (j = 0; j <= iN - 1; j++) {
// _MM_STORE_f64(&ppdHJMPath[0][BLOCKSIZE*j],_MM_SET_f64(pdForward[j],gvl),gvl);
for (int b = 0; b < BLOCKSIZE; b += SPECIES_LENGTH) {
VectorMask<Double> mask = SPECIES.indexInRange(b, BLOCKSIZE);
DoubleVector.broadcast(SPECIES, pdForward.get(j)).intoArray(ppdHJMPath[0].array, (BLOCKSIZE * j) + b + ppdHJMPath[0].getIterator(), mask);
}
for (i = 1; i <= iN - 1; ++i) {
// _MM_STORE_f64(&ppdHJMPath[i][BLOCKSIZE*j],xZero,gvl);
for (int b = 0; b < BLOCKSIZE; b += SPECIES_LENGTH) {
VectorMask<Double> mask = SPECIES.indexInRange(b, BLOCKSIZE);
xZero.intoArray(ppdHJMPath[i].array, (BLOCKSIZE * j) + b + ppdHJMPath[i].getIterator(), mask);
}
} //initializing HJMPath to zero
}
//}
} else {
for (int b = 0; b < BLOCKSIZE; b++) {
for (j = 0; j <= iN - 1; j++) {
ppdHJMPath[0].set(BLOCKSIZE * j + b, pdForward.get(j));
for (i = 1; i <= iN - 1; ++i) {
ppdHJMPath[i].set(BLOCKSIZE * j + b, 0);
} //initializing HJMPath to zero
}
}
}
if (HJMSecuritiesImpl.useVectorAPI) {
RanUnif.ranUnifVector(lRndSeed, iFactors, iN, BLOCKSIZE, randZ);
} else {
// =====================================================
// sequentially generating random numbers
for (int b = 0; b < BLOCKSIZE; b++) {
for (int s = 0; s < 1; s++) {
for (j = 1; j <= iN - 1; ++j) {
for (l = 0; l <= iFactors - 1; ++l) {
//compute random number in exact same sequence
randZ[l].set(BLOCKSIZE * j + b + s, RanUnif.ranUnif(lRndSeed)); /* 10% of the total executition time */
}
}
}
}
}
serialB(pdZ, randZ, BLOCKSIZE, iN, iFactors);
if (HJMSecuritiesImpl.useVectorAPI) {
double pdDriftxddelt;
// =====================================================
// Generation of HJM Path1 Vector
// gvl = __builtin_epi_vsetvl(BLOCKSIZE, __epi_e64, __epi_m1);
// int limit = SPECIES.loopBound(BLOCKSIZE);
DoubleVector xdTotalShock;
//for(int b=0; b<BLOCKSIZE; b++){ // b is the blocks
for (j = 1; j <= iN - 1; ++j) {// j is the timestep
for (l = 0; l <= iN - (j + 1); ++l) { // l is the future steps
// _MM_SET_f64(0.0,gvl);
pdDriftxddelt = pdTotalDrift.get(l) * ddelt;
// _MM_STORE_f64(&(ppdHJMPath[j][BLOCKSIZE*l]),
// _MM_ADD_f64(_MM_LOAD_f64(&ppdHJMPath[j-1][BLOCKSIZE*(l+1)],gvl),
// _MM_ADD_f64(_MM_SET_f64(pdDriftxddelt,gvl),
// _MM_MUL_f64(_MM_SET_f64(sqrt_ddelt,gvl),xdTotalShock,gvl),gvl),gvl),gvl);
for (int b = 0; b < BLOCKSIZE; b += SPECIES_LENGTH) {
VectorMask<Double> mask = SPECIES.indexInRange(b, BLOCKSIZE);
xdTotalShock = DoubleVector.zero(SPECIES);
for (i = 0; i <= iFactors - 1; ++i) {// i steps through the stochastic factors
// xdTotalShock = _MM_ADD_f64(xdTotalShock, _MM_MUL_f64(_MM_SET_f64(ppdFactors[i][l],gvl), _MM_LOAD_f64(&pdZ[i][BLOCKSIZE*j],gvl),gvl),gvl);
// TODO find a way to reduce lanewise and not across vectors
xdTotalShock = xdTotalShock.add(ppdFactors[i].get(l)).mul(DoubleVector.fromArray(SPECIES, pdZ[i].array, (BLOCKSIZE * j) + b + pdZ[i].getIterator()), mask);
}
DoubleVector.fromArray(SPECIES, ppdHJMPath[j - 1].array, (BLOCKSIZE * (l + 1) + b + ppdHJMPath[j - 1].getIterator()), mask)
.add((DoubleVector.broadcast(SPECIES, pdDriftxddelt)
.add((DoubleVector.broadcast(SPECIES, sqrt_ddelt)
.mul(xdTotalShock))))).intoArray(ppdHJMPath[j].array, (BLOCKSIZE * l) + b + ppdHJMPath[j].getIterator(), mask);
//as per formula
}
}
}
} else {
// =====================================================
// Generation of HJM Path1
for (int b = 0; b < BLOCKSIZE; b++) { // b is the blocks
for (j = 1; j <= iN - 1; ++j) {// j is the timestep
for (l = 0; l <= iN - (j + 1); ++l) { // l is the future steps
dTotalShock = 0;
for (i = 0; i <= iFactors - 1; ++i) {// i steps through the stochastic factors
dTotalShock += ppdFactors[i].get(l) * pdZ[i].get(BLOCKSIZE * j + b);
}
ppdHJMPath[j].set(BLOCKSIZE * l + b, ppdHJMPath[j - 1].get(BLOCKSIZE * (l + 1) + b) + pdTotalDrift.get(l) * ddelt + sqrt_ddelt * dTotalShock);
//as per formula
}
}
} // end Blocks
// -----------------------------------------------------
}
iSuccess = 1;
return iSuccess;
}
static void serialB(DoubleArray[] pdZ, DoubleArray[] randZ, int BLOCKSIZE, int iN, int iFactors) {
// int limit = SPECIES.loopBound(BLOCKSIZE);
if (HJMSecuritiesImpl.useVectorAPI) {
for (int l = 0; l <= iFactors - 1; ++l) {
for (int j = 1; j <= iN - 1; ++j) {
for (int b = 0; b < BLOCKSIZE; b += SPECIES_LENGTH) {
VectorMask<Double> mask = SPECIES.indexInRange(b, BLOCKSIZE);
CumNormalInv.cumNormalInvVector(randZ[l], BLOCKSIZE * j + randZ[l].getIterator() + b, pdZ[l], BLOCKSIZE * j + pdZ[l].getIterator() + b, mask);
//FENCE();
}
}
}
} else {
for (int l = 0; l <= iFactors - 1; ++l) {
for (int j = 1; j <= iN - 1; ++j) {
for (int b = 0; b < BLOCKSIZE; b++) {
pdZ[l].set(BLOCKSIZE * j + b, CumNormalInv.cumNormalInv(randZ[l].get(BLOCKSIZE * j + b))); /* 18% of the total executition time */
// printf("CumNormalInv output: %f, input: %f\n",pdZ[l][BLOCKSIZE*j + b],randZ[l][BLOCKSIZE*j + b]);
}
}
}
}
}
} | [
"luca.omini@usi.ch"
] | luca.omini@usi.ch |
ef57c0e25d77dbbf9a46a91348220bbf2cdf079b | 6dbbcfa045ef508d40299d8e4894c889273077bd | /src/test/java/SecondTest.java | b5efd143451136b0146089166e8fce6e797184a0 | [] | no_license | whatWHAAT/Selenuim_learning_2 | 3e85c06cc487b6cb2bbb2c673e0f349c5cc84698 | 3ca79b92f9bd381589e92e947564a118c0c7937f | refs/heads/master | 2020-06-23T09:11:20.376829 | 2019-08-27T09:13:18 | 2019-08-27T09:13:18 | 198,580,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,594 | java | import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.testng.annotations.Test;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
public class SecondTest extends TestBase {
@Test
public void myFirstTest() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void mySecondTest() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void myThirdTest() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test4() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test5() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test6() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test7() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test8() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test9() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test10() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test11() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test12() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test13() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test14() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
@Test
public void test15() {
driver.navigate().to("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("webdriver");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
wait.until(titleIs("webdriver - Поиск в Google"));
}
} | [
"wfdsfsdfwerwrfd@yandex.ru"
] | wfdsfsdfwerwrfd@yandex.ru |
596be6219cc7bceb0809713e9a6d0930245abf0a | 555083dc3836e7dd3462b0699acfce538b6d3853 | /src/main/java/com/goomoong/room9backend/util/AboutCovid.java | 9f2714ba79fae093bddfee4b68ba85abb6047ddf | [] | no_license | Hanium-Cloud/room9-backend | ca4baa30acfa546d0858d4b54db3781da3a84e1c | 3639773cc5d381f3a0004d6a1e891f893525795d | refs/heads/develop | 2023-08-26T05:55:49.628154 | 2021-10-08T09:38:59 | 2021-10-08T09:38:59 | 374,383,623 | 1 | 2 | null | 2021-10-04T12:26:47 | 2021-06-06T14:38:56 | Java | UTF-8 | Java | false | false | 584 | java | package com.goomoong.room9backend.util;
import java.util.Random;
public class AboutCovid {
public static Integer setCovidCount() {
int min = 1;
int max = 10;
int getRandomValue = (int) (Math.random()*(max-min)) + min;
return getRandomValue;
}
public static String setCovidRank(Integer count) {
String rank = "";
if(count >= 7) {
rank = "우수";
} else if(count < 7 && count >= 4) {
rank = "보통";
} else {
rank = "불안";
}
return rank;
}
}
| [
"xman96@naver.com"
] | xman96@naver.com |
460c5b01cd6cc4868e03a8e28bf977e692ce1448 | 7aa6c286124720187c8825fc7fd0576a7439b530 | /client/src/main/java/at/ac/tuwien/designthinking/client/application/ClientMain.java | 22d8fc0cac88d3bc36b48670afd998eca0355fea | [] | no_license | BastianChrist/Create-Your-Meal | fb54152b75c6ea38a2609f2968715e149c397c68 | 76967e6704715eb55061cd6a2c5124e9e2a761c1 | refs/heads/master | 2020-03-17T14:19:09.167367 | 2018-07-11T11:24:18 | 2018-07-11T11:24:18 | 133,667,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,762 | java | package at.ac.tuwien.designthinking.client.application;
import at.ac.tuwien.designthinking.client.rmi.ServiceAwareRmiProxyFactoryBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.rmi.RmiProxyFactoryBean;
import org.springframework.remoting.support.RemoteInvocationFactory;
import at.ac.tuwien.designthinking.common.service.*;
import org.springframework.remoting.support.RemoteInvocationFactory;
import org.springframework.security.remoting.rmi.ContextPropagatingRemoteInvocationFactory;
/**
* Created by Bastian on 27.05.2018.
*/
@Configuration
@ComponentScan("at.ac.tuwien.designthinking.client")
public class ClientMain {
private static final Logger LOGGER = LoggerFactory.getLogger(ClientMain.class);
private static String host = "localhost";
private static String port = "1199";
private RemoteInvocationFactory remoteInvocationFactory;
/**
* needed for all services, to be used with a ContextPropagatingRemoteInvocationFactory,
* so the SecurityContext is forwarded to the server
*/
@Autowired
public void setRemoteInvocationFactory(RemoteInvocationFactory remoteInvocationFactory) {
this.remoteInvocationFactory = remoteInvocationFactory;
}
//needed for setRemoteInvocationFactory
@Bean
public ContextPropagatingRemoteInvocationFactory createRemoteInvocationFactory() {
return new ContextPropagatingRemoteInvocationFactory();
}
@Bean
public IngridientService createUserServiceLink() {
RmiProxyFactoryBean rmiProxyFactoryBean = new ServiceAwareRmiProxyFactoryBean();
rmiProxyFactoryBean.setServiceUrl("rmi://" + host + ":" + port + "/IngridientService");
rmiProxyFactoryBean.setServiceInterface(IngridientService.class);
rmiProxyFactoryBean.setRemoteInvocationFactory(remoteInvocationFactory);
rmiProxyFactoryBean.afterPropertiesSet();
return (IngridientService) rmiProxyFactoryBean.getObject();
}
@Bean
public RecipeService createEquipmentServiceLink() {
RmiProxyFactoryBean rmiProxyFactoryBean = new ServiceAwareRmiProxyFactoryBean();
rmiProxyFactoryBean.setServiceUrl("rmi://" + host + ":" + port + "/RecipeService");
rmiProxyFactoryBean.setServiceInterface(RecipeService.class);
rmiProxyFactoryBean.setRemoteInvocationFactory(remoteInvocationFactory);
rmiProxyFactoryBean.afterPropertiesSet();
return (RecipeService) rmiProxyFactoryBean.getObject();
}
}
| [
"e1327605@tuwien.ac.at"
] | e1327605@tuwien.ac.at |
830e319f3db3664183cb0bc9db4e48a97a32e7b6 | 09e1b6a29477922506e6ee3efd2ce9bd2d8b7aaf | /blog/src/main/java/com/blog/web/TagShowController.java | 1c96afd85b65fc05b6ee270169d765741f01b3d3 | [] | no_license | aotemai/blog | 8ae173834745202a98975d37f7430219967d0010 | 1113130d2fb3793149c2ae0fe67c9f5349e90615 | refs/heads/master | 2020-03-24T22:46:09.739216 | 2018-08-07T10:38:17 | 2018-08-07T10:38:17 | 143,101,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,297 | java | package com.blog.web;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import com.blog.po.Tag;
import com.blog.service.BlogService;
import com.blog.service.TagService;
@Controller
public class TagShowController {
@Autowired
private TagService tagService;
@Autowired
private BlogService blogService;
@GetMapping("/tags/{id}")
public String tags(@PageableDefault(size = 8, sort = {"updateTime"}, direction = Sort.Direction.DESC) Pageable pageable,
@PathVariable Long id, Model model) {
List<Tag> tags = tagService.listTagTop(10000);
if (id == -1) {
id = tags.get(0).getId();
}
model.addAttribute("tags", tags);
model.addAttribute("page", blogService.listBlog(id,pageable));
model.addAttribute("activeTagId", id);
return "tags";
}
}
| [
"512096583@qq.com"
] | 512096583@qq.com |
934f59f200688c42dec9e7a347abf8654c26c7ca | 36073e09d6a12a275cc85901317159e7fffa909e | /thomasjungblut_thomasjungblut-common/modifiedFiles/2/old/MinHash.java | f6eb0970738aea61089770d2a17d65f220b6bfcc | [] | no_license | monperrus/bug-fixes-saner16 | a867810451ddf45e2aaea7734d6d0c25db12904f | 9ce6e057763db3ed048561e954f7aedec43d4f1a | refs/heads/master | 2020-03-28T16:00:18.017068 | 2018-11-14T13:48:57 | 2018-11-14T13:48:57 | 148,648,848 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,928 | java | package de.jungblut.nlp;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import com.google.common.base.Preconditions;
import com.google.common.hash.Hashing;
import de.jungblut.datastructure.ArrayUtils;
import de.jungblut.math.DoubleVector;
import de.jungblut.math.DoubleVector.DoubleVectorElement;
/**
* Linear MinHash algorithm to find near duplicates faster or to speedup nearest
* neighbour searches.
*
* @author thomas.jungblut
*
*/
public final class MinHash {
/*
* define some hashfunctions
*/
public static enum HashType {
LINEAR, MURMUR128, MD5
}
abstract class HashFunction {
protected int seed;
public HashFunction(int seed) {
this.seed = seed;
}
abstract int hash(byte[] bytes);
}
class LinearHashFunction extends HashFunction {
private int seed2;
public LinearHashFunction(int seed, int seed2) {
super(seed);
this.seed2 = seed2;
}
@Override
int hash(byte[] bytes) {
long hashValue = 31;
for (byte byteVal : bytes) {
hashValue *= seed * byteVal;
hashValue += seed2;
}
return Math.abs((int) (hashValue % 2147482949));
}
}
class Murmur128HashFunction extends HashFunction {
com.google.common.hash.HashFunction murmur;
public Murmur128HashFunction(int seed) {
super(seed);
this.murmur = Hashing.murmur3_128(seed);
}
@Override
int hash(byte[] bytes) {
return murmur.hashBytes(bytes).asInt();
}
}
class MD5HashFunction extends HashFunction {
com.google.common.hash.HashFunction md5;
public MD5HashFunction(int seed) {
super(seed);
this.md5 = Hashing.md5();
}
@Override
int hash(byte[] bytes) {
return md5.hashBytes(bytes).asInt();
}
}
/*
* Hashfunction end
*/
private final int numHashes;
private final HashFunction[] functions;
private MinHash(int numHashes) {
this(numHashes, HashType.LINEAR, System.currentTimeMillis());
}
private MinHash(int numHashes, HashType type) {
this(numHashes, type, System.currentTimeMillis());
}
private MinHash(int numHashes, HashType type, long seed) {
this.numHashes = numHashes;
this.functions = new HashFunction[numHashes];
Random r = new Random(seed);
for (int i = 0; i < numHashes; i++) {
switch (type) {
case LINEAR:
functions[i] = new LinearHashFunction(r.nextInt(), r.nextInt());
break;
case MURMUR128:
functions[i] = new Murmur128HashFunction(r.nextInt());
break;
case MD5:
functions[i] = new MD5HashFunction(r.nextInt());
break;
default:
throw new IllegalArgumentException(
"Don't know the equivalent hashfunction to: " + type);
}
}
}
/**
* Minhashes the given vector by iterating over all non zero items and hashing
* each byte in its value (as an integer). So it will end up with 4 bytes to
* be hashed into a single integer by a linear hash function.
*
* @param vector a arbitrary vector.
* @return a int array of min hashes based on how many hashes were configured.
*/
public int[] minHashVector(DoubleVector vector) {
int[] minHashes = new int[numHashes];
byte[] bytesToHash = new byte[4];
Arrays.fill(minHashes, Integer.MAX_VALUE);
for (int i = 0; i < numHashes; i++) {
Iterator<DoubleVectorElement> iterateNonZero = vector.iterateNonZero();
while (iterateNonZero.hasNext()) {
DoubleVectorElement next = iterateNonZero.next();
int value = (int) next.getValue();
bytesToHash[0] = (byte) (value >> 24);
bytesToHash[1] = (byte) (value >> 16);
bytesToHash[2] = (byte) (value >> 8);
bytesToHash[3] = (byte) value;
int hash = functions[i].hash(bytesToHash);
if (minHashes[i] > hash) {
minHashes[i] = hash;
}
}
}
return minHashes;
}
/**
* Measures the similarity between two min hash arrays by comparing the hashes
* at the same index. This is assuming that both arrays having the same size.
*
* @return a similarity between 0 and 1, where 1 is very similar.
*/
@SuppressWarnings("static-method")
public double measureSimilarity(int[] left, int[] right) {
Preconditions.checkArgument(left.length == right.length,
"Left length was not equal to right length! " + left.length + " != "
+ right.length);
if (left.length + right.length == 0)
return 0d;
int[] union = ArrayUtils.union(left, right);
int[] intersection = ArrayUtils.intersectionUnsorted(left, right);
return intersection.length / (double) union.length;
}
/**
* Generates cluster keys from the minhashes. Make sure that if you are going
* to lookup the ids in a hashtable, sort out these that don't have a specific
* minimum occurence. Also make sure that if you're using this in parallel,
* you have to make sure that the seeds of the minhash should be consistent
* across each task. Otherwise this key will be completely random.
*
* @param keyGroups how many keygroups there should be, normally it's just a
* single per hash.
* @return a set of string IDs that can refer as cluster identifiers.
*/
public Set<String> createClusterKeys(int[] minHashes, int keyGroups) {
HashSet<String> set = new HashSet<>();
for (int i = 0; i < numHashes; i++) {
StringBuilder clusterIdBuilder = new StringBuilder();
for (int j = 0; j < keyGroups; j++) {
clusterIdBuilder.append(minHashes[(i + j) % minHashes.length]).append(
'_');
}
String clusterId = clusterIdBuilder.toString();
clusterId = clusterId.substring(0, clusterId.lastIndexOf('_'));
set.add(clusterId);
}
return set;
}
/**
* Creates a {@link MinHash} instance with the given number of hash functions
* with a linear hashing function.
*/
public static MinHash create(int numHashes) {
return new MinHash(numHashes);
}
/**
* Creates a {@link MinHash} instance with the given number of hash functions
* and a seed to be used in parallel systems. This method uses a linear
* hashfunction.
*/
public static MinHash create(int numHashes, long seed) {
return new MinHash(numHashes, HashType.LINEAR, seed);
}
/**
* Creates a {@link MinHash} instance with the given number of hash functions.
*/
public static MinHash create(int numHashes, HashType type) {
return new MinHash(numHashes, type);
}
/**
* Creates a {@link MinHash} instance with the given number of hash functions
* and a seed to be used in parallel systems.
*/
public static MinHash create(int numHashes, HashType type, long seed) {
return new MinHash(numHashes, type, seed);
}
}
| [
"martin.monperrus@gnieh.org"
] | martin.monperrus@gnieh.org |
4e09e89ef60b847d852bca5dd3b6d9c24aceafd1 | 368c0aa50b4bc026da6fee1690d5d5b5737070cd | /app/src/main/java/com/example/tic_tac_toe/models/Player.java | 91cdd0ad2eb655244bb74b431d5891de74e669d0 | [] | no_license | vivek-kurma/TIC-TAC-TOE | 06a81076524f40dc61031dc8c605616cb32d8cca | 43cb92ce51a063a83692644a3d14188f6736c157 | refs/heads/master | 2023-06-09T10:05:12.179940 | 2020-12-28T15:53:01 | 2020-12-28T15:53:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package com.example.tic_tac_toe.models;
import androidx.room.Entity;
public class Player {
public String name;
public String value;
public Player(String name, String value) {
this.name = name;
this.value = value;
}
}
| [
"7vivann@gmail.com"
] | 7vivann@gmail.com |
97f1496aa02eaca19e24afd7bc7713c7b5f48c24 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_341ec8ca6834a3c50a86ae8892b097b815a1b7e8/MakeAppTouchTestable/2_341ec8ca6834a3c50a86ae8892b097b815a1b7e8_MakeAppTouchTestable_t.java | 9429879f9fce91e46bafef6a7025021783681eed | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,525 | java | package com.soasta.jenkins;
import hudson.AbortException;
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import hudson.model.JDK;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
import hudson.util.ArgumentListBuilder;
import hudson.util.ListBoxModel;
import hudson.util.QuotedStringTokenizer;
import org.kohsuke.stapler.DataBoundConstructor;
import javax.inject.Inject;
import java.io.IOException;
/**
* @author Kohsuke Kawaguchi
*/
public class MakeAppTouchTestable extends Builder {
private final String url;
private final String projectFile,target;
private final String additionalOptions;
@DataBoundConstructor
public MakeAppTouchTestable(String url, String projectFile, String target, String additionalOptions) {
this.url = url;
this.projectFile = projectFile;
this.target = target;
this.additionalOptions = additionalOptions;
}
public String getUrl() {
return url;
}
public String getProjectFile() {
return projectFile;
}
public String getTarget() {
return target;
}
public String getAdditionalOptions() {
return additionalOptions;
}
public CloudTestServer getServer() {
return CloudTestServer.get(url);
}
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
ArgumentListBuilder args = new ArgumentListBuilder();
JDK java = build.getProject().getJDK();
if (java!=null)
args.add(java.getHome()+"/bin/java");
else
args.add("java");
CloudTestServer s = getServer();
if (s==null)
throw new AbortException("No TouchTest server is configured in the system configuration.");
FilePath path = new MakeAppTouchTestableInstaller(s).performInstallation(build.getBuiltOn(), listener);
args.add("-jar").add(path.child("MakeAppTouchTestable.jar"))
.add("-overwriteapp")
.add("-project", projectFile)
.add("-target", target)
.add("-url").add(s.getUrl())
.add("-username",s.getUsername())
.add("-password").addMasked(s.getPassword().getPlainText());
args.add(new QuotedStringTokenizer(additionalOptions).toArray());
int r = launcher.launch().cmds(args).pwd(build.getWorkspace()).stdout(listener).join();
return r==0;
}
@Extension
public static class DescriptorImpl extends BuildStepDescriptor<Builder> {
@Inject
CloudTestServer.DescriptorImpl serverDescriptor;
@Override
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return true;
}
public ListBoxModel doFillUrlItems() {
ListBoxModel r = new ListBoxModel();
for (CloudTestServer s : serverDescriptor.getServers()) {
r.add(s.getUrl().toExternalForm());
}
return r;
}
public boolean showUrlField() {
return serverDescriptor.getServers().size()>1;
}
@Override
public String getDisplayName() {
return "Make App TouchTestable";
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b4624f5b864227a3c5cba507b3f36a2c86b2a053 | 802bd0e3175fe02a3b6ca8be0a2ff5347a1fd62c | /corelibrary/src/main/java/com/wuwind/corelibrary/network/download/DownloadTaskListener.java | 2308285bb1bf3e35f74b0e29874453e9d58bd9e8 | [] | no_license | wuwind/CstFramePub | 87b8534d85cabcf6b8ca58077ef54d706c8a6a91 | 4059789b42224fe53806569673065a207c0890dd | refs/heads/master | 2023-04-11T20:58:37.505639 | 2021-04-14T06:11:29 | 2021-04-14T06:11:29 | 351,687,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package com.wuwind.corelibrary.network.download;
/**
* Created by dzc on 15/11/21.
*/
public interface DownloadTaskListener {
void onPrepare(DownloadTask downloadTask);
void onStart(DownloadTask downloadTask);
void onDownloading(DownloadTask downloadTask);
void onPause(DownloadTask downloadTask);
void onCancel(DownloadTask downloadTask);
void onCompleted(DownloadTask downloadTask);
void onError(DownloadTask downloadTask, int errorCode);
int DOWNLOAD_ERROR_FILE_NOT_FOUND = -1;
int DOWNLOAD_ERROR_IO_ERROR = -2;
}
| [
"412719784@qq.com"
] | 412719784@qq.com |
38fa98a42586771b008659617b1de5cf27ba3b88 | 641cb853d7892c9b36effb21117835c399c8ffe4 | /src/main/java/com/dky/modules/mq/enums/AssignmentEnum.java | c5447a40ad176b423a64238fbfb4e32efc858522 | [] | no_license | bowensd/graduation | c2226d7cc12909ba0e3f5121ce6a657eca1c2f6e | 1e13c25f09fc766eb3623b84ef425a48ed03170c | refs/heads/master | 2020-05-03T00:14:38.132083 | 2019-04-11T04:23:18 | 2019-04-11T04:23:18 | 178,304,432 | 0 | 0 | null | 2019-04-11T04:23:19 | 2019-03-29T00:44:13 | Java | UTF-8 | Java | false | false | 680 | java | package com.dky.modules.mq.enums;
/**
* describe:
*
* @author bowen
* @date 2019/04/09
*/
public enum AssignmentEnum {
TEACHER_ID("教师ID","teacher_id",0),
STUDENT_ID("学生ID","student_id",0);
private String name;
private Integer integerVal;
private String stringVal;
AssignmentEnum(String name, String stringVal, Integer integerVal) {
this.name = name;
this.stringVal = stringVal;
this.integerVal = integerVal;
}
public String getName() {
return name;
}
public Integer getIntegerVal() {
return integerVal;
}
public String getStringVal() {
return stringVal;
}
}
| [
"243874370@qq.com"
] | 243874370@qq.com |
345c5260d2c9a3299f049bb7f5cccf553f9c60f5 | d67cd91c4c6626a4d0b0e4d82f259d471561bbf1 | /plugins/org.pgsqlite/src/android/org/pgsqlite/SQLitePlugin.java | 0990387f3ae1b0714a2a528959accc4084f8ff73 | [] | no_license | DeadlineDevelopers/HTML5Cordova-Sample-Project | 5f25581244edaccac14b8164429c37a89dbe5af3 | d42c016f799cfa26949db1da61e2621207761cdf | refs/heads/master | 2021-01-18T06:42:40.595521 | 2014-12-26T14:38:54 | 2014-12-26T14:38:54 | 51,663,066 | 0 | 0 | null | 2016-02-13T19:55:23 | 2016-02-13T19:55:22 | null | UTF-8 | Java | false | false | 13,284 | java | /*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
* Copyright (c) 2005-2010, Nitobi Software Inc.
* Copyright (c) 2010, IBM Corporation
*/
package org.pgsqlite;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.lang.Number;
import java.util.HashMap;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import android.database.Cursor;
import android.database.sqlite.*;
import android.util.Base64;
import android.util.Log;
public class SQLitePlugin extends CordovaPlugin
{
/**
* Multiple database map (static).
*/
static HashMap<String, SQLiteDatabase> dbmap = new HashMap<String, SQLiteDatabase>();
/**
* Get a SQLiteDatabase reference from the db map (public static accessor).
*
* @param dbname
* The name of the database.
*
*/
public static SQLiteDatabase getSQLiteDatabase(String dbname)
{
return dbmap.get(dbname);
}
/**
* NOTE: Using default constructor, explicit constructor no longer required.
*/
/**
* Executes the request and returns PluginResult.
*
* @param action
* The action to execute.
*
* @param args
* JSONArry of arguments for the plugin.
*
* @param cbc
* Callback context from Cordova API
*
*/
@Override
public boolean execute(String action, JSONArray args, CallbackContext cbc)
{
try {
if (action.equals("open")) {
JSONObject o = args.getJSONObject(0);
String dbname = o.getString("name");
this.openDatabase(dbname, null);
}
else if (action.equals("close")) {
JSONObject o = args.getJSONObject(0);
String dbname = o.getString("path");
this.closeDatabase(dbname);
}
else if (action.equals("delete")) {
JSONObject o = args.getJSONObject(0);
String dbname = o.getString("path");
this.deleteDatabase(dbname);
}
else if (action.equals("executePragmaStatement"))
{
String dbName = args.getString(0);
String query = args.getString(1);
JSONArray jparams = (args.length() < 3) ? null : args.getJSONArray(2);
String[] params = null;
if (jparams != null) {
params = new String[jparams.length()];
for (int j = 0; j < jparams.length(); j++) {
if (jparams.isNull(j))
params[j] = "";
else
params[j] = jparams.getString(j);
}
}
Cursor myCursor = this.getDatabase(dbName).rawQuery(query, params);
String result = this.getRowsResultFromQuery(myCursor).getJSONArray("rows").toString();
this.sendJavascriptCB("window.SQLitePluginCallback.p1('" + id + "', " + result + ");");
}
else if (action.equals("executeSqlBatch") || action.equals("executeBatchTransaction") || action.equals("backgroundExecuteSqlBatch"))
{
String[] queries = null;
String[] queryIDs = null;
JSONArray jsonArr = null;
int paramLen = 0;
JSONArray[] jsonparams = null;
JSONObject allargs = args.getJSONObject(0);
JSONObject dbargs = allargs.getJSONObject("dbargs");
String dbName = dbargs.getString("dbname");
JSONArray txargs = allargs.getJSONArray("executes");
if (txargs.isNull(0)) {
queries = new String[0];
} else {
int len = txargs.length();
queries = new String[len];
queryIDs = new String[len];
jsonparams = new JSONArray[len];
for (int i = 0; i < len; i++)
{
JSONObject a = txargs.getJSONObject(i);
queries[i] = a.getString("sql");
queryIDs[i] = a.getString("qid");
jsonArr = a.getJSONArray("params");
paramLen = jsonArr.length();
jsonparams[i] = jsonArr;
}
}
boolean ex = action.equals("executeBatchTransaction");
if (action.equals("backgroundExecuteSqlBatch"))
this.executeSqlBatchInBackground(dbName, queries, jsonparams, queryIDs, cbc);
else
this.executeSqlBatch(dbName, queries, jsonparams, queryIDs, cbc);
}
return true;
} catch (JSONException e) {
// TODO: signal JSON problem to JS
return false;
}
}
/**
*
* Clean up and close all open databases.
*
*/
@Override
public void onDestroy() {
while (!dbmap.isEmpty()) {
String dbname = dbmap.keySet().iterator().next();
this.closeDatabase(dbname);
dbmap.remove(dbname);
}
}
// --------------------------------------------------------------------------
// LOCAL METHODS
// --------------------------------------------------------------------------
/**
* Open a database.
*
* @param dbname
* The name of the database-NOT including its extension.
*
* @param password
* The database password or null.
*
*/
private void openDatabase(String dbname, String password)
{
if (this.getDatabase(dbname) != null) this.closeDatabase(dbname);
File dbfile = this.cordova.getActivity().getDatabasePath(dbname + ".db");
Log.v("info", "Open sqlite db: " + dbfile.getAbsolutePath());
SQLiteDatabase mydb = SQLiteDatabase.openOrCreateDatabase(dbfile, null);
dbmap.put(dbname, mydb);
}
/**
* Close a database.
*
* @param dbName
* The name of the database-NOT including its extension.
*
*/
private void closeDatabase(String dbName)
{
SQLiteDatabase mydb = this.getDatabase(dbName);
if (mydb != null)
{
mydb.close();
dbmap.remove(dbName);
}
}
/**
* Delete a database.
*
* @param dbname
* The name of the database-NOT including its extension.
*
*/
private void deleteDatabase(String dbname)
{
if (this.getDatabase(dbname) != null) this.closeDatabase(dbname);
File dbfile = this.cordova.getActivity().getDatabasePath(dbname + ".db");
Log.v("info", "delete sqlite db: " + dbfile.getAbsolutePath());
SQLiteDatabase.deleteDatabase(dbfile);
}
/**
* Get a database from the db map.
*
* @param dbname
* The name of the database.
*
*/
private SQLiteDatabase getDatabase(String dbname)
{
return dbmap.get(dbname);
}
/**
* Executes a batch request IN BACKGROUND THREAD and sends the results via sendJavascriptCB().
*
* @param dbName
* The name of the database.
*
* @param queryarr
* Array of query strings
*
* @param jsonparams
* Array of JSON query parameters
*
* @param queryIDs
* Array of query ids
*
* @param cbc
* Callback context from Cordova API
*
*/
private void executeSqlBatchInBackground(final String dbName,
final String[] queryarr, final JSONArray[] jsonparams, final String[] queryIDs, final CallbackContext cbc)
{
final SQLitePlugin myself = this;
this.cordova.getThreadPool().execute(new Runnable() {
public void run() {
synchronized(myself) {
myself.executeSqlBatch(dbName, queryarr, jsonparams, queryIDs, cbc);
}
}
});
}
/**
* Executes a batch request and sends the results via sendJavascriptCB().
*
* @param dbname
* The name of the database.
*
* @param queryarr
* Array of query strings
*
* @param jsonparams
* Array of JSON query parameters
*
* @param queryIDs
* Array of query ids
*
* @param cbc
* Callback context from Cordova API
*
*/
private void executeSqlBatch(String dbname, String[] queryarr, JSONArray[] jsonparams, String[] queryIDs, CallbackContext cbc)
{
SQLiteDatabase mydb = this.getDatabase(dbname);
if (mydb == null) return;
String query = "";
String query_id = "";
int len = queryarr.length;
JSONArray batchResults = new JSONArray();
for (int i = 0; i < len; i++) {
query_id = queryIDs[i];
JSONObject queryResult = null;
String errorMessage = null;
try {
query = queryarr[i];
// /* OPTIONAL changes for new Android SDK from HERE:
if (android.os.Build.VERSION.SDK_INT >= 11 &&
(query.toLowerCase().startsWith("update") ||
query.toLowerCase().startsWith("delete")))
{
SQLiteStatement myStatement = mydb.compileStatement(query);
if (jsonparams != null) {
for (int j = 0; j < jsonparams[i].length(); j++) {
if (jsonparams[i].get(j) instanceof Float || jsonparams[i].get(j) instanceof Double ) {
myStatement.bindDouble(j + 1, jsonparams[i].getDouble(j));
} else if (jsonparams[i].get(j) instanceof Number) {
myStatement.bindLong(j + 1, jsonparams[i].getLong(j));
} else if (jsonparams[i].isNull(j)) {
myStatement.bindNull(j + 1);
} else {
myStatement.bindString(j + 1, jsonparams[i].getString(j));
}
}
}
int rowsAffected = myStatement.executeUpdateDelete();
queryResult = new JSONObject();
queryResult.put("rowsAffected", rowsAffected);
} else // to HERE. */
if (query.toLowerCase().startsWith("insert") && jsonparams != null) {
SQLiteStatement myStatement = mydb.compileStatement(query);
for (int j = 0; j < jsonparams[i].length(); j++) {
if (jsonparams[i].get(j) instanceof Float || jsonparams[i].get(j) instanceof Double ) {
myStatement.bindDouble(j + 1, jsonparams[i].getDouble(j));
} else if (jsonparams[i].get(j) instanceof Number) {
myStatement.bindLong(j + 1, jsonparams[i].getLong(j));
} else if (jsonparams[i].isNull(j)) {
myStatement.bindNull(j + 1);
} else {
myStatement.bindString(j + 1, jsonparams[i].getString(j));
}
}
long insertId = myStatement.executeInsert();
int rowsAffected = (insertId == -1) ? 0 : 1;
queryResult = new JSONObject();
queryResult.put("insertId", insertId);
queryResult.put("rowsAffected", rowsAffected);
} else {
String[] params = null;
if (jsonparams != null) {
params = new String[jsonparams[i].length()];
for (int j = 0; j < jsonparams[i].length(); j++) {
if (jsonparams[i].isNull(j))
params[j] = "";
else
params[j] = jsonparams[i].getString(j);
}
}
Cursor myCursor = mydb.rawQuery(query, params);
if (query_id.length() > 0) {
queryResult = this.getRowsResultFromQuery(myCursor);
}
myCursor.close();
}
} catch (Exception ex) {
ex.printStackTrace();
errorMessage = ex.getMessage();
Log.v("executeSqlBatch", "SQLitePlugin.executeSql[Batch](): Error=" + errorMessage);
}
try {
if (queryResult != null) {
JSONObject r = new JSONObject();
r.put("qid", query_id);
r.put("type", "success");
r.put("result", queryResult);
batchResults.put(r);
} else if (errorMessage != null) {
JSONObject r = new JSONObject();
r.put("qid", query_id);
r.put("type", "error");
r.put("result", errorMessage);
batchResults.put(r);
}
} catch (JSONException ex) {
ex.printStackTrace();
Log.v("executeSqlBatch", "SQLitePlugin.executeSql[Batch](): Error=" + ex.getMessage());
// TODO what to do?
}
}
cbc.success(batchResults);
}
/**
* Get rows results from query cursor.
*
* @param cur
* Cursor into query results
*
* @return results in string form
*
*/
private JSONObject getRowsResultFromQuery(Cursor cur)
{
JSONObject rowsResult = new JSONObject();
// If query result has rows
if (cur.moveToFirst()) {
JSONArray rowsArrayResult = new JSONArray();
String key = "";
int colCount = cur.getColumnCount();
// Build up JSON result object for each row
do {
JSONObject row = new JSONObject();
try {
for (int i = 0; i < colCount; ++i) {
key = cur.getColumnName(i);
// for old Android SDK remove lines from HERE:
if(android.os.Build.VERSION.SDK_INT >= 11)
{
switch(cur.getType (i))
{
case Cursor.FIELD_TYPE_NULL:
row.put(key, JSONObject.NULL);
break;
case Cursor.FIELD_TYPE_INTEGER:
row.put(key, cur.getInt(i));
break;
case Cursor.FIELD_TYPE_FLOAT:
row.put(key, cur.getFloat(i));
break;
case Cursor.FIELD_TYPE_STRING:
row.put(key, cur.getString(i));
break;
case Cursor.FIELD_TYPE_BLOB:
row.put(key, new String(Base64.encode(cur.getBlob(i), Base64.DEFAULT)));
break;
}
}
else // to HERE.
{
row.put(key, cur.getString(i));
}
}
rowsArrayResult.put(row);
} catch (JSONException e) {
e.printStackTrace();
}
} while (cur.moveToNext());
try {
rowsResult.put("rows", rowsArrayResult);
} catch (JSONException e) {
e.printStackTrace();
}
}
return rowsResult;
}
/**
* Send Javascript callback.
*
* @param cb
* Javascript callback command to send
*
*/
private void sendJavascriptCB(String cb)
{
this.webView.sendJavascript(cb);
}
/**
* Send Javascript callback on GUI thread.
*
* @param cb
* Javascript callback command to send
*
*/
private void sendJavascriptToGuiThread(final String cb)
{
final SQLitePlugin myself = this;
this.cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
myself.webView.sendJavascript(cb);
}
});
}
}
| [
"ffurkan.tanriverdi@gmail.com"
] | ffurkan.tanriverdi@gmail.com |
653f4bd46bc548bee9095ffb5dd1f73d4093d039 | 274ed9e76f0a42b24568540443ce9cc50e74f9de | /src/main/java/org/pgmx/cloudpoc/poc3/bolt/MicroBatchFieldReducerBolt.java | 3e4d4ae3643152c164d4d8d3be54197a284060be | [] | no_license | pugmarx/poc3 | b498197a3a7e2a65a2926e4945b4adc667015063 | 4f776e7cf67b09c7fb9c733b65932f57e5363e4d | refs/heads/master | 2021-09-03T05:03:05.158872 | 2018-01-05T20:33:19 | 2018-01-05T20:33:19 | 115,944,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,451 | java | package org.pgmx.cloudpoc.poc3.bolt;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.storm.Config;
import org.apache.storm.Constants;
import org.apache.storm.task.OutputCollector;
import org.apache.storm.task.TopologyContext;
import org.apache.storm.topology.IRichBolt;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Tuple;
import org.apache.storm.tuple.Values;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
public class MicroBatchFieldReducerBolt implements IRichBolt {
private OutputCollector collector;
private static final Logger LOG = Logger.getLogger(MicroBatchFieldReducerBolt.class);
/**
* The queue holding tuples in a batch.
*/
protected LinkedBlockingQueue<Tuple> queue = new LinkedBlockingQueue<>();
/**
* The threshold after which the batch should be flushed out.
*/
int batchSize = 10000;
/**
* The batch interval in sec. Minimum time between flushes if the batch sizes
* are not met. This should typically be equal to
* topology.tick.tuple.freq.secs and half of topology.message.timeout.secs
*/
//int batchIntervalInSec = 45;
int batchIntervalInSec = 10;
/**
* The last batch process time seconds. Used for tracking purpose
*/
long lastBatchProcessTimeSeconds = 0;
@Override
public void execute(Tuple tuple) {
// Check if the tuple is of type Tick Tuple
if (isTickTuple(tuple)) {
// If so, it is indication for batch flush. But don't flush if previous
// flush was done very recently (either due to batch size threshold was
// crossed or because of another tick tuple)
//
if ((System.currentTimeMillis() / 1000 - lastBatchProcessTimeSeconds) >= batchIntervalInSec) {
LOG.debug("Current queue size is " + this.queue.size()
+ ". But received tick tuple so executing the batch");
finishBatch();
} else {
LOG.debug("Current queue size is " + this.queue.size()
+ ". Received tick tuple but last batch was executed "
+ (System.currentTimeMillis() / 1000 - lastBatchProcessTimeSeconds)
+ " seconds back that is less than " + batchIntervalInSec
+ " so ignoring the tick tuple");
}
} else {
// Add the tuple to queue. But don't ack it yet.
this.queue.add(tuple);
int queueSize = this.queue.size();
LOG.debug("current queue size is " + queueSize);
if (queueSize >= batchSize) {
LOG.debug("Current queue size is >= " + batchSize
+ " executing the batch");
finishBatch();
}
}
}
public static boolean isTickTuple(Tuple tuple) {
return tuple.getSourceComponent().equals(Constants.SYSTEM_COMPONENT_ID) && tuple.getSourceStreamId().equals(
Constants.SYSTEM_TICK_STREAM_ID);
}
private String processTupleArr(String[] inpArr) {
// if (LOG.isDebugEnabled()) {
// LOG.debug(String.format("#### %s|%s|%s|%s|%s", inpArr[0], inpArr[4], inpArr[5], inpArr[11], inpArr[17]));
// }
// Get the relevant fields, as a single field (KafkaBolt needs single field)
// 0,5,23,4,6,10,11,17,25,34,36,41
return String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s", inpArr[0], inpArr[5], inpArr[23],
inpArr[4], inpArr[6], inpArr[10], inpArr[11], inpArr[17], inpArr[25], inpArr[34], inpArr[36],
inpArr[41]);
}
/**
* Finish batch.
*/
public void finishBatch() {
if (queue.isEmpty()) {
return;
}
LOG.debug("Finishing batch of size " + queue.size());
lastBatchProcessTimeSeconds = System.currentTimeMillis() / 1000;
List<Tuple> tuples = new ArrayList<>();
queue.drainTo(tuples);
for (Tuple tuple : tuples) {
String inputRecord = tuple.getString(0);
String[] inpArr = inputRecord.split(",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)");
inpArr = StringUtils.stripAll(inpArr, "\"");
// ignore headers
if (inpArr[0].equalsIgnoreCase("Year")) {
collector.ack(tuple);
continue;
}
collector.emit(new Values(new Object[]{processTupleArr(inpArr)}));
collector.ack(tuple);
}
try {
Thread.sleep(1000);
} catch (Exception e) {
//ignore
}
}
@Override
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
outputFieldsDeclarer.declare(new Fields(new String[]{"output"}));
}
@Override
public Map<String, Object> getComponentConfiguration() {
Config conf = new Config();
conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 10);
return conf;
}
@Override
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
this.collector = outputCollector;
}
@Override
public void cleanup() {
finishBatch();
}
} | [
"naqi.rizvi@gmail.com"
] | naqi.rizvi@gmail.com |
1446f715b209128da6e4f1c3dfce9a22e1fac70a | 2df8d1ebf168c0db3eb02cf180548983e720d1e3 | /src/main/java/com/waw/hr/model/AdminUserModel.java | cc2c82f9bc1008551cec286a26f9b34aae11a521 | [] | no_license | heboot/waw_server | e75288c68348a2f2dd3b14960c96853c45d8250c | 14e3d3cbf5db0e18b6d33de48f2363d9b6c4f6d1 | refs/heads/master | 2020-04-20T00:48:29.024191 | 2019-04-10T10:45:40 | 2019-04-10T10:45:40 | 168,529,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,385 | java | package com.waw.hr.model;
import com.waw.hr.core.MValue;
import javafx.scene.control.cell.MapValueFactory;
import org.apache.commons.lang3.StringUtils;
public class AdminUserModel {
private Integer id;
private String name;
private String mobile;
private Integer status;
private int role;
private Integer createUid;
private String createTime;
private String lastLoginTime;
private String wxCode;
private String qqCode;
private String nickname;
private String avatar;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public int getRole() {
return role;
}
public void setRole(int role) {
this.role = role;
}
public Integer getCreateUid() {
return createUid;
}
public void setCreateUid(Integer createUid) {
this.createUid = createUid;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(String lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public String getWxCode() {
return wxCode;
}
public void setWxCode(String wxCode) {
this.wxCode = wxCode;
}
public String getQqCode() {
return qqCode;
}
public void setQqCode(String qqCode) {
this.qqCode = qqCode;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getAvatar() {
if (StringUtils.isEmpty(avatar)) {
return avatar;
}
return MValue.IMAGE_PRIFIX + avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
}
| [
"heboot@126.com"
] | heboot@126.com |
dc4f66d8fc5c846a761300f5fcc1a2e78a3f4d35 | 3cfe4dded0ba1936cd61bdfe1934a852b5c8338b | /Xadrez/src/pecas/Peao.java | b07c664251e4a90ebc64079b6a9b5510bf0686ca | [] | no_license | akabrunao/projeto-poo | 2023e6d2922a250d137ae3f9860e1042f858734d | 41a0153afb73eb6e5ab28be617fadb77ef03df5a | refs/heads/master | 2023-09-02T06:40:24.183204 | 2021-11-21T13:48:12 | 2021-11-21T13:48:12 | 409,307,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,507 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pecas;
/**
* Classe responsavel pela peca "Peao"
*
* @author Daniele
*/
public class Peao extends Peca {
/**
* Construtor do cavalo, responsavel por inicializar os atributos e definir
* a posicao inicial da peca no inicio do jogo.
*
* @param cor Cor da peca (branca/preta)
*/
public Peao(String cor) {
if (cor.toLowerCase() == "branca" || cor.toLowerCase() == "preta") {
this.capturada = false;
this.cor = cor;
desenho();
}
}
/**
* De acordo com a cor da peça define qual o desenho deve ser impresso no
* tabuleiro.
*/
@Override
protected String desenho() {
if (this.cor == "branca") {
this.desenho = "p";
} else if (this.cor == "preta") {
this.desenho = "P";
}
return this.desenho;
}
/**
* Checa se a peca pode executar o movimento informado pelo usuario
*
* @param linhaOrigem A linha da posicao que a peca estava
* @param colunaOrigem A coluna da posicao que a peca estava
* @param linhaDestino A linha da posicao que a peca ira
* @param colunaDestino A coluna da posicao que a peca ira
* @return true caso o movimento seja valido, false se o movimento for
* invalido
*/
@Override
public boolean checaMovimento(int linhaOrigem, char colunaOrigem, int linhaDestino, char colunaDestino) {
int intColunaOrigem = (int) colunaOrigem - 97;
int intColunaDestino = (int) colunaDestino - 97;
if (linhaOrigem == linhaDestino && intColunaOrigem == intColunaDestino) {
return false;
}
if (cor == "branca") {
return ((intColunaOrigem == intColunaDestino
|| (Math.abs(intColunaOrigem - intColunaDestino) == 1 && linhaOrigem - linhaDestino == 1))
&& ((linhaOrigem - linhaDestino == 1) || (linhaOrigem == 6 && linhaOrigem - linhaDestino == 2)));
} else {
return ((intColunaOrigem == intColunaDestino
|| (Math.abs(intColunaOrigem - intColunaDestino) == 1 && linhaOrigem - linhaDestino == -1))
&& ((linhaOrigem - linhaDestino == -1) || (linhaOrigem == 1 && linhaOrigem - linhaDestino == -2)));
}
}
}
| [
"brunoorochaa@gmail.com"
] | brunoorochaa@gmail.com |
ddd262524f4db574c0a4a46a0eefe1de748fb6db | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/transform/GetIntegrationResponsesRequestMarshaller.java | 012f11ac698ffb57c97f9ab11fa577465ebac5dd | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 3,076 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.apigatewayv2.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.apigatewayv2.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* GetIntegrationResponsesRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class GetIntegrationResponsesRequestMarshaller {
private static final MarshallingInfo<String> APIID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PATH)
.marshallLocationName("apiId").build();
private static final MarshallingInfo<String> INTEGRATIONID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PATH).marshallLocationName("integrationId").build();
private static final MarshallingInfo<String> MAXRESULTS_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.QUERY_PARAM).marshallLocationName("maxResults").build();
private static final MarshallingInfo<String> NEXTTOKEN_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.QUERY_PARAM).marshallLocationName("nextToken").build();
private static final GetIntegrationResponsesRequestMarshaller instance = new GetIntegrationResponsesRequestMarshaller();
public static GetIntegrationResponsesRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(GetIntegrationResponsesRequest getIntegrationResponsesRequest, ProtocolMarshaller protocolMarshaller) {
if (getIntegrationResponsesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getIntegrationResponsesRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(getIntegrationResponsesRequest.getIntegrationId(), INTEGRATIONID_BINDING);
protocolMarshaller.marshall(getIntegrationResponsesRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(getIntegrationResponsesRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
c0b59e3edb5a4442fe13c0ea18ab5a958d17e112 | c27193e18a2b5fede2b3f32cc9e6df43bf8779d1 | /src/com/work/Dispose.java | 134e4facf2defcb06f24728cb93f0280797f9914 | [] | no_license | frywang/DBpedia | ea269c54fa58d346488c6448e01b7e638ae25dd4 | b5daec04b6db1c71b91f1c0662e297c525aeefa3 | refs/heads/master | 2020-12-23T22:56:25.573302 | 2017-06-24T03:50:05 | 2017-06-24T03:50:05 | 92,567,180 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,961 | java | package com.work;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
public class Dispose {
public static void main(String[] args) throws IOException {
File dir = new File("./datas\\结果");
File[] path = dir.listFiles();
LinkedList<File> fileList = new LinkedList<File>();
for (int i = 0 ; i < path.length;i++) {
if (path[i].isDirectory()) {
File[] filePath = path[i].listFiles();
for (int j = 0 ; j < filePath.length;j++) {
if (filePath[j].isDirectory()) {
System.out.println("error");
} else {
fileList.add(filePath[j]);
}
}
} else {
fileList.add(path[i]);
}
}
for (int i = 0 ; i < fileList.size();i++) {
System.out.println(fileList.get(i).getPath());
System.out.println("cs:"+fileList.get(i).getPath().replace("\\结果", "\\结果_t"));
System.out.println(fileList.get(i).getPath().replace("\\结果", "\\结果_new"));
File findFile = new File(fileList.get(i).getPath().replace("\\结果", "\\结果"));
File newFile = new File(fileList.get(i).getPath().replace("\\结果", "\\结果_new"));
File outputDir = new File(newFile.getParent());
if (!outputDir.exists()) {
outputDir.mkdirs();
}
FileOutputStream output = new FileOutputStream(newFile);
FileInputStream input = new FileInputStream(fileList.get(i));
FileInputStream inputf = new FileInputStream(findFile);
BufferedReader byteinputf = new BufferedReader(new InputStreamReader(inputf));
BufferedReader byteinput = new BufferedReader(new InputStreamReader(input));
Map<String,String> find = new HashMap<String, String>();
String findBuffer = null;
while ((findBuffer = byteinputf.readLine()) != null) {
if (findBuffer.contains("=")) {
String[] temp = findBuffer.split("=");
find.put(temp[0], temp[1]);
}
}
findBuffer = null;
while ((findBuffer = byteinput.readLine()) != null) {
if (findBuffer.contains("=")) {
String[] temp = findBuffer.split("=");
String value = find.get(temp[0]);
if (value != null) {
String[] values = value.split(",");
String[] v = temp[1].split(",");
output.write((temp[0] + "=" + v[0]).getBytes());
for (int k = 1; k < v.length;k++) {
output.write(("," + v[k]).getBytes());
}
for (int k = 0; k < values.length;k++) {
int l = 0;
for (l = 0; l < v.length;l++) {
if (values[k].trim().equals(v[l].trim())) {
break;
}
}
if (l >= v.length) {
output.write(("," + values[k]).getBytes());
}
}
output.write(("\n").getBytes());
} else {
output.write((findBuffer + "\n").getBytes());
}
} else {
output.write((findBuffer + "\n").getBytes());
}
}
byteinput.close();
byteinputf.close();
output.close();
}
System.out.println(fileList.size());
}
}
| [
"tungtungwang@gmail.com"
] | tungtungwang@gmail.com |
a04e2e24be693a13cdf4d8b52e582259eca6fb86 | 68a7acc92e7312b4db75a4adc79469473d8dcc52 | /src/platform/JavaProperties.java | a08e2205a51982dcaf43bc5a70081790d95dd0f5 | [] | no_license | vasanthsubram/JavaCookBook | e83f95a9a08d6227455ebd213d216837ec1c97b5 | 3fb2dfc38a4bb56f21f329b0dbc8283609412840 | refs/heads/master | 2022-12-16T00:13:31.515018 | 2019-06-24T03:12:11 | 2019-06-24T03:12:11 | 30,102,351 | 0 | 0 | null | 2022-12-13T19:13:55 | 2015-01-31T04:39:51 | Java | UTF-8 | Java | false | false | 1,103 | java | package platform;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;
public class JavaProperties {
public static void main(String[] args) throws Exception {
FileInputStream def = null, custom=null;
FileOutputStream customOut=null;
try {
//default
Properties props = new Properties();
def = new FileInputStream("resources/default.properties");
props.load(def);
System.out.println(props.get("test1.prop"));
System.out.println(props.getProperty("test1.prop"));
System.out.println(props.contains("test.prop"));
props.list(System.out);
//custom
custom = new FileInputStream("resources/custom.properties");
Properties customProps = new Properties();
customProps.load(custom);
customProps.put("new.prop", "pigloo");
custom.close();
customOut=new FileOutputStream("resources/custom.properties");
customProps.store(customOut, "--");
} finally {
if (def != null) {
def.close();
}
if(custom !=null){
custom.close();
}
if(customOut !=null){
customOut.close();
}
}
}
}
| [
"v-vsubramanian@expedia.com"
] | v-vsubramanian@expedia.com |
1eae2f414e4c85e628d0c6c7c0f46049b33c20b8 | 65a5d8768e95ccdef3d7aa72abc00b001b01201d | /src/main/java/ore/CtR.java | 17bcfb954a5a9d34c47029627adc8667b2264410 | [] | no_license | zhzz1994/vsse | 643c40d97ffd8785634821055c99c1f6fa8159c2 | 09979e7dde47db9069bf9028e2f31cf5f06948ae | refs/heads/master | 2020-04-14T17:04:06.452563 | 2019-01-27T14:19:43 | 2019-01-27T14:19:43 | 163,969,208 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package ore;
import ore.ore_env.OreEnv;
import utils.cryptMethod.SecureRomdom;
import java.util.Random;
/**
* @author zhzz
* @Data create in 17:07 2018/12/20
*/
public class CtR {
private byte[] r; //随机数r
private CtRvi[] ctrVis; //密文vi
private CtR(){} //禁止调用构造函数初始化
public static CtR encNum(int num, OreEnv env){ //静态工厂方法
CtR ctR = new CtR();
ctR.NumberEnc(num,env);
return ctR;
}
private void NumberEnc(int num ,OreEnv env) {
Random random = new Random();
r = SecureRomdom.getRomdom(env.getLambda(),"r"+random.nextInt());
int n = env.getN();
ctrVis = new CtRvi[n];
Oredary daryY = Oredary.genByNum(num,env);
for (int i = 0; i < n; i++) {
ctrVis[i] = CtRvi.getCtRvi(daryY , i , r ,env);
}
}
public byte[] getR() {
return r;
}
public CtRvi getCtrVi(int i) {
return ctrVis[i];
}
}
| [
"1094835165@qq.com"
] | 1094835165@qq.com |
b97894e18ff7c7017fd6711eb8c878cf2e734923 | 9fda2ffae67a651d41ad69c7b28ee516d8e90888 | /src/com/sollace/unicopia/Race.java | 759b6caf72d445766c2af79ae580cac6f2102199 | [] | no_license | killjoy1221/Unicopia | c72d3a9fcc895e33edc737f1cb8321f2b671a9dd | 6832e896d56d2169cd5f8b6c9451007d70408e7d | refs/heads/master | 2020-04-29T14:01:06.470241 | 2018-05-21T17:02:18 | 2018-05-21T17:02:18 | 176,183,865 | 0 | 0 | null | 2019-03-18T01:34:28 | 2019-03-18T01:34:28 | null | UTF-8 | Java | false | false | 1,871 | java | package com.sollace.unicopia;
import com.google.common.base.Predicate;
import com.sollace.unicopia.server.PlayerSpeciesRegister;
import net.minecraft.entity.player.EntityPlayer;
public enum Race implements Predicate<EntityPlayer> {
EARTH("Earth Pony", false, false),
UNICORN("Unicorn", false, true),
PEGASUS("Pegasus", true, false),
ALICORN("Alicorn", true, true),
CHANGELING("Changeling", true, false);
private final String displayName;
private final boolean fly;
private final boolean magic;
Race(String name, boolean flying, boolean magical) {
displayName = name;
fly = flying;
magic = magical;
}
public static Race getDefault() {
return EARTH;
}
public boolean canUseEarth() {
return this == EARTH || this == ALICORN;
}
public boolean canCast() {
return magic;
}
public boolean canFly() {
return fly;
}
public boolean canInteractWithClouds() {
return this == PEGASUS || this == ALICORN;
}
public String displayName() {
return displayName;
}
public boolean startsWithVowel() {
return "AEIO".indexOf(name().charAt(0)) != -1;
}
public static Race value(String s) {
Race result = getSpeciesFromName(s);
return result != null ? result : getDefault();
}
public static Race getSpeciesFromName(String s) {
if (s != null && !s.isEmpty()) {
s = s.toUpperCase();
for (Race i : values()) {
if (i.name().contentEquals(s) || i.displayName().contentEquals(s)) return i;
}
}
return null;
}
public static Race getSpeciesFromId(String s) {
try {
int id = Integer.parseInt(s);
Race[] values = values();
if (id >= 0 || id < values.length) {
return values[id];
}
} catch (NumberFormatException e) { }
return null;
}
public boolean apply(EntityPlayer o) {
return o instanceof EntityPlayer && PlayerSpeciesRegister.getPlayerSpecies((EntityPlayer)o) == this;
}
}
| [
"sollacea@gmail.com"
] | sollacea@gmail.com |
4e628e1fa69b41f06f69f8a9fec8823f8ce55817 | 4a8bcfa280c0aed245383150b66acf1a7550458d | /org.obeonetwork.dsl.spem.properties/src-gen/org/obeonetwork/dsl/spem/uma/components/PhasePropertiesEditionComponent.java | b443c3b60b380535d938e1cd93e0a1bdc93a2da1 | [] | no_license | SebastienAndreo/SPEM-Designer | f4eedad7e0d68403a1a3bddfddcfb2182796a222 | 532e71548fde8d73a78b471a8fd8dd402e92f58e | refs/heads/master | 2021-01-15T13:06:10.846652 | 2012-08-07T07:13:03 | 2012-08-07T07:13:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 54,989 | java | /**
* Generated with Acceleo
*/
package org.obeonetwork.dsl.spem.uma.components;
// Start of user code for imports
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.Diagnostician;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent;
import org.eclipse.emf.eef.runtime.context.PropertiesEditingContext;
import org.eclipse.emf.eef.runtime.context.impl.EObjectPropertiesEditionContext;
import org.eclipse.emf.eef.runtime.context.impl.EReferencePropertiesEditionContext;
import org.eclipse.emf.eef.runtime.impl.components.SinglePartPropertiesEditingComponent;
import org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter;
import org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent;
import org.eclipse.emf.eef.runtime.impl.utils.EEFConverterUtil;
import org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy;
import org.eclipse.emf.eef.runtime.policies.impl.CreateEditingPolicy;
import org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider;
import org.eclipse.emf.eef.runtime.ui.widgets.ButtonsModeEnum;
import org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings;
import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.obeonetwork.dsl.spem.Activity;
import org.obeonetwork.dsl.spem.ActivityUseKind;
import org.obeonetwork.dsl.spem.BreakdownElement;
import org.obeonetwork.dsl.spem.Category;
import org.obeonetwork.dsl.spem.Guidance;
import org.obeonetwork.dsl.spem.Kind;
import org.obeonetwork.dsl.spem.MethodConfiguration;
import org.obeonetwork.dsl.spem.Metric;
import org.obeonetwork.dsl.spem.SpemFactory;
import org.obeonetwork.dsl.spem.SpemPackage;
import org.obeonetwork.dsl.spem.VariabilityElement;
import org.obeonetwork.dsl.spem.VariabilityType;
import org.obeonetwork.dsl.spem.WorkSequence;
import org.obeonetwork.dsl.spem.uma.Phase;
import org.obeonetwork.dsl.spem.uma.parts.PhasePropertiesEditionPart;
import org.obeonetwork.dsl.spem.uma.parts.UmaViewsRepository;
// End of user code
/**
*
*
*/
public class PhasePropertiesEditionComponent extends SinglePartPropertiesEditingComponent {
public static String BASE_PART = "Base"; //$NON-NLS-1$
/**
* Settings for kind EObjectFlatComboViewer
*/
private EObjectFlatComboSettings kindSettings;
/**
* Settings for guidance ReferencesTable
*/
private ReferencesTableSettings guidanceSettings;
/**
* Settings for metric ReferencesTable
*/
private ReferencesTableSettings metricSettings;
/**
* Settings for category ReferencesTable
*/
private ReferencesTableSettings categorySettings;
/**
* Settings for linkToPredecessor ReferencesTable
*/
private ReferencesTableSettings linkToPredecessorSettings;
/**
* Settings for linkToSuccessor ReferencesTable
*/
private ReferencesTableSettings linkToSuccessorSettings;
/**
* Settings for variabilityBasedOnElement EObjectFlatComboViewer
*/
private EObjectFlatComboSettings variabilityBasedOnElementSettings;
/**
* Settings for usedActivity EObjectFlatComboViewer
*/
private EObjectFlatComboSettings usedActivitySettings;
/**
* Settings for suppressedBreakdownElement ReferencesTable
*/
private ReferencesTableSettings suppressedBreakdownElementSettings;
/**
* Settings for defaultContext EObjectFlatComboViewer
*/
private EObjectFlatComboSettings defaultContextSettings;
/**
* Settings for validContext ReferencesTable
*/
private ReferencesTableSettings validContextSettings;
/**
* Default constructor
*
*/
public PhasePropertiesEditionComponent(PropertiesEditingContext editingContext, EObject phase, String editing_mode) {
super(editingContext, phase, editing_mode);
parts = new String[] { BASE_PART };
repositoryKey = UmaViewsRepository.class;
partKey = UmaViewsRepository.Phase.class;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final Phase phase = (Phase)elt;
final PhasePropertiesEditionPart basePart = (PhasePropertiesEditionPart)editingPart;
// init values
if (phase.getPreCondition() != null && isAccessible(UmaViewsRepository.Phase.Properties.preCondition))
basePart.setPreCondition(phase.getPreCondition());
if (phase.getPostCondition() != null && isAccessible(UmaViewsRepository.Phase.Properties.postCondition))
basePart.setPostCondition(phase.getPostCondition());
if (isAccessible(UmaViewsRepository.Phase.Properties.kind)) {
// init part
kindSettings = new EObjectFlatComboSettings(phase, SpemPackage.eINSTANCE.getExtensibleElement_Kind());
basePart.initKind(kindSettings);
// set the button mode
basePart.setKindButtonMode(ButtonsModeEnum.BROWSE);
}
if (phase.getPresentationName() != null && isAccessible(UmaViewsRepository.Phase.Properties.presentationName))
basePart.setPresentationName(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEString(), phase.getPresentationName()));
if (phase.getBriefDescription() != null && isAccessible(UmaViewsRepository.Phase.Properties.briefDescription))
basePart.setBriefDescription(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEString(), phase.getBriefDescription()));
if (phase.getMainDescription() != null && isAccessible(UmaViewsRepository.Phase.Properties.mainDescription))
basePart.setMainDescription(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEString(), phase.getMainDescription()));
if (phase.getPurpose() != null && isAccessible(UmaViewsRepository.Phase.Properties.purpose))
basePart.setPurpose(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEString(), phase.getPurpose()));
if (isAccessible(UmaViewsRepository.Phase.Properties.guidance)) {
guidanceSettings = new ReferencesTableSettings(phase, SpemPackage.eINSTANCE.getDescribableElement_Guidance());
basePart.initGuidance(guidanceSettings);
}
if (isAccessible(UmaViewsRepository.Phase.Properties.metric)) {
metricSettings = new ReferencesTableSettings(phase, SpemPackage.eINSTANCE.getDescribableElement_Metric());
basePart.initMetric(metricSettings);
}
if (isAccessible(UmaViewsRepository.Phase.Properties.category)) {
categorySettings = new ReferencesTableSettings(phase, SpemPackage.eINSTANCE.getDescribableElement_Category());
basePart.initCategory(categorySettings);
}
if (phase.getCopyright() != null && isAccessible(UmaViewsRepository.Phase.Properties.copyright))
basePart.setCopyright(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEString(), phase.getCopyright()));
if (phase.getAuthor() != null && isAccessible(UmaViewsRepository.Phase.Properties.author))
basePart.setAuthor(phase.getAuthor());
if (phase.getChangeDate() != null && isAccessible(UmaViewsRepository.Phase.Properties.changeDate))
basePart.setChangeDate(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEDate(), phase.getChangeDate()));
if (phase.getChangeDescription() != null && isAccessible(UmaViewsRepository.Phase.Properties.changeDescription))
basePart.setChangeDescription(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEString(), phase.getChangeDescription()));
if (phase.getVersion() != null && isAccessible(UmaViewsRepository.Phase.Properties.version))
basePart.setVersion(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEString(), phase.getVersion()));
if (phase.getName() != null && isAccessible(UmaViewsRepository.Phase.Properties.name))
basePart.setName(EEFConverterUtil.convertToString(EcorePackage.eINSTANCE.getEString(), phase.getName()));
if (isAccessible(UmaViewsRepository.Phase.Properties.hasMultipleOccurrences)) {
basePart.setHasMultipleOccurrences(phase.isHasMultipleOccurrences());
}
if (isAccessible(UmaViewsRepository.Phase.Properties.isOptional)) {
basePart.setIsOptional(phase.isIsOptional());
}
if (isAccessible(UmaViewsRepository.Phase.Properties.isPlanned)) {
basePart.setIsPlanned(phase.isIsPlanned());
}
if (isAccessible(UmaViewsRepository.Phase.Properties.isRepeatable)) {
basePart.setIsRepeatable(phase.isIsRepeatable());
}
if (isAccessible(UmaViewsRepository.Phase.Properties.isOngoing)) {
basePart.setIsOngoing(phase.isIsOngoing());
}
if (isAccessible(UmaViewsRepository.Phase.Properties.isEventDriven)) {
basePart.setIsEventDriven(phase.isIsEventDriven());
}
if (isAccessible(UmaViewsRepository.Phase.Properties.linkToPredecessor)) {
linkToPredecessorSettings = new ReferencesTableSettings(phase, SpemPackage.eINSTANCE.getWorkBreakdownElement_LinkToPredecessor());
basePart.initLinkToPredecessor(linkToPredecessorSettings);
}
if (isAccessible(UmaViewsRepository.Phase.Properties.linkToSuccessor)) {
linkToSuccessorSettings = new ReferencesTableSettings(phase, SpemPackage.eINSTANCE.getWorkBreakdownElement_LinkToSuccessor());
basePart.initLinkToSuccessor(linkToSuccessorSettings);
}
if (isAccessible(UmaViewsRepository.Phase.Properties.variabilityType)) {
basePart.initVariabilityType((EEnum) SpemPackage.eINSTANCE.getVariabilityElement_VariabilityType().getEType(), phase.getVariabilityType());
}
if (isAccessible(UmaViewsRepository.Phase.Properties.variabilityBasedOnElement)) {
// init part
variabilityBasedOnElementSettings = new EObjectFlatComboSettings(phase, SpemPackage.eINSTANCE.getVariabilityElement_VariabilityBasedOnElement());
basePart.initVariabilityBasedOnElement(variabilityBasedOnElementSettings);
// set the button mode
basePart.setVariabilityBasedOnElementButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(UmaViewsRepository.Phase.Properties.useKind)) {
basePart.initUseKind((EEnum) SpemPackage.eINSTANCE.getActivity_UseKind().getEType(), phase.getUseKind());
}
if (isAccessible(UmaViewsRepository.Phase.Properties.usedActivity)) {
// init part
usedActivitySettings = new EObjectFlatComboSettings(phase, SpemPackage.eINSTANCE.getActivity_UsedActivity());
basePart.initUsedActivity(usedActivitySettings);
// set the button mode
basePart.setUsedActivityButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(UmaViewsRepository.Phase.Properties.suppressedBreakdownElement)) {
suppressedBreakdownElementSettings = new ReferencesTableSettings(phase, SpemPackage.eINSTANCE.getActivity_SuppressedBreakdownElement());
basePart.initSuppressedBreakdownElement(suppressedBreakdownElementSettings);
}
if (isAccessible(UmaViewsRepository.Phase.Properties.defaultContext)) {
// init part
defaultContextSettings = new EObjectFlatComboSettings(phase, SpemPackage.eINSTANCE.getActivity_DefaultContext());
basePart.initDefaultContext(defaultContextSettings);
// set the button mode
basePart.setDefaultContextButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(UmaViewsRepository.Phase.Properties.validContext)) {
validContextSettings = new ReferencesTableSettings(phase, SpemPackage.eINSTANCE.getActivity_ValidContext());
basePart.initValidContext(validContextSettings);
}
// init filters
basePart.addFilterToKind(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
return (element instanceof String && element.equals("")) || (element instanceof Kind); //$NON-NLS-1$
}
});
// Start of user code for additional businessfilters for kind
// End of user code
basePart.addFilterToGuidance(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!basePart.isContainedInGuidanceTable((EObject)element));
return element instanceof Resource;
}
});
basePart.addFilterToGuidance(new EObjectFilter(SpemPackage.eINSTANCE.getGuidance()));
// Start of user code for additional businessfilters for guidance
// End of user code
basePart.addFilterToMetric(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!basePart.isContainedInMetricTable((EObject)element));
return element instanceof Resource;
}
});
basePart.addFilterToMetric(new EObjectFilter(SpemPackage.eINSTANCE.getMetric()));
// Start of user code for additional businessfilters for metric
// End of user code
basePart.addFilterToCategory(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!basePart.isContainedInCategoryTable((EObject)element));
return element instanceof Resource;
}
});
basePart.addFilterToCategory(new EObjectFilter(SpemPackage.eINSTANCE.getCategory()));
// Start of user code for additional businessfilters for category
// End of user code
basePart.addFilterToLinkToPredecessor(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!basePart.isContainedInLinkToPredecessorTable((EObject)element));
return element instanceof Resource;
}
});
basePart.addFilterToLinkToPredecessor(new EObjectFilter(SpemPackage.eINSTANCE.getWorkSequence()));
// Start of user code for additional businessfilters for linkToPredecessor
// End of user code
basePart.addFilterToLinkToSuccessor(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!basePart.isContainedInLinkToSuccessorTable((EObject)element));
return element instanceof Resource;
}
});
basePart.addFilterToLinkToSuccessor(new EObjectFilter(SpemPackage.eINSTANCE.getWorkSequence()));
// Start of user code for additional businessfilters for linkToSuccessor
// End of user code
basePart.addFilterToVariabilityBasedOnElement(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
return (element instanceof String && element.equals("")) || (element instanceof VariabilityElement); //$NON-NLS-1$
}
});
// Start of user code for additional businessfilters for variabilityBasedOnElement
// End of user code
basePart.addFilterToUsedActivity(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
return (element instanceof String && element.equals("")) || (element instanceof Activity); //$NON-NLS-1$
}
});
// Start of user code for additional businessfilters for usedActivity
// End of user code
basePart.addFilterToSuppressedBreakdownElement(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!basePart.isContainedInSuppressedBreakdownElementTable((EObject)element));
return element instanceof Resource;
}
});
basePart.addFilterToSuppressedBreakdownElement(new EObjectFilter(SpemPackage.eINSTANCE.getBreakdownElement()));
// Start of user code for additional businessfilters for suppressedBreakdownElement
// End of user code
basePart.addFilterToDefaultContext(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
return (element instanceof String && element.equals("")) || (element instanceof MethodConfiguration); //$NON-NLS-1$
}
});
// Start of user code for additional businessfilters for defaultContext
// End of user code
basePart.addFilterToValidContext(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!basePart.isContainedInValidContextTable((EObject)element));
return element instanceof Resource;
}
});
basePart.addFilterToValidContext(new EObjectFilter(SpemPackage.eINSTANCE.getMethodConfiguration()));
// Start of user code for additional businessfilters for validContext
// End of user code
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#associatedFeature(java.lang.Object)
*/
public EStructuralFeature associatedFeature(Object editorKey) {
if (editorKey == UmaViewsRepository.Phase.Properties.preCondition) {
return SpemPackage.eINSTANCE.getWorkDefinition_PreCondition();
}
if (editorKey == UmaViewsRepository.Phase.Properties.postCondition) {
return SpemPackage.eINSTANCE.getWorkDefinition_PostCondition();
}
if (editorKey == UmaViewsRepository.Phase.Properties.kind) {
return SpemPackage.eINSTANCE.getExtensibleElement_Kind();
}
if (editorKey == UmaViewsRepository.Phase.Properties.presentationName) {
return SpemPackage.eINSTANCE.getDescribableElement_PresentationName();
}
if (editorKey == UmaViewsRepository.Phase.Properties.briefDescription) {
return SpemPackage.eINSTANCE.getDescribableElement_BriefDescription();
}
if (editorKey == UmaViewsRepository.Phase.Properties.mainDescription) {
return SpemPackage.eINSTANCE.getDescribableElement_MainDescription();
}
if (editorKey == UmaViewsRepository.Phase.Properties.purpose) {
return SpemPackage.eINSTANCE.getDescribableElement_Purpose();
}
if (editorKey == UmaViewsRepository.Phase.Properties.guidance) {
return SpemPackage.eINSTANCE.getDescribableElement_Guidance();
}
if (editorKey == UmaViewsRepository.Phase.Properties.metric) {
return SpemPackage.eINSTANCE.getDescribableElement_Metric();
}
if (editorKey == UmaViewsRepository.Phase.Properties.category) {
return SpemPackage.eINSTANCE.getDescribableElement_Category();
}
if (editorKey == UmaViewsRepository.Phase.Properties.copyright) {
return SpemPackage.eINSTANCE.getDescribableElement_Copyright();
}
if (editorKey == UmaViewsRepository.Phase.Properties.author) {
return SpemPackage.eINSTANCE.getDescribableElement_Author();
}
if (editorKey == UmaViewsRepository.Phase.Properties.changeDate) {
return SpemPackage.eINSTANCE.getDescribableElement_ChangeDate();
}
if (editorKey == UmaViewsRepository.Phase.Properties.changeDescription) {
return SpemPackage.eINSTANCE.getDescribableElement_ChangeDescription();
}
if (editorKey == UmaViewsRepository.Phase.Properties.version) {
return SpemPackage.eINSTANCE.getDescribableElement_Version();
}
if (editorKey == UmaViewsRepository.Phase.Properties.name) {
return SpemPackage.eINSTANCE.getProcessPackageableElement_Name();
}
if (editorKey == UmaViewsRepository.Phase.Properties.hasMultipleOccurrences) {
return SpemPackage.eINSTANCE.getBreakdownElement_HasMultipleOccurrences();
}
if (editorKey == UmaViewsRepository.Phase.Properties.isOptional) {
return SpemPackage.eINSTANCE.getBreakdownElement_IsOptional();
}
if (editorKey == UmaViewsRepository.Phase.Properties.isPlanned) {
return SpemPackage.eINSTANCE.getBreakdownElement_IsPlanned();
}
if (editorKey == UmaViewsRepository.Phase.Properties.isRepeatable) {
return SpemPackage.eINSTANCE.getWorkBreakdownElement_IsRepeatable();
}
if (editorKey == UmaViewsRepository.Phase.Properties.isOngoing) {
return SpemPackage.eINSTANCE.getWorkBreakdownElement_IsOngoing();
}
if (editorKey == UmaViewsRepository.Phase.Properties.isEventDriven) {
return SpemPackage.eINSTANCE.getWorkBreakdownElement_IsEventDriven();
}
if (editorKey == UmaViewsRepository.Phase.Properties.linkToPredecessor) {
return SpemPackage.eINSTANCE.getWorkBreakdownElement_LinkToPredecessor();
}
if (editorKey == UmaViewsRepository.Phase.Properties.linkToSuccessor) {
return SpemPackage.eINSTANCE.getWorkBreakdownElement_LinkToSuccessor();
}
if (editorKey == UmaViewsRepository.Phase.Properties.variabilityType) {
return SpemPackage.eINSTANCE.getVariabilityElement_VariabilityType();
}
if (editorKey == UmaViewsRepository.Phase.Properties.variabilityBasedOnElement) {
return SpemPackage.eINSTANCE.getVariabilityElement_VariabilityBasedOnElement();
}
if (editorKey == UmaViewsRepository.Phase.Properties.useKind) {
return SpemPackage.eINSTANCE.getActivity_UseKind();
}
if (editorKey == UmaViewsRepository.Phase.Properties.usedActivity) {
return SpemPackage.eINSTANCE.getActivity_UsedActivity();
}
if (editorKey == UmaViewsRepository.Phase.Properties.suppressedBreakdownElement) {
return SpemPackage.eINSTANCE.getActivity_SuppressedBreakdownElement();
}
if (editorKey == UmaViewsRepository.Phase.Properties.defaultContext) {
return SpemPackage.eINSTANCE.getActivity_DefaultContext();
}
if (editorKey == UmaViewsRepository.Phase.Properties.validContext) {
return SpemPackage.eINSTANCE.getActivity_ValidContext();
}
return super.associatedFeature(editorKey);
}
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*
*/
public void updateSemanticModel(final IPropertiesEditionEvent event) {
Phase phase = (Phase)semanticObject;
if (UmaViewsRepository.Phase.Properties.preCondition == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
phase.getPreCondition().clear();
phase.getPreCondition().addAll(((List) event.getNewValue()));
}
}
if (UmaViewsRepository.Phase.Properties.postCondition == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
phase.getPostCondition().clear();
phase.getPostCondition().addAll(((List) event.getNewValue()));
}
}
if (UmaViewsRepository.Phase.Properties.kind == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
kindSettings.setToReference((Kind)event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.ADD) {
Kind eObject = SpemFactory.eINSTANCE.createKind();
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, eObject, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(eObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy != null) {
policy.execute();
}
}
kindSettings.setToReference(eObject);
}
}
if (UmaViewsRepository.Phase.Properties.presentationName == event.getAffectedEditor()) {
phase.setPresentationName((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEString(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.briefDescription == event.getAffectedEditor()) {
phase.setBriefDescription((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEString(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.mainDescription == event.getAffectedEditor()) {
phase.setMainDescription((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEString(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.purpose == event.getAffectedEditor()) {
phase.setPurpose((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEString(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.guidance == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
if (event.getNewValue() instanceof Guidance) {
guidanceSettings.addToReference((EObject) event.getNewValue());
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
guidanceSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
guidanceSettings.move(event.getNewIndex(), (Guidance) event.getNewValue());
}
}
if (UmaViewsRepository.Phase.Properties.metric == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
if (event.getNewValue() instanceof Metric) {
metricSettings.addToReference((EObject) event.getNewValue());
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
metricSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
metricSettings.move(event.getNewIndex(), (Metric) event.getNewValue());
}
}
if (UmaViewsRepository.Phase.Properties.category == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
if (event.getNewValue() instanceof Category) {
categorySettings.addToReference((EObject) event.getNewValue());
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
categorySettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
categorySettings.move(event.getNewIndex(), (Category) event.getNewValue());
}
}
if (UmaViewsRepository.Phase.Properties.copyright == event.getAffectedEditor()) {
phase.setCopyright((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEString(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.author == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
phase.getAuthor().clear();
phase.getAuthor().addAll(((List) event.getNewValue()));
}
}
if (UmaViewsRepository.Phase.Properties.changeDate == event.getAffectedEditor()) {
phase.setChangeDate((java.util.Date)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEDate(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.changeDescription == event.getAffectedEditor()) {
phase.setChangeDescription((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEString(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.version == event.getAffectedEditor()) {
phase.setVersion((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEString(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.name == event.getAffectedEditor()) {
phase.setName((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.eINSTANCE.getEString(), (String)event.getNewValue()));
}
if (UmaViewsRepository.Phase.Properties.hasMultipleOccurrences == event.getAffectedEditor()) {
phase.setHasMultipleOccurrences((Boolean)event.getNewValue());
}
if (UmaViewsRepository.Phase.Properties.isOptional == event.getAffectedEditor()) {
phase.setIsOptional((Boolean)event.getNewValue());
}
if (UmaViewsRepository.Phase.Properties.isPlanned == event.getAffectedEditor()) {
phase.setIsPlanned((Boolean)event.getNewValue());
}
if (UmaViewsRepository.Phase.Properties.isRepeatable == event.getAffectedEditor()) {
phase.setIsRepeatable((Boolean)event.getNewValue());
}
if (UmaViewsRepository.Phase.Properties.isOngoing == event.getAffectedEditor()) {
phase.setIsOngoing((Boolean)event.getNewValue());
}
if (UmaViewsRepository.Phase.Properties.isEventDriven == event.getAffectedEditor()) {
phase.setIsEventDriven((Boolean)event.getNewValue());
}
if (UmaViewsRepository.Phase.Properties.linkToPredecessor == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
if (event.getNewValue() instanceof WorkSequence) {
linkToPredecessorSettings.addToReference((EObject) event.getNewValue());
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
linkToPredecessorSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
linkToPredecessorSettings.move(event.getNewIndex(), (WorkSequence) event.getNewValue());
}
}
if (UmaViewsRepository.Phase.Properties.linkToSuccessor == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
if (event.getNewValue() instanceof WorkSequence) {
linkToSuccessorSettings.addToReference((EObject) event.getNewValue());
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
linkToSuccessorSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
linkToSuccessorSettings.move(event.getNewIndex(), (WorkSequence) event.getNewValue());
}
}
if (UmaViewsRepository.Phase.Properties.variabilityType == event.getAffectedEditor()) {
phase.setVariabilityType((VariabilityType)event.getNewValue());
}
if (UmaViewsRepository.Phase.Properties.variabilityBasedOnElement == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
variabilityBasedOnElementSettings.setToReference((VariabilityElement)event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, variabilityBasedOnElementSettings, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy instanceof CreateEditingPolicy) {
policy.execute();
}
}
}
}
if (UmaViewsRepository.Phase.Properties.useKind == event.getAffectedEditor()) {
phase.setUseKind((ActivityUseKind)event.getNewValue());
}
if (UmaViewsRepository.Phase.Properties.usedActivity == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
usedActivitySettings.setToReference((Activity)event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.ADD) {
Activity eObject = SpemFactory.eINSTANCE.createActivity();
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, eObject, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(eObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy != null) {
policy.execute();
}
}
usedActivitySettings.setToReference(eObject);
}
}
if (UmaViewsRepository.Phase.Properties.suppressedBreakdownElement == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
if (event.getNewValue() instanceof BreakdownElement) {
suppressedBreakdownElementSettings.addToReference((EObject) event.getNewValue());
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
suppressedBreakdownElementSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
suppressedBreakdownElementSettings.move(event.getNewIndex(), (BreakdownElement) event.getNewValue());
}
}
if (UmaViewsRepository.Phase.Properties.defaultContext == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
defaultContextSettings.setToReference((MethodConfiguration)event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.ADD) {
MethodConfiguration eObject = SpemFactory.eINSTANCE.createMethodConfiguration();
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, eObject, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(eObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy != null) {
policy.execute();
}
}
defaultContextSettings.setToReference(eObject);
}
}
if (UmaViewsRepository.Phase.Properties.validContext == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
if (event.getNewValue() instanceof MethodConfiguration) {
validContextSettings.addToReference((EObject) event.getNewValue());
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
validContextSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
validContextSettings.move(event.getNewIndex(), (MethodConfiguration) event.getNewValue());
}
}
}
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
*/
public void updatePart(Notification msg) {
if (editingPart.isVisible()) {
PhasePropertiesEditionPart basePart = (PhasePropertiesEditionPart)editingPart;
if (SpemPackage.eINSTANCE.getWorkDefinition_PreCondition().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.preCondition)) {
basePart.setPreCondition(((Phase)semanticObject).getPreCondition());
}
if (SpemPackage.eINSTANCE.getWorkDefinition_PostCondition().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.postCondition)) {
basePart.setPostCondition(((Phase)semanticObject).getPostCondition());
}
if (SpemPackage.eINSTANCE.getExtensibleElement_Kind().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.kind))
basePart.setKind((EObject)msg.getNewValue());
if (SpemPackage.eINSTANCE.getDescribableElement_PresentationName().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.presentationName)) {
if (msg.getNewValue() != null) {
basePart.setPresentationName(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
} else {
basePart.setPresentationName("");
}
}
if (SpemPackage.eINSTANCE.getDescribableElement_BriefDescription().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.briefDescription)) {
if (msg.getNewValue() != null) {
basePart.setBriefDescription(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
} else {
basePart.setBriefDescription("");
}
}
if (SpemPackage.eINSTANCE.getDescribableElement_MainDescription().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.mainDescription)) {
if (msg.getNewValue() != null) {
basePart.setMainDescription(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
} else {
basePart.setMainDescription("");
}
}
if (SpemPackage.eINSTANCE.getDescribableElement_Purpose().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.purpose)) {
if (msg.getNewValue() != null) {
basePart.setPurpose(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
} else {
basePart.setPurpose("");
}
}
if (SpemPackage.eINSTANCE.getDescribableElement_Guidance().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.guidance))
basePart.updateGuidance();
if (SpemPackage.eINSTANCE.getDescribableElement_Metric().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.metric))
basePart.updateMetric();
if (SpemPackage.eINSTANCE.getDescribableElement_Category().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.category))
basePart.updateCategory();
if (SpemPackage.eINSTANCE.getDescribableElement_Copyright().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.copyright)) {
if (msg.getNewValue() != null) {
basePart.setCopyright(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
} else {
basePart.setCopyright("");
}
}
if (SpemPackage.eINSTANCE.getDescribableElement_Author().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.author)) {
basePart.setAuthor(((Phase)semanticObject).getAuthor());
}
if (SpemPackage.eINSTANCE.getDescribableElement_ChangeDate().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.changeDate)) {
if (msg.getNewValue() != null) {
basePart.setChangeDate(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEDate(), msg.getNewValue()));
} else {
basePart.setChangeDate("");
}
}
if (SpemPackage.eINSTANCE.getDescribableElement_ChangeDescription().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.changeDescription)) {
if (msg.getNewValue() != null) {
basePart.setChangeDescription(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
} else {
basePart.setChangeDescription("");
}
}
if (SpemPackage.eINSTANCE.getDescribableElement_Version().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.version)) {
if (msg.getNewValue() != null) {
basePart.setVersion(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
} else {
basePart.setVersion("");
}
}
if (SpemPackage.eINSTANCE.getProcessPackageableElement_Name().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.name)) {
if (msg.getNewValue() != null) {
basePart.setName(EcoreUtil.convertToString(EcorePackage.eINSTANCE.getEString(), msg.getNewValue()));
} else {
basePart.setName("");
}
}
if (SpemPackage.eINSTANCE.getBreakdownElement_HasMultipleOccurrences().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.hasMultipleOccurrences))
basePart.setHasMultipleOccurrences((Boolean)msg.getNewValue());
if (SpemPackage.eINSTANCE.getBreakdownElement_IsOptional().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.isOptional))
basePart.setIsOptional((Boolean)msg.getNewValue());
if (SpemPackage.eINSTANCE.getBreakdownElement_IsPlanned().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.isPlanned))
basePart.setIsPlanned((Boolean)msg.getNewValue());
if (SpemPackage.eINSTANCE.getWorkBreakdownElement_IsRepeatable().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.isRepeatable))
basePart.setIsRepeatable((Boolean)msg.getNewValue());
if (SpemPackage.eINSTANCE.getWorkBreakdownElement_IsOngoing().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.isOngoing))
basePart.setIsOngoing((Boolean)msg.getNewValue());
if (SpemPackage.eINSTANCE.getWorkBreakdownElement_IsEventDriven().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.isEventDriven))
basePart.setIsEventDriven((Boolean)msg.getNewValue());
if (SpemPackage.eINSTANCE.getWorkBreakdownElement_LinkToPredecessor().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.linkToPredecessor))
basePart.updateLinkToPredecessor();
if (SpemPackage.eINSTANCE.getWorkBreakdownElement_LinkToSuccessor().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.linkToSuccessor))
basePart.updateLinkToSuccessor();
if (SpemPackage.eINSTANCE.getVariabilityElement_VariabilityType().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.variabilityType))
basePart.setVariabilityType((Enumerator)msg.getNewValue());
if (SpemPackage.eINSTANCE.getVariabilityElement_VariabilityBasedOnElement().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.variabilityBasedOnElement))
basePart.setVariabilityBasedOnElement((EObject)msg.getNewValue());
if (SpemPackage.eINSTANCE.getActivity_UseKind().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.useKind))
basePart.setUseKind((Enumerator)msg.getNewValue());
if (SpemPackage.eINSTANCE.getActivity_UsedActivity().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.usedActivity))
basePart.setUsedActivity((EObject)msg.getNewValue());
if (SpemPackage.eINSTANCE.getActivity_SuppressedBreakdownElement().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.suppressedBreakdownElement))
basePart.updateSuppressedBreakdownElement();
if (SpemPackage.eINSTANCE.getActivity_DefaultContext().equals(msg.getFeature()) && basePart != null && isAccessible(UmaViewsRepository.Phase.Properties.defaultContext))
basePart.setDefaultContext((EObject)msg.getNewValue());
if (SpemPackage.eINSTANCE.getActivity_ValidContext().equals(msg.getFeature()) && isAccessible(UmaViewsRepository.Phase.Properties.validContext))
basePart.updateValidContext();
}
}
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#isRequired(java.lang.Object, int)
*
*/
public boolean isRequired(Object key, int kind) {
return key == UmaViewsRepository.Phase.Properties.hasMultipleOccurrences || key == UmaViewsRepository.Phase.Properties.isOptional || key == UmaViewsRepository.Phase.Properties.isPlanned || key == UmaViewsRepository.Phase.Properties.isRepeatable || key == UmaViewsRepository.Phase.Properties.isOngoing || key == UmaViewsRepository.Phase.Properties.isEventDriven || key == UmaViewsRepository.Phase.Properties.useKind;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*
*/
public Diagnostic validateValue(IPropertiesEditionEvent event) {
Diagnostic ret = Diagnostic.OK_INSTANCE;
if (event.getNewValue() != null) {
try {
if (UmaViewsRepository.Phase.Properties.preCondition == event.getAffectedEditor()) {
BasicDiagnostic chain = new BasicDiagnostic();
for (Iterator iterator = ((List)event.getNewValue()).iterator(); iterator.hasNext();) {
chain.add(Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getWorkDefinition_PreCondition().getEAttributeType(), iterator.next()));
}
ret = chain;
}
if (UmaViewsRepository.Phase.Properties.postCondition == event.getAffectedEditor()) {
BasicDiagnostic chain = new BasicDiagnostic();
for (Iterator iterator = ((List)event.getNewValue()).iterator(); iterator.hasNext();) {
chain.add(Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getWorkDefinition_PostCondition().getEAttributeType(), iterator.next()));
}
ret = chain;
}
if (UmaViewsRepository.Phase.Properties.presentationName == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getDescribableElement_PresentationName().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_PresentationName().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.briefDescription == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getDescribableElement_BriefDescription().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_BriefDescription().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.mainDescription == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getDescribableElement_MainDescription().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_MainDescription().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.purpose == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getDescribableElement_Purpose().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_Purpose().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.copyright == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getDescribableElement_Copyright().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_Copyright().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.author == event.getAffectedEditor()) {
BasicDiagnostic chain = new BasicDiagnostic();
for (Iterator iterator = ((List)event.getNewValue()).iterator(); iterator.hasNext();) {
chain.add(Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_Author().getEAttributeType(), iterator.next()));
}
ret = chain;
}
if (UmaViewsRepository.Phase.Properties.changeDate == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getDescribableElement_ChangeDate().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_ChangeDate().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.changeDescription == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getDescribableElement_ChangeDescription().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_ChangeDescription().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.version == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getDescribableElement_Version().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getDescribableElement_Version().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getProcessPackageableElement_Name().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getProcessPackageableElement_Name().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.hasMultipleOccurrences == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getBreakdownElement_HasMultipleOccurrences().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getBreakdownElement_HasMultipleOccurrences().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.isOptional == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getBreakdownElement_IsOptional().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getBreakdownElement_IsOptional().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.isPlanned == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getBreakdownElement_IsPlanned().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getBreakdownElement_IsPlanned().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.isRepeatable == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getWorkBreakdownElement_IsRepeatable().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getWorkBreakdownElement_IsRepeatable().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.isOngoing == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getWorkBreakdownElement_IsOngoing().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getWorkBreakdownElement_IsOngoing().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.isEventDriven == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getWorkBreakdownElement_IsEventDriven().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getWorkBreakdownElement_IsEventDriven().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.variabilityType == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getVariabilityElement_VariabilityType().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getVariabilityElement_VariabilityType().getEAttributeType(), newValue);
}
if (UmaViewsRepository.Phase.Properties.useKind == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EcoreUtil.createFromString(SpemPackage.eINSTANCE.getActivity_UseKind().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(SpemPackage.eINSTANCE.getActivity_UseKind().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
}
| [
"Stephane.Drapeau@obeo.fr"
] | Stephane.Drapeau@obeo.fr |
ca213e85ebd43cdb7380a3e256da998014c0f031 | ddb4471bb6ccbe71130470bf261c8965bb3c017b | /src/main/java/NewJFrame.java | 08c293bab580fe5906896630e444115a3eb42185 | [] | no_license | WindowYZU/swing-buttons-s1050316 | deb610677b3f28770911d775782befbc023dfab8 | 4661b451490d613cc44bb6048eca10c2e540d4a7 | refs/heads/master | 2020-03-29T18:47:22.349796 | 2018-10-02T08:38:55 | 2018-10-02T08:38:55 | 150,231,550 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,921 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author user
*/
public class NewJFrame extends javax.swing.JFrame {
/**
* Creates new form NewJFrame
*/
public NewJFrame() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
jPanel1 = new javax.swing.JPanel();
jCheckBox1 = new javax.swing.JCheckBox();
jCheckBox2 = new javax.swing.JCheckBox();
jCheckBox3 = new javax.swing.JCheckBox();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
buttonGroup1.add(jRadioButton1);
jRadioButton1.setText("jRadioButton1");
jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton1ActionPerformed(evt);
}
});
buttonGroup1.add(jRadioButton2);
jRadioButton2.setText("jRadioButton2");
jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton2ActionPerformed(evt);
}
});
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("group1"));
jPanel1.setName("group1"); // NOI18N
jCheckBox1.setText("jCheckBox1");
jCheckBox1.setEnabled(false);
jCheckBox2.setText("jCheckBox2");
jCheckBox2.setEnabled(false);
jCheckBox3.setText("jCheckBox3");
jCheckBox3.setEnabled(false);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jCheckBox1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBox2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBox3)
.addContainerGap(180, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox1)
.addComponent(jCheckBox2)
.addComponent(jCheckBox3))
.addContainerGap(97, Short.MAX_VALUE))
);
jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("group2"));
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jTextArea1.setEnabled(false);
jScrollPane1.setViewportView(jTextArea1);
jButton1.setText("jButton1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton1))
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jRadioButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButton2)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton1)
.addComponent(jRadioButton2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(jButton1)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
// TODO add your handling code here:
if(jRadioButton1.isSelected()){
jCheckBox1.setEnabled(true);
jCheckBox2.setEnabled(true);
jCheckBox3.setEnabled(true);
jTextArea1.setEnabled(false);
}else{
jCheckBox1.setEnabled(false);
jCheckBox2.setEnabled(false);
jCheckBox3.setEnabled(false);
jTextArea1.setEnabled(true);
}
}//GEN-LAST:event_jRadioButton1ActionPerformed
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
// TODO add your handling code here:
if(jRadioButton1.isSelected()){
jCheckBox1.setEnabled(true);
jCheckBox2.setEnabled(true);
jCheckBox3.setEnabled(true);
jTextArea1.setEnabled(false);
}else{
jCheckBox1.setEnabled(false);
jCheckBox2.setEnabled(false);
jCheckBox3.setEnabled(false);
jTextArea1.setEnabled(true);
}
}//GEN-LAST:event_jRadioButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton1;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JCheckBox jCheckBox3;
private javax.swing.JPanel jPanel1;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration//GEN-END:variables
}
| [
"user@009"
] | user@009 |
f2990fa3316244457fed5e9346a46aca8985039c | 4536078b4070fc3143086ff48f088e2bc4b4c681 | /v1.1.2/decompiled/androidx/appcompat/widget/SearchView$p.java | 2b630ab55a39e41501d0072ce1dfe5ec2b30f2d9 | [] | no_license | olealgoritme/smittestopp_src | 485b81422752c3d1e7980fbc9301f4f0e0030d16 | 52080d5b7613cb9279bc6cda5b469a5c84e34f6a | refs/heads/master | 2023-05-27T21:25:17.564334 | 2023-05-02T14:24:31 | 2023-05-02T14:24:31 | 262,846,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,268 | java | package androidx.appcompat.widget;
import android.graphics.Rect;
import android.view.MotionEvent;
import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewConfiguration;
public class SearchView$p
extends TouchDelegate
{
public final View a;
public final Rect b;
public final Rect c;
public final Rect d;
public final int e;
public boolean f;
public SearchView$p(Rect paramRect1, Rect paramRect2, View paramView)
{
super(paramRect1, paramView);
e = ViewConfiguration.get(paramView.getContext()).getScaledTouchSlop();
b = new Rect();
d = new Rect();
c = new Rect();
a(paramRect1, paramRect2);
a = paramView;
}
public void a(Rect paramRect1, Rect paramRect2)
{
b.set(paramRect1);
d.set(paramRect1);
paramRect1 = d;
int i = e;
paramRect1.inset(-i, -i);
c.set(paramRect2);
}
public boolean onTouchEvent(MotionEvent paramMotionEvent)
{
int i = (int)paramMotionEvent.getX();
int j = (int)paramMotionEvent.getY();
int k = paramMotionEvent.getAction();
boolean bool1 = true;
boolean bool2 = false;
if (k != 0) {
if ((k != 1) && (k != 2))
{
if (k != 3) {
break label131;
}
bool1 = f;
f = false;
}
else
{
bool3 = f;
bool1 = bool3;
if (bool3)
{
bool1 = bool3;
if (!d.contains(i, j))
{
bool1 = bool3;
k = 0;
break label137;
}
}
}
}
for (;;)
{
k = 1;
break label137;
if (!b.contains(i, j)) {
break;
}
f = true;
}
label131:
k = 1;
bool1 = false;
label137:
boolean bool3 = bool2;
if (bool1)
{
if ((k != 0) && (!c.contains(i, j)))
{
paramMotionEvent.setLocation(a.getWidth() / 2, a.getHeight() / 2);
}
else
{
Rect localRect = c;
paramMotionEvent.setLocation(i - left, j - top);
}
bool3 = a.dispatchTouchEvent(paramMotionEvent);
}
return bool3;
}
}
/* Location:
* Qualified Name: androidx.appcompat.widget.SearchView.p
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"olealgoritme@gmail.com"
] | olealgoritme@gmail.com |
67d8f5567b5874c82f325c0e081e84042be4a4dc | d832dc7ac032d7d8159dc99caadc2e41803cd908 | /app/src/main/java/com/psi/projectpsi/ServiceActivity.java | 8c4b68c0def80867edd40d38767f7848fe2908c0 | [] | no_license | zzZDenisZzz/ProjectPsi | 445f47d6bd1287ed10e242bcf6d4238230c225a0 | d19487b0ce09830d49d7d748e1767077bc4380a1 | refs/heads/master | 2021-04-12T06:12:40.956439 | 2018-04-18T19:47:11 | 2018-04-18T19:47:11 | 125,904,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,457 | java | package com.psi.projectpsi;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;
import android.widget.Toast;
import com.psi.projectpsi.api.PsiApi;
import com.psi.projectpsi.controller.Controller;
import com.psi.projectpsi.model.PsiModel;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ServiceActivity extends AppCompatActivity {
PsiApi psiApi;
TextView textService;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.service_layout);
psiApi = Controller.getApi();
textService = findViewById(R.id.text_service);
psiApi.getData("getServiceContent",343).enqueue(new Callback<List<PsiModel>>() {
@Override
public void onResponse(Call<List<PsiModel>> call, Response<List<PsiModel>> response) {
// response.body();
}
@Override
public void onFailure(Call<List<PsiModel>> call, Throwable t) {
Toast.makeText(ServiceActivity.this, "An error occurred during networking", Toast.LENGTH_SHORT).show();
}
});
}
}
| [
"corey2007@bigmir.net"
] | corey2007@bigmir.net |
6b6765ffc9ce2ea725908aa39114f9b989c43c10 | 3b2d2064c051721521cfa9b58fa4fa37ec17b01f | /scw-parent/scw-project/src/main/java/com/offcn/project/config/AppProjectConfig.java | 9da7b1494b7732d80f6dc3772093b19eb4aa2616 | [] | no_license | tianxinfang1145/offcn-parent | 4db33d29038df3e00586e6be39e88b902bab0a3c | d326ca99764f4053e6becf137617675554eab07e | refs/heads/master | 2023-01-24T10:35:25.436675 | 2020-11-07T13:20:07 | 2020-11-07T13:20:07 | 310,849,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 578 | java | package com.offcn.project.config;
import com.offcn.utils.OSSTemplate;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Auther: lhq
* @Date: 2020/10/23 10:17
* @Description:
*/
@Configuration
public class AppProjectConfig {
//加载配置文件中的oss属性
@ConfigurationProperties(prefix = "oss")
@Bean //<bean id="" class="">
public OSSTemplate ossTemplate(){
return new OSSTemplate();
}
}
| [
"3047195940@qq.com"
] | 3047195940@qq.com |
ada7d3822a23afa3d5a121f8bd65478f702b5fd4 | 8ba2ca6c9bfb3e59cd3b5768614d73c9674a7283 | /app/src/main/java/com/example/animalsapp/MainActivity.java | 9a396d0c1ec6bdf530b652797a081cbb93c1cfeb | [] | no_license | ayfantis53/animals_android_app | f74ec299257a127f552c032ee5ad744c58ff42fc | acbbb48c95779ea8ec3360811ee75be5d1e93d3e | refs/heads/master | 2023-08-14T22:00:32.323366 | 2021-10-10T00:39:29 | 2021-10-11T05:52:37 | 415,452,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,993 | java | package com.example.animalsapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements AnimalAdapter.MyClickInterface {
RecyclerView recyclerView;
ArrayList<Animal> animals;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_AnimalsApp);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recycler_view);
animals = new ArrayList<>();
animals.add(new Animal("Dolphin", R.drawable.dolphin));
animals.add(new Animal("Turtle", R.drawable.turtle));
animals.add(new Animal("Parrot", R.drawable.parrot));
animals.add(new Animal("Rabbit", R.drawable.rabbit));
animals.add(new Animal("Tiger", R.drawable.tiger));
animals.add(new Animal("Owl", R.drawable.owl));
animals.add(new Animal("Lion", R.drawable.lion));
animals.add(new Animal("Wolf", R.drawable.wolf));
AnimalAdapter animalAdapter = new AnimalAdapter(animals, this , this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(animalAdapter);
}
@Override
public void onItemClick(int positionOfTheAnimal) {
Toast.makeText(this,"Clicked " + animals.get(positionOfTheAnimal).getName(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, AnimalInfo.class);
intent.putExtra("image", animals.get(positionOfTheAnimal).getImage());
intent.putExtra("name", animals.get(positionOfTheAnimal).getName());
startActivity(intent);
}
} | [
"andrew_yfantis@yahoo.com"
] | andrew_yfantis@yahoo.com |
0e27363adfc62d9ecda19e601d397a84dbe14cce | 6d60a8adbfdc498a28f3e3fef70366581aa0c5fd | /codebase/selected/1144107.java | 88715097a128969dcc85c590aa5b1a3ae7ace7a8 | [] | no_license | rayhan-ferdous/code2vec | 14268adaf9022d140a47a88129634398cd23cf8f | c8ca68a7a1053d0d09087b14d4c79a189ac0cf00 | refs/heads/master | 2022-03-09T08:40:18.035781 | 2022-02-27T23:57:44 | 2022-02-27T23:57:44 | 140,347,552 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,067 | java | package DAOs;
import beans.RecTeam;
import beans.RecTeamPK;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import DAOs.RecTeamJpaController;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
/**
*
* @author Ioana C
*/
public class RecTeamConverter implements Converter {
public Object getAsObject(FacesContext facesContext, UIComponent component, String string) {
if (string == null || string.length() == 0) {
return null;
}
RecTeamPK id = getId(string);
RecTeamJpaController controller = (RecTeamJpaController) facesContext.getApplication().getELResolver().getValue(facesContext.getELContext(), null, "recTeamJpa");
return controller.findRecTeam(id);
}
RecTeamPK getId(String string) {
RecTeamPK id = new RecTeamPK();
String[] params = new String[2];
int p = 0;
int grabStart = 0;
String delim = "#";
String escape = "~";
Pattern pattern = Pattern.compile(escape + "*" + delim);
Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
String found = matcher.group();
if (found.length() % 2 == 1) {
params[p] = string.substring(grabStart, matcher.start());
p++;
grabStart = matcher.end();
}
}
if (p != params.length - 1) {
throw new IllegalArgumentException("string " + string + " is not in expected format. expected 2 ids delimited by " + delim);
}
params[p] = string.substring(grabStart);
for (int i = 0; i < params.length; i++) {
params[i] = params[i].replace(escape + delim, delim);
params[i] = params[i].replace(escape + escape, escape);
}
id.setPersonID(Integer.parseInt(params[0]));
id.setRecProcessID(Integer.parseInt(params[1]));
return id;
}
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null) {
return null;
}
if (object instanceof RecTeam) {
RecTeam o = (RecTeam) object;
RecTeamPK id = o.getRecTeamPK();
if (id == null) {
return "";
}
String delim = "#";
String escape = "~";
String personID = String.valueOf(id.getPersonID());
personID = personID.replace(escape, escape + escape);
personID = personID.replace(delim, escape + delim);
String recProcessID = String.valueOf(id.getRecProcessID());
recProcessID = recProcessID.replace(escape, escape + escape);
recProcessID = recProcessID.replace(delim, escape + delim);
return personID + delim + recProcessID;
} else {
throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: beans.RecTeam");
}
}
}
| [
"aaponcseku@gmail.com"
] | aaponcseku@gmail.com |
4024e840a101c3d656f95c3947ed63b9771bae67 | 9f109b42c54aeb5233ad5eacfceca3b745fe0a67 | /src/main/java/com/anhelinaZhuzha/mobileOperator/model/service/Dial.java | 95879774b7fde502dff4f404d6ead558347b72ce | [] | no_license | anhelina-zhuzha/mobile-operator-java | c634296f21a758e79b5b8ba7745e34a6c7238ab6 | 69cfeb830668f702a766071f439bda76a2c0b871 | refs/heads/master | 2020-04-07T09:17:24.273387 | 2018-12-20T16:24:35 | 2018-12-20T16:24:35 | 158,071,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package com.anhelinaZhuzha.mobileOperator.model.service;
import com.anhelinaZhuzha.mobileOperator.model.payment.PaymentType;
public class Dial extends Service {
private int minutes;
public Dial(String name, boolean isItRequired, PaymentType paymentType, int minutes) {
super(name, isItRequired, paymentType);
this.minutes = minutes;
}
public int minutesAmount() {
return minutes;
}
/**
* Dynamic polymorphism, method overridden method on the super class
*/
@Override
public String text() {
return String.format("%d минут звонков", minutes) + " / " + super.text();
}
}
| [
"ang@mail"
] | ang@mail |
f79f08e8f504b2d5920575048efbbdb4979358bd | a3df789ce5e66610eee20af8627a79fd6bb191e9 | /src/test/amz/Amazon2.java | 48ca9e1ab41e122fc084a93c304866246ad5774e | [] | no_license | evalle-mx/demo-varios | d5701fe2bfc8d0481ea3c505f8b24d5c16c52aba | d4cc083af5057a511b354e1a7cf13ce257397510 | refs/heads/master | 2022-10-22T09:08:41.895259 | 2020-06-17T00:47:00 | 2020-06-17T00:47:00 | 272,843,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,032 | java | package amz;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
public class Amazon2 {
// METHOD SIGNATURE BEGINS, THIS METHOD IS REQUIRED
int minimumHours(int rows, int columns, List<List<Integer> > grid)
{
// WRITE YOUR CODE HERE
Iterator<List<Integer>> itGrid = grid.iterator();
List<Integer> ls;
boolean noZero=false, ones=false;
int hours = 1;
Integer iBase;
int y=0;
while(itGrid.hasNext()) {
ls = itGrid.next();
System.out.println(ls);
for(int x=0;x<ls.size();x++) {
iBase=ls.get(x);
if(iBase==1) {
ones=true;//At least one
System.out.println("("+x+","+y+") look for adjacency");
if(x<ls.size()-2) {
if(ls.get(x+1)==0) {
hours++;
}
}
}
}
y++;
}
if(!ones) {
return -1;
}
return hours;
}
// METHOD SIGNATURE ENDS
public static void main(String[] args) {
Amazon2 demo = new Amazon2();
List<List<Integer>> grid = new ArrayList<List<Integer>>();
String linea = "1,0,0,0,0";
grid.add(parsInts(linea));
linea = "0,1,0,0,0";
grid.add(parsInts(linea));
linea = "0,0,1,0,0";
grid.add(parsInts(linea));
linea = "0,0,0,1,0";
grid.add(parsInts(linea));
linea = "0,0,0,0,1";
grid.add(parsInts(linea));
System.out.println("numH: " + demo.minimumHours(5, 5, grid) );
}
private static List<Integer> parsInts(String linea){
List<String> lsData = Arrays.asList(linea.split("\\s*,\\s*"));
List<Integer> lsLinea = new ArrayList<Integer>();
for(int x=0;x<lsData.size();x++) {
int pInt = Integer.parseInt(lsData.get(x));
lsLinea.add(pInt);
}
return lsLinea;
}
}
| [
"netto.speed@gmail.com"
] | netto.speed@gmail.com |
cbec860cadebde68cdce9c1bfd079ecf8b55794c | 434f3dc2bc1f2e3b332eab90c7479297307de9bb | /election/src/election/Election.java | f501fd263c8319ee431808faadee406eca0102d1 | [] | no_license | utkuyurter/Java-Files | 58a6f7e6de1272c4ec3495ad2b5dcb034473d67d | 4b3ac056f2f674abb14e3d081c4ee2ed427b4deb | refs/heads/master | 2021-01-10T02:04:33.927637 | 2016-03-03T20:19:52 | 2016-03-03T20:19:52 | 50,553,939 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | package election;
// ************************************************************
// Election.java
//
// This file contains a program that tallies the results of
// an election. It reads in the number of votes for each of
// two candidates in each of several precincts. It determines
// the total number of votes received by each candidate, the
// percent of votes received by each candidate, the number of
// precincts each candidate carries, and the
// maximum winning margin in a precinct.
// ************************************************************
import java.util.Scanner;
public class Election
{
public static void main(String[] args)
{
int votesForPolly = 0; // number of votes for Polly in each precinct
int votesForErnest = 0; // number of votes for Ernest in each precinct
int totalPolly = 0; // running total of votes for Polly
int totalErnest = 0; // running total of votes for Ernest
String response; // answer (y or n) to the "more precincts" question
Scanner scan = new Scanner(System.in);
System.out.println();
System.out.println("Election Day Vote Counting Program");
System.out.println();
// Initializations
//System.out.println("Enter the number of votes for Polly: ");
////votesForPolly = scan.nextInt();
//System.out.println("Enter the number of votes for Ernest: ");
//votesForErnest = scan.nextInt();
// Loop to "process" the votes in each precinct
do
{
System.out.print("Enter the number of votes for Polly: ");
votesForPolly = scan.nextInt();
totalPolly += votesForPolly ;
System.out.print("Enter the number of votes for Ernest: ");
votesForErnest = scan.nextInt();
totalErnest += votesForErnest;
System.out.print("Any more precinct? (y or n)");
response = scan.next();
}
while (response.equalsIgnoreCase("y"));
System.out.println("Total votes for Polly: " + totalPolly);
System.out.println("Total votes for Ernest: " + totalErnest);
System.out.printf("Total percentage votes for Polly: %.2f%% \n" , ((double) totalPolly / (totalPolly + totalErnest)) * 100);
System.out.printf("Total percentage votes for Ernest: %.2f%% " , ((double) totalErnest / (totalPolly + totalErnest)) * 100);
}
}
| [
"utkuyurter@outlook.com"
] | utkuyurter@outlook.com |
bee142b1c14537d0c1dc320250cd6ae073884b97 | c55bff4d2838d77358d8bba3ad66c8e79b08b2cb | /src/tests/ActionPendingQueueFlow.java | cdafa23d3ff63688bb52a8734f70fc91e2729142 | [] | no_license | clarkmodesitt/DR-monitoring-selenium | 753acc5a7b4f59baf716b8e0c821704bf1de4ef2 | 7f589b176d37be2112423cd7144510d8a1e778c4 | refs/heads/master | 2021-01-10T13:43:07.159338 | 2016-03-29T21:21:07 | 2016-03-29T21:21:07 | 49,220,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53,026 | java | package tests;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.Assert;
import org.testng.AssertJUnit;
import functions.MonitoringPage_Functions;
public class ActionPendingQueueFlow extends MonitoringPage_Functions {
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
public static String sharedUIMapPath;
public static String baseUrl;
@BeforeMethod
public void setUp() throws Exception {
prop = new Properties();
prop.load(new FileInputStream("./Configuration/Monitoring_Config.properties"));
//driver = new FirefoxDriver();
System.setProperty("webdriver.chrome.driver", "chromedriver");
driver = new ChromeDriver();
sharedUIMapPath = prop.getProperty("SharedUIMap");
prop.load(new FileInputStream(sharedUIMapPath));
baseUrl = prop.getProperty("ClusterUrl");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@Test
public void testActionPendingQueueFlow() throws Exception {
// Log in - using Synthesys_Login method
driver.get(baseUrl);
driver.manage().window().maximize();
Synthesys_Login(driver, prop.getProperty("Username"), prop.getProperty("Password"));
//Wait for page to load
WebDriverWait wait = new WebDriverWait(driver, 10);
//wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Lbl_Synthesys_KnowledgeGraphToQuery"))));
Thread.sleep(500);
// Go to monitoring and wait for page to load selected KG - using AQ_SelectKGForTesting method
driver.findElement(By.linkText(prop.getProperty("Lnk_Synthesys_MonitoringTab"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_Monitoring_KGDropdownButton"))));
//Change back to More1mKG
//AQ_SelectKGForTesting(driver, prop.getProperty("More1mKG"));
AQ_SelectKGForTesting(driver, prop.getProperty("EnronKG"));
//Analyst Queue - Setting message statuses
// Select first message and store the message subject, date, and source ID
driver.findElement(By.xpath(prop.getProperty("Btn_AnalystQueue_ClickFirstMessage"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_AnalystQueue_MsgViewRedTakeActionButton"))));
Thread.sleep(2000);
String followUpMessageSubject = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSubjectLabel"))).getText();
System.out.println("Follow-up message 1 Subject: "+ followUpMessageSubject);
String followUpMessageDate = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewDateLabel"))).getText();
System.out.println("Follow-up message 1 Date: " + followUpMessageDate);
String followUpMessageSourceId = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSourceId"))).getText();
System.out.println("Follow-up message 1 Source ID: " + followUpMessageSourceId);
//Set status to follow-up and click green Take Action button - using AQ_TakeActionFollowUp method
AQ_TakeActionFollowUp(driver);
//Check that message has been moved from the Analyst Queue
String followUpMessageSourceId2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSourceId"))).getText();
if(followUpMessageSourceId2.equals(followUpMessageSourceId)) {
String newFollowUpMessageSourceId2 = AQ_WaitForNewSourceId(driver, followUpMessageSourceId, followUpMessageSourceId2);
followUpMessageSourceId2 = newFollowUpMessageSourceId2;
}
//Mark next message as Follow-up - using AQ_TakeActionFollowUp method
String followUpMessageSubject2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSubjectLabel"))).getText();
System.out.println("Follow-up message 2 Subject: "+ followUpMessageSubject2);
String followUpMessageDate2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewDateLabel"))).getText();
System.out.println("Follow-up message 2 Date: " + followUpMessageDate2);
System.out.println("Follow-up message 2 Source ID: " + followUpMessageSourceId2);
AQ_TakeActionFollowUp(driver);
//Check that message has been moved from the Analyst Queue
String escalateMessageSourceId = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSourceId"))).getText();
if(escalateMessageSourceId.equals(followUpMessageSourceId2)) {
String newEscalateMessageSourceId = AQ_WaitForNewSourceId(driver, followUpMessageSourceId2, escalateMessageSourceId);
escalateMessageSourceId = newEscalateMessageSourceId;
}
String escalateMessageSubject = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSubjectLabel"))).getText();
System.out.println("Escalate message 1 Subject: " + escalateMessageSubject);
String escalateMessageDate = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewDateLabel"))).getText();
System.out.println("Escalate message 1 Date: " + escalateMessageDate);
System.out.println("Escalate message 1 Source ID: " + escalateMessageSourceId);
//Set status to escalate and click green Take Action button - using AQ_TakeActionEscalate method
AQ_TakeActionEscalate(driver);
//Check that message has been moved from the Analyst Queue
String escalateMessageSourceId2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSourceId"))).getText();
if(escalateMessageSourceId2.equals(escalateMessageSourceId)) {
String newEscalateMessageSourceId2 = AQ_WaitForNewSourceId(driver, escalateMessageSourceId, escalateMessageSourceId2);
escalateMessageSourceId2 = newEscalateMessageSourceId2;
}
String escalateMessageSubject2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSubjectLabel"))).getText();
System.out.println("Escalate message 2 Subject: " + escalateMessageSubject2);
String escalateMessageDate2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewDateLabel"))).getText();
System.out.println("Escalate message 2 Date: " + escalateMessageDate2);
System.out.println("Escalate message 2 Source ID: " + escalateMessageSourceId2);
//Set status to escalate and click green Take Action button - using AQ_TakeActionEscalate method
AQ_TakeActionEscalate(driver);
//Check that message has been moved from the Analyst Queue
String breachMessageSourceId = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSourceId"))).getText();
if(breachMessageSourceId.equals(escalateMessageSourceId)) {
String newBreachMessageSourceId = AQ_WaitForNewSourceId(driver, escalateMessageSourceId2, breachMessageSourceId);
breachMessageSourceId = newBreachMessageSourceId;
}
String breachMessageSubject = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSubjectLabel"))).getText();
System.out.println("Breach message 1 Subject: " + breachMessageSubject);
String breachMessageDate = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewDateLabel"))).getText();
System.out.println("Breach message 1 Date: " + breachMessageDate);
System.out.println("Breach message 1 Source ID: " + breachMessageSourceId);
//Set status to breach and click green Take Action button - using AQ_TakeActionBreach method
AQ_TakeActionBreach(driver);
//Check that message has been moved from the Analyst Queue
String breachMessageSourceId2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSourceId"))).getText();
if(breachMessageSourceId2.equals(breachMessageSourceId)) {
String newBreachMessageSourceId2 = AQ_WaitForNewSourceId(driver, breachMessageSourceId, breachMessageSourceId2);
breachMessageSourceId2 = newBreachMessageSourceId2;
}
String breachMessageSubject2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSubjectLabel"))).getText();
System.out.println("Breach message 2 Subject: " + breachMessageSubject2);
String breachMessageDate2 = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewDateLabel"))).getText();
System.out.println("Breach message 2 Date: " + breachMessageDate2);
System.out.println("Breach message 2 Source ID: " + breachMessageSourceId2);
//Set status to breach and click green Take Action button - using AQ_TakeActionBreach method
AQ_TakeActionBreach(driver);
//Check that message has been moved from the Analyst Queue
String testMessageSourceId = driver.findElement(By.cssSelector(prop.getProperty("Lbl_AnalystQueue_MsgViewSourceId"))).getText();
if(testMessageSourceId.equals(breachMessageSourceId)) {
String newTestMessageSourceId = AQ_WaitForNewSourceId(driver, breachMessageSourceId, testMessageSourceId);
testMessageSourceId = newTestMessageSourceId;
}
//Go to the Action Pending Queue tab
driver.findElement(By.linkText(prop.getProperty("Lnk_Monitoring_ActionPendingQueueTab"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
Thread.sleep(2000);
//Find the first message that was labeled "breach" and verify the message details
driver.findElement(By.xpath(".//*[@id='status-0']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + breachMessageSubject + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), breachMessageSubject, "Message subjects do not match for breachMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "breach", "Message status does not match for breachMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for breachMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), breachMessageDate, "Message Date does not match for breachMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for breachMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for breachMessage");
// Mark the message as reviewed
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_ReviewedButton0"))).click();
System.out.println("breachMessage marked as Reviewed");
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
Thread.sleep(2000);
//Check the count, click Refresh and verify that the count has gone down
String strOriginalCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
int originalCount = Integer.parseInt(strOriginalCount);
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
String strUpdatedCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
int updatedCount = Integer.parseInt(strUpdatedCount);
System.out.println("Original Count: " + originalCount);
if(updatedCount != originalCount - 1) {
int newUpdatedCount = APQ_WaitForRefresh(driver, originalCount, updatedCount);
updatedCount = newUpdatedCount;
}
System.out.println("Updated Count: " + updatedCount);
Thread.sleep(2000);
//Find the second message that was labeled "breach" and verify the message details
driver.findElement(By.xpath(".//*[@id='status-0']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + breachMessageSubject2 + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), breachMessageSubject2, "Message subjects do not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "breach", "Message status does not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), breachMessageDate2, "Message Date does not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for breachMessage2");
//Mark the message as Reviewed through the Take Action flow - using APQ_TakeActionReviewed method
APQ_TakeActionReviewed(driver);
System.out.println("breachMessage2 marked as Reviewed");
//Check the count, click Refresh and verify that the count has gone down
strOriginalCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
originalCount = Integer.parseInt(strOriginalCount);
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
strUpdatedCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
updatedCount = Integer.parseInt(strUpdatedCount);
System.out.println("Original Count: " + originalCount);
if(updatedCount != originalCount - 1) {
int newUpdatedCount = APQ_WaitForRefresh(driver, originalCount, updatedCount);
updatedCount = newUpdatedCount;
}
System.out.println("Updated Count: " + updatedCount);
//Go to the Search tab
driver.findElement(By.linkText(prop.getProperty("Lnk_Monitoring_SearchTab"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_Search_ClearAllFiltersButton"))));
Thread.sleep(2000);
//Add Quotes to breachMessageSubject so that it can be used to search
String breachMessageSubject_Search = "\"" + breachMessageSubject + "\"";
//Shorten message timestamp to date for search
String breachMessageDate_Search = breachMessageDate.substring(0, 10);
//Search for message by subject, status (Reviewed), and Date - using SearchMessage method
String searchReviewedXpath = "Lst_Search_StatusListReviewed";
SearchMessage(driver, breachMessageSubject_Search, breachMessageDate_Search, searchReviewedXpath);
//Set list to sort by Sent - Newest First
new Select(driver.findElement(By.xpath(prop.getProperty("Btn_Search_SortListDropdown")))).selectByVisibleText("Sent - Newest First");
driver.findElement(By.xpath(prop.getProperty("Lst_Search_SortListNewestFirst"))).click();
Thread.sleep(2000);
//Click on the message to verify the details
driver.findElement(By.xpath(".//*[@id='applicationHost']/div/div[1]/div/div/div[2]/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + breachMessageSubject + "\"]/td[1]")).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_AnalystQueue_MsgViewRedTakeActionButton"))));
Thread.sleep(2000);
//Verify that message details (subject, status, date) match the message
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewSubject"))).getText(), breachMessageSubject, "Message subjects do not match for breachMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewStatus"))).getText(), "reviewed", "Message status does not match for breachMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewResolved"))).getText(), "true", "Message status does not match for breachMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewDate"))).getText(), breachMessageDate, "Message Date does not match for breachMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for breachMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for breachMessage");
//Add Quotes to breachMessageSubject so that it can be used to search
String breachMessageSubject2_Search = "\"" + breachMessageSubject2 + "\"";
//Shorten message timestamp to date for search
String breachMessageDate2_Search = breachMessageDate2.substring(0, 10);
//Click Show Filters
driver.findElement(By.xpath(prop.getProperty("Btn_Search_ShowFiltersButton"))).click();
Thread.sleep(2000);
//Search for message by subject, status (Reviewed), and Date - using SearchMessage method
SearchMessage(driver, breachMessageSubject2_Search, breachMessageDate2_Search, searchReviewedXpath);
//Click on the message to verify the details
driver.findElement(By.xpath(".//*[@id='applicationHost']/div/div[1]/div/div/div[2]/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + breachMessageSubject2 + "\"]/td[1]")).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_AnalystQueue_MsgViewRedTakeActionButton"))));
Thread.sleep(2000);
//Verify that message details (subject, status, date) match the message
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewSubject"))).getText(), breachMessageSubject2, "Message subjects do not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewStatus"))).getText(), "reviewed", "Message status does not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewResolved"))).getText(), "true", "Message status does not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewDate"))).getText(), breachMessageDate2, "Message Date does not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for breachMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for breachMessage2");
//Go to the Action Pending Queue tab
driver.findElement(By.linkText(prop.getProperty("Lnk_Monitoring_ActionPendingQueueTab"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
Thread.sleep(2000);
//Go to the escalate tab, click on the first message, verify the message details, and mark it as Spam (also check if anything is in the breach column - changes the xpath query if so)
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnEscalate"))).click();
Thread.sleep(1000);
String firstButtonText = driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnFirstButton"))).getText();
if(firstButtonText.equals("breach")) {
driver.findElement(By.xpath(".//*[@id='status-1']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + escalateMessageSubject + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), escalateMessageSubject, "Message subjects do not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "escalate", "Message status does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), escalateMessageDate, "Message Date does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for escalateMessage");
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_SpamButton1"))).click();
}
else {
driver.findElement(By.xpath(".//*[@id='status-0']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + escalateMessageSubject + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), escalateMessageSubject, "Message subjects do not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "escalate", "Message status does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), escalateMessageDate, "Message Date does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for escalateMessage");
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_SpamButton0"))).click();
}
System.out.println("escalateMessage marked as Spam");
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
Thread.sleep(2000);
//Check the count, click Refresh and verify that the count has gone down
strOriginalCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
originalCount = Integer.parseInt(strOriginalCount);
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
strUpdatedCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
updatedCount = Integer.parseInt(strUpdatedCount);
System.out.println("Original Count: " + originalCount);
if(updatedCount != originalCount - 1) {
int newUpdatedCount = APQ_WaitForRefresh(driver, originalCount, updatedCount);
updatedCount = newUpdatedCount;
}
System.out.println("Updated Count: " + updatedCount);
Thread.sleep(2000);
//Go to the escalate tab, click on the second message and mark it as Spam through the take action workflow (also check if anything is in the breach column - changes the xpath query if so) - uses APQ_TakeActionSpam method
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnEscalate"))).click();
Thread.sleep(1000);
firstButtonText = driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnFirstButton"))).getText();
if(firstButtonText.equals("breach")) {
driver.findElement(By.xpath(".//*[@id='status-1']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + escalateMessageSubject2 + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), escalateMessageSubject2, "Message subjects do not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "escalate", "Message status does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), escalateMessageDate2, "Message Date does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for escalateMessage2");
APQ_TakeActionSpam(driver,1);
}
else {
driver.findElement(By.xpath(".//*[@id='status-0']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + escalateMessageSubject2 + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), escalateMessageSubject2, "Message subjects do not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "escalate", "Message status does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), escalateMessageDate2, "Message Date does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for escalateMessage2");
APQ_TakeActionSpam(driver,0);
}
System.out.println("escalateMessage2 marked as Spam");
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
Thread.sleep(2000);
//Check the count, click Refresh and verify that the count has gone down
strOriginalCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
originalCount = Integer.parseInt(strOriginalCount);
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
strUpdatedCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
updatedCount = Integer.parseInt(strUpdatedCount);
System.out.println("Original Count: " + originalCount);
if(updatedCount != originalCount - 1) {
int newUpdatedCount = APQ_WaitForRefresh(driver, originalCount, updatedCount);
updatedCount = newUpdatedCount;
}
System.out.println("Updated Count: " + updatedCount);
//Go to the Search tab
driver.findElement(By.linkText(prop.getProperty("Lnk_Monitoring_SearchTab"))).click();
Thread.sleep(2000);
driver.findElement(By.xpath(prop.getProperty("Btn_Search_ShowFiltersButton"))).click();
Thread.sleep(2000);
//Add Quotes to escalateMessageSubject so that it can be used to search
String escalateMessageSubject_Search = "\"" + escalateMessageSubject + "\"";
//Shorten message timestamp to date for search
String escalateMessageDate_Search = escalateMessageDate.substring(0, 10);
//Search for message by subject, status (Spam), and Date
String searchSpamXpath = "Lst_Search_StatusListSpam";
SearchMessage(driver, escalateMessageSubject_Search, escalateMessageDate_Search, searchSpamXpath);
//Set list to sort by Sent - Newest First
new Select(driver.findElement(By.xpath(prop.getProperty("Btn_Search_SortListDropdown")))).selectByVisibleText("Sent - Newest First");
driver.findElement(By.xpath(prop.getProperty("Lst_Search_SortListNewestFirst"))).click();
Thread.sleep(2000);
//Click on the message to verify the details
driver.findElement(By.xpath(".//*[@id='applicationHost']/div/div[1]/div/div/div[2]/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + escalateMessageSubject + "\"]/td[1]")).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_AnalystQueue_MsgViewRedTakeActionButton"))));
Thread.sleep(2000);
//Verify that message details (subject, status, date) match the message
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewSubject"))).getText(), escalateMessageSubject, "Message subjects do not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewStatus"))).getText(), "spam", "Message status does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewResolved"))).getText(), "true", "Message status does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewDate"))).getText(), escalateMessageDate, "Message Date does not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for escalateMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for escalateMessage");
//Add Quotes to escalateMessageSubject2 so that it can be used to search
String escalateMessageSubject2_Search = "\"" + escalateMessageSubject2 + "\"";
//Shorten message timestamp to date for search
String escalateMessageDate2_Search = escalateMessageDate2.substring(0, 10);
//Click Show Filters
driver.findElement(By.xpath(prop.getProperty("Btn_Search_ShowFiltersButton"))).click();
Thread.sleep(2000);
//Search for message by subject, status (Spam), and Date
SearchMessage(driver, escalateMessageSubject2_Search, escalateMessageDate2_Search, searchSpamXpath);
//Set list to sort by Sent - Newest First
new Select(driver.findElement(By.xpath(prop.getProperty("Btn_Search_SortListDropdown")))).selectByVisibleText("Sent - Newest First");
driver.findElement(By.xpath(prop.getProperty("Lst_Search_SortListNewestFirst"))).click();
Thread.sleep(2000);
//Click on the message to verify the details
driver.findElement(By.xpath(".//*[@id='applicationHost']/div/div[1]/div/div/div[2]/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + escalateMessageSubject2 + "\"]/td[1]")).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_AnalystQueue_MsgViewRedTakeActionButton"))));
Thread.sleep(2000);
//Verify that message details (subject, status, date) match the message
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewSubject"))).getText(), escalateMessageSubject2, "Message subjects do not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewStatus"))).getText(), "spam", "Message status does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewResolved"))).getText(), "true", "Message status does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewDate"))).getText(), escalateMessageDate2, "Message Date does not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for escalateMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for escalateMessage2");
//Go to the Action Pending Queue tab
driver.findElement(By.linkText(prop.getProperty("Lnk_Monitoring_ActionPendingQueueTab"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
Thread.sleep(2000);
//Go to the follow-up tab, click on the first message, verify the message details, and mark it as News (also check if anything is in the breach or escalate column - changes the xpath query if so)
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnFollowUp"))).click();
Thread.sleep(1000);
firstButtonText = driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnFirstButton"))).getText();
if (driver.findElements(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnSecondButton"))).size() != 0) {
String secondButtonText = driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnSecondButton"))).getText();
if(firstButtonText.equals("breach") && secondButtonText.equals("escalate")) {
driver.findElement(By.xpath(".//*[@id='status-2']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + followUpMessageSubject + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), followUpMessageSubject, "Message subjects do not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "follow-up", "Message status does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), followUpMessageDate, "Message Date does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for followUpMessage");
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_NewsButton2"))).click();
}
}
else if (firstButtonText.equals("breach") || firstButtonText.equals("escalate")){
driver.findElement(By.xpath(".//*[@id='status-1']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + followUpMessageSubject + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), followUpMessageSubject, "Message subjects do not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "follow-up", "Message status does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), followUpMessageDate, "Message Date does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for followUpMessage");
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_NewsButton1"))).click();
}
else {
driver.findElement(By.xpath(".//*[@id='status-0']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + followUpMessageSubject + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), followUpMessageSubject, "Message subjects do not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "follow-up", "Message status does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), followUpMessageDate, "Message Date does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for followUpMessage");
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_NewsButton0"))).click();
}
System.out.println("followUpMessage marked as News");
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
Thread.sleep(2000);
//Check the count, click Refresh and verify that the count has gone down
strOriginalCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
originalCount = Integer.parseInt(strOriginalCount);
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
strUpdatedCount = driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_TotalCount"))).getText();
updatedCount = Integer.parseInt(strUpdatedCount);
System.out.println("Original Count: " + originalCount);
if(updatedCount != originalCount - 1) {
int newUpdatedCount = APQ_WaitForRefresh(driver, originalCount, updatedCount);
updatedCount = newUpdatedCount;
}
System.out.println("Updated Count: " + updatedCount);
Thread.sleep(2000);
//Go to the follow-up tab, click on the second message, verify the message details, and mark it as News through Take Action (also check if anything is in the breach or escalate column - changes the xpath query if so) - using APQ_TakeActionNews method
driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnFollowUp"))).click();
Thread.sleep(1000);
firstButtonText = driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnFirstButton"))).getText();
if (driver.findElements(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnSecondButton"))).size() != 0) {
String secondButtonText = driver.findElement(By.xpath(prop.getProperty("Btn_ActionPendingQueue_StatusColumnSecondButton"))).getText();
if(firstButtonText.equals("breach") && secondButtonText.equals("escalate")) {
driver.findElement(By.xpath(".//*[@id='status-2']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + followUpMessageSubject2 + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), followUpMessageSubject2, "Message subjects do not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "follow-up", "Message status does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), followUpMessageDate2, "Message Date does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for followUpMessage2");
APQ_TakeActionNews(driver,2);
}
}
else if (firstButtonText.equals("breach") || firstButtonText.equals("escalate")){
driver.findElement(By.xpath(".//*[@id='status-1']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + followUpMessageSubject2 + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), followUpMessageSubject2, "Message subjects do not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "follow-up", "Message status does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), followUpMessageDate2, "Message Date does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for followUpMessage2");
APQ_TakeActionNews(driver,1);
}
else {
driver.findElement(By.xpath(".//*[@id='status-0']/div/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + followUpMessageSubject2 + "\"]/td[1]")).click();
Thread.sleep(5000);
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewSubject"))).getText(), followUpMessageSubject2, "Message subjects do not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewStatus"))).getText(), "follow-up", "Message status does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewResolved"))).getText(), "false", "Message status does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_ActionPendingQueue_MsgViewDate"))).getText(), followUpMessageDate2, "Message Date does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_ActionPendingQueue_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for followUpMessage2");
APQ_TakeActionNews(driver,0);
}
System.out.println("followUpMessage2 marked as News");
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_ActionPendingQueue_RefreshButton"))));
Thread.sleep(2000);
//Go to the Search tab
driver.findElement(By.linkText(prop.getProperty("Lnk_Monitoring_SearchTab"))).click();
Thread.sleep(2000);
driver.findElement(By.xpath(prop.getProperty("Btn_Search_ShowFiltersButton"))).click();
Thread.sleep(2000);
//Add Quotes to followUpMessageSubject so that it can be used to search
String followUpMessageSubject_Search = "\"" + followUpMessageSubject + "\"";
//Shorten message timestamp to date for search
String followUpMessageDate_Search = followUpMessageDate.substring(0, 10);
//Search for message by subject, status (News), and Date
String searchNewsXpath = "Lst_Search_StatusListNews";
SearchMessage(driver, followUpMessageSubject_Search, followUpMessageDate_Search, searchNewsXpath);
//Set list to sort by Sent - Newest First
new Select(driver.findElement(By.xpath(prop.getProperty("Btn_Search_SortListDropdown")))).selectByVisibleText("Sent - Newest First");
driver.findElement(By.xpath(prop.getProperty("Lst_Search_SortListNewestFirst"))).click();
Thread.sleep(2000);
//Click on the message to verify the details
driver.findElement(By.xpath(".//*[@id='applicationHost']/div/div[1]/div/div/div[2]/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + followUpMessageSubject + "\"]/td[1]")).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_AnalystQueue_MsgViewRedTakeActionButton"))));
Thread.sleep(2000);
//Verify that message details (subject, status, date) match the message
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewSubject"))).getText(), followUpMessageSubject, "Message subjects do not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewStatus"))).getText(), "news", "Message status does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewResolved"))).getText(), "true", "Message status does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewDate"))).getText(), followUpMessageDate, "Message Date does not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for followUpMessage");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for followUpMessage");
//Add Quotes to followUpMessageSubject so that it can be used to search
String followUpMessageSubject2_Search = "\"" + followUpMessageSubject2 + "\"";
//Shorten message timestamp to date for search
String followUpMessageDate2_Search = followUpMessageDate2 .substring(0, 10);
//Click Show Filters
driver.findElement(By.xpath(prop.getProperty("Btn_Search_ShowFiltersButton"))).click();
Thread.sleep(2000);
//Search for message by subject, status (News), and Date
SearchMessage(driver, followUpMessageSubject2_Search, followUpMessageDate2_Search, searchNewsXpath);
//Set list to sort by Sent - Newest First
new Select(driver.findElement(By.xpath(prop.getProperty("Btn_Search_SortListDropdown")))).selectByVisibleText("Sent - Newest First");
driver.findElement(By.xpath(prop.getProperty("Lst_Search_SortListNewestFirst"))).click();
Thread.sleep(2000);
//Click on the message to verify the details
driver.findElement(By.xpath(".//*[@id='applicationHost']/div/div[1]/div/div/div[2]/div/div[1]/div[2]/table/tbody/tr[td[1]=\"" + followUpMessageSubject2 + "\"]/td[1]")).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(prop.getProperty("Btn_AnalystQueue_MsgViewRedTakeActionButton"))));
Thread.sleep(2000);
//Verify that message details (subject, status, date) match the message
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewSubject"))).getText(), followUpMessageSubject2, "Message subjects do not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewStatus"))).getText(), "news", "Message status does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewResolved"))).getText(), "true", "Message status does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.cssSelector(prop.getProperty("Lbl_Search_MsgViewDate"))).getText(), followUpMessageDate2, "Message Date does not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewOwner"))).getText(), "Analyst User", "Message Owners do not match for followUpMessage2");
Assert.assertEquals(driver.findElement(By.xpath(prop.getProperty("Lbl_Search_MsgViewAssignee"))).getText(), "Analyst User", "Message Assignees do not match for followUpMessage2");
//End of test
System.out.println("Test PASSED!");
}
@AfterMethod
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
AssertJUnit.fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
| [
"clarkmodesitt@gmail.com"
] | clarkmodesitt@gmail.com |
1710e2db640b49b3b6057cb7d6e1db759de5c68d | 36698a8464c18cfe4476b954eed4c9f3911b5e2c | /ZimbraIM/src/java/org/jivesoftware/util/PropertyEventListener.java | d0eeb51c70c992df83ae33afd77c8ddb3b21ffe5 | [] | no_license | mcsony/Zimbra-1 | 392ef27bcbd0e0962dce99ceae3f20d7a1e9d1c7 | 4bf3dc250c68a38e38286bdd972c8d5469d40e34 | refs/heads/master | 2021-12-02T06:45:15.852374 | 2011-06-13T13:10:57 | 2011-06-13T13:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,919 | java | /*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2006, 2007, 2009, 2010 Zimbra, Inc.
*
* The contents of this file are subject to the Zimbra Public License
* Version 1.3 ("License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.zimbra.com/license.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
* ***** END LICENSE BLOCK *****
*/
package org.jivesoftware.util;
import java.util.Map;
/**
* Interface to listen for property events. Use the
* {@link org.jivesoftware.util.PropertyEventDispatcher#addListener(PropertyEventListener)}
* method to register for events.
*
* @author Matt Tucker
*/
public interface PropertyEventListener {
/**
* A property was set. The parameter map <tt>params</tt> will contain the
* the value of the property under the key <tt>value</tt>.
*
* @param property the name of the property.
* @param params event parameters.
*/
public void propertySet(String property, Map params);
/**
* A property was deleted.
*
* @param property the name of the property deleted.
* @param params event parameters.
*/
public void propertyDeleted(String property, Map params);
/**
* An XML property was set. The parameter map <tt>params</tt> will contain the
* the value of the property under the key <tt>value</tt>.
*
* @param property the name of the property.
* @param params event parameters.
*/
public void xmlPropertySet(String property, Map params);
/**
* An XML property was deleted.
*
* @param property the name of the property.
* @param params event parameters.
*/
public void xmlPropertyDeleted(String property, Map params);
} | [
"dstites@autobase.net"
] | dstites@autobase.net |
c362c9f1092d9c6a1fe068e96446937796571dc2 | f0f35d31c1271cca63952173592cb70421db3367 | /backend/src/main/java/com/devsuperior/dscatalog/services/validation/UserInsertValidator.java | 422a6364a44d00f115fe3b30be1be1503c71ac0e | [] | no_license | rivaelRodriguesJr/dscatalog-bootcamp-devsuperior | 003e2e733ea41bac5656a2311d338da90191b8f0 | 1a96aab9a3193655acbc5fb4ac7c34d1eff6a3b4 | refs/heads/main | 2023-04-01T20:24:49.850193 | 2021-04-12T22:02:18 | 2021-04-12T22:02:18 | 300,725,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,241 | java | package com.devsuperior.dscatalog.services.validation;
import java.util.ArrayList;
import java.util.List;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.springframework.beans.factory.annotation.Autowired;
import com.devsuperior.dscatalog.dto.UserInsertDTO;
import com.devsuperior.dscatalog.entities.User;
import com.devsuperior.dscatalog.repositories.UserRepository;
import com.devsuperior.dscatalog.resources.exceptions.FieldMessage;
public class UserInsertValidator implements ConstraintValidator<UserInsertValid, UserInsertDTO> {
@Autowired
private UserRepository repository;
@Override
public void initialize(UserInsertValid ann) {
}
@Override
public boolean isValid(UserInsertDTO dto, ConstraintValidatorContext context) {
List<FieldMessage> list = new ArrayList<>();
User user = repository.findByEmail(dto.getEmail());
if (user != null) {
list.add(new FieldMessage("email", "Email já existe"));
}
for (FieldMessage e : list) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(e.getMessage()).addPropertyNode(e.getFieldName())
.addConstraintViolation();
}
return list.isEmpty();
}
} | [
"rivael.rodriguesjr@outlook.com"
] | rivael.rodriguesjr@outlook.com |
a76675b6c68057c7a2cceacfed151b301e6ea7f1 | aa31afe39836359e2f0e1ebc682ffc05113e41cb | /app/src/main/java/com/example/carteiradeclientes/ActCadCliente.java | 47492f46ca744b0c686f71bbe7d925f4dc90ddc9 | [] | no_license | edsongomes1/Android_crud_application | 9fdfd09152e1fd24b9ca53f51125fa88701c4b00 | 475e3aa9ff865d6406ade23e0d594209a906fe59 | refs/heads/master | 2023-01-05T09:12:54.297817 | 2020-11-09T21:12:14 | 2020-11-09T21:12:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,612 | java | package com.example.carteiradeclientes;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.text.TextUtils;
import android.util.Patterns;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.example.carteiradeclientes.database.DadosOpenHelper;
import com.example.carteiradeclientes.dominio.entidades.Cliente;
import com.example.carteiradeclientes.dominio.repositorio.ClienteRepositorio;
import com.google.android.material.snackbar.Snackbar;
import java.util.regex.Pattern;
public class ActCadCliente extends AppCompatActivity {
private EditText edtNome;
private EditText edtEndereco;
private EditText edtEmail;
private EditText edtTelefone;
private ConstraintLayout layoutContentActCadCliente;
private ClienteRepositorio clienteRepositorio ;
private SQLiteDatabase conexao;
private DadosOpenHelper dadosOpenHelper;
private Cliente cliente;
//private FloatingActionButton fab;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_cad_cliente);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
edtNome = (EditText) findViewById(R.id.edtNome);
edtEndereco = (EditText) findViewById(R.id.edtEndereco);
edtEmail = (EditText) findViewById(R.id.edtEmail);
edtTelefone = (EditText) findViewById(R.id.edtTelefone);
layoutContentActCadCliente = (ConstraintLayout) findViewById(R.id.layoutContentActCadCliente);
criarConexao();
verificaParametro();
/*
fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
*/
}
private void verificaParametro() {
Bundle bundle = getIntent().getExtras();
cliente = new Cliente();
if(bundle != null && bundle.containsKey("CLIENTE")) {
cliente = (Cliente) bundle.getSerializable("CLIENTE");
edtNome.setText(cliente.nome);
edtEndereco.setText(cliente.endereco);
edtEmail.setText(cliente.email);
edtTelefone.setText(cliente.telefone);
}
}
private void criarConexao() {
try {
dadosOpenHelper = new DadosOpenHelper(this);
conexao = dadosOpenHelper.getWritableDatabase();
Snackbar.make(layoutContentActCadCliente, R.string.message_conexao_criada_com_sucesso, Snackbar.LENGTH_LONG)
.setAction(R.string.action_ok,null).show();
clienteRepositorio = new ClienteRepositorio(conexao);
}
catch (SQLException ex) {
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setTitle(R.string.title_erro);
dlg.setMessage(ex.getMessage());
dlg.setNeutralButton(R.string.action_ok, null);
dlg.show();
}
}
private void confirmar(){
if(!validaCampos()) {
try {
if(cliente.codigo == 0) {
clienteRepositorio.inserir(cliente);
}
else {
clienteRepositorio.alterar(cliente);
}
finish();
}catch (SQLException ex) {
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setTitle(R.string.title_erro);
dlg.setMessage(ex.getMessage());
dlg.setNeutralButton(R.string.action_ok, null);
dlg.show();
}
}
}
private boolean validaCampos() {
boolean res = false ;
String nome = edtNome.getText().toString();
String endereco = edtEndereco.getText().toString();
String email = edtEmail.getText().toString();
String telefone = edtTelefone.getText().toString();
cliente.nome = nome;
cliente.endereco =endereco;
cliente.email = email;
cliente.telefone = telefone;
if(res = isCampoVazio(nome)) {
edtNome.requestFocus();
}
else if (res = isCampoVazio(endereco)) {
edtEndereco.requestFocus();
}
else if(res = !isEmailValido(email)) {
edtEmail.requestFocus();
}
else if(res = isCampoVazio(telefone)) {
edtTelefone.requestFocus();
}
if(res) {
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setTitle(R.string.title_aviso);
dlg.setMessage(R.string.message_campos_invalidos_brancos);
dlg.setNeutralButton(R.string.action_ok, null );
dlg.show();
}
return res;
}
private boolean isCampoVazio(String valor) {
boolean resultado = TextUtils.isEmpty(valor) || valor.trim().isEmpty() ;
return resultado;
}
private boolean isEmailValido(String email) {
boolean resultado = (!isCampoVazio(email) && Patterns.EMAIL_ADDRESS.matcher(email).matches());
return resultado;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_act_cad_cliente, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
switch (id){
case android.R.id.home:
finish();
break;
case R.id.action_ok:
confirmar();
//Toast.makeText(this,"Botão Ok Selecionado", Toast.LENGTH_SHORT).show();
break;
case R.id.action_excluir:
clienteRepositorio.excluir(cliente.codigo);
finish();
break;
}
return super.onOptionsItemSelected(item);
}
} | [
"edson.gomes@pitang.com"
] | edson.gomes@pitang.com |
eb3de26db4ab7d19f5a5d511107893dd031f4a62 | ba1f8d00ac9f7ce247f737f4192c2c7cf2a790b7 | /src/main/java/com/whichcontact/rest/CrunchBase_organizations/Paging.java | b0eacda7e0835b3f11e802cc13537b1cbf00e823 | [] | no_license | TSCI6/WC | 75e44851b3bee51601f7d2a273dc807998e09419 | aa326d7ef458f4a80ec96d7353a02f78ede96f98 | refs/heads/master | 2021-01-21T10:41:52.171591 | 2017-06-22T13:11:08 | 2017-06-22T13:11:08 | 101,981,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,625 | java | package com.whichcontact.rest.CrunchBase_organizations;
public class Paging
{
private int total_items;
private int number_of_pages;
private int current_page;
private String sort_order;
private int items_per_page;
private String next_page_url;
private String prev_page_url;
public void setTotal_items(int total_items){
this.total_items = total_items;
}
public int getTotal_items(){
return this.total_items;
}
public void setNumber_of_pages(int number_of_pages){
this.number_of_pages = number_of_pages;
}
public int getNumber_of_pages(){
return this.number_of_pages;
}
public void setCurrent_page(int current_page){
this.current_page = current_page;
}
public int getCurrent_page(){
return this.current_page;
}
public void setSort_order(String sort_order){
this.sort_order = sort_order;
}
public String getSort_order(){
return this.sort_order;
}
public void setItems_per_page(int items_per_page){
this.items_per_page = items_per_page;
}
public int getItems_per_page(){
return this.items_per_page;
}
public void setNext_page_url(String next_page_url){
this.next_page_url = next_page_url;
}
public String getNext_page_url(){
return this.next_page_url;
}
public void setPrev_page_url(String prev_page_url){
this.prev_page_url = prev_page_url;
}
public String getPrev_page_url(){
return this.prev_page_url;
}
}
| [
"TS001127@FONNOIDSK72.IND.FONANTRIX.COM"
] | TS001127@FONNOIDSK72.IND.FONANTRIX.COM |
5f83c112f100160707e9cdd6764ab3baf90f52c6 | 69b09d11cd1dd3b5ca6cba942f18eb5494e9b168 | /JANN/JavaANN/src/org/jann/Train/TrainingDataSet.java | 0d1b11a02abdacf6f050448c196edd2ea3a1615a | [] | no_license | FranckChaillat/Java-Artificial-Neural-Net | 35e19894419c97d4210acd65952f4b3c4726b4bc | d56c899053a5c3af3318cd92300b3c0c479bb97b | refs/heads/master | 2021-01-10T19:19:22.854936 | 2015-08-19T13:14:45 | 2015-08-19T13:14:45 | 41,034,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 248 | java | package org.jann.Train;
import java.util.ArrayList;
public class TrainingDataSet {
public ArrayList<DataExample> dataset;
public int errorCount;
public TrainingDataSet(){
errorCount = 1;
dataset = new ArrayList<DataExample>();
}
}
| [
"franck.chaillat@viacesi.fr"
] | franck.chaillat@viacesi.fr |
20363f614a8236cba84ae0c5e9b797911d4c9eb6 | 5b413860483cf5da545424eb81b8e3dac19f625e | /app/src/main/java/com/hariharan/connectme/Notifications.java | abcf4bdef02945132b7b605cef616c3715d16bf1 | [] | no_license | haran2248/ConnectMe | 5b4ab1f6620dfe460e431a2c6ee63ecc9d67e5e0 | 5559a9d6a39bd0c4af740c11e9c31f7f3b180ecd | refs/heads/master | 2023-02-12T10:59:34.805871 | 2021-01-10T13:23:40 | 2021-01-10T13:23:40 | 263,776,714 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,108 | java | package com.hariharan.connectme;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
public class Notifications extends AppCompatActivity {
DatabaseReference friends,userRef;
String currentID;
String receiver_key;
RecyclerView notif_RV;
ArrayList<NotificationModel> notificationModelArrayList;
NotificationsRVAdapter adapter;
int c;
TextView zero,move;
@Override
protected void onCreate(Bundle savedInstanceState) {
c=0;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notifications);
GoogleSignInAccount googleSignInAccount= GoogleSignIn.getLastSignedInAccount(this);
currentID=googleSignInAccount.getId();
Log.i("currentID",currentID);
zero=findViewById(R.id.zeroNotifs);
move=findViewById(R.id.accept_notifs);
zero.setVisibility(View.GONE);
move.setVisibility(View.GONE);
notif_RV=findViewById(R.id.notification_rv);
userRef=FirebaseDatabase.getInstance().getReference().child("users");
friends= FirebaseDatabase.getInstance().getReference().child("friend_requests");
notif_RV.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
friends.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if(dataSnapshot.child(currentID).exists())
{
c=1;
friends.child(currentID)
.orderByChild("request_type")
.equalTo("received")
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot1) {
for (DataSnapshot childSnapshot : dataSnapshot1.getChildren()) {
receiver_key= childSnapshot.getKey();
Log.i("Receiver key",receiver_key);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
userRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
notificationModelArrayList=new ArrayList<NotificationModel>();
for(DataSnapshot shot:dataSnapshot.getChildren())
{
if(shot.child("information").child("Info").child("IDno").getValue().equals(receiver_key))
{
Log.i("notifications",shot.child("NotificationModel").getValue(NotificationModel.class).getName());
notificationModelArrayList.add(shot.child("NotificationModel").getValue(NotificationModel.class));
c=1;
}
}
adapter=new NotificationsRVAdapter(notificationModelArrayList,getApplicationContext());
notif_RV.setAdapter(adapter);
adapter.notifyDataSetChanged();
Toast.makeText(Notifications.this,"Success",Toast.LENGTH_LONG).show();
if(c==0)
{
zero.setVisibility(View.VISIBLE);
}
else {
move.setVisibility(View.VISIBLE);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
else
{
c=0;
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| [
"haran2248@gmail.com"
] | haran2248@gmail.com |
c96d23c98f8cf6ac766500834f06264aae9d0325 | 4101ca418093ee8963d36ffaf2a9aa199d37e90e | /algs/sort/Selection.java | 5c8c8c53346d5071f9055e224dcfac0c1873fd74 | [] | no_license | pablo-mayrgundter/freality | b4c5aa9f0db61ea254ca61d1a7f2d3f33e307b4b | 2799b63b4b36a06ec4cdf010c4d5555f254e4617 | refs/heads/master | 2023-06-08T21:43:53.687910 | 2023-06-06T23:26:44 | 2023-06-06T23:26:44 | 41,884,992 | 4 | 3 | null | 2016-05-25T16:06:41 | 2015-09-03T21:35:46 | JavaScript | UTF-8 | Java | false | false | 620 | java | package algs.sort;
/**
* @author Pablo Mayrgundter
* @see <a href="http://en.wikipedia.org/wiki/Selection_sort">http://en.wikipedia.org/wiki/Selection_sort</a>
*/
final class Selection {
public static void sort(final int [] vals) {
sort(vals, 0, vals.length);
}
public static void sort(final int [] vals, final int from, final int to) {
if (to - from <= 1)
return;
for (int i = from; i < to - 1; i++) {
int min = i;
for (int j = i + 1; j < to; j++) {
if (vals[j] < vals[min])
min = j;
}
if (i != min)
algs.Util.swap(vals, min, i);
}
}
} | [
"pablo.mayrgundter@b8c78ab8-d18f-11de-aacf-132551bdafba"
] | pablo.mayrgundter@b8c78ab8-d18f-11de-aacf-132551bdafba |
2ea1479207d25c7eb5c26aa03c63dd8a32843191 | d18ab8a5c50d73c2c5cf2bde04d66f1f1e301ce1 | /src/main/java/kino/model/repositories/ResetTokenRepository.java | 5bd0956ce90e43f7d76328017dc6ed7a58364202 | [] | no_license | Ilvana/cinema | 1b5e7d47bbbb07511e320c925d9b977029092083 | 3f94ae4eb35c729a2e35c6cd32af48edf533d2bf | refs/heads/master | 2021-06-01T04:55:53.321872 | 2016-05-31T22:42:37 | 2016-05-31T22:42:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package kino.model.repositories;
import kino.model.entities.ResetToken;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ResetTokenRepository extends JpaRepository<ResetToken, Integer> {
List<ResetToken> findByToken(String token);
}
| [
"mmujic1@etf.unsa.ba"
] | mmujic1@etf.unsa.ba |
b995acd1e24166dc138a8768d59f91daf96d330b | ba9e79988d6335c66a0d39e419cdd1ded62ff70b | /src/main/java/myzd/utils/RetrofitUtils.java | 0b3b8d904357a50a8765bd1746a2ce62639bc088 | [
"MIT"
] | permissive | zhangkesheng/lib-edge | 469d376717efee1be075a0aacaa840ad9426e488 | 4274457f4c3217454b91f0c07a3a641953a3daef | refs/heads/master | 2021-07-16T04:55:10.123694 | 2017-10-24T05:51:29 | 2017-10-24T05:51:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,102 | java | package myzd.utils;
import lombok.extern.slf4j.Slf4j;
import myzd.domain.exceptions.GenericException;
import myzd.domain.request.ResultWrapper;
import retrofit2.Response;
/**
* Created by zks on 2017/9/5.
* RetrofitUtils
*/
@Slf4j
public class RetrofitUtils {
private final static Integer RESPONSE_OK_CODE = 1000000;
public static <T> T getResponseBody(Response<ResultWrapper<T>> response) throws GenericException {
ResultWrapper<T> resultWrapper = response.body();
if (response.isSuccessful() && resultWrapper != null) {
if (resultWrapper.getCode() == RESPONSE_OK_CODE) {
return resultWrapper.getData();
}
log.error("Services has some errors. resultWrapper: {}", resultWrapper);
throw new GenericException(String.valueOf(resultWrapper.getCode()), resultWrapper.getMessage());
}
log.error("Request is not success. code: {}, message: {}, response: {}", response.code(), response.message(), response);
throw new GenericException("1910001", String.format("请求出错, %s - %s", String.valueOf(response.code()), response.message()));
}
}
| [
"clark.zhang@mingyizhudao.com"
] | clark.zhang@mingyizhudao.com |
11957c24d542ca8d8ac1e4cfbb043bca11f97130 | b9c69f56af052ef0ac74947a361cf7570d9553a0 | /leetcode/src/combination_sum_39/Solution.java | 8690bbbb7b4f242e9a895c165d0bdc3e97fe2542 | [] | no_license | yishing/leetcode | 95135f8618ce1cdb5f56bb93e645c07b25059bda | 3bfd7bc13044f46d097a9f92ae3d9ed33f848cba | refs/heads/master | 2021-01-22T10:36:39.411612 | 2017-02-15T05:10:39 | 2017-02-15T05:10:39 | 82,020,941 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package combination_sum_39;
import java.util.ArrayList;
import java.util.List;
public class Solution {
public List<List<Integer>> combinationSum(int[] candidates, int target) {
List<List<Integer>> ans=new ArrayList<List<Integer>>();
if(candidates==null||candidates.length==0) return ans;
List<Integer> list=new ArrayList<Integer>();
backtrack(ans,0,candidates,target,list);
return ans;
}
public void backtrack(List<List<Integer>> ans,int index,int[] candidates,int target,List<Integer> list){
if(index>=candidates.length) return ;
if(target<0) return ;
if(target==0) {
ans.add(new ArrayList<Integer>(list));
return ;
}
list.add(candidates[index]);
backtrack(ans,index,candidates,target-candidates[index],list);
list.remove(list.size()-1);
backtrack(ans,index+1,candidates,target,list);
}
} | [
"yi-shing@wustl.edu"
] | yi-shing@wustl.edu |
59ab6a3815f870208852ae8b6216d52a97111e88 | 8d15aa8e2daf2a7a7adde495067ae9d37c50a0a3 | /src/main/java/com/test/model/dto/BooleanResponseDTO.java | a08cac52718e0f4045f190f4bcff1965de07be60 | [] | no_license | KevinTangYi/friendmanagement | ae96e1b41c40542df7eec31cd5c44be5825e340b | 48f76997ff485963a8570d38aea09aee1432e9b1 | refs/heads/master | 2020-03-18T15:57:04.111848 | 2018-05-27T11:46:01 | 2018-05-27T11:46:01 | 134,939,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.test.model.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@ApiModel(value="BooleanResponseDTO", description="Boolean Data Response Object")
public class BooleanResponseDTO {
private Boolean success;
}
| [
"YI.TANG@mastercard.com"
] | YI.TANG@mastercard.com |
74460974b7c67fbed08d5feaca864accd9bdcef8 | f291c73a4e39786d6db88467cc5a0fb7d388b98b | /src/main/java/com/tocgroup/tradeshow/controller/NotificationController.java | 638a9bf8cb7216a3870bc0b0ed1b609f3d0131df | [
"Apache-2.0"
] | permissive | velmuruganvelayutham/trade-show | 2537c3f7bfbaa32702fe85ab97e3951d127e78be | e2bed0e2dd5c840f695dafc6fc3a9511439b37cd | refs/heads/master | 2022-12-20T20:15:40.959394 | 2014-11-13T14:15:38 | 2014-11-13T14:15:38 | 24,140,145 | 0 | 0 | Apache-2.0 | 2022-12-16T02:37:46 | 2014-09-17T10:27:38 | JavaScript | UTF-8 | Java | false | false | 912 | java | package com.tocgroup.tradeshow.controller;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Handles requests for the application home page.
*/
@Controller
public class NotificationController {
private static final Logger logger = LoggerFactory
.getLogger(NotificationController.class);
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/notifications", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
model.addAttribute("message", "Notifications are coming soon !.");
return "notifications.";
}
}
| [
"mailtovelmuruga@gmail.com"
] | mailtovelmuruga@gmail.com |
22eb34809af15fa182d83ab3564f120da2b44a86 | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/未反混淆/src/main/java/com/tencent/mm/plugin/appbrand/jsapi/media/JsApiChooseImage.java | b08fac8ea97ff7fb8a0f1339b35066035be236d7 | [] | no_license | xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072197 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,726 | java | package com.tencent.mm.plugin.appbrand.jsapi.media;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory.Options;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.R;
import com.tencent.mm.compatible.util.Exif;
import com.tencent.mm.compatible.util.e;
import com.tencent.mm.graphics.MMBitmapFactory;
import com.tencent.mm.plugin.appbrand.appstorage.AppBrandLocalMediaObject;
import com.tencent.mm.plugin.appbrand.appstorage.AppBrandLocalMediaObjectManager;
import com.tencent.mm.plugin.appbrand.g;
import com.tencent.mm.plugin.appbrand.g.b;
import com.tencent.mm.plugin.appbrand.ipc.AppBrandProxyUIProcessTask;
import com.tencent.mm.plugin.appbrand.ipc.AppBrandProxyUIProcessTask.ProcessRequest;
import com.tencent.mm.plugin.appbrand.ipc.AppBrandProxyUIProcessTask.ProcessResult;
import com.tencent.mm.plugin.appbrand.r.m;
import com.tencent.mm.plugin.appbrand.s.c;
import com.tencent.mm.plugin.mmsight.segment.FFmpegMetadataRetriever;
import com.tencent.mm.pluginsdk.ui.tools.n;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.al;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.sdk.platformtools.d;
import com.tencent.mm.ui.base.h;
import com.tencent.mm.ui.base.p;
import com.tencent.mm.ui.base.t;
import com.tencent.ttpic.baseutils.FileUtils;
import com.tencent.wxmm.v2helper;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONObject;
public final class JsApiChooseImage extends com.tencent.mm.plugin.appbrand.jsapi.a {
public static final int CTRL_INDEX = 29;
public static final String NAME = "chooseImage";
static final class ChooseRequest extends ProcessRequest {
public static final Creator<ChooseRequest> CREATOR = new Creator<ChooseRequest>() {
public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
return new ChooseRequest[i];
}
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
AppMethodBeat.i(131126);
ChooseRequest chooseRequest = new ChooseRequest(parcel);
AppMethodBeat.o(131126);
return chooseRequest;
}
};
String appId;
int count;
boolean hOS;
boolean hOT;
boolean hOU;
boolean hOV;
public final Class<? extends AppBrandProxyUIProcessTask> aCa() {
return a.class;
}
public final void k(Parcel parcel) {
boolean z;
boolean z2 = true;
AppMethodBeat.i(131127);
this.appId = parcel.readString();
this.count = parcel.readInt();
if (parcel.readByte() != (byte) 0) {
z = true;
} else {
z = false;
}
this.hOS = z;
if (parcel.readByte() != (byte) 0) {
z = true;
} else {
z = false;
}
this.hOT = z;
if (parcel.readByte() != (byte) 0) {
z = true;
} else {
z = false;
}
this.hOU = z;
if (parcel.readByte() == (byte) 0) {
z2 = false;
}
this.hOV = z2;
AppMethodBeat.o(131127);
}
public final int describeContents() {
return 0;
}
public final void writeToParcel(Parcel parcel, int i) {
byte b;
byte b2 = (byte) 1;
AppMethodBeat.i(131128);
parcel.writeString(this.appId);
parcel.writeInt(this.count);
if (this.hOS) {
b = (byte) 1;
} else {
b = (byte) 0;
}
parcel.writeByte(b);
if (this.hOT) {
b = (byte) 1;
} else {
b = (byte) 0;
}
parcel.writeByte(b);
if (this.hOU) {
b = (byte) 1;
} else {
b = (byte) 0;
}
parcel.writeByte(b);
if (!this.hOV) {
b2 = (byte) 0;
}
parcel.writeByte(b2);
AppMethodBeat.o(131128);
}
public final String aBZ() {
return "GalleryChooseImage";
}
public final boolean aBY() {
return true;
}
ChooseRequest() {
}
ChooseRequest(Parcel parcel) {
AppMethodBeat.i(131129);
k(parcel);
AppMethodBeat.o(131129);
}
static {
AppMethodBeat.i(131130);
AppMethodBeat.o(131130);
}
}
static final class ChooseResult extends ProcessResult {
public static final Creator<ChooseResult> CREATOR = new Creator<ChooseResult>() {
public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
return new ChooseResult[i];
}
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
AppMethodBeat.i(131131);
ChooseResult chooseResult = new ChooseResult(parcel);
AppMethodBeat.o(131131);
return chooseResult;
}
};
int bFZ;
ArrayList<AppBrandLocalMediaObject> hOW;
public final void k(Parcel parcel) {
AppMethodBeat.i(131132);
this.bFZ = parcel.readInt();
this.hOW = parcel.createTypedArrayList(AppBrandLocalMediaObject.CREATOR);
AppMethodBeat.o(131132);
}
public final int describeContents() {
return 0;
}
public final void writeToParcel(Parcel parcel, int i) {
AppMethodBeat.i(131133);
parcel.writeInt(this.bFZ);
parcel.writeTypedList(this.hOW);
AppMethodBeat.o(131133);
}
ChooseResult() {
}
ChooseResult(Parcel parcel) {
super(parcel);
}
static {
AppMethodBeat.i(131134);
AppMethodBeat.o(131134);
}
}
static final class a extends AppBrandProxyUIProcessTask {
private p ejZ;
ChooseRequest hOX;
ChooseResult hOY = new ChooseResult();
int hOZ;
private OnCancelListener hPa;
private a() {
AppMethodBeat.i(131139);
AppMethodBeat.o(131139);
}
static /* synthetic */ String Bp(String str) {
AppMethodBeat.i(131147);
String Bo = Bo(str);
AppMethodBeat.o(131147);
return Bo;
}
static /* synthetic */ String Bq(String str) {
AppMethodBeat.i(131148);
String Bn = Bn(str);
AppMethodBeat.o(131148);
return Bn;
}
static /* synthetic */ void a(a aVar, ProcessResult processResult) {
AppMethodBeat.i(131146);
aVar.a(processResult);
AppMethodBeat.o(131146);
}
static /* synthetic */ void b(a aVar, ProcessResult processResult) {
AppMethodBeat.i(131149);
aVar.a(processResult);
AppMethodBeat.o(131149);
}
public final void a(ProcessRequest processRequest) {
int i;
AppMethodBeat.i(131140);
this.hOX = (ChooseRequest) processRequest;
this.hOX.count = Math.max(1, Math.min(9, this.hOX.count));
if ((this.hOX.hOU & this.hOX.hOV) != 0) {
i = 8;
} else {
i = 7;
}
this.hOZ = i;
if (bo.gO(aBQ()) > 200) {
i = 1;
} else {
boolean z = false;
}
if (i == 0) {
t.makeText(aBQ(), ah.getResources().getString(R.string.ha), 1).show();
}
aBQ().ifE = this;
Intent intent = new Intent();
intent.putExtra("key_send_raw_image", !this.hOX.hOU);
intent.putExtra("query_media_type", 1);
if (this.hOX.hOS && this.hOX.hOT) {
n.a(aBQ(), 1, this.hOX.count, this.hOZ, intent);
AppMethodBeat.o(131140);
} else if (this.hOX.hOT) {
intent.putExtra("show_header_view", false);
n.a(aBQ(), 1, this.hOX.count, this.hOZ, intent);
AppMethodBeat.o(131140);
} else if (this.hOX.hOS) {
n.c(aBQ(), e.euR, "microMsg." + System.currentTimeMillis() + FileUtils.PIC_POSTFIX_JPEG, 2);
AppMethodBeat.o(131140);
} else {
ab.e("MicroMsg.JsApiChooseImage", "unknown scene, ignore this request");
this.hOY.bFZ = -2;
a((ProcessResult) this.hOY);
AppMethodBeat.o(131140);
}
}
private void or(int i) {
AppMethodBeat.i(131141);
this.hPa = new OnCancelListener() {
public final void onCancel(DialogInterface dialogInterface) {
AppMethodBeat.i(131135);
a.this.hOY.bFZ = 0;
a.a(a.this, a.this.hOY);
AppMethodBeat.o(131135);
}
};
Context aBQ = aBQ();
ah.getResources().getString(R.string.tz);
this.ejZ = h.b(aBQ, ah.getResources().getString(i), true, this.hPa);
AppMethodBeat.o(131141);
}
private static String Bn(String str) {
AppMethodBeat.i(131142);
int orientationInDegree = Exif.fromFile(str).getOrientationInDegree();
if (orientationInDegree != 0) {
orientationInDegree %= v2helper.VOIP_ENC_HEIGHT_LV1;
try {
Options options = new Options();
Bitmap decodeFile = MMBitmapFactory.decodeFile(str, options);
if (decodeFile == null) {
ab.e("MicroMsg.JsApiChooseImage", "rotate image, get null bmp");
AppMethodBeat.o(131142);
return str;
}
Bitmap b = d.b(decodeFile, (float) orientationInDegree);
String str2 = e.euR + "microMsg.tmp." + System.currentTimeMillis() + (c.e(options) ? FileUtils.PIC_POSTFIX_JPEG : ".png");
try {
d.a(b, 80, c.e(options) ? CompressFormat.JPEG : CompressFormat.PNG, str2, true);
if (c.e(options)) {
b.bY(str, str2);
}
AppMethodBeat.o(131142);
return str2;
} catch (Exception e) {
ab.e("MicroMsg.JsApiChooseImage", "rotate image, exception occurred when saving | %s", e);
com.tencent.mm.a.e.deleteFile(str2);
AppMethodBeat.o(131142);
return str;
}
} catch (OutOfMemoryError e2) {
AppMethodBeat.o(131142);
return str;
} catch (NullPointerException e3) {
AppMethodBeat.o(131142);
return str;
}
}
AppMethodBeat.o(131142);
return str;
}
private static String Bo(String str) {
Bitmap decodeFile;
AppMethodBeat.i(131143);
String str2 = e.euR + "microMsg." + System.currentTimeMillis() + FileUtils.PIC_POSTFIX_JPEG;
try {
decodeFile = MMBitmapFactory.decodeFile(str);
} catch (OutOfMemoryError e) {
ab.e("MicroMsg.JsApiChooseImage", "doCompressImage, decode bmp oom");
try {
decodeFile = d.decodeFile(str, null);
} catch (OutOfMemoryError e2) {
ab.e("MicroMsg.JsApiChooseImage", "doCompressImage, decode bmp oom retry, oom again");
decodeFile = null;
} catch (Exception e3) {
ab.e("MicroMsg.JsApiChooseImage", "doCompressImage, decode bmp oom retry, e ".concat(String.valueOf(e3)));
decodeFile = null;
}
} catch (NullPointerException e4) {
try {
decodeFile = d.decodeFile(str, null);
} catch (Exception e32) {
ab.e("MicroMsg.JsApiChooseImage", "doCompressImage, decode bmp npe retry, e ".concat(String.valueOf(e32)));
decodeFile = null;
}
} catch (Exception e322) {
ab.e("MicroMsg.JsApiChooseImage", "doCompressImage, decode bmp e ".concat(String.valueOf(e322)));
decodeFile = null;
}
if (decodeFile == null) {
ab.e("MicroMsg.JsApiChooseImage", "doCompressImage, decode bmp return null");
AppMethodBeat.o(131143);
return null;
}
decodeFile.recycle();
long anU = bo.anU();
try {
ab.i("MicroMsg.JsApiChooseImage", "doCompressImage, ret = %b, cost = %d, %s (%d) -> %s (%d)", Boolean.valueOf(c.cU(str2, str)), Long.valueOf(bo.anU() - anU), str, Long.valueOf(new File(str).length()), str2, Long.valueOf(new File(str2).length()));
if (c.cU(str2, str)) {
AppMethodBeat.o(131143);
return str2;
}
AppMethodBeat.o(131143);
return str;
} catch (OutOfMemoryError e5) {
ab.e("MicroMsg.JsApiChooseImage", "compressImage, oom");
AppMethodBeat.o(131143);
return str;
}
}
public final void aBX() {
AppMethodBeat.i(131144);
super.aBX();
if (this.ejZ != null) {
this.ejZ.dismiss();
this.ejZ = null;
}
AppMethodBeat.o(131144);
}
/* JADX WARNING: Missing block: B:32:0x00d3, code skipped:
if (r0 == false) goto L_0x00fa;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public final void c(int i, int i2, Intent intent) {
boolean z = true;
AppMethodBeat.i(131145);
if (i2 == 0) {
this.hOY.bFZ = 0;
a((ProcessResult) this.hOY);
AppMethodBeat.o(131145);
return;
}
final String h;
switch (i) {
case 1:
case 3:
if (intent == null) {
this.hOY.bFZ = 0;
a((ProcessResult) this.hOY);
AppMethodBeat.o(131145);
return;
}
boolean z2;
final ArrayList<String> stringArrayListExtra = intent.getStringArrayListExtra("CropImage_OutputPath_List");
final boolean z3 = (((!this.hOX.hOV ? 1 : 0) & this.hOX.hOU) == 0 && ((this.hOX.hOU & this.hOX.hOV) & intent.getBooleanExtra("CropImage_Compress_Img", false)) == 0) ? false : true;
if (intent.getBooleanExtra("isTakePhoto", false) || intent.getBooleanExtra("isPreviewPhoto", false)) {
z2 = true;
} else {
z2 = false;
}
ab.d("MicroMsg.JsApiChooseImage", "onActivityResult, fromCamera = %b, canCompress = %b, canOriginal = %b, CropImageUI.KCompressImg = %b, doCompress = %b", Boolean.valueOf(z2), Boolean.valueOf(this.hOX.hOU), Boolean.valueOf(this.hOX.hOV), Boolean.valueOf(r6), Boolean.valueOf(z3));
if (z3) {
or(R.string.hb);
}
if (!z3) {
boolean z4;
if (!bo.ek(stringArrayListExtra)) {
for (String h2 : stringArrayListExtra) {
if (Exif.fromFile(h2).getOrientationInDegree() != 0) {
z4 = true;
break;
}
}
}
z4 = false;
break;
}
z = false;
if (z) {
or(R.string.k2);
}
m.aNS().aa(new Runnable() {
public final void run() {
AppMethodBeat.i(131137);
final ArrayList arrayList = new ArrayList(stringArrayListExtra.size());
for (String str : stringArrayListExtra) {
String Bp;
boolean z = z2;
if (z3) {
Bp = a.Bp(str);
z |= 1;
} else {
if (z) {
Bp = a.Bq(str);
if (!Bp.equals(str)) {
z |= 1;
}
}
Bp = str;
}
AppBrandLocalMediaObject j = AppBrandLocalMediaObjectManager.j(a.this.hOX.appId, Bp, z);
if (j != null) {
arrayList.add(j);
} else {
ab.e("MicroMsg.JsApiChooseImage", "handle chosen list from gallery, get null obj from path: %s", Bp);
}
}
al.d(new Runnable() {
public final void run() {
AppMethodBeat.i(131136);
a.this.hOY.bFZ = -1;
a.this.hOY.hOW = arrayList;
a.b(a.this, a.this.hOY);
AppMethodBeat.o(131136);
}
});
AppMethodBeat.o(131137);
}
});
AppMethodBeat.o(131145);
return;
case 2:
h2 = n.h(aBQ().getApplicationContext(), intent, e.euR);
if (bo.isNullOrNil(h2)) {
ab.w("MicroMsg.JsApiChooseImage", "take photo, but result is null");
this.hOY.bFZ = -2;
a((ProcessResult) this.hOY);
AppMethodBeat.o(131145);
return;
}
ab.i("MicroMsg.JsApiChooseImage", "take photo, result[%s]", h2);
al.d(new Runnable() {
public final void run() {
AppMethodBeat.i(131138);
Intent intent = new Intent();
intent.putExtra("key_send_raw_image", !a.this.hOX.hOU);
intent.putExtra("max_select_count", a.this.hOX.count);
intent.putExtra("query_source_type", a.this.hOZ);
intent.putExtra("isPreviewPhoto", true);
intent.putExtra("max_select_count", 1);
ArrayList arrayList = new ArrayList(1);
arrayList.add(h2);
intent.putStringArrayListExtra("preview_image_list", arrayList);
intent.putExtra("preview_image", true);
intent.addFlags(67108864);
a.a(a.this, "gallery", ".ui.GalleryEntryUI", intent);
AppMethodBeat.o(131138);
}
});
AppMethodBeat.o(131145);
return;
default:
this.hOY.bFZ = -2;
a((ProcessResult) this.hOY);
AppMethodBeat.o(131145);
return;
}
}
static /* synthetic */ void a(a aVar, String str, String str2, Intent intent) {
AppMethodBeat.i(131150);
aVar.aBQ().ifE = aVar;
com.tencent.mm.bp.d.b(aVar.aBQ(), str, str2, intent, 3);
AppMethodBeat.o(131150);
}
}
public final void a(final com.tencent.mm.plugin.appbrand.jsapi.c cVar, final JSONObject jSONObject, final int i) {
AppMethodBeat.i(131151);
if (com.tencent.mm.plugin.appbrand.n.xa(cVar.getAppId()).gPi) {
cVar.M(i, j("cancel", null));
AppMethodBeat.o(131151);
return;
}
Context context = cVar.getContext();
if (context == null || !(context instanceof Activity)) {
cVar.M(i, j("fail", null));
AppMethodBeat.o(131151);
return;
}
String str;
ChooseRequest chooseRequest = new ChooseRequest();
JSONArray optJSONArray = jSONObject.optJSONArray("sourceType");
String optString = jSONObject.optString("sizeType");
ab.i("MicroMsg.JsApiChooseImage", "doChooseImage sourceType = %s, sizeType = %s, count = %s", optJSONArray, optString, jSONObject.optString("count"));
if (optJSONArray == null || optJSONArray.length() == 0) {
chooseRequest.hOS = true;
chooseRequest.hOT = true;
} else {
chooseRequest.hOS = optJSONArray.toString().contains("camera");
chooseRequest.hOT = optJSONArray.toString().contains(FFmpegMetadataRetriever.METADATA_KEY_ALBUM);
}
if (chooseRequest.hOS) {
boolean z;
com.tencent.mm.plugin.appbrand.permission.n.b(cVar.getAppId(), new android.support.v4.app.a.a() {
public final void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
AppMethodBeat.i(131125);
if (i != 113) {
AppMethodBeat.o(131125);
} else if (iArr == null || iArr.length <= 0 || iArr[0] != 0) {
cVar.M(i, JsApiChooseImage.this.j("fail:system permission denied", null));
AppMethodBeat.o(131125);
} else {
JsApiChooseImage.this.a(cVar, jSONObject, i);
AppMethodBeat.o(131125);
}
}
});
Context context2 = cVar.getContext();
if (context2 == null || !(context2 instanceof Activity)) {
cVar.M(i, j("fail", null));
z = false;
} else {
z = com.tencent.mm.pluginsdk.permission.b.a((Activity) context2, "android.permission.CAMERA", 113, "", "");
if (z) {
com.tencent.mm.plugin.appbrand.permission.n.Dr(cVar.getAppId());
}
}
if (!z) {
AppMethodBeat.o(131151);
return;
}
}
com.tencent.mm.plugin.appbrand.n.xb(cVar.getAppId()).gPi = true;
g.a(cVar.getAppId(), new g.c() {
public final void onResume() {
AppMethodBeat.i(131123);
com.tencent.mm.plugin.appbrand.n.xb(cVar.getAppId()).gPi = false;
g.b(cVar.getAppId(), this);
AppMethodBeat.o(131123);
}
});
if (bo.isNullOrNil(optString)) {
str = "compressed";
} else {
str = optString;
}
chooseRequest.hOU = str.contains("compressed");
chooseRequest.hOV = str.contains("original");
chooseRequest.count = bo.getInt(r4, 9);
chooseRequest.appId = cVar.getAppId();
com.tencent.mm.plugin.appbrand.ipc.a.b(context, chooseRequest, new AppBrandProxyUIProcessTask.b<ChooseResult>() {
public final /* synthetic */ void c(ProcessResult processResult) {
AppMethodBeat.i(131124);
ChooseResult chooseResult = (ChooseResult) processResult;
if (chooseResult != null) {
switch (chooseResult.bFZ) {
case -1:
ArrayList arrayList = chooseResult.hOW;
if (bo.ek(arrayList)) {
ab.e("MicroMsg.JsApiChooseImage", "onActivityResult, result list is null or nil");
break;
}
ArrayList arrayList2 = new ArrayList(arrayList.size());
ArrayList arrayList3 = new ArrayList(arrayList.size());
ArrayList arrayList4 = new ArrayList(arrayList.size());
Iterator it = arrayList.iterator();
while (it.hasNext()) {
AppBrandLocalMediaObject appBrandLocalMediaObject = (AppBrandLocalMediaObject) it.next();
if (!(appBrandLocalMediaObject == null || bo.isNullOrNil(appBrandLocalMediaObject.czD))) {
arrayList2.add(appBrandLocalMediaObject.czD);
arrayList3.add(Long.valueOf(appBrandLocalMediaObject.gjQ));
arrayList4.add(appBrandLocalMediaObject.fnQ);
}
}
ab.i("MicroMsg.JsApiChooseImage", "onActivityResult, localIds json list string = %s", JsApiChooseImage.l(arrayList2));
HashMap hashMap = new HashMap(1);
hashMap.put("tempFilePaths", JsApiChooseImage.m(arrayList2));
hashMap.put("tempFileSizes", JsApiChooseImage.m(arrayList3));
if (com.tencent.mm.sdk.a.b.dnO()) {
hashMap.put("__realPaths", JsApiChooseImage.m(arrayList4));
}
cVar.M(i, JsApiChooseImage.this.j("ok", hashMap));
AppMethodBeat.o(131124);
return;
case 0:
cVar.M(i, JsApiChooseImage.this.j("cancel", null));
AppMethodBeat.o(131124);
return;
}
}
cVar.M(i, JsApiChooseImage.this.j("fail", null));
AppMethodBeat.o(131124);
}
});
AppMethodBeat.o(131151);
}
static /* synthetic */ String l(ArrayList arrayList) {
AppMethodBeat.i(131152);
if (arrayList.size() == 0) {
ab.e("MicroMsg.JsApiChooseImage", "data is null");
AppMethodBeat.o(131152);
return null;
}
JSONArray jSONArray = new JSONArray();
for (int i = 0; i < arrayList.size(); i++) {
jSONArray.put(arrayList.get(i));
}
String jSONArray2 = jSONArray.toString();
AppMethodBeat.o(131152);
return jSONArray2;
}
static /* synthetic */ JSONArray m(ArrayList arrayList) {
AppMethodBeat.i(131153);
if (arrayList.size() == 0) {
ab.e("MicroMsg.JsApiChooseImage", "data is null");
AppMethodBeat.o(131153);
return null;
}
JSONArray jSONArray = new JSONArray();
for (int i = 0; i < arrayList.size(); i++) {
jSONArray.put(arrayList.get(i));
}
AppMethodBeat.o(131153);
return jSONArray;
}
}
| [
"alwangsisi@163.com"
] | alwangsisi@163.com |
f2897417520eb75a18d5b6f5f4ce141db307ade7 | d24be948a925c438e227b1aa389dc0895939a0a2 | /New Project/src/com/javaproject/demo3.java | 64c2035bf4ad790386e876a9c70d53890d90bd6b | [] | no_license | sudarshankumart/newrepository | 21e3d63d8d34fe7036e5344c36dc362555a5a715 | 7acc7060c5671ce33a7338b87588f2ee34cca454 | refs/heads/master | 2020-09-03T09:32:08.037908 | 2019-11-20T18:26:16 | 2019-11-20T18:26:16 | 219,436,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package com.javaproject;
public class demo3 {
public static void meth(double x)
{
System.out.println("from meth d");
System.out.println(x);
}
public static void meth(int x)
{
System.out.println("from meth integer ");
System.out.println(x);
}
public static void main(String[] args) {
meth('z');
meth(10.0);
meth('a');
meth(5.0f);
meth(2);
}
}
| [
"57182743+sudarshankumart@users.noreply.github.com"
] | 57182743+sudarshankumart@users.noreply.github.com |
e392bd63f5098fd6e8f4eaf38def3546b1b530f9 | 793724ed6a772203d28d1e50e978d944717e5778 | /app/src/main/java/com/renj/applicationtest/model/http/apis/ApiServer.java | 17e5cbecfc321589930248a484a06034d325b749 | [] | no_license | rtk4616/ApplicationTest | dcd9b55e52dc23da08a08394da564365f079749e | 8f3b8f57acd31e2f0c47089d87c59dc49e207fb5 | refs/heads/master | 2020-03-30T13:09:12.682982 | 2018-04-13T02:52:31 | 2018-04-13T02:52:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package com.renj.applicationtest.model.http.apis;
import java.util.Map;
import io.reactivex.Flowable;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;
/**
* ======================================================================
* 作者:Renj
* <p>
* 创建时间:2017-05-11 17:58
* <p>
* 描述:Retrofit框架中定义服务器路径的接口
* <p>
* 修订历史:
* <p>
* ======================================================================
*/
public interface ApiServer {
String BASE_URL = "http://wthrcdn.etouch.cn/";
@GET("{path}")
Flowable<String> getWeather(@Path("path") String text, @QueryMap Map<String, String> queryMap);
}
| [
"atlantisspeed@gmail.com"
] | atlantisspeed@gmail.com |
79b4bb46d4cddfe7961057f07dc5ce6dee3a917a | e951240dae6e67ee10822de767216c5b51761bcb | /src/main/java/concurrent/AtomicIntegerArrayTest.java | 4fd194f5e005af57dfd5904d5c3116edbcb359c4 | [] | no_license | fengjiny/practice | b1315ca8800ba25b5d6fed64b0d68d870d84d1bb | 898e635967f3387dc870c1ee53a95ba8a37d5e37 | refs/heads/master | 2021-06-03T09:20:35.904702 | 2020-10-26T10:45:03 | 2020-10-26T10:45:03 | 131,289,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package concurrent;
import java.util.concurrent.atomic.AtomicIntegerArray;
public class AtomicIntegerArrayTest {
static int[] value = new int[] {2, 3};
static AtomicIntegerArray ai = new AtomicIntegerArray(value);
public static void main(String[] args) {
ai.getAndSet(0, 3);
System.out.println(ai.get(0));
System.out.println(value[0]);
}
}
| [
"fengjinyu@mobike.com"
] | fengjinyu@mobike.com |
cd68767775b40f6890ccaf6e9380f731aabdbd22 | 289daa00c83328bb74e3fd4b263a45c817b02332 | /taotao-sso/src/main/java/com/xiaoyue/sso/dao/impl/JedisClientCluster.java | 9b425c527180ee9dc6e55504c5f3f514f2ebd9ab | [] | no_license | kevinXiao2016/taotao | 8a4a66acdf0a975d0b093ccf4a2186722b2f5ff1 | f728704edebd9050914ba16e304f56a5036b2ba9 | refs/heads/master | 2020-03-27T08:12:05.459178 | 2018-08-29T10:59:10 | 2018-08-29T10:59:10 | 146,230,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,302 | java | package com.xiaoyue.sso.dao.impl;
import org.springframework.beans.factory.annotation.Autowired;
import com.xiaoyue.sso.dao.JedisClient;
import redis.clients.jedis.JedisCluster;
/**
* 集群版客户端
*/
public class JedisClientCluster implements JedisClient {
@Autowired
private JedisCluster jedisCluster;
@Override
public String get(String key) {
return jedisCluster.get(key);
}
@Override
public String set(String key, String value) {
return jedisCluster.set(key, value);
}
@Override
public Long del(String key) {
return jedisCluster.del(key);
}
@Override
public String hget(String hkey, String key) {
return jedisCluster.hget(hkey, key);
}
@Override
public Long hset(String hkey, String key, String value) {
return jedisCluster.hset(hkey, key, value);
}
@Override
public Long hdel(String hkey, String key) {
return jedisCluster.hdel(hkey, key);
}
@Override
public Long incr(String key) {
return jedisCluster.incr(key);
}
@Override
public Long expire(String key, int second) {
return jedisCluster.expire(key, second);
}
@Override
public Long ttl(String key) {
return jedisCluster.ttl(key);
}
}
| [
"xiaoyue@dvt.dvt.com"
] | xiaoyue@dvt.dvt.com |
d6a58f7e4a71c64c80ebb0b24b51c7dc52463498 | 62e334192393326476756dfa89dce9f0f08570d4 | /tk_code/position/position-server/src/main/java/com/huatu/tiku/position/biz/service/SpecialtyService.java | 124b7015ea7bb34308eeb01937b751e84fcdd3db | [] | no_license | JellyB/code_back | 4796d5816ba6ff6f3925fded9d75254536a5ddcf | f5cecf3a9efd6851724a1315813337a0741bd89d | refs/heads/master | 2022-07-16T14:19:39.770569 | 2019-11-22T09:22:12 | 2019-11-22T09:22:12 | 223,366,837 | 1 | 2 | null | 2022-06-30T20:21:38 | 2019-11-22T09:15:50 | Java | UTF-8 | Java | false | false | 444 | java | package com.huatu.tiku.position.biz.service;
import com.huatu.tiku.position.base.service.BaseService;
import com.huatu.tiku.position.biz.domain.Specialty;
import com.huatu.tiku.position.biz.enums.Education;
import java.util.List;
/**
* @author wangjian
**/
public interface SpecialtyService extends BaseService<Specialty,Long> {
/**
* 通过学历查找专业
*/
List<Specialty> findByEducation(Education education);
}
| [
"jelly_b@126.com"
] | jelly_b@126.com |
cf9eef59e8047c23f87f6eeb954db398eb9c27e4 | 8b64eedef238f93914bf3a33dad32cf050d89e6f | /app/src/main/java/com/maxleapmobile/gitmaster/ui/widget/BaseDialog.java | e6885a0f48732126c95aa02ca033abecd98b7e64 | [] | no_license | ajaykoppisetty/MaxLeapGit-Android | 28647eb5c51930f05871f39bbff567a07dd8013a | a3efa6a8fde9c2566a43c4e516c9ec9aa494a2fb | refs/heads/master | 2021-01-13T09:49:31.689570 | 2015-11-09T07:24:49 | 2015-11-09T07:24:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 914 | java | /**
* Copyright (c) 2015-present, MaxLeapMobile.
* All rights reserved.
* ----
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.maxleapmobile.gitmaster.ui.widget;
import android.app.Dialog;
import android.content.Context;
public class BaseDialog extends Dialog {
public BaseDialog(Context context) {
super(context);
}
public BaseDialog(Context context, int theme) {
super(context, theme);
}
public BaseDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
}
@Override
public void dismiss() {
try {
super.dismiss();
} catch (Exception e) {
}
}
}
| [
"sampythoner@gmail.com"
] | sampythoner@gmail.com |
a6599bc1c057d8cdbe2d8c7a82a6e3f598a8d498 | 2ff0b6814d5ed47a489467acf637c7f1b193fe45 | /Airports/app/src/main/java/nl/reupload/guube/airports/MapsActivity.java | 6a6890c49f8e4f1bdbd4a38e884109c2efa6b662 | [] | no_license | maziesmith/MAD_Android_playground | 8e51a3a95f604acd0f186341b59cf7ad9f01fdb4 | d1b6050f2295c93fccee3b75d735b783d6e9ca2f | refs/heads/master | 2020-12-18T09:27:51.934304 | 2015-10-29T15:33:22 | 2015-10-29T15:33:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,769 | java | package nl.reupload.guube.airports;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private String selectedAirportName;
private String schipholAirportName = "Schiphol Airport";
private LatLng selectedAirportLatLng;
private LatLng schipholAirportLatLng = new LatLng(52.3086013794, 4.76388978958);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
Bundle extras = getIntent().getExtras();
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
selectedAirportName = extras.getString("AIRPORTNAME");
selectedAirportLatLng = new LatLng(extras.getDouble("AIRPORTLATITUDE"), extras.getDouble("AIRPORTLONGITUDE"));
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.addMarker(new MarkerOptions().position(selectedAirportLatLng).title(selectedAirportName));
mMap.addMarker(new MarkerOptions().position(schipholAirportLatLng).title(schipholAirportName));
mMap.moveCamera(CameraUpdateFactory.newLatLng(selectedAirportLatLng));
PolylineOptions rectOptions = new PolylineOptions()
.add(selectedAirportLatLng)
.add(schipholAirportLatLng)
.geodesic(true);
Polyline polyline = mMap.addPolyline(rectOptions);
}
}
| [
"guus@reupload.nl"
] | guus@reupload.nl |
88c5dca486c9c7e3da9cdce261b8d489ca49daca | e16d21d893361e2e51eb9a76724e3ff71e4f9f12 | /src/main/java/APFRQs/Unit6Frq2.java | 308e43a90ca4c5d1ff50396517e8597c08ec9ab2 | [] | no_license | PranavKambhampati/CalculatorHubPlayground | 3f75724a01f5f8c08fc261e48a9ace43be8f9597 | f362a57820699a79219319a83449444332394828 | refs/heads/master | 2023-03-26T06:44:09.785518 | 2021-03-09T04:31:40 | 2021-03-09T04:31:40 | 340,542,168 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,128 | java | package APFRQs;
//Final Score: 1/2. Some of the logic in the first part of the problem was incorrect, but correct logic is written in comments. Second part was correct.
import java.util.Arrays;
import java.lang.*;
import java.util.*;
public class Unit6Frq2 {
int itemsSold[] = {5,6,5};
double wages[] = {5,3,5};
public static void main (String[] args){
Unit6Frq2 c = new Unit6Frq2();
c.computeBonusThreshold();
c.computeWages(10.0,1.5);
System.out.println("wages");
} //Everything in driver is correct.
public double computeBonusThreshold(){
int highest = 0;
int lowest = 0;
int sum = 0;
double answer = 0; //all instance variables are initialized correctly.
for(int item: itemsSold){
sum += item;
if(item > highest){
highest = item;
} else if (item < highest){ // faulty logic
lowest = item;//faulty logic
}//faulty logic
/*Faulty logic can be rewritten as:
if(item<min) then min = item and if(item>max then max = item)
*/
//0/1.Incorrect because of the faulty logic, but correct logic is in comment above.
double ans = sum - highest - lowest;
double arraylength = itemsSold.length;
answer = ans/arraylength;
}
return answer;
}
public void computeWages(double fixedWage, double perItemWage){
for(int employee = 0; employee < itemsSold.length; employee++){
if(itemsSold[employee] > computeBonusThreshold()){
double wagey = (fixedWage + (perItemWage * itemsSold[employee])* 1.1);
wages[employee] = wagey;
}
else {
double wagey = (fixedWage + (perItemWage * itemsSold[employee]));
wages[employee] = wagey;
} //1/1. This part of the problem does everything correctly. Everything is calculated correctly. This could have been more efficient if the items sold was compared to the treshold first. CORRECT FROM CLASS ANSWERS.
}
}
}
| [
"pranav.21950@gmail.com"
] | pranav.21950@gmail.com |
070a4e060d2c580ccad9b53901d4525024f0dc9b | 46e19383fb79da57ad8e0e76d76a78eb8b95806d | /src/main/java/com/monpro/cloudmusic/service/IAlbumService.java | bcb6fe9e88d8e4b3f4bec28d221f6c7a1427bb2e | [] | no_license | monpro/mon-cloud-music-api | 3c12e040504a63d9eb20426c3d8b7a84b3d55461 | 3197f22358c454a2ccda8287f5a41147b81d8b85 | refs/heads/main | 2023-03-13T10:01:46.158076 | 2021-02-20T11:59:49 | 2021-02-20T11:59:49 | 339,693,655 | 0 | 0 | null | 2021-02-20T11:59:50 | 2021-02-17T10:57:38 | Java | UTF-8 | Java | false | false | 221 | java | package com.monpro.cloudmusic.service;
import com.monpro.cloudmusic.entity.Album;
import java.util.List;
public interface IAlbumService {
List<Album> getHomePopularAlbums();
List<Album> getNewReleasedAlbums();
}
| [
"monproshen@gmail.com"
] | monproshen@gmail.com |
19d68a9de7a8945c1ed5b6ecde503390979bd3c8 | 31e30cf0795f957c2ff8d6f624432d92fb0e6e2d | /springboot/src/test/java/com/bsworld/springboot/stream/EventInfo.java | aa0aaa7584f3c58e16368db77fea03cd84e16031 | [] | no_license | abxworld/Final | 38b6f54ed2c1c3f05d191347a42a6c799968d2df | 5e8ce864e45b486b7a1a267fed2a4228a44076cd | refs/heads/master | 2022-07-01T20:09:38.917368 | 2020-07-09T07:21:11 | 2020-07-09T07:21:11 | 146,417,862 | 2 | 1 | null | 2022-06-21T00:48:49 | 2018-08-28T08:41:47 | Java | UTF-8 | Java | false | false | 1,140 | java | package com.bsworld.springboot.stream;
import org.joda.time.DateTime;
import java.util.Date;
/**
* program: Final
* author: bsworld.xie
* create: 2018-12-27 15:14
* description:
*/
public class EventInfo {
private Long eventId;
private Date createTime;
private String name;
private Integer location;
public EventInfo(Long eventId, Date createTime, String name, Integer location) {
this.eventId = eventId;
this.createTime = createTime;
this.name = name;
this.location = location;
}
public Long getEventId() {
return eventId;
}
public void setEventId(Long eventId) {
this.eventId = eventId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getLocation() {
return location;
}
public void setLocation(Integer location) {
this.location = location;
}
}
| [
"bsworld.xie@uxin.com"
] | bsworld.xie@uxin.com |
42d6c915d5924a22ef96ea58520b1c3733ae3adf | a084e5a116fbe9fdb4bbcf899ebe1bbef2de6a8a | /Spring/src/main/java/com/kosta/s1107/LoginProcess.java | 76baf40541a2d5c2bc883d4a74a2289c8729977a | [] | no_license | ball4716/kosta130 | cb082cbe6e8a22735789efa8c0f25235661d8b1b | 35253a183b529d76c7e404af7a451baf62ed6fdf | refs/heads/master | 2020-02-26T17:27:12.538435 | 2016-11-08T06:47:07 | 2016-11-08T06:47:07 | 71,738,465 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,318 | java | package com.kosta.s1107;
import java.util.HashMap;
import com.kosta.s1107.UserInfo;
public class LoginProcess {
//DB표현
//login처리(아이디,비밀번호 확인) - login
HashMap<String, UserInfo> userInfo;
HashMap<String, String> userPass;
public LoginProcess() {
userInfo = new HashMap<>();
userPass = new HashMap<>();
//DB데이터
userInfo.put("gildong", new UserInfo("나길동", "010-1234-5678", "gildong@kosta.com"));
userInfo.put("lime", new UserInfo("길라임", "010-3333-4444", "lime@kosta.com"));
userInfo.put("juwon", new UserInfo("김주원", "010-4432-3321", "won@kosta.com"));
userPass.put("gildong", "1111");
userPass.put("lime", "2222");
userPass.put("juwon", "3333");
}
public UserInfo login(String userid, String userpwd) {
System.out.println(userid+", "+userpwd);
String dpass = userPass.get(userid);
System.out.println("패스워드: "+dpass);
if(dpass == null)//아이디가 존재하지 않는다면
return null;
if(!dpass.equals(userpwd))//아이디 존재, 비밀번호 불일치
return null;
//아이디 존재, 비밀번호 일치 했을때 아래의 코드를 실행!!
UserInfo info = userInfo.get(userid);
System.out.println("userid:"+info.getName());
return info;
}
}
| [
"Hyunyoung@DESKTOP-Q7FRSEG"
] | Hyunyoung@DESKTOP-Q7FRSEG |
24055b1d15d48b7de7d7c30d02405a1497671bd1 | 697db402e870e96339326d380d95315394865caa | /src/DataAccess/AdminData.java | 6191e3562c7f09a79093283aec34b5a8fbea030b | [] | no_license | navthedev/Husky-Airlines | 4d934f75b05940611910737dcd4c76e0a5e0e4f6 | 594a37cb00dbeeef8455065a8eb9ab96a4806e3c | refs/heads/master | 2020-05-02T21:46:25.980272 | 2019-03-28T15:26:57 | 2019-03-28T15:26:57 | 178,231,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,154 | java | package DataAccess;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import Application.DataTypes.Admin;
public class AdminData {
//fields
private static ArrayList<Admin> admins;
private static Statement statement;
//get admins
public static ArrayList<Admin> getAdmins(){
admins = new ArrayList<>();
try{
statement = DataConnection.getConnection().createStatement();
ResultSet rs = statement.executeQuery("SELECT* FROM Admin");
if(rs != null)
while (rs.next()) {
Admin admin = new Admin();
admin.setAdmin_id(rs.getString(1));
admin.setFirst_name(rs.getString(2));
admin.setLast_name(rs.getString(3));
admin.setPassword(rs.getString(4));
if ("admin".equalsIgnoreCase(rs.getString(5))) {
admin.setRole(rs.getString(5));
}else {
admin.setRole("customer");
}
admin.setEmail(rs.getString(6));
admins.add(admin);
}
}
catch(Exception e){
e.printStackTrace();
}
return admins;
}
//method to add a admin
public static void insertAdmin(String admin_idT,String fNameT,String lNameT,String password, String email)
{
try{
String url = "INSERT INTO Admin VALUE('"+ admin_idT + "',' "
+ fNameT + "', '" + lNameT + "', '" + password + "','customer',"+"'"+email+"');";
statement.executeUpdate(url);
}
catch(Exception e){
e.printStackTrace();
}
}
//method to update a admin
public static void updateAdmin(String email,String password)
{
try{
String url = "UPDATE Admin SET password= '"+ password+"'"+" WHERE email ='"+ email+"';";
statement.executeUpdate(url);
}
catch(Exception e){
e.printStackTrace();
}
}
}
| [
"navjotbhatti01@gmail.com"
] | navjotbhatti01@gmail.com |
027f12c00722e4366d4fa4ca1f376db7a287eba1 | 76b3578d338ea9bbc230414f601d009726ace021 | /platform-examples/process-monitor-sample/process-monitor-common/src/main/java/com/canoo/dolphin/samples/processmonitor/model/ProcessBean.java | 6996c9d0329513a4b2814e3c582bd19e282b596f | [
"Apache-2.0"
] | permissive | kunsingh/dolphin-platform | 1a32ff8633cf2e990d18e738df572993e8d50d76 | 15e56b5eb31b3594c462e3fe447a0c8ae96af88d | refs/heads/master | 2020-07-16T20:12:22.422460 | 2017-06-14T09:27:02 | 2017-06-14T09:27:02 | 94,314,705 | 0 | 1 | null | 2017-06-14T09:37:55 | 2017-06-14T09:37:55 | null | UTF-8 | Java | false | false | 2,025 | java | /*
* Copyright 2015-2016 Canoo Engineering AG.
*
* 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.canoo.dolphin.samples.processmonitor.model;
import com.canoo.dolphin.mapping.DolphinBean;
import com.canoo.dolphin.mapping.Property;
@DolphinBean
public class ProcessBean {
private Property<String> processID;
private Property<String> name;
private Property<String> cpuPercentage;
private Property<String> memoryPercentage;
public Property<String> processIDProperty() {
return processID;
}
public Property<String> nameProperty() {
return name;
}
public Property<String> cpuPercentageProperty() {
return cpuPercentage;
}
public Property<String> memoryPercentageProperty() {
return memoryPercentage;
}
public void setProcessID(String processID) {
this.processID.set(processID);
}
public void setCpuPercentage(String cpuPercentage) {
this.cpuPercentage.set(cpuPercentage);
}
public void setMemoryPercentage(String memoryPercentage) {
this.memoryPercentage.set(memoryPercentage);
}
public void setName(String name) {
this.name.set(name);
}
public String getProcessID() {
return processID.get();
}
public String getName() {
return name.get();
}
public String getCpuPercentage() {
return cpuPercentage.get();
}
public String getMemoryPercentage() {
return memoryPercentage.get();
}
}
| [
"hendrik.ebbers@web.de"
] | hendrik.ebbers@web.de |
06c02b0c423fbc96c63f98a85d04c2b422b34bc9 | d3e1306275afeb483df49137cf156cebe5cbeb6e | /TEST5/src/Student.java | 435bcc7700a1a18e934cd3e9e3049e0d5a3cb2b0 | [] | no_license | eric3120925/Network-programming | 69935567f4aeb3fbd4c599ea7e8a81c04d2a6d76 | 77c2ed3e18494b372ca3fe00821cc8f4ff0efb7a | refs/heads/master | 2020-09-28T11:52:54.777443 | 2019-12-09T03:03:59 | 2019-12-09T03:03:59 | 226,773,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java |
public class Student {
public String id ;
public String name;
public String score;
public Student(String i , String n ,String s) {
id = i;
name =n;
score =s;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getScore() {
return score;
}
}
| [
"eric3120925@gmail.com"
] | eric3120925@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.