blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b3947ed15280fa21605919863ff837f92d6f1699 | 88cbed379abcf6e415a37131b4ed61a911896235 | /src/main/java/problem/solution/model/BNode.java | 3370aea803beef786751144a659cf0a15b79cb39 | [] | no_license | ADiligentMan/Practice | bc4a494cd359785fd5874cb053d83321d2bf3a15 | 7d6da50bcc0d5ec3b8e2e8398fc061c23baf4512 | refs/heads/master | 2021-08-03T22:04:44.904911 | 2021-07-22T14:38:05 | 2021-07-22T14:38:05 | 157,845,821 | 0 | 0 | null | 2020-10-13T21:50:24 | 2018-11-16T09:41:04 | Java | UTF-8 | Java | false | false | 173 | java | package problem.solution.model;
/**
* @author wangpeng
* @since 2021-01-26
*/
public class BNode {
public int value;
public BNode left;
public BNode right;
} | [
"[email protected]"
] | |
baac9926a9cda9df5dbe784f9ddfda88e108ca89 | 467b202a8aa0a82b373884d4dd106fda8b6c665c | /src/main/java/com/singtel/model/ButterflySolution.java | d5c50453a4f27661736800a553ca86e6a788ec61 | [] | no_license | RajarajeswariSG/Assignment | 30e348321a0e42f441740abf6dc1c151e362cf39 | 5bab0d0e69d4337a15dce6294ba9ec8f55b30459 | refs/heads/master | 2020-12-27T22:35:30.438455 | 2020-02-06T01:58:20 | 2020-02-06T01:58:20 | 237,503,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package com.singtel.model;
public class ButterflySolution {
public static void main(String[] args) {
Butterfly b = new Butterfly();
System.out.println("ButterFly");
b.fly();
CatterPillar c = new CatterPillar();
System.out.println("CatterPillar");
c.walk();
Butterfly butterFlyFromCaterpillar = new Metamorphosis().stage(c);
System.out.println("butterFlyFromCaterpillar");
butterFlyFromCaterpillar.fly();
}
}
| [
"[email protected]"
] | |
10feeef04836834d9ea14951e804a9738279fd5b | 0c7d26ce4f95e5e40cb5dc67b80d6ee00b84c689 | /Assignment 4/Assign_4_Q1.java | 51dcbe205d4e818f80ecab130dff2a46fe0d7ff0 | [] | no_license | NamanDeept/Java-OOM-3rd-semester | 0d90bbb85858c71c58d3dc185169892e65322eb1 | adb71303c3c3da776727c65e68f40bdc9dffcdda | refs/heads/master | 2021-10-10T10:29:55.415604 | 2019-01-09T17:28:44 | 2019-01-09T17:28:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,716 | java | import java.util.Scanner;
import java.util.*;
class ArrayClass{
private Student students[];
private Question questions[];
int countStudents = 0;
int countQuestions = 0;
public ArrayClass(int numberOfStudents,int numberOfQuestions){
students= new Student[numberOfStudents];
questions = new Question[numberOfQuestions];
}
public void BubbleSort(int number){
Student tempStudent = null;
/*a null reference to a temporary student */
for(int i = 0 ; i < number-1 ; i++){
for(int j = 0 ; j < number - i -1; j++){
if(students[j].getStudentRoll().compareTo(students[j+1].getStudentRoll())>0)
{
tempStudent = students[j];
students[j] = students[j+1];
students[j+1] = tempStudent;
}
}
}
}
/*Getter methods */
public Student getStudent(int index){
return students[index];
}
public Question getQuestion(int index){
return questions[index];
}
public void addStudent(Student s){
students[countStudents++] = s;
}
public void addQuestion(Question q){
questions[countQuestions++] = q;
}
}
public class Assign_4_Q2{
public static void main(String args[]){
Scanner data = new Scanner(System.in);
int testCases = data.nextInt();
for(int t = 0 ; t<testCases ; t++){
int numberOfQuestions = data.nextInt();
int numberOfStudents = data.nextInt();
String string = data.nextLine();
ArrayClass ac = new ArrayClass(numberOfStudents,numberOfQuestions);
String specialQuestion ="";
Question ques;
Student s;
for(int i=0 ; i<numberOfQuestions ; i++){
String quesId = data.next();
String quesType = data.next();
String quesText = data.next();
int quesMarks = data.nextInt();
ques = new Question(quesId,quesType,quesText,quesMarks);
ac.addQuestion(ques);
}
int counter = 0;
for(int i=0 ; i<numberOfStudents ; i++){
String roll = data.next();
String name = data.next();
int numberAttempted = data.nextInt();
s = new Student(roll,name,numberAttempted);
ac.addStudent(s);
int q_index = 0;
for(int j = 0 ; j < numberAttempted ;j++){
String quesid = data.next();
String text = data.next();
counter++;
for(int k= 0 ; k < numberOfQuestions; k++){
if(ac.getQuestion(k).getQuestionId().equals(quesid)){
q_index =k;
}
}
if(ac.getQuestion(q_index).getQuestionType().equals("specialized")){
int references = data.nextInt();
for(int k=0;k<references;k++){
String ref = data.next();
}
}
}
}
/*Now getting the actual marks of the student */
for(int i=0;i<counter;i++){
String roll_n = data.next();
String ques_n = data.next();
int mrks = data.nextInt();
int index_student=0;
int index_question = 0;
int cnt = 0;
int index = 0;
for(int j = 0 ; j < numberOfStudents ;j++){
if(ac.getStudent(j).getStudentRoll().equals(roll_n)){
index_student = j;
break;
}
}
for(int k = 0 ; k < numberOfQuestions ;k++){
if(ac.getQuestion(k).getQuestionId().equals(ques_n)){
index_question = k;
break;
}
}
Question qu = ac.getQuestion(index_question);
int marks = qu.getQuestionMarks();
Student std = ac.getStudent(index_student);
if(mrks > marks){
std.addQuestionMarks(marks);
}
else if(mrks < 0)
std.addQuestionMarks(0);
else
std.addQuestionMarks(mrks);
}
ac.BubbleSort(numberOfStudents);
for(int i = 0 ; i < numberOfStudents ; i++){
Student var = ac.getStudent(i);
System.out.printf("%s %s %d\n",var.getStudentRoll(),var.getStudentName(),var.getTotal());
}
}
}
}
class Student{
private String StudentName;
private String StudentRoll;
private ArrayList<Question> questions;
private ArrayList<Integer>QuestionMarks;
public Student(String roll,String name,int numberOfAttempts){
StudentName = name;
StudentRoll = roll;
questions = new ArrayList<Question>();
QuestionMarks = new ArrayList<Integer>();
}
/*getter methods */
public String getStudentName(){
return StudentName;
}
public String getStudentRoll(){
return StudentRoll;
}
public Question getQuestion(int index){
return questions.get(index);
}
/*setter functions */
public void setStudentName(String Name){
StudentName = Name;
}
public void setStudentRoll(String Roll){
StudentRoll = Roll;
}
public void addQuestion(Question ques){
questions.add(ques);
}
public void addQuestionMarks(int marks){
QuestionMarks.add(marks);
}
public int getTotal(){
int total = 0;
for(int questionMarks : QuestionMarks){
total += questionMarks;
}
return total;
}
}
class Question{
private String QuestionId;
private String QuestionType;
private String QuestionText;
private int QuestionMarks;
public Question(String quesId,String QuesType,String QuesText,int marks){
QuestionId = quesId;
QuestionType = QuesType;
QuestionText = QuesText;
QuestionMarks = marks;
}
public Question(String quesId,String QuesText,int marks){
QuestionId = quesId;
QuestionText = QuesText;
QuestionMarks = marks;
}
/*Getter methods */
public String getQuestionId(){
return QuestionId;
}
public String getQuestionType(){
return QuestionType;
}
public String getQuestionText(){
return QuestionText;
}
public int getQuestionMarks(){
return QuestionMarks;
}
/*Setter Methods */
public void setQuestionId(String qID){
QuestionId = qID;
}
public void setQuestionType(String qType){
QuestionType = qType;
}
public void setQuestionText(String text){
QuestionText = text;
}
public void setQuestionMarks(int mrks){
QuestionMarks = mrks;
}
}
| [
"[email protected]"
] | |
f8a92c79459ddd29a5ec4338f135beae2fe352c1 | 67ec60c810cdd63eab37d54056a56f8094026065 | /app/src/com/d2cmall/buyer/activity/RefundReshipActivity.java | 9eb8c5cf17371137160a3ed842339f50a6b80d1f | [] | no_license | sinbara0813/fashion | 2e2ef73dd99c71f2bebe0fc984d449dc67d5c4c5 | 4127db4963b0633cc3ea806851441bc0e08e6345 | refs/heads/master | 2020-08-18T04:43:25.753009 | 2019-10-25T02:28:47 | 2019-10-25T02:28:47 | 215,748,112 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 41,038 | java | package com.d2cmall.buyer.activity;
import android.Manifest;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.bumptech.glide.Glide;
import com.d2cmall.buyer.Constants;
import com.d2cmall.buyer.D2CApplication;
import com.d2cmall.buyer.R;
import com.d2cmall.buyer.adapter.ObjectBindAdapter;
import com.d2cmall.buyer.api.KaoLaSaleAfterListApi;
import com.d2cmall.buyer.api.PostRefundApi;
import com.d2cmall.buyer.api.PostReshipApi;
import com.d2cmall.buyer.base.BaseActivity;
import com.d2cmall.buyer.base.BaseBean;
import com.d2cmall.buyer.bean.GlobalTypeBean;
import com.d2cmall.buyer.bean.JsonPic;
import com.d2cmall.buyer.bean.KaoLaSameWarehouseBean;
import com.d2cmall.buyer.bean.OrdersBean;
import com.d2cmall.buyer.bean.UserBean;
import com.d2cmall.buyer.http.BeanRequest;
import com.d2cmall.buyer.util.CashierInputFilter;
import com.d2cmall.buyer.util.DialogUtil;
import com.d2cmall.buyer.util.ScreenUtil;
import com.d2cmall.buyer.util.Session;
import com.d2cmall.buyer.util.TitleUtil;
import com.d2cmall.buyer.util.UniversalImageLoader;
import com.d2cmall.buyer.util.Util;
import com.d2cmall.buyer.widget.CheckableLinearLayoutButton;
import com.d2cmall.buyer.widget.CheckableLinearLayoutGroup;
import com.d2cmall.buyer.widget.ClearEditText;
import com.d2cmall.buyer.widget.SelectReasonPop;
import com.d2cmall.buyer.widget.SingleSelectPop;
import com.d2cmall.buyer.widget.TransparentPop;
import com.qiyukf.unicorn.api.ConsultSource;
import com.qiyukf.unicorn.api.Unicorn;
import com.upyun.library.common.Params;
import com.upyun.library.common.UploadManager;
import com.upyun.library.listener.SignatureListener;
import com.upyun.library.listener.UpCompleteListener;
import com.upyun.library.utils.UpYunUtils;
import com.zhihu.matisse.Matisse;
import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.engine.impl.GlideEngine;
import com.zhihu.matisse.internal.entity.CaptureStrategy;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import de.greenrobot.event.EventBus;
/**
* Created by rookie on 2017/9/9.
* 申请退款以及退货退换页面
*/
public class RefundReshipActivity extends BaseActivity implements
AdapterView.OnItemClickListener, ObjectBindAdapter.ViewBinder<JsonPic>, SingleSelectPop.CallBack {
@Bind(R.id.back_iv)
ImageView backIv;
@Bind(R.id.name_tv)
TextView nameTv;
@Bind(R.id.title_right)
TextView titleRight;
@Bind(R.id.tag)
View tag;
@Bind(R.id.title_layout)
RelativeLayout titleLayout;
@Bind(R.id.img_product)
ImageView imgProduct;
@Bind(R.id.tv_product_title)
TextView tvProductTitle;
@Bind(R.id.tv_product_style)
TextView tvProductStyle;
@Bind(R.id.tv_product_num)
TextView tvProductNum;
@Bind(R.id.tv_product_status)
TextView tvProductStatus;
@Bind(R.id.iv_received)
ImageView ivReceived;
@Bind(R.id.received_layout)
CheckableLinearLayoutButton receivedLayout;
@Bind(R.id.iv_unreceived)
ImageView ivUnreceived;
@Bind(R.id.unreceived_layout)
CheckableLinearLayoutButton unreceivedLayout;
@Bind(R.id.status_menu)
CheckableLinearLayoutGroup statusMenu;
@Bind(R.id.status_layout)
LinearLayout statusLayout;
@Bind(R.id.status_line_view)
View statusLineView;
@Bind(R.id.tv_reason_label)
TextView tvReasonLabel;
@Bind(R.id.tv_reason)
TextView tvReason;
@Bind(R.id.reason_layout)
LinearLayout reasonLayout;
@Bind(R.id.tv_num_product)
TextView tvNumProduct;
@Bind(R.id.et_count)
ClearEditText etCount;
@Bind(R.id.rl_num_product)
RelativeLayout rlNumProduct;
@Bind(R.id.tv_money_product)
TextView tvMoneyProduct;
@Bind(R.id.et_money)
ClearEditText etMoney;
@Bind(R.id.et_remark)
ClearEditText etRemark;
@Bind(R.id.gridView)
GridView gridView;
@Bind(R.id.btn_apply)
Button btnApply;
@Bind(R.id.ll_items_container)
LinearLayout llItemsContainer;
@Bind(R.id.line_layout)
View lineLayout;
@Bind(R.id.progressBar)
ProgressBar progressBar;
@Bind(R.id.rb_all)
RadioButton rbAll;
@Bind(R.id.rb_freight)
RadioButton rbFreight;
@Bind(R.id.rb_gap_price)
RadioButton rbGapPrice;
@Bind(R.id.radio_group)
RadioGroup radioGroup;
@Bind(R.id.tv_back_desc)
TextView tvBackDesc;
@Bind(R.id.tv_back_reason)
TextView tvBackReason;
@Bind(R.id.scroll_view)
ScrollView scrollView;
private ArrayList<JsonPic> photos;
private ArrayList<JsonPic> jsonPics;
private ObjectBindAdapter<JsonPic> adapter;
private JsonPic emptyPic;
private int imageSize;
private SingleSelectPop singleSelectPop;
private Dialog loadingDialog;
private String reason = "";
private int type;//type=0 申请退货退款; type=1 申请退款
private int intentFlag;//intentFlag=0 列表进入的;intentFlag=1 详情进入的
private String orderSn;
private long orderId;
private long orderItemId;
private String skuSn;
private long quantity;
private String paymentType;
private double actualAmount;
private int upLoadIndex;
private ArrayList<String> imgUpyunPaths;
private String alipayAccount;
private String alipayName;
private String money;
private String remark;
private String reminded;
private boolean isReceived = true;
private SelectReasonPop selectPromotionPop;
private int maxSelected = 3;
private OrdersBean.DataEntity.OrdersEntity.ListEntity.ItemsEntity bean;
private String allItemAmount = null;//考拉订单同仓所有商品的金额,逗号分隔
private String allItemId = null;//考拉订单同仓所有商品的id,逗号分隔
private double otherAmount = 0;//考拉订单同仓其它商品的金额
private int statusCode; //订单状态用来退款的(已发货且未完成)radioButton显示的
private ArrayList<RadioButton> rbs;
private int allRefund = 1; //1:全额退款,-1:退差价,-2:退运费
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_refund_reship);
ButterKnife.bind(this);
type = getIntent().getIntExtra("type", 0);
intentFlag = getIntent().getIntExtra("intentFlag", 0);
orderSn = getIntent().getStringExtra("orderSn");
orderId = getIntent().getLongExtra("orderId", -1);
orderItemId = getIntent().getLongExtra("orderItemId", -1);
skuSn = getIntent().getStringExtra("skuSn");
quantity = getIntent().getIntExtra("quantity", -1);
paymentType = getIntent().getStringExtra("paymentType");
actualAmount = getIntent().getDoubleExtra("actualAmount", 0);
reminded = getIntent().getStringExtra("reminded");
statusCode = getIntent().getIntExtra("statusCode", -1);
bean = (OrdersBean.DataEntity.OrdersEntity.ListEntity.ItemsEntity) getIntent().getSerializableExtra("bean");
initProductView();
initRefundList();
initReshipList();
initTypeInfo();
photos = new ArrayList<>();
jsonPics = new ArrayList<>();
emptyPic = new JsonPic();
DisplayMetrics dm = getResources().getDisplayMetrics();
imageSize = Math.round(50 * dm.density);
int gridViewWidth = Math.round(10 * 2 * dm.density + 50 * 3 * dm.density);
gridView.getLayoutParams().width = gridViewWidth;
tvReason.addTextChangedListener(textWatcher);
etMoney.addTextChangedListener(textWatcher);
InputFilter[] filters = {new CashierInputFilter()};
etMoney.setFilters(filters);
loadingDialog = DialogUtil.createLoadingDialog(this);
photos.add(emptyPic);
adapter = new ObjectBindAdapter<>(this, photos, R.layout.list_item_post_image, this);
gridView.setAdapter(adapter);
gridView.setOnItemClickListener(this);
imgUpyunPaths = new ArrayList<>();
titleRight.setBackgroundResource(R.mipmap.tab_all_service);
}
private void initProductView() {
UniversalImageLoader.displayImage(this, Util.getD2cProductPicUrl(
bean.getProductImg(), ScreenUtil.dip2px(48), ScreenUtil.dip2px(72)), imgProduct,
R.mipmap.ic_logo_empty5, R.mipmap.ic_logo_empty5);
tvProductTitle.setText(bean.getProductName());
tvProductStatus.setText(bean.getItemStatus());
tvProductStyle.setText(getString(R.string.label_kongge, bean.getColor(), bean.getSize()));
tvProductStatus.setText(getString(R.string.label_final_price, Util.getNumberFormat(actualAmount)));
tvProductNum.setText(getString(R.string.label_product_quantity, bean.getQuantity()));
if (bean != null && "KAOLA".equals(bean.getProductSource())) {
loadKaoLaRelate();
}
}
//拉取考拉商品的同仓商品
private void loadKaoLaRelate() {
progressBar.setVisibility(View.VISIBLE);
KaoLaSaleAfterListApi kaoLaSaleAfterListApi = new KaoLaSaleAfterListApi();
kaoLaSaleAfterListApi.setOrderItemId(bean.getId());
D2CApplication.httpClient.loadingRequest(kaoLaSaleAfterListApi, new BeanRequest.SuccessListener<KaoLaSameWarehouseBean>() {
@Override
public void onResponse(KaoLaSameWarehouseBean kaoLaSameWarehouseBean) {
if (isFinishing() || progressBar == null) {
return;
}
progressBar.setVisibility(View.GONE);
//考拉商品将相关商品(同仓商品,展示出来)
if (kaoLaSameWarehouseBean.getData().getItems().size() > 1) {
addRelateProduct(kaoLaSameWarehouseBean);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressBar.setVisibility(View.GONE);
Util.showToast(RefundReshipActivity.this, Util.checkErrorType(error));
}
});
}
private void addRelateProduct(KaoLaSameWarehouseBean kaoLaSameWarehouseBean) {
llItemsContainer.setVisibility(View.VISIBLE);
lineLayout.setVisibility(View.VISIBLE);
List<KaoLaSameWarehouseBean.DataBean.ItemsBean> items = kaoLaSameWarehouseBean.getData().getItems();
StringBuilder idBuilder = new StringBuilder();
StringBuilder priceBuilder = new StringBuilder();
for (int i = 0; i < items.size(); i++) {
//拼接考拉同仓商品所有id和金额
// if(i==0){
// priceBuilder.append(items.get(i).getActualAmount());
// }else{
// priceBuilder.append(","+items.get(i).getActualAmount());
// }
// if(i==0){
// idBuilder.append(items.get(i).getId());
// }else{
// idBuilder.append(","+items.get(i).getId());
// }
if (items.get(i).getId() == bean.getId()) {
continue;
}
otherAmount += items.get(i).getActualAmount() * items.get(i).getQuantity();
View itemView = getLayoutInflater().inflate(R.layout.layout_after_sale_list_item, llItemsContainer, false);
ImageView itemImgProduct = (ImageView) itemView.findViewById(R.id.img_product);
TextView itemTvProductTitle = (TextView) itemView.findViewById(R.id.tv_product_title);
TextView itemTvProductStyle = (TextView) itemView.findViewById(R.id.tv_product_style);
TextView itemTvProductStatus = (TextView) itemView.findViewById(R.id.tv_product_status);
TextView itemTvProductNum = (TextView) itemView.findViewById(R.id.tv_product_num);
View line = itemView.findViewById(R.id.line_layout);
UniversalImageLoader.displayImage(this, Util.getD2cProductPicUrl(
items.get(i).getProductImg(), ScreenUtil.dip2px(48), ScreenUtil.dip2px(72)), itemImgProduct,
R.mipmap.ic_logo_empty5, R.mipmap.ic_logo_empty5);
itemTvProductTitle.setText(items.get(i).getProductName());
itemTvProductStyle.setText(getString(R.string.label_kongge, items.get(i).getColor(), items.get(i).getSize()));
itemTvProductStatus.setText(getString(R.string.label_final_price, Util.getNumberFormat(items.get(i).getActualAmount())));
itemTvProductNum.setText(getString(R.string.label_product_quantity, items.get(i).getQuantity()));
line.setVisibility(View.VISIBLE);
llItemsContainer.addView(itemView);
}
allItemAmount = priceBuilder.toString();
allItemId = idBuilder.toString();
etMoney.setHint(getString(R.string.hint_refund_money, Util.getNumberFormat(actualAmount + otherAmount, false)));
}
public void showPop() {
if (photos.contains(emptyPic)) {
photos.remove(emptyPic);
}
PackageManager pkgManager = getPackageManager();
boolean cameraPermission =
pkgManager.checkPermission(Manifest.permission.CAMERA, getPackageName()) == PackageManager.PERMISSION_GRANTED;
if (Build.VERSION.SDK_INT >= 23 && !cameraPermission) {
requestPermission();
} else {
choosePic();
}
}
private void requestPermission() {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE},
Constants.RequestCode.REQUEST_PERMISSION);
}
private void choosePic() {
Matisse.from(RefundReshipActivity.this)
.choose(MimeType.of(MimeType.JPEG, MimeType.PNG))
.theme(R.style.Matisse_Dracula)
.countable(true)
.capture(true)
.captureStrategy(
new CaptureStrategy(true, "com.d2cmall.buyer.fileprovider"))
.maxSelectable(maxSelected)
.gridExpectedSize(ScreenUtil.dip2px(120))
.restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
.thumbnailScale(0.85f)
.imageEngine(new GlideEngine())
.forResult(456);
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode == Constants.RequestCode.REQUEST_PERMISSION) {
if ((grantResults.length == 2 && grantResults[0] == PackageManager.PERMISSION_GRANTED
&& grantResults[1] == PackageManager.PERMISSION_GRANTED)) {
choosePic();
}
} else {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
private void initTypeInfo() {
TitleUtil.setBack(this);
if (type == 0) {//退货退款
rlNumProduct.setVisibility(View.VISIBLE);
TitleUtil.setTitle(this, R.string.label_reship_info);
tvReasonLabel.setText(R.string.label_reship_reason);
etCount.setHint(String.format(getString(R.string.hint_refund_count), String.valueOf(bean.getQuantity())));
//申请金额根据用户所填退货件数变化
if(bean.getQuantity()==1){
etCount.setText("1");
etCount.setFocusable(false);
}
if(bean.getQuantity()>1){
TextWatcher textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(!Util.isEmpty(etCount.getText().toString())){
Integer applyCount = Integer.valueOf(etCount.getText().toString());
if(applyCount!=null && bean.getQuantity() > applyCount && applyCount>0){
etMoney.setText(Util.getNumberFormat((bean.getActualAmount()*applyCount)/bean.getQuantity()));
}else{
etMoney.setText(Util.getNumberFormat(bean.getActualAmount()));
}
if(applyCount!=null && (applyCount<=0 || applyCount>bean.getQuantity())){
etCount.setText(bean.getQuantity()+"");
etMoney.setText(Util.getNumberFormat(bean.getActualAmount()));
}
}else{
etMoney.setText(Util.getNumberFormat(bean.getActualAmount()));
}
}
@Override
public void afterTextChanged(Editable editable) {
}
};
etCount.addTextChangedListener(textWatcher);
}
if (!"COD".equals(paymentType)) {
statusLayout.setVisibility(View.VISIBLE);
statusLineView.setVisibility(View.VISIBLE);
} else {
statusLayout.setVisibility(View.GONE);
statusLineView.setVisibility(View.GONE);
}
etMoney.setText(Util.getNumberFormat(bean.getActualAmount()));
etMoney.setFocusable(false);
// tvMoneyLabel.setText(R.string.label_reship_money);
// tvRemarkLabel.setText(R.string.label_reship_remark);
singleSelectPop = new SingleSelectPop(this, getResources().getStringArray(R.array.label_exchange_titles));
} else {//退款
if (statusCode >= 2 && statusCode < 8) {
radioGroup.setVisibility(View.VISIBLE);
rbs = new ArrayList<>();
rbs.add(rbAll);
rbs.add(rbFreight);
rbs.add(rbGapPrice);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb_all://退全款
changeRbStatus(checkedId);
allRefund = 1;
break;
case R.id.rb_gap_price: //退差价
changeRbStatus(checkedId);
allRefund = -1;
break;
case R.id.rb_freight: //退差价
changeRbStatus(checkedId);
allRefund = -2;
break;
}
}
});
}
TitleUtil.setTitle(this, R.string.label_refund_info);
tvReasonLabel.setText(R.string.label_refund_reason);
tvMoneyProduct.setText("退款金额");
rlNumProduct.setVisibility(View.GONE);
statusLayout.setVisibility(View.GONE);
statusLineView.setVisibility(View.GONE);
// if (!"COD".equals(paymentType)) {
// tvLabel.setText(reminded);
// } else {
// tvLabel.setText(R.string.label_is_cod);
// }
// tvMoneyLabel.setText(R.string.label_refund_money);
// tvRemarkLabel.setText(R.string.label_refund_remark);
singleSelectPop = new SingleSelectPop(this, getResources().getStringArray(R.array.label_refund_titles));
}
singleSelectPop.setCallBack(this);
etMoney.setHint(getString(R.string.hint_refund_money, Util.getNumberFormat(actualAmount, false)));
}
//改变rb的显示状态
private void changeRbStatus(int checkedId) {
if (rbs == null) {
return;
}
for (int i = 0; i < rbs.size(); i++) {
if (checkedId == rbs.get(i).getId()) {
rbs.get(i).setBackgroundResource(R.drawable.sp_round4_stroke_red);
rbs.get(i).setTextColor(getResources().getColor(R.color.color_red));
} else {
rbs.get(i).setBackgroundResource(R.drawable.sp_round4_stroke_black3);
rbs.get(i).setTextColor(getResources().getColor(R.color.trans_50_color_black));
}
}
}
@OnClick({R.id.back_iv, R.id.received_layout, R.id.unreceived_layout, R.id.title_right, R.id.tv_back_desc})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.back_iv:
finish();
break;
case R.id.received_layout:
isReceived = true;
ivReceived.setImageResource(R.mipmap.icon_shopcart_aselected);
ivUnreceived.setImageResource(R.mipmap.icon_shopcart_unaselected);
break;
case R.id.unreceived_layout:
isReceived = false;
ivReceived.setImageResource(R.mipmap.icon_shopcart_unaselected);
ivUnreceived.setImageResource(R.mipmap.icon_shopcart_aselected);
break;
case R.id.title_right:
toChat();
break;
case R.id.tv_back_desc:
//退款说明
Util.urlAction(RefundReshipActivity.this, "http://d2cmall.com/page/refunds");
break;
}
}
private class ViewHolder {
View addView;
View deleteView;
ImageView imageView;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
JsonPic jsonPic = (JsonPic) parent.getAdapter().getItem(position);
if (jsonPic != null) {
if (Util.isEmpty(jsonPic.getMediaPath())) {
showPop();
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 456) {
if (resultCode == RESULT_OK) {
for (String string : Matisse.obtainPathResult(data)) {
JsonPic jsonPic = new JsonPic();
jsonPic.setMediaPath(string);
photos.add(jsonPic);
jsonPics.add(jsonPic);
}
if (!photos.contains(emptyPic) && jsonPics.size() < 3) {
photos.add(emptyPic);
}
if (jsonPics.size() >= 3 && photos.contains(emptyPic)) {
photos.remove(emptyPic);
}
maxSelected = 3 - jsonPics.size();
adapter.notifyDataSetChanged();
} else {
if (!photos.contains(emptyPic) && jsonPics.size() < 3) {
photos.add(emptyPic);
}
}
}
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public void setViewValue(View view, JsonPic jsonPic, int position) {
ViewHolder holder = (ViewHolder) view.getTag();
if (holder == null) {
holder = new ViewHolder();
holder.addView = view.findViewById(R.id.add_btn);
holder.deleteView = view.findViewById(R.id.delete);
holder.imageView = (ImageView) view.findViewById(R.id.image);
view.getLayoutParams().width = imageSize;
view.getLayoutParams().height = imageSize;
view.setTag(holder);
}
if (Util.isEmpty(jsonPic.getMediaPath())) {
holder.imageView.setVisibility(View.GONE);
holder.deleteView.setVisibility(View.GONE);
holder.addView.setVisibility(View.VISIBLE);
} else {
holder.addView.setVisibility(View.GONE);
holder.imageView.setVisibility(View.VISIBLE);
holder.deleteView.setVisibility(View.VISIBLE);
holder.deleteView.setOnClickListener(new OnPhotoDeleteClickListener(jsonPic));
Glide.with(this)
.load(Uri.fromFile(new File(jsonPic.getMediaPath())))
.error(R.mipmap.ic_default_pic)
.into(holder.imageView);
}
}
@OnClick(R.id.reason_layout)
void onClick() {
showPopupMenu(tvReasonLabel);
}
private List<String> reshipList = new ArrayList<>();
private void initReshipList() {
reshipList.add("商品需要维修");
reshipList.add("收到商品破损");
reshipList.add("商品错发/漏发");
reshipList.add("收到商品描述不符");
reshipList.add("商品质量问题");
reshipList.add("七天无理由退货");
}
private void showPopupMenu(View view) {
if (type == 0) {
selectPromotionPop = new SelectReasonPop(this, reshipList, tvReasonLabel.getText().toString());
selectPromotionPop.setTitle("退货退款原因");
selectPromotionPop.setDissMissListener(new TransparentPop.DismissListener() {
@Override
public void dismissStart() {
}
@Override
public void dismissEnd() {
if (!Util.isEmpty(selectPromotionPop.getPromotion())) {
tvReason.setText(selectPromotionPop.getPromotion());
getParams(selectPromotionPop.getPosition());
}
}
});
selectPromotionPop.show(tvReasonLabel);
} else {
selectPromotionPop = new SelectReasonPop(this, refundList, tvReasonLabel.getText().toString());
selectPromotionPop.setTitle("退款原因");
selectPromotionPop.setDissMissListener(new TransparentPop.DismissListener() {
@Override
public void dismissStart() {
}
@Override
public void dismissEnd() {
if (!Util.isEmpty(selectPromotionPop.getPromotion())) {
tvReason.setText(selectPromotionPop.getPromotion());
getParams(selectPromotionPop.getPosition());
}
}
});
selectPromotionPop.show(tvReasonLabel);
}
}
private List<String> refundList = new ArrayList<>();
private void initRefundList() {
refundList.add("拍错了");
refundList.add("不想要了");
refundList.add("商品缺货");
refundList.add("协商一致退款");
refundList.add("订单信息错误");
}
private void getParams(int index) {
buttonEnableOrNot();
if (type == 0) {//退货退款
switch (index) {
case 0:
reason = "repair";
break;
case 1:
reason = "damaged";
break;
case 2:
reason = "wrong";
break;
case 3:
reason = "not";
break;
case 4:
reason = "quality";
break;
case 5:
reason = "noReason";
break;
}
} else {//退款
switch (index) {
case 0:
reason = "wrong";
break;
case 1:
reason = "no";
break;
case 2:
reason = "stock";
break;
case 3:
reason = "consensus";
break;
case 4:
reason = "error";
break;
}
}
}
@OnClick(R.id.btn_apply)
void onApply() {
hideKeyboard(null);
money = etMoney.getText().toString().trim();
remark = etRemark.getText().toString().trim();
if (Util.isEmpty(money)) {
Util.showToast(this, "请输入金额");
return;
}
if (Util.isEmpty(reason)) {
Util.showToast(this, "请选择退货退款原因");
return;
}
if(money.contains(",")){
money = money.replaceAll(",","");
}
double moneyDouble = Double.parseDouble(money);
if (moneyDouble > actualAmount + otherAmount) {
Util.showToast(this, R.string.msg_apply_money_limit);
return;
}
// if ("COD".equals(paymentType)) {
// if (Util.isEmpty(alipayAccount)) {
// Util.showToast(this, R.string.msg_alipay_account_empty);
// return;
// }
// if (Util.isEmpty(alipayName)) {
// Util.showToast(this, R.string.msg_alipay_name_empty);
// return;
// }
// if (alipayAccount.length() > 20) {
// Util.showToast(this, R.string.msg_alipay_account_error);
// return;
// }
// if (alipayName.length() < 2 || alipayName.length() > 10) {
// Util.showToast(this, R.string.msg_alipay_name_error);
// return;
// }
// }
if (remark.length() > 100) {
Util.showToast(this, R.string.msg_mark_error);
return;
}
if ((reason.equals("repair") || reason.equals("damaged") || reason.equals("quality")) && jsonPics.isEmpty()) {
Util.showToast(this, "请上传图片凭证");
return;
}
loadingDialog.show();
if (!jsonPics.isEmpty()) {
upLoadIndex = 0;
uploadFile();
} else {
requestTask();
}
}
private class OnPhotoDeleteClickListener implements View.OnClickListener {
private JsonPic jsonPic;
private OnPhotoDeleteClickListener(JsonPic jsonPic) {
this.jsonPic = jsonPic;
}
@Override
public void onClick(View v) {
photos.remove(jsonPic);
jsonPics.remove(jsonPic);
maxSelected = 3 - jsonPics.size();
if (!photos.contains(emptyPic)) {
photos.add(emptyPic);
}
adapter.notifyDataSetChanged();
}
}
private TextWatcher textWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
buttonEnableOrNot();
}
public void afterTextChanged(Editable s) {
}
};
private void requestTask() {
if (type == 0) {
PostReshipApi api = new PostReshipApi();
//api.setQuantity(quantity);
if (!Util.isEmpty(etCount.getText().toString())) {
api.setReceiveQuantity(Integer.valueOf(etCount.getText().toString()));
} else {
api.setReceiveQuantity((int) quantity);
}
api.setOrderItemId(orderItemId);
if (Util.isEmpty(reason)) {
Util.showToast(RefundReshipActivity.this, "请选择退款原因");
return;
} else {
api.setReshipReason(reason);
}
api.setApplyAmount(money);
if (!"COD".equals(paymentType)) {
if (isReceived) {
api.setReceived(1);
} else {
api.setReceived(0);
}
} else {
api.setBackAccountSn(alipayAccount);
api.setBackAccountName(alipayName);
}
api.setEvidences(Util.join(imgUpyunPaths.toArray(), ","));
api.setMemo(remark);
D2CApplication.httpClient.loadingRequest(api, new BeanRequest.SuccessListener<BaseBean>() {
@Override
public void onResponse(BaseBean baseBean) {
loadingDialog.dismiss();
Util.showToast(RefundReshipActivity.this, baseBean.getMsg());
// if (intentFlag == 0) {
// Intent intent = new Intent(RefundReshipActivity.this, MyOrderActivity.class);
// startActivity(intent);
// } else {
// Intent intent = new Intent(RefundReshipActivity.this, OrderDetailActivity.class);
// intent.putExtram ("orderSn", orderSn);
// startActivity(intent);
// }
Intent intent = new Intent();//跳转到退货
intent.putExtra("position", 0);
setResult(RESULT_OK, intent);
finish();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
loadingDialog.dismiss();
Util.showToast(RefundReshipActivity.this, Util.checkErrorType(error));
}
});
} else {
PostRefundApi api = new PostRefundApi();
// if (!Util.isEmpty(etCount.getText().toString())) {
// api.setQuantity(Integer.valueOf(etCount.getText().toString()));
// } else {
// api.setQuantity((int) quantity);
// }
api.setAllRefund(allRefund);
api.setOrderItemId(orderItemId);
api.setApplyAmount(money);
if (Util.isEmpty(reason)) {
Util.showToast(RefundReshipActivity.this, "请选择退款原因");
return;
} else {
api.setRefundReason(reason);
}
// if ("COD".equals(paymentType)) {
// api.setBackAccountSn(alipayAccount);
// api.setBackAccountName(alipayName);
// }
api.setEvidences(Util.join(imgUpyunPaths.toArray(), ","));
api.setMemo(remark);
D2CApplication.httpClient.loadingRequest(api, new BeanRequest.SuccessListener<BaseBean>() {
@Override
public void onResponse(BaseBean baseBean) {
loadingDialog.dismiss();
Util.showToast(RefundReshipActivity.this, baseBean.getMsg());
EventBus.getDefault().post(new GlobalTypeBean(Constants.GlobalType.APPLY_AFTER));
// if (intentFlag == 0) {
// Intent intent = new Intent(RefundReshipActivity.this, MyOrderActivity.class);
// startActivity(intent);
// } else {
// Intent intent = new Intent(RefundReshipActivity.this, OrderDetailActivity.class);
// intent.putExtra("orderSn",orderSn);
// startActivity(intent);
// }
Intent intent = new Intent();
intent.putExtra("position", 2);
setResult(RESULT_OK, intent);
finish();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
loadingDialog.dismiss();
Util.showToast(RefundReshipActivity.this, Util.checkErrorType(error));
}
});
}
}
private void buttonEnableOrNot() {
boolean reasonTyped = tvReason.getText().length() > 0;
boolean isMoney = false;
if (!Util.isEmpty(etMoney.getText().toString())) {
String amount = etMoney.getText().toString();
if(amount.contains(",")){
amount = amount.replaceAll(",","");
}
double moneyDouble = Double.parseDouble(amount);
if (moneyDouble > 0) {
isMoney = true;
}
}
// if ("COD".equals(paymentType)) {
// if (reasonTyped && alipayAccountTyped && alipayNameTyped && isMoney) {
// btnApply.setEnabled(true);
// } else {
// btnApply.setEnabled(false);
// }
// } else {
// if (reasonTyped && isMoney) {
// btnApply.setEnabled(true);
// } else {
// btnApply.setEnabled(false);
// }
// }
}
private void uploadFile() {
UserBean.DataEntity.MemberEntity user = Session.getInstance().getUserFromFile(this);
JsonPic jsonPic = jsonPics.get(upLoadIndex);
File file = new File(jsonPic.getMediaPath());
final Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put(Params.BUCKET, Constants.UPYUN_SPACE);
paramsMap.put(Params.SAVE_KEY, Util.getUPYunSavePath(user.getId(), Constants.TYPE_CUSTOMER));
paramsMap.put(Params.RETURN_URL, "httpbin.org/post");
UpCompleteListener completeListener = new UpCompleteListener() {
@Override
public void onComplete(boolean isSuccess, String result) {
try {
JSONObject jsonObject = new JSONObject(result);
imgUpyunPaths.add(jsonObject.optString("url"));
} catch (JSONException e) {
}
upLoadIndex++;
if (upLoadIndex < jsonPics.size()) {
uploadFile();
} else {
requestTask();
}
}
};
SignatureListener signatureListener = new SignatureListener() {
@Override
public String getSignature(String raw) {
return UpYunUtils.md5(raw + Constants.UPYUN_KEY);
}
};
UploadManager.getInstance().blockUpload(file, paramsMap, signatureListener, completeListener, null);
}
@Override
public void callback(View trigger, int index, String value) {
tvReason.setText(value);
buttonEnableOrNot();
if (type == 0) {//退货退款
switch (index) {
case 0:
reason = "repair";
break;
case 1:
reason = "damaged";
break;
case 2:
reason = "wrong";
break;
case 3:
reason = "not";
break;
case 4:
reason = "quality";
break;
case 5:
reason = "noReason";
break;
}
} else {//退款
switch (index) {
case 0:
reason = "wrong";
break;
case 1:
reason = "no";
break;
case 2:
reason = "stock";
break;
case 3:
reason = "consensus";
break;
case 4:
reason = "error";
break;
}
}
}
private void toChat() {
String title = "线上客服";
String url = "http://www.d2cmall.com";
ConsultSource source = new ConsultSource(url, title, "售后详情");
source.groupId = Constants.QIYU_AF_GROUP_ID;
source.robotFirst = true;
Unicorn.openServiceActivity(this, "D2C客服", source);
//合力亿捷
// Intent intent = new Intent(this,CustomServiceActivity.class);
// intent.putExtra("skillGroupId",Constants.HLYJ_BF_AF_GROUP_ID);
// startActivity(intent);
}
}
| [
"[email protected]"
] | |
7881eeb9fd176752ce79c495fe11f7335656634a | 1bddef117119d7bc9733a5ab6bec7461845e302d | /java06/src/배열의응용/원하는값찾기2.java | ce54cb91c72961157aa05bb4bff5620c8c7bd2ea | [] | no_license | Minbyeong/androidjava | 46d4f866cd3988068a2f98dfc3f560bdc97e7dd6 | af31929e84093d3e82a7f36be34a6c713a46cae8 | refs/heads/master | 2023-01-02T08:18:04.679180 | 2020-10-30T03:19:28 | 2020-10-30T03:19:28 | 288,131,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,647 | java | package 배열의응용;
import java.util.Random;
public class 원하는값찾기2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Random r = new Random();
int[] number = new int[100];
for (int i = 0; i < number.length; i++) {
number[i] = r.nextInt(100);//-100; 뒤에 -숫자를 해주면 음수가 나옴 // 0~999
}
// for (int i = 0; i < number.length; i++) {
// System.out.println(i + ": " + number[i]);
// }
int max = number[0];
for (int i = 0; i < number.length; i++) {
if (number[i] > max) {
max = number[i];
}
}
System.out.println("최대값은 " + max);
int maxcount = 0;
for (int i = 0; i < number.length; i++) {
if (max == number[i]) {
System.out.println(max + "의 위치는 " + i);
maxcount++;
}
}
System.out.println(max + "의 개수는 " + maxcount);
System.out.println("-----------------------------");
int min = number[0];
for (int i = 0; i < number.length; i++) {
if (number[i] < min) {
min = number[i];
}
}
System.out.println("최소값은 " + min);
int mincount = 0;
for (int i = 0; i < number.length; i++) {
if (min == number[i]) {
System.out.println(min + "의 위치는 " + i);
mincount++;
}
}
System.out.println(min + "의 개수는 " + mincount);
// int target = 884;
// int count = 0;
// for (int i = 0; i < number.length; i++) {
// if (number[i] == target) {
// System.out.println(target + "의 위치는 " + i);
// count++;
// }
// }
// System.out.println(target + "의 개수는 " + count);
}
}
| [
"[email protected]"
] | |
23f7b799e923e68c080b16f23c0e1fbf579ed5e1 | c4b5e9c9de96168b23c3709ecc79ff3dcbd5f56e | /src/main/java/com/subhamsql/mysqljpa/dao/UserRepository.java | ee6ac8c7c16e565851c0574ee499ffe031f50d4e | [] | no_license | subhambhardwaj/jpa-mysql-database | 3a535c8dc995b09cb73b698b8f469b42036d1681 | b09ef001bdad8e063f0977593c60238ce63a36a2 | refs/heads/master | 2022-12-05T13:39:40.511225 | 2020-08-31T15:37:18 | 2020-08-31T15:37:18 | 291,044,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.subhamsql.mysqljpa.dao;
import com.subhamsql.mysqljpa.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Set;
public interface UserRepository extends JpaRepository<User, String> {
Set<User> findByEmailContaining (String email);
List<User> findByNameContaining(String name);
} | [
"[email protected]"
] | |
942ae8af2811aafdd7bbdc0d636b8e92717c5862 | e6004aeba5c82481407b3f487dfb45095453cad2 | /app/src/main/java/org/d3ifcool/finpro/core/mediators/interfaces/prodi/ProdiDetailActivityMediator.java | 776d66f3c32a62b51f79743218d07851f6dda159 | [] | no_license | haryandrafatwa/TA | 869f997e9e8d32114e868110335a271e5e3c550e | da2c3646211a5e6d987c4ce2520c8d7a6975fd63 | refs/heads/master | 2023-07-11T09:45:00.992567 | 2021-08-10T08:12:39 | 2021-08-10T08:12:39 | 357,818,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package org.d3ifcool.finpro.core.mediators.interfaces.prodi;
import android.app.ProgressDialog;
import androidx.annotation.IdRes;
import org.d3ifcool.finpro.core.models.Mahasiswa;
import org.d3ifcool.finpro.core.models.Plotting;
public interface
ProdiDetailActivityMediator {
void Notify(@IdRes int id);
void message(String event);
ProgressDialog getProgressDialog();
Mahasiswa getMahasiswa();
void setPlotting(Plotting plotting);
}
| [
"[email protected]"
] | |
1ee52deb31f7c6ffc71a86106e9067aaae3819ab | 2bb515ec8fa91754a932bb427d6ff688d0243ca5 | /二叉树的使用基础部分/二叉树的镜像.java | b99d8de9e1ee07b34f3eb8d759d36c9a2eae7bc3 | [] | no_license | WZPluckeyboy/JAVA- | e950d5e4d58b392ac19ad97a21bea380ee025989 | 333c4c55df183e6c53a3091ea7f5534ed2fa4334 | refs/heads/master | 2022-12-21T13:56:12.427568 | 2019-09-11T15:04:47 | 2019-09-11T15:04:47 | 178,685,093 | 0 | 0 | null | 2022-12-16T04:50:38 | 2019-03-31T12:29:05 | Java | UTF-8 | Java | false | false | 738 | java | package 二叉树.OJ题;
//操作给定的二叉树,将其变换为源二叉树的镜像。
public class 二叉树的镜像 {
class TreeNode{
char val;
TreeNode left;
TreeNode right;
public TreeNode(char var){
this.val=val;
}
}
public void Mirror(TreeNode root){
if(root==null){
return;
}
if(root.left==null&&root.right==null){
return;
}
TreeNode pTemp=root.left;
root.left=root.right;
root.right=pTemp;
if(root.left!=null){
Mirror ( root.left );
}
if(root.right!=null){
Mirror ( root.right );
}
}
}
| [
"[email protected]"
] | |
e90f8b0a3a99ab0c69d4f9c3bebadf7d59ffcdf8 | e76195b0b532f39210a09b28e615638b6ef633e3 | /src/main/java/cn/com/boe/b5/fwp/poserver/model/TradeUnionFund.java | 8c8c2eb9bc1e367778ab5b4360a58e25a6daecc5 | [] | no_license | triple-golds/po-server | a0ba5a9816feddae6a8ccf92e58c912430f7a4c5 | b217f8b159b703f0a3da7df564733394fb11a97d | refs/heads/master | 2022-11-22T22:55:49.899596 | 2020-07-27T09:37:23 | 2020-07-27T09:37:23 | 281,907,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,200 | java | package cn.com.boe.b5.fwp.poserver.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.util.Date;
//阳光基金
@Entity
public class TradeUnionFund {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
//员工编号
private String code;
//姓名
private String name;
//性别
private String sex;
//年龄
private String age;
//个人月收入
private String salary;
//家庭人口数
private String people;
//入司日期
// @JsonFormat(pattern = "yyyy-MM-dd")
private Date entryDate;
//科室岗位
private String department;
//公司慰问次数
private String sympathyTimes;
//联系方式
private String phone;
//双职工配偶姓名
private String coupleName;
//配偶员工编号
private String coupleCode;
//出现困难主要原因
private String reason;
//所属工会小组
@ManyToOne
private TradeUnionTeam team;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getSalary() {
return salary;
}
public void setSalary(String salary) {
this.salary = salary;
}
public String getPeople() {
return people;
}
public void setPeople(String people) {
this.people = people;
}
public Date getEntryDate() {
return entryDate;
}
public void setEntryDate(Date entryDate) {
this.entryDate = entryDate;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getSympathyTimes() {
return sympathyTimes;
}
public void setSympathyTimes(String sympathyTimes) {
this.sympathyTimes = sympathyTimes;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getCoupleName() {
return coupleName;
}
public void setCoupleName(String coupleName) {
this.coupleName = coupleName;
}
public String getCoupleCode() {
return coupleCode;
}
public void setCoupleCode(String coupleCode) {
this.coupleCode = coupleCode;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public TradeUnionTeam getTeam() {
return team;
}
public void setTeam(TradeUnionTeam team) {
this.team = team;
}
}
| [
"[email protected]"
] | |
6ea210d4571d8e5d205cf88d65175f2705b11c8d | 512ff7e33759e38f7d395218857e5549c107cc6c | /app/src/main/java/com/github/codetanzania/feature/logincitizen/OTPVerificationActivity.java | fd0c32c409f40acbd9c342be2f68db02642de678 | [] | no_license | krtonga/mwauwasa | 26d011a6de9870444dc419bd3f40306092a79b15 | c2703bf3e013f07585d46de0c3312be407ce9496 | refs/heads/master | 2020-03-20T21:26:28.588088 | 2018-06-21T08:13:14 | 2018-06-21T08:13:14 | 137,740,858 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,477 | java | package com.github.codetanzania.feature.logincitizen;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.annotation.NonNull;
import android.support.design.widget.TextInputEditText;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.github.codetanzania.core.api.Open311Api;
import com.github.codetanzania.feature.home.MainActivity;
import com.github.codetanzania.open311.android.library.models.Reporter;
import com.github.codetanzania.util.LocalTimeUtils;
import com.github.codetanzania.util.SmsUtils;
import com.github.codetanzania.util.Util;
import java.util.HashMap;
import java.util.Map;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import tz.co.codetanzania.BuildConfig;
import tz.co.codetanzania.R;
public class OTPVerificationActivity extends AppCompatActivity
implements Callback<ResponseBody>,
DialogInterface.OnCancelListener,
DialogInterface.OnClickListener,
SmsVerificationBroadcastReceiver.OnVerificationResult,
View.OnClickListener, TextWatcher {
private static final String TAG = "OTPVerification";
private static final int SMS_PERMISSION_CODE = 0;
// reference to the views
private TextView tvCountDown;
private TextView tvOtpTitle;
private TextInputEditText tilVerificationCode;
private Button btnRetry;
private Button btnCancel;
// Constants used by the timer
private static long VERIFICATION_TIMEOUT = 60000;
private static final int UPDATE_INTERVAL = 1000;
private long mCurrentTick = VERIFICATION_TIMEOUT;
/* broadcast receiver for the SMSs */
private SmsVerificationBroadcastReceiver mSmsReceiver;
private String mVerificationCode;
private CountDownTimer mCountDownTimer;
/* CountDown timer to keep track of the number of second remains until the request is cancelled */
private CountDownTimer getCountDownTimer() {
return new CountDownTimer(mCurrentTick, UPDATE_INTERVAL) {
@Override
public void onTick(long l) {
tvCountDown.setText(LocalTimeUtils
.formatCountDown(l, LocalTimeUtils.FMT_MM_SS));
mCurrentTick = l;
}
@Override
public void onFinish() {
if (!PhoneVerificationUtils.isVerified(
OTPVerificationActivity.this)) {
showOptions();
}
}
};
}
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_otp_verification);
initViews();
Log.d(TAG, "VISITED");
if (mSmsReceiver == null) {
mSmsReceiver = new SmsVerificationBroadcastReceiver();
registerReceiver(mSmsReceiver,
new IntentFilter("android.provider.Telephony.SMS_RECEIVED"));
}
mSmsReceiver.setOnVerificationResult(this);
bootstrapVerification();
}
@Override
protected void onResume() {
super.onResume();
Log.d(TAG, "onResume: " + mCurrentTick);
// Log.d(TAG, "onResume: ");
mCountDownTimer = getCountDownTimer();
mCountDownTimer.start();
}
@Override public void onPause() {
if (mCountDownTimer != null) {
mCountDownTimer.cancel();
}
super.onPause();
}
@Override public void onDestroy() {
if (mSmsReceiver != null) {
unregisterReceiver(mSmsReceiver);
mSmsReceiver = null;
}
super.onDestroy();
}
private void initViews() {
tvOtpTitle = (TextView) findViewById(R.id.tv_OtpTitle);
tvCountDown = (TextView) findViewById(R.id.tv_OtpCountDown);
tilVerificationCode = (TextInputEditText) findViewById(R.id.til_VerificationCode);
btnRetry = (Button) findViewById(R.id.btn_OtpRetry);
btnCancel = (Button) findViewById(R.id.btn_ChangeNumber);
btnRetry.setOnClickListener(this);
btnCancel.setOnClickListener(this);
tilVerificationCode.addTextChangedListener(this);
}
private void showOptions() {
btnRetry.setVisibility(View.VISIBLE);
btnCancel.setVisibility(View.VISIBLE);
}
private void bootstrapVerification() {
// generate and store random code
mVerificationCode = PhoneVerificationUtils.getRandomVerificationCode();
PhoneVerificationUtils.storeVerificationCode(this, mVerificationCode);
// initialize broadcast receiver
if (hasReadSmsPermission()) {
// send verification code using SMS transporter [presumably, EGA]
SmsUtils.sendVerificationCode(getApplicationContext(), mVerificationCode, this);
} else {
showPermitClarificationDialog();
}
}
private boolean hasReadSmsPermission() {
return ContextCompat.checkSelfPermission(
this, Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(
this, Manifest.permission.RECEIVE_SMS) == PackageManager.PERMISSION_GRANTED;
}
private void requestReadSmsPermission() {
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.READ_SMS,
Manifest.permission.RECEIVE_SMS
}, SMS_PERMISSION_CODE);
}
private void showMessage(String msg) {
tilVerificationCode.setText(msg);
tilVerificationCode.setTextColor(Color.parseColor("#262626"));
}
private void showPermitClarificationDialog() {
int msgId = R.string.msg_reason_to_read_sms;
int txtGrant = R.string.text_grant_read_sms_permission;
int txtDeny = R.string.text_deny_read_sms_permission;
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
alertDialog.setMessage(msgId)
.setPositiveButton(txtGrant, this)
.setNegativeButton(txtDeny, this)
.create().show();
tvOtpTitle.setText(R.string.title_otp_requesting_permission);
tilVerificationCode.setVisibility(View.INVISIBLE);
}
private void exitApplication() {
android.os.Process.killProcess(android.os.Process.myPid());
}
@Override
public void onRequestPermissionsResult(
int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case SMS_PERMISSION_CODE: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// send verification code using SMS transporter [presumably, EGA]
SmsUtils.sendVerificationCode(getApplicationContext(), mVerificationCode, this);
} else {
// show dialog message before quiting
exitApplication();
}
}
}
}
@Override
public void onResponse(
@NonNull Call<ResponseBody> call,
@NonNull Response<ResponseBody> response) {
// if (response.isSuccessful()) {
// mCountDownTimer.start();
// }
}
@Override
public void onFailure(
Call<ResponseBody> call,
Throwable t) {
Toast.makeText(this,
R.string.error_delivering_sms, Toast.LENGTH_SHORT).show();
showOptions();
}
@Override
public void onCancel(DialogInterface dialog) {
// there's no need now!
exitApplication();
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
requestReadSmsPermission();
dialog.dismiss();
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
exitApplication();
}
}
@Override
public void onVerificationSuccessful(String message, boolean userAction) {
PhoneVerificationUtils.setVerified(this, true);
if (!userAction) {
showMessage(message);
}
// start another activity and finish this.
// As a result, this will call our onPause, causing the activity
// to tear down, which includes stopping the timer and
// un-registering the broadcast receiver.
startActivity(new Intent(this, MainActivity.class));
}
@Override
public void onVerificationFailed() {
// Show option buttons [retry|quit]
showOptions();
}
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.btn_OtpRetry:
recreate();
break;
case R.id.btn_ChangeNumber:
startActivity(new Intent(this, UserDetailsActivity.class));
finish();
break;
}
}
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(
CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
// manual verification
if (!TextUtils.isEmpty(s)) {
if (s.toString().equals(mVerificationCode)) {
tilVerificationCode.setError(null);
onVerificationSuccessful(mVerificationCode, true);
} else {
if (s.length() >= 4) {
tilVerificationCode.setError(getString(R.string.text_invalid_verification_code));
} else {
tilVerificationCode.setError(null);
}
}
}
}
}
| [
"[email protected]"
] | |
584322143980838e677488b1ff1d7fc8916a52c9 | 94138ba86d0dbf80b387064064d1d86269e927a1 | /group06/1378560653/src/com/coding/basic/array/ArrayUtil.java | 3e3b51e735c7f20f602f363880ede713a0e260c5 | [] | no_license | DonaldY/coding2017 | 2aa69b8a2c2990b0c0e02c04f50eef6cbeb60d42 | 0e0c386007ef710cfc90340cbbc4e901e660f01c | refs/heads/master | 2021-01-17T20:14:47.101234 | 2017-06-01T00:19:19 | 2017-06-01T00:19:19 | 84,141,024 | 2 | 28 | null | 2017-06-01T00:19:20 | 2017-03-07T01:45:12 | Java | UTF-8 | Java | false | false | 6,020 | java | package com.coding.basic.array;
import java.util.Arrays;
public class ArrayUtil {
/**
* 给定一个整形数组a , 对该数组的值进行置换
例如: a = [7, 9 , 30, 3] , 置换后为 [3, 30, 9,7]
如果 a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
* @param origin
* @return
*/
public void reverseArray(int[] origin){
//注意边界条件
if(origin == null || origin.length == 0){
return;
}
for(int i=0, j = origin.length-1; i<j; i++, j--){
int t = origin[i];
origin[i] = origin[j];
origin[j] = t;
}
/*for(int i = 0; i < origin.length; i++){
* int t = origin[i];
* origin[i] = origin[origin.length - 1 - i];
* origin[origin.length - 1 - i] = t;
}*/
}
/**
* 现在有如下的一个数组: int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}
* 要求将以上数组中值为0的项去掉,将不为0的值存入一个新的数组,生成的新数组为:
* {1,3,4,5,6,6,5,4,7,6,7,5}
* @param oldArray
* @return
*/
public int[] removeZero(int[] oldArray){
if(oldArray == null){
return null;
}
int count = 0; //统计非零元素个数
int b[] = new int[oldArray.length];
//先统计非零元素个数,并将非零元素存入一个和原数组同样大小的新数组
for(int i=0; i < oldArray.length; i++)
{
if(oldArray[i] != 0)
{
b[count++] = oldArray[i];
}
}
return Arrays.copyOf(b, count);
}
/**
* 给定两个已经排序好的整形数组, a1和a2 , 创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素, 并且仍然是有序的
* 例如 a1 = [3, 5, 7,8] a2 = [4, 5, 6,7] 则 a3 为[3,4,5,6,7,8] , 注意: 已经消除了重复
* @param array1
* @param array2
* @return
*/
public int[] merge(int[] array1, int[] array2){
//当array1和array2都为空时,返回空
if(array1 == null && array2 == null){
return null;
}
if(array1 == null && array2 != null){
return array2;
}
if(array1 != null && array2 == null){
return array1;
}
int[] newArray = new int[array1.length + array2.length];
//应该让a1,a2两个数组先进行比较 比较后插入元素
int i = 0; //array1下标
int j = 0; //array2下标
int count = 0; //array3下标
while(i < array1.length && j < array2.length){
if(array1[i] < array2[j]){
newArray[count++] = array1[i++];
}else if(array1[i] > array2[j]){
newArray[count++] = array2[j++];
}else if(array1[i] == array2[j]){
newArray[count++] = array2[j++];
i++;
}
}
while(i==array1.length && j<array2.length){
newArray[count++] = array2[j++];
}
while(j==array2.length && i<array1.length){
newArray[count++] = array1[i++];
}
return Arrays.copyOf(newArray, count);
}
/**
* 把一个已经存满数据的数组 oldArray的容量进行扩展, 扩展后的新数据大小为oldArray.length + size
* 注意,老数组的元素在新数组中需要保持
* 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
* [2,3,6,0,0,0]
* @param oldArray
* @param size
* @return
* @throws Exception
*/
public int[] grow(int [] oldArray, int size){
if(oldArray == null)
return null;
if(size < 0)
throw new IndexOutOfBoundsException("size小于0");
int[] newArray = new int[oldArray.length + size];
System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
return newArray;
}
/**
* 斐波那契数列为:1,1,2,3,5,8,13,21...... ,给定一个最大值, 返回小于该值的数列
* 例如, max = 15 , 则返回的数组应该为 [1,1,2,3,5,8,13]
* max = 1, 则返回空数组 []
* @param max
* @return
*/
public int[] fibonacci(int max){
//先将2个边界条件处理
if(max == 1){
return new int[0];
}
if(max == 2){
return new int[]{1,1};//注意
}
int[] a = new int[max];
a[0] = 1;
a[1] = 1;
int count = 2;
for(int i=2; i<max; i++){
a[i] = a[i-1] + a[i-2];
if(a[i] >= max){
break;
}else{
count++;
}
}
return Arrays.copyOf(a,count);
}
/**
* 返回小于给定最大值max的所有素数数组
* 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
* @param max
* @return
*/
public int[] getPrimes(int max){
if(max < 3){
return new int[0];
}
boolean[] isPrime = isPrime(max);
int[] array = new int[max];
int count = 1;
array[0] = 2;
for(int i = 3; i < max; i++){
if(isPrime[i]){
array[count++] = i;
}
}
return Arrays.copyOf(array, count);
}
private boolean[] isPrime(int max) {
boolean[] isPrime = new boolean[max];
for(int i = 3; i < max; i++){
if(i % 2 != 0 ){
isPrime[i] = true;
}else{
isPrime[i] = false;
}
}
for(int i = 3; i < Math.sqrt(max); i++){
if(isPrime[i]){
for(int j = 2*i ; j < max; j += i){
isPrime[j] = false;
}
}
}
return isPrime;
}
/**
* 所谓“完数”, 是指这个数恰好等于它的因子之和,例如6=1+2+3
* 给定一个最大值max, 返回一个数组, 数组中是小于max 的所有完数
* @param max
* @return
*/
public int[] getPerfectNumbers(int max){
if(max < 0){
return new int[0];
}
int[] Array = new int[max];
int count = 0;
for(int n = 1; n < max; n++)
{
int sum = 0;
for(int i=1; i< n; i++)
{
if(n%i == 0)
sum += i;
}
if(sum == n)
Array[count++] = n;
}
return Arrays.copyOf(Array, count);
}
/**
* 用seperator 把数组 array给连接起来
* 例如array= [3,8,9], seperator = "-"
* 则返回值为"3-8-9"
* @param array
* @param s
* @return
*/
public String join(int[] array, String seperator)
{
if(array == null || array.length == 0){
return "";
}
StringBuilder buffer = new StringBuilder();
for(int i = 0; i < array.length; i++){
buffer.append(array[i]);
if(i < array.length - 1){
buffer.append(seperator);
}
}
return buffer.toString();
}
}
| [
"[email protected]"
] | |
85786dd8f225ffb6778ad16eaefc193497443016 | db7be03deb10996b99ec128fda05d049b3c64dfe | /Java/GameWithJavaNoobTuts/src/Renderer.java | 176141861ce4c5e56e7db53424b7ac3e1d269453 | [] | no_license | carolhcs/Studies-Basic-Intermediary-Codes-ALGC | a75842506d107524464a63504b327cb85b827382 | 0c70024973003c7772c6f0ddc410d36cac866ead | refs/heads/master | 2023-03-04T15:45:20.410077 | 2021-02-13T00:04:32 | 2021-02-13T00:04:32 | 80,257,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,981 | java | /*
* This project is maked follow NoobTuts tutorials <https://noobtuts.com/java>!
* Download <https://www.lwjgl.org/>
* stop here: https://noobtuts.com/java/opengl-renderer
*/
/**
*
* @author CarolHCS
*/
import java.awt.*;
public class Renderer {
// Window Size
int m_width;
int m_height;
// Timing
Interval m_elapsed = new Interval();
public int getWidth() {
return m_width;
}
public int getHeight() {
return m_height;
}
// Constructor
public Renderer(int width, int height, String title) {
m_width = width;
m_height = height;
// Create the Window
try {
Display.setDisplayMode(new DisplayMode(width, height)); // Display and DisplayMode check downloads on top
Display.setFullscreen(false);
Display.setVSyncEnabled(true);
Display.create();
Display.setTitle(title);
} catch (LWJGLException e) {
System.out.println("LWJGLException @ Renderer start");
System.exit(0);
}
// Initialize OpenGL
initGL();
// Call onStart
onStart();
// Loop while running
while (!Display.isCloseRequested()) {
// Calculate how much time has elapsed
long dT = m_elapsed.value();
m_elapsed.reset();
// Update
onUpdate(dT);
// Draw: Clear the screen and depth buffer
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
GL11.glLoadIdentity();
// Draw: 3D
refresh3D();
onDraw3D(dT);
// Draw: 2D
refresh2D();
onDraw2D(dT);
// Draw: update display
Display.update();
}
// Free resources in onEnd
onEnd();
// Destroy the Window
Display.destroy();
}
public abstract void onStart();
public abstract void onUpdate(long dT);
public abstract void onDraw2D(long dT);
public abstract void onDraw3D(long dT);
public abstract void onEnd();
void initGL() { //it is here?
// Set some default opengl settings
GL11.glShadeModel(GL11.GL_SMOOTH); // GL11 check downloads on top
GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
GL11.glClearDepth(1.0f);
GL11.glClearStencil(0);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
GL11.glDisable(GL11.GL_DITHER);
GL11.glCullFace(GL11.GL_BACK);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
GL11.glColor3f(1.0f, 1.0f, 1.0f);
}
}
| [
"[email protected]"
] | |
b7fc73d31d5b193d87b971e09316f38dfce79c56 | 8b719ffda2d80fc1b717935ac09fba3e316b24ae | /src/User.java | 5d4cafea982731285440ed7670031b4d58ee33a5 | [] | no_license | abhinavb05/parking-lot | 9e51868acd42a448b63576f007ec0652a3474abc | 4c4b91c5adb565e32abc66419805e8721b022586 | refs/heads/main | 2023-05-30T20:01:49.439801 | 2021-06-20T08:49:34 | 2021-06-20T08:49:34 | 378,599,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 980 | java | import java.util.*;
public class User {
private Vehicle vehicle;
private Ticket ticket;
private ParkingLot parkingLot;
User(Vehicle vehicle){
this.vehicle = vehicle;
}
void setTicket(ParkingLot parkingLot) {
Manager manager = new Manager(parkingLot);
this.ticket = manager.findVacantSlot(vehicle);
this.parkingLot = parkingLot;
}
Ticket getTicket() {
return ticket;
}
void parkVehicle() {
Floor allocatedFloor = parkingLot.getFloors().get(ticket.getFloorNumber());
Slot allocatedSlot = allocatedFloor.getSlots().get(ticket.getSlotNumber());
if(!allocatedSlot.getVacancy()) {
allocatedSlot.reverseVacancy();
}else {
//slot not vaccant
}
}
void unparkVehicle() {
Floor allocatedFloor = parkingLot.getFloors().get(ticket.getFloorNumber());
Slot allocatedSlot = allocatedFloor.getSlots().get(ticket.getSlotNumber());
if(allocatedSlot.getVacancy()) {
allocatedSlot.reverseVacancy();
}else {
//slot already vaccant
}
}
}
| [
"[email protected]"
] | |
38d5f71d590dd841c336735320a7f6d05ad4e144 | de52068e2541de1b58b236f42092270c00bbd681 | /src/main/java/com/jeeplus/modules/cv/web/statis/CoverSummaryController.java | e69f5fafcceaab4d7042b50a0e3a51d77a981097 | [] | no_license | dtatgit/cover-admin-1 | 57b1a442b8b20b1c4a46305f0669366da69442af | 3b606119e167755bf5899b22135369033f7662d2 | refs/heads/master | 2023-06-28T10:41:21.781016 | 2021-02-25T08:29:32 | 2021-02-25T08:29:32 | 391,333,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,685 | java | package com.jeeplus.modules.cv.web.statis;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.web.BaseController;
import com.jeeplus.modules.cv.entity.statis.CoverCollectStatis;
import com.jeeplus.modules.cv.service.statis.CoverCollectStatisService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
@Controller
@RequestMapping(value = "${adminPath}/cv/statis/coverSummary")
public class CoverSummaryController extends BaseController {
@Autowired
private CoverCollectStatisService coverCollectStatisService;
/**
* 窨井盖汇总列表页面
*/
@RequiresPermissions("cv:statis:coverSummary:list")
@RequestMapping(value = {"list", ""})
public String list() {
return "modules/cv/statis/coverSummaryList";
}
/**
* 窨井盖采集统计列表数据
*/
@ResponseBody
@RequiresPermissions("cv:statis:coverSummary:list")
@RequestMapping(value = "data")
public Map<String, Object> data(CoverCollectStatis coverCollectStatis, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<CoverCollectStatis> page = coverCollectStatisService.findSummaryPage(new Page<CoverCollectStatis>(request, response), coverCollectStatis);
return getBootstrapData(page);
}
}
| [
"[email protected]"
] | |
30680d6f0b4dd7de6cb05e215746b0a5972cf3b9 | 1718d541e81f1c61ad76ecef47eb0fbc06eb25a3 | /src/cit/workflow/engine/manager/action/OpenWorkflowInstancesViewAction.java | 78dca93e6131f916adf7ac04d2d22e92a78c0e98 | [] | no_license | Syncret/cit.workflow.engine.manager | 434f207627c24c57afd51a6b3209e5159d5f4e00 | 23b61125e25c9884d4a75aa483b33d55d42b4432 | refs/heads/master | 2021-01-19T08:14:25.571997 | 2020-05-26T03:03:51 | 2020-05-26T03:03:51 | 15,020,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,198 | java | package cit.workflow.engine.manager.action;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import cit.workflow.engine.manager.util.ImageFactory;
public class OpenWorkflowInstancesViewAction extends Action implements IWorkbenchAction{
private final IWorkbenchWindow window;
public static final String ID="cit.workflow.engine.manager.action.openworkflowinstancesviewaction";
private final String viewID=cit.workflow.engine.manager.views.WorkflowInstancesView.ID;
public OpenWorkflowInstancesViewAction(IWorkbenchWindow window){
this.window=window;
this.setText("&Workflow Instances");
setToolTipText("Open Workflow Instances View");
this.setImageDescriptor(ImageFactory.getImageDescriptor(ImageFactory.WORKFLOWSVIEW));
}
public void run(){
if(window!=null){
try{
window.getActivePage().showView(viewID);
}catch(PartInitException e){
MessageDialog.openError(window.getShell(), "Error", "Error opening view:"+e.getMessage());
}
}
}
@Override
public void dispose() {
}
}
| [
"[email protected]"
] | |
41d6b57065d287abd46ddb767267b219b58aa984 | dd648e67a9f0dfecb5424db391e3642703d92639 | /src/entregaFinal/PaymentButton.java | 08dfbc2635c0a7ab3e434717e815158701ed72d0 | [] | no_license | RicardoPoleo/FinalProject | cebc3377d0b378fc22017814f70b356378142972 | 9de5b764eba19e4d03fda16b712b55a736ab9004 | refs/heads/master | 2020-07-09T04:27:16.196477 | 2019-08-22T21:33:34 | 2019-08-22T21:33:34 | 203,876,521 | 0 | 0 | null | 2019-08-22T21:32:18 | 2019-08-22T21:32:18 | null | UTF-8 | Java | false | false | 702 | java | package entregaFinal;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
public class PaymentButton extends PageObject {
private WebElement paymentbutton = driver.findElement(By.xpath("(/html[1]/body[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div[2]/div[1]/form[1]/div[5]/div[1]/input[1])"));
public PaymentButton(WebDriver driver) {
super(driver);
}
public boolean isInitialized() {
wait.until(ExpectedConditions.visibilityOf(paymentbutton));
return this.paymentbutton.isDisplayed();
}
public void PaymentButtonClick(){
this.paymentbutton.click();
}
} | [
"[email protected]"
] | |
e79624d0cb75ff2b3e4b0e2c8c717eb33990c88b | 9254e7279570ac8ef687c416a79bb472146e9b35 | /gpdb-20160503/src/main/java/com/aliyun/gpdb20160503/models/ModifyDBInstanceNetworkTypeResponse.java | 8c2fb4d0ca29f4f8911fb2df57917b06c300f1d3 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.gpdb20160503.models;
import com.aliyun.tea.*;
public class ModifyDBInstanceNetworkTypeResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("body")
@Validation(required = true)
public ModifyDBInstanceNetworkTypeResponseBody body;
public static ModifyDBInstanceNetworkTypeResponse build(java.util.Map<String, ?> map) throws Exception {
ModifyDBInstanceNetworkTypeResponse self = new ModifyDBInstanceNetworkTypeResponse();
return TeaModel.build(map, self);
}
public ModifyDBInstanceNetworkTypeResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public ModifyDBInstanceNetworkTypeResponse setBody(ModifyDBInstanceNetworkTypeResponseBody body) {
this.body = body;
return this;
}
public ModifyDBInstanceNetworkTypeResponseBody getBody() {
return this.body;
}
}
| [
"[email protected]"
] | |
1e8130be79a36b560e2fdb4fa3650ae31353ba89 | baf03272774e32a60a3b21817400d57d1347068d | /src/_26Inheritance/B.java | 0858fc3d75cf02ca787f1f34c7650485782ac67f | [] | no_license | Arasefe/OCAPREP | 8e22c1df09efcdad1d8ab6a09c63d4a5058cf81e | f0a411d508b8ad93a9b8ac2b414f99c79ce8005d | refs/heads/master | 2022-10-21T14:51:16.594373 | 2020-06-08T21:56:24 | 2020-06-08T21:56:24 | 270,837,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package _26Inheritance;
public class B extends A {
public void print() {
A obj = new A();
System.out.println(obj.i1); //Line 8
System.out.println(i2); //Line 9 System.out.println(obj.i2); causes compilation error
System.out.println(this.i2); //Line 10
System.out.println(super.i2); //Line 11
}
public static void main(String [] args) {
new B().print();
}
}
| [
"[email protected]"
] | |
cc9b952ff57b71ffe240751b288291b7851e1038 | c927e81cf94c84e2ef8ecd265d15363aa05ff420 | /app/src/main/java/gcg/testproject/activity/selectdate/SelectDateActivity.java | 3cfde39dcd3a4d510ea6bcbb08a646886940a802 | [] | no_license | chenxiaoliMira/AndroidExample | 277b28dc5f6a67c6b4d14cbd5cdcf3e3868e5946 | cbe250c9eefc23edcf3fd5fb94497ced0e126ee5 | refs/heads/master | 2020-03-28T10:39:37.095830 | 2018-09-11T01:05:36 | 2018-09-11T01:05:36 | 148,131,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,599 | java | package gcg.testproject.activity.selectdate;
import android.icu.util.Calendar;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.util.Log;
import android.view.View;
import android.widget.DatePicker;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
import gcg.testproject.R;
import gcg.testproject.base.BaseActivity;
/**
* 日期选择器
*
* @ClassName:SelectDateActivity
* @PackageName:gcg.testproject.activity.selectdate
* @Create On 2018/1/15 14:48
* @Site:http://www.handongkeji.com
* @author:gongchenghao
* @Copyrights 2018/1/15 handongkeji All rights reserved.
*/
public class SelectDateActivity extends BaseActivity implements View.OnClickListener{
@Bind(R.id.tv_start_time)
TextView tvStartTime;
@Bind(R.id.tv_end_time)
TextView tvEndTime;
private Calendar c;
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_date);
ButterKnife.bind(this);
initClickEvent(); //初始化控件的点击事件
c = Calendar.getInstance();
}
private void initClickEvent() {
tvStartTime.setOnClickListener(this);
tvEndTime.setOnClickListener(this);
}
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onClick(View view) {
switch (view.getId())
{
case R.id.tv_start_time:
showDateDialog();
break;
case R.id.tv_end_time:
showDateDialog();
break;
}
}
@RequiresApi(api = Build.VERSION_CODES.N)
private void showDateDialog() {
new DoubleDatePickerDialog(SelectDateActivity.this, 0, new DoubleDatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker startDatePicker,
int startYear, int startMonthOfYear, int startDayOfMonth,
DatePicker endDatePicker,
int endYear, int endMonthOfYear, int endDayOfMonth) {
tvStartTime.setText(startYear+"-"+(startMonthOfYear + 1)+"-"+startDayOfMonth);
tvEndTime.setText(endYear+"-"+(endMonthOfYear + 1)+"-"+endDayOfMonth);
}
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE), true).show(); //最后一个参数传true,表示可以显示日
}
}
| [
"[email protected]"
] | |
e6f30d17df8cae4496a7350a15072b12ba709e30 | 64a2beabdc4edaf7f3b22a5430a710b63e4ff2bc | /src/main/java/com/meenu/codingskills/algorithms/SelectionSort.java | f5133fc25b80aa2a1f1ab458f71b0f49cf701330 | [] | no_license | MeenuVNair/CodingSkills | 338cea55e52fc1db7927463f5cdbf25374c2eab5 | 28da48e9841e61f2c7eb5f51fb39c6e7fdf7aaf3 | refs/heads/master | 2022-12-24T11:35:45.806566 | 2020-08-06T12:30:15 | 2020-08-06T12:30:15 | 254,673,841 | 0 | 0 | null | 2020-10-13T21:05:03 | 2020-04-10T15:48:08 | Java | UTF-8 | Java | false | false | 708 | java | package com.meenu.codingskills.algorithms;
/**
* @author Meenu V Nair
*
* Creation time: Apr 24, 2020 9:38:03 PM
*
*/
public class SelectionSort {
private void selectionSort(int[] arr) {
int n = arr.length;
for(int i = 0; i < n - 1; i++) {
int minIndex = i;
for(int j = i + 1; j < n; j++) {
if(arr[j] < arr[minIndex]) {
minIndex = j;
}
}
int temp = arr[i];
arr[i] = arr[minIndex];
arr[minIndex] = temp;
}
}
public void findSolution() {
int arr[] = {12, 11, 13, 5, 6, 7};
printArray(arr);
selectionSort(arr);
printArray(arr);
}
private void printArray(int[] arr) {
for(int i : arr) {
System.out.print(i + " ");
}
System.out.println();
}
}
| [
"[email protected]"
] | |
6a26e191c01369faf015d13e2cf53180cccd379e | 2bd7a5899912b6215ba6c813e59abe4e08126336 | /Es2_1_JDBC/src.main.java/it/polito/ai/es2/ReadJson.java | 24aeba9c4af9108cb5c8eb6d60a24629d2fad052 | [] | no_license | jaime9510/Es2_MappaTrasportoTorino | 7ccfdb67886b8ed53a4b0c5035a0aa2da102b9f7 | 755bf843e5ec74f0f14e4d4204ac1a773074f37c | refs/heads/master | 2021-03-27T11:46:16.737709 | 2017-04-12T21:57:05 | 2017-04-12T21:57:05 | 87,852,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,384 | java | package it.polito.ai.es2;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import it.polito.ai.es2.model.Linea;
import it.polito.ai.es2.model.LineeFermate;
import it.polito.ai.es2.model.Stop;
public class ReadJson {
public LineeFermate read() {
ObjectMapper mapper = new ObjectMapper();
LineeFermate lineeFermate = new LineeFermate();
List<Linea> listLine = new ArrayList<Linea>();
List<Stop> listStop = new ArrayList<Stop>();
try {
JsonNode root = mapper.readTree(new File("./src/main/resources/linee.json"));
JsonNode lines = root.get("lines");
JsonNode stops = root.get("stops");
for (JsonNode line : lines) {
Linea linea = mapper.treeToValue(line, Linea.class);
listLine.add(linea);
}
lineeFermate.setLinee(listLine);
for (JsonNode s : stops) {
Stop stop = mapper.treeToValue(s, Stop.class);
listStop.add(stop);
}
lineeFermate.setStops(listStop);
} catch (JsonGenerationException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return lineeFermate;
}
}
| [
"[email protected]"
] | |
23b2660084dde82fb695df27e5c8b0f248f09ea8 | 1e903af4698e642c7f75e97eeec8f219cca928c3 | /src/Demo_1/Str_2.java | 3b652c513a99e02a71826ac1c7f08bda1f10c658 | [] | no_license | skirandr/Lambo | 59028bac43838965b1d487b2bdc480854e4d520a | a6e9d4bfba5dcf46047370c51b61eb702018566a | refs/heads/master | 2022-11-16T22:35:39.700078 | 2020-07-14T16:45:21 | 2020-07-14T16:45:21 | 279,638,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package Demo_1;
public class Str_2 {
public static void main(String[] args) {
System.out.println("hi_!");
}
}
| [
"shashi@HP-PC"
] | shashi@HP-PC |
1fdc4b4268f37b5035849f02af09ed8f16395223 | 59e4596f07b00a69feabb1fb119619aa58964dd4 | /StsTool.v.1.3.3/eu.aniketos.wp1.ststool.commitments/src/eu/aniketos/wp1/ststool/commitments/model/DelegationCommitment/TrustworthinessCommitment.java | 2c9b96134ec59c3320eef027381e79af2fc6ac94 | [] | no_license | AniketosEU/Socio-technical-Security-Requirements | 895bac6785af1a40cb55afa9cb3dd73f83f8011f | 7ce04c023af6c3e77fa4741734da7edac103c875 | refs/heads/master | 2018-12-31T17:08:39.594985 | 2014-02-21T14:36:14 | 2014-02-21T14:36:14 | 15,801,803 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,358 | java | /*
* TrustworthinessCommitment.java
*
* This file is part of the STS-Tool project.
* Copyright (c) 2011-2012 "University of Trento - DISI" All rights reserved.
*
* Is strictly forbidden to remove this copyright notice from this source code.
*
* Disclaimer of Warranty:
* STS-Tool (this software) is provided "as-is" and without warranty of any kind,
* express, implied or otherwise, including without limitation, any warranty of
* merchantability or fitness for a particular purpose.
* In no event shall the copyright holder or contributors be liable for any direct,
* indirect, incidental, special, exemplary, or consequential damages
* including, but not limited to, procurement of substitute goods or services;
* loss of use, data, or profits; or business interruption) however caused and on
* any theory of liability, whether in contract, strict liability, or tort (including
* negligence or otherwise) arising in any way out of the use of this software, even
* if advised of the possibility of such damage.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3
* as published by the Free Software Foundation with the addition of the
* following permission added to Section 15 as permitted in Section 7(a):
* FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
* "University of Trento - DISI","University of Trento - DISI" DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, see http://www.gnu.org/licenses or write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA, 02110-1301 USA, or download the license from the following URL:
* http://www.sts-tool.eu/License.php
*
* For more information, please contact STS-Tool group at this
* address: [email protected]
*
*/
package eu.aniketos.wp1.ststool.commitments.model.DelegationCommitment;
import eu.aniketos.wp1.ststool.Delegation;
public class TrustworthinessCommitment extends AbstractDelegationCommitment {
public TrustworthinessCommitment(Delegation delegation, int index) {
super(delegation, index);
}
@Override
public String getRequester(){
if (delegation.getSource() == null || delegation.getSource().getName() == null)
return "Unknwon";
else
return delegation.getSource().getName();
}
@Override
public String getResponsible(){
if (delegation.getSource() == null || delegation.getSource().getName() == null)
return "Unknwon";
else
return delegation.getSource().getName();
}
@Override
public String getReqisite(){
return "delegatedTo(" + getDelegation().getTarget().getName() + ",trustworthiness level " + getDelegation().getTrustworthinessValue() + ")";
}
@Override
public String getDescritption(){
return getResponsible() + " will delegate goal "+getDelegation().getSourceGoal().getName()+", only to " + getDelegation().getTarget().getName() + " that have trustwhorthiness level grater than " + getDelegation().getTrustworthinessValue();
}
@Override
public String securityNeedName(){
return "trustworthiness";
}
}
| [
"[email protected]"
] | |
24c5cb188e41bb448b2187681f93245dc76876ff | 0e2f7a18e7f4bc4cd0e031c8dc9dd782929a5cae | /app/src/main/java/com/xbx/client/ui/activity/LoginActivity.java | c1ea6239f780aff99da7f2122e3a2d807b187873 | [] | no_license | baletree/XbxClient | 597be14023fe08bfc1c1fde94f2e684def5b9338 | a1865ca84b8d16818696d332b88dd3eadc9236a3 | refs/heads/master | 2021-06-01T19:30:41.947431 | 2016-05-23T10:07:52 | 2016-05-23T10:07:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,033 | java | package com.xbx.client.ui.activity;
import android.content.Intent;
import android.graphics.Paint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.content.LocalBroadcastManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.xbx.client.R;
import com.xbx.client.beans.UserInfo;
import com.xbx.client.http.IRequest;
import com.xbx.client.http.RequestParams;
import com.xbx.client.jsonparse.UtilParse;
import com.xbx.client.jsonparse.UserInfoParse;
import com.xbx.client.linsener.RequestBackLisener;
import com.xbx.client.utils.Constant;
import com.xbx.client.utils.SharePrefer;
import com.xbx.client.utils.Util;
import cn.jpush.android.api.JPushInterface;
/**
* Created by EricYuan on 2016/3/29.
*/
public class LoginActivity extends BaseActivity {
private TextView title_txt_tv;
private TextView login_agreepact_tv;
private EditText login_phone_et;
private EditText login_code_et;
private Button login_btn;
private Button login_code_btn;
private LocalBroadcastManager lBManager = null;
private int countDown = 60;
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 1:
if (countDown > 0) {
countDown--;
login_code_btn.setText(countDown + getString(R.string.login_code_minute));
handler.sendEmptyMessageDelayed(1, 1000);
} else {
login_code_btn.setText(getString(R.string.login_code_get));
login_code_btn.setClickable(true);
login_code_btn.setBackgroundResource(R.drawable.button_bg);
}
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Util.pLog("JPushId:" + JPushInterface.getRegistrationID(this));
}
@Override
protected void initDatas() {
super.initDatas();
lBManager = LocalBroadcastManager.getInstance(this);
}
@Override
protected void initViews() {
super.initViews();
title_txt_tv = (TextView) findViewById(R.id.title_txt_tv);
login_agreepact_tv = (TextView) findViewById(R.id.login_agreepact_tv);
login_btn = (Button) findViewById(R.id.login_btn);
login_code_btn = (Button) findViewById(R.id.login_code_btn);
login_phone_et = (EditText) findViewById(R.id.login_phone_et);
login_code_et = (EditText) findViewById(R.id.login_code_et);
findViewById(R.id.title_left_img).setOnClickListener(this);
title_txt_tv.setText(R.string.login_title);
login_agreepact_tv.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//下划线
login_btn.setOnClickListener(this);
login_code_btn.setOnClickListener(this);
String userPhone = SharePrefer.getUserPhone(LoginActivity.this);
if (!Util.isNull(userPhone)) {
Util.pLog("LoginInput:" + userPhone);
login_phone_et.setText(userPhone);
login_phone_et.setSelection(userPhone.length());
}
}
@Override
public void onClick(View v) {
super.onClick(v);
/* login_phone_et.setText("18602854129");
login_code_et.setText("147248");*/
String phone = login_phone_et.getText().toString();
String code = login_code_et.getText().toString();
switch (v.getId()) {
case R.id.login_btn:
if (Util.isNull(phone)) {
Util.showToast(LoginActivity.this, getString(R.string.phone_tips));
return;
}
if (Util.isNull(code)) {
Util.showToast(LoginActivity.this, getString(R.string.code_tips));
return;
}
// startActivity(new Intent(LoginActivity.this, MainActivity.class));
toLogin(phone, code);
break;
case R.id.login_code_btn:
if (Util.isNull(phone)) {
Util.showToast(LoginActivity.this, getString(R.string.phone_tips));
return;
}
if (!Util.checkTel(phone)) {
Util.showToast(LoginActivity.this, getString(R.string.phone_check));
return;
}
getCode(phone);
break;
case R.id.title_left_img:
finish();
break;
}
}
private void getCode(final String phone) {
String postUrl = getString(R.string.url_conIp).concat(getString(R.string.url_getCode));
RequestParams params = new RequestParams();
params.put("mobile", phone);
SharePrefer.savePhone(LoginActivity.this, phone);
IRequest.post(this, postUrl, params, "", new RequestBackLisener(LoginActivity.this) {
@Override
public void requestSuccess(String json) {
Util.pLog("getCode Result=" + json);
if (UtilParse.getRequestCode(json) == 1) {
countDown = 60;
login_code_btn.setBackgroundResource(R.drawable.button_code_bg);
login_code_btn.setClickable(false);
handler.sendEmptyMessage(1);
}
Util.showToast(LoginActivity.this, UtilParse.getRequestMsg(json));
}
});
}
private void toLogin(String phone, String code) {
String postUrl = getString(R.string.url_conIp).concat(getString(R.string.url_Login));
final String pushId = JPushInterface.getRegistrationID(this);
RequestParams params = new RequestParams();
params.put("mobile", phone);
params.put("password", code);
params.put("push_id", pushId);//代表用户端
params.inputParams();
IRequest.post(this, postUrl, params, "", new RequestBackLisener(LoginActivity.this) {
@Override
public void requestSuccess(String json) {
Util.pLog("Login Result=" + json + "\npushId:" + pushId);
if (UtilParse.getRequestCode(json) == 1) {
UserInfo userInfo = UserInfoParse.getUserInfo(UtilParse.getRequestData(json));
if (userInfo != null) {
SharePrefer.saveUserInfo(LoginActivity.this, userInfo);
lBManager.sendBroadcast(new Intent(Constant.ACTION_LOGINSUC));
finish();
}
} else {
Util.showToast(LoginActivity.this, UtilParse.getRequestMsg(json));
}
}
});
}
}
| [
"[email protected]"
] | |
1c2ad507d243f8a2d504f452de7eec26c0bf4012 | bdc77caea64e0851a08bde5cb3e44e72e82a12a7 | /lab2/src/Account.java | a4e5b2e3a76e4af3c59ef9b1eab2ca2a70dd5557 | [] | no_license | Abenezer2008/CS-525 | 8b311872fa34d85dd922dece0a5af6ea897703ee | 90c38d057779c055fa7247ea1e55bbb693a8fc22 | refs/heads/main | 2023-05-30T08:24:24.490600 | 2021-06-25T19:16:27 | 2021-06-25T19:16:27 | 380,331,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,606 | java | import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class Account {
private Customer customer;
private String accountNumber;
private List<AccountEntry> entryList = new ArrayList<AccountEntry>();
public Account(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public double getBalance() {
double balance = 0;
for (AccountEntry entry : entryList) {
balance += entry.getAmount();
}
return balance;
}
public void deposit(double amount) {
AccountEntry entry = new AccountEntry(amount, "deposit", "", "");
entryList.add(entry);
}
public void withdraw(double amount) {
AccountEntry entry = new AccountEntry(-amount, "withdraw", "", "");
entryList.add(entry);
}
private void addEntry(AccountEntry entry) {
entryList.add(entry);
}
public void transferFunds(Account toAccount, double amount, String description) {
AccountEntry fromEntry = new AccountEntry(-amount, description, toAccount.getAccountNumber(),
toAccount.getCustomer().getName());
AccountEntry toEntry = new AccountEntry(amount, description, toAccount.getAccountNumber(),
toAccount.getCustomer().getName());
entryList.add(fromEntry);
toAccount.addEntry(toEntry);
}
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public Collection<AccountEntry> getEntryList() {
return entryList;
}
}
| [
"[email protected]"
] | |
01d598e38b5fb5ceb438eee7ad6eb0209f6a8921 | 2db3391efdeaeb8756540277ae5a039ad6915311 | /src/com/klasser/person.java | 9586720a758a2acb496ab900ef428707530b7453 | [] | no_license | heimgun/ContactList | 77d5f8d4ddacec977fb6213fb65d695a8da88bf0 | 48e3b3dde130e262c452d6f5cf8e845741937639 | refs/heads/master | 2020-07-27T09:21:31.666169 | 2019-09-18T08:26:10 | 2019-09-18T08:26:10 | 209,044,133 | 0 | 1 | null | 2019-09-18T08:22:05 | 2019-09-17T12:11:00 | Java | UTF-8 | Java | false | false | 318 | java | package com.klasser;
public class person {
public String navn;
public String alder;
public String tele;
public String epost;
public String personInfo(){
String text = "Navn: "+navn+"\n" + "Alder: "+alder+"\n"+ "Telefonnr.: "+tele+"\n"+"E-post: "+epost+"\n";
return text;
}
}
| [
"[email protected]"
] | |
ff381482593f00d2362863cb3739e8ab70e211a3 | e23b2224eff572098c3c319681b8caabed5b5335 | /app/src/main/java/com/spencerstudios/admincenter/Models/Member.java | c1bccb17f4685dd3a23d5a7aeda070b32110c0e5 | [] | no_license | Binary-Finery/AdminCenter | 47487902e4b34105f2dedae1e46f4a4920bed9b7 | 344880b935e592e1acff8c46162e65c8b8caa089 | refs/heads/master | 2020-03-12T02:40:01.241688 | 2018-04-26T19:27:20 | 2018-04-26T19:27:20 | 130,408,247 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,090 | java | package com.spencerstudios.admincenter.Models;
public class Member {
public String name;
private String reason;
private String author;
private long timeStamp;
private boolean isBanned;
private String id;
public Member() {
/*empty constructor*/
}
public Member(String name, String reason, String author, long timeStamp, boolean isBanned, String id) {
this.name = name;
this.reason = reason;
this.author = author;
this.timeStamp = timeStamp;
this.isBanned = isBanned;
this.id = id;
}
public String getName() {
return name;
}
public String getReason() {
return reason;
}
public String getAuthor() {
return author;
}
public long getTimeStamp() {
return timeStamp;
}
public boolean isBanned() {
return isBanned;
}
public void setBanned(boolean banned) {
isBanned = banned;
}
public String getId(){
return id;
}
public void setId(String id){
this.id = id;
}
}
| [
"[email protected]"
] | |
5fb7cd1151f106ba09e9a3f204d5cef0e3fffd60 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Math-10/org.apache.commons.math3.analysis.differentiation.DSCompiler/BBC-F0-opt-70/25/org/apache/commons/math3/analysis/differentiation/DSCompiler_ESTest_scaffolding.java | 998e47e53d1804f0fd589061f59ca910434409d8 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 5,809 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Oct 23 19:06:14 GMT 2021
*/
package org.apache.commons.math3.analysis.differentiation;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class DSCompiler_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math3.analysis.differentiation.DSCompiler";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
/*No java.lang.System property to set*/
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DSCompiler_ESTest_scaffolding.class.getClassLoader() ,
"org.apache.commons.math3.exception.util.ExceptionContextProvider",
"org.apache.commons.math3.util.MathArrays",
"org.apache.commons.math3.exception.util.ArgUtils",
"org.apache.commons.math3.exception.MathArithmeticException",
"org.apache.commons.math3.exception.NumberIsTooSmallException",
"org.apache.commons.math3.util.FastMath$ExpIntTable",
"org.apache.commons.math3.util.FastMath$lnMant",
"org.apache.commons.math3.exception.NotPositiveException",
"org.apache.commons.math3.exception.MathInternalError",
"org.apache.commons.math3.exception.MathIllegalStateException",
"org.apache.commons.math3.analysis.differentiation.DSCompiler",
"org.apache.commons.math3.util.FastMath$ExpFracTable",
"org.apache.commons.math3.exception.NonMonotonicSequenceException",
"org.apache.commons.math3.exception.MathIllegalArgumentException",
"org.apache.commons.math3.exception.MathIllegalNumberException",
"org.apache.commons.math3.exception.util.LocalizedFormats",
"org.apache.commons.math3.util.FastMath",
"org.apache.commons.math3.exception.DimensionMismatchException",
"org.apache.commons.math3.exception.util.Localizable",
"org.apache.commons.math3.exception.NumberIsTooLargeException",
"org.apache.commons.math3.exception.NotStrictlyPositiveException",
"org.apache.commons.math3.exception.util.ExceptionContext",
"org.apache.commons.math3.util.ArithmeticUtils",
"org.apache.commons.math3.exception.NullArgumentException",
"org.apache.commons.math3.util.FastMathLiteralArrays"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(DSCompiler_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.apache.commons.math3.analysis.differentiation.DSCompiler",
"org.apache.commons.math3.util.FastMath",
"org.apache.commons.math3.util.FastMathLiteralArrays",
"org.apache.commons.math3.util.FastMath$lnMant",
"org.apache.commons.math3.util.FastMath$ExpIntTable",
"org.apache.commons.math3.util.FastMath$ExpFracTable",
"org.apache.commons.math3.util.Precision",
"org.apache.commons.math3.exception.util.LocalizedFormats",
"org.apache.commons.math3.util.ArithmeticUtils",
"org.apache.commons.math3.util.FastMath$CodyWaite",
"org.apache.commons.math3.exception.MathIllegalArgumentException",
"org.apache.commons.math3.exception.MathIllegalNumberException",
"org.apache.commons.math3.exception.DimensionMismatchException",
"org.apache.commons.math3.exception.util.ExceptionContext",
"org.apache.commons.math3.exception.util.ArgUtils",
"org.apache.commons.math3.util.MathArrays",
"org.apache.commons.math3.exception.NumberIsTooLargeException"
);
}
}
| [
"[email protected]"
] | |
47b7de0a205cfec518a1eb9dabad9dedcd9aabea | 2b462bcd6aa9b4776d6996d29c1927650168fb7a | /src/main/java/com/uber/cadence/workflow/CompletablePromise.java | 2a454a3bd2854c3539551e720d9fdf1c6b175255 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | uber/cadence-java-client | 4ee742873cd08e480d917496d6a1ef32f96ad9a1 | 8f153cfd26300fbccd75e61d8a4515b73978b4b1 | refs/heads/master | 2023-09-04T04:37:12.526205 | 2023-08-28T20:06:19 | 2023-08-28T20:06:19 | 113,889,550 | 126 | 105 | NOASSERTION | 2023-08-31T20:53:43 | 2017-12-11T17:42:08 | Java | UTF-8 | Java | false | false | 1,820 | java | /*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* 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.uber.cadence.workflow;
/** {@link Promise} that exposes completion methods. */
public interface CompletablePromise<V> extends Promise<V> {
/**
* Completes this Promise with a value if not yet done.
*
* @return true if wasn't already completed.
*/
boolean complete(V value);
/**
* Completes this Promise with a an exception if not yet done.
*
* @return true if wasn't already completed.
*/
boolean completeExceptionally(RuntimeException value);
/**
* Completes or completes exceptionally this promise from the source promise when it becomes
* completed.
*
* <pre><code>
* destination.completeFrom(source);
* </code></pre>
*
* Is shortcut to:
*
* <pre><code>
* source.handle((value, failure) -> {
* if (failure != null) {
* destination.completeExceptionally(failure);
* } else {
* destination.complete(value);
* }
* return null;
* }
* </code></pre>
*
* @param source promise that is being watched.
* @return false if source already completed, otherwise return true or null
*/
boolean completeFrom(Promise<V> source);
}
| [
"[email protected]"
] | |
6b6772200b99ded27e04940f044efc8fc37386d0 | da8886e63c3da46694b97aaa5cf888553f81b242 | /src/main/java/team/union/sys_sp/twotabrel/vo/TwoTabRelWeb.java | 6486e7cbc680f342e2f99f9103d4e50494778ef6 | [] | no_license | dcxsIntegartion/integration | 474bb06eeffc70e0e40b65518beb906f0a8491d5 | 69bd1b627afff3c6ed5745cbdca314782926f804 | refs/heads/master | 2021-01-19T21:01:37.126874 | 2018-06-13T07:47:37 | 2018-06-13T07:47:37 | 88,593,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package team.union.sys_sp.twotabrel.vo;
public class TwoTabRelWeb {
/** 当前业务已经使用颜色 **/
private String[] colers;
/** 当前业务已经使用颜色对应的业务id **/
private String[] mainIds;
public String[] getColers() {
return colers;
}
public void setColers(String[] colers) {
this.colers = colers;
}
public String[] getMainIds() {
return mainIds;
}
public void setMainIds(String[] mainIds) {
this.mainIds = mainIds;
}
}
| [
"[email protected]"
] | |
1f17c3c6bc656439af1c23625c15e2b56218fd7a | bde682a9933140140f1712e066c23160b23ada5b | /hibernate-examples/src/test/java/org/hibernate/examples/mapping/inheritance/joinedsubclass/Person.java | c3d22e94be5d258d19c2853f9423ed4267b51a45 | [
"Apache-2.0"
] | permissive | egorpe/hibernate-redis | 8f378df180b61176b137b48b9e1d06ec057e0ac3 | 40c4b23f7b1911508420e29682277ebecd8387bf | refs/heads/master | 2020-04-06T03:52:57.794524 | 2014-01-01T06:21:30 | 2014-01-01T06:21:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,657 | java | package org.hibernate.examples.mapping.inheritance.joinedsubclass;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.examples.model.AbstractHibernateEntity;
import org.hibernate.examples.utils.HashTool;
import org.hibernate.examples.utils.ToStringHelper;
import javax.persistence.*;
/**
* org.hibernate.examples.mapping.inheritance.joinedsubclass.Person
*
* @author 배성혁 [email protected]
* @since 2013. 11. 30. 오후 12:54
*/
@Entity
@Table(name = "JoinedSubclass_Person")
@org.hibernate.annotations.Cache(region = "examples", usage = CacheConcurrencyStrategy.READ_WRITE)
@Inheritance(strategy = InheritanceType.JOINED)
@DynamicInsert
@DynamicUpdate
@Getter
@Setter
public abstract class Person extends AbstractHibernateEntity<Long> {
@Id
@GeneratedValue
@Column(name = "personId")
@Setter(AccessLevel.PROTECTED)
private Long id;
@Column(name = "personName", nullable = false, length = 128)
private String name;
@Column(name = "regidentNo", nullable = false, length = 128)
private String regidentNo;
private Integer age;
@Override
public int hashCode() {
return HashTool.compute(name, regidentNo);
}
@Override
public ToStringHelper buildStringHelper() {
return super.buildStringHelper()
.add("name", name)
.add("regidentNo", regidentNo);
}
private static final long serialVersionUID = 823321933233116966L;
}
| [
"[email protected]"
] | |
0eb08fc14a84405bf11c6daef469923a5fbbbbba | 04ed4181ce0c61295f8fc3af99905aa3cba7c5f5 | /app/src/main/java/ps/gov/mtit/govqr/LoginActivity.java | 5d6894f448db594581bedc716798931646f43193 | [] | no_license | cryptobuks1/GovQR | 1cef6c872125ff14dac1c3d96d4d4d6456cf64d1 | f620a389f05dab96de395b6dad15b755a003c511 | refs/heads/master | 2021-01-08T07:57:01.138792 | 2019-12-24T10:05:24 | 2019-12-24T10:05:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,501 | java | package ps.gov.mtit.govqr;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.StringRequest;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
import ps.gov.mtit.govqr.utils.PrefsUtils;
public class LoginActivity extends AppCompatActivity {
public static String TAG = "SSOLOGIN";
EditText txtUser, txtPw;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
txtUser = findViewById(R.id.userEditText);
txtPw = findViewById(R.id.pwEditText);
}
private void ssoLogin(final String user, final String pw) {
final ProgressDialog pd = ProgressDialog.show(this, getString(R.string.app_name), "جاري تسجيل الدخول");
StringRequest request = new StringRequest(Request.Method.POST, AppZone.TOKEN_URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
pd.dismiss();
Log.d(TAG, "response : " + response);
try {
JSONObject obj = new JSONObject(response.substring(response.indexOf("{")));
if (obj.getString("status").equalsIgnoreCase("success")) {
PrefsUtils.saveToken(LoginActivity.this, obj.getString("access_token"));
PrefsUtils.saveRefreshToken(LoginActivity.this, obj.getString("refresh_token"));
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
finish();
//checkPermissionRequest(obj.getString("access_token"), obj.getString("refresh_token"));
} else {
Toast.makeText(LoginActivity.this, obj.getString("message"), Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
pd.dismiss();
Log.d(TAG, "error : " + error.toString());
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("client_id", AppZone.SSO_CLIENTID);
params.put("client_secret", AppZone.SSO_SECRET);
params.put("username", user);
params.put("password", pw);
Log.d(TAG, "params : " + params.toString());
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<String, String>();
//headers.put("Authorization", reqHeader);
// headers.put("Content-Type","application/x-www-form-urlencoded");
Log.d(TAG, "headers : " + headers.toString());
return headers;
}
};
// add the request object to the queue to be executed
MyRequestQueue.getInstance(this).getRequestQueue().add(request);
}
private void checkPermissionRequest(final String token, final String refresh_token) {
final ProgressDialog pd = ProgressDialog.show(this, getString(R.string.app_name), "");
String url = AppZone.BASE_URL + "/GET_SUPERMARKET_USER_PR";
Log.d(TAG, "Url : " + url);
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
pd.dismiss();
Log.d(TAG, "Response : " + response.toString());
try {
if (response.getString("status").equalsIgnoreCase("success")) {
PrefsUtils.saveToken(LoginActivity.this, token);
PrefsUtils.saveRefreshToken(LoginActivity.this, refresh_token);
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
finish();
} else {
Toast.makeText(LoginActivity.this, response.getString("message"), Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
pd.dismiss();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("x-sso-authorization", token);
Log.d(TAG, "headers : " + headers.toString());
return headers;
}
};
MyRequestQueue.getInstance(this).getRequestQueue().add(request);
}
public void login(View view) {
if (!txtUser.getText().toString().isEmpty() && !txtPw.getText().toString().isEmpty()) {
//ssoLogin(txtUser.getText().toString(), AppZone.passMd5Encryption(txtPw.getText().toString()));
ssoLogin(txtUser.getText().toString(), AppZone.passMd5Encryption(txtPw.getText().toString()));
} else {
Toast.makeText(this, "أدخل اسم المستخدم وكلمة المرور", Toast.LENGTH_SHORT).show();
}
}
public void forgetPassword(View view) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://elogin.gov.ps/new/forgotPasswordNew")));
}
}
| [
"[email protected]"
] | |
b58c61aada5e5d1549604289a73085dc925a25a7 | 1b0ec3416150da9654bc3651be0386eec81d6bdd | /app/src/main/java/com/example/project/easyshopping/AddGoods.java | 315126ea01b5ef06de4cbb910fcd8276ded1a1f5 | [] | no_license | xkyyxj/summer_yunshangdian | 85606c15b799de06022d77a1675961ee36789587 | 8cf975c96270e8f3d8bd07777b8f1f93cf78d97a | refs/heads/master | 2020-05-17T00:09:00.349333 | 2015-08-04T02:39:46 | 2015-08-04T02:39:46 | 40,158,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,035 | java | package com.example.project.easyshopping;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.bmob.BTPFileResponse;
import com.bmob.BmobProFile;
import com.bmob.btp.callback.DownloadListener;
import com.bmob.btp.callback.UploadListener;
import com.example.project.easyshopping.data.ShopG;
import com.test.albert.myapplication.R;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
import cn.bmob.v3.listener.SaveListener;
/**
* Created by acer on 2015/7/13.
*/
public class AddGoods extends Activity {
//图片处理的类变量
private String file_path = null, pro_file_path = null, pic_name;
private FileOutputStream out = null;
private Bitmap pic_bt = null;
//两个类对象
private ShopG mShopG = null;
private ShopG new_mShopG = null;
private static final int IMAGE_REQUEST_CODE = 0;
private static final int CAMERA_REQUEST_CODE = 1;
private static final int RESULT_REQUEST_CODE = 2;
public static final String IMAGE_FILE_NAME = "temp_file";
private static final String PROPERTY_FILE_NAME = "user_info.xml";
private LinearLayout ll1;
private ImageButton back;
private TextView textView0;
private RelativeLayout rl1;
private LinearLayout ll2;
private EditText etBarcode;
private ImageButton ibScan;
private ImageButton ibPic;
private ImageButton ibUpload;
private LinearLayout ll3;
private LinearLayout ll4;
private TextView tvName;
private EditText dtName;
private LinearLayout ll5;
private TextView tvDescribe;
private EditText dtDescribe;
private LinearLayout ll6;
private TextView tvPrice;
private EditText dtPrice;
private LinearLayout ll7;
private TextView tvCat;
private Spinner spinner;
private Button submit;
private static String ShopName;
private void assignViews() {
ll1 = (LinearLayout) findViewById(R.id.ll1);
back = (ImageButton) findViewById(R.id.back);
textView0 = (TextView) findViewById(R.id.textView0);
rl1 = (RelativeLayout) findViewById(R.id.rl1);
ll2 = (LinearLayout) findViewById(R.id.ll2);
etBarcode = (EditText) findViewById(R.id.et_barcode);
ibScan = (ImageButton) findViewById(R.id.ib_scan);
ibPic = (ImageButton) findViewById(R.id.ib_pic);
ibUpload = (ImageButton) findViewById(R.id.ib_upload);
ll3 = (LinearLayout) findViewById(R.id.ll3);
ll4 = (LinearLayout) findViewById(R.id.ll4);
tvName = (TextView) findViewById(R.id.tv_name);
dtName = (EditText) findViewById(R.id.dt_name);
ll5 = (LinearLayout) findViewById(R.id.ll5);
tvDescribe = (TextView) findViewById(R.id.tv_describe);
dtDescribe = (EditText) findViewById(R.id.dt_describe);
ll6 = (LinearLayout) findViewById(R.id.ll6);
tvPrice = (TextView) findViewById(R.id.tv_price);
dtPrice = (EditText) findViewById(R.id.dt_price);
ll7 = (LinearLayout) findViewById(R.id.ll7);
tvCat = (TextView) findViewById(R.id.tv_cat);
spinner = (Spinner) findViewById(R.id.spinner);
submit = (Button) findViewById(R.id.submit);
}
private ArrayAdapter<String> mAdapter;
private static String[] cat;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.addgoods);
assignViews();
Intent intent = getIntent();
ShopName = intent.getStringExtra("shopname");
Log.e("AddGoods里的onCreat()方法", "里得到的ShopName是" + ShopName);
file_path = getFilesDir().getPath() + ShopName + ".png";
pro_file_path = getFilesDir().getPath() + "/" + PROPERTY_FILE_NAME;
mShopG=new ShopG();
new_mShopG=new ShopG();
loadpic();
initSpinner();
initButton();
}
private void initSpinner() {
cat = new String[]{"请选择类别", "日用品", "水果", "零食"};
mAdapter = new ArrayAdapter<String>(this, R.layout.drop_down_item, cat);
spinner.setAdapter(mAdapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Log.v("AddGoods", "spinner选择了第" + position + "个item");
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
private void initButton() {
ibPic.setOnClickListener(new EditGoodsPicClickListener());
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
update();
}
});
}
class EditGoodsPicClickListener implements View.OnClickListener {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog();
}
}
/**
* 弹出选择图片进行上传的dialog
*/
private void showDialog() {
new AlertDialog.Builder(this)
.setTitle(R.string.activity_edit_user_info_pic_source_cho)
.setItems(R.array.face_image_choice_item,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case 0:
Intent intentFromGallery = new Intent();
intentFromGallery.setType("image/*");
intentFromGallery
.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intentFromGallery,
IMAGE_REQUEST_CODE);
break;
case 1:
Intent intentFromCapture = new Intent(
MediaStore.ACTION_IMAGE_CAPTURE);
if (hasSdcard()) {
intentFromCapture.putExtra(
MediaStore.EXTRA_OUTPUT,
Uri.fromFile(new File(
Environment.getExternalStorageDirectory(),
IMAGE_FILE_NAME)));
}
startActivityForResult(intentFromCapture,
CAMERA_REQUEST_CODE);
break;
}
}
})
.setNegativeButton(R.string.activity_edit_user_info_cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
dialog.dismiss();
}
}).show();
}
private static boolean hasSdcard() {
String state = Environment.getExternalStorageState();
if (state.equals(Environment.MEDIA_MOUNTED)) {
return true;
} else {
return false;
}
}
private void loadpic() {
File file = new File(file_path);
if (!file.exists())
try {
ibPic.setImageDrawable(getResources().getDrawable(R.drawable.nopic));
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e("on creating file!", "error!!!!!!!");
e.printStackTrace();
}
else {
pic_bt = BitmapFactory.decodeFile(file_path);
ibPic.setImageBitmap(pic_bt);
}
try {
out = new FileOutputStream(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
Log.e("on creating :", "error!!!");
e.printStackTrace();
}
String file_na = mShopG.getPicture();
if (file_na != null && pic_bt == null) {
downloadFile(file_na);
}
}
private void downloadFile(String file_name) {
BmobProFile.getInstance(this).download(file_name, new DownloadListener() {
@Override
public void onError(int arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
public void onProgress(String arg0, int arg1) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(String full_path) {
// TODO Auto-generated method stub
pic_bt = BitmapFactory.decodeFile(full_path);
ibPic.setImageBitmap(pic_bt);
saveShopBitmap(pic_bt);
}
});
}
private void update() {
BTPFileResponse response = BmobProFile.getInstance(AddGoods.this).upload(file_path, new UploadListener() {
@Override
public void onError(int arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
public void onProgress(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(String file_name, String url) {
// TODO Auto-generated method stub
pic_name = file_name;
try {
writeProperty("user_pic", file_name);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (pic_name != null) {
new_mShopG.setPicture(pic_name);
}
String p = dtPrice.getText().toString();
String goodsname = dtName.getText().toString();
String describe = dtDescribe.getText().toString();
String cat = spinner.getSelectedItem().toString();
if (p.equals("") || goodsname.equals("") || describe.equals("") || cat.equals("")) {
toast("信息不完整,请检查。");
} else {
Log.e("AddGoods里的update()方法", "种类cat为" + cat);
new_mShopG.setShopname(ShopName);
new_mShopG.setGoodsname(goodsname);
new_mShopG.setDescription(describe);
new_mShopG.setPrice(p);
new_mShopG.setGcat(cat);
//上传数据
new_mShopG.save(AddGoods.this, new SaveListener() {
@Override
public void onSuccess() {
toast("商品已添加!快去管理你的小店吧~");
finish();
}
@Override
public void onFailure(int i, String s) {
toast("添加商品失败"+s);
}
});
}
}
});
/* ShopG mShopG = new ShopG();
mShopG.setShopname(ShopName);
mShopG.setGoodsname(goodsname);
mShopG.setDescription(describe);
mShopG.setPrice(price);
mShopG.setGcat(cat);
//上传数据
mShopG.save(AddGoods.this, new SaveListener() {
@Override
public void onSuccess() {
toast("商品已添加!快去管理你的小店吧~");
}
@Override
public void onFailure(int i, String s) {
toast("添加商品失败!请重新尝试");
}
});*/
}
private void writeProperty(String pro_name, String pro_value) throws IOException {
File file = new File(pro_file_path);
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream output = new FileOutputStream(file);
Properties pro = new Properties();
pro.put(pro_name, pro_value);
pro.store(output, null);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_CANCELED) {
Log.i("onActivityResult :", "is running ???");
switch (requestCode) {
case IMAGE_REQUEST_CODE:
startPhotoZoom(data.getData());
break;
case CAMERA_REQUEST_CODE:
if (hasSdcard()) {
File tempFile = new File(
Environment.getExternalStorageDirectory() + "/"
+ IMAGE_FILE_NAME);
// Log.e("is the file","");
Log.i("onActivityResult:", "is running ???2");
startPhotoZoom(Uri.fromFile(tempFile));
} else {
//Toast.makeText(UserInfoActivity.this,
// "", Toast.LENGTH_LONG).show();
}
break;
case RESULT_REQUEST_CODE:
if (data != null) {
getImageToView(data);
}
break;
}
}
super.onActivityResult(requestCode, resultCode, data);
}
public void startPhotoZoom(Uri uri) {
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", 320);
intent.putExtra("outputY", 320);
intent.putExtra("return-data", true);
startActivityForResult(intent, 2);
}
private void getImageToView(Intent data) {
Bundle extras = data.getExtras();
if (extras != null) {
Bitmap photo = extras.getParcelable("data");
saveShopBitmap(photo);
// Drawable drawable = new BitmapDrawable(photo);
// face_image.setImageDrawable(drawable);
ibPic.setImageBitmap(photo);
//photo.
}
}
private void saveShopBitmap(Bitmap photo) {
BufferedOutputStream buffer_out = new BufferedOutputStream(out);
photo.compress(Bitmap.CompressFormat.PNG, 100, buffer_out);
try {
buffer_out.flush();
buffer_out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e("write bitmap:", "error!!!!!!!!!!!!!!!!!!");
e.printStackTrace();
}
}
private void toast(String text) {
Toast.makeText(AddGoods.this, text, Toast.LENGTH_SHORT).show();
;
}
}
| [
"[email protected]"
] | |
14d72e4d61baa806abcd288b48d92006158644d7 | d97ed22f159b4577eff940068fdb0d63b08f1149 | /app/src/main/java/com/saechaol/learningapp/sinch/AudioPlayer.java | 4183f98f0aae89f49114f185b33627e5ae040b90 | [] | no_license | saechaol/learning-app | 79ed81445a0d348b3b53d7ecea7fd1d58f2f64b6 | 22f0730c9882d1159f203a72c3d9a0524786d072 | refs/heads/main | 2023-02-22T03:38:30.258474 | 2021-01-28T06:58:17 | 2021-01-28T06:58:17 | 308,889,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,270 | java | package com.saechaol.learningapp.sinch;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioTrack;
import android.media.MediaPlayer;
import android.net.Uri;
import android.util.Log;
import com.saechaol.learningapp.R;
import java.io.FileInputStream;
import java.io.IOException;
/**
* Implements an audio stream player for the application
*/
public class AudioPlayer {
static final String LOG_TAG = AudioPlayer.class.getSimpleName();
private Context context;
private MediaPlayer mediaPlayer;
private AudioTrack dialTone;
private final static int SAMPLE_RATE = 16000;
public AudioPlayer(Context context) {
this.context = context.getApplicationContext();
}
public void playRingtone() {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
// check silent mode
if (audioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_RING);
try {
mediaPlayer.setDataSource(context, Uri.parse("android.resource://" + context.getPackageName() + "/" + R.raw.ringtone));
} catch (IOException e) {
Log.e(LOG_TAG, "Could not set up media player object for ringtone");
mediaPlayer = null;
return;
}
}
}
public void stopRingtone() {
if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.release();
mediaPlayer = null;
}
}
public void playDialTone() {
stopDialTone();
try {
dialTone = createDialTone(context);
dialTone.play();
} catch (Exception e) {
Log.e(LOG_TAG, "Could not play dialtone", e);
}
}
public void stopDialTone() {
if (dialTone != null) {
dialTone.stop();
dialTone.release();
dialTone = null;
}
}
private static AudioTrack createDialTone(Context context) throws IOException {
AssetFileDescriptor fileDescriptor = context.getResources().openRawResourceFd(R.raw.dialtone);
int length = (int) fileDescriptor.getLength();
AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL, SAMPLE_RATE,
AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, length, AudioTrack.MODE_STATIC);
byte[] data = new byte[length];
readFileToBytes(fileDescriptor, data);
audioTrack.write(data, 0, data.length);
audioTrack.setLoopPoints(0, data.length / 2, 30);
return audioTrack;
}
private static void readFileToBytes(AssetFileDescriptor fileDescriptor, byte[] data) throws IOException {
FileInputStream inputStream = fileDescriptor.createInputStream();
int bytesRead = 0;
while (bytesRead < data.length) {
int res = inputStream.read(data, bytesRead, (data.length - bytesRead));
if (res == -1)
break;
bytesRead += res;
}
}
}
| [
"[email protected]"
] | |
e0c3648c25df6f2deff43e7e530ddc9beb89bfbe | 32f38cd53372ba374c6dab6cc27af78f0a1b0190 | /app/src/main/java/android/support/v4/app/FragmentManager.java | aaab41cb29b801ef5ef1ad65289af4f5f7b296fd | [] | no_license | shuixi2013/AmapCode | 9ea7aefb42e0413f348f238f0721c93245f4eac6 | 1a3a8d4dddfcc5439df8df570000cca12b15186a | refs/heads/master | 2023-06-06T23:08:57.391040 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,412 | java | package android.support.v4.app;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment.SavedState;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.List;
public abstract class FragmentManager {
public static final int POP_BACK_STACK_INCLUSIVE = 1;
public interface BackStackEntry {
CharSequence getBreadCrumbShortTitle();
@StringRes
int getBreadCrumbShortTitleRes();
CharSequence getBreadCrumbTitle();
@StringRes
int getBreadCrumbTitleRes();
int getId();
String getName();
}
public interface OnBackStackChangedListener {
void onBackStackChanged();
}
public abstract void addOnBackStackChangedListener(OnBackStackChangedListener onBackStackChangedListener);
public abstract FragmentTransaction beginTransaction();
public abstract void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr);
public abstract boolean executePendingTransactions();
public abstract Fragment findFragmentById(@IdRes int i);
public abstract Fragment findFragmentByTag(String str);
public abstract BackStackEntry getBackStackEntryAt(int i);
public abstract int getBackStackEntryCount();
public abstract Fragment getFragment(Bundle bundle, String str);
public abstract List<Fragment> getFragments();
public abstract boolean isDestroyed();
public abstract boolean isExecutingActions();
public abstract void popBackStack();
public abstract void popBackStack(int i, int i2);
public abstract void popBackStack(String str, int i);
public abstract boolean popBackStackImmediate();
public abstract boolean popBackStackImmediate(int i, int i2);
public abstract boolean popBackStackImmediate(String str, int i);
public abstract void putFragment(Bundle bundle, String str, Fragment fragment);
public abstract void removeOnBackStackChangedListener(OnBackStackChangedListener onBackStackChangedListener);
public abstract SavedState saveFragmentInstanceState(Fragment fragment);
@Deprecated
public FragmentTransaction openTransaction() {
return beginTransaction();
}
public static void enableDebugLogging(boolean z) {
FragmentManagerImpl.a = z;
}
}
| [
"[email protected]"
] | |
745a295624dc4f3fa6c3d77a3a9549f1b7688ef3 | 4d97a8ec832633b154a03049d17f8b58233cbc5d | /Math/96/Math/evosuite-branch/0/org/apache/commons/math/complex/ComplexEvoSuite_branch_Test_scaffolding.java | a0a71dc83fed7af8dfcd6f061d82865f5eaf89dd | [] | no_license | 4open-science/evosuite-defects4j | be2d172a5ce11e0de5f1272a8d00d2e1a2e5f756 | ca7d316883a38177c9066e0290e6dcaa8b5ebd77 | refs/heads/master | 2021-06-16T18:43:29.227993 | 2017-06-07T10:37:26 | 2017-06-07T10:37:26 | 93,623,570 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,869 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Dec 11 19:10:17 GMT 2014
*/
package org.apache.commons.math.complex;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
public class ComplexEvoSuite_branch_Test_scaffolding {
@org.junit.Rule
public org.junit.rules.Timeout globalTimeout = new org.junit.rules.Timeout(6000);
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 5000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
resetClasses();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("java.vm.vendor", "Oracle Corporation");
java.lang.System.setProperty("java.specification.version", "1.7");
java.lang.System.setProperty("java.home", "/usr/local/packages6/java/jdk1.7.0_55/jre");
java.lang.System.setProperty("user.dir", "/scratch/ac1gf/Math/96/0/run_evosuite.pl_7163_1418324400");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
java.lang.System.setProperty("awt.toolkit", "sun.awt.X11.XToolkit");
java.lang.System.setProperty("file.encoding", "UTF-8");
java.lang.System.setProperty("file.separator", "/");
java.lang.System.setProperty("java.awt.graphicsenv", "sun.awt.X11GraphicsEnvironment");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.awt.printerjob", "sun.print.PSPrinterJob");
java.lang.System.setProperty("java.class.path", "/data/ac1gf/defects4j/framework/projects/lib/evosuite.jar:/scratch/ac1gf/Math/96/0/run_evosuite.pl_7163_1418324400/target/classes");
java.lang.System.setProperty("java.class.version", "51.0");
java.lang.System.setProperty("java.endorsed.dirs", "/usr/local/packages6/java/jdk1.7.0_55/jre/lib/endorsed");
java.lang.System.setProperty("java.ext.dirs", "/usr/local/packages6/java/jdk1.7.0_55/jre/lib/ext:/usr/java/packages/lib/ext");
java.lang.System.setProperty("java.library.path", "lib");
java.lang.System.setProperty("java.runtime.name", "Java(TM) SE Runtime Environment");
java.lang.System.setProperty("java.runtime.version", "1.7.0_55-b13");
java.lang.System.setProperty("java.specification.name", "Java Platform API Specification");
java.lang.System.setProperty("java.specification.vendor", "Oracle Corporation");
java.lang.System.setProperty("java.vendor", "Oracle Corporation");
java.lang.System.setProperty("java.vendor.url", "http://java.oracle.com/");
java.lang.System.setProperty("java.version", "1.7.0_55");
java.lang.System.setProperty("java.vm.info", "mixed mode");
java.lang.System.setProperty("java.vm.name", "Java HotSpot(TM) 64-Bit Server VM");
java.lang.System.setProperty("java.vm.specification.name", "Java Virtual Machine Specification");
java.lang.System.setProperty("java.vm.specification.vendor", "Oracle Corporation");
java.lang.System.setProperty("java.vm.specification.version", "1.7");
java.lang.System.setProperty("java.vm.version", "24.55-b03");
java.lang.System.setProperty("line.separator", "\n");
java.lang.System.setProperty("os.arch", "amd64");
java.lang.System.setProperty("os.name", "Linux");
java.lang.System.setProperty("os.version", "2.6.32-431.23.3.el6.x86_64");
java.lang.System.setProperty("path.separator", ":");
java.lang.System.setProperty("user.country", "GB");
java.lang.System.setProperty("user.home", "/home/ac1gf");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "ac1gf");
java.lang.System.setProperty("user.timezone", "Europe/Belfast");
}
private static void initializeClasses() {
org.evosuite.runtime.ClassStateSupport.initializeClasses(ComplexEvoSuite_branch_Test_scaffolding.class.getClassLoader() ,
"org.apache.commons.math.complex.Complex",
"org.apache.commons.math.util.MathUtils"
);
}
private static void resetClasses() {
org.evosuite.runtime.reset.ClassResetter.getInstance().setClassLoader(ComplexEvoSuite_branch_Test_scaffolding.class.getClassLoader());
org.evosuite.runtime.ClassStateSupport.resetClasses(
"org.apache.commons.math.complex.Complex",
"org.apache.commons.math.util.MathUtils"
);
}
}
| [
"[email protected]"
] | |
bba86f7c3cf458fc2861ae5dbd2e811f6078319e | 14f2e4bb1add511b63bb4886b15c5040a5dada77 | /src/utils/sort/BubbleSorter.java | 005b1a618f437135ad61c353596108437445815e | [] | no_license | lizhaowei/lzw | e2150baf4508cf3bb975477c6d4db1b360f00485 | 4651a1e20d7d88e371504f7ee387d4f0af90f38b | refs/heads/master | 2016-09-05T12:49:15.719190 | 2014-01-15T16:54:54 | 2014-01-15T16:54:54 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,232 | java | package utils.sort;
/**
* 冒泡排序<br>
*
* <pre>
* 这可能是最简单的排序算法了,算法思想是每次从数组末端开始比较相邻两元素,把第i小的冒泡到
* 数组的第i个位置。i从0一直到N-1从而完成排序。(当然也可以从数组开始端开始比较相邻两元素,
* 把第i大的冒泡到数组的第N-i个位置。i从0一直到N-1从而完成排序。)
* </pre>
*
* @author 李赵伟
* @param <E>
*/
public class BubbleSorter<E extends Comparable<E>> extends Sorter<E> {
private static boolean DWON = true;
private final void bubble_down(E[] array, int from, int len) {
for (int i = from; i < from + len; i++) {
for (int j = from + len - 1; j > i; j--) {
if (array[j].compareTo(array[j - 1]) < 0) {
swap(array, j - 1, j);
}
}
}
}
private final void bubble_up(E[] array, int from, int len) {
for (int i = from + len - 1; i >= from; i--) {
for (int j = from; j < i; j++) {
if (array[j].compareTo(array[j + 1]) > 0) {
swap(array, j, j + 1);
}
}
}
}
@Override
public void sort(E[] array, int from, int len) {
if (DWON) {
bubble_down(array, from, len);
} else {
bubble_up(array, from, len);
}
}
}
| [
"[email protected]"
] | |
0ab832f7c28e8fd2f99c123e28ee8d975f6da3be | 03096b3e84aed5101432546fca1efa4462602cfb | /Application/HelloWorld/app/src/main/java/com/mousebird/maply/CoordSystem.java | ac4419c5ef55d8e939983a7ddc1c027d7540bb59 | [] | no_license | enoxaiming/HelloWorld | 020ee5f31d54f24ad7dcdc5802500f371ed1527d | fd4594c7b579c273597dd1840264e70560168027 | refs/heads/master | 2020-07-25T12:50:01.941283 | 2016-09-04T14:43:50 | 2016-09-04T14:43:50 | 67,212,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,055 | java | /*
* CoordSystem.java
* WhirlyGlobeLib
*
* Created by Steve Gifford on 6/2/14.
* Copyright 2011-2014 mousebird consulting
*
* 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.mousebird.maply;
/**
* The coord system is a very simple representation of the coordinate
* systems supported by WhirlyGlobe-Maply. Very few moving parts are
* accessible at this level. In general, you'll want to instantiate
* one of the subclasses and pass it around to Mapy objects as needed.
*
*/
public class CoordSystem
{
/**
* Only ever called by the subclass. Don't use this directly please.
*/
CoordSystem()
{
}
public void finalize()
{
dispose();
}
/**
* Lower left corner of the bounding box in local coordinates.
*/
Point3d ll = null;
/**
* Upper right corner of the bounding box in local coordinates.
*/
Point3d ur = null;
/**
* Return the valid bounding box for the coordinate system.
* null means everywhere is valid.
*/
public Mbr getBounds()
{
if (ll == null || ur == null)
return null;
Mbr mbr = new Mbr();
mbr.addPoint(new Point2d(ll.getX(),ll.getY()));
mbr.addPoint(new Point2d(ur.getX(),ur.getY()));
return mbr;
}
/**
* Set the bounding box for the coordinate system.
* @param mbr
*/
public void setBounds(Mbr mbr)
{
ll = new Point3d(mbr.ll.getX(),mbr.ll.getY(),0.0);
ur = new Point3d(mbr.ur.getX(),mbr.ur.getY(),0.0);
}
/**
* Convert from WGS84 longitude/latitude coordinates to the local coordinate system.
*
* @param pt The input coordinate in longitude/latitude WGS84 radians. Yes, radians.
* @return A point in the local coordinate system.
*/
public native Point3d geographicToLocal(Point3d pt);
/**
* Convert from the local coordinate system to WGS84 longitude/latitude in radians.
*
* @param pt A point in the local coordinate system.
* @return A coordinate in longitude/latitude WGS84 radians. Yes, radians.
*/
public native Point3d localToGeographic(Point3d pt);
/**
* Convert the coordinate between systems.
* @param inSystem The system the coordinate is in.
* @param outSystem The system the coordinate you want it in.
* @param inCoord The coordinate.
* @return Returns the coordinate in the outSystem.
*/
public static native Point3d CoordSystemConvert3d (CoordSystem inSystem, CoordSystem outSystem, Point3d inCoord);
static
{
nativeInit();
}
private static native void nativeInit();
native void initialise();
native void dispose();
private long nativeHandle;
}
| [
"[email protected]"
] | |
525d26787a78ddd0c7a0b69d1ae4d4a3a216ab74 | 8c88ef471a572d4eb47c283b46f3cd7e3b8d93b9 | /src/main/java/com/great/childschool/tools/ZipUtil.java | bec0c0be383b6e6fafd0ab73977a59407eca490e | [] | no_license | JeoYan/ChildSchool | af208dbd3a7b83b00e1b655632ceec5bfd9af090 | 667a2c87ee8882629851a24d1811efe8f8df1763 | refs/heads/master | 2022-07-06T09:31:24.657594 | 2020-01-10T02:20:05 | 2020-01-10T02:20:05 | 228,354,191 | 0 | 0 | null | 2022-05-20T21:19:49 | 2019-12-16T09:50:15 | JavaScript | UTF-8 | Java | false | false | 3,567 | java | package com.great.childschool.tools;
import org.apache.commons.io.FileUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class ZipUtil
{
public static ResponseEntity<byte[]> downLoadFiles(List<File> files,String bookName, HttpServletResponse response) throws Exception {
ResponseEntity<byte[]> responseEntity=null;
try {
// List<File> 作为参数传进来,就是把多个文件的路径放到一个list里面
// 创建一个临时压缩文件
// 临时文件可以放在CDEF盘中,但不建议这么做,因为需要先设置磁盘的访问权限,最好是放在服务器上,方法最后有删除临时文件的步骤
String zipFilename = "F:/"+bookName+".rar";
File file = new File(zipFilename);
file.createNewFile();
if (!file.exists()) {
file.createNewFile();
}
response.reset();
// response.getWriter()
// 创建文件输出流
FileOutputStream fous = new FileOutputStream(file);
ZipOutputStream zipOut = new ZipOutputStream(fous);
zipFile(files, zipOut);
zipOut.close();
fous.close();
responseEntity=export(file);
} catch (Exception e) {
e.printStackTrace();
}
return responseEntity;
}
/**
* 把接受的全部文件打成压缩包
*
*
*/
public static void zipFile(List files, ZipOutputStream outputStream) {
int size = files.size();
for (int i = 0; i < size; i++) {
File file = (File) files.get(i);
zipFile(file, outputStream);
}
}
/**
* 根据输入的文件与输出流对文件进行打包
*
*
*/
public static void zipFile(File inputFile, ZipOutputStream ouputStream) {
try {
if (inputFile.exists()) {
if (inputFile.isFile()) {
FileInputStream IN = new FileInputStream(inputFile);
BufferedInputStream bins = new BufferedInputStream(IN, 512);
ZipEntry entry = new ZipEntry(inputFile.getName());
ouputStream.putNextEntry(entry);
// 向压缩文件中输出数据
int nNumber;
byte[] buffer = new byte[512];
while ((nNumber = bins.read(buffer)) != -1) {
ouputStream.write(buffer, 0, nNumber);
}
// 关闭创建的流对象
bins.close();
IN.close();
} else {
try {
File[] files = inputFile.listFiles();
for (int i = 0; i < files.length; i++) {
zipFile(files[i], ouputStream);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static ResponseEntity<byte[]> export(File file)
{
HttpHeaders headers = new HttpHeaders();
// MediaType:互联网媒介类型 contentType:具体请求中的媒体类型信息
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", file.getName());
System.out.println("-----file-------"+file);
System.out.println("-----file.getName()-------"+file.getName());
ResponseEntity<byte[]> responseEntity= null;
try
{
responseEntity = new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), headers, HttpStatus.CREATED);
} catch (IOException e)
{
e.printStackTrace();
}finally
{
file.delete();
}
return responseEntity;
}
}
| [
"[email protected]"
] | |
27a242b618966b74a0da62eb39fefc11a471a8e5 | 81adb6bb0148ae5d8e1668fc5267431dc89c88a6 | /src/jp/co/jjs/java_seminar/exercise_20140514_2/Exercise1.java | 9d39227bcd4370b4b98370b750675ee2ea111e6d | [] | no_license | jjs-0006/Exercise | 9510915eebe2f91431f5ee7d6aa62861a9fc0588 | 2abb9eea9961254d867dd5672e639b0f4e208d97 | refs/heads/master | 2020-05-19T19:05:27.826897 | 2014-05-23T08:29:30 | 2014-05-23T08:29:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package jp.co.jjs.java_seminar.exercise_20140514_2;
public class Exercise1 {
public static void main(String[] args) {
Student s1 = new Student("山田一",20,0);
Student s2 = new Student("田中太郎",21,1);
System.out.println(s1.s + " " + s1.c + " " + s1.classNumber + " " + s1.d + " " + s1.b);
s1.showName();
s2.showName();
s1.answer();
System.out.println(s1.report());
s1.answer();
System.out.println(s1.report());
}
}
| [
"[email protected]"
] | |
3ed9f9bbc2f69bea44ba2da3b43d4352f0583058 | 51bbc6cd93a8a9db49b55f1af74ba794fafa0a56 | /excel-plugin/src/test/java/tests/diagnosis/MockNodeData.java | ad3aacb47aacf117e46d1dd8d1eef44a5b4a6141 | [
"Apache-2.0"
] | permissive | manleviet/Master-project | 0131d38f55663a52071d889de90298395d76bafa | 387cff0fd4fd1dab3914f7a181dac68a3b2fe60e | refs/heads/master | 2021-09-21T00:43:23.546164 | 2018-08-17T19:49:43 | 2018-08-17T19:49:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,950 | java | package tests.diagnosis;
import choco.Choco;
import choco.kernel.model.constraints.Constraint;
import choco.kernel.model.variables.integer.IntegerVariable;
import org.exquisite.core.engines.tree.Node;
import org.exquisite.diagnosis.engines.common.ConstraintComparator;
import java.util.*;
/**
* Reflects the unpruned DAG structure from the Greiner paper - used for testing revised pruning and node reuse methods.
* @author David
*
*/
public class MockNodeData {
public Hashtable<String, Constraint> constraints = new Hashtable<String, Constraint>();
public List<Node<Constraint>> graph = new ArrayList<>();
public List<List<Constraint>> knownConflicts = new ArrayList<List<Constraint>>();
public Hashtable<List<Constraint>, List<Node<Constraint>>> conflictNodeLookup = new Hashtable<>();
public Node<Constraint> rootNode;
/**
* @return a graph the same as used in Greiner's paper.
*/
public static MockNodeData greinerExample(){
MockNodeData instance = new MockNodeData();
instance.makeGreinerExample();
return instance;
}
/**
* @return a small graph with a pair of nodes whose paths contain identical labels.
*/
public static MockNodeData duplicatePathsExample(){
MockNodeData instance = new MockNodeData();
instance.makeDuplicatePathExample();
return instance;
}
public static MockNodeData nodeReuseExample(){
MockNodeData instance = new MockNodeData();
instance.makeReuseExample();
return instance;
}
private void makeReuseExample(){
IntegerVariable testVar = Choco.makeIntVar("testVar");
Constraint a = Choco.eq(testVar, 1);
Constraint b = Choco.eq(testVar, 2);
Constraint c = Choco.eq(testVar, 3);
Constraint d = Choco.eq(testVar, 4);
constraints.put("a", a);
constraints.put("b", b);
constraints.put("c", c);
constraints.put("d", d);
Constraint[] rootArray = {a,b};
Node<Constraint> root = makeRoot(rootArray);
Constraint[] n1Conflicts = {b, c};
Node<Constraint> n1 = makeNode("n1", n1Conflicts, root, a);
Constraint[] n2Conflicts = {a, c};
Node<Constraint> n2 = makeNode("n2", n2Conflicts, root, b);
Constraint[] n3Conflicts = {};
Node<Constraint> n3 = makeNode("n3", n3Conflicts, n1, b);
Constraint[] n4Conflicts = {b, d};
Node<Constraint> n4 = makeNode("n4", n4Conflicts, n1, c);
}
/**
* Emulates unpruned graph example from pg.85 of
* http://cs.ru.nl/~peterl/teaching/KeR/Theorist/greibers-correctiontoreiter.pdf
*/
private void makeGreinerExample(){
IntegerVariable testVar = Choco.makeIntVar("testVar");
Constraint a = Choco.eq(testVar, 1);
Constraint b = Choco.eq(testVar, 2);
Constraint c = Choco.eq(testVar, 3);
Constraint d = Choco.eq(testVar, 4);
constraints.put("a", a);
constraints.put("b", b);
constraints.put("c", c);
constraints.put("d", d);
Constraint[] rootArray = {a,b};
Node<Constraint> root = makeRoot(rootArray);
Constraint[] n1Conflicts = {b, c};
Node<Constraint> n1 = makeNode("n1", n1Conflicts, root, a);
Constraint[] n2Conflicts = {a, c};
Node<Constraint> n2 = makeNode("n2", n2Conflicts, root, b);
Constraint[] n3Conflicts = {};
Node<Constraint> n3 = makeNode("n3", n3Conflicts, n1, b);
n2.addChild(n3, a);
Constraint[] n4Conflicts = {b, d};
Node<Constraint> n4 = makeNode("n4", n4Conflicts, n1, c);
Constraint[] n5Conflicts = {};
Node<Constraint> n5 = makeNode("n5", n5Conflicts, n2, c);
Constraint[] n6Conflicts = {};
Node<Constraint> n6 = makeNode("n6", n6Conflicts, n4, b);
Constraint[] n7Conflicts = {b};
Node<Constraint> n7 = makeNode("n7", n7Conflicts, n4, d);
}
/**
* For testing parallel tree pre-check for duplicate node paths.
*/
private void makeDuplicatePathExample(){
IntegerVariable testVar = Choco.makeIntVar("testVar");
Constraint a = Choco.eq(testVar, 1);
Constraint b = Choco.eq(testVar, 2);
Constraint c = Choco.eq(testVar, 3);
Constraint d = Choco.eq(testVar, 4);
Constraint e = Choco.eq(testVar, 4);
Constraint f = Choco.eq(testVar, 4);
constraints.put("a", a);
constraints.put("b", b);
constraints.put("c", c);
constraints.put("d", d);
constraints.put("e", e);
constraints.put("f", f);
//level 0
Constraint[] rootArray = {a,b,c};
Node<Constraint> root = makeRoot(rootArray);
//level 1
Constraint[] n1Conflicts = {b, e};
Node<Constraint> n1 = makeNode("n1", n1Conflicts, root, a);
Constraint[] n2Conflicts = {a, f};
Node<Constraint> n2 = makeNode("n2", n2Conflicts, root, b);
Constraint[] n3Conflicts = {d, e};
Node<Constraint> n3 = makeNode("n3", n3Conflicts, root, c);
}
/**
* Makes a Node and configures that node as a root node.
* @param conflict the nodeLabel set for this root node
* @return Node set as root.
*/
private Node<Constraint> makeRoot(Constraint[] conflict) {
Node<Constraint> root = new Node<Constraint>(new ArrayList<Constraint>(Arrays.asList(conflict)));
root.nodeName = "root";
graph.add(root);
knownConflicts.add(root.nodeLabel);
List<Node<Constraint>> nodes = new ArrayList<Node<Constraint>>();
nodes.add(root);
conflictNodeLookup.put(root.nodeLabel, nodes);
rootNode = root;
return root;
}
/**
* Makes a (non-root) Node
* @param name A name for the node (can be useful for printing, debugging).
* @param conflict The nodeLabel set for this particular node.
* @param parent The parent of this node.
* @param edge The path label from the parent that points to this node.
* @return A Node that is the child of another node.
*/
private Node<Constraint> makeNode(String name, Constraint[] conflict, Node<Constraint> parent,
Constraint edge) {
Node<Constraint> node = new Node<Constraint>(parent, edge);
node.nodeLabel = new ArrayList<Constraint>(Arrays.asList(conflict));
//System.out.println("Making node " + name + " with nodeLabel size of: " + node.nodeLabel.size());
node.nodeName = name;
Set<Constraint> set = new TreeSet<Constraint>(new ConstraintComparator());
set.addAll(parent.pathLabels);
node.pathLabels.addAll(set);
node.pathLabels.add(edge);
graph.add(node);
if (!node.nodeLabel.isEmpty()){
knownConflicts.add(node.nodeLabel);
List<Node<Constraint>> nodes = conflictNodeLookup.get(node.nodeLabel);
if (nodes == null) {
nodes = new ArrayList<Node<Constraint>>();
}
nodes.add(node);
conflictNodeLookup.put(node.nodeLabel, nodes);
}
return node;
}
}
| [
"[email protected]"
] | |
ee41114a5cd290db6ae7eaff063002954f6bad11 | c9edd21bdf3e643fe182c5b0f480d7deb218737c | /dy-agent-log4j/dy-agent-log4j-core/src/main/java/com/hust/foolwc/dy/agent/log4j/core/config/PropertiesPlugin.java | ae2789f53f21a02dd7504dad6816523eeeb447e5 | [] | no_license | foolwc/dy-agent | f302d2966cf3ab9fe8ce6872963828a66ca8a34e | d7eca9df2fd8c4c4595a7cdc770d6330e7ab241c | refs/heads/master | 2022-11-22T00:13:52.434723 | 2022-02-18T09:39:15 | 2022-02-18T09:39:15 | 201,186,332 | 10 | 4 | null | 2022-11-16T02:45:38 | 2019-08-08T05:44:02 | Java | UTF-8 | Java | false | false | 2,915 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache license, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the license for the specific language governing permissions and
* limitations under the license.
*/
package com.hust.foolwc.dy.agent.log4j.core.config;
import java.util.HashMap;
import java.util.Map;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.Plugin;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.PluginConfiguration;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.PluginElement;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.PluginFactory;
import com.hust.foolwc.dy.agent.log4j.core.lookup.Interpolator;
import com.hust.foolwc.dy.agent.log4j.core.lookup.MapLookup;
import com.hust.foolwc.dy.agent.log4j.core.lookup.StrLookup;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.Plugin;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.PluginConfiguration;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.PluginElement;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.PluginFactory;
import com.hust.foolwc.dy.agent.log4j.core.lookup.Interpolator;
import com.hust.foolwc.dy.agent.log4j.core.lookup.MapLookup;
import com.hust.foolwc.dy.agent.log4j.core.lookup.StrLookup;
/**
* Handles properties defined in the configuration.
*/
@Plugin(name = "properties", category = Node.CATEGORY, printObject = true)
public final class PropertiesPlugin {
private PropertiesPlugin() {
}
/**
* Creates the Properties component.
* @param properties An array of Property elements.
* @param config The Configuration.
* @return An Interpolator that includes the configuration properties.
*/
@PluginFactory
public static StrLookup configureSubstitutor(@PluginElement("Properties") final Property[] properties,
@PluginConfiguration final Configuration config) {
if (properties == null) {
return new Interpolator(config.getProperties());
}
final Map<String, String> map = new HashMap<>(config.getProperties());
for (final Property prop : properties) {
map.put(prop.getName(), prop.getValue());
}
return new Interpolator(new MapLookup(map), config.getPluginPackages());
}
}
| [
"[email protected]"
] | |
96b34f39589622f26eca9991d04b2e5515445517 | f2be6aa0d9a6e2d455c04cf063cf0dfd3246aa5a | /jixiao/.svn/pristine/11/118fe961ec8fa6291db141a8c1562d8bb999e3ff.svn-base | 5c02a062e1b630316b404d4e6aea73ba93b7157e | [] | no_license | platinumhamburg/jixiao | 33b7a6228f8b0e41714fbbdc1812db45a38d067a | 874a4d618c9fbb01851cd2fd2a8b344474b3e89c | refs/heads/master | 2021-01-10T21:49:00.690878 | 2015-05-25T17:41:05 | 2015-05-25T17:41:05 | 36,075,373 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 5,922 | package com.hoyotech.prison.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.hoyotech.prison.bean.ContrabandGoods;
import com.hoyotech.prison.bean.Police;
import com.hoyotech.prison.bean.PrisonerContrabandGoods;
import com.hoyotech.prison.log.LogFactory;
import com.hoyotech.prison.service.impl.DictionaryService;
import com.hoyotech.prison.service.impl.PrisonerContrabandGoodsService;
import com.hoyotech.prison.util.ConfigHelper;
import com.hoyotech.prison.util.ObjectUpdateUtil;
import com.hoyotech.prison.util.PrisonUtil;
public class ContrabandGoodsAction {
private PrisonerContrabandGoodsService prisonerContrabandGoodsService;
private DictionaryService dictionaryService;
private List<PrisonerContrabandGoods> list;
private PrisonerContrabandGoods prisonerContrabandGoods;
private ContrabandGoods contrabandGoods;
private String id;
private String prisonerId;
private String type;
private List<Police> policelist;
private LogFactory log;
public String detail(){
prisonerContrabandGoods = prisonerContrabandGoodsService.detailByPrisoner(id);
return "detail";
}
public String detailByPrisoner(){
prisonerContrabandGoods = prisonerContrabandGoodsService.detailByPrisoner(id);
return "detail";
}
public String addUI(){
selectPolice();
prisonerId = id;
type = "contrabandGoods";
return "addUI";
}
public void selectPolice(){
HttpServletRequest request = ServletActionContext.getRequest();
String prisonCode=PrisonUtil.getPrisonCode(request);
policelist=dictionaryService.selectPolice(prisonCode);
}
public String addGoodsUI(){
selectPolice();
prisonerContrabandGoods = prisonerContrabandGoodsService.detail(id);
prisonerId = prisonerContrabandGoods.getPrisoner().getId();
return "addGoodsUI";
}
/**
* 添加涉案装备
* @return
*/
public String addContrabandGoods(){
HttpServletRequest request=ServletActionContext.getRequest();
String prisonCode=PrisonUtil.getPrisonCode(request);
contrabandGoods.setPrisonCode(prisonCode);
prisonerContrabandGoodsService.addContrabandGoods(contrabandGoods);
// 添加日志
ConfigHelper config = ConfigHelper.getConfig();
String operate = "添加成功。";
log.getInsertLogMessage(contrabandGoods, config.getInsert(), operate, config.getContrabandGood(), config.getSucceed(), request);
return "seccess";
}
/**
* 添加
* @return
*/
public String add(){
addContrabandGoods();
prisonerContrabandGoods.setNoYear(PrisonUtil.getYear());//添加流水号
prisonerContrabandGoods.setNoNumber(dictionaryService.getNo("PrisonerContrabandGoods"));
HttpServletRequest request=ServletActionContext.getRequest();
String prisonCode=PrisonUtil.getPrisonCode(request);
prisonerContrabandGoods.setPrisonCode(prisonCode);
prisonerContrabandGoodsService.add(prisonerContrabandGoods);
id = prisonerContrabandGoods.getPrisoner().getId();
type = "contrabandGoods";
// 添加日志
ConfigHelper config = ConfigHelper.getConfig();
String operate = "添加成功。";
log.getInsertLogMessage(prisonerContrabandGoods, config.getInsert(), operate, config.getContrabandGood(), config.getSucceed(), request);
return "main";
}
/**
* 添加涉案物品
* @return
*/
public String add1(){
addContrabandGoods();
id = prisonerContrabandGoods.getId();
PrisonerContrabandGoods object = prisonerContrabandGoodsService.detail(id);
ObjectUpdateUtil.compareProperty(prisonerContrabandGoods, object);
prisonerContrabandGoodsService.update(object);
id = prisonerContrabandGoods.getPrisoner().getId();
// 添加日志
PrisonerContrabandGoods old_obj = prisonerContrabandGoodsService.detail(id);
HttpServletRequest request = ServletActionContext.getRequest();
ConfigHelper config = ConfigHelper.getConfig();
String operate = "修改成功。";
log.getModifyLogMessage(object, old_obj, config.getUpdate(), operate, config.getContrabandGood(), config.getSucceed(), request);
return "Detail";
}
public String doc(){
prisonerContrabandGoods = prisonerContrabandGoodsService.detailByPrisoner(prisonerId);
return "doc";
}
public PrisonerContrabandGoodsService getPrisonerContrabandGoodsService() {
return prisonerContrabandGoodsService;
}
public void setPrisonerContrabandGoodsService(
PrisonerContrabandGoodsService prisonerContrabandGoodsService) {
this.prisonerContrabandGoodsService = prisonerContrabandGoodsService;
}
public DictionaryService getDictionaryService() {
return dictionaryService;
}
public void setDictionaryService(DictionaryService dictionaryService) {
this.dictionaryService = dictionaryService;
}
public List<Police> getPolicelist() {
return policelist;
}
public void setPolicelist(List<Police> policelist) {
this.policelist = policelist;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<PrisonerContrabandGoods> getList() {
return list;
}
public void setList(List<PrisonerContrabandGoods> list) {
this.list = list;
}
public PrisonerContrabandGoods getPrisonerContrabandGoods() {
return prisonerContrabandGoods;
}
public void setPrisonerContrabandGoods(
PrisonerContrabandGoods prisonerContrabandGoods) {
this.prisonerContrabandGoods = prisonerContrabandGoods;
}
public ContrabandGoods getContrabandGoods() {
return contrabandGoods;
}
public void setContrabandGoods(ContrabandGoods contrabandGoods) {
this.contrabandGoods = contrabandGoods;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPrisonerId() {
return prisonerId;
}
public void setPrisonerId(String prisonerId) {
this.prisonerId = prisonerId;
}
public LogFactory getLog() {
return log;
}
public void setLog(LogFactory log) {
this.log = log;
}
}
| [
"[email protected]"
] | ||
c910a472cd139422fce8349830ae9074ce8d9277 | 9f7c6324f63b1f19f93bb9aea42c8391c9171486 | /src/main/java/com/itlize/ResourceManagement/Service/Impl/ResourceServiceImpl.java | 75fd1aafffbc55ff90d8e193925ff35a7985b312 | [] | no_license | jaspervhr-dev/ResourceManagement | 894f4c9777f3518f742be88d7f7805a7fa8e1296 | af26682ceb1cbc9c1f6ae583d4d7f0a4b8778a2a | refs/heads/master | 2023-08-15T12:44:18.826472 | 2021-10-11T04:02:01 | 2021-10-11T04:02:01 | 411,016,012 | 0 | 0 | null | 2021-10-05T15:58:47 | 2021-09-27T19:25:30 | Java | UTF-8 | Java | false | false | 901 | java | package com.itlize.ResourceManagement.Service.Impl;
import com.itlize.ResourceManagement.Entity.Resource;
import com.itlize.ResourceManagement.Repository.ResourceRepository;
import com.itlize.ResourceManagement.Service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Siteng Fan
* @date 9/29/21 11:45 AM
*/
@Service
public class ResourceServiceImpl implements ResourceService {
@Autowired
ResourceRepository resourceRepository;
@Override
public Resource findOneById(Integer id) {
return resourceRepository.findById(id).orElse(null);
}
@Override
public List<Resource> findALl() {
return resourceRepository.findAll();
}
@Override
public void addOne(Resource resource) {
resourceRepository.save(resource);
}
}
| [
"[email protected]"
] | |
8862036c37fa3addf5931052c49b912b9e92bf4a | 8820fc33ecd70d398573e205e359e9d0d3447f24 | /src/main/java/com/wiselink/exception/ServiceException.java | d3e78372160762fd537c93f2fc79526a91babc86 | [] | no_license | leoyonn/erp | 06bc95a9328628ec7d1397143b6a888eacbe500c | 34a9671e59fa3dfcb15a43a7b990e5daa25110ef | refs/heads/master | 2021-01-10T20:36:53.926279 | 2013-09-14T06:24:12 | 2013-09-14T06:24:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | /**
* ServiceException.java
* [CopyRight]
* @author leo [[email protected]]
* @date 2013-6-14 下午6:15:25
*/
package com.wiselink.exception;
/**
* 服务层出现的异常
* @author leo
*/
public class ServiceException extends Exception {
private static final long serialVersionUID = 1L;
public ServiceException() {
super();
}
public ServiceException(String message) {
super(message);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
public ServiceException(Throwable cause) {
super(cause);
}
}
| [
"[email protected]"
] | |
ffdc8a5149836c7d8768f10ff3780f2de0e71820 | 71aabef4b162ee6b7ad8248fe578a4ec78a1d761 | /src/main/java/com/programapprentice/app/FlattenBinaryTreeToLinkedList_114.java | 33e5854350d2fa703e8d680896a069469a681b03 | [] | no_license | program-apprentice/leetcode | 9eb67066a45f67c459e6a59268669ed58c82520b | 38dab4d4faa04d48d2052ad31322eff34cb0dae3 | refs/heads/master | 2021-01-16T17:45:45.644339 | 2015-11-11T05:16:22 | 2015-11-11T05:16:22 | 40,210,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,398 | java | package com.programapprentice.app;
import com.programapprentice.util.TreeNode;
/**
* User: program-apprentice
* Date: 9/7/15
* Time: 8:33 PM
*/
public class FlattenBinaryTreeToLinkedList_114 {
// Recursive is too slow
public void flatten_v1(TreeNode root) {
if(root == null) {
return;
}
flatten_v1(root.left);
TreeNode p = root.left;
if(p != null) {
while (p.right != null) {
p = p.right;
}
flatten_v1(root.right);
p.right = root.right;
root.right = root.left;
}
}
public void flatten(TreeNode root) {
flatten2(root);
}
// return last node in flatten
public TreeNode flatten2(TreeNode root) {
if(root == null) {
return root; // wrong: return null
}
if(root.left == null && root.right == null) {
return root;
}
TreeNode left = root.left;
TreeNode right = root.right;
TreeNode leftLast = flatten2(left);
if(leftLast != null) {
root.left = null; // missing this one.
root.right = left; // wrong: root.left = left
leftLast.right = right;
}
TreeNode rightLast = flatten2(right);
if(rightLast != null) {
return rightLast;
}
return leftLast;
}
}
| [
"[email protected]"
] | |
e5fea9ca59ab9a3ae8ea67a376ef0fd3c8d7d7c0 | 60231321ae07d564d4245ba7182b5ffd455da7a5 | /JavaIoProgramming/src/ch18/exam09/CopyExample.java | 196ca3c8d67e0a8e42a17e35b79f0fcdf89537b0 | [] | no_license | JeongSemi/TestRepository | 1fc7b1b86e75adcf72f5584389bde2311b5c647f | 3e16625c5802302f505a507f89bf187265269061 | refs/heads/master | 2021-01-20T00:45:51.856815 | 2017-08-29T05:26:45 | 2017-08-29T05:26:45 | 89,182,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | package ch18.exam09;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
public class CopyExample {
public static void main(String[] args) throws FileNotFoundException, IOException {
Reader reader = new FileReader("src/ch18/exam09/test.txt");
Writer writer = new FileWriter("src/ch18/exam09/test2.txt");
char[] data = new char[3];
int readChars = -1;
while (true) {
readChars = reader.read(data);
if (readChars == -1) {
break;
}
writer.write(data, 0, readChars);
}
writer.flush();
writer.close();
}
}
| [
"[email protected]"
] | |
4f663c25fa1272e32bec9a613804876d23f3e618 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Closure-114/com.google.javascript.jscomp.NameAnalyzer/default/20/com/google/javascript/jscomp/NameAnalyzer_ESTest.java | 1c0dfc72a0f7f0e25483bd07b18800560efb8b75 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 8,257 | java | /*
* This file was automatically generated by EvoSuite
* Thu Jul 29 20:09:21 GMT 2021
*/
package com.google.javascript.jscomp;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.google.javascript.jscomp.AbstractCompiler;
import com.google.javascript.jscomp.Compiler;
import com.google.javascript.jscomp.NameAnalyzer;
import com.google.javascript.jscomp.Normalize;
import com.google.javascript.jscomp.PeepholeSubstituteAlternateSyntax;
import com.google.javascript.jscomp.StatementFusion;
import com.google.javascript.rhino.Node;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.mock.java.io.MockPrintStream;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class NameAnalyzer_ESTest extends NameAnalyzer_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
NameAnalyzer nameAnalyzer0 = new NameAnalyzer((AbstractCompiler) null, true);
nameAnalyzer0.removeUnreferenced();
}
@Test(timeout = 4000)
public void test01() throws Throwable {
NameAnalyzer nameAnalyzer0 = new NameAnalyzer((AbstractCompiler) null, true);
// Undeclared exception!
// try {
nameAnalyzer0.process((Node) null, (Node) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.google.javascript.jscomp.NodeTraversal", e);
// }
}
@Test(timeout = 4000)
public void test02() throws Throwable {
Compiler compiler0 = new Compiler();
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "groupVariableDeclarations");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test03() throws Throwable {
MockPrintStream mockPrintStream0 = new MockPrintStream("=T,ZYuZiWDR,H(Q");
Compiler compiler0 = new Compiler(mockPrintStream0);
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
StatementFusion statementFusion0 = new StatementFusion(false);
PeepholeSubstituteAlternateSyntax peepholeSubstituteAlternateSyntax0 = new PeepholeSubstituteAlternateSyntax(false);
Node node0 = Normalize.parseAndNormalizeTestCode(compiler0, "com.google.javascript.rhino.head.ScriptableObject$GetterSlot");
nameAnalyzer0.process(node0, node0);
nameAnalyzer0.process(node0, node0);
assertEquals(2, Node.FLAG_THIS_UNMODIFIED);
}
@Test(timeout = 4000)
public void test04() throws Throwable {
Compiler compiler0 = new Compiler();
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "comgo^gle.javasWript.jscomp.NameAnalyzer$JsNameRefNode");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test05() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
Node node0 = Node.newNumber((double) 119);
Node node1 = new Node(119, node0, node0, node0, node0, 8, 57);
nameAnalyzer0.process(node0, node1);
assertEquals(2, Node.POST_FLAG);
}
@Test(timeout = 4000)
public void test06() throws Throwable {
Compiler compiler0 = new Compiler();
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "comgo^gle.javasWript.jcomp.NameAnalyze]$Js%ameRefNode");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test07() throws Throwable {
MockPrintStream mockPrintStream0 = new MockPrintStream("=T,ZYuZiWDR,H(Q");
Compiler compiler0 = new Compiler(mockPrintStream0);
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
StatementFusion statementFusion0 = new StatementFusion(true);
PeepholeSubstituteAlternateSyntax peepholeSubstituteAlternateSyntax0 = new PeepholeSubstituteAlternateSyntax(false);
Node node0 = Normalize.parseAndNormalizeTestCode(compiler0, "window");
Node node1 = new Node(49, node0);
nameAnalyzer0.process(node0, node1);
assertFalse(node1.isNull());
}
@Test(timeout = 4000)
public void test08() throws Throwable {
Compiler compiler0 = new Compiler();
// Undeclared exception!
// try {
compiler0.parseTestCode("wino2.K");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test09() throws Throwable {
Compiler compiler0 = new Compiler();
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "com.google.javasWript.jscomp.NameAnalyzer$JsNameRefNode");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test10() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
Node node0 = Node.newNumber((double) 154);
Node node1 = new Node(154, node0, node0, node0, node0, 8, 57);
// Undeclared exception!
// try {
nameAnalyzer0.process(node1, node1);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// }
}
@Test(timeout = 4000)
public void test11() throws Throwable {
Compiler compiler0 = new Compiler();
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "fBhknVGzwNgz=UHF");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test12() throws Throwable {
Compiler compiler0 = new Compiler();
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "com.googl.javascript.jscomp.NameAnalyzer$AliasSet");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
}
| [
"[email protected]"
] | |
2acff1316d708a3c4b5c9600f4f088f0616b5db7 | 9f04e9f9a22ecddfce6260e552878c359ea9273a | /FMP/api/src/main/java/ua/softserve/rv036/findmeplace/config/WebMvcConfig.java | 41c1f55283266ba624cd8abc32eee45144219027 | [] | no_license | alexleokyky/study-devops | 83354267cce59eb7b88a1bd455daf42c9e22bf2d | 181041d814e361a3f6763d4db11c5b0a28814205 | refs/heads/master | 2020-04-30T04:37:13.090976 | 2019-04-01T13:22:58 | 2019-04-01T13:22:58 | 176,614,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package ua.softserve.rv036.findmeplace.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
private final long MAX_AGE_SECS = 3600;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("HEAD", "OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE")
.maxAge(MAX_AGE_SECS);
}
} | [
"[email protected]"
] | |
8d2d2a8a335568d4b66bd54323faf460e2273a2a | 1e225a48a7cbd7e7bb6f8a2d3922cb5b69767b55 | /mybatisPlus/src/main/java/com/example/demo/person/controller/PersonController.java | e89b6139a0452ebfbf928014269b127788a300c3 | [] | no_license | zpTree/USDemo | 5dfe9ee12bd6d864707d3d7e2dafb8cfe612d04c | 5fc9253eee6b44bd5bdad705b421492a90149f60 | refs/heads/master | 2020-04-02T03:45:04.290698 | 2019-06-14T16:59:39 | 2019-06-14T16:59:39 | 153,982,255 | 0 | 0 | null | 2019-10-31T12:17:28 | 2018-10-21T07:05:25 | Java | UTF-8 | Java | false | false | 803 | java | package com.example.demo.person.controller;
import com.example.demo.person.entity.Person;
import com.example.demo.person.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* <p>
* 前端控制器
* </p>
*
* @author ZP
* @since 2019-06-14
*/
@Controller
@RequestMapping("/person")
public class PersonController {
@Autowired
private IPersonService personService;
@RequestMapping("getPerson")
@ResponseBody
public String getPerson(){
Person p = personService.getById("1");
System.out.print("getPerson");
return p.toString();
}
}
| [
"[email protected]"
] | |
6699f4994ce313c48f268499e2d5c9ef1abdbcd5 | e434c81fb59ecaeacbc3da9dd4a24c3bac8c99e3 | /TuanNgoaiLe_Exception/FileNotFoundException.java | 52c7e553073ba2f151c5986232c5e51da8680f4e | [] | no_license | HuyNguyen1302/OOP2020 | b12a5fd9cebe05c061acf0b10e43c1e9e14ff522 | b307b4a3ad45174fa0f343695457ef6b56a8d4e0 | refs/heads/master | 2022-12-01T00:53:48.583277 | 2020-08-21T07:23:20 | 2020-08-21T07:23:20 | 284,185,277 | 0 | 0 | null | 2020-08-07T18:09:59 | 2020-08-01T04:23:12 | Java | UTF-8 | Java | false | false | 750 | java | package Task2;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class FileNotFoundException {
static String filename = "f_out.txt";
public static void readFile(String filename) throws java.io.FileNotFoundException, IOException {
BufferedReader br;
FileReader f = new FileReader("f_out.txt");
br = new BufferedReader(f);
System.out.println(br.lines());
}
public static void main(String[] args) {
try {
readFile(filename);
} catch ( java.io.FileNotFoundException e) {
System.out.println("Không tìm thấy file");
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
| [
"[email protected]"
] | |
d71ad8f9685221efded6c035045e202dfb3d3c31 | 61f67f88ad20a7b78d869b648a80fa5946c57fec | /src/main/java/test/hqltest.java | 7eabbda14285d73f1d492308bcf3483a79bdaf34 | [] | no_license | Fullcreammilk/RJJH | 23d604ab293c81d5677a48289f506604a667e0e4 | 18bf603c7a30c73f39ca7a866dc1cfa0c0b2eaf7 | refs/heads/master | 2020-03-18T21:31:14.830764 | 2018-07-02T14:04:31 | 2018-07-02T14:04:31 | 135,285,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,128 | java | package test;
import com.edu.nju.wel.dao.*;
import com.edu.nju.wel.model.*;
import com.edu.nju.wel.service.CompanyDetailService;
import com.edu.nju.wel.service.MakerDetailService;
import com.edu.nju.wel.service.UserService;
import com.edu.nju.wel.service.impl.CompanyDetailImpl;
import com.edu.nju.wel.service.impl.MakerDetailImpl;
import com.edu.nju.wel.util.Persistence;
import com.edu.nju.wel.util.ToBigImage;
import org.junit.Test;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Created by ${WX} on 2017/4/15.
*/
@Controller
public class hqltest {
@Resource(name = "UserService")
UserService userService;
CompanyDetailService companyDetailService = new CompanyDetailImpl();
@Test
public void test1() {
UserDao userDao = DAOManager.userDao;
// userDao.find("hyx");
// MovieReviewDao movieReviewDao=DAOManager.movieReviewDao;
// movieReviewDao.find();
User u = new User();
u.setName("gmd");
// u.setAge(2);
userDao.add(u);
}
// @Test
// public void test2(){
// // userService= (UserServiceImpl) ApplicationContextHelper.getApplicationContext().getBean("UserService");
// List<User> list = userService.find();
// for (User u:
// list) {
// System.out.println(u.getId());
//
// }
// }
@Test
public void test3() {
MovieReviewDao dao = DAOManager.movieReviewDao;
dao.find("b");
}
@Test
public void test4() {
MovieDetailDao dao = DAOManager.movieDetailDao;
List<MovieDetailPO> list = dao.getAll();
for (MovieDetailPO po : list
) {
System.out.println(po.getName());
}
MovieDetailPO po = dao.getByName("The Shawshank Redemption");
System.out.println(po.getName());
Iterator<String> iterator = dao.getCreators("The Shawshank Redemption");
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
iterator = dao.getStars("The Shawshank Redemption");
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
}
@Test
public void test5() {
MakerDetailDao dao = DAOManager.makerDetailDao;
List<MakerDetailPO> list = dao.getAll("star");
for (MakerDetailPO po : list
) {
System.out.println(po.getName());
}
MakerDetailPO po = dao.getByName("Arshad Warsi");
System.out.println(po.getName());
Iterator<String> iterator = dao.getMovies("Arshad Warsi");
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
}
@Test
public void test6() {
System.out.println(ToBigImage.toBigImage("https://images-na.ssl-images-amazon.com/images/M/MV5BYzVlMWViZGEtYjEyYy00YWZmLThmZGEtYmM4MDZlN2Q5MmRmXkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_UX182_CR0,0,182,268_AL_.jpg"));
}
@Test
public void test7() {
List<MakerDetailPO> list = DAOManager.makerDetailDao.getAllByFirstLetter("star", "A");
// for (MakerDetailPO po:list
// ) {
// System.out.println(po.getName());
// }
}
@Test
public void test8() {
MovieReviewPO po = new MovieReviewPO();
po.setAll(1);
po.setUseful(2);
DAOManager.movieReviewDao.find("");
}
@Test
public void test9() {
List<MovieReviewPO> list = DAOManager.movieReviewDao.find("Dangal");
for (MovieReviewPO po :
list) {
System.out.println(po.getAuthor());
}
System.out.println(DAOManager.movieReviewDao.getPersonalReviewNum("12 Angry Men"));
}
@Test
public void test10() {
List<RewardPO> list = DAOManager.rewardDao.getByMovieName("Ben-Hur");
for (RewardPO po : list
) {
System.out.println(po.getMovieName());
System.out.println(po.getPeopleName());
System.out.println(po.getRewardYear());
System.out.println(po.getRewardName());
System.out.println(po.getRewardType());
}
}
@Test
public void test11() {
DAOManager.makerDetailDao.getAll("star");
}
@Test
public void test12() {
List<MovieDetailPO> list = DAOManager.movieDetailDao.getAll();
int count = 0;
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i).getReleDate());
count++;
}
System.out.println(count);
}
@Test
public void test13() {
Map<Integer, Integer> map = companyDetailService.getCompanyAwards("Twentieth Century Fox", "nomiees", "oscar");
Iterator<Integer> integerIterator = map.keySet().iterator();
while (integerIterator.hasNext()) {
Integer i = integerIterator.next();
System.out.println(i + ":" + map.get(i));
}
}
@Test
public void test14() {
Map<String, Double> map = companyDetailService.getTopSix("Twentieth Century Fox");
for (String s : map.keySet()) {
System.out.println(s);
}
}
@Test
public void test15() {
List<LittleAwardsPO> littleAwardsPOS = DAOManager.littleAwardsDao.getByName("Woody Allen", "star");
Iterator<LittleAwardsPO> iterator = littleAwardsPOS.iterator();
LittleAwardsPO littleAwardsPO;
int temp = 0;
while (iterator.hasNext()) {
littleAwardsPO = iterator.next();
temp += (littleAwardsPO.getWon() + littleAwardsPO.getNominated() * 0.5);
System.out.println(littleAwardsPO.getWon() + " " + littleAwardsPO.getNominated());
}
System.out.println(temp);
}
@Test
public void test16() {
List<MakerDetailPO> list = Persistence.getAllMaker("star");
for (MakerDetailPO po :
list) {
DAOManager.makerDetailDao.getByName(po.getName());
}
}
@Test
public void test17() {
List<MakerDetailPO> list = DAOManager.makerDetailDao.modify("Woody Allen", "star");
System.out.println(list.size());
for (int i = 1; i < list.size(); i++) {
DAOManager.makerDetailDao.delete(list.get(i));
}
DAOManager.makerDetailDao.getByName("Woody Allen");
}
@Test
public void test18() {
MakerDetailService service = new MakerDetailImpl();
Map<String, Double> map = service.getMakerRadarMap("Woody Allen", "star");
Iterator<String> iterator = map.keySet().iterator();
while (iterator.hasNext()) {
String s = iterator.next();
System.out.println(s + ":" + map.get(s));
}
}
@Test
public void test19() {
System.out.println(DAOManager.favoriteDao.getMakerByUserName("gmd","creator").get(0).getName());
}
@Test
public void test20(){
DAOManager.favoriteDao.getMakerByUserName("wx","creator");
}
}
| [
"[email protected]"
] | |
38748a77818e136c2e262507b2789c1df0c51e23 | 677e3f9b2be1b6066bc1a5dc59b1bf29d4395882 | /SCT2/tags/ci-build/jenkins-YAKINDU_SCT2_CI-799/test-plugins/org.yakindu.sct.generator.java.runtime.test/src-gen/org/yakindu/sct/runtime/java/test_hierarchy/Test_HierarchyCycleBasedStatemachine.java | 386e1b52f1d2bc68b9439b74e8f23b3114217d16 | [] | no_license | peterharaszin/yakindu | 5647464966b6fb953272603441fd08d412c27a18 | 6990984f2c67a853f02cfc7a58e1741f136032f0 | refs/heads/master | 2021-01-10T21:33:19.748169 | 2015-04-22T12:52:50 | 2015-04-22T12:52:50 | 34,406,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,322 | java | /**
Copyright (c) 2011 committers of YAKINDU and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
committers of YAKINDU - initial API and implementation
*/
package org.yakindu.sct.runtime.java.test_hierarchy;
import java.util.Collection;
import java.util.HashSet;
import org.yakindu.sct.runtime.java.Event;
import org.yakindu.sct.runtime.java.EventVector;
import org.yakindu.sct.runtime.java.IStatemachine;
public class Test_HierarchyCycleBasedStatemachine implements IStatemachine {
public enum State {
State1, State9, State10, State2, State3, State4, State5, State6, State7, State8, $NullState$
};
private DefaultInterfaceImpl defaultInterface;
private final State[] stateVector = new State[1];
private int nextStateIndex;
private final EventVector<Event<? extends Enum<?>>> occuredEvents;
private final Collection<Event<? extends Enum<?>>> outEvents;
public Test_HierarchyCycleBasedStatemachine() {
occuredEvents = new EventVector<Event<? extends Enum<?>>>(16);
outEvents = new HashSet<Event<? extends Enum<?>>>();
defaultInterface = new DefaultInterfaceImpl(this);
}
protected Collection<Event<? extends Enum<?>>> getOccuredEvents() {
return occuredEvents;
}
protected Collection<Event<? extends Enum<?>>> getOutEvents() {
return outEvents;
}
protected boolean eventOccured() {
return !occuredEvents.isEmpty();
}
public void init() {
for (int i = 0; i < stateVector.length; i++) {
stateVector[i] = State.$NullState$;
}
occuredEvents.clear();
}
public boolean isStateActive(State state) {
for (int i = 0; i < stateVector.length; i++) {
if (stateVector[i] == state) {
return true;
}
}
return false;
}
public DefaultInterface getDefaultInterface() {
return defaultInterface;
}
public void enter() {
defaultInterface.setVarS1(1);
defaultInterface.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
}
private void reactState1() {
}
private void reactState9() {
if (occuredEvents.contains(defaultInterface.getEventEvent1())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State9 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS1(defaultInterface.getVarS1() - (1));
break;
case State10 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS1(defaultInterface.getVarS1() - (1));
break;
default :
break;
}
defaultInterface.setVarS1(defaultInterface.getVarS1() - (1));
defaultInterface.setVarS2(1);
defaultInterface.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State3;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent9())) {
stateVector[0] = State.$NullState$;
defaultInterface.setVarS1(defaultInterface.getVarS1() - (1));
defaultInterface.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State10;
}
}
}
private void reactState10() {
if (occuredEvents.contains(defaultInterface.getEventEvent1())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State9 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS1(defaultInterface.getVarS1() - (1));
break;
case State10 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS1(defaultInterface.getVarS1() - (1));
break;
default :
break;
}
defaultInterface.setVarS1(defaultInterface.getVarS1() - (1));
defaultInterface.setVarS2(1);
defaultInterface.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State3;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent10())) {
stateVector[0] = State.$NullState$;
defaultInterface.setVarS1(defaultInterface.getVarS1() - (1));
defaultInterface.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
}
}
}
private void reactState2() {
}
private void reactState3() {
if (occuredEvents.contains(defaultInterface.getEventEvent6())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State3 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State5 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
default :
break;
}
defaultInterface.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent2())) {
stateVector[0] = State.$NullState$;
defaultInterface.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface.getVarS2() + (1));
defaultInterface.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State5;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent11())) {
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface
.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
} else {
if (occuredEvents.contains(defaultInterface
.getEventEvent14())) {
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface
.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
}
}
}
}
}
private void reactState4() {
}
private void reactState5() {
if (occuredEvents.contains(defaultInterface.getEventEvent6())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State3 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State5 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
default :
break;
}
defaultInterface.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent7())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State5 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
default :
break;
}
defaultInterface.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State3;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent3())) {
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() + (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State7;
} else {
if (occuredEvents.contains(defaultInterface
.getEventEvent12())) {
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface
.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
} else {
if (occuredEvents.contains(defaultInterface
.getEventEvent15())) {
stateVector[0] = State.$NullState$;
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface.setVarS1(defaultInterface
.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State10;
}
}
}
}
}
}
private void reactState6() {
}
private void reactState7() {
if (occuredEvents.contains(defaultInterface.getEventEvent6())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State3 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State5 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
default :
break;
}
defaultInterface.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent7())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State5 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
default :
break;
}
defaultInterface.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State3;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent8())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
break;
default :
break;
}
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State5;
} else {
if (occuredEvents.contains(defaultInterface
.getEventEvent4())) {
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State8;
}
}
}
}
}
private void reactState8() {
if (occuredEvents.contains(defaultInterface.getEventEvent6())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State3 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State5 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
default :
break;
}
defaultInterface.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface.setVarS1(defaultInterface.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent7())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State5 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
break;
default :
break;
}
defaultInterface.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State3;
} else {
if (occuredEvents.contains(defaultInterface.getEventEvent8())) {
//Handle exit of all possible states on position 0...
switch (stateVector[0]) {
case State7 :
stateVector[0] = State.$NullState$;
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
break;
case State8 :
stateVector[0] = State.$NullState$;
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
break;
default :
break;
}
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State5;
} else {
if (occuredEvents.contains(defaultInterface
.getEventEvent5())) {
stateVector[0] = State.$NullState$;
defaultInterface
.setVarS2(defaultInterface.getVarS2() - (1));
defaultInterface
.setVarS2(defaultInterface.getVarS2() + (1));
nextStateIndex = 0;
stateVector[0] = State.State7;
} else {
if (occuredEvents.contains(defaultInterface
.getEventEvent13())) {
stateVector[0] = State.$NullState$;
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface.setVarS1(defaultInterface
.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State9;
} else {
if (occuredEvents.contains(defaultInterface
.getEventEvent16())) {
stateVector[0] = State.$NullState$;
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS2(defaultInterface
.getVarS2() - (1));
defaultInterface.setVarS1(1);
defaultInterface.setVarS1(defaultInterface
.getVarS1() + (1));
nextStateIndex = 0;
stateVector[0] = State.State10;
}
}
}
}
}
}
}
public void runCycle() {
outEvents.clear();
for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
switch (stateVector[nextStateIndex]) {
case State1 :
reactState1();
break;
case State9 :
reactState9();
break;
case State10 :
reactState10();
break;
case State2 :
reactState2();
break;
case State3 :
reactState3();
break;
case State4 :
reactState4();
break;
case State5 :
reactState5();
break;
case State6 :
reactState6();
break;
case State7 :
reactState7();
break;
case State8 :
reactState8();
break;
default :
// $NullState$
}
}
occuredEvents.clear();
}
}
| [
"[email protected]@6a4fa09a-a2c1-c95f-7b62-f4ef5be68d87"
] | [email protected]@6a4fa09a-a2c1-c95f-7b62-f4ef5be68d87 |
f8d2c34d6568dc943a4eb46a6c3698c1513e7925 | bfa558655a172335d947e9c4bd28232bc094e7a5 | /service/src/main/java/org/sunbird/service/tenantpreference/TenantPreferenceService.java | 1811a4ea50808a9fecb722837e9ab12a598d8950 | [
"MIT"
] | permissive | Hari-stackroute/sunbird-lms-service | e76a4195868c6cccbf7411a9e3e38d9ff6336c87 | e608f695bebf624d94be0f48549029ca12d32b5d | refs/heads/master | 2023-08-25T20:39:02.866323 | 2022-11-09T06:32:15 | 2022-11-09T06:32:15 | 198,610,823 | 0 | 0 | MIT | 2019-07-24T10:14:26 | 2019-07-24T10:14:26 | null | UTF-8 | Java | false | false | 4,443 | java | package org.sunbird.service.tenantpreference;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.sql.Timestamp;
import java.text.MessageFormat;
import java.util.*;
import org.apache.commons.collections.CollectionUtils;
import org.sunbird.dao.tenantpreference.TenantPreferenceDao;
import org.sunbird.dao.tenantpreference.impl.TenantPreferenceDaoImpl;
import org.sunbird.exception.ProjectCommonException;
import org.sunbird.exception.ResponseCode;
import org.sunbird.exception.ResponseMessage;
import org.sunbird.keys.JsonKey;
import org.sunbird.logging.LoggerUtil;
import org.sunbird.request.RequestContext;
import org.sunbird.response.Response;
import org.sunbird.util.ProjectUtil;
public class TenantPreferenceService {
private final LoggerUtil logger = new LoggerUtil(TenantPreferenceService.class);
private final ObjectMapper mapper = new ObjectMapper();
private final TenantPreferenceDao preferenceDao = TenantPreferenceDaoImpl.getInstance();
public Map<String, Object> validateAndGetTenantPreferencesById(
String orgId, String key, String operationType, RequestContext context) {
List<Map<String, Object>> orgPreference =
preferenceDao.getTenantPreferenceById(orgId, key, context);
if (JsonKey.CREATE.equalsIgnoreCase(operationType)
&& CollectionUtils.isNotEmpty(orgPreference)) {
throw new ProjectCommonException(
ResponseCode.errorParamExists,
MessageFormat.format(
ResponseCode.resourceNotFound.getErrorMessage(),
(ProjectUtil.formatMessage(ResponseMessage.Message.AND_FORMAT, key, orgId))),
ResponseCode.CLIENT_ERROR.getResponseCode());
} else if (((JsonKey.GET.equalsIgnoreCase(operationType))
|| (JsonKey.UPDATE.equalsIgnoreCase(operationType)))
&& CollectionUtils.isEmpty(orgPreference)) {
throw new ProjectCommonException(
ResponseCode.resourceNotFound,
MessageFormat.format(
ResponseCode.resourceNotFound.getErrorMessage(),
(ProjectUtil.formatMessage(ResponseMessage.Message.AND_FORMAT, key, orgId))),
ResponseCode.RESOURCE_NOT_FOUND.getResponseCode());
}
if (CollectionUtils.isNotEmpty(orgPreference)) {
try {
String data = (String) orgPreference.get(0).get(JsonKey.DATA);
Map<String, Object> map = mapper.readValue(data, new TypeReference<>() {});
orgPreference.get(0).put(JsonKey.DATA, map);
return orgPreference.get(0);
} catch (Exception e) {
logger.error(
context,
"TenantPreferenceService:Exception while reading preferences " + e.getMessage(),
e);
}
}
return Collections.emptyMap();
}
public Response createPreference(
String orgId,
String key,
Map<String, Object> data,
String createdBy,
RequestContext context) {
try {
Map<String, Object> dbMap = new HashMap<>();
dbMap.put(JsonKey.ORG_ID, orgId);
dbMap.put(JsonKey.KEY, key);
dbMap.put(JsonKey.DATA, mapper.writeValueAsString(data));
dbMap.put(JsonKey.CREATED_BY, createdBy);
dbMap.put(JsonKey.CREATED_ON, new Timestamp(Calendar.getInstance().getTimeInMillis()));
return preferenceDao.insertTenantPreference(dbMap, context);
} catch (Exception e) {
logger.error(
context,
"TenantPreferenceService:Exception while adding preferences " + e.getMessage(),
e);
}
return null;
}
public Response updatePreference(
String orgId,
String key,
Map<String, Object> data,
String updatedBy,
RequestContext context) {
try {
Map<String, Object> preference = new HashMap<>();
Map<String, Object> clusteringKeys = new HashMap<>();
clusteringKeys.put(JsonKey.KEY, key);
clusteringKeys.put(JsonKey.ORG_ID, orgId);
preference.put(JsonKey.DATA, mapper.writeValueAsString(data));
preference.put(JsonKey.UPDATED_BY, updatedBy);
preference.put(JsonKey.UPDATED_ON, new Timestamp(Calendar.getInstance().getTimeInMillis()));
return preferenceDao.updateTenantPreference(preference, clusteringKeys, context);
} catch (Exception e) {
logger.error(
context,
"TenantPreferenceService:Exception while updating preferences " + e.getMessage(),
e);
}
return null;
}
}
| [
"[email protected]"
] | |
988365e997f81775a378d4e73e15098ed47b8a1a | 9dc11d068f883b15a0fd45935a834c896b722ec0 | /app/src/main/java/com/hotellook/dependencies/DatabaseModule_ProvideLocationFavoritesCacheFactory.java | 7c9505b601f07613ea52d174efe85282ab1ddf9a | [
"Apache-2.0"
] | permissive | justyce2/HotellookDagger | 7a44d9b263cbde0da05759119d9c01e9d2090dc6 | 7229312d711c6cb1f8fc5cfafb413a3c5aff6dbe | refs/heads/master | 2020-03-31T21:04:23.472668 | 2016-07-27T09:03:11 | 2016-07-27T09:03:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,699 | java | package com.hotellook.dependencies;
import com.hotellook.db.FavoritesRepository;
import com.hotellook.db.SearchDestinationFavoritesCache;
import dagger.internal.Factory;
import dagger.internal.Preconditions;
import javax.inject.Provider;
public final class DatabaseModule_ProvideLocationFavoritesCacheFactory implements Factory<SearchDestinationFavoritesCache> {
static final /* synthetic */ boolean $assertionsDisabled;
private final DatabaseModule module;
private final Provider<FavoritesRepository> repositoryProvider;
static {
$assertionsDisabled = !DatabaseModule_ProvideLocationFavoritesCacheFactory.class.desiredAssertionStatus();
}
public DatabaseModule_ProvideLocationFavoritesCacheFactory(DatabaseModule module, Provider<FavoritesRepository> repositoryProvider) {
if ($assertionsDisabled || module != null) {
this.module = module;
if ($assertionsDisabled || repositoryProvider != null) {
this.repositoryProvider = repositoryProvider;
return;
}
throw new AssertionError();
}
throw new AssertionError();
}
public SearchDestinationFavoritesCache get() {
return (SearchDestinationFavoritesCache) Preconditions.checkNotNull(this.module.provideLocationFavoritesCache((FavoritesRepository) this.repositoryProvider.get()), "Cannot return null from a non-@Nullable @Provides method");
}
public static Factory<SearchDestinationFavoritesCache> create(DatabaseModule module, Provider<FavoritesRepository> repositoryProvider) {
return new DatabaseModule_ProvideLocationFavoritesCacheFactory(module, repositoryProvider);
}
}
| [
"[email protected]"
] | |
d564e38c25c3fc88bbbe359424ede833144bb00a | b4455f4f99e4d3eda863812f29f0161089e4d0b8 | /presentation/src/main/java/com/fernandocejas/android10/sample/presentation/ui/home/adapter/HomeViewHolder.java | e25d91b6b48430cf8bcb44e07abe5734dd7cf393 | [
"Apache-2.0"
] | permissive | leeprohacker/MAndroidCleanArchitecture | a42d350881d9afcfd3cec26a3e4413701c5e0677 | b45da787669cca38f9ba4c1c4df04bc9c2007c53 | refs/heads/master | 2021-04-12T11:02:53.788340 | 2018-03-23T01:28:14 | 2018-03-23T01:28:14 | 126,412,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,670 | java | package com.fernandocejas.android10.sample.presentation.ui.home.adapter;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.AppCompatImageView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseViewHolder;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
import com.fernandocejas.android10.sample.presentation.R;
import com.fernandocejas.android10.sample.presentation.model.giphy.PDataItem;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by Leeprohacker on 3/22/18.
*/
public class HomeViewHolder extends BaseViewHolder {
@BindView(R.id.img_avatar)
SimpleDraweeView imgAvatar;
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.tv_content)
TextView tvContent;
@BindView(R.id.my_image_view)
SimpleDraweeView myImageView;
@BindView(R.id.img_like)
AppCompatImageView imgLike;
@BindView(R.id.tv_like)
TextView tvLike;
@BindView(R.id.view_like)
LinearLayout viewLike;
@BindView(R.id.img_comment)
AppCompatImageView imgComment;
@BindView(R.id.tv_comment)
TextView tvComment;
@BindView(R.id.view_comment)
LinearLayout viewComment;
@BindView(R.id.img_share)
AppCompatImageView imgShare;
@BindView(R.id.tv_share)
TextView tvShare;
@BindView(R.id.view_share)
LinearLayout viewShare;
public HomeViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
}
public void bindView(PDataItem item) {
tvTitle.setText(item.getUser().getDisplayName());
tvContent.setText(item.getImportDatetime());
imgAvatar.setImageURI(item.getUser().getAvatarUrl());
myImageView.setImageURI(item.getImages().getOriginalStill().getUrl());
addOnClickListener(viewLike.getId());
addOnClickListener(viewComment.getId());
addOnClickListener(viewShare.getId());
if(item.isLike()){
imgLike.setColorFilter(ContextCompat.getColor(itemView.getContext(),R.color.colorAccent));
}else {
imgLike.setColorFilter(ContextCompat.getColor(itemView.getContext(),R.color.grey_90));
}
// DraweeController controller = Fresco.newDraweeControllerBuilder()
// .setUri(item.getImages().getOriginalStill().getUrl())
// .setAutoPlayAnimations(true)
// .build();
// imgAvatar.setController(controller);
}
}
| [
"[email protected]"
] | |
0a1f47e56ddf9bb54795de75f9fd901fdbe4ed91 | f021a194631fd6f8549686a651c0e22d5f24802c | /src/test/java/org/apache/lucene/tr/TestZemberek3StemFilter.java | 30add8cb8d52027f8342ecd1c7af70fa08eb8397 | [
"Apache-2.0"
] | permissive | iorixxx/lucene-solr-analysis-turkish | 929d556baeac77e2ae03e52a84f2d62b604da9f4 | 4d4ff9cef2a17616726c07503909e9e66783f759 | refs/heads/master | 2022-12-15T23:51:43.255830 | 2022-10-15T06:57:58 | 2022-10-15T06:57:58 | 18,417,264 | 77 | 24 | Apache-2.0 | 2022-12-04T17:54:42 | 2014-04-03T20:31:55 | Java | UTF-8 | Java | false | false | 3,712 | java | package org.apache.lucene.tr;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.tests.analysis.BaseTokenStreamTestCase;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.custom.CustomAnalyzer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tr.MyTurkishMorphology;
import org.apache.lucene.analysis.tr.TurkishLowerCaseFilter;
import org.apache.lucene.analysis.tr.Zemberek3StemFilter;
import org.apache.lucene.analysis.tr.Zemberek3StemFilterFactory;
import org.junit.Test;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
public class TestZemberek3StemFilter extends BaseTokenStreamTestCase {
private static final MyTurkishMorphology morphology = MyTurkishMorphology.createWithDefaults();
@Test
public void testSomeWords() throws Exception {
TokenStream stream = whitespaceMockTokenizer("kuş gribi aşısı ortaklar çekişme masalı TİCARETİN DE ARTMASI BEKLENİYOR");
stream = new Zemberek3StemFilter(stream, morphology, "maxLength");
assertTokenStreamContents(stream, new String[]{"kuş", "grip", "aşı", "ortak", "çekişme", "masal", "ticaret", "de", "artma", "beklen"});
}
@Test
public void testUnrecognizedWords() throws Exception {
TokenStream stream = whitespaceMockTokenizer("kuku euro");
stream = new Zemberek3StemFilter(stream, morphology, "maxLength");
assertTokenStreamContents(stream, new String[]{"kuku", "euro"});
}
@Test
public void test4SP() throws Exception {
Analyzer analyzer = CustomAnalyzer.builder()
.withTokenizer("standard")
.addTokenFilter("turkishlowercase")
.addTokenFilter(Zemberek3StemFilterFactory.class)
.build();
System.out.println(getAnalyzedTokens("4g.x", analyzer));
System.out.println(getAnalyzedTokens("0.25", analyzer));
System.out.println(getAnalyzedTokens(".", analyzer));
System.out.println(getAnalyzedTokens("bulun.duğunu", analyzer));
assertTrue(getAnalyzedTokens(".", analyzer).isEmpty());
identity("4g.x");
identity("0.25");
identity(".");
TokenStream stream = whitespaceMockTokenizer("4S.P");
stream = new TurkishLowerCaseFilter(stream);
stream = new Zemberek3StemFilter(stream, morphology, "maxLength");
assertTokenStreamContents(stream, new String[]{"4s.p"});
}
private void identity(String word) throws Exception {
TokenStream stream = whitespaceMockTokenizer(word);
stream = new TurkishLowerCaseFilter(stream);
stream = new Zemberek3StemFilter(stream, morphology, "maxLength");
assertTokenStreamContents(stream, new String[]{word});
}
/**
* Modified from : http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/analysis/package-summary.html
*/
public static List<String> getAnalyzedTokens(String text, Analyzer analyzer) {
final List<String> list = new ArrayList<>();
try (TokenStream ts = analyzer.tokenStream("FIELD", new StringReader(text))) {
final CharTermAttribute termAtt = ts.addAttribute(CharTermAttribute.class);
ts.reset(); // Resets this stream to the beginning. (Required)
while (ts.incrementToken())
list.add(termAtt.toString());
ts.end(); // Perform end-of-stream operations, e.g. set the final offset.
} catch (IOException ioe) {
throw new RuntimeException("happened during string analysis", ioe);
}
return list;
}
}
| [
"[email protected]"
] | |
8a70276bab3969ea6d91b26150a79aa88d724c9f | 1620dff752885cbdc96c667752affea6b9dfe8f0 | /eTAAP-Dashboard-Rectifier/src/com/etaap/beans/CommitedCompletedUserStoryCategory.java | bd7b617703fd4be092bf32d1c0c46d2dc2a081b6 | [] | no_license | hmarimuthu/Dashboard | e30ffcc2f491c1afa28ecf3ca94a6d1af7c09266 | 3a84785bca75c74fdcdca81eceeb30fa462cd02b | refs/heads/master | 2021-01-20T18:52:13.238828 | 2016-07-13T22:09:20 | 2016-07-13T22:09:20 | 63,282,609 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package com.etaap.beans;
import java.util.ArrayList;
import java.util.List;
public class CommitedCompletedUserStoryCategory {
String name;
List<String> categories = new ArrayList<String>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getCategories() {
return categories;
}
public void setCategories(List<String> categories) {
this.categories = categories;
}
}
| [
"[email protected]"
] | |
70d41d51de2a822b8d022c7a57b0c7dd27bf9315 | 524b46960d37a14b4be58b4657f17fc9ff78b669 | /gankio/src/main/java/com/sky/gank/net/rxutil/HttpResult.java | 97992986fe5dcac6e7861c40af8b25e6a19c76e2 | [
"Apache-2.0"
] | permissive | SkyZhang007/LazyCat | 70a5600a24ce21c72e453fa330bd5ea5c5f9552e | 7f522b88b3dcd2470458266182e8d659f725ab34 | refs/heads/master | 2021-06-02T16:06:06.787212 | 2019-03-18T09:46:51 | 2019-03-18T09:46:51 | 96,196,158 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | package com.sky.gank.net.rxutil;
/**
* 类名称:
* 类功能:
* 类作者:Sky
* 类日期:2019/1/8 0008.
**/
public class HttpResult<T> {
private boolean error;
private T data;
public boolean isError() {
return error;
}
public void setError(boolean error) {
this.error = error;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
| [
"[email protected]"
] | |
4365d5fa03cbc847dabebd08195ff6166e70e05d | 368c0c6bc01a79f27b5f061aa842108282a6d4f2 | /src/main/java/com/devsuperior/aulajparepository/entities/User.java | 9ddb7a568b2aded9e8c4791af156b249acb6e802 | [] | no_license | SPRINGBOOTJAVA/aula-jparepository | f5b96f99f4a0b33e1b68dc4ba7c09d6bb1d5e2f3 | ab57a6e699cab66589bf69e4807a3100a1f537cb | refs/heads/main | 2023-07-15T20:02:41.366906 | 2021-08-31T21:53:17 | 2021-08-31T21:53:17 | 401,847,087 | 0 | 0 | null | 2021-08-31T21:24:48 | 2021-08-31T21:24:48 | null | UTF-8 | Java | false | false | 1,043 | java | package com.devsuperior.aulajparepository.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "tb_users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private String email;
private Double salary;
public User() {
}
public User(Long id, String name, String email, Double salary) {
super();
this.id = id;
this.name = name;
this.email = email;
this.salary = salary;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Double getSalary() {
return salary;
}
public void setSalary(Double salary) {
this.salary = salary;
}
}
| [
"[email protected]"
] | |
dd0481dcbe4a71fcca3ae6a75402b806e00bd2b7 | 59ca721ca1b2904fbdee2350cd002e1e5f17bd54 | /aliyun-java-sdk-cms/src/main/java/com/aliyuncs/cms/model/v20180308/NodeUninstallResponse.java | 7bf78a795fa155fb52986ce9af4452579594b44f | [
"Apache-2.0"
] | permissive | longtx/aliyun-openapi-java-sdk | 8fadfd08fbcf00c4c5c1d9067cfad20a14e42c9c | 7a9ab9eb99566b9e335465a3358553869563e161 | refs/heads/master | 2020-04-26T02:00:35.360905 | 2019-02-28T13:47:08 | 2019-02-28T13:47:08 | 173,221,745 | 2 | 0 | NOASSERTION | 2019-03-01T02:33:35 | 2019-03-01T02:33:35 | null | UTF-8 | Java | false | false | 1,762 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.cms.model.v20180308;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.cms.transform.v20180308.NodeUninstallResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class NodeUninstallResponse extends AcsResponse {
private Integer errorCode;
private String errorMessage;
private Boolean success;
private String requestId;
public Integer getErrorCode() {
return this.errorCode;
}
public void setErrorCode(Integer errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return this.errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public Boolean getSuccess() {
return this.success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
@Override
public NodeUninstallResponse getInstance(UnmarshallerContext context) {
return NodeUninstallResponseUnmarshaller.unmarshall(this, context);
}
}
| [
"[email protected]"
] | |
87bac4666e7060dd3ba53d28207ebb5dd3066664 | 414fdd8d8805138259872b50d4370038c0a025fb | /priyatham workspace/TODO APP/tasks/src/com/example/tasks/categories/YearlyCls.java | 2e5619e30d03b92c6b2793e4562272161e131806 | [] | no_license | suryaharshan1/android-windroilla | d16295a23d5d597ed7cb45e22153b9ff28c10abd | fc50ff05689a68ba0696d306d1081525777a8012 | refs/heads/master | 2020-04-05T23:19:58.776502 | 2014-08-02T20:21:47 | 2014-08-02T20:21:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,610 | java | package com.example.tasks.categories;
import java.util.ArrayList;
import java.util.List;
import com.example.tasks.CustomAdapter;
import com.example.tasks.R;
import com.example.tasks.RowItem;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
public class YearlyCls extends Fragment {
List<RowItem> rowItems;
RowItem itemData;
CustomAdapter adapter;
SQLiteDatabase db;
Cursor cu;
View rootView;
ListView l1;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
rootView =inflater.inflate(R.layout.yearly, container,false);
rowItems = new ArrayList<RowItem>();
l1=(ListView)rootView.findViewById(R.id.listyearly);
adapter = new CustomAdapter(getActivity(), rowItems);
l1.setAdapter(adapter);
//========================================
db = getActivity().openOrCreateDatabase("tasks", getActivity().MODE_WORLD_WRITEABLE,null);
db.execSQL("create table if not exists tasksdetails(name VARCHAR,time VARCHAR,priority VARCHAR,category VARCHAR)");
//db.execSQL("drop table tasksdetails");
cu= db.rawQuery("select * from tasksdetails where category ='YEARLY' and priority ='HIGH'", null); // null is for mode.
while(cu.moveToNext()){
RowItem item = new RowItem(R.drawable.high,""+cu.getString(0),""+cu.getString(1),cu.getString(2),"("+cu.getString(3)+")");
rowItems.add(item);
adapter.notifyDataSetChanged();
}
cu= db.rawQuery("select * from tasksdetails where category ='YEARLY' and priority ='NORMAL'", null); // null is for mode.
while(cu.moveToNext()){
RowItem item = new RowItem(R.drawable.normal,""+cu.getString(0),""+cu.getString(1),cu.getString(2),"("+cu.getString(3)+")");
rowItems.add(item);
adapter.notifyDataSetChanged();
}
cu= db.rawQuery("select * from tasksdetails where category ='YEARLY' and priority ='LOW'", null); // null is for mode.
while(cu.moveToNext()){
RowItem item = new RowItem(R.drawable.low,""+cu.getString(0),""+cu.getString(1),cu.getString(2),"("+cu.getString(3)+")");
rowItems.add(item);
adapter.notifyDataSetChanged();
}
return rootView;
}
}
| [
"[email protected]"
] | |
a58cc77826e5f8ef9b238dc776adb9b24ccfa54b | dcee00ba00708eece05529b6f38a360d3b07e353 | /src/com/hck/money/bean/Config.java | d499bfb0a45927c620c3540e8c8f81abc5a30827 | [] | no_license | hhhccckkk/zhuanqian_server | 68c5a39108ed7ffeb177e3f771b3db36a5f1ac03 | 56eee5cec8f94cc795306a23036f04cebddab5af | refs/heads/master | 2021-01-21T23:03:56.234728 | 2016-02-15T02:33:18 | 2016-02-15T02:33:18 | 39,005,398 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 980 | java | package com.hck.money.bean;
/**
* News entity. @author MyEclipse Persistence Tools
*/
public class Config implements java.io.Serializable {
// Fields
private Integer id;
private int config1;
private int config2;
private int config3;
private String image1;
private String image2;
public String getImage1() {
return image1;
}
public void setImage1(String image1) {
this.image1 = image1;
}
public String getImage2() {
return image2;
}
public void setImage2(String image2) {
this.image2 = image2;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getConfig1() {
return config1;
}
public void setConfig1(int config1) {
this.config1 = config1;
}
public int getConfig2() {
return config2;
}
public void setConfig2(int config2) {
this.config2 = config2;
}
public int getConfig3() {
return config3;
}
public void setConfig3(int config3) {
this.config3 = config3;
}
} | [
"[email protected]"
] | |
23d685674e7bd700d78b6e72d3afdfd49a3dd78f | f69921ab69c305d90a5dd5f6c3b93f3ffb7e6f6e | /jars/gwt-g3d/gwt-g3d-base/src/gwt/g3d/client/gl2/enums/TextureWrapMode.java | 49c7559b07fe1c6d1ce04bddcfabc8fc6e5ba5cb | [] | no_license | thallium205/bitcoin-visualizer | 6ed1f4795e21e8c7677ead58b7dd4f3b5183c738 | aaf29c2ccfabd6ed0b82701d82cfe0368f2512d1 | refs/heads/master | 2021-01-10T21:45:22.092511 | 2011-12-07T07:16:03 | 2011-12-07T07:16:03 | 2,044,919 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,621 | java | /*
* Copyright 2009 Hao Nguyen
*
* 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 gwt.g3d.client.gl2.enums;
import java.util.HashMap;
import java.util.Map;
/**
* TextureWrapMode flags.
*
* @author [email protected]
*/
public enum TextureWrapMode {
REPEAT(GLEnum.REPEAT),
CLAMP_TO_EDGE(GLEnum.CLAMP_TO_EDGE),
MIRRORED_REPEAT(GLEnum.MIRRORED_REPEAT);
private static Map<Integer, TextureWrapMode> textureWrapModeMap;
private final int value;
private TextureWrapMode(GLEnum glEnum) {
this.value = glEnum.getValue();
}
/**
* Gets the enum's numerical value.
*/
public int getValue() {
return value;
}
/**
* Parses an integer value to its corresponding TextureWrapMode enum.
*
* @param textureWrapMode
*/
public static TextureWrapMode parseTextureWrapMode(int textureWrapMode) {
if (textureWrapModeMap == null) {
textureWrapModeMap = new HashMap<Integer, TextureWrapMode>();
for (TextureWrapMode v : values()) {
textureWrapModeMap.put(v.getValue(), v);
}
}
return textureWrapModeMap.get(textureWrapMode);
}
}
| [
"[email protected]"
] | |
8c780129311f172e4c3845a6df87cd2afb6a2571 | 495a9c0ed3b604693c115ede93a35d61e4e606e0 | /src/LamportProtocol.java | 8b980c3a602834da50a45bddb617c0cd61448a59 | [] | no_license | GauravNaresh/Lamport_MutualExclusion | f68a242d72f57e4362b4c7bc585c1e1274126563 | 89f4e03ba69a82eed8db2655deec81753c8b2fab | refs/heads/master | 2022-12-08T20:20:35.232202 | 2020-09-02T00:51:29 | 2020-09-02T00:51:29 | 292,126,612 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,118 | java | import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.ArrayList;
import java.util.Random;
public class LamportProtocol implements MESProvider {
Messenger messenger;
ProjectMain use;
HashMap<Integer, Long> lastMessageTimes = new HashMap<Integer, Long>();
PriorityQueue<CSRequest> pq = new PriorityQueue<CSRequest>();
int N;
int nodeId;
long temp_clk;
Object lock = new Object();
boolean inCriticalSection = false;
CSRequest currentRequest = null;
ArrayList<Integer> requestsWhenInCS = new ArrayList<Integer>();
public LamportProtocol(Messenger messenger, int nodeId, int N){
this.use = (ProjectMain)messenger;
this.messenger = messenger;
this.nodeId = nodeId;
this.N = N;
}
public void initialize(){
currentRequest = null;
inCriticalSection = false;
lastMessageTimes.clear();
requestsWhenInCS.clear();
}
public void process(Object message, int senderId, long sendTime, long receiveTime){
synchronized(this){
if(inCriticalSection){
if(message instanceof LamportRequestMessage){
System.out.println("received a request message in cs");
pq.add(new CSRequest(senderId, sendTime));
requestsWhenInCS.add(senderId);
} else if (message instanceof LamportReplyMessage){
} else if (message instanceof LamportReleaseMessage){
;
} else {
;
}
} else {
if(message instanceof LamportRequestMessage){
CSRequest nextRequest = new CSRequest(senderId, sendTime);
if(currentRequest != null && (currentRequest.compareTo(nextRequest) < 0)){
pq.add(nextRequest);
} else {
pq.add(nextRequest);
messenger.send(new LamportReplyMessage(), senderId);
}
} else if (message instanceof LamportReplyMessage){
;
} else if (message instanceof LamportReleaseMessage){
pq.poll();
} else {
;
}
if(currentRequest != null){
lastMessageTimes.put(senderId, sendTime);
if(l1() && l2()){
inCriticalSection = true;
notify();
}
}
}
}
}
public void csEnter() {
synchronized(this){
initialize();
currentRequest = new CSRequest(nodeId, -1);
currentRequest.clock = messenger.broadcast(new LamportRequestMessage(), false);
temp_clk = currentRequest.clock;
String nodex = "Node " + Integer.toString(nodeId) + " Entered CS: " + Long.toString(currentRequest.clock);
System.out.println(nodex);
this.use.output.add(nodex);
this.use.cat.add(nodex);
pq.add(currentRequest);
while(!inCriticalSection){
try{
wait(this.use.getCSdelay());
System.out.println("done waiting!!" + inCriticalSection);
} catch (InterruptedException iex){
;
}
}
return;
}
}
public void csExit() {
long temp;
synchronized(this){
System.out.println("got the lock!");
messenger.broadcast(new LamportReleaseMessage(), false);
pq.poll();
for(int i:requestsWhenInCS){
messenger.send(new LamportReplyMessage(), i);
}
initialize();
requestsWhenInCS.clear();
inCriticalSection = false;
temp= temp_clk+ this.use.getCSdelay();
String nodey = "Node " + Integer.toString(nodeId) + " exits CS: " + Long.toString(temp);
System.out.println(nodey);
this.use.output.add(nodey);
this.use.cat.add(nodey);
}
}
public boolean l1(){
if(currentRequest!=null && lastMessageTimes.size() >= (N - 1)){
for(Integer i: lastMessageTimes.keySet()){
if(i!=nodeId){
if(lastMessageTimes.get(i) <= currentRequest.clock){
return false;
}
}
}
return true;
}
return false;
}
public boolean l2(){
if(!pq.isEmpty()){
CSRequest next = pq.peek();
if(next.nodeId == this.nodeId){
return true;
} else {
return false;
}
}
return false;
}
}
class CSRequest implements Comparable<CSRequest>{
int nodeId;
long clock;
CSRequest(int nodeId, long clock){
this.nodeId = nodeId;
this.clock = clock;
}
public int compareTo(CSRequest o) {
if(this.clock == o.clock){
return this.nodeId - o.nodeId;
} else if(this.clock > o.clock){
return 1;
} else {
return -1;
}
}
}
| [
"[email protected]"
] | |
6e8b2508227d783293bd571fc4f1e7d7eb671680 | c9a160b3694ff93bcf25d9d5a8cc3fe4d7bbc1f1 | /3.UML建模/1.源代码/BridgePattern/Client.java | 16c6612c36c5a578e03fd79536c90b439d45bf10 | [] | no_license | ylscj/cultivate | f597c0564aba976402332559739925ab8afdd1e2 | 06656d66a91daf6da943e9dc027ba7ccb0d83224 | refs/heads/master | 2021-01-05T20:14:50.744524 | 2020-02-16T13:09:11 | 2020-02-16T13:09:11 | 241,126,188 | 1 | 0 | null | 2020-02-17T14:22:23 | 2020-02-17T14:22:22 | null | UTF-8 | Java | false | false | 1,012 | java | package BridgePattern;
import java.util.Scanner;
public class Client {
public static void main(String a[]) {
Color color;
Pen pen;
try {
Scanner sc = new Scanner(System.in);
System.out.println("请输入您需要用多大的笔:");
String type = sc.nextLine();
System.out.println("请输入您需要用哪种颜色:");
String type1 = sc.nextLine();
color = (Color) XMLUtilPen.getBean(type1);//color = new Red();
pen = (Pen) XMLUtilPen.getBean(type);//pen = new BigPen();
pen.setColor(color);
System.out.println("请输入您要绘制的东西:");
pen.draw(sc.nextLine());
}catch(Exception e) {
System.out.println("找不到您所输入的类型!");
}
// color = (Color) XMLUtilPen.getBean("color");
// pen = (Pen) XMLUtilPen.getBean("pen");
// pen.setColor(color);
// pen.draw("鲜花");
}
} | [
"[email protected]"
] | |
2a13dec140ed6ddb8cb33ac6faad92197ebc71d5 | dcd36633a849864751fb30e878b2301a879d8f95 | /Samples/Biometrics/Android/multibiometric-sample/gen-external-apklibs/com.neurotec.samples_samples-utils-android_5.1.0.0/src/com/neurotec/samples/app/BaseActivity.java | 5d107174c4c5a4dd12f84a08d8ee71d9ff0950dd | [] | no_license | aeadara/fingerprint-android | b3cb75241d41a670c351c5132e016f02dcbdb1c6 | 1a87898b37ced5ad93974c920e09eb831c619d79 | refs/heads/master | 2021-01-20T20:56:41.447298 | 2015-08-23T21:19:22 | 2015-08-23T21:19:22 | 41,186,654 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,367 | java | package com.neurotec.samples.app;
import android.app.Activity;
import android.app.ProgressDialog;
import android.util.Log;
import com.neurotec.samples.util.ExceptionUtils;
import com.neurotec.samples.util.ToastManager;
import com.neurotec.samples.view.ErrorDialogFragment;
import com.neurotec.samples.view.InfoDialogFragment;
public abstract class BaseActivity extends Activity {
// ===========================================================
// Private fields
// ===========================================================
private ProgressDialog mProgressDialog;
// ===========================================================
// Protected methods
// ===========================================================
protected void showProgress(int messageId) {
showProgress(getString(messageId));
}
protected void showProgress(final String message) {
hideProgress();
runOnUiThread(new Runnable() {
@Override
public void run() {
mProgressDialog = ProgressDialog.show(BaseActivity.this, "", message);
}
});
}
protected void hideProgress() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}
});
}
protected void showToast(int messageId) {
showToast(getString(messageId));
}
protected void showToast(final String message) {
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastManager.show(BaseActivity.this, message);
}
});
}
protected void showError(String message, boolean close) {
ErrorDialogFragment.newInstance(message, close).show(getFragmentManager(), "error");
}
protected void showError(int messageId) {
showError(getString(messageId));
}
protected void showError(String message) {
showError(message, false);
}
protected void showError(Throwable th) {
Log.e(getClass().getSimpleName(), "Exception", th);
showError(ExceptionUtils.getMessage(th), false);
}
protected void showInfo(int messageId) {
showInfo(getString(messageId));
}
protected void showInfo(String message) {
InfoDialogFragment.newInstance(message).show(getFragmentManager(), "info");
}
@Override
protected void onStop() {
super.onStop();
hideProgress();
}
}
| [
"[email protected]"
] | |
c31f69e6f13a7a74aa6175597472282ba44e2aec | a2fad165515c696bda3f6ddb1a6a25a36df6209d | /src/main/java/com/procedures/pojo/Studentsanswer.java | 8cb9bec28dcb00fd7e3f1547b32397cc3aea189e | [] | no_license | THORSU/procedures | 9644a10a466537403e29b934131da829de4fa9df | e3f443ad9a150af1a7d55311d76eab9bdfb5e8c7 | refs/heads/master | 2020-04-29T18:00:14.027328 | 2019-05-10T17:11:14 | 2019-05-10T17:11:14 | 176,311,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package com.procedures.pojo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class Studentsanswer implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 业务主键
*/
private Integer id;
/**
* 用户id
*/
private String studentid;
/**
* 成绩
*/
private Integer grade;
/**
* 创建时间
*/
private Date createtime;
}
| [
"[email protected]"
] | |
40bec7fd4fbe175a99689c5676a725abdd4d9d36 | c8f0424b132efb9bedd1f3141bf61f6cb4a8ff49 | /java-basic/src/main/java/com/evil/concurrent/deadlock/Deadlock.java | bdd771ac8a3f1ae29a6909552375574758e7eaa8 | [
"Apache-2.0"
] | permissive | hurleychin/java-practice | 3345f0cff6f6fe925ee5e27f030607eb96d56de7 | aa36a717eefa8bfa2153eab8beaa3d15cb4388a9 | refs/heads/master | 2023-06-22T15:13:38.581330 | 2023-06-17T10:28:44 | 2023-06-17T10:29:02 | 113,329,388 | 0 | 1 | Apache-2.0 | 2023-06-14T22:22:36 | 2017-12-06T14:55:11 | Java | UTF-8 | Java | false | false | 1,116 | java | package com.evil.concurrent.deadlock;
/**
* @author qinhulin on 2018-06-12
*/
public class Deadlock {
static class Friend {
private final String name;
public Friend(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public synchronized void bow(Friend bower) {
System.out.format("%s: %s"
+ " has bowed to me!%n",
this.name, bower.getName());
bower.bowBack(this);
}
public synchronized void bowBack(Friend bower) {
System.out.format("%s: %s"
+ " has bowed back to me!%n",
this.name, bower.getName());
}
}
public static void main(String[] args) {
final Friend alphonse =
new Friend("Alphonse");
final Friend gaston =
new Friend("Gaston");
new Thread(new Runnable() {
public void run() { alphonse.bow(gaston); }
}).start();
new Thread(new Runnable() {
public void run() { gaston.bow(alphonse); }
}).start();
}
}
| [
"[email protected]"
] | |
ac071774453c1d64770285b598f5ae5b9dfc0490 | af0dd3027f49cccf97b8841a37c5bd16d47d52ec | /app/src/main/java/com/trendyfy/volley/CustomJsonRequest.java | 437f03c97638e12de0d2974d3620d3f020eff50e | [] | no_license | dpkgupta21/TrendyfyAndroid | 2a0a5e6fe3832c1b7cf70eb51ed340ac9a36258d | 149ad72c6b72ff5a3e6240a7c6cad590f194e750 | refs/heads/master | 2021-08-19T21:43:12.086945 | 2017-11-27T13:32:49 | 2017-11-27T13:32:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,689 | java | package com.trendyfy.volley;
import com.android.volley.Cache;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.toolbox.HttpHeaderParser;
import com.trendyfy.utility.Utils;
import java.io.UnsupportedEncodingException;
import java.util.Map;
public class CustomJsonRequest extends Request<String> {
private Listener<String> listener;
private Map<String, String> params;
//private String cacheKey;
public CustomJsonRequest(String url, Map<String, String> params,
Listener<String> reponseListener,
ErrorListener errorListener) {
super(Method.GET, url, errorListener);
// cacheKey = params.get("action");
this.listener = reponseListener;
this.params = params;
}
public CustomJsonRequest(int method, String url, Map<String, String> params,
Listener<String> reponseListener,
ErrorListener errorListener) {
super(method, url, errorListener);
//cacheKey = params.get("action");
this.listener = reponseListener;
this.params = params;
}
@Override
protected Map<String, String> getParams() throws com.android.volley.AuthFailureError {
return params;
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
try {
String jsonString = new String(response.data,
HttpHeaderParser.parseCharset(response.headers));
//JSONObject jsonObject = new JSONObject(jsonString);
String parseResponse = null;
if (jsonString.contains("[")) {
parseResponse = jsonString.substring(jsonString.indexOf("["),
jsonString.indexOf("</string>"));
} else {
parseResponse = jsonString.substring(jsonString.lastIndexOf("<string xmlns=\"http://tempuri.org/\">"),
jsonString.indexOf("</string>"));
parseResponse = parseResponse.replace("<string xmlns=\"http://tempuri.org/\">", "");
}
Utils.ShowLog("TAG", "" + jsonString);
// force response to be cached
//Map<String, String> headers = response.headers;
//long cacheExpiration = 24 * 60 * 60 * 1000; // in 24 hours this cache entry expires completely
//long now = System.currentTimeMillis();
//Cache.Entry entry = new Cache.Entry();
//entry.data = response.data;
//entry.etag = headers.get("ETag");
//entry.ttl = now + cacheExpiration;
//entry.serverDate = HttpHeaderParser.parseDateAsEpoch(headers.get("Date"));
//entry.responseHeaders = headers;
//entry = HttpHeaderParser.parseCacheHeaders(response);
//Application.getInstance().getRequestQueue().getCache().put(cacheKey, entry);
Cache.Entry entry = HttpHeaderParser.parseCacheHeaders(response);
//Application.getInstance().getRequestQueue().getCache().put(cacheKey, entry);
return Response.success(parseResponse,
entry);
//return Response.success(jsonObject, entry);
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
}
}
@Override
protected void deliverResponse(String response) {
listener.onResponse(response);
}
} | [
"[email protected]"
] | |
532aae32cd77998256ffa66a1bbcff92c500a217 | a28473366a8335635e5c43e3b67153c713a5d27c | /analytics-and-data-summit-2018/src/truck-client/src/main/java/com/hortonworks/solution/KafkaSensorEventCollector.java | fba57b7206cca032ab876fafed78dcf1aa6ef367 | [] | no_license | rodrigo-mendes/various-demos | a71304c58eb7b668c78016edbebbe3267126ac41 | 2e8833d127388371560a951052f59f8586744f2f | refs/heads/master | 2023-03-11T08:20:46.262097 | 2021-03-01T13:52:21 | 2021-03-01T13:52:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,142 | java | package com.hortonworks.solution;
import akka.actor.UntypedActor;
import com.hortonworks.simulator.impl.domain.transport.MobileEyeEvent;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.apache.log4j.Logger;
import java.util.Properties;
import java.util.concurrent.Future;
public class KafkaSensorEventCollector extends UntypedActor {
private static final String TOPIC = "truck_position";
private Logger logger = Logger.getLogger(this.getClass());
private Producer<String, String> producer = null;
private Producer<String, String> connect() {
Producer<String, String> producer = null;
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("acks", "all");
props.put("retries", 0);
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
try {
producer = new KafkaProducer<String, String>(props);
} catch (Exception e) {
e.printStackTrace();
}
return producer;
}
public KafkaSensorEventCollector() {
if (producer == null) {
producer = connect();
}
}
@Override
public void onReceive(Object event) throws Exception {
MobileEyeEvent mee = (MobileEyeEvent) event;
String eventToPass = null;
if (Lab.format.equals(Lab.JSON)) {
eventToPass = mee.toJSON();
} else if (Lab.format.equals(Lab.CSV)) {
eventToPass = mee.toCSV();
}
String truckId = String.valueOf(mee.getTruck().getTruckId());
ProducerRecord<String, String> record = new ProducerRecord<String, String>(TOPIC, truckId, eventToPass);
if (producer != null) {
try {
Future<RecordMetadata> future = producer.send(record);
RecordMetadata metadata = future.get();
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
d271d4b7468855ec1384a60abc2d17660f05fa72 | 5e2763ba05b1f3b1249dd5bad6d12e9789924caa | /src/main/java/pojo/ProductColorKey.java | 571631816a0160bfa5ebe4b30ff0d072fb99e095 | [] | no_license | yzl9527/test | 43aa646d99b1a96f3fb8d497d78eebd5ab99723e | d3ece10cdeec87dcbffacd5ca282e5dabac2fb35 | refs/heads/master | 2020-04-14T16:26:41.187094 | 2019-01-03T08:41:00 | 2019-01-03T08:41:00 | 163,952,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package pojo;
import org.springframework.stereotype.Component;
import java.io.Serializable;
@Component
public class ProductColorKey implements Serializable {
private int crid;
private int spid;
private Color color;
private Product product;
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public int getCrid() {
return crid;
}
public void setCrid(int crid) {
this.crid = crid;
}
public int getSpid() {
return spid;
}
public void setSpid(int spid) {
this.spid = spid;
}
} | [
"[email protected]"
] | |
44ea605c3c887f84cd7c39605b75d3a143ec85b4 | 8f660dc660a9cd6d3b3830bc011ae29bcc943c2c | /PoS Payment/AndroidApp/app/src/main/java/org/wso2/iot/sample/mqtt/MessageReceivedCallback.java | 6bc561a2dc20291e8b985a445a166f87b24c43de | [
"Apache-2.0"
] | permissive | Nirothipan/samples-iots | b9545e83221923a770c7f3a33edc64b8ad6807f6 | 3144addcac3f05f4874e17087d31e3f689cdff11 | refs/heads/master | 2021-01-25T00:29:27.780196 | 2018-02-06T05:19:47 | 2018-02-06T05:19:47 | 123,297,780 | 0 | 0 | Apache-2.0 | 2018-02-28T14:40:18 | 2018-02-28T14:40:17 | null | UTF-8 | Java | false | false | 902 | java | /*
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.iot.sample.mqtt;
import org.json.JSONException;
import org.wso2.iot.sample.util.dto.Operation;
public interface MessageReceivedCallback {
void onMessageReceived(Operation operation) throws JSONException;
}
| [
"[email protected]"
] | |
004e314b386899c28ae111c72976e40b69798c50 | 47b2dfcb254997c76c8ad6fad5dabe820654339f | /CustomerCreditWorkShop/src/manager/CustomerManager.java | 95ed8c2e54c0322916402ba9b9926fa62e342f4c | [] | no_license | GulaySahin/EtiyaCamp | 0157477d7e17c107f182d8a4abc165f25a19172c | cfca3a98b6fe7aef08eadf20b1344354e94593ba | refs/heads/main | 2023-09-01T20:55:29.487567 | 2021-10-03T14:31:45 | 2021-10-03T14:31:45 | 397,737,452 | 2 | 0 | null | null | null | null | MacCentralEurope | Java | false | false | 815 | java | package manager;
import entitites.Customer;
import interfaces.CustomerService;
import interfaces.UserIdentityValidatorService;
public class CustomerManager implements CustomerService {
UserIdentityValidatorService userIdentityValidatorService;
public CustomerManager(UserIdentityValidatorService userIdentityValidatorService ) {
super();
this.userIdentityValidatorService=userIdentityValidatorService;
}
@Override
public void add(Customer customer) {
if(this.userIdentityValidatorService.isValid(customer)) {
System.out.println("eklendi"+customer.getFirstName());
}
}
@Override
public void remove(Customer customer) {
System.out.println("silindi");
}
@Override
public void update(Customer customer) {
System.out.println("gŁncellendi");
}
}
| [
"[email protected]"
] | |
c30f7f832c16bc7d7d1e07e2634226a1d2a2c18b | be1459afd8a90edeb04af5c1886880a4de8d83c9 | /src/main/java/com/test/autobot/util/Response.java | 06c5ae9fb491c55a47c2bde78d9eab91e4b1c8d0 | [] | no_license | kmcoderz/autobot | d2a01bd74d637a760107ebdc4082c19cce80bb20 | e35ac441f3003dc4941c471ab5754da1c0df5b50 | refs/heads/master | 2021-01-24T11:10:06.179115 | 2016-10-07T10:21:59 | 2016-10-07T10:21:59 | 70,236,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 701 | java | package com.test.autobot.util;
import org.springframework.http.HttpStatus;
public class Response {
private String responseContent;
private HttpStatus responseCode;
public Response() {
super();
}
public Response(String responseContent, HttpStatus responseCode) {
super();
this.responseContent = responseContent;
this.responseCode = responseCode;
}
public String getResponseContent() {
return responseContent;
}
public void setResponseContent(String responseContent) {
this.responseContent = responseContent;
}
public HttpStatus getResponseCode() {
return responseCode;
}
public void setResponseCode(HttpStatus responseCode) {
this.responseCode = responseCode;
}
}
| [
"[email protected]"
] | |
e6ba3ddfe52f546d6159f56406988cc455d10ecc | 485273f948a4e113bd21a17cc6db5576b39def33 | /src/main/java/com/netsdk/common/LoginPanel.java | 43461ea9b4a139cea90ee080d0aa6cba54755fff | [] | no_license | yang10002502/cream | 5358b551800ec37cd6232ea94616578f7d82c0b7 | 89fe02906e99903fd84fa66e26957a3231cbd821 | refs/heads/master | 2021-07-04T14:26:19.684659 | 2019-06-03T08:22:53 | 2019-06-03T08:22:53 | 189,965,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,428 | java | package com.netsdk.common;
import com.netsdk.lib.ToolKits;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
/*
* 登陆面板
*/
public class LoginPanel extends JPanel {
private static final long serialVersionUID = 1L;
//登陆参数
private String s_strIp = "172.18.19.223"; //"192.168.7.61";
private Integer s_nPort = new Integer("80");
private String s_strUser = "admin";
private String s_strPassword = "admin123";
public LoginPanel() {
BorderEx.set(this, Res.string().getLogin(), 2);
setLayout(new FlowLayout());
////////////////////////////////
loginBtn = new JButton(Res.string().getLogin());
logoutBtn = new JButton(Res.string().getLogout());
ipLabel = new JLabel(Res.string().getDeviceIp());
portLabel = new JLabel(" " + Res.string().getPort());
nameLabel = new JLabel(" " + Res.string().getUserName());
passwordLabel = new JLabel(" " + Res.string().getPassword());
ipTextArea = new JTextField(s_strIp);
nameTextArea = new JTextField(s_strUser);
passwordTextArea = new JPasswordField(s_strPassword);
portTextArea = new JTextField(s_nPort.toString());
add(ipLabel);
add(ipTextArea);
add(portLabel);
add(portTextArea);
add(nameLabel);
add(nameTextArea);
add(passwordLabel);
add(passwordTextArea);
add(loginBtn);
add(logoutBtn);
ipTextArea.setPreferredSize(new Dimension(90, 20));
nameTextArea.setPreferredSize(new Dimension(90, 20));
passwordTextArea.setPreferredSize(new Dimension(90, 20));
portTextArea.setPreferredSize(new Dimension(90, 20));
loginBtn.setPreferredSize(new Dimension(80, 20));
logoutBtn.setPreferredSize(new Dimension(80, 20));
ToolKits.limitTextFieldLength(portTextArea, 6);
logoutBtn.setEnabled(false);
}
public void addLoginBtnActionListener(ActionListener e) {
loginBtn.addActionListener(e);
}
public void addLogoutBtnActionListener(ActionListener e) {
logoutBtn.addActionListener(e);
}
public void setButtonEnable(boolean bln) {
loginBtn.setEnabled(!bln);
logoutBtn.setEnabled(bln);
}
public boolean checkLoginText() {
if(ipTextArea.getText().equals("")) {
JOptionPane.showMessageDialog(null, Res.string().getInputDeviceIP(), Res.string().getErrorMessage(), JOptionPane.ERROR_MESSAGE);
return false;
}
if(portTextArea.getText().equals("")) {
JOptionPane.showMessageDialog(null, Res.string().getInputDevicePort(), Res.string().getErrorMessage(), JOptionPane.ERROR_MESSAGE);
return false;
}
if(nameTextArea.getText().equals("")) {
JOptionPane.showMessageDialog(null, Res.string().getInputUsername(), Res.string().getErrorMessage(), JOptionPane.ERROR_MESSAGE);
return false;
}
if(new String(passwordTextArea.getPassword()).equals("")) {
JOptionPane.showMessageDialog(null, Res.string().getInputPassword(), Res.string().getErrorMessage(), JOptionPane.ERROR_MESSAGE);
return false;
}
return true;
}
public JLabel nameLabel;
public JLabel passwordLabel;
public JLabel ipLabel;
public JLabel portLabel;
public JTextField ipTextArea;
public JTextField portTextArea;
public JTextField nameTextArea;
public JPasswordField passwordTextArea;
public JButton loginBtn;
public JButton logoutBtn;
}
| [
"[email protected]"
] | |
d145c685158be4f72f8f1cd09732c88a8df8271c | c038baf116ec206b5ba12ffc664f27116aed3896 | /src/by/bsu/labs/lab14/entity/Soil.java | 1c30cb440b2830bd3720a64b0be513ef82953d51 | [] | no_license | Elentary/University | f38a93d3fa9a158d76188880a4cff26c54617913 | 8ba9c34a4350a9fd42b0be203f948f8f6013d5c0 | refs/heads/master | 2021-05-04T07:58:08.006390 | 2017-01-22T10:28:25 | 2017-01-22T10:28:25 | 70,733,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132 | java | package by.bsu.labs.lab14.entity;
/**
* Created by amareelez on 13.12.16.
*/
public enum Soil {
Ground, Podzol, SodPodzol
}
| [
"[email protected]"
] | |
a55e8875b4065618ec54e590b828931d6ba82445 | 2f4a058ab684068be5af77fea0bf07665b675ac0 | /utils/com/google/common/collect/Synchronized$SynchronizedAsMap.java | 4c7811520d55019d333941f2cb1c4153c54d6b26 | [] | no_license | cengizgoren/facebook_apk_crack | ee812a57c746df3c28fb1f9263ae77190f08d8d2 | a112d30542b9f0bfcf17de0b3a09c6e6cfe1273b | refs/heads/master | 2021-05-26T14:44:04.092474 | 2013-01-16T08:39:00 | 2013-01-16T08:39:00 | 8,321,708 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,710 | java | package com.google.common.collect;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
class Synchronized$SynchronizedAsMap<K, V> extends Synchronized.SynchronizedMap<K, Collection<V>>
{
private static final long serialVersionUID;
transient Set<Map.Entry<K, Collection<V>>> a;
transient Collection<Collection<V>> b;
Synchronized$SynchronizedAsMap(Map<K, Collection<V>> paramMap, Object paramObject)
{
super(paramMap, paramObject);
}
public Collection<V> a(Object paramObject)
{
synchronized (this.mutex)
{
Collection localCollection = (Collection)super.get(paramObject);
if (localCollection == null)
{
localObject3 = null;
return localObject3;
}
Object localObject3 = Synchronized.a(localCollection, this.mutex);
}
}
public boolean containsValue(Object paramObject)
{
return values().contains(paramObject);
}
public Set<Map.Entry<K, Collection<V>>> entrySet()
{
synchronized (this.mutex)
{
if (this.a == null)
this.a = new Synchronized.SynchronizedAsMapEntries(a().entrySet(), this.mutex);
Set localSet = this.a;
return localSet;
}
}
public Collection<Collection<V>> values()
{
synchronized (this.mutex)
{
if (this.b == null)
this.b = new Synchronized.SynchronizedAsMapValues(a().values(), this.mutex);
Collection localCollection = this.b;
return localCollection;
}
}
}
/* Location: /data1/software/apk2java/dex2jar-0.0.9.12/secondary-1.dex_dex2jar.jar
* Qualified Name: com.google.common.collect.Synchronized.SynchronizedAsMap
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
ed6b666a1488b15e051c682bf146e91448288718 | acd0f9fbd7b9f148f9b780aa7dd2b7c59c51161d | /finalproject/src/main/java/com/jhta/finalproject/vo/Gcs2Vo.java | 89c9174bdf8be7f0d6588bca2c2c0e98318d3dc3 | [] | no_license | MOA-LMY/finalproject | 019eb14821ed49cfa3a38657ecbd9d5ea6522a62 | c8fd3528f67e4c4bf733c7f23c2b7a747e93664f | refs/heads/main | 2023-08-03T17:17:36.255285 | 2021-08-31T16:53:08 | 2021-08-31T16:53:08 | 390,265,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.jhta.finalproject.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Gcs2Vo {
private int g_num;
private String sz_sizename;
private String c_colorname;
private String c_colorcode;
}
| [
"[email protected]"
] | |
5c7100e4881e9558c6ed766265c3a34721eddad7 | f6b52f007e7c28bdc0963b30db2b2a7aa62761d0 | /src/main/java/framework/configuration/PropertiesLoader.java | 36f3fb172db635fb48ea876e9ca1de9d7c150acc | [] | no_license | srachitsky1023/uptakeInterview_NavTest | 899ca9094d9f9417333ace50b85fa0e9390b8ed3 | d2fb093664e2662fe2be7b689da999088dccdfe6 | refs/heads/master | 2020-07-19T17:27:32.727123 | 2016-11-14T23:40:01 | 2016-11-14T23:40:01 | 73,756,830 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | package framework.configuration;
import java.io.InputStream;
import java.util.Properties;
public class PropertiesLoader {
private static final String CONFIG_FILE = "/config.properties";
private static Properties prop = new Properties();
private static void openFile(String file){
InputStream inpStream = Properties.class.getResourceAsStream(file);
try {
prop.load(inpStream);
} catch (Exception e) {
System.out.println("Error opening file: " + file);
throw new RuntimeException(e);
}
}
public static String getValue(String key){
String value = null;
openFile(CONFIG_FILE);
value = prop.getProperty(key);
if (value == null){
String msg = "Value not found for: " + key;
System.out.println(msg);
throw new RuntimeException(msg);
}
return value;
}
}
| [
"[email protected]"
] | |
fed146baff6b2b516c3671b6223bd772b4c88a90 | 2dbccdd37702971b5b75054a36ab01dabe00ec82 | /app/src/test/java/com/elab/grocery_list/ExampleUnitTest.java | 71d96a1c6939b6bf6a9c211cb3d440b2dd780806 | [] | no_license | TechieAditi/Grocery_list | 8e9211972240219e893f88111dabf5855160f4a9 | c3d7727b315b895bdd7d54f84ff7081b4d765345 | refs/heads/master | 2020-12-10T10:09:24.574071 | 2020-03-13T18:36:32 | 2020-03-13T18:36:32 | 233,563,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.elab.grocery_list;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
ff105603304e6b899a1a1b5218dd702eccf432c1 | 663032c83287759e4833486a8ef2b1d012a05fbe | /EmployeeManagementSystem/src/com/employee/controller/EmployeeRegisterServlet.java | 58db078491ecfc6d1db32cd8c88f517d1b0c6eb5 | [] | no_license | MaalavyaMani/Employee-Management-System | b0eb98b0752783057c575c987c0abb02b059ff4a | 2d5d6690655437c88325310bd9f9a30ac586ea6c | refs/heads/master | 2020-12-25T18:43:50.965283 | 2017-06-11T07:28:55 | 2017-06-11T07:28:55 | 93,988,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,772 | java | package com.employee.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.employee.bean.EmployeeRegister;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class EmployeeRegisterServlet
*/
@WebServlet("/EmployeeRegisterServlet")
public class EmployeeRegisterServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public EmployeeRegisterServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
String empID = request.getParameter("emp_id");
String name = request.getParameter("emp_name");
String dateOfBirth = request.getParameter("dob");
String gender = request.getParameter("gender");
String phone = request.getParameter("contact");
String email = request.getParameter("email");
String address = request.getParameter("address");
String designation = request.getParameter("designation");
String mangID = request.getParameter("manager_id");
String salary = request.getParameter("salary");
//String leave = request.getParameter("leaves");
//String password = request.getParameter("password");
EmployeeRegister er = new EmployeeRegister();
er.setEmpID(empID);
er.setName(name);
er.setDateOfBirth(dateOfBirth);
er.setGender(gender);
er.setPhone(phone);
er.setEmail(email);
er.setAddress(address);
er.setDesignation(designation);
er.setMangID(mangID);
er.setSalary(salary);
//er.setLeave(30);
er.setPassword("trustus");
er.saveData();
RequestDispatcher rd = request.getRequestDispatcher("AdminPage.jsp");
rd.forward(request, response);
}
}
| [
"[email protected]"
] | |
b679b068594cbdb641874ccd288daf256f322e8c | fa870a93f41f924417a1647275cdd2f98f819a2d | /app/src/main/java/com/example/meet/ui/main/SectionsPagerAdapter.java | bdfd53042a74093ab51a0165fd4aa6866badb6d4 | [] | no_license | 18Nishant2000/Meet | c938450ec43ecbfec51c640d3902e77e182adacd | 91f7e0b8feeac099351f54ef5016427fe37ec41b | refs/heads/master | 2022-11-10T18:01:01.388805 | 2020-07-06T12:33:30 | 2020-07-06T12:33:30 | 277,257,936 | 0 | 1 | null | 2020-07-06T04:21:04 | 2020-07-05T08:06:49 | Java | UTF-8 | Java | false | false | 1,654 | java | package com.example.meet.ui.main;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import com.example.meet.Chats;
import com.example.meet.Contacts;
import com.example.meet.Groups;
import com.example.meet.R;
/**
* A [FragmentPagerAdapter] that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {
@StringRes
private static final int[] TAB_TITLES = new int[]{R.string.tab_text_1, R.string.tab_text_2, R.string.tab_text_3};
private final Context mContext;
public SectionsPagerAdapter(Context context, FragmentManager fm) {
super(fm);
mContext = context;
}
@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
Fragment fragment = null;
switch (position){
case 0:
fragment = new Chats();
break;
case 1:
fragment = new Groups();
break;
case 2:
fragment = new Contacts();
}
return fragment;
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return mContext.getResources().getString(TAB_TITLES[position]);
}
@Override
public int getCount() {
return 3;
}
} | [
"[email protected]"
] | |
bd6f482990599257d3b5b388efc070b44274a944 | f62ead2a12d78619365dee2e62aa161164a47274 | /src/com/sapyoung/member/heejung/day20210726/HeejungVo.java | ef6524ed5830cd4095492dd0a9f7de21e4c83ddc | [] | no_license | withpd/sapyoung_java | f3926a14c77cb55d94f07f907e87ca76639e3711 | d0d956fdd193a066271172efb5b08c56c5248c85 | refs/heads/master | 2023-08-01T19:00:04.228308 | 2021-09-12T23:43:57 | 2021-09-12T23:43:57 | 387,065,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 931 | java | package com.sapyoung.member.heejung.day20210726;
public class HeejungVo {
private String id;
private String mail;
private String floor;
private String name;
private String departName;
private String pos;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getFloor() {
return floor;
}
public void setFloor(String floor) {
this.floor = floor;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
public String getPos() {
return pos;
}
public void setPos(String pos) {
this.pos = pos;
}
}
| [
"user@DESKTOP-SB5OCUE"
] | user@DESKTOP-SB5OCUE |
928abcf4f53224806be07ee73bb5f9482071cddb | 9ab150519e0a82c7ccde5807711dc5057dc3f37f | /WebsiteScraper/testing/FirstThreePublicationTitlesExtracterTest.java | b450d361990b2be72f5d8bcf7f1d1b4c4a55492a | [] | no_license | arthurpavlov/Java-Projects | caaa0e2a503fa29c2a182d86d6d7abbd8d333545 | 3b3e45bc36ebf16cffc1e79e3801cb1566fee2ba | refs/heads/master | 2020-03-06T21:29:20.190959 | 2018-03-28T03:30:50 | 2018-03-28T03:30:50 | 127,078,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,324 | java | package test;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
import driver.HTMLToStringConverter;
import extracter.FirstThreePublicationTitlesExtracter;
public class FirstThreePublicationTitlesExtracterTest {
private String file1string;
private ArrayList<String> correcttitles = new ArrayList(Arrays.asList(
"Bioclipse: an open source workbench for chemo-and bioinformatics",
"The LCB data warehouse",
"XMPP for cloud computing in bioinformatics supporting discovery and"
+ " invocation of asynchronous web services"));
private FirstThreePublicationTitlesExtracter titleex;
private ArrayList<String> testoutput;
/**
* Set up an instance of FirstThreePublicationTitlesExtracter that runs on
* sample1.html.
*/
@Before
public void setUp() {
HTMLToStringConverter file1 = new HTMLToStringConverter("sample1.html");
if (file1.checkHTML()) {
file1string = file1.getString();
}
titleex = new FirstThreePublicationTitlesExtracter(file1string);
}
/**
* Test that the extract method returns the correct set of publication titles.
*/
@Test
public void testExtract() {
testoutput = titleex.extract();
assertEquals(testoutput, correcttitles);
}
}
| [
"[email protected]"
] | |
c927d8b26d6730836d0b2ef8773f177c87e6f568 | c1898104ac17ece71661dc59560621332693fb60 | /src/Lesson6/Client.java | aeb6634ea898e29792b53cfc0869b5092aa8b3a9 | [] | no_license | nikolayshuklin/GeekbrainsJava2 | cab9b726cdeffc4cd942f35d2d750494c103dbcd | eb866176ff71ea96151594f6553cc2130511a24c | refs/heads/master | 2022-10-14T09:24:04.784290 | 2020-06-11T17:37:30 | 2020-06-11T17:37:30 | 266,755,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package Lesson6;
import java.io.*;
import java.net.Socket;
import java.io.BufferedReader;
public class Client {
private static final String SERVER_ADDRESS = "localhost";
private static final int SERVER_PORT = 8189;
public static void main(String[] args) throws InterruptedException{
try (Socket socket = new Socket(SERVER_ADDRESS, SERVER_PORT);
DataInputStream in = new DataInputStream(socket.getInputStream());
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
) {
while (true) {
String serverMsg = in.readUTF();
System.out.println("Сервер:" + serverMsg);
String clientMsg = br.readLine();
System.out.println("Сообщение клиента записано и отправлено на сервер");
out.writeUTF(clientMsg);
}
} catch (IOException e){
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
711a21d4e364a198bc03bdd98e115289e6215e00 | d1bbb47fb53a973d58d03f81f3edff164974d69c | /Prototype/com/design/pack/Prototype/demo/Resume_ShallowCopy.java | 191a83885693b3f005a987562caf7212d8950736 | [] | no_license | leospiritlee/DesignPatterns | b1144a9ffd5ecfa3de4fde544f5c2c02433dca23 | e5f46887f8fdd1b4ed3ee702ec9047ca07681f52 | refs/heads/master | 2021-01-10T08:44:09.520034 | 2016-01-11T09:03:41 | 2016-01-11T09:03:41 | 47,669,410 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 942 | java | package com.design.pack.Prototype.demo;
public class Resume_ShallowCopy implements Cloneable{
private String name;
private String sex;
private String age;
private WorkInfo_ShallowCopy workInfo;
public Resume_ShallowCopy(String name){
this.name = name;
workInfo = new WorkInfo_ShallowCopy();
}
public void setPersonalInfo(String age,String sex){
this.age = age;
this.sex = sex;
}
public void setWorkInfo(String workInfo){
this.workInfo.setWorkInfo(workInfo);
}
public void Display(){
System.out.print("name : " + name);
System.out.print("sex : " + sex);
System.out.print("age : " + age);
System.out.print("\n");
System.out.println("workInfo : " + workInfo.getWorkInfo());
}
public Resume_ShallowCopy Clone(){
Resume_ShallowCopy resume = null;
try {
resume = (Resume_ShallowCopy) super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return resume;
}
}
| [
"[email protected]"
] | |
49f0cdf64804df27009c11455679f4b7d930a01b | 6a8913e8fb5c4f552cee033f0cef687f0b10c422 | /src/main/java/rocks/cleanstone/storage/player/PlayerDataSourceFactory.java | 84b6175d9b878402b6039e1d61b0cbf181a74105 | [
"MIT",
"CC-BY-4.0"
] | permissive | CleanstoneMC/Cleanstone | 5e5c60b01bb6d5f51ef61f32ad5a5c353ba1d55c | 1b35516004d00fa3267063b840a31211b04f9156 | refs/heads/master | 2021-04-12T09:37:56.768045 | 2021-03-25T12:39:19 | 2021-03-25T12:39:19 | 126,891,902 | 160 | 18 | MIT | 2021-03-11T22:52:29 | 2018-03-26T21:26:03 | Java | UTF-8 | Java | false | false | 180 | java | package rocks.cleanstone.storage.player;
public interface PlayerDataSourceFactory {
String getName();
PlayerDataSource get() throws PlayerDataSourceCreationException;
}
| [
"[email protected]"
] | |
8a74c4fa9259e597366d2c18b4dc8873eb7f5aec | 2ccd067101b4932c396c93deac55c022a1ca6399 | /src/main/java/com/zea7ot/leetcode/lvl3/lc0332/SolutionApproach0HierholzersAlgorithm.java | 3647a175c28c63c3b6061973d18753f959304862 | [] | no_license | dulekang1025/leetcode-solutions-java-zea7ot | 26d9019628a3b98a8932ffdc3531229cdb6fb690 | a5f2fb570733379afb0b5fc676670fe4b54f583c | refs/heads/master | 2023-01-03T03:18:10.936018 | 2020-10-26T01:18:53 | 2020-10-26T01:18:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,995 | java | /**
* https://leetcode.com/problems/reconstruct-itinerary/
*
* Time Complexity: O(N * lg(N)) + O(N) ~ O(N * lg(N))
* O(N * lg(N)), consumed by PQ
* O(N), consumed by `postorder()`
*
* Space Complexity: O(N) + O(H)
*
* to sort the children and post order traverse the graph
*
*
* References:
* https://www.youtube.com/watch?v=4udFSOWQpdg
* http://zxi.mytechroad.com/blog/graph/leetcode-332-reconstruct-itinerary/
* Hierholzer's algorithm: https://en.wikipedia.org/wiki/Eulerian_path
*/
package com.zea7ot.leetcode.lvl3.lc0332;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
public class SolutionApproach0HierholzersAlgorithm {
public List<String> findItinerary(List<List<String>> tickets) {
List<String> ans = new ArrayList<String>();
// sanity check
if (tickets == null || tickets.isEmpty())
return ans;
// a tree-like graph, with children sorted lexicographically and greedily
Map<String, PriorityQueue<String>> graph = new HashMap<String, PriorityQueue<String>>();
for (List<String> ticket : tickets) {
// this PriorityQueue is a minHeap
graph.putIfAbsent(ticket.get(0), new PriorityQueue<String>((a, b) -> a.compareTo(b)));
graph.get(ticket.get(0)).add(ticket.get(1));
}
final String START = "JFK";
postorder(START, graph, ans);
Collections.reverse(ans);
return ans;
}
private void postorder(String source, Map<String, PriorityQueue<String>> graph, List<String> routes) {
PriorityQueue<String> destinations = graph.get(source);
if (destinations != null) {
while (!destinations.isEmpty()) {
String destination = destinations.poll();
postorder(destination, graph, routes);
}
}
routes.add(source);
}
} | [
"[email protected]"
] | |
049554516b517c08e28b6fcfbf61c115a59b18c2 | b6693cf10ad9a9e950ac8cc15759eee11dd651c9 | /addsup/app/src/main/java/addup/fpcompany/com/addsup/Notice_Activity.java | cd67af6353c10e91308e85c0290c43a2bfa04ce4 | [] | no_license | skydusic/spotz | 75a5efc30216907ed3bf46ab34241e0d81b783ae | da34c3a52d1bfd70241469006693b682681d95cb | refs/heads/master | 2021-04-09T15:35:24.153541 | 2019-03-14T00:48:53 | 2019-03-14T00:48:53 | 125,802,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,282 | java | package addup.fpcompany.com.addsup;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import addup.fpcompany.com.addsup.adapter.NoticeAdapter;
import addup.fpcompany.com.addsup.adapter.RecyclerItemClickListener;
import addup.fpcompany.com.addsup.java.noticeItem;
import okhttp3.Call;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class Notice_Activity extends AppCompatActivity implements View.OnClickListener, RecyclerView.OnItemTouchListener {
TextView appVersionTv;
Button noticeIns;
RecyclerView recyclerView;
NoticeAdapter adapter;
ArrayList<noticeItem> noticeArr = new ArrayList<>();
Intent intent;
final String TAG = "Notice_Activity";
String myJSON = "";
String url = "http://spotz.co.kr/var/www/html/noticetable.php";
private static final String TAG_IDX = "idx";
private static final String TAG_RESULTS = "results";
private static final String TAG_TITLE = "title";
private static final String TAG_CONTENTS = "contents";
private static final String TAG_CREATED = "created";
private static final String TAG_IMAGE = "image";
private static final String TAG_HIT = "hit";
private static final String TAG_EMAIL1 = "[email protected]";
private static final String TAG_EMAIL2 = "[email protected]";
JSONArray topic = new JSONArray();
getPost getPost = new getPost();
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notice_);
appVersionTv = findViewById(R.id.appVersionTv);
noticeIns = findViewById(R.id.noticeIns);
recyclerView = findViewById(R.id.recyclerView);
getPost.requestPost(url);
handler.sendEmptyMessage(100);
appVersionTv.setText("v" + SplashActivity.device_version);
if (MainActivity.mUser != null && MainActivity.mUser.getEmail().equals(TAG_EMAIL1)) {
noticeIns.setVisibility(View.VISIBLE);
noticeIns.setOnClickListener(this);
} else if (MainActivity.mUser != null && MainActivity.mUser.getEmail().equals(TAG_EMAIL2)) {
noticeIns.setVisibility(View.VISIBLE);
noticeIns.setOnClickListener(this);
}
recyclerView.addOnItemTouchListener(
new RecyclerItemClickListener(this, recyclerView, new RecyclerItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View v, int position) {
// do whatever
Intent intent = new Intent(v.getContext(), Notice_Detail.class);
intent.putExtra("listname", "공지사항");
intent.putExtra("idx", noticeArr.get(position).getIdx());
intent.putExtra("title", noticeArr.get(position).getTitle());
intent.putExtra("contents", noticeArr.get(position).getContents());
intent.putExtra("created", noticeArr.get(position).getCreated());
intent.putExtra("image", noticeArr.get(position).getImage());
v.getContext().startActivity(intent);
}
@Override
public void onLongItemClick(View view, int position) {
// do whatever
}
})
);
}
@SuppressLint("HandlerLeak")
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (!myJSON.equals("")) {
showList();
setRecyclerView();
removeMessages(100);
myJSON = "";
} else {
handler.sendEmptyMessageDelayed(100, 200);
}
}
};
protected void showList() {
noticeArr.clear();
try {
JSONObject jsonObj = new JSONObject(myJSON);
topic = jsonObj.getJSONArray(TAG_RESULTS);
for (int i = 0; i < topic.length(); i++) {
JSONObject c = topic.getJSONObject(i);
noticeArr.add(new noticeItem(c.getString(TAG_IDX), c.getString(TAG_TITLE), c.getString(TAG_CONTENTS), c.getString(TAG_IMAGE), ClubList.settingTimes(c.getString(TAG_CREATED)), c.getString(TAG_HIT)));
}
} catch (JSONException e) {
e.printStackTrace();
// Log.d("heu", "adapter Exception : " + e);
}
}
private void setRecyclerView() {
LinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
adapter = new NoticeAdapter(getApplicationContext(), noticeArr);
recyclerView.setAdapter(adapter);
}
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
return false;
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
class getPost {
OkHttpClient client = new OkHttpClient();
Request request;
void requestPost(String url) {
RequestBody requestBody = new FormBody.Builder().build();
request = new Request.Builder().url(url).post(requestBody).build();
client.newCall(request).enqueue(new okhttp3.Callback() {
@Override
public void onFailure(Call call, IOException e) {
// Log.d(TAG, "Connect Server Error is " + e.toString());
}
@Override
public void onResponse(Call call, Response response) throws IOException {
myJSON = response.body().string();
}
});
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case (R.id.bottomHome):
intent = new Intent(Notice_Activity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break;
case (R.id.bottomMember):
if (MainActivity.mUser == null) {
Intent intent = new Intent(Notice_Activity.this, SignInActivity.class);
startActivityForResult(intent, 10);
} else {
Intent intent = new Intent(Notice_Activity.this, myPageActivity.class);
startActivityForResult(intent, 1000);
}
break;
/*case (R.id.bottomNotice):
intent = new Intent(Notice_Activity.this, Notice_Activity.class);
startActivity(intent);
break;*/
case (R.id.bottomInfo):
intent = new Intent(Notice_Activity.this, infoActivity.class);
startActivity(intent);
break;
case (R.id.noticeIns):
Intent intent = new Intent(Notice_Activity.this, NoticeInsertActivity.class);
startActivity(intent);
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
handler.removeMessages(100);
}
@Override
public void onResume() {
super.onResume();
myJSON = "";
getPost.requestPost(url);
handler.sendEmptyMessage(100);
}
}
| [
"[email protected]"
] | |
b5503ec5b3ad2df18428c0deedcaf1668cf6adc6 | 0f0451a3a2909429ce2357aebdb678b8888268d1 | /app/src/main/java/com/roshine/lookbar/utils/DialogUtil.java | b8edefa3aa497a7a504e7b9adcc827037a10527e | [] | no_license | Roben1016/LookBar | e4075bd00554da6e98dc20140f1aebaae3c2c85f | 830d605ac9aeec4ad302e535af0a237eb36becd5 | refs/heads/master | 2021-01-20T10:46:37.711601 | 2018-04-11T12:09:43 | 2018-04-11T12:09:43 | 101,646,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,203 | java | package com.roshine.lookbar.utils;
import android.content.Context;
import android.support.v7.app.AlertDialog;
import com.roshine.lookbar.R;
import com.roshine.lookbar.callback.AutoDialogCallback;
/**
* @author Roshine
* @date 2017/7/18 16:18
* @blog http://www.roshine.xyz
* @email [email protected]
* @github https://github.com/Roben1016
* @phone 136****1535
* @desc suppertv7中AlertDialog工具类
*/
public class DialogUtil {
private static DialogUtil instance = null;
public static DialogUtil getInstance(){
if(instance == null){
synchronized (DialogUtil.class){
if(instance == null){
instance = new DialogUtil();
}
}
}
return instance;
}
private DialogUtil(){}
public void showNormalDialog(Context context, String title, CharSequence message, String btnSureText, String btnCancelText,
final int dialogCode, final AutoDialogCallback callback){
showNormalDialog(context,true,title,message,btnSureText,btnCancelText,dialogCode,callback);
}
public void showNormalDialog(Context context,boolean cancelable, String title, CharSequence message, String btnSureText, String btnCancelText,
final int dialogCode, final AutoDialogCallback callback){
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AlertDialogThemeV7);
builder.setTitle(title == null?"":title)
.setMessage(message == null?"":message)
.setCancelable(cancelable);
if(btnSureText != null && !btnSureText.equals("")){
builder.setPositiveButton(btnSureText, (dialog, i) -> {
if (callback != null) {
callback.onSureClick(dialog,i,dialogCode);
}
});
}
if(btnCancelText != null && !btnCancelText.equals("")){
builder.setNegativeButton(btnCancelText, (dialog, i) -> {
if (callback != null) {
callback.onCancelClick(dialog,i,dialogCode);
}
});
}
builder.show();
}
}
| [
"[email protected]"
] | |
33fdacb6d2a5a9941557469a69ed6f8c98b85dd7 | 75c4712ae3f946db0c9196ee8307748231487e4b | /src/main/java/com/alipay/api/domain/AlipayEcoSignFlowCreateModel.java | 3efbeabcfff3c7af2a47464f3d20cf0fbc0527de | [
"Apache-2.0"
] | permissive | yuanbaoMarvin/alipay-sdk-java-all | 70a72a969f464d79c79d09af8b6b01fa177ac1be | 25f3003d820dbd0b73739d8e32a6093468d9ed92 | refs/heads/master | 2023-06-03T16:54:25.138471 | 2021-06-25T14:48:21 | 2021-06-25T14:48:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,615 | java | package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 创建流程(E签宝)
*
* @author auto create
* @since 1.0, 2020-08-26 10:59:27
*/
public class AlipayEcoSignFlowCreateModel extends AlipayObject {
private static final long serialVersionUID = 5899853926819142123L;
/**
* 附件信息
*/
@ApiListField("attachments")
@ApiField("attachment")
private List<Attachment> attachments;
/**
* 流程主题
*/
@ApiField("business_scene")
private String businessScene;
/**
* 流程配置信息
*/
@ApiField("config_info")
private ConfigInfo configInfo;
/**
* 模板信息
*/
@ApiListField("template_infos")
@ApiField("template_info")
private List<TemplateInfo> templateInfos;
public List<Attachment> getAttachments() {
return this.attachments;
}
public void setAttachments(List<Attachment> attachments) {
this.attachments = attachments;
}
public String getBusinessScene() {
return this.businessScene;
}
public void setBusinessScene(String businessScene) {
this.businessScene = businessScene;
}
public ConfigInfo getConfigInfo() {
return this.configInfo;
}
public void setConfigInfo(ConfigInfo configInfo) {
this.configInfo = configInfo;
}
public List<TemplateInfo> getTemplateInfos() {
return this.templateInfos;
}
public void setTemplateInfos(List<TemplateInfo> templateInfos) {
this.templateInfos = templateInfos;
}
}
| [
"[email protected]"
] | |
d0750548ae0c8f04ce0fcf5db316e8e2d7d3b21b | 447520f40e82a060368a0802a391697bc00be96f | /apks/comparison_androart/ro.btrl.pay/source/o/Bj.java | c1f3fc28a003245084d209dceab9b15e482b4e9a | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 33,255 | java | package o;
import java.io.BufferedReader;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.text.ParseException;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
public final class Bj
extends AZ<Bj>
implements Serializable
{
private static final int[] ʻ;
private static final Integer[] ʻॱ;
private static final int[] ʼ;
private static final Integer[] ʼॱ;
private static final int[] ʽ;
private static final Integer[] ʾ;
private static final Integer[] ʿ;
private static final int[] ˊ;
private static final HashMap<Integer, Integer[]> ˊॱ;
private static final int[] ˋ;
private static final HashMap<Integer, Integer[]> ˋॱ;
private static final int[] ˎ;
private static final int[] ˏ = { 0, 30, 59, 89, 118, 148, 177, 207, 236, 266, 295, 325 };
private static final String ˏॱ;
private static final Long[] ͺ;
private static final int[] ॱ;
private static final HashMap<Integer, Integer[]> ॱˊ;
private static final Integer[] ॱˋ;
private static final Integer[] ॱˎ;
private static final String ॱॱ;
private static final Integer[] ॱᐝ;
private static final char ᐝ;
private static final Integer[] ᐝॱ;
private final transient int ʽॱ;
private final transient Bl ˈ;
private final transient int ˉ;
private final transient int ˊˊ;
private final transient AL ˊˋ;
private final transient int ˊᐝ;
private final long ˋˊ;
private final transient boolean ˋᐝ;
static
{
ˎ = new int[] { 0, 30, 59, 89, 118, 148, 177, 207, 236, 266, 295, 325 };
ˋ = new int[] { 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29 };
ॱ = new int[] { 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 30 };
ˊ = new int[] { 0, 1, 0, 1, 0, 1, 1 };
ʻ = new int[] { 1, 9999, 11, 51, 5, 29, 354 };
ʼ = new int[] { 1, 9999, 11, 52, 6, 30, 355 };
ʽ = new int[] { 0, 354, 709, 1063, 1417, 1772, 2126, 2481, 2835, 3189, 3544, 3898, 4252, 4607, 4961, 5315, 5670, 6024, 6379, 6733, 7087, 7442, 7796, 8150, 8505, 8859, 9214, 9568, 9922, 10277 };
ᐝ = File.separatorChar;
ॱॱ = File.pathSeparator;
ˏॱ = "org" + ᐝ + "threeten" + ᐝ + "bp" + ᐝ + "chrono";
ॱˊ = new HashMap();
ˋॱ = new HashMap();
ˊॱ = new HashMap();
ॱˎ = new Integer[ˏ.length];
int i = 0;
while (i < ˏ.length)
{
ॱˎ[i] = new Integer(ˏ[i]);
i += 1;
}
ॱᐝ = new Integer[ˎ.length];
i = 0;
while (i < ˎ.length)
{
ॱᐝ[i] = new Integer(ˎ[i]);
i += 1;
}
ʼॱ = new Integer[ˋ.length];
i = 0;
while (i < ˋ.length)
{
ʼॱ[i] = new Integer(ˋ[i]);
i += 1;
}
ʾ = new Integer[ॱ.length];
i = 0;
while (i < ॱ.length)
{
ʾ[i] = new Integer(ॱ[i]);
i += 1;
}
ʿ = new Integer[ʽ.length];
i = 0;
while (i < ʽ.length)
{
ʿ[i] = new Integer(ʽ[i]);
i += 1;
}
ͺ = new Long['Ŏ'];
i = 0;
while (i < ͺ.length)
{
ͺ[i] = new Long(i * 10631);
i += 1;
}
ॱˋ = new Integer[ˊ.length];
i = 0;
while (i < ˊ.length)
{
ॱˋ[i] = new Integer(ˊ[i]);
i += 1;
}
ᐝॱ = new Integer[ʻ.length];
i = 0;
while (i < ʻ.length)
{
ᐝॱ[i] = new Integer(ʻ[i]);
i += 1;
}
ʻॱ = new Integer[ʼ.length];
i = 0;
while (i < ʼ.length)
{
ʻॱ[i] = new Integer(ʼ[i]);
i += 1;
}
try
{
ᐝ();
return;
}
catch (IOException localIOException) {}catch (ParseException localParseException) {}
}
private Bj(long paramLong)
{
int[] arrayOfInt = ʼ(paramLong);
ॱ(arrayOfInt[1]);
ˋ(arrayOfInt[2]);
ˎ(arrayOfInt[3]);
ˏ(arrayOfInt[4]);
this.ˈ = Bl.ˎ(arrayOfInt[0]);
this.ʽॱ = arrayOfInt[1];
this.ˊᐝ = arrayOfInt[2];
this.ˊˊ = arrayOfInt[3];
this.ˉ = arrayOfInt[4];
this.ˊˋ = AL.ˋ(arrayOfInt[5]);
this.ˋˊ = paramLong;
this.ˋᐝ = ʻ(this.ʽॱ);
}
private Object readResolve()
{
return new Bj(this.ˋˊ);
}
private Object writeReplace()
{
return new Bs((byte)3, this);
}
private static long ʻ(int paramInt)
{
int j = (paramInt - 1) / 30;
int k = (paramInt - 1) % 30;
int i = ʽ(j)[Math.abs(k)].intValue();
paramInt = i;
if (k < 0) {
paramInt = -i;
}
Object localObject1;
try
{
Long localLong = ͺ[j];
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
localObject1 = null;
}
Object localObject2 = localObject1;
if (localObject1 == null) {
localObject2 = new Long(j * 10631);
}
return ((Long)localObject2).longValue() + paramInt - 492148L - 1L;
}
private static InputStream ʻ()
{
Object localObject1 = System.getProperty("org.threeten.bp.i18n.HijrahDate.deviationConfigFile");
Object localObject4 = localObject1;
if (localObject1 == null) {
localObject4 = "hijrah_deviation.cfg";
}
Object localObject5 = System.getProperty("org.threeten.bp.i18n.HijrahDate.deviationConfigDir");
if (localObject5 != null)
{
if (((String)localObject5).length() == 0)
{
localObject1 = localObject5;
if (((String)localObject5).endsWith(System.getProperty("file.separator"))) {}
}
else
{
localObject1 = (String)localObject5 + System.getProperty("file.separator");
}
localObject1 = new File((String)localObject1 + ᐝ + (String)localObject4);
if (((File)localObject1).exists()) {
try
{
localObject1 = new FileInputStream((File)localObject1);
return localObject1;
}
catch (IOException localIOException1)
{
throw localIOException1;
}
}
return null;
}
StringTokenizer localStringTokenizer = new StringTokenizer(System.getProperty("java.class.path"), ॱॱ);
while (localStringTokenizer.hasMoreTokens())
{
Object localObject2 = localStringTokenizer.nextToken();
localObject5 = new File((String)localObject2);
if (((File)localObject5).exists()) {
if (((File)localObject5).isDirectory())
{
if (new File((String)localObject2 + ᐝ + ˏॱ, (String)localObject4).exists()) {
try
{
localObject2 = new FileInputStream((String)localObject2 + ᐝ + ˏॱ + ᐝ + (String)localObject4);
return localObject2;
}
catch (IOException localIOException2)
{
throw localIOException2;
}
}
}
else
{
try
{
localObject5 = new ZipFile((File)localObject5);
}
catch (IOException localIOException3)
{
localObject5 = null;
}
if (localObject5 != null)
{
String str = ˏॱ + ᐝ + (String)localObject4;
ZipEntry localZipEntry = ((ZipFile)localObject5).getEntry(str);
Object localObject3 = localZipEntry;
if (localZipEntry == null)
{
if (ᐝ == '/')
{
localObject3 = str.replace('/', '\\');
}
else
{
localObject3 = str;
if (ᐝ == '\\') {
localObject3 = str.replace('\\', '/');
}
}
localObject3 = ((ZipFile)localObject5).getEntry((String)localObject3);
}
if (localObject3 != null) {
try
{
localObject3 = ((ZipFile)localObject5).getInputStream((ZipEntry)localObject3);
return localObject3;
}
catch (IOException localIOException4)
{
throw localIOException4;
}
}
}
}
}
}
return null;
}
static boolean ʻ(long paramLong)
{
if (paramLong <= 0L) {
paramLong = -paramLong;
}
return (paramLong * 11L + 14L) % 30L < 11L;
}
static int ʼ()
{
return ʻॱ[6].intValue();
}
private static int[] ʼ(long paramLong)
{
paramLong += 492148L;
int i;
int k;
int j;
int n;
int m;
int i1;
if (paramLong >= 0L)
{
i = ʽ(paramLong);
k = ˋ(paramLong, i);
j = ˊ(i, k);
n = ˎ(i, k, j);
j = i * 30 + j + 1;
k = ॱ(n, j);
m = ˏ(n, k, j) + 1;
i = Bl.ˊ.ॱ();
}
else
{
k = (int)paramLong / 10631;
m = (int)paramLong % 10631;
i = k;
j = m;
if (m == 0)
{
j = 54905;
i = k + 1;
}
k = ˊ(i, j);
m = ˎ(i, j, k);
j = 1 - (i * 30 - k);
if (ʻ(j)) {
i = m + 355;
} else {
i = m + 354;
}
k = ॱ(i, j);
m = ˏ(i, k, j) + 1;
i1 = Bl.ˎ.ॱ();
n = i;
i = i1;
}
int i2 = (int)((5L + paramLong) % 7L);
if (i2 <= 0) {
i1 = 7;
} else {
i1 = 0;
}
return new int[] { i, j, k + 1, m, n + 1, i2 + i1 };
}
private static int ʽ(long paramLong)
{
Long[] arrayOfLong = ͺ;
int i = 0;
try
{
while (i < arrayOfLong.length)
{
long l = arrayOfLong[i].longValue();
if (paramLong < l) {
return i - 1;
}
i += 1;
}
i = (int)paramLong;
i /= 10631;
return i;
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {}
return (int)paramLong / 10631;
}
private static Integer[] ʽ(int paramInt)
{
Object localObject1;
try
{
Integer[] arrayOfInteger = (Integer[])ˊॱ.get(new Integer(paramInt));
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
localObject1 = null;
}
Object localObject2 = localObject1;
if (localObject1 == null) {
localObject2 = ʿ;
}
return localObject2;
}
static int ˊ(int paramInt)
{
int i = (paramInt - 1) / 30;
Object localObject;
try
{
Integer[] arrayOfInteger = (Integer[])ˊॱ.get(Integer.valueOf(i));
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
localObject = null;
}
if (localObject != null)
{
paramInt = (paramInt - 1) % 30;
if (paramInt == 29) {
return ͺ[(i + 1)].intValue() - ͺ[i].intValue() - localObject[paramInt].intValue();
}
return localObject[(paramInt + 1)].intValue() - localObject[paramInt].intValue();
}
if (ʻ(paramInt)) {
return 355;
}
return 354;
}
private static int ˊ(int paramInt, long paramLong)
{
Integer[] arrayOfInteger = ʽ(paramInt);
if (paramLong == 0L) {
return 0;
}
if (paramLong > 0L)
{
paramInt = 0;
while (paramInt < arrayOfInteger.length)
{
if (paramLong < arrayOfInteger[paramInt].intValue()) {
return paramInt - 1;
}
paramInt += 1;
}
return 29;
}
paramLong = -paramLong;
paramInt = 0;
while (paramInt < arrayOfInteger.length)
{
if (paramLong <= arrayOfInteger[paramInt].intValue()) {
return paramInt - 1;
}
paramInt += 1;
}
return 29;
}
public static Bj ˊ(int paramInt1, int paramInt2, int paramInt3)
{
if (paramInt1 >= 1) {
return ˎ(Bl.ˊ, paramInt1, paramInt2, paramInt3);
}
return ˎ(Bl.ˎ, 1 - paramInt1, paramInt2, paramInt3);
}
private static int ˋ(long paramLong, int paramInt)
{
Object localObject1;
try
{
Long localLong = ͺ[paramInt];
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
localObject1 = null;
}
Object localObject2 = localObject1;
if (localObject1 == null) {
localObject2 = new Long(paramInt * 10631);
}
return (int)(paramLong - ((Long)localObject2).longValue());
}
private static long ˋ(int paramInt1, int paramInt2, int paramInt3)
{
return ʻ(paramInt1) + ˎ(paramInt2 - 1, paramInt1) + paramInt3;
}
private static void ˋ(int paramInt)
{
if ((paramInt < 1) || (paramInt > 12)) {
throw new AG("Invalid month of Hijrah date");
}
}
private static void ˋ(String paramString, int paramInt)
{
paramString = new StringTokenizer(paramString, ";");
while (paramString.hasMoreTokens())
{
String str1 = paramString.nextToken();
int j = str1.indexOf(':');
if (j != -1)
{
String str2 = str1.substring(j + 1, str1.length());
int i;
try
{
i = Integer.parseInt(str2);
}
catch (NumberFormatException paramString)
{
throw new ParseException("Offset is not properly set at line " + paramInt + ".", paramInt);
}
int k = str1.indexOf('-');
if (k != -1)
{
str2 = str1.substring(0, k);
str1 = str1.substring(k + 1, j);
j = str2.indexOf('/');
int m = str1.indexOf('/');
if (j != -1)
{
String str3 = str2.substring(0, j);
str2 = str2.substring(j + 1, str2.length());
try
{
j = Integer.parseInt(str3);
}
catch (NumberFormatException paramString)
{
throw new ParseException("Start year is not properly set at line " + paramInt + ".", paramInt);
}
try
{
k = Integer.parseInt(str2);
}
catch (NumberFormatException paramString)
{
throw new ParseException("Start month is not properly set at line " + paramInt + ".", paramInt);
}
}
else
{
throw new ParseException("Start year/month has incorrect format at line " + paramInt + ".", paramInt);
}
int n;
if (m != -1)
{
str2 = str1.substring(0, m);
str1 = str1.substring(m + 1, str1.length());
try
{
m = Integer.parseInt(str2);
}
catch (NumberFormatException paramString)
{
throw new ParseException("End year is not properly set at line " + paramInt + ".", paramInt);
}
try
{
n = Integer.parseInt(str1);
}
catch (NumberFormatException paramString)
{
throw new ParseException("End month is not properly set at line " + paramInt + ".", paramInt);
}
}
else
{
throw new ParseException("End year/month has incorrect format at line " + paramInt + ".", paramInt);
}
if ((j != -1) && (k != -1) && (m != -1) && (n != -1)) {
ˎ(j, k, m, n, i);
} else {
throw new ParseException("Unknown error at line " + paramInt + ".", paramInt);
}
}
else
{
throw new ParseException("Start and end year/month has incorrect format at line " + paramInt + ".", paramInt);
}
}
else
{
throw new ParseException("Offset has incorrect format at line " + paramInt + ".", paramInt);
}
}
}
private static int ˎ(int paramInt1, int paramInt2)
{
return ॱॱ(paramInt2)[paramInt1].intValue();
}
private static int ˎ(int paramInt1, int paramInt2, int paramInt3)
{
Integer[] arrayOfInteger = ʽ(paramInt1);
if (paramInt2 > 0) {
return paramInt2 - arrayOfInteger[paramInt3].intValue();
}
return arrayOfInteger[paramInt3].intValue() + paramInt2;
}
static Bj ˎ(long paramLong)
{
return new Bj(paramLong);
}
static Bj ˎ(Bl paramBl, int paramInt1, int paramInt2, int paramInt3)
{
BM.ˎ(paramBl, "era");
ॱ(paramInt1);
ˋ(paramInt2);
ˎ(paramInt3);
return new Bj(ˋ(paramBl.ˏ(paramInt1), paramInt2, paramInt3));
}
private static void ˎ(int paramInt)
{
if ((paramInt < 1) || (paramInt > ˏ())) {
throw new AG("Invalid day of month of Hijrah date, day " + paramInt + " greater than " + ˏ() + " or less than 1");
}
}
private static void ˎ(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5)
{
if (paramInt1 < 1) {
throw new IllegalArgumentException("startYear < 1");
}
if (paramInt3 < 1) {
throw new IllegalArgumentException("endYear < 1");
}
if ((paramInt2 < 0) || (paramInt2 > 11)) {
throw new IllegalArgumentException("startMonth < 0 || startMonth > 11");
}
if ((paramInt4 < 0) || (paramInt4 > 11)) {
throw new IllegalArgumentException("endMonth < 0 || endMonth > 11");
}
if (paramInt3 > 9999) {
throw new IllegalArgumentException("endYear > 9999");
}
if (paramInt3 < paramInt1) {
throw new IllegalArgumentException("startYear > endYear");
}
if ((paramInt3 == paramInt1) && (paramInt4 < paramInt2)) {
throw new IllegalArgumentException("startYear == endYear && endMonth < startMonth");
}
boolean bool = ʻ(paramInt1);
Integer[] arrayOfInteger2 = (Integer[])ॱˊ.get(new Integer(paramInt1));
Integer[] arrayOfInteger1 = arrayOfInteger2;
if (arrayOfInteger2 == null) {
if (bool)
{
arrayOfInteger1 = new Integer[ˎ.length];
i = 0;
while (i < ˎ.length)
{
arrayOfInteger1[i] = new Integer(ˎ[i]);
i += 1;
}
}
else
{
arrayOfInteger2 = new Integer[ˏ.length];
i = 0;
for (;;)
{
arrayOfInteger1 = arrayOfInteger2;
if (i >= ˏ.length) {
break;
}
arrayOfInteger2[i] = new Integer(ˏ[i]);
i += 1;
}
}
}
arrayOfInteger2 = new Integer[arrayOfInteger1.length];
int i = 0;
while (i < 12)
{
if (i > paramInt2) {
arrayOfInteger2[i] = new Integer(arrayOfInteger1[i].intValue() - paramInt5);
} else {
arrayOfInteger2[i] = new Integer(arrayOfInteger1[i].intValue());
}
i += 1;
}
ॱˊ.put(new Integer(paramInt1), arrayOfInteger2);
arrayOfInteger2 = (Integer[])ˋॱ.get(new Integer(paramInt1));
arrayOfInteger1 = arrayOfInteger2;
if (arrayOfInteger2 == null) {
if (bool)
{
arrayOfInteger1 = new Integer[ॱ.length];
i = 0;
while (i < ॱ.length)
{
arrayOfInteger1[i] = new Integer(ॱ[i]);
i += 1;
}
}
else
{
arrayOfInteger2 = new Integer[ˋ.length];
i = 0;
for (;;)
{
arrayOfInteger1 = arrayOfInteger2;
if (i >= ˋ.length) {
break;
}
arrayOfInteger2[i] = new Integer(ˋ[i]);
i += 1;
}
}
}
arrayOfInteger2 = new Integer[arrayOfInteger1.length];
i = 0;
while (i < 12)
{
if (i == paramInt2) {
arrayOfInteger2[i] = new Integer(arrayOfInteger1[i].intValue() - paramInt5);
} else {
arrayOfInteger2[i] = new Integer(arrayOfInteger1[i].intValue());
}
i += 1;
}
ˋॱ.put(new Integer(paramInt1), arrayOfInteger2);
if (paramInt1 != paramInt3)
{
j = (paramInt1 - 1) / 30;
arrayOfInteger2 = (Integer[])ˊॱ.get(new Integer(j));
arrayOfInteger1 = arrayOfInteger2;
if (arrayOfInteger2 == null)
{
arrayOfInteger2 = new Integer[ʽ.length];
i = 0;
for (;;)
{
arrayOfInteger1 = arrayOfInteger2;
if (i >= arrayOfInteger2.length) {
break;
}
arrayOfInteger2[i] = new Integer(ʽ[i]);
i += 1;
}
}
i = (paramInt1 - 1) % 30 + 1;
while (i < ʽ.length)
{
arrayOfInteger1[i] = new Integer(arrayOfInteger1[i].intValue() - paramInt5);
i += 1;
}
ˊॱ.put(new Integer(j), arrayOfInteger1);
i = (paramInt1 - 1) / 30;
j = (paramInt3 - 1) / 30;
if (i != j)
{
i += 1;
while (i < ͺ.length)
{
ͺ[i] = new Long(ͺ[i].longValue() - paramInt5);
i += 1;
}
i = j + 1;
while (i < ͺ.length)
{
ͺ[i] = new Long(ͺ[i].longValue() + paramInt5);
i += 1;
}
}
j = (paramInt3 - 1) / 30;
arrayOfInteger2 = (Integer[])ˊॱ.get(new Integer(j));
arrayOfInteger1 = arrayOfInteger2;
if (arrayOfInteger2 == null)
{
arrayOfInteger2 = new Integer[ʽ.length];
i = 0;
for (;;)
{
arrayOfInteger1 = arrayOfInteger2;
if (i >= arrayOfInteger2.length) {
break;
}
arrayOfInteger2[i] = new Integer(ʽ[i]);
i += 1;
}
}
i = (paramInt3 - 1) % 30 + 1;
while (i < ʽ.length)
{
arrayOfInteger1[i] = new Integer(arrayOfInteger1[i].intValue() + paramInt5);
i += 1;
}
ˊॱ.put(new Integer(j), arrayOfInteger1);
}
bool = ʻ(paramInt3);
arrayOfInteger2 = (Integer[])ॱˊ.get(new Integer(paramInt3));
arrayOfInteger1 = arrayOfInteger2;
if (arrayOfInteger2 == null) {
if (bool)
{
arrayOfInteger1 = new Integer[ˎ.length];
i = 0;
while (i < ˎ.length)
{
arrayOfInteger1[i] = new Integer(ˎ[i]);
i += 1;
}
}
else
{
arrayOfInteger2 = new Integer[ˏ.length];
i = 0;
for (;;)
{
arrayOfInteger1 = arrayOfInteger2;
if (i >= ˏ.length) {
break;
}
arrayOfInteger2[i] = new Integer(ˏ[i]);
i += 1;
}
}
}
arrayOfInteger2 = new Integer[arrayOfInteger1.length];
i = 0;
while (i < 12)
{
if (i > paramInt4) {
arrayOfInteger2[i] = new Integer(arrayOfInteger1[i].intValue() + paramInt5);
} else {
arrayOfInteger2[i] = new Integer(arrayOfInteger1[i].intValue());
}
i += 1;
}
ॱˊ.put(new Integer(paramInt3), arrayOfInteger2);
arrayOfInteger2 = (Integer[])ˋॱ.get(new Integer(paramInt3));
arrayOfInteger1 = arrayOfInteger2;
if (arrayOfInteger2 == null) {
if (bool)
{
arrayOfInteger1 = new Integer[ॱ.length];
i = 0;
while (i < ॱ.length)
{
arrayOfInteger1[i] = new Integer(ॱ[i]);
i += 1;
}
}
else
{
arrayOfInteger2 = new Integer[ˋ.length];
i = 0;
for (;;)
{
arrayOfInteger1 = arrayOfInteger2;
if (i >= ˋ.length) {
break;
}
arrayOfInteger2[i] = new Integer(ˋ[i]);
i += 1;
}
}
}
arrayOfInteger2 = new Integer[arrayOfInteger1.length];
i = 0;
while (i < 12)
{
if (i == paramInt4) {
arrayOfInteger2[i] = new Integer(arrayOfInteger1[i].intValue() + paramInt5);
} else {
arrayOfInteger2[i] = new Integer(arrayOfInteger1[i].intValue());
}
i += 1;
}
ˋॱ.put(new Integer(paramInt3), arrayOfInteger2);
arrayOfInteger1 = (Integer[])ˋॱ.get(new Integer(paramInt1));
arrayOfInteger2 = (Integer[])ˋॱ.get(new Integer(paramInt3));
Integer[] arrayOfInteger3 = (Integer[])ॱˊ.get(new Integer(paramInt1));
Integer[] arrayOfInteger4 = (Integer[])ॱˊ.get(new Integer(paramInt3));
paramInt5 = arrayOfInteger1[paramInt2].intValue();
paramInt4 = arrayOfInteger2[paramInt4].intValue();
paramInt3 = arrayOfInteger3[11].intValue() + arrayOfInteger1[11].intValue();
paramInt2 = arrayOfInteger4[11].intValue() + arrayOfInteger2[11].intValue();
i = ʻॱ[5].intValue();
int j = ᐝॱ[5].intValue();
paramInt1 = i;
if (i < paramInt5) {
paramInt1 = paramInt5;
}
i = paramInt1;
if (paramInt1 < paramInt4) {
i = paramInt4;
}
ʻॱ[5] = new Integer(i);
paramInt1 = j;
if (j > paramInt5) {
paramInt1 = paramInt5;
}
paramInt5 = paramInt1;
if (paramInt1 > paramInt4) {
paramInt5 = paramInt4;
}
ᐝॱ[5] = new Integer(paramInt5);
paramInt4 = ʻॱ[6].intValue();
paramInt5 = ᐝॱ[6].intValue();
paramInt1 = paramInt4;
if (paramInt4 < paramInt3) {
paramInt1 = paramInt3;
}
paramInt4 = paramInt1;
if (paramInt1 < paramInt2) {
paramInt4 = paramInt2;
}
ʻॱ[6] = new Integer(paramInt4);
paramInt1 = paramInt5;
if (paramInt5 > paramInt3) {
paramInt1 = paramInt3;
}
paramInt3 = paramInt1;
if (paramInt1 > paramInt2) {
paramInt3 = paramInt2;
}
ᐝॱ[6] = new Integer(paramInt3);
}
static int ˏ()
{
return ʻॱ[5].intValue();
}
static int ˏ(int paramInt1, int paramInt2)
{
return ᐝ(paramInt2)[paramInt1].intValue();
}
private static int ˏ(int paramInt1, int paramInt2, int paramInt3)
{
Integer[] arrayOfInteger = ॱॱ(paramInt3);
if (paramInt1 >= 0)
{
if (paramInt2 > 0) {
return paramInt1 - arrayOfInteger[paramInt2].intValue();
}
return paramInt1;
}
if (ʻ(paramInt3)) {
paramInt1 += 355;
} else {
paramInt1 += 354;
}
if (paramInt2 > 0) {
return paramInt1 - arrayOfInteger[paramInt2].intValue();
}
return paramInt1;
}
static Bc ˏ(DataInput paramDataInput)
{
int i = paramDataInput.readInt();
int j = paramDataInput.readByte();
int k = paramDataInput.readByte();
return Bm.ˏ.ˋ(i, j, k);
}
private static void ˏ(int paramInt)
{
if ((paramInt < 1) || (paramInt > ʼ())) {
throw new AG("Invalid day of year of Hijrah date");
}
}
private static int ॱ(int paramInt1, int paramInt2)
{
Integer[] arrayOfInteger = ॱॱ(paramInt2);
if (paramInt1 >= 0)
{
paramInt2 = 0;
while (paramInt2 < arrayOfInteger.length)
{
if (paramInt1 < arrayOfInteger[paramInt2].intValue()) {
return paramInt2 - 1;
}
paramInt2 += 1;
}
return 11;
}
if (ʻ(paramInt2)) {
paramInt1 += 355;
} else {
paramInt1 += 354;
}
paramInt2 = 0;
while (paramInt2 < arrayOfInteger.length)
{
if (paramInt1 < arrayOfInteger[paramInt2].intValue()) {
return paramInt2 - 1;
}
paramInt2 += 1;
}
return 11;
}
private static Bj ॱ(int paramInt1, int paramInt2, int paramInt3)
{
int j = ˎ(paramInt2 - 1, paramInt1);
int i = paramInt3;
if (paramInt3 > j) {
i = j;
}
return ˊ(paramInt1, paramInt2, i);
}
private static void ॱ(int paramInt)
{
if ((paramInt < 1) || (paramInt > 9999)) {
throw new AG("Invalid year of Hijrah Era");
}
}
private static Integer[] ॱॱ(int paramInt)
{
Object localObject1;
try
{
Integer[] arrayOfInteger = (Integer[])ॱˊ.get(new Integer(paramInt));
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
localObject1 = null;
}
Object localObject2 = localObject1;
if (localObject1 == null)
{
if (ʻ(paramInt)) {
return ॱᐝ;
}
localObject2 = ॱˎ;
}
return localObject2;
}
private static void ᐝ()
{
Object localObject2 = ʻ();
if (localObject2 != null)
{
Object localObject1 = null;
try
{
localObject2 = new BufferedReader(new InputStreamReader((InputStream)localObject2));
int i = 0;
for (;;)
{
localObject1 = localObject2;
String str = ((BufferedReader)localObject2).readLine();
if (str == null) {
break;
}
i += 1;
localObject1 = localObject2;
ˋ(str.trim(), i);
}
if (localObject2 != null)
{
((BufferedReader)localObject2).close();
return;
}
}
finally
{
if (localObject1 != null) {
localObject1.close();
}
}
}
}
private static Integer[] ᐝ(int paramInt)
{
Object localObject1;
try
{
Integer[] arrayOfInteger = (Integer[])ˋॱ.get(new Integer(paramInt));
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
localObject1 = null;
}
Object localObject2 = localObject1;
if (localObject1 == null)
{
if (ʻ(paramInt)) {
return ʾ;
}
localObject2 = ʼॱ;
}
return localObject2;
}
public int ˊ()
{
return ˏ(this.ˊᐝ - 1, this.ʽॱ);
}
void ˊ(DataOutput paramDataOutput)
{
paramDataOutput.writeInt(ˏ(BN.ˋˊ));
paramDataOutput.writeByte(ˏ(BN.ʿ));
paramDataOutput.writeByte(ˏ(BN.ॱᐝ));
}
public long ˋ(BT paramBT)
{
if ((paramBT instanceof BN))
{
switch (3.ˏ[((BN)paramBT).ordinal()])
{
default:
break;
case 5:
return this.ˊˋ.ˋ();
case 6:
return (this.ˊˊ - 1) % 7 + 1;
case 7:
return (this.ˉ - 1) % 7 + 1;
case 1:
return this.ˊˊ;
case 2:
return this.ˉ;
case 8:
return ॱˊ();
case 3:
return (this.ˊˊ - 1) / 7 + 1;
case 9:
return (this.ˉ - 1) / 7 + 1;
case 10:
return this.ˊᐝ;
case 4:
return this.ʽॱ;
case 11:
return this.ʽॱ;
case 12:
return this.ˈ.ॱ();
}
throw new BX("Unsupported field: " + paramBT);
}
return paramBT.ˎ(this);
}
public final Bg<Bj> ˋ(AQ paramAQ)
{
return super.ˋ(paramAQ);
}
public Bl ˋ()
{
return this.ˈ;
}
public int ˋॱ()
{
return ˊ(this.ʽॱ);
}
public Bj ˎ(BT paramBT, long paramLong)
{
if ((paramBT instanceof BN))
{
BN localBN = (BN)paramBT;
localBN.ˊ(paramLong);
int i = (int)paramLong;
switch (3.ˏ[localBN.ordinal()])
{
default:
break;
case 5:
return ᐝ(paramLong - this.ˊˋ.ˋ());
case 6:
return ᐝ(paramLong - ˋ(BN.ᐝॱ));
case 7:
return ᐝ(paramLong - ˋ(BN.ॱˋ));
case 1:
return ॱ(this.ʽॱ, this.ˊᐝ, i);
case 2:
return ॱ(this.ʽॱ, (i - 1) / 30 + 1, (i - 1) % 30 + 1);
case 8:
return new Bj(i);
case 3:
return ᐝ((paramLong - ˋ(BN.ˈ)) * 7L);
case 9:
return ᐝ((paramLong - ˋ(BN.ʼॱ)) * 7L);
case 10:
return ॱ(this.ʽॱ, i, this.ˊˊ);
case 4:
if (this.ʽॱ < 1) {
i = 1 - i;
}
return ॱ(i, this.ˊᐝ, this.ˊˊ);
case 11:
return ॱ(i, this.ˊᐝ, this.ˊˊ);
case 12:
return ॱ(1 - this.ʽॱ, this.ˊᐝ, this.ˊˊ);
}
throw new BX("Unsupported field: " + paramBT);
}
return (Bj)paramBT.ˎ(this, paramLong);
}
Bj ˏ(long paramLong)
{
if (paramLong == 0L) {
return this;
}
int i = BM.ॱ(this.ʽॱ, (int)paramLong);
return ˎ(this.ˈ, i, this.ˊᐝ, this.ˊˊ);
}
public Bj ˏ(BS paramBS)
{
return (Bj)super.ˋ(paramBS);
}
public BZ ॱ(BT paramBT)
{
if ((paramBT instanceof BN))
{
if (ˊ(paramBT))
{
paramBT = (BN)paramBT;
switch (3.ˏ[paramBT.ordinal()])
{
default:
break;
case 1:
return BZ.ˋ(1L, ˊ());
case 2:
return BZ.ˋ(1L, ˋॱ());
case 3:
return BZ.ˋ(1L, 5L);
case 4:
return BZ.ˋ(1L, 1000L);
}
return ॱ().ˏ(paramBT);
}
throw new BX("Unsupported field: " + paramBT);
}
return paramBT.ॱ(this);
}
public Bj ॱ(long paramLong, BW paramBW)
{
return (Bj)super.ˊ(paramLong, paramBW);
}
public Bm ॱ()
{
return Bm.ˏ;
}
public long ॱˊ()
{
return ˋ(this.ʽॱ, this.ˊᐝ, this.ˊˊ);
}
Bj ॱॱ(long paramLong)
{
if (paramLong == 0L) {
return this;
}
int i = this.ˊᐝ - 1 + (int)paramLong;
int j = i / 12;
i %= 12;
while (i < 0)
{
i += 12;
j = BM.ˏ(j, 1);
}
j = BM.ॱ(this.ʽॱ, j);
return ˎ(this.ˈ, j, i + 1, this.ˊˊ);
}
public Bj ॱॱ(long paramLong, BW paramBW)
{
return (Bj)super.ˏ(paramLong, paramBW);
}
public boolean ॱॱ()
{
return this.ˋᐝ;
}
Bj ᐝ(long paramLong)
{
return new Bj(this.ˋˊ + paramLong);
}
}
| [
"[email protected]"
] | |
7685e230d8105c094f890665dc041ca7a0d36449 | 18bb64344d70f4a1f5d1f165e5e6394fd3bb04b9 | /easyPhotos/src/main/java/com/huantansheng/easyphotos/ui/widget/PressedTextView.java | 16f48df6820aca6f99b2c778f8cfbad335cae653 | [] | no_license | joyce2016jiayou/biu_user_android | 6612db7f860d652e3a7108f37b5cba4a8a2a71b3 | 61f778b3f7ea835bba48ad0304be9e2235b9b4ed | refs/heads/master | 2022-11-17T22:09:28.547361 | 2020-07-11T08:05:20 | 2020-07-11T08:05:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,291 | java | package com.huantansheng.easyphotos.ui.widget;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
/**
* 带点击状态的textview
* Created by huan on 2017/9/15.
*/
public class PressedTextView extends AppCompatTextView {
private float pressedScale;
private AnimatorSet set;
private int pressedFlag;
public PressedTextView(Context context) {
super(context);
this.pressedScale = 1.1f;
this.pressedFlag = 1;
}
public PressedTextView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
this.pressedScale = 1.1f;
this.pressedFlag = 1;
}
public PressedTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.pressedScale = 1.1f;
this.pressedFlag = 1;
}
@Override
public void setPressed(boolean pressed) {
super.setPressed(pressed);
if (isPressed()) {
pressedFlag = 1;
if (null == set) {
set = new AnimatorSet();
set.setDuration(5);
}
if (set.isRunning()) set.cancel();
ObjectAnimator pScaleX = ObjectAnimator.ofFloat(this, "scaleX", 1.0f, pressedScale);
ObjectAnimator pScaleY = ObjectAnimator.ofFloat(this, "scaleY", 1.0f, pressedScale);
set.play(pScaleX).with(pScaleY);
set.start();
} else {
if (pressedFlag != 1) {
return;
}
pressedFlag = 2;
if (null == set) {
set = new AnimatorSet();
set.setDuration(5);
}
if (set.isRunning()) set.cancel();
ObjectAnimator nScaleX = ObjectAnimator.ofFloat(this, "scaleX", pressedScale, 1.0f);
ObjectAnimator nScaleY = ObjectAnimator.ofFloat(this, "scaleY", pressedScale, 1.0f);
set.play(nScaleX).with(nScaleY);
set.start();
}
}
public void setPressedScale(float pressedScale) {
this.pressedScale = pressedScale;
}
}
| [
"[email protected]"
] | |
f21d36677fb42f6965e1e475bccddf7822616b4c | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /src/irvine/oeis/a180/A180595.java | cf2095b1232f5184901d161a049ebf245573f665 | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package irvine.oeis.a180;
// Generated by gen_pattern.pl - DO NOT EDIT here!
import irvine.oeis.GeneratingFunctionSequence;
/**
* A180595 Digital root of <code>5n</code>.
* @author Georg Fischer
*/
public class A180595 extends GeneratingFunctionSequence {
/** Construct the sequence. */
public A180595() {
super(0, new long[] {0, -5, -1, -6, -2, -7, -3, -8, -4, -9},
new long[] {-1, 0, 0, 0, 0, 0, 0, 0, 0, 1});
}
}
| [
"[email protected]"
] | |
cf1ddf64acf813db571dc6dd154d9a01be87699e | ad79ad924319ae4c840799c6f279d5397ed13de7 | /java/SHA1.java | 0a453410ea83ac0187ee9a8b0dadecbaee7ae104 | [] | no_license | w4o/CodeSnippets | fff09f194af165a33368abcb9cb171aa3c23f0c6 | 63715e3739c2ded3fadd74a1e3445881ad57c3e8 | refs/heads/master | 2022-01-09T17:22:51.673071 | 2019-05-23T02:28:30 | 2019-05-23T02:28:30 | 112,837,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,488 | java | package com.ueedit.common.utils.security;
public class SHA1 {
private final int[] abcde = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 };
// 摘要数据存储数组
private int[] digestInt = new int[5];
// 计算过程中的临时数据存储数组
private int[] tmpData = new int[80];
// 计算sha-1摘要
private int process_input_bytes(byte[] bytedata) {
// 初试化常量
System.arraycopy(abcde, 0, digestInt, 0, abcde.length);
// 格式化输入字节数组,补10及长度数据
byte[] newbyte = byteArrayFormatData(bytedata);
// 获取数据摘要计算的数据单元个数
int MCount = newbyte.length / 64;
// 循环对每个数据单元进行摘要计算
for (int pos = 0; pos < MCount; pos++) {
// 将每个单元的数据转换成16个整型数据,并保存到tmpData的前16个数组元素中
for (int j = 0; j < 16; j++) {
tmpData[j] = byteArrayToInt(newbyte, (pos * 64) + (j * 4));
}
// 摘要计算函数
encrypt();
}
return 20;
}
// 格式化输入字节数组格式
private byte[] byteArrayFormatData(byte[] bytedata) {
// 补0数量
int zeros = 0;
// 补位后总位数
int size = 0;
// 原始数据长度
int n = bytedata.length;
// 模64后的剩余位数
int m = n % 64;
// 计算添加0的个数以及添加10后的总长度
if (m < 56) {
zeros = 55 - m;
size = n - m + 64;
} else if (m == 56) {
zeros = 63;
size = n + 8 + 64;
} else {
zeros = 63 - m + 56;
size = (n + 64) - m + 64;
}
// 补位后生成的新数组内容
byte[] newbyte = new byte[size];
// 复制数组的前面部分
System.arraycopy(bytedata, 0, newbyte, 0, n);
// 获得数组Append数据元素的位置
int l = n;
// 补1操作
newbyte[l++] = (byte) 0x80;
// 补0操作
for (int i = 0; i < zeros; i++) {
newbyte[l++] = (byte) 0x00;
}
// 计算数据长度,补数据长度位共8字节,长整型
long N = (long) n * 8;
byte h8 = (byte) (N & 0xFF);
byte h7 = (byte) ((N >> 8) & 0xFF);
byte h6 = (byte) ((N >> 16) & 0xFF);
byte h5 = (byte) ((N >> 24) & 0xFF);
byte h4 = (byte) ((N >> 32) & 0xFF);
byte h3 = (byte) ((N >> 40) & 0xFF);
byte h2 = (byte) ((N >> 48) & 0xFF);
byte h1 = (byte) (N >> 56);
newbyte[l++] = h1;
newbyte[l++] = h2;
newbyte[l++] = h3;
newbyte[l++] = h4;
newbyte[l++] = h5;
newbyte[l++] = h6;
newbyte[l++] = h7;
newbyte[l++] = h8;
return newbyte;
}
private int f1(int x, int y, int z) {
return (x & y) | (~x & z);
}
private int f2(int x, int y, int z) {
return x ^ y ^ z;
}
private int f3(int x, int y, int z) {
return (x & y) | (x & z) | (y & z);
}
private int f4(int x, int y) {
return (x << y) | x >>> (32 - y);
}
// 单元摘要计算函数
private void encrypt() {
for (int i = 16; i <= 79; i++) {
tmpData[i] = f4(tmpData[i - 3] ^ tmpData[i - 8] ^ tmpData[i - 14] ^ tmpData[i - 16], 1);
}
int[] tmpabcde = new int[5];
for (int i1 = 0; i1 < tmpabcde.length; i1++) {
tmpabcde[i1] = digestInt[i1];
}
for (int j = 0; j <= 19; j++) {
int tmp = f4(tmpabcde[0], 5) + f1(tmpabcde[1], tmpabcde[2], tmpabcde[3]) + tmpabcde[4] + tmpData[j]
+ 0x5a827999;
tmpabcde[4] = tmpabcde[3];
tmpabcde[3] = tmpabcde[2];
tmpabcde[2] = f4(tmpabcde[1], 30);
tmpabcde[1] = tmpabcde[0];
tmpabcde[0] = tmp;
}
for (int k = 20; k <= 39; k++) {
int tmp = f4(tmpabcde[0], 5) + f2(tmpabcde[1], tmpabcde[2], tmpabcde[3]) + tmpabcde[4] + tmpData[k]
+ 0x6ed9eba1;
tmpabcde[4] = tmpabcde[3];
tmpabcde[3] = tmpabcde[2];
tmpabcde[2] = f4(tmpabcde[1], 30);
tmpabcde[1] = tmpabcde[0];
tmpabcde[0] = tmp;
}
for (int l = 40; l <= 59; l++) {
int tmp = f4(tmpabcde[0], 5) + f3(tmpabcde[1], tmpabcde[2], tmpabcde[3]) + tmpabcde[4] + tmpData[l]
+ 0x8f1bbcdc;
tmpabcde[4] = tmpabcde[3];
tmpabcde[3] = tmpabcde[2];
tmpabcde[2] = f4(tmpabcde[1], 30);
tmpabcde[1] = tmpabcde[0];
tmpabcde[0] = tmp;
}
for (int m = 60; m <= 79; m++) {
int tmp = f4(tmpabcde[0], 5) + f2(tmpabcde[1], tmpabcde[2], tmpabcde[3]) + tmpabcde[4] + tmpData[m]
+ 0xca62c1d6;
tmpabcde[4] = tmpabcde[3];
tmpabcde[3] = tmpabcde[2];
tmpabcde[2] = f4(tmpabcde[1], 30);
tmpabcde[1] = tmpabcde[0];
tmpabcde[0] = tmp;
}
for (int i2 = 0; i2 < tmpabcde.length; i2++) {
digestInt[i2] = digestInt[i2] + tmpabcde[i2];
}
for (int n = 0; n < tmpData.length; n++) {
tmpData[n] = 0;
}
}
// 4字节数组转换为整数
private int byteArrayToInt(byte[] bytedata, int i) {
return ((bytedata[i] & 0xff) << 24) | ((bytedata[i + 1] & 0xff) << 16) | ((bytedata[i + 2] & 0xff) << 8)
| (bytedata[i + 3] & 0xff);
}
// 整数转换为4字节数组
private void intToByteArray(int intValue, byte[] byteData, int i) {
byteData[i] = (byte) (intValue >>> 24);
byteData[i + 1] = (byte) (intValue >>> 16);
byteData[i + 2] = (byte) (intValue >>> 8);
byteData[i + 3] = (byte) intValue;
}
// 将字节转换为十六进制字符串
private static String byteToHexString(byte ib) {
char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
char[] ob = new char[2];
ob[0] = Digit[(ib >>> 4) & 0X0F];
ob[1] = Digit[ib & 0X0F];
String s = new String(ob);
return s;
}
// 将字节数组转换为十六进制字符串
private static String byteArrayToHexString(byte[] bytearray) {
String strDigest = "";
for (int i = 0; i < bytearray.length; i++) {
strDigest += byteToHexString(bytearray[i]);
}
return strDigest;
}
// 计算sha-1摘要,返回相应的字节数组
public byte[] getDigestOfBytes(byte[] byteData) {
process_input_bytes(byteData);
byte[] digest = new byte[20];
for (int i = 0; i < digestInt.length; i++) {
intToByteArray(digestInt[i], digest, i * 4);
}
return digest;
}
// 计算sha-1摘要,返回相应的十六进制字符串
public String getDigestOfString(byte[] byteData) {
return byteArrayToHexString(getDigestOfBytes(byteData));
}
public static void main(String[] args) {
String data = "123456";
System.out.println(data);
String digest = new SHA1().getDigestOfString(data.getBytes());
System.out.println(digest);
// System.out.println( ToMD5.convertSHA1(data).toUpperCase());
}
}
| [
"no-mail"
] | no-mail |
b5cee95df8bf166b268f3bccf7d8972bc14e9f23 | 009b5374faff17da31c3cf869db9eb3a6bb9aeef | /src/main/java/com/souvenironline/api/admin/SildeAPI.java | 41bd702c6fb9369e194c9ed15adcd7324e65e06e | [] | no_license | tandat56/SouvenirOnline | 65610ad4bd2a7ad453749304d1e68c128b862015 | e7df215061624d97fcf6d2fc67aa3c012bf4a507 | refs/heads/main | 2023-02-15T12:25:34.174779 | 2021-01-18T08:13:58 | 2021-01-18T08:13:58 | 308,809,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | package com.souvenironline.api.admin;
import com.souvenironline.dto.SildeDTO;
import com.souvenironline.service.admin.ISildeAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
public class SildeAPI {
@Autowired
private ISildeAdminService sildeAdminService;
@PostMapping("/api/silde")
public SildeDTO createSilde(@RequestBody SildeDTO sildeDTO) {
return sildeAdminService.save(sildeDTO);
}
@PutMapping("/api/silde")
public SildeDTO updateSilde(@RequestBody SildeDTO updateSilde) {
return sildeAdminService.save(updateSilde);
}
@DeleteMapping("/api/silde")
public void deleteSilde(@RequestBody long[] ids) {
sildeAdminService.delete(ids);
}
}
| [
"datlt,[email protected]"
] | datlt,[email protected] |
93118d245380393e17d3715f4188d09de30a0e5b | 1263fcecc09ee5b5a46863c6f2c1e3cb4140083c | /src/com/example/activity/XiaJiaActivity.java | bd4c0ccc421c0a3bd0e12c503613f4b2f5a293e8 | [] | no_license | ltliyue/TaoTao | 69ec1ef9db66bf8373ae8b9b144ed21f153a0005 | a8f16b977233d502ea747c916e1ec0446190743d | refs/heads/master | 2021-01-18T21:40:57.421821 | 2016-03-31T02:35:51 | 2016-03-31T02:35:51 | 21,632,722 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,849 | java | package com.example.activity;
//商品下架
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import org.json.JSONException;
import org.json.JSONObject;
import com.example.utils.APIUtil;
import com.example.utils.Util;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.widget.LinearLayout;
import android.widget.Toast;
public class XiaJiaActivity extends Activity {
public static final String TAG = "XiaJiaActivity";
LinearLayout exit, fanhui;
String sign;
String result;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadList();
}
public void loadList() {
sign = getParams(); // 获得API签名
publishFeedThread();
}
public String getParams() {
TreeMap<String, String> apiparamsMap01 = new TreeMap<String, String>();
String num = Util.num_iid;
apiparamsMap01.put("format", "json");
apiparamsMap01.put("method", "taobao.item.update.delisting");
apiparamsMap01.put("sign_method", "md5");
apiparamsMap01.put("app_key", Util.APPKEY);
apiparamsMap01.put("v", "2.0");
apiparamsMap01.put("session", Util.access_token);
String timestamp01 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
apiparamsMap01.put("timestamp", timestamp01);
apiparamsMap01.put("num_iid", num);
// 生成签名
String sign = APIUtil.md5Signature(apiparamsMap01, Util.SECRET);
TreeMap<String, String> apiparamsMap = new TreeMap<String, String>();
apiparamsMap.put("format", "json");
apiparamsMap.put("method", "taobao.item.update.delisting");
apiparamsMap.put("sign_method", "md5");
apiparamsMap.put("app_key", Util.APPKEY);
apiparamsMap.put("v", "2.0");
apiparamsMap.put("session", Util.access_token);
String timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
apiparamsMap.put("timestamp", timestamp);
apiparamsMap.put("num_iid", num);
apiparamsMap.put("sign", sign);
StringBuilder param = new StringBuilder();
for (Iterator<Map.Entry<String, String>> it = apiparamsMap.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, String> e = it.next();
param.append("&").append(e.getKey()).append("=").append(e.getValue());
}
Log.i(TAG, "TEST==" + param.toString().substring(1));
return param.toString().substring(1);
}
public void publishFeedThread() {
new Thread() {
@Override
public void run() {
int what = 1;
// 发送请求得到数据
String testUrl = "http://gw.api.taobao.com/router/rest";
result = APIUtil.getResult(testUrl, getParams());
// 解析得到的数据
try {
JSONObject data = new JSONObject(result);
JSONObject item_update_delisting_response = data.getJSONObject("item_update_delisting_response");
JSONObject item = item_update_delisting_response.getJSONObject("item");
String num_iid = item.getString("num_iid");
String modified = item.getString("modified");
} catch (JSONException e) {
e.printStackTrace();
}
Message msg = new Message();
msg.what = what;
Bundle bundle = new Bundle();
bundle.putString("result", result); // 往Bundle中存放数据
msg.setData(bundle); // mes利用Bundle传递数据
handler.sendMessage(msg); // 用activity中的handler发送消息
}
}.start();
}
/**
* 更新UI线程ListView
*/
Handler handler = new Handler() {
public void handleMessage(Message msg) {
Toast.makeText(XiaJiaActivity.this, "商品已成功下架,转到仓库中宝贝", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
intent.setClass(XiaJiaActivity.this, Baobei1.class);
finish();
startActivity(intent);
}
};
}
| [
"[email protected]"
] | |
d04177f479d440fb703612714f19c413a11f4e20 | 08345dde7830b0080ae84c0dee096053febea69d | /designPatternn_chan/src/main/java/c4/adapter/section1/IUserInfo.java | add273c6ac8b28595314f18aef5b5e72f5ccb387 | [] | no_license | sumnear/codeLife | fbf2a929fd4b829c1cdd69464b30e169a5bc7fcf | 227a2a2480d27fd1961e62f89173216d045736b1 | refs/heads/master | 2022-12-23T07:36:10.508350 | 2021-06-27T13:06:34 | 2021-06-27T13:06:34 | 198,769,670 | 0 | 0 | null | 2022-12-16T05:24:26 | 2019-07-25T06:18:32 | Java | UTF-8 | Java | false | false | 636 | java | package c4.adapter.section1;
/**
* @author cbf4Life [email protected]
* I'm glad to share my knowledge with you all.
* 用户信息对象
*/
public interface IUserInfo {
//获得用户姓名
public String getUserName();
//获得家庭地址
public String getHomeAddress();
//手机号码,这个太重要,手机泛滥呀
public String getMobileNumber();
//办公电话,一般式座机
public String getOfficeTelNumber();
//这个人的职位是啥
public String getJobPosition();
//获得家庭电话,这个有点缺德,我是不喜欢打家庭电话讨论工作
public String getHomeTelNumber();
}
| [
"[email protected]"
] | |
38f0ab191046928c602128f2b671aa32402a3751 | aec783d985b9ac802cf4ff4cc560297032b3c8c6 | /WeChatDemo/src/com/matrix/wechat/activity/FriendRequestActivity.java | ef35fe005acde3320c167bae97536651bb3a9656 | [] | no_license | TimBuild/WeChat_Friends | d47c2fb8497c7c0481c5d7051fbad17a2b39cb69 | fa8fb88fd0a1212756cd5c50e0aa7db2b245fb41 | refs/heads/master | 2020-04-05T23:40:28.678642 | 2015-07-15T06:53:56 | 2015-07-15T06:53:56 | 35,399,451 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,051 | java | package com.matrix.wechat.activity;
import static com.matrix.wechat.global.Constants.API_GET_REQUEST_LIST;
import static com.matrix.wechat.global.Constants.API_GET_USER_BY_USERID;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
import com.matrix.wechat.R;
import com.matrix.wechat.adapter.FriendRequestListAdapter;
import com.matrix.wechat.model.FriendRequest;
import com.matrix.wechat.utils.CacheUtil;
import com.matrix.wechat.utils.NetworkUtil;
import com.matrix.wechat.web.Request;
public class FriendRequestActivity extends Activity {
public static Activity instance = null;
public static List<FriendRequest> friendRequests = null;
public static FriendRequestListAdapter adapter;
private ListView requests_LV;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_friend_request);
instance = this;
friendRequests = new ArrayList<FriendRequest>();
adapter = new FriendRequestListAdapter(this, friendRequests);
requests_LV = (ListView) findViewById(R.id.requests_LV);
requests_LV.setAdapter(adapter);
requests_LV.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
FriendRequest request = adapter.friendRequests.get(arg2);
Log.i("info", request.toString());
new Request(instance, API_GET_USER_BY_USERID, true).execute(request.getUserid(), request);
}
});
if(!NetworkUtil.isNetworkConnected(this)) {
Toast.makeText(this, "network anomaly", Toast.LENGTH_LONG).show();
this.finish();
return;
}
new Request(this, API_GET_REQUEST_LIST, true).execute(CacheUtil.getUser(this).getUserid());
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.