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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4860267c551bb63983c0a44ce7fcd0016ec1c831 | 963599f6f1f376ba94cbb504e8b324bcce5de7a3 | /sources/p035ru/unicorn/ujin/util/Validator.java | b90b3b4cc578ead928ddae0cbd76652cfe63234f | [] | no_license | NikiHard/cuddly-pancake | 563718cb73fdc4b7b12c6233d9bf44f381dd6759 | 3a5aa80d25d12da08fd621dc3a15fbd536d0b3d4 | refs/heads/main | 2023-04-09T06:58:04.403056 | 2021-04-20T00:45:08 | 2021-04-20T00:45:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,475 | java | package p035ru.unicorn.ujin.util;
import android.text.TextUtils;
import android.widget.EditText;
import com.google.android.material.textfield.TextInputLayout;
import p035ru.mysmartflat.kortros.R;
/* renamed from: ru.unicorn.ujin.util.Validator */
public class Validator {
public static boolean isNameValid(String str) {
return true;
}
public static boolean isEmailValid(String str) {
return str.matches("(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])");
}
public static boolean isPasswordSafe(String str) {
return str.matches("^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$");
}
public static boolean isPhoneValid(String str) {
return containsOnlyDigits(str) && str.length() == 11;
}
public static boolean isPasswordValid(String str) {
return str.length() >= 6;
}
public static boolean isRegistrationCodeValid(String str) {
return str.length() == 20;
}
public static boolean containsOnlyDigits(String str) {
return str.matches("\\d+");
}
public static boolean isCorrectFormatDate(String str) {
return str.matches("\\d{4}-\\d{2}-\\d{2}");
}
public static boolean validate(EditText editText, TextInputLayout textInputLayout) {
return validate(editText, textInputLayout, editText.getContext().getString(R.string.error_not_empty));
}
public static boolean validate(EditText editText, TextInputLayout textInputLayout, String str) {
if (editText.getVisibility() == 8 || editText.getVisibility() == 4 || textInputLayout.getVisibility() == 8 || textInputLayout.getVisibility() == 4) {
return true;
}
if (TextUtils.getTrimmedLength(editText.getText().toString()) > 0) {
textInputLayout.setError((CharSequence) null);
textInputLayout.setErrorEnabled(false);
return true;
}
textInputLayout.setError(str);
textInputLayout.clearFocus();
textInputLayout.requestFocus();
return false;
}
}
| [
"[email protected]"
] | |
10214a2b05f961c0aa5e3c5cc6476da9d58d7766 | 6e26eb3110fe0a9977092f737a2b0cfc282ab54d | /app/src/main/java/com/devahmed/techx/onlineshop/ui/notifications/NotificationsViewModel.java | 31ee7b9f31fab3fd94752e03d251cf6d4c148b4c | [] | no_license | mohamedhossny4654/e-commerce-app | 1f80a4dbb76c234188d6d43381ae758fe6c0c84a | d043d638c93ff5f98df0a33dde43fdb053f78005 | refs/heads/master | 2023-02-22T14:54:05.889450 | 2021-01-24T14:34:49 | 2021-01-24T14:34:49 | 332,470,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package com.devahmed.techx.onlineshop.ui.notifications;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class NotificationsViewModel extends ViewModel {
private MutableLiveData<String> mText;
public NotificationsViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is notifications fragment");
}
public LiveData<String> getText() {
return mText;
}
} | [
"[email protected]"
] | |
5d4ca9c08cc76f850d5cc61c30a3a37509220e27 | 29227577f1b07a9fcada5d38d6c57cded3515cb2 | /src/main/java/cct/interfaces/Point3fInterface.java | 6f8716df25160581b46bd03a5eb3c8956f893143 | [
"Apache-2.0"
] | permissive | SciGaP/seagrid-rich-client | ad11edd2691c0ac1863591e106cb5f4f19d6d633 | b7114b3bb4bb3796e8f9ab3b49e5bd08f9fc005e | refs/heads/master | 2023-06-23T16:33:10.356706 | 2022-06-16T02:27:46 | 2022-06-16T02:27:46 | 45,587,225 | 1 | 8 | Apache-2.0 | 2023-06-14T22:43:06 | 2015-11-05T04:19:15 | Java | UTF-8 | Java | false | false | 2,415 | java | /* ***** BEGIN LICENSE BLOCK *****
Version: Apache 2.0/GPL 3.0/LGPL 3.0
CCT - Computational Chemistry Tools
Jamberoo - Java Molecules Editor
Copyright 2008-2015 Dr. Vladislav Vasilyev
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.
Contributor(s):
Dr. Vladislav Vasilyev <[email protected]> (original author)
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the Apache 2.0, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the Apache 2.0, the GPL or the LGPL.
***** END LICENSE BLOCK *****/
package cct.interfaces;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: ANU</p>
*
* @author Dr. V. Vasilyev
* @version 1.0
*/
public interface Point3fInterface {
double distanceTo(Point3fInterface point);
float getX();
float getY();
float getZ();
void setX(double x);
void setY(double y);
void setZ(double z);
void setXYZ(double xx, double yy, double zz);
void setXYZ(Point3fInterface xyz);
void subtract(Point3fInterface a1, Point3fInterface a2);
Point3fInterface getInstance();
Point3fInterface getInstance(Point3fInterface a);
Point3fInterface getInstance(float xx, float yy, float zz);
}
| [
"[email protected]"
] | |
687f454532e63eca23ebbaf06660bae5d266e1ca | 5548ae11bc86a1903b424bd9f3c1caac0ea6a74a | /V1.0/src/main/java/com/logo/eshow/service/impl/ServiceTypeManagerImpl.java | da493cce7942a9078fc67219d93eae18d14237b6 | [] | no_license | lizheng473/b2bEshow | 491c9e62230721b6a347f5bc95b2a38307f6dbd1 | e4ba45cf7fb6409e69c358c42191fa2725caf6b1 | refs/heads/master | 2016-09-11T00:21:14.718892 | 2014-10-25T08:48:01 | 2014-10-25T08:48:01 | 20,797,734 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package com.logo.eshow.service.impl;
import com.logo.eshow.bean.query.ServiceTypeQueryBean;
import com.logo.eshow.common.page.Page;
import com.logo.eshow.dao.ServiceTypeDao;
import com.logo.eshow.model.ServiceType;
import com.logo.eshow.service.ServiceTypeManager;
import com.logo.eshow.service.impl.GenericManagerImpl;
import java.util.List;
import javax.jws.WebService;
@WebService(serviceName = "ServiceTypeService", endpointInterface = "com.logo.eshow.service.ServiceTypeManager")
public class ServiceTypeManagerImpl extends GenericManagerImpl<ServiceType, Integer> implements
ServiceTypeManager {
ServiceTypeDao serviceTypeDao;
public ServiceTypeManagerImpl(ServiceTypeDao serviceTypeDao) {
super(serviceTypeDao);
this.serviceTypeDao = serviceTypeDao;
}
public List<ServiceType> list(ServiceTypeQueryBean queryBean) {
return serviceTypeDao.list(queryBean);
}
public Page<ServiceType> search(ServiceTypeQueryBean queryBean, int offset,
int pagesize) {
return serviceTypeDao.search(queryBean, offset, pagesize);
}
} | [
"[email protected]"
] | |
a9a80e042417abf1035f26ddd2cbb5a508cdb218 | 58d1fcf7fa8d7ce6e3129178fb5486ed30508cd0 | /SonoRoll/app/src/main/java/com/gentlesoft/sonoroll/Menuf.java | bb7c22af7a52aa97503ce150d62613b0cca30830 | [] | no_license | mamm3/RealInter | ee1d50199cda71b9449fb3bca70b2699358f2bc7 | 5c87eb0b72188b06fb596af605449672bb496afa | refs/heads/master | 2020-05-23T21:26:36.665564 | 2019-05-20T05:39:41 | 2019-05-20T05:39:41 | 186,954,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | package com.gentlesoft.sonoroll;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
public class Menuf extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menuf);
}
}
| [
"[email protected]"
] | |
05e681d11216f753ef1ebdb39a38358706e2c641 | 3e93bf92b8f23d140f112996e7ec73a2aa65073c | /6. @ModelAttribute & @SessionAttributes/2. Passing model object as parameter and annotated with @ModelAttribute/sampleSpringWeb/src/main/java/com/soni/controller/HelloWorldController.java | 693b475f8918049c4902e69c5926801d2775eb0f | [] | no_license | suyash248/spring_mvc | 228d13b9864f2609c8a48dd72231738532cd78b3 | 89cac59157471ade34ea595f2b6e6cef5190b21d | refs/heads/master | 2021-07-23T21:17:53.021902 | 2017-11-05T22:22:47 | 2017-11-05T22:22:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,330 | java | package com.soni.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.soni.model.UserDetail;
@Controller
public class HelloWorldController {
@RequestMapping(value="/", method=RequestMethod.GET)
public String helloWorld(@ModelAttribute(value="userDetail") UserDetail userDetail) {
userDetail.setUsername("Abhi"); // userDetail model object will be placed in a model map after executing this handler method. So we can alter it here.
return "showDetails.def";
}
// All the methods that are annotated with @ModelAttribute annotation are executed first and the result of those methods are stored in temporary map.
// Then the handler method(s) are executed and after completing the execution of handler method, That temporary map is added to model and can be accessed inside view.
@ModelAttribute(value="userDetail")
public UserDetail initializeUserDetail(){
UserDetail userDetail = new UserDetail();
userDetail.setUsername("Suyash");
userDetail.setEmail("[email protected]");
userDetail.setAge(21);
userDetail.setPhone("8894617178");
return userDetail;
}
}
| [
"[email protected]"
] | |
2183edbd57591caa99cb28371a445e79c763743d | d37b8315bcb00b393b34bedcd24833a7a62fa339 | /bjstjh_console/src/main/java/com/sutong/auditDoorFrame/controller/AuditDoorFrameController.java | 285304919cf08cee47eaf58e0ca443ea87ed66fb | [] | no_license | springbn/bejing | 87e94c8df02e0a57595ad5494ebb310b1dda8227 | f26a86884691a2b7832b742d9cd774cd127b837d | refs/heads/master | 2022-10-01T17:11:49.503743 | 2020-06-09T16:13:53 | 2020-06-09T16:13:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,730 | java | package com.sutong.auditDoorFrame.controller;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import com.sutong.auditDoorFrame.model.AuditDoorFrame;
import com.sutong.auditDoorFrame.service.AuditDoorFrameService;
import com.sutong.bjstjh.result.Result;
import com.sutong.bjstjh.util.DateUtils;
import com.sutong.bjstjh.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
/**
* @Description: 门架数据管理
* @author: Mr.Kong
* @date: 2019/12/23 11:31
*/
@CrossOrigin
@RestController
public class AuditDoorFrameController {
private static final Logger logger = LoggerFactory.getLogger(AuditDoorFrameController.class);
@Reference
private AuditDoorFrameService auditDoorFrameService;
// 绑定变量名字和属性,参数封装进类
@InitBinder("auditDoorFrame")
public void initBinderAuditDoorFrame(WebDataBinder binder) {
binder.setFieldDefaultPrefix("auditDoorFrame.");
}
/**
* @description: 查询门架数据分页
* @auther: Mr.kong
* @date: 2019/12/23 13:54
* @Param auditDoorFrame: 门架数据实体
* @Param pageNum: 当前页码
* @Param pageSize: 分页条数
* @return: com.sutong.bjstjh.result.Result
**/
@RequestMapping("/auditDoorFrame/page")
public Result doFindAuditDoorFramePage(@ModelAttribute("auditDoorFrame") AuditDoorFrame auditDoorFrame,
@RequestParam(value = "pageNum",defaultValue = "1")int pageNum,
@RequestParam(value = "pageSize",defaultValue = "10")int pageSize){
try {
if (StringUtils.isNotEmpty(auditDoorFrame.getStartTimeStr()) && DateUtils.checkDateReg(auditDoorFrame.getStartTimeStr())){
auditDoorFrame.setStartTimeDate(DateUtils.parseToDate(auditDoorFrame.getStartTimeStr(), "yyyy-MM-dd"));
}
if (StringUtils.isNotEmpty(auditDoorFrame.getEndTimeStr()) && DateUtils.checkDateReg(auditDoorFrame.getEndTimeStr())){
auditDoorFrame.setEndTimeDate(DateUtils.parseToDate(auditDoorFrame.getEndTimeStr(), "yyyy-MM-dd"));
}
PageInfo<AuditDoorFrame> pageInfo = auditDoorFrameService.doFindAuditDoorFramePage(pageNum, pageSize, auditDoorFrame);
return Result.ok().data("pageInfo",pageInfo);
}catch (Exception e){
e.printStackTrace();
logger.error("AuditDoorFrameController.doFindAuditDoorFramePage", e);
return Result.error().message("系统异常,请稍后再试!");
}
}
}
| [
"[email protected]"
] | |
cf8f3826c51d28f10879c78842095ca3a927a42f | 69ff12744be222e3ffd764a12ca75c968183040d | /ECFramework/src/com/ecloudiot/framework/widget/QRCodeWidget.java | 7640eb0894891192737f3797288b95646e107326 | [] | no_license | yixinxiangshan/YunDongJingAn_Android | de93c32608b42da3741ef07be0fbbb7bf2e7e31b | a8be24265dd98e2210f1d169d0bcd75ae22b5363 | refs/heads/master | 2021-01-17T07:07:42.563005 | 2016-03-12T16:23:35 | 2016-03-12T16:23:35 | 33,221,523 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 967 | java | package com.ecloudiot.framework.widget;
import com.ecloudiot.framework.event.listener.CaptureQRCodeListener;
import com.ecloudiot.framework.utility.LogUtil;
import com.google.zxing.client.android.CaptureActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
@SuppressLint("ViewConstructor")
public class QRCodeWidget extends BaseWidget {
private final static String TAG = "QRCodeWidget";
public QRCodeWidget(Object pageContext, String dataString, String layoutName) {
super(pageContext, dataString, layoutName);
LogUtil.d(TAG, "QRCodeWidget : start activity ...");
parsingData();
CaptureQRCodeListener captureQRCodeListener = new CaptureQRCodeListener(ctx, this, "");
Bundle mBundle = new Bundle();
mBundle.putSerializable("captureQRCodeListener", captureQRCodeListener);
Intent intent = new Intent(ctx, CaptureActivity.class);
// intent.putExtras(mBundle);
ctx.startActivity(intent);
}
}
| [
"[email protected]"
] | |
2cb27a5cea55e9122e05c63beeb245bd299ab465 | c9d1ffc85084173021b453ca8590f9f2250390a5 | /animator/src/main/java/com/zhenai/animator/MainActivity.java | 73182128f8bb0fb2ed9cc6666cf31cbbc673a250 | [] | no_license | lcf2013/androidExercise | ea92678e854fec4b52b33e4fd3e9ae0ea6293613 | 784da940e3edf67e4e2e1b0f9a5186b0fbb2304b | refs/heads/master | 2021-01-10T09:17:22.045626 | 2016-04-07T04:42:03 | 2016-04-07T04:42:03 | 47,161,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,142 | java | package com.zhenai.animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView txt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txt=(TextView)findViewById(R.id.txt);
/*
ValueAnimator valueAnimator=ValueAnimator.ofFloat(0f,5f,3f,10f);
valueAnimator.setDuration(3000);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float cur = (float) valueAnimator.getAnimatedValue();
Log.d("TAG", cur + "");
}
});
valueAnimator.start();*/
/*
ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(txt,"rotation",0f,360f);
objectAnimator.setDuration(3000);
objectAnimator.start();*/
/*
float cur=txt.getTranslationX();
ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(txt,"translationX",cur,-5000f,cur);
objectAnimator.setDuration(3000);
objectAnimator.start();*/
/*
ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(txt,"scaleY",1f,3f,1f);
objectAnimator.setDuration(3000);
objectAnimator.start();*/
/*
ObjectAnimator moveIn = ObjectAnimator.ofFloat(txt, "translationX", -500f, 0f);
ObjectAnimator rotate = ObjectAnimator.ofFloat(txt, "rotation", 0f, 360f);
ObjectAnimator fadeInOut = ObjectAnimator.ofFloat(txt, "alpha", 1f, 0f, 1f);
AnimatorSet animSet = new AnimatorSet();
animSet.play(rotate).with(fadeInOut).after(moveIn);
animSet.setDuration(5000);
animSet.start();*/
txt.animate().setDuration(3000).alpha(0f);
}
}
| [
"[email protected]"
] | |
9ff21ed7d326e7394fcf094f89b21a812e68a2d8 | a86fd523d6c1dc67501989bcf4dc90218bb48c1f | /GreenPOS/src-pda/com/openbravo/pos/ticket/CategoryInfo.java | c4f8991e74a795ff61ec88aa070956d159ac64f3 | [] | no_license | raccarab/openbravocustom | 173302a4d448dda43d47f89ff092020b2cac57a3 | 2973aefa50331ba082cc8f0c54cd7fde1b273df4 | refs/heads/master | 2021-01-25T10:29:47.334527 | 2012-03-13T17:44:13 | 2012-03-13T17:44:13 | 32,250,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,485 | java | // Openbravo POS is a point of sales application designed for touch screens.
// Copyright (C) 2007-2009 Openbravo, S.L.
// http://code.google.com/p/openbravocustom/
//
// This file is part of Openbravo POS.
//
// Openbravo POS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Openbravo POS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Openbravo POS. If not, see <http://www.gnu.org/licenses/>.
package com.openbravo.pos.ticket;
/**
*
* @author jaroslawwozniak
*/
public class CategoryInfo {
private String id;
private String name;
private String parentid;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getParentid() {
return parentid;
}
public void setParentid(String parentid) {
this.parentid = parentid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]@59e4095a-f9fc-11de-8cdf-e97ad7d0f28a"
] | [email protected]@59e4095a-f9fc-11de-8cdf-e97ad7d0f28a |
abc9f7ced8827cd7ee4c7647d2b8c3bcda9d13c6 | dd53a59066a398d5627324562d1b2be6e5173012 | /olami-android-voice-assistant-example/examples/src/main/java/ai/olami/android/example/DumpIDSDataExample.java | 3ecbaa6eeb1197f80b0859ae1eea5c98943208e6 | [
"Apache-2.0"
] | permissive | olami-developers/olami-android-voice-kit | 97342771154d9aa8861a2392721254ed90e5f6c2 | 68d3be06be4a9fdb3b3c1a8e2188d8165b12397c | refs/heads/master | 2022-01-25T10:02:23.150147 | 2019-06-13T09:56:53 | 2019-06-13T09:56:53 | 109,241,875 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 27,741 | java | /*
Copyright 2017, VIA Technologies, Inc. & OLAMI Team.
http://olami.ai
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 ai.olami.android.example;
import java.util.ArrayList;
import java.util.Map;
import ai.olami.ids.BaikeData;
import ai.olami.ids.CookingData;
import ai.olami.ids.ExchangeRateData;
import ai.olami.ids.IDSResult;
import ai.olami.ids.JokeData;
import ai.olami.ids.KKBOXData;
import ai.olami.ids.KKBOXDataPhoto;
import ai.olami.ids.MathData;
import ai.olami.ids.MusicControlData;
import ai.olami.ids.NewsData;
import ai.olami.ids.OpenWebData;
import ai.olami.ids.PoemData;
import ai.olami.ids.StockMarketData;
import ai.olami.ids.TVProgramData;
import ai.olami.ids.UnitConvertData;
import ai.olami.ids.WeatherData;
import ai.olami.nli.NLIResult;
public class DumpIDSDataExample {
/**
* Parsing IDS data to get reply for questions or dialogue.
*
* @param nliResult NLIResult object.
* @see [https://github.com/olami-developers/olami-java-client-sdk]
*/
public static String dumpIDSData(NLIResult nliResult) {
//
// * This method shows you how to parsing IDS data.
// -----------------------------------------------------------------------------------------
// This refers to dump-nli-results-example of the olami-java-client-sdk,
// So you can also find the example in https://github.com/olami-developers
//
String description = null;
if (nliResult == null) {
System.out.println("* [ERROR] NLI Result cannot be null! *");
return description;
}
System.out.println("|--[Example to Dump IDS Info & Data]----------- ");
// ********************************************************************
// * WEATHER EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 上海的天气怎么样
// * Traditional Chinese (Taiwan): 台北的天氣怎麼樣
// ********************************************************************
// * Check to see if contains IDS weather data
if (nliResult.getType().equals(IDSResult.Types.WEATHER.getName())) {
// Get all of WeatherData into ArrayList.
ArrayList<WeatherData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS Weather Data[%s] %s :\n", x,
(dataArray.get(x).isQueryTarget() ? "*TARGET*" : ""));
System.out.format("|\t\t- Date: %s\n",
dataArray.get(x).getDate());
System.out.format("|\t\t- City: %s\n",
dataArray.get(x).getCity());
System.out.format("|\t\t- Weather Type: %s\n",
dataArray.get(x).getWeatherEnd());
System.out.format("|\t\t- Description: %s\n",
dataArray.get(x).getDescription());
System.out.format("|\t\t- Wind: %s\n",
dataArray.get(x).getWind());
System.out.format("|\t\t- Temperature: %s to %s\n",
dataArray.get(x).getMinTemperature(),
dataArray.get(x).getMaxTemperature());
}
description = nliResult.getDescObject().getReplyAnswer();
}
// ********************************************************************
// * BAIKE EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 姚明的简介
// * Traditional Chinese (Taiwan): 郭台銘的簡介
// ********************************************************************
// * Check to see if contains IDS baike data
if (nliResult.getType().equals(IDSResult.Types.BAIKE.getName())) {
// Get all of BaikeData into ArrayList.
ArrayList<BaikeData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS Baike Data[%s] :\n", x);
System.out.format("|\t\t- Type: %s\n",
dataArray.get(x).getType());
System.out.format("|\t\t- Description: %s\n",
dataArray.get(x).getDescription());
System.out.format("|\t\t- Photo: %s\n",
dataArray.get(x).getPhotoURL());
description = dataArray.get(x).getDescription();
// List categories
if (dataArray.get(x).hasCategoryList()) {
String[] cateArray = dataArray.get(x).getCategoryList();
for (int i = 0; i < cateArray.length; i++) {
System.out.format("|\t\t- Categories[%s]: %s\n",
i, cateArray[i]);
}
}
// List detailed information
int fieldSize = dataArray.get(x).getNumberOfFields();
if (fieldSize > 0) {
System.out.println("|\t\t- Fields: " + fieldSize);
Map<String, String> fields = dataArray.get(x).getFieldNameValues();
for (Map.Entry<String, String> entry : fields.entrySet()) {
entry.getKey();
System.out.format("|\t\t - %s: %s\n",
entry.getKey(), entry.getValue());
}
}
}
}
// ********************************************************************
// * NEWS EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 今日新闻
// * Traditional Chinese (Taiwan): 今日新聞
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS news data.
// * And also check 'the TYPE OF DescObject' if it is a SELECTION mode.
if (nliResult.getType().equals(IDSResult.Types.NEWS.getName())
|| nliResult.getDescObject().getType().equals(IDSResult.Types.NEWS.getName())) {
// Get all of NewsData into ArrayList.
ArrayList<NewsData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS News Data[%s] :\n", x);
System.out.format("|\t\t- Title: %s\n",
dataArray.get(x).getTitle());
System.out.format("|\t\t- Time: %s\n",
dataArray.get(x).getTime());
System.out.format("|\t\t- URL: %s\n",
dataArray.get(x).getSourceURL());
System.out.format("|\t\t- Details: %s\n",
dataArray.get(x).getDetail());
System.out.format("|\t\t- Source: %s\n",
dataArray.get(x).getSourceName());
System.out.format("|\t\t- Image: %s\n",
dataArray.get(x).getImageURL());
}
description = nliResult.getDescObject().getReplyAnswer();
}
// ********************************************************************
// * KKBOX EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): ** 简体中文服务地区尚不支持此模块 **
// * Traditional Chinese (Taiwan): 我要聽音樂
// ********************************************************************
// * Check to see if contains IDS KKBOX data
if (nliResult.getType().equals(IDSResult.Types.KKBOX.getName())) {
// Get all of KKBOXData into ArrayList.
ArrayList<KKBOXData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS KKBOX Data[%s] :\n", x);
System.out.format("|\t\t- ID: %s\n",
dataArray.get(x).getID());
System.out.format("|\t\t- Duration: %s\n",
dataArray.get(x).getDuration());
System.out.format("|\t\t- Title: %s\n",
dataArray.get(x).getTitle());
System.out.format("|\t\t- Artist: [ID=%s], %s\n",
dataArray.get(x).getArtistID(), dataArray.get(x).getArtist());
System.out.format("|\t\t- Album: [ID=%s], %s\n",
dataArray.get(x).getAlbumID(), dataArray.get(x).getAlbum());
System.out.format("|\t\t- URL: %s\n",
dataArray.get(x).getURL());
// List photos
if (dataArray.get(x).hasPhotos()) {
KKBOXDataPhoto[] photoArray = dataArray.get(x).getPhotos();
for (int i = 0; i < photoArray.length; i++) {
System.out.format("|\t\t- Photo[%s]:\n", i);
System.out.format("|\t\t\t- Width:%s , Hight:%s\n",
photoArray[i].getWidth(), photoArray[i].getHeight());
System.out.format("|\t\t\t- URL:%s\n",
photoArray[i].getURL());
}
}
}
description = nliResult.getDescObject().getReplyAnswer();
}
// ********************************************************************
// * MUSIC CONTROL EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 下一首
// * Traditional Chinese (Taiwan): 下一首
// ********************************************************************
// * Check to see if contains IDS MusicControl data
if (nliResult.getType().equals(IDSResult.Types.MUSIC_CONTROL.getName())) {
// Get all of MusicControlData into ArrayList.
ArrayList<MusicControlData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS MusicControl Data[%s] :\n", x);
System.out.format("|\t\t- Index: %s\n",
(dataArray.get(x).hasIndex() ? dataArray.get(x).getIndex() : "NO INDEX, [It means based on current/previous index] "));
System.out.format("|\t\t- Command: %s \n",
dataArray.get(x).getCommand());
if (dataArray.get(x).getCommand().equals(MusicControlData.NEXT)) {
System.out.println("|\t\t <播放下一首 / 播放下一首>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.PREVIOUS)) {
System.out.println("|\t\t <播放上一首 / 播放上一首>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.PAUSE)) {
System.out.println("|\t\t <暂停播放 / 暫停播放>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.PLAY)) {
System.out.println("|\t\t <开始播放 / 開始播放>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.RANDOM)) {
System.out.println("|\t\t <随机播放模式 / 隨機播放模式>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.LOOP)) {
System.out.println("|\t\t <循环播放模式 / 循環播放模式>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.ORDER)) {
System.out.println("|\t\t <顺序播放模式 / 順序播放模式>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.MUTE)) {
System.out.println("|\t\t <设置为静音 / 設置為靜音>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.VOLUME_UP)) {
System.out.println("|\t\t <音量增大 / 音量增大>");
}
if (dataArray.get(x).getCommand().equals(MusicControlData.VOLUME_DOWN)) {
System.out.println("|\t\t <音量减小 / 音量減小>");
}
}
description = nliResult.getDescObject().getReplyAnswer();
}
// ********************************************************************
// * TV PROGRAM EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 今晚8点后的东方卫视节目
// * Traditional Chinese (Taiwan): 今晚8點後的公視電視節目
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS TV program data.
// * And also check 'the TYPE OF DescObject' if it is a QUESTION mode.
if (nliResult.getType().equals(IDSResult.Types.TV_PROGRAM.getName())
|| nliResult.getDescObject().getType().equals(IDSResult.Types.TV_PROGRAM.getName())) {
// Extended fields for this module:
System.out.format("|\t- /////////////////////////////////////\n");
// Try to get URL from the DescObject.
if (nliResult.getDescObject().hasURL()) {
System.out.format("|\t- URL: %s\n",
nliResult.getDescObject().getURL());
}
System.out.format("|\t- /////////////////////////////////////\n");
// Get all of TVProgramData into ArrayList.
ArrayList<TVProgramData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS TV Program Data[%s] %s :\n", x,
(dataArray.get(x).isHighlight() ? "*TARGET*" : ""));
System.out.format("|\t\t- Name: %s\n",
dataArray.get(x).getName());
System.out.format("|\t\t- Time: %s\n",
dataArray.get(x).getTime());
}
description = nliResult.getDescObject().getReplyAnswer();
}
// ********************************************************************
// * POEM EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 我要听长恨歌
// * Traditional Chinese (Taiwan): 我要聽長恨歌
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS poem data.
// * And also check 'the TYPE OF DescObject' if it is a SELECTION mode
// * or CONFIRMATION mode.
if (nliResult.getType().equals(IDSResult.Types.POEM.getName())
|| nliResult.getDescObject().getType().equals(IDSResult.Types.POEM.getName())) {
// Get all of PoemData into ArrayList.
ArrayList<PoemData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS Poem Data[%s] :\n", x);
System.out.format("|\t\t- Author: %s\n",
dataArray.get(x).getAuthor());
System.out.format("|\t\t- Name: %s\n",
dataArray.get(x).getPoemName());
System.out.format("|\t\t- Title: %s\n",
dataArray.get(x).getTitle());
System.out.format("|\t\t- Content: %s\n",
dataArray.get(x).getContent());
description = dataArray.get(x).getContent();
}
}
// ********************************************************************
// * JOKE/STORY EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China) 1: 讲个笑话
// * Simplified Chinese (China) 2: 讲个故事
// * Traditional Chinese (Taiwan) 1: 講個笑話
// * Traditional Chinese (Taiwan) 2: 講個故事
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS joke data.
if (nliResult.getType().equals(IDSResult.Types.JOKE.getName())) {
// Extended fields for this module:
System.out.format("|\t- /////////////////////////////////////\n");
// Try to get Joke/Story name from the DescObject.
// And also check 'the TYPE OF DescObject' to get content type.
if (nliResult.getDescObject().hasName()) {
System.out.format("|\t- %s-name: %s\n",
nliResult.getDescObject().getType(),
nliResult.getDescObject().getName());
}
System.out.format("|\t- /////////////////////////////////////\n");
// Get all of JokeData into ArrayList.
ArrayList<JokeData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS %s Data[%s] :\n",
nliResult.getDescObject().getType(), x);
System.out.format("|\t\t- Content: %s\n",
dataArray.get(x).getContent());
description = dataArray.get(x).getContent();
}
}
// ********************************************************************
// * STOCK MARKET EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 中国石油的股票
// * Traditional Chinese (Taiwan): 台積電的股票
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS stock market data.
// * And also check 'the TYPE OF DescObject' if it is a QUESTION mode.
if (nliResult.getType().equals(IDSResult.Types.STOCK_MARKET.getName())
|| nliResult.getDescObject().getType().equals(IDSResult.Types.STOCK_MARKET.getName())) {
// Get all of StockMarketData into ArrayList.
ArrayList<StockMarketData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS Stock Market Data[%s] :\n", x);
System.out.format("|\t\t- History: %s\n",
dataArray.get(x).isHistory() ? "YES" : "NO");
System.out.format("|\t\t- Stock: %s\n",
dataArray.get(x).getID());
System.out.format("|\t\t- Name: %s\n",
dataArray.get(x).getName());
System.out.format("|\t\t- Current Price: %s\n",
dataArray.get(x).getCurrentPrice());
System.out.format("|\t\t- Opening Price: %s\n",
dataArray.get(x).getOpeningPrice());
System.out.format("|\t\t- Closing Price: %s\n",
dataArray.get(x).getClosingPrice());
System.out.format("|\t\t- Highest Price: %s\n",
dataArray.get(x).getHighestPrice());
System.out.format("|\t\t- Lowest Price: %s\n",
dataArray.get(x).getLowestPrice());
System.out.format("|\t\t- Change Rate: %s\n",
dataArray.get(x).getChangeRate());
System.out.format("|\t\t- Change Amount: %s\n",
dataArray.get(x).getChangeAmount());
System.out.format("|\t\t- Volume: %s\n",
dataArray.get(x).getVolume());
System.out.format("|\t\t- Amount: %s\n",
dataArray.get(x).getAmount());
System.out.format("|\t\t- Intent Info.: %s\n",
dataArray.get(x).getIntentInfo());
System.out.format("|\t\t- Time: %s\n",
dataArray.get(x).getTime());
System.out.format("|\t\t- Favorite: %s\n",
dataArray.get(x).isFavorite() ? "YES" : "NO");
description = nliResult.getDescObject().getReplyAnswer();
}
}
// ********************************************************************
// * MATH EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 2乘4等于几
// * Traditional Chinese (Taiwan): 2乘4等於幾
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS math data.
if (nliResult.getType().equals(IDSResult.Types.MATH.getName())) {
// Get all of MathData into ArrayList.
ArrayList<MathData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS Math Data[%s] :\n", x);
System.out.format("|\t\t- Reply: %s\n",
dataArray.get(x).getContent());
System.out.format("|\t\t- Result: %s\n",
dataArray.get(x).getResult());
description = dataArray.get(x).getContent();
}
}
// ********************************************************************
// * UNIT CONVERT EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 0.2千米是多少米
// * Traditional Chinese (Taiwan): 0.2公尺是多少公分
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS unit convert data.
if (nliResult.getType().equals(IDSResult.Types.UNIT_CONVERT.getName())) {
// Get all of UnitConvertData into ArrayList.
ArrayList<UnitConvertData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS Unit Convert Data[%s] :\n", x);
System.out.format("|\t\t- Reply: %s\n",
dataArray.get(x).getContent());
System.out.format("|\t\t- From: %s %s\n",
dataArray.get(x).getSourceValue(),
dataArray.get(x).getSourceUnit());
System.out.format("|\t\t- Convert To: %s %s\n",
dataArray.get(x).getDestinationValue(),
dataArray.get(x).getDestinationUnit());
description = dataArray.get(x).getContent();
}
}
// ********************************************************************
// * EXCHANGE RATE EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 美元汇率
// * Traditional Chinese (Taiwan): 美元匯率
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS exchange rate data.
if (nliResult.getType().equals(IDSResult.Types.EXCHANGE_RATE.getName())) {
// Extended fields for this module:
System.out.format("|\t- /////////////////////////////////////\n");
// Try to get source currency from the DescObject.
if (nliResult.getDescObject().hasSourceCurrency()) {
System.out.format("|\t- Source Currency: %s\n",
nliResult.getDescObject().getSourceCurrency());
}
System.out.format("|\t- /////////////////////////////////////\n");
// Get all of ExchangeRateData into ArrayList.
ArrayList<ExchangeRateData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS Exchange Rate Data[%s] :\n", x);
System.out.format("|\t\t- Target: %s\n",
dataArray.get(x).getTargetCurrency());
}
description = nliResult.getDescObject().getReplyAnswer();
}
// ********************************************************************
// * COOKING EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 红烧肉怎么做
// * Traditional Chinese (Taiwan): 紅燒肉怎麼做
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS cooking data.
// * And also check 'the TYPE OF DescObject' if it is a SELECTION mode.
if (nliResult.getType().equals(IDSResult.Types.COOKING.getName())
|| nliResult.getDescObject().getType().equals(IDSResult.Types.COOKING.getName())) {
// Get all of CookingData into ArrayList.
ArrayList<CookingData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
System.out.format("|\t- IDS Cooking Data[%s] :\n", x);
System.out.format("|\t\t- Name: %s\n",
dataArray.get(x).getName());
System.out.format("|\t\t- Content: %s\n",
dataArray.get(x).getContent());
description = dataArray.get(x).getContent();
}
}
// ********************************************************************
// * OPEN WEB EXAMPLE
// *-------------------------------------------------------------------
// * Simplified Chinese (China): 我要买手机
// * Traditional Chinese (Taiwan): 我要買手機
// ********************************************************************
// * Check 'the TYPE of nliResult' if contains IDS open-web data.
// * And also check 'the TYPE OF DescObject' if it is a SELECTION mode.
if (nliResult.getType().equals(IDSResult.Types.OPEN_WEB.getName())) {
// Get all of OpenWebData into ArrayList.
ArrayList<OpenWebData> dataArray = nliResult.getDataObjects();
for (int x = 0; x < dataArray.size(); x++) {
// And also check 'the TYPE OF DescObject' to get action type.
System.out.format("|\t- IDS Open Web for %s Data[%s] :\n",
nliResult.getDescObject().getType(), x);
System.out.format("|\t\t- URL: %s\n",
dataArray.get(x).getURL());
}
}
System.out.println("|---------------------------------------------- ");
return description;
}
} | [
"[email protected]"
] | |
c97e3084a340135e5b9dce7ce67260b7068e513e | 347e9db4dd39f56af7c53b7b25b4bc805550fa55 | /WebApplication1/src/java/Servlet/SignupServlet.java | 96eb5554bee79626d53b35778cde2ba6e5aa1a14 | [] | no_license | ataichi/w3w | 7b3b519de1bedb09142b7cc11cf8a22ed8d9b3b4 | 0965d90e53e2ea6b5be3d7a1f0c01c0b8358d27f | refs/heads/master | 2021-01-20T03:37:05.072354 | 2014-11-16T11:04:42 | 2014-11-16T11:04:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,575 | java | package Servlet;
import Beans.AccountBean;
import Beans.CustomerBean;
import DAO.Implementation.AccountDAOImplementation;
import DAO.Implementation.CustomerDAOImplementation;
import DAO.Interface.AccountDAOInterface;
import DAO.Interface.CustomerDAOInterface;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@WebServlet(name = "SignupServlet", urlPatterns = {"/SignupServlet"})
public class SignupServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
HttpSession session = request.getSession();
AccountBean account = new AccountBean();
CustomerBean customer = new CustomerBean();
AccountDAOInterface userdao = new AccountDAOImplementation();
CustomerDAOInterface customerdao = new CustomerDAOImplementation();
boolean checkAccount, checkCustomer;
boolean locked=false;
String firstname = request.getParameter("fname");
String lastname = request.getParameter("lname");
String mInitial = request.getParameter("mname");
String email = request.getParameter("email");
String username = request.getParameter("uname");
String pass1 = request.getParameter("pass1");
account.setFirstName(firstname);
account.setLastName(lastname);
account.setMiddleInitial(mInitial);
account.setPassword(pass1);
account.setEmailAdd(email);
account.setUsername(username);
account.setAccountType("customer");
account.setLocked(locked);
checkAccount = userdao.addAccount(account);
String apartmentnoBA = request.getParameter("apartmentnoBA");
String streetBA = request.getParameter("streetBA");
String subdivisionBA = request.getParameter("subdivisionBA");
String cityBA = request.getParameter("cityBA");
int postalcodeBA = Integer.valueOf(request.getParameter("postalcodeBA"));
String countryBA = request.getParameter("countryBA");
String apartmentnoDA = request.getParameter("apartmentnoDA");
String streetDA = request.getParameter("streetDA");
String subdivisionDA = request.getParameter("subdivisionDA");
String cityDA = request.getParameter("cityDA");
int postalcodeDA = Integer.valueOf(request.getParameter("postalcodeDA"));
String countryDA = request.getParameter("countryDA");
int customer_accountID = userdao.getUserByUsername(username).getAccountID();
customer.setApartmentNoBA(apartmentnoBA);
customer.setApartmentNoDA(apartmentnoDA);
customer.setCityBA(cityBA);
customer.setCityDA(cityDA);
customer.setCountryBA(countryBA);
customer.setCountryDA(countryDA);
customer.setCustomer_accountID(customer_accountID);
customer.setPostalCodeBA(postalcodeBA);
customer.setPostalCodeDA(postalcodeDA);
customer.setStreetBA(streetBA);
customer.setStreetDA(streetDA);
customer.setSubdivisionBA(subdivisionBA);
customer.setSubdivisionDA(subdivisionDA);
checkCustomer = customerdao.addCustomer(customer);
if(checkAccount && checkCustomer){
// out.println("HI");
response.sendRedirect("home.html");
}
else{
// out.println("NO");
response.sendRedirect("loginfail.jsp");
}
} finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
4f6bfe7976d955c773db68aaff126aa5e5b3a2eb | d57c93c33885247ed882ced2843ed4c9742ab9c6 | /trailOfSpace/src/byui/cit260/trailOfSpace/control/MapControl.java | 5a15c76cced590bd2f41df8e11ba13584e56b112 | [] | no_license | Landonfw/CIT_260_GAME | a7a8e553239570ddcdafd7282540b7e9ad462ffe | 21360b16b998cb10a4d78b49c27ecb7eed0db842 | refs/heads/master | 2021-01-10T16:54:43.425591 | 2015-11-22T06:59:57 | 2015-11-22T06:59:57 | 46,103,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package byui.cit260.trailOfSpace.control;
/**
*
* @author animejedifreak
*/
public class MapControl {
public void move(int shipPosition) {
}
public boolean validLocation(String characterLocation, String position) {
boolean isValid = false;
return isValid;
}
public boolean visitInhabitableLocation(String characterLocation) {
boolean isValid = false;
return isValid;
}
public boolean visitItemLocation(String characterLocation) {
boolean isValid = false;
return isValid;
}
public boolean visitEnemyLocation(String characterLocation) {
boolean isValid = false;
return isValid;
}
public boolean visitMathLocation(String characterLocation) {
boolean isValid = false;
return isValid;
}
}
| [
"[email protected]"
] | |
1466f40a3337e3af16b9ba6b657d4ff64f06d24b | 5ccbd9dd1cf90207d160ff44f75c2655bed78fef | /Unit3-Linklist/src/Solution.java | aee88bee7a149123e075ffd14560fedd622e2333 | [] | no_license | b9zhengaoxing/Data-Structure | 38047413100ed4ec4fe8fb00082bf7ab8a48fc4e | 9b5950824450c3966e52c866577bbf42048024f6 | refs/heads/master | 2023-03-04T08:35:46.682157 | 2023-02-07T02:13:16 | 2023-02-10T01:24:52 | 197,175,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | public class Solution {
public ListNode removeElements(ListNode head, int val) {
if (head == null) return head;
if (head.val == val) {
head = this.removeElements(head.next, val);
} else {
head.next = this.removeElements(head.next, val);
}
return head;
}
public static void main(String[] args) {
int[] a = {1,2,3,4,5,6,7};
ListNode node = new ListNode(a);
Solution solution = new Solution();
ListNode res = solution.removeElements(node,2);
System.out.println(res);
}
}
| [
"[email protected]"
] | |
bc2e04caa9fe29e98a067ab5d45d3a4021614565 | 4dd413d3652def76b322be4fbd54f7566c3f9009 | /test/org/springframework/aop/support/ClassFiltersTests.java | 3fb36493e448ffcdf6fe03786c122b8602d27758 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | aristotle0x01/spring-framework-1.0 | 57ba9fb4571ae767d5e037bda317f0af636467de | 10839c81f4bb2265d968a03cc8a6f58f1c7d7b30 | refs/heads/master | 2022-07-11T21:39:19.231388 | 2020-03-17T09:44:21 | 2020-03-17T09:44:21 | 209,035,884 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 2,340 | java |
/*
* Copyright 2002-2004 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.support;
import junit.framework.TestCase;
import org.springframework.aop.ClassFilter;
import org.springframework.beans.ITestBean;
import org.springframework.beans.TestBean;
import org.springframework.core.NestedRuntimeException;
/**
* @author Rod Johnson
* @version $Id: ClassFiltersTests.java,v 1.4 2004/03/18 03:01:17 trisberg Exp $
*/
public class ClassFiltersTests extends TestCase {
ClassFilter exceptionFilter = new RootClassFilter(Exception.class);
ClassFilter itbFilter = new RootClassFilter(ITestBean.class);
ClassFilter hasRootCauseFilter = new RootClassFilter(NestedRuntimeException.class);
/**
* Constructor for ClassFiltersTests.
* @param arg0
*/
public ClassFiltersTests(String arg0) {
super(arg0);
}
public void testUnion() {
assertTrue(exceptionFilter.matches(RuntimeException.class));
assertFalse(exceptionFilter.matches(TestBean.class));
assertFalse(itbFilter.matches(Exception.class));
assertTrue(itbFilter.matches(TestBean.class));
ClassFilter union = ClassFilters.union(exceptionFilter, itbFilter);
assertTrue(union.matches(RuntimeException.class));
assertTrue(union.matches(TestBean.class));
}
public void testIntersection() {
assertTrue(exceptionFilter.matches(RuntimeException.class));
assertTrue(hasRootCauseFilter.matches(NestedRuntimeException.class));
ClassFilter intersection = ClassFilters.intersection(exceptionFilter, hasRootCauseFilter);
assertFalse(intersection.matches(RuntimeException.class));
assertFalse(intersection.matches(TestBean.class));
assertTrue(intersection.matches(NestedRuntimeException.class));
}
}
| [
"[email protected]"
] | |
64fdc52f0a6bb322c21a97e3b7d72007a5696b02 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/20/20_54f7792ce57e2a17720698b18c240af89647b70b/TestApplicationDescriptorParser/20_54f7792ce57e2a17720698b18c240af89647b70b_TestApplicationDescriptorParser_s.java | ed4ce5bfef5ffb4b3cf3ae451f8f46f50467f8c9 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 7,747 | java | /*
* ################################################################
*
* ProActive: The Java(TM) library for Parallel, Distributed,
* Concurrent computing with Security and Mobility
*
* Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
* Contact: [email protected]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): The ProActive Team
* http://proactive.inria.fr/team_members.htm
* Contributor(s):
*
* ################################################################
*/
package unitTests.gcmdeployment.descriptorParser;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import org.junit.Assert;
import org.junit.Test;
import org.objectweb.proactive.core.ProActiveException;
import org.objectweb.proactive.extra.gcmdeployment.GCMApplication.GCMApplicationDescriptorImpl;
import org.objectweb.proactive.extra.gcmdeployment.GCMApplication.GCMApplicationParser;
import org.objectweb.proactive.extra.gcmdeployment.GCMApplication.GCMApplicationParserImpl;
import org.objectweb.proactive.extra.gcmdeployment.GCMApplication.TechnicalServicesProperties;
import org.objectweb.proactive.extra.gcmdeployment.GCMApplication.commandbuilder.AbstractApplicationParser;
import org.objectweb.proactive.extra.gcmdeployment.GCMApplication.commandbuilder.CommandBuilder;
import org.objectweb.proactive.extra.gcmdeployment.GCMApplication.commandbuilder.CommandBuilderScript;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
public class TestApplicationDescriptorParser {
final static String TEST_APP_DIR = TestApplicationDescriptorParser.class.getClass().getResource(
"/unitTests/gcmdeployment/descriptorParser/testfiles/application").getFile();
final static String[] skipDescriptors = { "script_ext.xml", "oldDescriptor.xml", "scriptInvalid.xml" };
@Test
public void test() throws IOException, XPathExpressionException, SAXException,
ParserConfigurationException, TransformerException {
descloop: for (File descriptor : getApplicationDescriptors()) {
for (String skipIt : skipDescriptors) {
if (descriptor.toString().contains(skipIt))
continue descloop;
}
System.out.println("parsing " + descriptor.getCanonicalPath());
GCMApplicationParserImpl parser = new GCMApplicationParserImpl(descriptor, null);
parser.getCommandBuilder();
parser.getVirtualNodes();
parser.getNodeProviders();
}
}
/**
* User application node parser used to demonstrate how to install custom app parsers
* @author glaurent
*
*/
protected static class UserApplicationNodeParser extends AbstractApplicationParser {
@Override
protected CommandBuilder createCommandBuilder() {
return new CommandBuilderScript();
}
public String getNodeName() {
return "paext:myapplication";
}
@Override
public void parseApplicationNode(Node paNode, GCMApplicationParser applicationParser, XPath xpath)
throws XPathExpressionException, SAXException, IOException {
super.parseApplicationNode(paNode, applicationParser, xpath);
System.out.println("User Application Parser - someattr value = " +
paNode.getAttributes().getNamedItem("someattr").getNodeValue());
}
@Override
public TechnicalServicesProperties getTechnicalServicesProperties() {
// TODO Auto-generated method stub
return null;
}
}
// @Test
public void userSchemaTest() throws IOException, XPathExpressionException, SAXException,
ParserConfigurationException, TransformerException {
for (File file : getApplicationDescriptors()) {
if (!file.toString().contains("script_ext")) {
continue;
}
System.out.println(file);
URL userSchema = getClass()
.getResource(
"/unitTests/gcmdeployment/descriptorParser/testfiles/application/SampleApplicationExtension.xsd");
ArrayList<String> schemas = new ArrayList<String>();
schemas.add(userSchema.toString());
GCMApplicationParserImpl parser = new GCMApplicationParserImpl(file, null, schemas);
parser.registerApplicationParser(new UserApplicationNodeParser());
parser.getCommandBuilder();
parser.getVirtualNodes();
parser.getNodeProviders();
}
}
// @Test
public void doit() throws ProActiveException, FileNotFoundException {
for (File file : getApplicationDescriptors()) {
if (!file.toString().contains("scriptHostname") || file.toString().contains("Invalid") ||
file.toString().contains("oldDesc")) {
continue;
}
System.out.println(file);
new GCMApplicationDescriptorImpl(file);
}
}
private List<File> getApplicationDescriptors() {
List<File> ret = new ArrayList<File>();
File dir = new File(TEST_APP_DIR);
for (String file : dir.list()) {
if (file.endsWith(".xml")) {
ret.add(new File(dir, file));
}
}
return ret;
}
@Test(expected = SAXException.class)
public void validationTest() throws XPathExpressionException, TransformerException,
ParserConfigurationException, SAXException {
validationGenericTest("/unitTests/gcmdeployment/descriptorParser/testfiles/application/scriptInvalid.xml");
}
@Test(expected = SAXException.class)
public void validationOldSchemaTest() throws XPathExpressionException, TransformerException,
ParserConfigurationException, SAXException {
validationGenericTest("/unitTests/gcmdeployment/descriptorParser/testfiles/application/oldDescriptor.xml");
}
protected void validationGenericTest(String desc) throws XPathExpressionException, TransformerException,
ParserConfigurationException, SAXException {
File descriptor = new File(this.getClass().getResource(desc).getFile());
System.out.println("Parsing " + descriptor.getAbsolutePath());
try {
GCMApplicationParserImpl parser = new GCMApplicationParserImpl(descriptor, null);
} catch (IOException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
}
| [
"[email protected]"
] | |
5fbe1968cf1d04abac5bc3ea970ade3a14387cad | aa1a8961ceb9c5a366b2efa776d029a4631a0b64 | /src/com/huidian/day4/demo02/Dog2Ha.java | 345e9c6f7a7992cf28ec9039675eee399171da93 | [] | no_license | lingweiov/java1 | 7e62305808be7a5ae0b6700217b30a4f9508feb8 | 5800955cd297215e5e17055c440b919df9be6a3f | refs/heads/master | 2020-09-13T18:38:59.453987 | 2019-12-09T13:15:36 | 2019-12-09T13:15:37 | 222,870,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.huidian.day4.demo02;/*
@outhor shkstart
@date 2019/11/23-10:29
*/
public class Dog2Ha extends Dog{
@Override
public void sleep() {
System.out.println("二哈睡觉");
}
}
| [
"[email protected]"
] | |
d11c0d831c37b8ccdb38be5904bb9a3b013e96da | a33dedebbcccb675dbc0befd428574658d7a577c | /limits-service/src/main/java/com/services/micro/limitsservice/config/LimitsConfiguration.java | fdb9cb6b45a6d40079657b0113f4df2bd255fed1 | [] | no_license | anujsawhney/webservices | f01758613d0f4314f7a3e93e44dfef326559161f | e5400dbd414ef140b501d5a79720bec6a4dbb67e | refs/heads/master | 2021-01-30T15:55:33.216596 | 2020-02-29T04:48:53 | 2020-02-29T04:48:53 | 243,502,957 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package com.services.micro.limitsservice.config;
import org.springframework.stereotype.Component;
@Component
public class LimitsConfiguration {
private int minimium;
private int maximum;
public LimitsConfiguration() {
super();
}
public LimitsConfiguration(int minimium, int maximum) {
super();
this.minimium = minimium;
this.maximum = maximum;
}
public int getMinimium() {
return minimium;
}
public void setMinimium(int minimium) {
this.minimium = minimium;
}
public int getMaximum() {
return maximum;
}
public void setMaximum(int maximum) {
this.maximum = maximum;
}
}
| [
"[email protected]"
] | |
0b967b9657e289d49c14a9b6ab6aab6e0904364c | 4c4ae435db4175f209440b3b4f7d46fa98676b07 | /open-metadata-implementation/access-services/digital-architecture/digital-architecture-server/src/main/java/org/odpi/openmetadata/accessservices/digitalarchitecture/converters/ReferenceDataAssetConverter.java | b0f88e81788a9a2f3a04161ed65871ee81447379 | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | danielaotelea/egeria | 20536336efd2f6ab22d188673a02e4a4dc2490c1 | 1c50ffda7404820203b4e4422e2c8a7829030f43 | refs/heads/master | 2023-01-25T01:40:00.002563 | 2020-10-21T11:33:29 | 2020-10-21T11:33:29 | 206,025,967 | 1 | 0 | Apache-2.0 | 2023-01-23T06:12:10 | 2019-09-03T08:19:58 | Java | UTF-8 | Java | false | false | 11,256 | java | /* SPDX-License-Identifier: Apache 2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.digitalarchitecture.converters;
import org.odpi.openmetadata.accessservices.digitalarchitecture.metadataelements.ReferenceDataAssetElement;
import org.odpi.openmetadata.accessservices.digitalarchitecture.properties.OwnerCategory;
import org.odpi.openmetadata.accessservices.digitalarchitecture.properties.ReferenceDataAssetProperties;
import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper;
import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper;
import java.util.Map;
/**
* ReferenceDataAssetConverter provides common methods for transferring relevant properties from an Open Metadata Repository Services (OMRS)
* EntityDetail object into a bean that inherits from AssetProperties.
*/
public class ReferenceDataAssetConverter<B> extends DigitalArchitectureOMASConverter<B>
{
/**
* Constructor
*
* @param repositoryHelper helper object to parse entity
* @param serviceName name of this component
* @param serverName local server name
*/
public ReferenceDataAssetConverter(OMRSRepositoryHelper repositoryHelper,
String serviceName,
String serverName)
{
super(repositoryHelper, serviceName, serverName);
}
/**
* Using the supplied instances, return a new instance of the bean. This is used for beans that have
* contain a combination of the properties from an entity and a that os a connected relationship.
*
* @param beanClass name of the class to create
* @param entity entity containing the properties
* @param relationship relationship containing the properties
* @param methodName calling method
* @return bean populated with properties from the instances supplied
* @throws PropertyServerException there is a problem instantiating the bean
*/
public B getNewBean(Class<B> beanClass,
EntityDetail entity,
Relationship relationship,
String methodName) throws PropertyServerException
{
try
{
/*
* This is initial confirmation that the generic converter has been initialized with an appropriate bean class.
*/
B returnBean = beanClass.newInstance();
if (returnBean instanceof ReferenceDataAssetElement)
{
ReferenceDataAssetElement bean = (ReferenceDataAssetElement) returnBean;
this.updateSimpleMetadataElement(beanClass, bean, entity, methodName);
}
return returnBean;
}
catch (IllegalAccessException | InstantiationException | ClassCastException error)
{
super.handleInvalidBeanClass(beanClass.getName(), error, methodName);
}
return null;
}
/**
* Using the supplied instances, return a new instance of the bean. This is used for beans that have
* contain a combination of the properties from an entity and a that os a connected relationship.
*
* @param beanClass name of the class to create
* @param entity entity containing the properties
* @param methodName calling method
* @return bean populated with properties from the instances supplied
* @throws PropertyServerException there is a problem instantiating the bean
*/
public B getNewBean(Class<B> beanClass,
EntityDetail entity,
String methodName) throws PropertyServerException
{
try
{
/*
* This is initial confirmation that the generic converter has been initialized with an appropriate bean class.
*/
B returnBean = beanClass.newInstance();
if (returnBean instanceof ReferenceDataAssetElement)
{
ReferenceDataAssetElement bean = (ReferenceDataAssetElement) returnBean;
this.updateSimpleMetadataElement(beanClass, bean, entity, methodName);
}
return returnBean;
}
catch (IllegalAccessException | InstantiationException | ClassCastException error)
{
super.handleInvalidBeanClass(beanClass.getName(), error, methodName);
}
return null;
}
/**
* Extract the properties from the entity. Each concrete DataManager OMAS converter implements this method.
* The top level fills in the header
*
* @param beanClass name of the class to create
* @param bean output bean
* @param entity entity containing the properties
* @param methodName calling method
* @throws PropertyServerException there is a problem instantiating the bean
*/
void updateSimpleMetadataElement(Class<B> beanClass,
ReferenceDataAssetElement bean,
EntityDetail entity,
String methodName) throws PropertyServerException
{
if (entity != null)
{
bean.setElementHeader(this.getMetadataElementHeader(beanClass, entity, methodName));
ReferenceDataAssetProperties referenceDataAssetProperties = new ReferenceDataAssetProperties();
/*
* The initial set of values come from the entity.
*/
InstanceProperties instanceProperties = new InstanceProperties(entity.getProperties());
referenceDataAssetProperties.setQualifiedName(this.removeQualifiedName(instanceProperties));
referenceDataAssetProperties.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties));
referenceDataAssetProperties.setDisplayName(this.removeName(instanceProperties));
referenceDataAssetProperties.setDescription(this.removeDescription(instanceProperties));
/* Note this value should be in the classification */
referenceDataAssetProperties.setOwner(this.removeOwner(instanceProperties));
/* Note this value should be in the classification */
referenceDataAssetProperties.setOwnerCategory(this.removeOwnerCategoryFromProperties(instanceProperties));
/* Note this value should be in the classification */
referenceDataAssetProperties.setZoneMembership(this.removeZoneMembership(instanceProperties));
/*
* Any remaining properties are returned in the extended properties. They are
* assumed to be defined in a subtype.
*/
referenceDataAssetProperties.setTypeName(bean.getElementHeader().getType().getTypeName());
referenceDataAssetProperties.setExtendedProperties(this.getRemainingExtendedProperties(instanceProperties));
/*
* The values in the classifications override the values in the main properties of the Asset's entity.
* Having these properties in the main entity is deprecated.
*/
instanceProperties = super.getClassificationProperties(OpenMetadataAPIMapper.ASSET_ZONES_CLASSIFICATION_NAME, entity);
referenceDataAssetProperties.setZoneMembership(this.getZoneMembership(instanceProperties));
instanceProperties = super.getClassificationProperties(OpenMetadataAPIMapper.ASSET_OWNERSHIP_CLASSIFICATION_NAME, entity);
referenceDataAssetProperties.setOwner(this.getOwner(instanceProperties));
referenceDataAssetProperties.setOwnerCategory(this.getOwnerCategoryFromProperties(instanceProperties));
instanceProperties = super.getClassificationProperties(OpenMetadataAPIMapper.ASSET_ORIGIN_CLASSIFICATION_NAME, entity);
referenceDataAssetProperties.setOriginOrganizationGUID(this.getOriginOrganizationGUID(instanceProperties));
referenceDataAssetProperties.setOriginBusinessCapabilityGUID(this.getOriginBusinessCapabilityGUID(instanceProperties));
referenceDataAssetProperties.setOtherOriginValues(this.getOtherOriginValues(instanceProperties));
bean.setReferenceDataAssetProperties(referenceDataAssetProperties);
}
else
{
handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName);
}
}
/**
* Retrieve and delete the OwnerCategory enum property from the instance properties of an entity
*
* @param properties entity properties
* @return OwnerType enum value
*/
private OwnerCategory removeOwnerCategoryFromProperties(InstanceProperties properties)
{
OwnerCategory ownerCategory = this.getOwnerCategoryFromProperties(properties);
if (properties != null)
{
Map<String, InstancePropertyValue> instancePropertiesMap = properties.getInstanceProperties();
if (instancePropertiesMap != null)
{
instancePropertiesMap.remove(OpenMetadataAPIMapper.OWNER_TYPE_PROPERTY_NAME);
}
properties.setInstanceProperties(instancePropertiesMap);
}
return ownerCategory;
}
/**
* Retrieve the OwnerCategory enum property from the instance properties of a classification
*
* @param properties entity properties
* @return OwnerType enum value
*/
private OwnerCategory getOwnerCategoryFromProperties(InstanceProperties properties)
{
OwnerCategory ownerCategory = OwnerCategory.OTHER;
if (properties != null)
{
Map<String, InstancePropertyValue> instancePropertiesMap = properties.getInstanceProperties();
if (instancePropertiesMap != null)
{
InstancePropertyValue instancePropertyValue = instancePropertiesMap.get(OpenMetadataAPIMapper.OWNER_TYPE_PROPERTY_NAME);
if (instancePropertyValue instanceof EnumPropertyValue)
{
EnumPropertyValue enumPropertyValue = (EnumPropertyValue) instancePropertyValue;
switch (enumPropertyValue.getOrdinal())
{
case 0:
ownerCategory = OwnerCategory.USER_ID;
break;
case 1:
ownerCategory = OwnerCategory.PROFILE_ID;
break;
case 99:
ownerCategory = OwnerCategory.OTHER;
break;
}
}
}
}
return ownerCategory;
}
}
| [
"[email protected]"
] | |
bafe0d0bcc20413a979ed66010000dd7c470bff7 | 2bc2eadc9b0f70d6d1286ef474902466988a880f | /tags/mule-1.4.0/core/src/main/java/org/mule/util/PropertiesUtils.java | 1b71e732dab5fac068ee62f492527e4118f21f4e | [] | no_license | OrgSmells/codehaus-mule-git | 085434a4b7781a5def2b9b4e37396081eaeba394 | f8584627c7acb13efdf3276396015439ea6a0721 | refs/heads/master | 2022-12-24T07:33:30.190368 | 2020-02-27T19:10:29 | 2020-02-27T19:10:29 | 243,593,543 | 0 | 0 | null | 2022-12-15T23:30:00 | 2020-02-27T18:56:48 | null | UTF-8 | Java | false | false | 7,592 | java | /*
* $Id$
* --------------------------------------------------------------------------------------
* Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
*
* The software in this package is published under the terms of the MuleSource MPL
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/
package org.mule.util;
import org.mule.config.i18n.Message;
import org.mule.config.i18n.Messages;
import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
/**
* <code>PropertiesHelper</code> is a utility class for manipulating and filtering
* property Maps.
*/
// @ThreadSafe
public final class PropertiesUtils
{
// @GuardedBy(itself)
private static final List maskedProperties = new CopyOnWriteArrayList();
static
{
// When printing property lists mask password fields
// Users can register their own fields to mask
registerMaskedPropertyName("password");
}
/** Do not instanciate. */
protected PropertiesUtils ()
{
// no-op
}
/**
* Register a property name for masking. This will prevent certain values from
* leaking e.g. into debugging output or logfiles.
*
* @param name the key of the property to be masked.
* @throws IllegalArgumentException is name is null or empty.
*/
public static void registerMaskedPropertyName(String name)
{
if (StringUtils.isNotEmpty(name))
{
maskedProperties.add(name);
}
else
{
throw new IllegalArgumentException("Cannot mask empty property name.");
}
}
/**
* Returns the String representation of the property value or a masked String if
* the property key has been registered previously via
* {@link #registerMaskedPropertyName(String)}.
*
* @param property a key/value pair
* @return String of the property value or a "masked" String that hides the
* contents, or <code>null</code> if the property, its key or its value
* is <code>null</code>.
*/
public static String maskedPropertyValue(Map.Entry property)
{
if (property == null)
{
return null;
}
Object key = property.getKey();
Object value = property.getValue();
if (key == null || value == null)
{
return null;
}
if (maskedProperties.contains(key))
{
return ("*****");
}
else
{
return value.toString();
}
}
/**
* Read in the properties from a properties file. The file may be on the file
* system or the classpath.
*
* @param fileName - The name of the properties file
* @param callingClass - The Class which is calling this method. This is used to
* determine the classpath.
* @return a java.util.Properties object containing the properties.
*/
public static synchronized Properties loadProperties(String fileName, final Class callingClass)
throws IOException
{
InputStream is = IOUtils.getResourceAsStream(fileName, callingClass,
/* tryAsFile */true, /* tryAsUrl */false);
if (is == null)
{
Message error = new Message(Messages.CANT_LOAD_X_FROM_CLASSPATH_FILE, fileName);
throw new IOException(error.toString());
}
try
{
Properties props = new Properties();
props.load(is);
return props;
}
finally
{
is.close();
}
}
public static String removeXmlNamespacePrefix(String eleName)
{
int i = eleName.indexOf(':');
return (i == -1 ? eleName : eleName.substring(i + 1, eleName.length()));
}
public static String removeNamespacePrefix(String eleName)
{
int i = eleName.lastIndexOf('.');
return (i == -1 ? eleName : eleName.substring(i + 1, eleName.length()));
}
public static Map removeNamespaces(Map properties)
{
HashMap props = new HashMap(properties.size());
Map.Entry entry;
for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();)
{
entry = (Map.Entry) iter.next();
props.put(removeNamespacePrefix((String) entry.getKey()), entry.getValue());
}
return props;
}
/**
* Will create a map of properties where the names have a prefix Allows the
* callee to supply the target map so a comarator can be set
*
* @param props the source set of properties
* @param prefix the prefix to filter on
* @param newProps return map containing the filtered list of properties or an
* empty map if no properties matched the prefix
*/
public static void getPropertiesWithPrefix(Map props, String prefix, Map newProps)
{
for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();)
{
Map.Entry entry = (Map.Entry) iterator.next();
Object key = entry.getKey();
if (key.toString().startsWith(prefix))
{
newProps.put(key, entry.getValue());
}
}
}
public static Map getPropertiesWithoutPrefix(Map props, String prefix)
{
Map newProps = new HashMap();
for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();)
{
Map.Entry entry = (Map.Entry) iterator.next();
Object key = entry.getKey();
if (!key.toString().startsWith(prefix))
{
newProps.put(key, entry.getValue());
}
}
return newProps;
}
public static Properties getPropertiesFromQueryString(String query)
{
Properties props = new Properties();
if (query == null)
{
return props;
}
query = new StringBuffer(query.length() + 1).append('&').append(query).toString();
int x = 0;
while ((x = addProperty(query, x, props)) != -1)
{
// run
}
return props;
}
private static int addProperty(String query, int start, Properties properties)
{
int i = query.indexOf('&', start);
int i2 = query.indexOf('&', i + 1);
String pair;
if (i > -1 && i2 > -1)
{
pair = query.substring(i + 1, i2);
}
else if (i > -1)
{
pair = query.substring(i + 1);
}
else
{
return -1;
}
int eq = pair.indexOf('=');
if (eq <= 0)
{
String key = pair;
String value = StringUtils.EMPTY;
properties.setProperty(key, value);
}
else
{
String key = pair.substring(0, eq);
String value = (eq == pair.length() ? StringUtils.EMPTY : pair.substring(eq + 1));
properties.setProperty(key, value);
}
return i2;
}
/**
* @deprecated Use {@link MapUtils#toString(Map, boolean)} instead
*/
public static String propertiesToString(Map props, boolean newline)
{
return MapUtils.toString(props, newline);
}
}
| [
"dirk.olmes@bf997673-6b11-0410-b953-e057580c5b09"
] | dirk.olmes@bf997673-6b11-0410-b953-e057580c5b09 |
13152b80853abf4b3bf13a16ee052848e794d873 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /P9-8.0/src/main/java/com/huawei/android/view/LayoutParamsEx.java | ba72c2e2ff65a2350dcac258228960f0f7d2a12d | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package com.huawei.android.view;
import android.view.AbsLayoutParams;
import android.view.WindowManager.LayoutParams;
public class LayoutParamsEx extends AbsLayoutParams {
public static final int FLAG_MMI_TEST_DEFAULT_SHAPE = 16384;
public static final int FLAG_NOTCH_SUPPORT = 65536;
public static final int FLAG_SECURE_SCREENCAP = 8192;
public static final int FLAG_SECURE_SCREENSHOT = 4096;
LayoutParams attrs;
public LayoutParamsEx(LayoutParams lp) {
this.attrs = lp;
}
public int getHwFlags() {
return this.attrs.hwFlags;
}
public void addHwFlags(int hwFlags) {
setHwFlags(hwFlags, hwFlags);
}
public void clearHwFlags(int hwFlags) {
setHwFlags(0, hwFlags);
}
private void setHwFlags(int hwFlags, int mask) {
this.attrs.hwFlags = (this.attrs.hwFlags & (~mask)) | (hwFlags & mask);
}
}
| [
"[email protected]"
] | |
50a2494a320e06e047adb2571e35e4763a1e5883 | 3ef55e152decb43bdd90e3de821ffea1a2ec8f75 | /large/module0418_public/src/java/module0418_public/a/Foo3.java | 107705ba558acff727f7dfd70c6044c718ae5e88 | [
"BSD-3-Clause"
] | permissive | salesforce/bazel-ls-demo-project | 5cc6ef749d65d6626080f3a94239b6a509ef145a | 948ed278f87338edd7e40af68b8690ae4f73ebf0 | refs/heads/master | 2023-06-24T08:06:06.084651 | 2023-03-14T11:54:29 | 2023-03-14T11:54:29 | 241,489,944 | 0 | 5 | BSD-3-Clause | 2023-03-27T11:28:14 | 2020-02-18T23:30:47 | Java | UTF-8 | Java | false | false | 1,601 | java | package module0418_public.a;
import javax.naming.directory.*;
import javax.net.ssl.*;
import javax.rmi.ssl.*;
/**
* Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
* labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
* Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
*
* @see javax.annotation.processing.Completion
* @see javax.lang.model.AnnotatedConstruct
* @see javax.management.Attribute
*/
@SuppressWarnings("all")
public abstract class Foo3<F> extends module0418_public.a.Foo2<F> implements module0418_public.a.IFoo3<F> {
javax.naming.directory.DirContext f0 = null;
javax.net.ssl.ExtendedSSLSession f1 = null;
javax.rmi.ssl.SslRMIClientSocketFactory f2 = null;
public F element;
public static Foo3 instance;
public static Foo3 getInstance() {
return instance;
}
public static <T> T create(java.util.List<T> input) {
return module0418_public.a.Foo2.create(input);
}
public String getName() {
return module0418_public.a.Foo2.getInstance().getName();
}
public void setName(String string) {
module0418_public.a.Foo2.getInstance().setName(getName());
return;
}
public F get() {
return (F)module0418_public.a.Foo2.getInstance().get();
}
public void set(Object element) {
this.element = (F)element;
module0418_public.a.Foo2.getInstance().set(this.element);
}
public F call() throws Exception {
return (F)module0418_public.a.Foo2.getInstance().call();
}
}
| [
"[email protected]"
] | |
5cf3def63cc1cc22bda1c492ceb3096fadb24b5c | 6e14b46c4f66a1f638794dc85c1987eaa35f3597 | /src/main/java/com/truckshippingsystem/domain/Drivers.java | 55f5cb97dde7782fec8f7b44f72500b3062e5191 | [] | no_license | TanayaDave/SOA | d44045e53997aa9282cf82261960f9eb443b0a3b | 5b9598dd40678f57bcec3e6c04c5ebc1c91650b1 | refs/heads/master | 2021-07-13T06:33:47.017443 | 2017-10-19T05:56:20 | 2017-10-19T05:56:20 | 105,486,667 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,200 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.truckshippingsystem.domain;
/**
*
* @author Manish Vishwakarma
*/
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlType;
@Entity
@Table(name = "driver")
public class Drivers {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private String license;
private String licenseState;
private String driverType;
@ManyToOne
@JoinColumn(name = "truck_id")
private Truck truck;
public Drivers(Long id, String name, String license, Truck truck) {
this.id = id;
this.name = name;
this.license = license;
this.truck = truck;
}
public Drivers(String name, String license) {
this.name = name;
this.license = license;
}
public Drivers() {
}
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 getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
public String getLicenseState() {
return licenseState;
}
public void setLicenseState(String licenseState) {
this.licenseState = licenseState;
}
public String getDriverType() {
return driverType;
}
public void setDriverType(String driverType) {
this.driverType = driverType;
}
public Truck getTruck() {
return truck;
}
public void setTruck(Truck truck) {
this.truck = truck;
}
}
| [
"[email protected]"
] | |
d97b858f45be1c8162eab40f74b46aec4addc9af | e88b6b10653c8f2e89515cfe3e1d5b94fe2409e9 | /src/com/ezenity/oop/interfaces/project/Video.java | 93ffbe2f46c13af4783a085259140c58fc4da4c3 | [
"MIT"
] | permissive | ezenity/UltimateJava | 48d17b1233fc71af1644d16bf6842415e1cd3624 | 52bde2dd3fa1c2a77a3158f2842247af80822075 | refs/heads/master | 2021-02-16T12:15:09.396645 | 2020-03-23T01:05:34 | 2020-03-23T01:05:34 | 245,004,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package com.ezenity.oop.interfaces.project;
public class Video {
private String fileName;
private String title;
private User user;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
| [
"[email protected]"
] | |
d2ea8485e505e2195c54504cf01912ac6374094e | 42ed12696748a102487c2f951832b77740a6b70d | /Mage.Sets/src/mage/sets/eighthedition/ArdentMilitia.java | c2f9be23fabfa9c48ea4f829204fa5455f4bcb62 | [] | no_license | p3trichor/mage | fcb354a8fc791be4713e96e4722617af86bd3865 | 5373076a7e9c2bdabdabc19ffd69a8a567f2188a | refs/heads/master | 2021-01-16T20:21:52.382334 | 2013-05-09T21:13:25 | 2013-05-09T21:13:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,637 | java | /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com 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.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.eighthedition;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
/**
*
* @author North
*/
public class ArdentMilitia extends CardImpl<ArdentMilitia> {
public ArdentMilitia(UUID ownerId) {
super(ownerId, 3, "Ardent Militia", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{W}");
this.expansionSetCode = "8ED";
this.subtype.add("Human");
this.subtype.add("Soldier");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(5);
this.addAbility(VigilanceAbility.getInstance());
}
public ArdentMilitia(final ArdentMilitia card) {
super(card);
}
@Override
public ArdentMilitia copy() {
return new ArdentMilitia(this);
}
}
| [
"robyter@gmail"
] | robyter@gmail |
97d30ef27df8c1a90d191b7d3bd1464d2bbad6bb | d6c041879c662f4882892648fd02e0673a57261c | /com/planet_ink/coffee_mud/Abilities/Skills/Skill_TailSwipe.java | be63cbdcc52a38ca42862db8add9f4ada91b46dd | [
"Apache-2.0"
] | permissive | linuxshout/CoffeeMud | 15a2c09c1635f8b19b0d4e82c9ef8cd59e1233f6 | a418aa8685046b08c6d970083e778efb76fd3716 | refs/heads/master | 2020-04-14T04:17:39.858690 | 2018-12-29T20:50:15 | 2018-12-29T20:50:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,476 | java | package com.planet_ink.coffee_mud.Abilities.Skills;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2016-2018 Bo Zimmerman
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.
*/
public class Skill_TailSwipe extends StdSkill
{
@Override
public String ID()
{
return "Skill_TailSwipe";
}
private final static String localizedName = CMLib.lang().L("Tail Swipe");
@Override
public String name()
{
return localizedName;
}
private static final String[] triggerStrings = I(new String[] { "TAILSWIPE" });
@Override
public int abstractQuality()
{
return Ability.QUALITY_MALICIOUS;
}
@Override
public String[] triggerStrings()
{
return triggerStrings;
}
@Override
protected int canAffectCode()
{
return 0;
}
@Override
protected int canTargetCode()
{
return Ability.CAN_MOBS;
}
@Override
public boolean putInCommandlist()
{
return false;
}
@Override
public int classificationCode()
{
return Ability.ACODE_SKILL | Ability.DOMAIN_RACIALABILITY;
}
@Override
public int usageType()
{
return USAGE_MOVEMENT;
}
@Override
public long flags()
{
return Ability.FLAG_MOVING;
}
protected int enhancement = 0;
protected boolean doneTicking = false;
@Override
public int abilityCode()
{
return enhancement;
}
@Override
public void setAbilityCode(final int newCode)
{
enhancement = newCode;
}
@Override
public void affectPhyStats(final Physical affected, final PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
if(!doneTicking)
affectableStats.setDisposition(affectableStats.disposition()|PhyStats.IS_SITTING);
}
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((doneTicking)&&(msg.amISource(mob)))
unInvoke();
else
if(msg.amISource(mob)&&(msg.sourceMinor()==CMMsg.TYP_STAND))
return false;
return true;
}
@Override
public void unInvoke()
{
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if(canBeUninvoked())
doneTicking=true;
super.unInvoke();
if(canBeUninvoked() && (mob!=null))
{
final Room R=mob.location();
if((R!=null)&&(!mob.amDead()))
{
final CMMsg msg=CMClass.getMsg(mob,null,CMMsg.MSG_NOISYMOVEMENT,L("<S-NAME> regain(s) <S-HIS-HER> feet."));
if(R.okMessage(mob,msg)&&(!mob.amDead()))
{
R.send(mob,msg);
CMLib.commands().postStand(mob,true, false);
}
}
else
mob.tell(L("You regain your feet."));
}
}
@Override
public int castingQuality(final MOB mob, final Physical target)
{
if((mob!=null)&&(target!=null))
{
if(mob.isInCombat()&&(mob.rangeToTarget()>0))
return Ability.QUALITY_INDIFFERENT;
if(mob.charStats().getBodyPart(Race.BODY_TAIL)<=0)
return Ability.QUALITY_INDIFFERENT;
}
return super.castingQuality(mob,target);
}
@Override
public boolean invoke(final MOB mob, final List<String> commands, final Physical givenTarget, final boolean auto, final int asLevel)
{
if(mob.isInCombat()&&(mob.rangeToTarget()>1)&&(!auto))
{
mob.tell(L("You are too far away to tail swipe!"));
return false;
}
if(mob.charStats().getBodyPart(Race.BODY_TAIL)<=0)
{
mob.tell(L("You need a tail to do this."));
return false;
}
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
// now see if it worked
final int chance=(mob.charStats().getStat(CharStats.STAT_STRENGTH)-target.charStats().getStat(CharStats.STAT_DEXTERITY))*2;
final boolean success=proficiencyCheck(mob,chance,auto);
if(success)
{
invoker=mob;
final int topDamage=(adjustedLevel(mob,asLevel)/4)+1;
int damage=CMLib.dice().roll(1,topDamage,0);
final Room R=mob.location();
final CMMsg msg=CMClass.getMsg(mob,target,this,CMMsg.MSK_MALICIOUS_MOVE|CMMsg.TYP_JUSTICE|(auto?CMMsg.MASK_ALWAYS:0),null);
if((R!=null)&&(R.okMessage(mob,msg)))
{
R.send(mob,msg);
if(msg.value()>0)
damage = (int)Math.round(CMath.div(damage,2.0));
CMLib.combat().postDamage(mob,target,this,damage,
CMMsg.MASK_ALWAYS|CMMsg.MASK_SOUND|CMMsg.MASK_MOVE|CMMsg.TYP_JUSTICE,Weapon.TYPE_BASHING,
L("^F^<FIGHT^><S-NAME> <DAMAGE> <T-NAME> with a tail swipe!^</FIGHT^>^?@x1",CMLib.protocol().msp("bashed1.wav",30)));
final int tripChance = (chance > 0) ? chance/2 : chance*2;
if((msg.value()<=0)
&&(CMLib.flags().isStanding(target))
&&(proficiencyCheck(mob,tripChance,auto)))
{
if(maliciousAffect(mob,target,asLevel,2,CMMsg.MSK_MALICIOUS_MOVE|CMMsg.TYP_JUSTICE|(auto?CMMsg.MASK_ALWAYS:0)) != null)
R.show(mob,target,CMMsg.MSG_OK_ACTION,L("<T-NAME> hit(s) the floor!"));
}
}
}
else
return maliciousFizzle(mob,target,L("<S-NAME> fail(s) to tail swipe <T-NAMESELF>."));
// return whether it worked
return success;
}
}
| [
"[email protected]"
] | |
8a2ee4f1274936d976b2a4463a602135aa6fdbb3 | 4eb12ceab790c9dd5a86467c8a624afde8e02f45 | /src/main/java/rs/prefabs/nemesis/cards/generals/DirtyBlood.java | 486a870a3028145e3cc8a488835cdf1f76357d8d | [] | no_license | Somdy/PrefabsMod | b1897a9a7a6ba77e95c74a66518d12e488b97fd6 | 384f08c010914c46fb730ce66ada68c732d25a9e | refs/heads/master | 2023-06-23T11:48:59.905731 | 2021-07-22T16:06:36 | 2021-07-22T16:06:36 | 387,410,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,224 | java | package rs.prefabs.nemesis.cards.generals;
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.WeakPower;
import rs.prefabs.general.actions.common.DamageAndDoWhenUnblocked;
import rs.prefabs.nemesis.interfaces.AbstractOffering;
import rs.prefabs.nemesis.patches.NesCustomEnum;
import rs.prefabs.nemesis.powers.AdvancedVulnerablePower;
public class DirtyBlood extends AbstractNesGeneralCard implements AbstractOffering {
@Override
protected void play(AbstractCreature s, AbstractCreature t) {
if (!isInEnemyUse()) {
for (AbstractMonster m : getAllLivingMstrs()) {
addToBot(new DamageAndDoWhenUnblocked(m, crtDmgInfo(s, damage, damageTypeForTurn), NesCustomEnum.NES_PLAGUE,
crt -> {
addToBot(new ApplyPowerAction(m, s, new AdvancedVulnerablePower(m, upgraded ? 0.75F : 0.65F, magicNumber)));
if (canTriggerEnchantedEffect())
addToBot(new ApplyPowerAction(m, s, new WeakPower(m, ExMagicNum, false)));
}));
}
return;
}
}
@Override
protected void spectralize() {
appendDescription(EXTENDED_DESCRIPTION[0]);
}
@Override
protected void despectralize() {
subtractDescription(EXTENDED_DESCRIPTION[0]);
}
@Override
public void triggerOnInitializationAndCompletion() {
for (AbstractMonster m : getAllLivingMstrs()) {
addToBot(new DamageAndDoWhenUnblocked(m, crtDmgInfo(cpr(), damage, damageTypeForTurn), NesCustomEnum.NES_PLAGUE,
crt -> {
addToBot(new ApplyPowerAction(m, cpr(), new AdvancedVulnerablePower(m, upgraded ? 0.75F : 0.65F,
magicNumber)));
if (canTriggerEnchantedEffect())
addToBot(new ApplyPowerAction(m, cpr(), new WeakPower(m, ExMagicNum, false)));
}));
}
}
@Override
public boolean canEnemyUse() {
return true;
}
} | [
"[email protected]"
] | |
7fc7358eca5089de90d83e63e7a597a4afaeff4a | 74d9c340f825f924d90fb100ff5cf03a294d961e | /mockito-tutorial/src/main/java/com/hascode/tutorial/custom/mockparent/SubTypeOfGeneric.java | bdf7fc743f0c7ee443987c6b78ada591665adb90 | [] | no_license | pgrigoro/workspace-tutorials | 56985dd006b35cff13b5a5696f0483c22800f941 | 89abdc12ad5626efb1ec9a508641ad1f3062af20 | refs/heads/master | 2022-09-16T07:45:19.092154 | 2015-10-10T18:14:06 | 2015-10-10T18:14:06 | 23,735,962 | 0 | 0 | null | 2022-08-25T01:31:06 | 2014-09-06T14:06:54 | JavaScript | UTF-8 | Java | false | false | 369 | java | package com.hascode.tutorial.custom.mockparent;
class SubTypeOfGeneric extends GenericConstruct {
public String doSomethingExtra() {
System.out.println(doSomethingGeneric());
System.out.println(doSomethingElseGeneric());
return "this is a very extra thing I am doing";
}
public String doSomethingGeneric() {
return "I do something not so generic";
}
} | [
"[email protected]"
] | |
231438d593361be5ae9b7ff8eee8797a89d58b53 | b5bc55234849236b2c20c45678f15b2a1a37c111 | /ShogiBoardSearch/test/org/petanko/ottfoekst/boardsrch/indexer/IndexerUtilsTest.java | e882c23c3efb19f32f3420b6041a730deb0de6b3 | [] | no_license | ottfoekst/ShogiBoardSearch | 9e9b57b6880ae5020775fa8e970e871cbfedc00d | 8bba1ba2db81c9e127a5ab29160c76486d366713 | refs/heads/master | 2021-01-21T04:51:01.544040 | 2016-07-10T05:25:03 | 2016-07-10T05:25:03 | 51,753,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java | package org.petanko.ottfoekst.boardsrch.indexer;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.util.Random;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.petanko.ottfoekst.petankoshogi.board.PiecePosition;
import org.petanko.ottfoekst.petankoshogi.util.ShogiUtils;
public class IndexerUtilsTest {
@Rule
public TemporaryFolder tmpFolder = new TemporaryFolder();
@Test
public void getKifuIdFilePath_Test() throws Exception {
File expected = tmpFolder.newFile(IndexerUtils.KIFUID_FILE_NAME);
assertEquals(expected.getAbsolutePath(), IndexerUtils.getKifuIdFilePath(tmpFolder.getRoot().toPath()).toString());
}
@Test
public void getBoardInvFilePath_Test() throws Exception {
int blockNo = new Random().nextInt(10);
File expected = tmpFolder.newFile(IndexerUtils.BOARD_INV_FILE_NAME + "." + blockNo);
assertEquals(expected.getAbsolutePath(), IndexerUtils.getBoardInvFilePath(tmpFolder.getRoot().toPath(), blockNo).toString());
}
@Test
public void calculateBoardTokenId_Test() throws Exception {
PiecePosition piecePosition = ShogiUtils.getHiratePiecePosition();
for(int blockNo = 0; blockNo < 50; blockNo++) {
System.out.println("blockNo = " + blockNo + ", boardTokenId = " + IndexerUtils.calculateBoardTokenId(piecePosition, blockNo));
}
}
}
| [
"[email protected]"
] | |
cf0693d0ff0cb7b8d98bb1f8c3696e8ee719f9e9 | 0de908bdd3bd521c7241ce42cc49734ec4ff7c68 | /src/com/pratice1/Code52.java | a9a8360ec6b1495bf515faae3df6fa96ec80afef | [] | no_license | monster5475/NiuKe | fc7886a0cc90258a2b03be1c965baa9cbb4daf49 | 0a5cd12b5269e033de9d874406ee1ec7b39e13a1 | refs/heads/master | 2022-05-19T10:25:06.660654 | 2022-04-18T07:17:55 | 2022-04-18T07:17:55 | 205,992,510 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package com.pratice1;
import java.util.ArrayList;
/**
* @author: wyh
* 滑动窗口的最大值
* @Date: 2019/10/28 11:21
*/
public class Code52 {
public ArrayList<Integer> maxInWindows(int [] num, int size)
{
ArrayList<Integer> res = new ArrayList<>();
if (size==0 || size>num.length) {
return res;
}
int max = Integer.MIN_VALUE;
for(int i=0; i<size; i++){
max = Math.max(num[i], max);
}
res.add(max);
for(int i=size; i<num.length; i++){
if(num[i-size]==max){
max = Integer.MIN_VALUE;
for(int j=i-size+1;j<=i;j++){
max = Math.max(num[j], max);
}
}else {
max = Math.max(num[i], max);
}
res.add(max);
}
return res;
}
}
| [
"[email protected]"
] | |
f66b29c40d01fc1f59c7239297ab88cb342befd0 | 9e0e8dcb8f8ede6392de6984b65c07bb025953d8 | /src/etutorsoftwer/Student_dashboardController.java | 8392802c1ba1b08a6b7db58d3d791295f2740d65 | [] | no_license | hadiuzzaman524/eTutor-soft | 8ad99614e875b552586b9968df6c4bc62dc0a5e6 | e81cd3bc7973ae4383c8e35353c89ba4ab921550 | refs/heads/master | 2021-07-04T19:26:39.071998 | 2021-01-23T10:41:46 | 2021-01-23T10:41:46 | 217,699,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,739 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package etutorsoftwer;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* FXML Controller class
*
* @author ASUS
*/
public class Student_dashboardController implements Initializable {
/**
* Initializes the controller class.
*/
public static Stage stage;
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@FXML
private void Backbutton(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("Student_login.fxml"));
Scene scene = new Scene(root);
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
stage.setScene(scene);
stage.show();
}
@FXML
private void FindTeacherButton(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("FindTeacher_board.fxml"));
Scene scene = new Scene(root);
Stage stage2 = (Stage) ((Node) event.getSource()).getScene().getWindow();
stage2.setScene(scene);
stage2.show();
}
@FXML
private void TutorialButton(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("Tutorials_Link.fxml"));
Scene scene = new Scene(root);
Stage stage2 = (Stage) ((Node) event.getSource()).getScene().getWindow();
stage2.setScene(scene);
stage2.show();
}
@FXML
private void NoteButton(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("Notebooks.fxml"));
Scene scene = new Scene(root);
Stage stage2 = (Stage) ((Node) event.getSource()).getScene().getWindow();
stage2.setScene(scene);
stage2.show();
}
@FXML
private void TodoListButton(ActionEvent event) {
}
@FXML
private void ExamButton(ActionEvent event) {
}
@FXML
private void FidBackButton(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("FeedBack.fxml"));
Scene scene = new Scene(root);
Stage stage2 = new Stage();
stage2.setScene(scene);
stage2.show();
stage = stage2;//for signup windows
}
}
| [
"[email protected]"
] | |
c57d7290482cf62c7c58c71746c3727d8be51410 | c1d2a2ffb17378d718903d96227acb62a20d9042 | /HelloWorld.java | 89177d20c3926dd03c07c6c9bb77cf3a70a4fc7c | [] | no_license | donderasika94/corejava_assignments_repo | 6cad914fd3c682f60f59c2b759eb20d2ce2a3bb1 | 8ede678405629417a45a53435ed4e15cdecb302b | refs/heads/master | 2020-04-28T05:12:12.050575 | 2019-03-11T14:00:47 | 2019-03-11T14:00:47 | 175,011,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | package basic_assignments;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world!!!");
}
} | [
"[email protected]"
] | |
7442179e37900e83c2c33df7c3413d4a8d19634f | 82ff83e5977d2006f5f6bd4b919f88cfbcdbe6fc | /pdfbox_2995/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDActionSound.java | 33af5392a0f2c43e3869a10dc3d64ce39e134e7d | [] | no_license | Spirals-Team/npe-dataset | 7b94391d5ab2f437e1b3a7d6dcf50b5ef5387015 | b07d24851a8a9ce52a8c0e5898e8e3ca75a95c65 | refs/heads/master | 2022-08-08T12:23:48.592326 | 2019-03-29T17:02:56 | 2019-03-29T17:02:56 | 42,186,619 | 2 | 2 | null | 2022-07-06T20:34:25 | 2015-09-09T15:17:07 | Java | UTF-8 | Java | false | false | 2,090 | 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 org.apache.pdfbox.pdmodel.interactive.action;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
/**
* This represents a Sound action that can be executed in a PDF document
*
* @author Timur Kamalov
*/
public class PDActionSound extends PDAction
{
/**
* This type of action this object represents.
*/
public static final String SUB_TYPE = "Sound";
/**
* Default constructor.
*/
public PDActionSound()
{
action = new COSDictionary();
setSubType(SUB_TYPE);
}
/**
* Constructor.
*
* @param a The action dictionary.
*/
public PDActionSound(COSDictionary a)
{
super(a);
}
/**
* This will get the type of action that the actions dictionary describes. It must be Sound for
* a Sound action.
*
* @return The S entry of the specific Sound action dictionary.
*/
public String getS()
{
return action.getNameAsString(COSName.S);
}
/**
* This will set the type of action that the actions dictionary describes. It must be Sound for
* a Sound action.
*
* @param s The Sound action.
*/
public void setS(String s)
{
action.setName(COSName.S, s);
}
}
| [
"[email protected]"
] | |
f788f669f2aa52fb5c6be74fbfb7af82ed4159d4 | 47798511441d7b091a394986afd1f72e8f9ff7ab | /src/main/java/com/alipay/api/domain/AlipayEcoEprintTokenGetModel.java | 9dd5fbac3066baa1421d78d051c6be83c303e8e8 | [
"Apache-2.0"
] | permissive | yihukurama/alipay-sdk-java-all | c53d898371032ed5f296b679fd62335511e4a310 | 0bf19c486251505b559863998b41636d53c13d41 | refs/heads/master | 2022-07-01T09:33:14.557065 | 2020-05-07T11:20:51 | 2020-05-07T11:20:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,157 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 易联云token获取对外接口服务
*
* @author auto create
* @since 1.0, 2019-09-06 17:56:34
*/
public class AlipayEcoEprintTokenGetModel extends AlipayObject {
private static final long serialVersionUID = 4198941893447645546L;
/**
* 是否优先从缓存中拿取,false则强制刷新,1天20次
*/
@ApiField("cache_first")
private Boolean cacheFirst;
/**
* 应用ID
*/
@ApiField("client_id")
private String clientId;
/**
* 应用Secret
*/
@ApiField("client_secret")
private String clientSecret;
public Boolean getCacheFirst() {
return this.cacheFirst;
}
public void setCacheFirst(Boolean cacheFirst) {
this.cacheFirst = cacheFirst;
}
public String getClientId() {
return this.clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getClientSecret() {
return this.clientSecret;
}
public void setClientSecret(String clientSecret) {
this.clientSecret = clientSecret;
}
}
| [
"[email protected]"
] | |
0fa5e77f21fa164d4040298607d1baa16380a9d1 | cbf4b5a8b38e3599e6dae93992a147bbeaf44feb | /app/src/main/java/com/bruce/travel/travels/been/TravelsEntityComparator.java | c039dd040c7a4081475cb0e3da6cac5724001d83 | [
"MIT"
] | permissive | ricots/Travel | 23023a27031f11486bcb1cf32f3030f7fd71239f | b1597e7c97df4bec741fb67a12b14ae4c9aca7cd | refs/heads/master | 2021-01-12T17:45:58.263469 | 2016-09-18T05:51:40 | 2016-09-18T05:51:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.bruce.travel.travels.been;
import java.util.Comparator;
/**
* Created by sunfusheng on 16/4/25.
*/
public class TravelsEntityComparator implements Comparator<TravelsBean> {
@Override
public int compare(TravelsBean lhs, TravelsBean rhs) {
return rhs.getRank() - lhs.getRank();
}
}
| [
"[email protected]"
] | |
9614e368450eb1dce821ed70ecd3cc786b92e61a | 380fc00286058f32e825738e642dfdec1dd98a5e | /taoZhuMa/src/main/java/com/ruiyu/taozhuma/adapter/TzmSearchAdapter.java | 5989b57ea7b67c1044e9500e064cedb3059e48a8 | [] | no_license | huangbo877/TaoZhuMabase | b3af94d22c2d6e83fab77394ec011a93a5378286 | b02b69e892253c8323ccfb364392ad536938108a | refs/heads/master | 2021-01-10T10:12:07.400658 | 2016-02-25T06:19:24 | 2016-02-25T06:19:24 | 52,503,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,083 | java | package com.ruiyu.taozhuma.adapter;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ruiyu.taozhuma.R;
import com.ruiyu.taozhuma.base.xUtilsImageLoader;
import com.ruiyu.taozhuma.model.TzmCustomSearchModel;
import com.ruiyu.taozhuma.model.TzmSearchAllModel.Product;
import com.ruiyu.taozhuma.model.TzmSearchAllModel.Shop;
import com.ruiyu.taozhuma.utils.LogUtil;
import com.ruiyu.taozhuma.utils.StringUtils;
public class TzmSearchAdapter extends BaseAdapter {
private String TAG = "TzmSearchAdapter";
private LayoutInflater layoutInflater;
private Context context;
private ArrayList<TzmCustomSearchModel> list;
private xUtilsImageLoader imageLoader;
private List<Product> product_list;
private List<Shop> shop_list;
public TzmSearchAdapter(Context context,
ArrayList<TzmCustomSearchModel> list, xUtilsImageLoader imageLoader) {
layoutInflater = LayoutInflater.from(context);
this.context = context;
this.list = list;
this.imageLoader = imageLoader;
LogUtil.Log(TAG, "TzmSearchAdapter");
}
@Override
public int getCount() {
return this.list.size();
}
@Override
public Object getItem(int position) {
return this.list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View view, ViewGroup viweGroup) {
ViewHolder viewHolder;
if (view == null) {
view = layoutInflater.inflate(R.layout.search_item, null);
viewHolder = new ViewHolder();
viewHolder.search_product = (RelativeLayout) view
.findViewById(R.id.search_product);
viewHolder.search_shop = (RelativeLayout) view
.findViewById(R.id.search_shop);
viewHolder.shopName = (TextView) view
.findViewById(R.id.tv_shop_name);
viewHolder.shopImage = (ImageView) view
.findViewById(R.id.iv_shopImage);
viewHolder.productName = (TextView) view
.findViewById(R.id.tv_product_name);
viewHolder.productPrice = (TextView) view
.findViewById(R.id.tv_price);
viewHolder.productSellNumber = (TextView) view
.findViewById(R.id.tv_sellNumber);
viewHolder.productPicture = (ImageView) view
.findViewById(R.id.iv_picture);
viewHolder.tv_mainCategory = (TextView) view
.findViewById(R.id.tv_mainCategory);
viewHolder.tv_address = (TextView) view
.findViewById(R.id.tv_address);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
final TzmCustomSearchModel info = this.list.get(position);
if (info.type == 1) {
viewHolder.search_product.setVisibility(View.VISIBLE);
viewHolder.search_shop.setVisibility(View.GONE);
viewHolder.productName.setText(info.productName);
viewHolder.productPrice.setText("¥ " + info.distributionPrice);
viewHolder.productSellNumber.setText("销量:" + info.sellNumber + "");
if (StringUtils.isNotEmpty(info.productImage)) {
imageLoader.display(viewHolder.productPicture, ""
+ info.productImage);
}
}
if (info.type == 2) {
viewHolder.search_product.setVisibility(View.GONE);
viewHolder.search_shop.setVisibility(View.VISIBLE);
viewHolder.tv_mainCategory.setVisibility(View.VISIBLE);
viewHolder.tv_address.setVisibility(View.VISIBLE);
viewHolder.shopName.setText(info.shopName);
viewHolder.tv_mainCategory.setText(info.mainCategory);
viewHolder.tv_address.setText(info.address);
Log.i("tag", ">>>>>>>>>>>" + info.mainCategory + info.address);
if (StringUtils.isNotEmpty(info.shopImage)) {
imageLoader.display(viewHolder.shopImage, "" + info.shopImage);
}
}
return view;
}
private class ViewHolder {
TextView shopName, productName, productPrice, productSellNumber,
tv_mainCategory, tv_address;
ImageView shopImage, productPicture;
RelativeLayout search_product, search_shop;
}
}
| [
"黄博"
] | 黄博 |
fcab55c17ea0b29d134b0567b6e543f2247e5e8c | 8d8fc50da445d3b191d5e25e6f7def5c9acdd02f | /coconut-code/src/main/java/app/beelabs/com/codebase/support/util/CacheUtil.java | 24e288c12b69233bc8154af5caab8e0e3ad4d0fd | [] | no_license | acan12/coconut_beta | 5b039df88b46d11d44b997418f265c4f99e4e0d9 | c08ae445f99d47fbd90453240a5d3af4538cbbac | refs/heads/master | 2023-06-11T09:59:49.154389 | 2021-06-30T10:04:02 | 2021-06-30T10:04:02 | 348,253,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,195 | java | package app.beelabs.com.codebase.support.util;
import android.content.Context;
import android.content.SharedPreferences;
import app.beelabs.com.codebase.R;
/**
* Created by arysuryawan on 12/21/16.
*/
public class CacheUtil {
static final int PREFERENCE_KEY = R.string.app_name;
static SharedPreferences sharedPref;
public static void putPreferenceString(String key, String value, Context context) {
sharedPref = context.getSharedPreferences(context.getString(PREFERENCE_KEY), Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(key, value).commit();
}
public static void putPreferenceInteger(String key, int value, Context context) {
sharedPref = context.getSharedPreferences(context.getString(PREFERENCE_KEY), Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putInt(key, value).commit();
}
public static void putPreferenceBoolean(String key, boolean value, Context context) {
sharedPref = context.getSharedPreferences(context.getString(PREFERENCE_KEY), Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putBoolean(key, value).commit();
}
public static String getPreferenceString(String key, Context context) {
sharedPref = context.getSharedPreferences(context.getString(PREFERENCE_KEY), Context.MODE_PRIVATE);
return sharedPref.getString(key, "");
}
public static int getPreferenceInteger(String key, Context context) {
sharedPref = context.getSharedPreferences(context.getString(PREFERENCE_KEY), Context.MODE_PRIVATE);
return sharedPref.getInt(key, 0);
}
public static Boolean getPreferenceBoolean(String key, Context context) {
sharedPref = context.getSharedPreferences(context.getString(PREFERENCE_KEY), Context.MODE_PRIVATE);
return sharedPref.getBoolean(key, false);
}
public static void clearPreference(Context context) {
sharedPref = context.getSharedPreferences(context.getString(PREFERENCE_KEY), Context.MODE_PRIVATE);
sharedPref.edit().clear().commit();
}
}
| [
"[email protected]"
] | |
2b275f508520eedff677c90c967abb999fc9ceff | 41f622569cc145a0e3121b1eda85fa0d0c2ee04d | /src/model/AppointmentModel.java | 1c828387c9c9726cf09e5aa7aa3cea73286ffe2a | [] | no_license | Taolana/GDRDVM | cc115c0819a06425352a6d845c9e459628eead52 | f1628e29e5daf1cc3d1222e42f1ce1f4c6fc4685 | refs/heads/master | 2023-01-04T02:21:13.644183 | 2020-10-27T08:03:52 | 2020-10-27T08:03:52 | 187,333,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,885 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package model;
import java.sql.Timestamp;
/**
*
* @author bynan
*/
public class AppointmentModel {
private int id;
private int medic_id;
private int crenel_id;
private int patient_folder_id;
private String date;
private Timestamp timestamp;
private Timestamp updated_at;
public Timestamp getUpdated_at() {
return updated_at;
}
public void setUpdated_at(Timestamp updated_at) {
this.updated_at = updated_at;
}
public AppointmentModel(int id, int medic_id, int crenel_id, int patient_folder_id, String date, Timestamp timestamp, Timestamp updated_at) {
this.id = id;
this.medic_id = medic_id;
this.crenel_id = crenel_id;
this.patient_folder_id = patient_folder_id;
this.timestamp = timestamp;
this.updated_at = updated_at;
this.date = date;
}
public AppointmentModel(int id,int idpatientfolder, int idmedics, int idcreno, String date, Timestamp ts) {
this.id = id;
this.patient_folder_id = idpatientfolder;
this.medic_id = idmedics;
this.crenel_id = idcreno;
this.date = date;
this.timestamp = ts;
}
public AppointmentModel() {
}
public AppointmentModel(int idpatientfolder, int idmedics, int idcreno, String date, Timestamp ts) {
this.patient_folder_id = idpatientfolder;
this.medic_id = idmedics;
this.crenel_id = idcreno;
this.date = date;
this.timestamp = ts;
}
@Override
public String toString() {
return "AppointmentModel{" + "medic_id=" + medic_id + ", crenel_id=" + crenel_id + ", patient_folder_id=" + patient_folder_id + ", timestamp=" + timestamp + ", date=" + date + '}';
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public int getMedic_id() {
return medic_id;
}
public void setMedic_id(int medic_id) {
this.medic_id = medic_id;
}
public int getCrenel_id() {
return crenel_id;
}
public void setCrenel_id(int crenel_id) {
this.crenel_id = crenel_id;
}
public int getPatient_folder_id() {
return patient_folder_id;
}
public void setPatient_folder_id(int patient_folder_id) {
this.patient_folder_id = patient_folder_id;
}
public Timestamp getTimestamp() {
return timestamp;
}
public void setTimestamp(Timestamp timestamp) {
this.timestamp = timestamp;
}
}
| [
"[email protected]"
] | |
5ed7ce3ccf93f27bc9fdbd213a913a0bee2e3030 | 6361d2d876c0fb4a9a379d41cc44dcf8d8568778 | /MyProject/src/main/java/com/demo/service/inter/LoginServiceInter.java | 1f1abf141d3413ad2b90f3688e8b9e16a8155c88 | [] | no_license | h787073567/gitskills | 1099647453d36424de7b8c0834e1c3e4c5840962 | c1ef6204805e767ad930a1d01c1a2c32c8942d4c | refs/heads/master | 2020-12-05T07:41:52.387018 | 2016-09-01T09:27:40 | 2016-09-01T09:27:40 | 66,922,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 73 | java | package com.demo.service.inter;
public interface LoginServiceInter {
}
| [
"[email protected]"
] | |
653dcce9eebdfd0d9bd1a18176c2321c16cef9e0 | 387ef21cd4d579927596f5be5fa528c57f98d348 | /eindopdracht/tests/RecursiveAITest.java | 16abb86f4d091a456a78a0a837d8eb422c653649 | [] | no_license | lesteenman/PracticumP2 | 953000285f00ad2fe57b2d8c29fa5cea6ee946c4 | 98b807ea4188dee709e1e464d3404e79112925fc | refs/heads/master | 2020-04-11T16:04:12.685832 | 2012-04-12T13:48:38 | 2012-04-12T13:48:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,778 | java | package eindopdracht.tests;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import eindopdracht.ai.RecursiveAI;
import eindopdracht.client.model.Set;
import eindopdracht.client.model.player.Player;
import eindopdracht.model.Board;
import eindopdracht.util.ModelUtil;
import eindopdracht.util.PTLog;
public class RecursiveAITest {
public static void main(String[] args) {
boolean again = true;
ArrayList<Integer> testPlayers = new ArrayList<Integer>();
for (int i = 2; i <= 4; i++) {
testPlayers.add(i);
}
while (again) {
Board testBoard = new Board();
for (int x = 0; x < 9; x++) {
for (int y = 0; y < 9; y++) {
int block = ModelUtil.getBlockForPosition(x, y);
int tile = ModelUtil.getTileForPosition(x, y);
//Generate a random color 0-4
int randomColor = (int) (Math.random()*4);
testBoard.set(block, tile, randomColor);
}
}
testBoard.drawBoard();
RecursiveAI ai = new RecursiveAI(1, testBoard, testPlayers);
Set testSet = new Set(new Player());
ai.calculateSet(testSet);
PTLog.log("RecursiveAITest", "Best move would be: " + testSet.getBlock() + "," + testSet.getTile());
//Let the AI calculate
if (RecursiveAITest.readString("Again?").equals("EXIT")) {
again = false;
}
}
}
/** Leest een regel tekst van standaardinvoer. */
public static String readString(String tekst) {
System.out.print(tekst);
String antw = null;
try {
BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
antw = in.readLine();
} catch (IOException e) {}
return (antw == null) ? "" : antw;
}
}
| [
"[email protected]"
] | |
97baa3a5220a50540ee4abd0acb6db68ee82c0c8 | aeaa646d5bc262e48ed0769914eff3a272ed9c98 | /src/de/ioexception/me/ding/view/items/LoadItem.java | 5cca12f5521212d29669326d493b7615d243e760 | [
"MIT"
] | permissive | ioexception-de/echtzeitfahrplan-ulm-neuulm | 3f671d9e7c9eb32c80d4c903714d24056da9945f | 13956acc035b3698ef10fe2dbb0ec7f9fcb44f51 | refs/heads/master | 2020-03-31T09:23:33.308606 | 2011-03-28T11:03:07 | 2011-03-28T11:03:07 | 1,517,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package de.ioexception.me.ding.view.items;
import javax.microedition.lcdui.CustomItem;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
/**
* A simple {@link CustomItem} that display a "Loading..." message. Should be
* added to the Form on start loading and removed when async action finishes.
*
* @author Benjamin Erb
*/
public class LoadItem extends CustomItem
{
public LoadItem()
{
super("");
}
protected int getMinContentHeight()
{
return 120;
}
protected int getMinContentWidth()
{
return 225;
}
protected int getPrefContentHeight(int arg0)
{
return 120;
}
protected int getPrefContentWidth(int arg0)
{
return 225;
}
protected void paint(Graphics g, int w, int h)
{
g.setColor(0x2b80be);
g.fillRect(0, 45, 225, 60);
g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE));
g.setColor(0xFFFFFF);
g.drawString("Lade Daten...", 5, 54, Graphics.TOP | Graphics.LEFT);
}
}
| [
"[email protected]"
] | |
0cd2fe6f41714040d6c3fa95e8742196de45a573 | 7e95a62ec4e414b12c9220e4754b8c96e81bccd6 | /ep3/codigo/org/opensourcephysics/tools/Toolbox.java | c5b48328c0a026c68539caa0f0cf40beb3ed6c86 | [] | no_license | nicolasnogueira/MAC0209 | 8777315075c5f15c93be6b8990054cee683b3d9d | 9f47162a12a98d8116af69edd154cd1b1e3a755c | refs/heads/master | 2020-09-21T22:27:33.172477 | 2016-12-07T01:22:48 | 2016-12-07T01:22:48 | 67,250,654 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,011 | java | /*
* Open Source Physics software is free software as described near the bottom of this code file.
*
* For additional information and documentation on Open Source Physics please see:
* <http://www.opensourcephysics.org/>
*/
package org.opensourcephysics.tools;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
import org.opensourcephysics.controls.OSPLog;
/**
* Toolbox stores tools that can exchange data using the Tool interface.
*
* @author Wolfgang Christian and Doug Brown
* @version 0.1
*/
public class Toolbox {
protected static Map<String, Tool> tools = new HashMap<String, Tool>();
protected static Registry registry;
protected static int allowRMI = -1; // flag to determine if RMI should be allowed.
protected Toolbox() {
/** empty block */
}
public static void addTool(String name, Tool tool) {
if(tools.get(name)==null) {
tools.put(name, tool);
OSPLog.fine("Added to toolbox: "+name); //$NON-NLS-1$
}
}
public static boolean addRMITool(String name, Tool tool) {
initRMI();
if(allowRMI==0) { // user has choosen not to allow RMI
return false;
}
try {
Tool remote = new RemoteTool(tool);
registry.bind(name, remote);
OSPLog.fine("Added to RMI registry: "+name); //$NON-NLS-1$
return true;
} catch(Exception ex) {
OSPLog.warning("RMI registration failed: "+name+" ["+ex+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return false;
}
}
public static Tool getTool(String name) {
if(tools.containsKey(name)) {
// look for local tool
Tool tool = tools.get(name);
OSPLog.fine("Found local tool: "+name); //$NON-NLS-1$
return tool;
}
initRMI();
if(allowRMI==0) { // user has choosen not to allow RMI
return null;
}
// look for RMI tool
try {
Tool tool = (Tool) registry.lookup(name);
OSPLog.fine("Found RMI tool "+name); //$NON-NLS-1$
return new RemoteTool(tool);
} catch(Exception ex) {
OSPLog.info("RMI lookup failed: "+name+" ["+ex+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return null;
}
private static void initRMI() {
if(allowRMI==0) { // user has choosen not to allow RMI
return;
}
int selection = JOptionPane.showConfirmDialog(null, ToolsRes.getString("Toolbox.Dialog.UseRemote.Query"), ToolsRes.getString("Toolbox.Dialog.UseRemote.Title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); //$NON-NLS-1$ //$NON-NLS-2$
if(selection==JOptionPane.YES_OPTION) {
allowRMI = 1;
} else {
allowRMI = 0;
return;
}
if(registry==null) {
try {
registry = LocateRegistry.getRegistry(1099);
registry.list();
} catch(RemoteException ex) {
try {
registry = LocateRegistry.createRegistry(1099);
} catch(RemoteException ex1) {
OSPLog.info(ex1.getMessage());
}
}
}
if(System.getSecurityManager()==null) {
try {
// set the rmi server codebase and security policy properties
String base = "file:"+System.getProperty("user.dir"); //$NON-NLS-1$ //$NON-NLS-2$
System.setProperty("java.rmi.server.codebase", base+"/classes/"); //$NON-NLS-1$ //$NON-NLS-2$
System.setProperty("java.security.policy", base+"/Remote.policy"); //$NON-NLS-1$ //$NON-NLS-2$
// set the security manager
System.setSecurityManager(new RMISecurityManager());
} catch(Exception ex) {
OSPLog.info(ex.getMessage());
}
}
}
}
/*
* Open Source Physics software is free software; you can redistribute
* it and/or modify it under the terms of the GNU General Public License (GPL) as
* published by the Free Software Foundation; either version 2 of the License,
* or(at your option) any later version.
* Code that uses any portion of the code in the org.opensourcephysics package
* or any subpackage (subdirectory) of this package must must also be be released
* under the GNU GPL license.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA
* or view the license online at http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2007 The Open Source Physics project
* http://www.opensourcephysics.org
*/
| [
"[email protected]"
] | |
a017377b110ae6b82b87ea885ae7a817b57291c0 | 0a1eb9f5fd5f41fa382f3d80d64d277e68f66f14 | /examples/health/REEDHOUSESYSTEMS_HEALTH_DASHBOA/SRC/MAIN/JAVA/COM/REEDHOUSESYSTEMS/SERVICES/CORE/HEALTH/DASHBOARD/REQUESTS/TOPICREQUEST.JAVA | 83e0e8437a98bdf0798ffe2a2f67efe64e0edcfb | [
"Apache-2.0"
] | permissive | Nyakonda/teleweaver | ab15d594b2f16991ca25d1a678103d21203819b6 | ce05a4db9e206e7808eda2cc97a0dcf45b71d3da | refs/heads/master | 2021-01-22T10:47:39.490145 | 2017-05-03T08:00:57 | 2017-05-03T08:00:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 815 | java | package com.reedhousesystems.services.core.health.dashboard.requests;
import javax.validation.constraints.NotNull;
import com.reedhousesystems.services.core.health.dashboard.model.Topic;
public class TopicRequest {
private String id;
@NotNull
private String title;
@NotNull
private String description;
public TopicRequest() {
}
public TopicRequest(Topic topic) {
setId(topic.getUuid().toString());
setTitle(topic.getTitle());
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
} | [
"[email protected]"
] | |
ebaf193abeceaec1e8c7b3e425e6d298cfd46dc2 | 0b6f4d4dfcfd8e41eefbe9df0bc98ed4992d1eef | /src/test/java/org/arbeitspferde/groningen/Helper.java | 56fd34e2f13b72dd5420476da64194c287733c56 | [
"Apache-2.0"
] | permissive | sladeware/groningen | 68b043162b8bcbffffc467b187c885ce9dfb3106 | 1c58ca16212a08b31a10e4abcbcfbd981925f2c5 | refs/heads/master | 2021-01-19T21:52:01.897131 | 2014-08-29T09:59:39 | 2014-08-29T09:59:39 | 12,143,761 | 14 | 1 | null | 2014-08-29T09:59:39 | 2013-08-15T20:59:02 | Java | UTF-8 | Java | false | false | 2,469 | java | /* Copyright 2012 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.arbeitspferde.groningen;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
/**
* {@link Helper} is a simple class that assists with some basic testing functions that may
* be used by a plethora of test cases.
*/
public class Helper {
private static final Logger log = Logger.getLogger(Helper.class.getCanonicalName());
/**
* Provision an appropriate location for testing given the test harness.
*
* It is incumbent on the user of this method to clean up after its emissions.
*
* @return A {@link File} where temporary files will be created.
* @throws IOException In case no test directory can be created nor found.
*/
public static File getTestDirectory() throws IOException {
final String[] testDirectories = new String[] {
System.getenv("TEST_TMPDIR"),
System.getProperty("java.io.tmpdir"),
File.createTempFile("testing",
String.format("%s.%s", System.getenv("USER"), System.nanoTime())).getAbsolutePath()};
for (final String candidate : testDirectories) {
log.info(String.format("Testing %s", candidate));
if (candidate == null) {
continue;
}
/*
* It may be the case that the test directory refers to /tmp or /home. It would be dangerous
* were that to get wiped out.
*/
final String fullCandidate = String.format("%s/runtime", candidate, candidate);
final File candidateFile = new File(fullCandidate);
if (candidateFile.exists()) {
return candidateFile;
}
if (candidateFile.mkdir()) {
return candidateFile;
} else {
log.severe(String.format(
"Could not create temporary directory: %s.", candidateFile.getAbsoluteFile()));
}
}
throw new IOException("Coult not acquire nor create a test directory.");
}
}
| [
"[email protected]"
] | |
e95381d7c6b4a84e2585048f8893a40e10025ea8 | df1bd0f951e8797f676262bddb455d6e142c545a | /app/src/main/java/com/chris/leetcode/Q43_MultiplyStrings.java | 4000bedcc92aaf29738214e720defb944827747c | [] | no_license | XjojoX1989/LeetCode | 7446516d77fb5aba969f4a2345eb6a8aba89fd3f | 0e2929dee52f3f1ba5e26af060ecc3b3cb4eb86c | refs/heads/master | 2020-08-27T22:01:03.473281 | 2020-04-22T08:57:15 | 2020-04-22T08:57:15 | 217,499,009 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,322 | java | package com.chris.leetcode;
public class Q43_MultiplyStrings {
/*
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Example 1:
Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:
Input: num1 = "123", num2 = "456"
Output: "56088"
Note:
The length of both num1 and num2 is < 110.
Both num1 and num2 contain only digits 0-9.
Both num1 and num2 do not contain any leading zero, except the number 0 itself.
You must not use any built-in BigInteger library or convert the inputs to integer directly.
*/
public static void main(String[] args) {
new Q43_MultiplyStrings().multiply("2", "1");
}
//筆記
/**
將數字的字串相乘再以字串輸出
這題用到位數的概念
我們先把把兩個數字相乘後的位數用陣列保存
例如:2位數*3位數最多就是5位數(2+3)
接著我們把每個位數相乘的結果存進他們對應的位數裡面
例如: 23*14 先算個位數 3*4 = 12 我們就要把12存進陣列內
那他們是存進哪裡呢?
3在原本的數裡面他的index=1 ,
4在原本的數裡面他的index=1
所以 12中的2 -> 1+1+1 = 3 (i+j+1)
12中的1 -> 1+1 = 2 (i+J)
2 3
x 1 4
-------
1 2
0 8
0 3
0 2
--------------
sum 0 3 2 2
indices 0 1 2 3
*/
private String multiply(String num1, String num2) {
if (num1 == null || num2 == null) return "0";
int[] digits = new int[num1.length() + num2.length()];
for (int i = num1.length() - 1; i >= 0; i--) {
for (int j = num2.length() - 1; j >= 0; j--) {
int product = (num1.charAt(i) - '0') * (num2.charAt(j) - '0');
int p1 = i + j, p2 = i + j + 1;
int sum = product + digits[p2];
digits[p1] += sum / 10;
digits[p2] = sum % 10;
}
}
StringBuilder sb = new StringBuilder();
for(int digit:digits){
if (!(digit==0 && sb.length()==0))
sb.append(digit);
}
return sb.toString();
}
}
| [
"[email protected]"
] | |
f92053ff5740f06ac273c89c2836398b093d62b2 | ad01d3afcadd5b163ecf8ba60ba556ea268b4827 | /avvedrp/trunk/gms/plugins/spring-security-core-1.2.7.2/src/java/org/codehaus/groovy/grails/plugins/springsecurity/DefaultPostAuthenticationChecks.java | ec5094fae41a96a9ec9e2dfa45c742ecc5643176 | [
"Apache-2.0"
] | permissive | ynsingh/repos | 64a82c103f0033480945fcbb567b599629c4eb1b | 829ad133367014619860932c146c208e10bb71e0 | refs/heads/master | 2022-04-18T11:39:24.803073 | 2020-04-08T09:39:43 | 2020-04-08T09:39:43 | 254,699,274 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,813 | java | /* Copyright 2011-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.groovy.grails.plugins.springsecurity;
import org.apache.log4j.Logger;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.security.authentication.CredentialsExpiredException;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsChecker;
/**
* Copy of the private class in AbstractUserDetailsAuthenticationProvider
* to make subclassing or replacement easier.
*
* @author <a href='mailto:[email protected]'>Burt Beckwith</a>
*/
public class DefaultPostAuthenticationChecks implements UserDetailsChecker {
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
protected final Logger log = Logger.getLogger(getClass());
public void check(UserDetails user) {
if (!user.isCredentialsNonExpired()) {
log.debug("User account credentials have expired");
throw new CredentialsExpiredException(messages.getMessage(
"AbstractUserDetailsAuthenticationProvider.credentialsExpired",
"User credentials have expired"), user);
}
}
}
| [
"ynsingh@0c22728b-0eb9-4c4e-a44d-29de7e55569f"
] | ynsingh@0c22728b-0eb9-4c4e-a44d-29de7e55569f |
e245e806ed01ce56e7e5079727e96ab2bc3a2893 | df5b1581b352e2bfc8fffb5591f512efbb1d01a2 | /src/test/BB.java | 215d02f5a50ad5eb36babe8ce55781530b876a2a | [] | no_license | py0777/MappingManager5 | 12c4837110563a7a4d85b6396c0ff0ce663b2d8b | 8e6f9644573b2d74ff03c770f34bc8e9ae279b8e | refs/heads/master | 2023-01-09T08:45:23.629265 | 2021-03-29T15:09:55 | 2021-03-29T15:09:55 | 212,905,531 | 0 | 0 | null | 2023-01-04T16:24:06 | 2019-10-04T21:32:10 | Java | UTF-8 | Java | false | false | 147 | java | package test;
public class BB implements IService {
@Override
public String service(String arg) {
return arg + " by BB";
}
}
| [
"[email protected]"
] | |
f72fa2dd20dc4d04bf8b1f27a58fab43b60f5de2 | 49e7e9514ee3ee6ba02460892ed01257c1e9722e | /itrip-biz/src/main/java/cn/itrip/controller/HotelOrderController.java | 44578c3bd77c253bae9c5d10f54a6c8724b8696d | [] | no_license | wangshijun0012/itripbackend | 374350b8b3364c1c0c1e1c7740892d90287b4255 | 2ad4beded26491052bfa14213f6e551c95536d83 | refs/heads/master | 2022-12-25T10:26:17.659859 | 2020-03-10T08:44:45 | 2020-03-10T08:44:45 | 238,661,884 | 0 | 0 | null | 2022-12-16T10:04:19 | 2020-02-06T10:24:06 | Java | UTF-8 | Java | false | false | 23,643 | java | package cn.itrip.controller;
import cn.itrip.beans.dto.Dto;
import cn.itrip.beans.pojo.*;
import cn.itrip.beans.vo.order.*;
import cn.itrip.beans.vo.store.StoreVO;
import cn.itrip.common.*;
import cn.itrip.service.hotel.ItripHotelService;
import cn.itrip.service.hotelorder.ItripHotelOrderService;
import cn.itrip.service.hotelroom.ItripHotelRoomService;
import cn.itrip.service.hoteltempstore.ItripHotelTempStoreService;
import cn.itrip.service.orderlinkuser.ItripOrderLinkUserService;
import cn.itrip.service.tradeends.ItripTradeEndsService;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@Api(value = "订单信息接口",tags = "订单信息接口")
@RequestMapping(value = "/api/hotelorder")
public class HotelOrderController {
private Logger logger = Logger.getLogger(HotelOrderController.class);
@Resource
private ValidationToken validationToken;
@Resource
private ItripHotelService hotelService;
@Resource
private ItripHotelRoomService roomService;
@Resource
private ItripHotelTempStoreService tempStoreService;
@Resource
private SystemConfig systemConfig;
@Resource
private ItripHotelTempStoreService itripHotelTempStoreService;
@Resource
private ItripHotelOrderService itripHotelOrderService;
@Resource
private ItripTradeEndsService itripTradeEndsService;
@Resource
private ItripOrderLinkUserService itripOrderLinkUserService;
@ApiOperation(value = "修改订房日期验证是否有房",httpMethod = "POST", response = Dto.class)
@RequestMapping(value = "/validateroomstore",method = RequestMethod.POST)
@ResponseBody
public Dto validateRoomStore(@RequestBody ValidateRoomStoreVO vo, HttpServletRequest request){
if(EmptyUtils.isEmpty(request.getHeader("token")) || !validationToken.getRedisAPI().hasKey(request.getHeader("token"))){
return DtoUtil.returnFail("token失效,请重新登录","100000");
}
if(EmptyUtils.isEmpty(vo.getHotelId())){
return DtoUtil.returnFail("hotelId不能为空","100515");
}
if(EmptyUtils.isEmpty(vo.getRoomId())){
return DtoUtil.returnFail("roomId不能为空","100516");
}
HashMap<String, Object> map = new HashMap<>();
map.put("hotelId",vo.getHotelId());
map.put("roomId",vo.getRoomId());
map.put("startTime",EmptyUtils.isEmpty(vo.getCheckInDate()) ? null : vo.getCheckInDate());
map.put("endTime",EmptyUtils.isEmpty(vo.getCheckOutDate()) ? null : vo.getCheckOutDate());
map.put("count",EmptyUtils.isEmpty(vo.getCount()) ? 1 : vo.getCount());
boolean flag = false;
try {
flag = itripHotelOrderService.validationRoomStore(map);
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("系统异常","100517");
}
map.clear();
map.put("flag", flag);
return DtoUtil.returnSuccess("操作成功", map);
}
@ApiOperation(value = "根据订单ID查看个人订单详情",httpMethod = "GET",response = Dto.class)
@RequestMapping(value = "/getpersonalorderinfo/{orderId}",method = RequestMethod.GET)
@ResponseBody
public Dto getPrisonalOrderInfo(@PathVariable String orderId,HttpServletRequest request){
if(EmptyUtils.isEmpty(orderId)){
return DtoUtil.returnFail("orderId不能为空","100525");
}
if(EmptyUtils.isEmpty(request.getHeader("token")) || !validationToken.getRedisAPI().hasKey(request.getHeader("token"))){
return DtoUtil.returnFail("token失效,请重新登录","100000");
}
ItripHotelOrder order = null;
try {
order = itripHotelOrderService.getItripHotelOrderById(Long.parseLong(orderId));
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("获取个人订单信息错误","100527");
}
if(EmptyUtils.isEmpty(order)){
return DtoUtil.returnFail("没有相关订单信息","100526");
}
ItripPersonalHotelOrderVO orderVO = new ItripPersonalHotelOrderVO();
//查询房间预定信息
if(!EmptyUtils.isEmpty(order.getRoomId())){
try {
ItripHotelRoom room = roomService.getItripHotelRoomById(order.getRoomId());
order.setPayType(room.getPayType());
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("获取个人订单信息错误","100527");
}
}
//订单状态(0:待支付 1:已取消 2:支付成功 3:已消费 4:已点评)
//{"1":"订单提交","2":"订单支付","3":"支付成功","4":"入住","5":"订单点评","6":"订单完成"}
//{"1":"订单提交","2":"订单支付","3":"订单取消"}
Integer orderStatus = order.getOrderStatus();
BeanUtils.copyProperties(order,orderVO);
Object ok = JSONArray.parse(systemConfig.getOrderProcessOK());
Object cancel = JSONArray.parse(systemConfig.getOrderProcessCancel());
if (orderStatus == 1) {
orderVO.setOrderProcess(cancel);
//取消订单
orderVO.setProcessNode("3");
} else if (orderStatus == 0) {
orderVO.setOrderProcess(ok);
//订单支付
orderVO.setProcessNode("2");
} else if (orderStatus == 2) {
orderVO.setOrderProcess(ok);
//支付成功(未出行)
orderVO.setProcessNode("3");
} else if (orderStatus == 3) {
orderVO.setOrderProcess(ok);
//订单点评
orderVO.setProcessNode("5");
} else if (orderStatus == 4) {
orderVO.setOrderProcess(ok);
//订单完成
orderVO.setProcessNode("6");
} else {
orderVO.setOrderProcess(null);
orderVO.setProcessNode(null);
}
return DtoUtil.returnDataSuccess(orderVO);
}
@ApiOperation(value = "根据订单ID查看个人订单详情-房型相关信息",httpMethod = "GET",response = Dto.class)
@RequestMapping(value = "/getpersonalorderroominfo/{orderId}",method = RequestMethod.GET)
@ResponseBody
public Dto getPersonalOrderRoomInfo(@PathVariable String orderId,HttpServletRequest request){
if(EmptyUtils.isEmpty(request.getHeader("token")) || !validationToken.getRedisAPI().hasKey(request.getHeader("token"))){
return DtoUtil.returnFail("token失效,请重新登录","100000");
}
if(EmptyUtils.isEmpty(orderId)){
return DtoUtil.returnFail("orderId不能为空","100529");
}
ItripPersonalOrderRoomVO roomVO = null;
try {
roomVO = itripHotelOrderService.getItripHotelOrderRoomInfoById(Long.parseLong(orderId));
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("获取个人订单房型信息错误","100531");
}
return DtoUtil.returnDataSuccess(roomVO);
}
@ApiOperation(value = "根据个人订单列表,并分页显示",httpMethod = "POST",response = Dto.class)
@RequestMapping(value = "/getpersonalorderlist",method = RequestMethod.POST)
@ResponseBody
public Dto getPresonalOrderList(@RequestBody ItripSearchOrderVO vo,HttpServletRequest request){
if(EmptyUtils.isEmpty(request.getHeader("token")) || !validationToken.getRedisAPI().hasKey(request.getHeader("token"))){
return DtoUtil.returnFail("token失效,请重新登录","100000");
}
if(EmptyUtils.isEmpty(vo.getOrderType()) ){
return DtoUtil.returnFail("orderType不能为空","100501");
}
if(EmptyUtils.isEmpty(vo.getOrderStatus())){
return DtoUtil.returnFail("orserStatus不能为空","100502");
}
Integer orderType = vo.getOrderType();
Integer orderStatus = vo.getOrderStatus();
HashMap<String, Object> map = new HashMap<>();
map.put("orderType", orderType == -1 ? null : orderType);
map.put("orderStatus", orderStatus == -1 ? null : orderStatus);
map.put("userId", validationToken.getCurrentUser(request.getHeader("token")).getId());
map.put("orderNo", vo.getOrderNo());
map.put("linkUserName", vo.getLinkUserName());
map.put("startDate", vo.getStartDate());
map.put("endDate", vo.getEndDate());
Page<ItripListHotelOrderVO> voPage = null;
try {
voPage = itripHotelOrderService.queryOrderPageByMap(map, vo.getPageNo(), vo.getPageSize());
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("获取个人订单列表错误","100503 ");
}
return DtoUtil.returnDataSuccess(voPage);
}
@ApiOperation(value = "扫描中间表,执行库存更新操作",httpMethod = "GET",response = Dto.class)
@RequestMapping(value = "/scanTradeEnd",method = RequestMethod.GET)
@ResponseBody
public Dto scanTradeEnd(){
Map param = new HashMap();
List<ItripTradeEnds> tradeEndses = null;
try {
param.put("flag", 1);
param.put("oldFlag", 0);
itripTradeEndsService.itriptxModifyItripTradeEnds(param);
tradeEndses = itripTradeEndsService.getItripTradeEndsListByMap(param);
if (EmptyUtils.isNotEmpty(tradeEndses)) {
for (ItripTradeEnds ends : tradeEndses) {
Map<String, Object> orderParam = new HashMap<String, Object>();
orderParam.put("orderNo", ends.getOrderNo());
List<ItripHotelOrder> orderList = itripHotelOrderService.getItripHotelOrderListByMap(orderParam);
for (ItripHotelOrder order : orderList) {
Map<String, Object> roomStoreMap = new HashMap<String, Object>();
roomStoreMap.put("startTime", order.getCheckInDate());
roomStoreMap.put("endTime", order.getCheckOutDate());
roomStoreMap.put("count", order.getCount());
roomStoreMap.put("roomId", order.getRoomId());
tempStoreService.updateRoomStore(roomStoreMap);
}
}
param.put("flag", 2);
param.put("oldFlag", 1);
itripTradeEndsService.itriptxModifyItripTradeEnds(param);
return DtoUtil.returnSuccess();
}else{
return DtoUtil.returnFail("100535", "没有查询到相应记录");
}
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("系统异常", "100536");
}
}
@ApiOperation(value = "生成订单前,获取预订信息",httpMethod = "POST",response = Dto.class)
@RequestMapping(value = "/getpreorderinfo",method = RequestMethod.POST)
@ResponseBody
public Dto getPreOrderInfo(@RequestBody ValidateRoomStoreVO vo,HttpServletRequest request){
if(EmptyUtils.isEmpty(request.getHeader("token")) || !validationToken.getRedisAPI().hasKey(request.getHeader("token"))){
return DtoUtil.returnFail("token失效,请重新登录","100000");
}
if(EmptyUtils.isEmpty(vo.getHotelId()) ){
return DtoUtil.returnFail("hotelId不能为空","100510");
}
if(EmptyUtils.isEmpty(vo.getRoomId())){
return DtoUtil.returnFail("roomId不能为空","100511");
}
ItripHotel hotel = null;
ItripHotelRoom room = null;
RoomStoreVO roomStoreVO = null;
List<StoreVO> roomStoreVOList = null;
roomStoreVO = new RoomStoreVO();
Map map = new HashMap();
map.put("startTime", vo.getCheckInDate());
map.put("endTime", vo.getCheckOutDate());
map.put("roomId", vo.getRoomId());
map.put("hotelId", vo.getHotelId());
try {
hotel = hotelService.getItripHotelById(vo.getHotelId());
room = roomService.getItripHotelRoomById(vo.getRoomId());
roomStoreVOList = tempStoreService.queryRoomStore(map);
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("系统异常","100513");
}
roomStoreVO.setCheckInDate(vo.getCheckInDate());
roomStoreVO.setCheckOutDate(vo.getCheckOutDate());
roomStoreVO.setHotelName(hotel.getHotelName());
roomStoreVO.setRoomId(room.getId());
roomStoreVO.setPrice(room.getRoomPrice());
roomStoreVO.setHotelId(vo.getHotelId());
roomStoreVO.setCount(EmptyUtils.isEmpty(vo.getCount()) ? 1 : vo.getCount() );
if(EmptyUtils.isEmpty(roomStoreVOList)){
return DtoUtil.returnFail("暂时无房", "100512");
}
roomStoreVO.setStore(roomStoreVOList.get(0).getStore());
return DtoUtil.returnDataSuccess(roomStoreVO);
}
@ApiOperation(value = "支付成功后查询订单信息",httpMethod = "POST",response = Dto.class)
@RequestMapping(value = "/querysuccessorderinfo/{id}",method = RequestMethod.POST)
@ResponseBody
public Dto querySuccessOrderInfo(@PathVariable Integer id,HttpServletRequest request){
if(EmptyUtils.isEmpty(request.getHeader("token")) || !validationToken.getRedisAPI().hasKey(request.getHeader("token"))){
return DtoUtil.returnFail("token失效,请重新登录","100000");
}
if(EmptyUtils.isEmpty(id) ){
return DtoUtil.returnFail("hotelId不能为空","100510");
}
try {
ItripHotelOrder order = itripHotelOrderService.getItripHotelOrderById(Long.valueOf(id));
if (EmptyUtils.isEmpty(order)) {
return DtoUtil.returnFail("没有查询到相应订单", "100519");
}
ItripHotelRoom room = roomService.getItripHotelRoomById(order.getRoomId());
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("id", order.getId());
resultMap.put("orderNo", order.getOrderNo());
resultMap.put("payType", order.getPayType());
resultMap.put("payAmount", order.getPayAmount());
resultMap.put("hotelName", order.getHotelName());
resultMap.put("roomTitle", room.getRoomTitle());
return DtoUtil.returnSuccess("获取数据成功", resultMap);
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("获取数据失败", "100520");
}
}
@ApiOperation(value = "生成订单", httpMethod = "POST",response = Dto.class)
@RequestMapping(value = "/addhotelorder", method = RequestMethod.POST)
@ResponseBody
public Dto<Object> addHotelOrder(@RequestBody ItripAddHotelOrderVO itripAddHotelOrderVO, HttpServletRequest request) {
Dto<Object> dto = new Dto<Object>();
String tokenString = request.getHeader("token");
logger.debug("token name is from header : " + tokenString);
ItripUser currentUser = validationToken.getCurrentUser(tokenString);
Map<String, Object> validateStoreMap = new HashMap<String, Object>();
validateStoreMap.put("startTime", itripAddHotelOrderVO.getCheckInDate());
validateStoreMap.put("endTime", itripAddHotelOrderVO.getCheckOutDate());
validateStoreMap.put("hotelId", itripAddHotelOrderVO.getHotelId());
validateStoreMap.put("roomId", itripAddHotelOrderVO.getRoomId());
validateStoreMap.put("count", itripAddHotelOrderVO.getCount());
List<ItripUserLinkUser> linkUserList = itripAddHotelOrderVO.getLinkUser();
if(EmptyUtils.isEmpty(currentUser)){
return DtoUtil.returnFail("token失效,请重登录", "100000");
}
try {
//判断库存是否充足
Boolean flag = itripHotelTempStoreService.validateRoomStore(validateStoreMap);
if (flag && null != itripAddHotelOrderVO) {
//计算订单的预定天数
Integer days = DateUtil.getBetweenDates(
itripAddHotelOrderVO.getCheckInDate(), itripAddHotelOrderVO.getCheckOutDate()
).size()-1;
if(days<=0){
return DtoUtil.returnFail("退房日期必须大于入住日期", "100505");
}
ItripHotelOrder itripHotelOrder = new ItripHotelOrder();
BeanUtils.copyProperties(itripAddHotelOrderVO,itripHotelOrder);
itripHotelOrder.setId(itripAddHotelOrderVO.getId());
itripHotelOrder.setUserId(currentUser.getId());
itripHotelOrder.setCreatedBy(currentUser.getId());
StringBuilder linkUserName = new StringBuilder();
int size = linkUserList.size();
for (int i = 0; i < size; i++) {
if (i != size - 1) {
linkUserName.append(linkUserList.get(i).getLinkUserName() + ",");
} else {
linkUserName.append(linkUserList.get(i).getLinkUserName());
}
}
itripHotelOrder.setLinkUserName(linkUserName.toString());
itripHotelOrder.setBookingDays(days);
if (tokenString.startsWith("token:PC")) {
itripHotelOrder.setBookType(0);
} else if (tokenString.startsWith("token:MOBILE")) {
itripHotelOrder.setBookType(1);
} else {
itripHotelOrder.setBookType(2);
}
//支付之前生成的订单的初始状态为未支付
itripHotelOrder.setOrderStatus(0);
try {
//生成订单号:机器码 +日期+(MD5)(商品IDs+毫秒数+1000000的随机数)
StringBuilder md5String = new StringBuilder();
md5String.append(itripHotelOrder.getHotelId());
md5String.append(itripHotelOrder.getRoomId());
md5String.append(System.currentTimeMillis());
md5String.append(Math.random() * 1000000);
String md5 = MD5.getMd5(md5String.toString(), 6);
//生成订单编号
StringBuilder orderNo = new StringBuilder();
orderNo.append(systemConfig.getMachineCode());
orderNo.append(DateUtil.format(new Date(), "yyyyMMddHHmmss"));
orderNo.append(md5);
itripHotelOrder.setOrderNo(orderNo.toString());
//计算订单的总金额
itripHotelOrder.setPayAmount(itripHotelOrderService.getOrderPayAmount(days * itripAddHotelOrderVO.getCount(), itripAddHotelOrderVO.getRoomId()));
Map<String, String> map = itripHotelOrderService.itriptxAddItripHotelOrder(itripHotelOrder, linkUserList);
DtoUtil.returnSuccess();
dto = DtoUtil.returnSuccess("生成订单成功", map);
} catch (Exception e) {
e.printStackTrace();
dto = DtoUtil.returnFail("生成订单失败", "100505");
}
} else if (flag && null == itripAddHotelOrderVO) {
dto = DtoUtil.returnFail("不能提交空,请填写订单信息", "100506");
} else {
dto = DtoUtil.returnFail("库存不足", "100507");
}
return dto;
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("系统异常", "100508");
}
}
@ApiOperation(value = "根据订单ID获取订单信息", httpMethod = "GET", response = Dto.class)
@RequestMapping(value = "/queryOrderById/{orderId}", method = RequestMethod.GET)
@ResponseBody
public Dto<Object> queryOrderById(@ApiParam(required = true, name = "orderId", value = "订单ID") @PathVariable Long orderId, HttpServletRequest request) {
ItripModifyHotelOrderVO itripModifyHotelOrderVO = null;
try {
String tokenString = request.getHeader("token");
ItripUser currentUser = validationToken.getCurrentUser(tokenString);
if(EmptyUtils.isEmpty(currentUser)){
return DtoUtil.returnFail("token失效,请重登录", "100000");
}
ItripHotelOrder order = itripHotelOrderService.getItripHotelOrderById(orderId);
if (EmptyUtils.isEmpty(order)) {
return DtoUtil.returnFail("100533", "没有查询到相应订单");
}
itripModifyHotelOrderVO = new ItripModifyHotelOrderVO();
BeanUtils.copyProperties(order, itripModifyHotelOrderVO);
Map<String, Object> param = new HashMap<String, Object>();
param.put("orderId", order.getId());
List<ItripOrderLinkUserVo> itripOrderLinkUserList = itripOrderLinkUserService.getItripOrderLinkUserListByMap(param);
itripModifyHotelOrderVO.setItripOrderLinkUserList(itripOrderLinkUserList);
return DtoUtil.returnSuccess("获取订单成功", itripModifyHotelOrderVO);
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("系统异常", "100534");
}
}
@ApiOperation(value = "修改订单的支付方式和状态", httpMethod = "POST", response = Dto.class)
@RequestMapping(value = "/updateorderstatusandpaytype", method = RequestMethod.POST)
@ResponseBody
public Dto<Map<String, Boolean>> updateOrderStatusAndPayType(@RequestBody ItripModifyHotelOrderVO itripModifyHotelOrderVO, HttpServletRequest request) {
String tokenString = request.getHeader("token");
ItripUser currentUser = validationToken.getCurrentUser(tokenString);
if (null != currentUser && null != itripModifyHotelOrderVO) {
try {
ItripHotelOrder itripHotelOrder = new ItripHotelOrder();
itripHotelOrder.setId(itripModifyHotelOrderVO.getId());
//设置支付状态为:支付成功
itripHotelOrder.setOrderStatus(2);
itripHotelOrder.setPayType(itripModifyHotelOrderVO.getPayType());
itripHotelOrder.setModifiedBy(currentUser.getId());
itripHotelOrder.setModifyDate(new Date(System.currentTimeMillis()));
itripHotelOrderService.itriptxModifyItripHotelOrder(itripHotelOrder);
} catch (Exception e) {
e.printStackTrace();
return DtoUtil.returnFail("修改订单失败", "100522");
}
return DtoUtil.returnSuccess("修改订单成功");
} else if (null != currentUser && null == itripModifyHotelOrderVO) {
return DtoUtil.returnFail("不能提交空,请填写订单信息", "100523");
} else {
return DtoUtil.returnFail("token失效,请重新登录", "100000");
}
}
}
| [
"[email protected]"
] | |
6f19fa3b8f60c1f05351c6dab2c497394ffc7ef8 | be1472a553e1c8e3fe0084785258540f77f8c31f | /src/manager/RoomManagerUI.java | 34191b261982768991269c9a850368ead6da0f6c | [] | no_license | matthew-levene/RoomBookingSystem | fada2c497561f3dd308cfad3b02ecc2db785ae1d | 214f2c42e8e3a3fc5281e750fcc1770878aa591c | refs/heads/master | 2022-04-18T00:50:12.711947 | 2020-04-18T14:30:32 | 2020-04-18T14:30:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,897 | java | package manager;
import javax.swing.*;
import java.awt.*;
import shared.ui.TableDisplayPanel;
import shared.ui.TableSearchPanel;
public class RoomManagerUI extends JPanel {
private static RoomManagerUI instance;
private TableSearchPanel searchPanel;
private TableDisplayPanel tableDisplayPanel;
private RoomActionPanel roomActionPanel;
private RoomController roomController;
private RoomManagerUI(){
//set the layout and the border
setLayout(new FlowLayout());
setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 2, true));
//Initialise UI and controller objects
initUI();
//Adds the room manager user interface panels to this class
addUIPanels();
//Listens out for button click event on the RoomActionPanel
roomActionPanel.setActionListener(event -> roomController.processRoomAction(roomActionPanel, event));
//Listens out for button click event on the TableSearchPanel
searchPanel.setActionListener(() -> roomController.findRoom());
}
public static synchronized RoomManagerUI getInstance(){
if(instance == null){
instance = new RoomManagerUI();
}
return instance;
}
private void initUI() {
searchPanel = new TableSearchPanel();
tableDisplayPanel = new TableDisplayPanel();
roomActionPanel = new RoomActionPanel();
roomController = new RoomController(this);
}
private void addUIPanels(){
//Add search panel to UI
add(searchPanel);
//Add table display panel to UI
add(tableDisplayPanel);
//Add room actions panel to UI
add(roomActionPanel);
}
public TableDisplayPanel getTableDisplayPanel(){
return tableDisplayPanel;
}
public TableSearchPanel getTableSearchPanel(){ return searchPanel; }
}
| [
"[email protected]"
] | |
a92fc784cd2e2220c22aa0ad3703b42f24e08c12 | 0410e032ec7d27c1ec0b085f919bfa63de405749 | /online-apteka-dao/src/main/java/com/finalproject/onlineapteka/dao/CartDao.java | f45350cd50812e2abe55d388613b4b24fbedff8e | [] | no_license | nastyakisel/WebProject-v2 | 3ecb04e572842c913fda715ec04a5b7b829345a0 | e1e7afabf2ae5764838a9a325def67601f0acdf5 | refs/heads/master | 2021-04-29T00:20:52.631955 | 2017-06-24T21:48:13 | 2017-06-24T21:48:13 | 77,711,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package com.finalproject.onlineapteka.dao;
import java.util.List;
import com.finalproject.onlineapteka.bean.Cart;
import com.finalproject.onlineapteka.bean.Drug;
import com.finalproject.onlineapteka.dao.exception.DAOException;
public interface CartDao {
void saveDrugToCart(Integer drugId, Integer userId) throws DAOException;
List<Drug> loadDrugsFromCart(Integer userId) throws DAOException;
void deleteDrugFromCart(Integer drugId, Integer userId) throws DAOException;
void updateDrugInCart(Cart cart) throws DAOException;
void deleteCart(Integer userId) throws DAOException;
List<Drug> loadDrugsFromCart(Integer userId, String locale) throws DAOException;
}
| [
"[email protected]"
] | |
c01fcfd07e57913df13f66965e3a0a7e22652719 | bbcddc239a667397eaa47b0a214e108b5afa32de | /gen/com/example/tipapp2/R.java | 748874bbbbc17ce50c2e85f7a5aed5218c706c8a | [] | no_license | fruit13ok/TipApp | 659039808767e0bfcaacd508121a7958af2c27fc | 9c8dc0aff83b462cabd2f7d7c8e62ccce9b9c890 | refs/heads/master | 2021-01-01T18:54:53.245732 | 2014-06-19T02:41:19 | 2014-06-19T02:41:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,784 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.tipapp2;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int despicable_me_minions=0x7f020000;
public static final int despicable_me_minions_icon=0x7f020001;
public static final int ic_launcher=0x7f020002;
}
public static final class id {
public static final int action_settings=0x7f08000c;
public static final int btn10pc=0x7f080001;
public static final int btn15pc=0x7f080003;
public static final int btn20pc=0x7f080004;
public static final int btnLoadTipRate=0x7f080006;
public static final int btnSaveTipRate=0x7f080008;
public static final int etBillAmount=0x7f080002;
public static final int etCustomTipPercentage=0x7f080005;
public static final int etSplit=0x7f080007;
public static final int rlTipApp=0x7f080000;
public static final int sbCustomTipPercentage=0x7f080009;
public static final int tvTipLabel=0x7f08000b;
public static final int tvTipResult=0x7f08000a;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int main=0x7f070000;
}
public static final class string {
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int btn10pc=0x7f050004;
public static final int btn15pc=0x7f050005;
public static final int btn20pc=0x7f050006;
public static final int btnLoadTipRate=0x7f05000c;
public static final int btnSaveTipRate=0x7f05000b;
public static final int etBillAmount=0x7f050003;
public static final int etCustomTipPercentage=0x7f050009;
public static final int etSplit=0x7f05000a;
public static final int hello_world=0x7f050002;
public static final int tvTipLabel=0x7f050007;
public static final int tvTipResult=0x7f050008;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
| [
"[email protected]"
] | |
af1cb9957503e0641a7d089a5645dfa88b49865a | 93749153b8a8c42e8233b3b13f5b5a2d6d70c308 | /Simulatable.java | 261edbb59945aec412ab7b94859caa64ca9f76d1 | [
"MIT"
] | permissive | RoydeZomer/Soccer-Visualisation | 627de6c43338a77f4ba32dde4d8abf5b07ced0ce | 7678586fb8e39c7f2cab66632eeefd224da07f3d | refs/heads/master | 2021-01-10T15:32:14.314215 | 2016-03-22T20:00:17 | 2016-03-22T20:00:17 | 54,502,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,615 | java | import processing.core.*;
public class Simulatable {
// Current Force, Acceleration, Speed and Position
protected PVector force = new PVector();
protected PVector accel = new PVector();
protected PVector speed = new PVector();
protected PVector position = new PVector();
// Real Acceleration and Speed
protected PVector realAccel = new PVector();
protected PVector realSpeed = new PVector();
public float getMass() {
return 1f;
}
public float getKFactor() {
return 1f;
}
/*
This method should return a force for the given dt
*/
public PVector getForce(float dt) {
return force.get();
}
/*
Returns the REAL Acceleration, Speed and Position
*/
public PVector getRealAccel() {
return realAccel.get();
}
public PVector getRealSpeed() {
return realSpeed.get();
}
public PVector getRealPosition() {
return position.get();
}
public void simulate(float dt) {
// Saves last Speed and Position to calculate the real Accel and Speed
PVector lastSpeed = speed.get();
PVector lastPosition = position.get();
// Simulate Acceleration
accel = getForce(dt);
accel.div(getMass());
force.set(0, 0);
// Simulate Speed
PVector dSpeed = accel.get();
dSpeed.mult(dt);
speed.add(dSpeed);
// Simulate Position
PVector dPos = speed.get();
dPos.mult(dt);
position.add(dPos);
// Calculate real Accel and Speed
realAccel = speed.get();
realAccel.sub(lastSpeed);
realAccel.div(dt);
realSpeed = position.get();
realSpeed.sub(lastPosition);
realSpeed.div(dt);
}
public boolean canCollide(Simulatable s) {
return true;
}
public boolean colliding(Simulatable that) {
if (this instanceof ShapeCircle && that instanceof ShapeCircle) {
float dist = PVector.sub(this.position, that.position).mag();
if (dist <= ((ShapeCircle)this).getRadius() + ((ShapeCircle)that).getRadius()) {
// System.out.println("Collide CIRCLE w CIRCLE: "+this+" with "+that);
return true;
}
} else if (this instanceof ShapeCircle && that instanceof ShapeRect ||
that instanceof ShapeCircle && this instanceof ShapeRect) {
PVector dist = PVector.sub(this.position, that.position);
ShapeCircle c = (ShapeCircle)(this instanceof ShapeCircle ? this : that);
ShapeRect r = (ShapeRect)(this instanceof ShapeRect ? this : that);
PVector cPos = ((Simulatable)c).position;
PVector rPos = ((Simulatable)r).position;
float radius = c.getRadius();
if ( cPos.x >= rPos.x - r.getWidth()/2 - radius &&
cPos.x <= rPos.x + r.getWidth()/2 + radius &&
cPos.y >= rPos.y - r.getHeight()/2 - radius &&
cPos.y <= rPos.y + r.getHeight()/2 + radius) {
// System.out.println("Collide BLOCK w CIRCLE: "+this+" with "+that);
// Rough check is OK, let's do the actual verification now
// Two cases for collision: some segment intersects circle,
// or circle inside rect
return true;//MathUtil.distCircleToRect(c, cPos, r, rPos) <= 0f ||
// MathUtil.pointInsideRect(cPos, r, rPos);
}
} else {
System.out.println("Exception: Cannot handle Collision with unknown types");
}
return false;
}
public void resolveCollision(Simulatable that) {
float thisMass = this.getMass();
float thatMass = that.getMass();
PVector thisSpeed = this.speed;
PVector thatSpeed = that.speed;
PVector P = PVector.sub(that.position, this.position);
float dist = 0f;
// Set back and find out normal reaction point
if (this instanceof ShapeCircle && that instanceof ShapeCircle) {
float thisRadius = ((ShapeCircle)this).getRadius();
float thatRadius = ((ShapeCircle)that).getRadius();
// set back both balls along collision direction so that they are just touching again
// Use their speed as "weighening" of this shift
dist = P.mag() - thisRadius - thatRadius;
// parallel vector in collision direction
P.normalize();
} else if (this instanceof ShapeCircle && that instanceof ShapeRect ||
that instanceof ShapeCircle && this instanceof ShapeRect) {
ShapeCircle c = (ShapeCircle)(this instanceof ShapeCircle ? this : that);
ShapeRect r = (ShapeRect)(this instanceof ShapeRect ? this : that);
PVector cPos = ((Simulatable) c).position;
PVector rPos = ((Simulatable) r).position;
//dist = MathUtil.distCircleToRect(c, cPos, r, rPos);
//PVector collisionPoint = MathUtil.closestToCircleInRect(c, cPos, r, rPos);
//P = PVector.sub(collisionPoint, cPos);
//P.normalize();
} else {
System.out.println("Impossible to collide: "+this+" with "+that);
}
// Correct overlapping by moving Simulatables
float thisMag = (this.canCollide(that) ? thisSpeed.mag(): 0);
float thatMag = (that.canCollide(this) ? thatSpeed.mag(): 0);
if (thisMag + thatMag <= 0.0) {
thisMag = 1f;
}
this.position.add(PVector.mult(P, dist * thisMag / (thisMag + thatMag)));
if (that.canCollide(this))
that.position.add(PVector.mult(P, dist * thatMag / (thisMag + thatMag) * -1));
if (Double.isNaN(force.x) ||
Double.isNaN(speed.x) ||
Double.isNaN(accel.x) ||
Double.isNaN(position.x) ||
Double.isNaN(P.x)) {
System.out.println("$$$COL "+this+"with"+that+" - "+force+""+accel+""+speed+""+position+""+P+" "+thisMag+"/"+thatMag);
}
// calculate speed components along and normal to collision direction
PVector N = new PVector(P.y, P.x * -1); // normal vector to collision direction
float vp1 = thisSpeed.dot(P); // velocity of P1 along collision direction
float vn1 = thisSpeed.dot(N); // velocity of P1 normal to collision direction
float vp2 = thatSpeed.dot(P); // velocity of P2 along collision direction
float vn2 = thatSpeed.dot(N); // velocity of P2 normal to collision direction
// calculate collison
// simple collision: "flip"
float massSum = (thisMass + thatMass);
float k = this.getKFactor() * that.getKFactor();
float vp1_after = 0;
float vp2_after = 0;
vp1_after = (-1)*((k) * thatMass * Math.abs(vp1-vp2) - thisMass * vp1 - thatMass*vp2) / massSum;
vp2_after = ((k) * thisMass * Math.abs(vp1-vp2) + thisMass * vp1 + thatMass*vp2) / massSum;
this.speed = PVector.add(PVector.mult(P, vp1_after), PVector.mult(N, vn1));
if (that.canCollide(this))
that.speed = PVector.add(PVector.mult(P, vp2_after), PVector.mult(N, vn2));
}
}
| [
"[email protected]"
] | |
20b7ac7b5a39f922f50c28f18604db2a9cb52592 | 63152c4f60c3be964e9f4e315ae50cb35a75c555 | /core/target/java/org/apache/spark/launcher/LauncherBackend$.java | 86f7bd49d5b6bae0d0024db85ba768657026f589 | [
"EPL-1.0",
"Classpath-exception-2.0",
"LicenseRef-scancode-unicode",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"GCC-exception-3.1",
"LGPL-2.0-or-later",
"CDDL-1.0",
"MIT",
"CC-BY-SA-3.0",
"NAIST-2003",
"LGPL-2.1-only",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-other-permissive",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"CPL-1.0",
"CC-PDDC",
"EPL-2.0",
"CDDL-1.1",
"BSD-2-Clause",
"CC0-1.0",
"Python-2.0",
"LicenseRef-scancode-unknown"
] | permissive | PowersYang/spark-cn | 76c407d774e35d18feb52297c68c65889a75a002 | 06a0459999131ee14864a69a15746c900e815a14 | refs/heads/master | 2022-12-11T20:18:37.376098 | 2020-03-30T09:48:22 | 2020-03-30T09:48:22 | 219,248,341 | 0 | 0 | Apache-2.0 | 2022-12-05T23:46:17 | 2019-11-03T03:55:17 | HTML | UTF-8 | Java | false | false | 370 | java | package org.apache.spark.launcher;
public class LauncherBackend$ {
/**
* Static reference to the singleton instance of this Scala object.
*/
public static final LauncherBackend$ MODULE$ = null;
public LauncherBackend$ () { throw new RuntimeException(); }
public java.util.concurrent.ThreadFactory threadFactory () { throw new RuntimeException(); }
}
| [
"[email protected]"
] | |
52ad018143d479ddc114758c2f071e07d419c48d | 11675a3aa173ce47ff99c751e10b4a176f0f8848 | /src/main/java/pl/quider/web/allegro/ArrayOfPriceinfotype.java | 6e0f507515729ac41139bbd3344e7cebee2a5859 | [] | no_license | Esmelealem/springWebPage | 41e708335c77b4021589d12fef432a557c796860 | 0484899b169e0ac66a83ee86875b1180e1eb090c | refs/heads/master | 2021-01-13T05:25:26.353167 | 2017-02-07T13:46:44 | 2017-02-07T13:46:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,747 | java |
package pl.quider.web.allegro;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ArrayOfPriceinfotype complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ArrayOfPriceinfotype">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="item" type="{urn:SandboxWebApi}PriceInfoType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfPriceinfotype", propOrder = {
"item"
})
public class ArrayOfPriceinfotype {
protected List<PriceInfoType> item;
/**
* Gets the value of the item property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the item property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getItem().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PriceInfoType }
*
*
*/
public List<PriceInfoType> getItem() {
if (item == null) {
item = new ArrayList<PriceInfoType>();
}
return this.item;
}
}
| [
"[email protected]"
] | |
3bf00138663a202eff5c7a6b2b60d21491e44488 | f0aeee071fd17fbd5dddb94efc62844f17ede27e | /app/src/main/java/com/maangalabs/android/frontscreen/CardViewHolder.java | a585eb5d51c20ab664524b2f47eedf0052a5a1e6 | [] | no_license | rohanreji/Ripple | d1c3af3943931c0ef07e150c453cbd9761ca8e6d | 8a149cec6f2bbd9481ef017594f3bed6676af450 | refs/heads/master | 2021-05-28T05:14:00.457679 | 2015-02-21T09:30:48 | 2015-02-21T09:30:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package com.maangalabs.android.frontscreen;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by rohan on 7/2/15.
*/
public class CardViewHolder extends RecyclerView.ViewHolder {
protected TextView vTitle;
protected ImageView im;
public CardViewHolder(View v) {
super(v);
vTitle = (TextView) v.findViewById(R.id.textView);
im= (ImageView) v.findViewById(R.id.imageView);
}
} | [
"[email protected]"
] | |
0d123412d0e512744582687e6190ecddab1c4d00 | e197d4e7b96814762bb313e40b743e353af41b46 | /src/com/github/xzzpig/mcpig/listener/TCPListener.java | 8c6b27be7dab4dcc4333b07dcd72ed8a4227879d | [] | no_license | xzzpig/MCPig | 0e15b9f08b05e85363ba803eae64c7731ac68e8c | 2b970201dbc3d2446e734329474b0cabaf58bd05 | refs/heads/master | 2021-01-17T12:44:39.395766 | 2016-05-15T15:40:53 | 2016-05-15T15:40:53 | 58,869,659 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.github.xzzpig.mcpig.listener;
import com.github.xzzpig.mcpig.Debuger;
import com.github.xzzpig.pigapi.customevent.ServerDataReachEvent;
import com.github.xzzpig.pigapi.event.EventHandler;
import com.github.xzzpig.pigapi.event.Listener;
public class TCPListener implements Listener {
@EventHandler
public void onServerDataReach(ServerDataReachEvent event){
Debuger.print(event.getClient().s.getInetAddress().getHostName()+":\n"+event.getData());
}
}
| [
"[email protected]"
] | |
f45dffa49fb82ba95df4a593d52c21ed0d46e061 | 8d2fcd8c2cc76675f37ad33147288635d9eb7b50 | /spring-server/src/main/java/io/swagger/api/UsuarioApiController.java | c0802803b63a1ad591b7d660d4779e9ff00eb6c1 | [] | no_license | Carla1/swagger-acme-v2 | 0e7d6f7c8ccee0fa1bc93069c967eb1c92bf10cf | 2fbe731c6b4e87ccbcc3e8a35d266e7e2000bc72 | refs/heads/master | 2022-12-06T01:54:02.702743 | 2020-08-12T20:05:47 | 2020-08-12T20:05:47 | 287,104,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,635 | java | package io.swagger.api;
import io.swagger.model.Cliente;
import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-08-12T19:39:06.828Z")
@Controller
public class UsuarioApiController implements UsuarioApi {
private static final Logger log = LoggerFactory.getLogger(UsuarioApiController.class);
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
@org.springframework.beans.factory.annotation.Autowired
public UsuarioApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
public ResponseEntity<Void> createusuario(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody Cliente body) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> createusuariosWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<Cliente> body) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> createusuariosWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<Cliente> body) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> deleteusuario(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("nome") String nome) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Cliente> getusuarioByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathVariable("nome") String nome) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/xml")) {
try {
return new ResponseEntity<Cliente>(objectMapper.readValue("<Cliente> <id>123456789</id> <nome>aeiou</nome> <cpf>aeiou</cpf> <data_nascimento>2000-01-23T04:56:07.000Z</data_nascimento></Cliente>", Cliente.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/xml", e);
return new ResponseEntity<Cliente>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
if (accept != null && accept.contains("application/json")) {
try {
return new ResponseEntity<Cliente>(objectMapper.readValue("{ \"endereco\" : { \"uf\" : \"uf\", \"cidade\" : \"cidade\", \"numero\" : 2, \"bairro\" : \"bairro\", \"logradouro\" : \"logradouro\", \"id\" : 5 }, \"data_nascimento\" : \"2000-01-23T04:56:07.000+00:00\", \"cpf\" : \"cpf\", \"nome\" : \"nome\", \"id\" : 5}", Cliente.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<Cliente>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<Cliente>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> updateusuario(@ApiParam(value = "name that need to be updated",required=true) @PathVariable("nome") String nome,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody Cliente body) {
String accept = request.getHeader("Accept");
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
}
| [
"[email protected]"
] | |
968833e525de3dea9d261e5012340f6be9a2104f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_ff823e51bb28291becba694560097f51640c388e/GroovyPagesServlet/2_ff823e51bb28291becba694560097f51640c388e_GroovyPagesServlet_s.java | 4de31205778578a5a39e8b4c1d9dbc1c6fc048bf | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 6,104 | java | /*
* Copyright 2004-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.groovy.grails.web.pages;
import groovy.lang.Writable;
import groovy.text.Template;
import java.io.IOException;
import java.io.Writer;
import java.net.URL;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.groovy.grails.web.errors.GrailsWrappedRuntimeException;
import org.codehaus.groovy.grails.web.servlet.DefaultGrailsApplicationAttributes;
import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes;
/**
* NOTE: Based on work done by on the GSP standalone project (https://gsp.dev.java.net/)
*
* Main servlet class. Example usage in web.xml:
* <servlet>
* <servlet-name>GroovyPagesServlet</servlet-name>
* <servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class>
* <init-param>
* <param-name>showSource</param-name>
* <param-value>1</param-value>
* <description>
* Allows developers to view the intermediade source code, when they pass
* a showSource argument in the URL (eg /edit/list?showSource=true.
* </description>
* </init-param>
* </servlet>
*
* @author Troy Heninger
* @author Graeme Rocher
* Date: Jan 10, 2004
*
*/
public class GroovyPagesServlet extends HttpServlet /*implements GroovyObject*/ {
private static final Log LOG = LogFactory.getLog(GroovyPagesServlet.class);
private ServletContext context;
private boolean showSource = false;
private static ClassLoader parent;
private GroovyPagesTemplateEngine engine;
private GrailsApplicationAttributes grailsAttributes;
/**
* @return the servlet context
*/
public ServletContext getServletContext() { return context; }
/**
* Initialize the servlet, set it's parameters.
* @param config servlet settings
*/
public void init(ServletConfig config) {
// Get the servlet context
context = config.getServletContext();
context.log("GSP servlet initialized");
// Ensure that we use the correct classloader so that we can find
// classes in an application server.
parent = Thread.currentThread().getContextClassLoader();
if (parent == null) parent = getClass().getClassLoader();
showSource = config.getInitParameter("showSource") != null;
this.grailsAttributes = new DefaultGrailsApplicationAttributes(context);
} // init()
/**
* Handle HTTP GET requests.
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPage(request, response);
} // doGet()
/**
* Handle HTTP POST requests.
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPage(request, response);
} // doPost()
/**
* Execute page and produce output.
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void doPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setAttribute(GrailsApplicationAttributes.REQUEST_SCOPE_ID, grailsAttributes);
this.engine = grailsAttributes.getPagesTemplateEngine();
this.engine.setShowSource(this.showSource);
String pageId = (String)request.getAttribute(GrailsApplicationAttributes.GSP_TO_RENDER);
if(pageId == null)
pageId = engine.getPageId(request);
URL pageUrl = engine.getPageUrl(context,pageId);
if (pageUrl == null) {
context.log("GroovyPagesServlet: \"" + pageUrl + "\" not found");
response.sendError(404, "\"" + pageUrl + "\" not found.");
return;
}
Template t = engine.createTemplate(context,request,response);
if(t == null) {
context.log("GroovyPagesServlet: \"" + pageUrl + "\" not found");
response.sendError(404, "\"" + pageUrl + "\" not found.");
return;
}
Writable w = t.make();
Writer out = GSPResonseWriter.getInstance(response, 8192);
try {
w.writeTo(out);
}
catch(Exception e) {
LOG.debug("Error processing GSP: " + e.getMessage(), e);
request.setAttribute("exception",new GrailsWrappedRuntimeException(context,e));
RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/grails-app/views/error.jsp");
if(response.isCommitted()) {
rd.include(request,response);
}
else {
rd.forward(request,response);
}
}
finally {
if (out != null) out.close();
}
} // doPage()
}
| [
"[email protected]"
] | |
23cfd7865be75255656fa8f41015582e9cbd1cde | 0e1e1fcd00bfbd06963df3e031c131043783e071 | /my-pet-clinic-data/src/main/java/de/alexanderkaden/mypetclinic/model/BaseEntity.java | f03e3733e38b4d9f164871d94dbbedb4e49b0d5a | [] | no_license | aykay87/my-pet-clinic | 05593d702c2d1d0ec4652758b27ecc6100338d72 | 6603b75d0b69d4dc0679ba5f6dfd70e47c3b665f | refs/heads/master | 2020-03-27T12:54:41.500618 | 2018-09-02T15:10:49 | 2018-09-02T15:10:49 | 146,577,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 264 | java | package de.alexanderkaden.mypetclinic.model;
import java.io.Serializable;
public class BaseEntity implements Serializable {
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
| [
"[email protected]"
] | |
41fa55231a2aaccf720f5a5e65b3f1ad84c9d78c | cec1602d23034a8f6372c019e5770773f893a5f0 | /sources/com/sweetzpot/stravazpot/athlete/model/Power.java | e6204de4db25e59315cbbce6aa979adf4b074d3c | [] | no_license | sengeiou/zeroner_app | 77fc7daa04c652a5cacaa0cb161edd338bfe2b52 | e95ae1d7cfbab5ca1606ec9913416dadf7d29250 | refs/heads/master | 2022-03-31T06:55:26.896963 | 2020-01-24T09:20:37 | 2020-01-24T09:20:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package com.sweetzpot.stravazpot.athlete.model;
import com.google.gson.annotations.SerializedName;
import com.sweetzpot.stravazpot.common.model.Interval;
import java.util.List;
public class Power {
@SerializedName("zones")
private List<Interval<Float>> zones;
public List<Interval<Float>> getZones() {
return this.zones;
}
}
| [
"[email protected]"
] | |
02ef91db8e368d55ff2dc85c056ffca8052fc92e | e5fcecd08dc30e947cf11d1440136994226187c6 | /SpagoBIQbeEngine/src/main/java/it/eng/spagobi/engines/qbe/services/core/ValidateExpressionAction.java | 8c954733f7539325abc7295bf48f38d2c15c753b | [] | no_license | skoppe/SpagoBI | 16851fa5a6949b5829702eaea2724cee0629560b | 7a295c096e3cca9fb53e5c125b9566983472b259 | refs/heads/master | 2021-05-05T10:18:35.120113 | 2017-11-27T10:26:44 | 2017-11-27T10:26:44 | 104,053,911 | 0 | 0 | null | 2017-09-19T09:19:44 | 2017-09-19T09:19:43 | null | UTF-8 | Java | false | false | 8,135 | java | /* SpagoBI, the Open Source Business Intelligence suite
* Copyright (C) 2012 Engineering Ingegneria Informatica S.p.A. - SpagoBI Competency Center
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, without the "Incompatible With Secondary Licenses" notice.
* If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package it.eng.spagobi.engines.qbe.services.core;
import it.eng.qbe.runtime.script.groovy.GroovyScriptAPI;
import it.eng.spago.base.SourceBean;
import it.eng.spagobi.commons.bo.UserProfile;
import it.eng.spagobi.utilities.assertion.Assert;
import it.eng.spagobi.utilities.engines.EngineConstants;
import it.eng.spagobi.utilities.engines.SpagoBIEngineServiceException;
import it.eng.spagobi.utilities.engines.SpagoBIEngineServiceExceptionHandler;
import it.eng.spagobi.utilities.groovy.GroovySandbox;
import it.eng.spagobi.utilities.service.JSONAcknowledge;
import it.eng.spagobi.utilities.service.JSONFailure;
import it.eng.spagobi.utilities.service.JSONResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
/**
*
* @author Andrea Gioia ([email protected])
*/
public class ValidateExpressionAction extends AbstractQbeEngineAction {
public static final String EXPRESSION = "expression";
public static final String FIELDS = "fields";
public static final String SERVICE_NAME = "VALIDATE_EXPRESSION_ACTION";
@Override
public String getActionName() {
return SERVICE_NAME;
}
/** Logger component. */
public static transient Logger logger = Logger.getLogger(ValidateExpressionAction.class);
@Override
public void service(SourceBean request, SourceBean response) {
String expression;
JSONArray fieldsJSON;
// filed in context (mapped by unique name and by alias)
Set availableDMFields;
Set availableQFields;
// unresolved field reference errors stack
List uresolvedReferenceErrors;
List items;
Pattern seedPattern;
Matcher seedMatcher;
// bindings
Map attributes;
Map parameters;
Map qFields;
Map dmFields;
logger.debug("IN");
try {
super.service(request, response);
expression = getAttributeAsString(EXPRESSION);
logger.debug("Parameter [" + EXPRESSION + "] is equals to [" + expression + "]");
Assert.assertNotNull(expression, "Parameter [" + EXPRESSION + "] cannot be null in oder to execute " + this.getActionName() + " service");
fieldsJSON = getAttributeAsJSONArray(FIELDS);
logger.debug("Parameter [" + FIELDS + "] is equals to [" + fieldsJSON + "]");
Assert.assertNotNull(fieldsJSON, "Parameter [" + FIELDS + "] cannot be null in oder to execute " + this.getActionName() + " service");
availableQFields = new HashSet();
availableDMFields = new HashSet();
for (int i = 0; i < fieldsJSON.length(); i++) {
JSONObject field = fieldsJSON.getJSONObject(i);
availableDMFields.add(field.getString("uniqueName"));
availableQFields.add(field.getString("alias"));
}
attributes = new HashMap();
UserProfile profile = (UserProfile) this.getEnv().get(EngineConstants.ENV_USER_PROFILE);
Iterator it = profile.getUserAttributeNames().iterator();
while (it.hasNext()) {
String attributeName = (String) it.next();
Object attributeValue = profile.getUserAttribute(attributeName);
attributes.put(attributeName, attributeValue);
}
parameters = this.getEnv();
// check for unresolved reference first
uresolvedReferenceErrors = new ArrayList();
seedPattern = Pattern.compile("'[^']*'");
// ... in fields
items = new ArrayList();
items.addAll(extractItems("fields", expression));
items.addAll(extractItems("qFields", expression));
items.addAll(extractItems("dmFields", expression));
qFields = new HashMap();
dmFields = new HashMap();
for (int i = 0; i < items.size(); i++) {
String item = (String) items.get(i);
seedMatcher = seedPattern.matcher(item);
seedMatcher.find();
String seed = seedMatcher.group().substring(1, seedMatcher.group().length() - 1);
if (!availableQFields.contains(seed) && !availableDMFields.contains(seed)) {
uresolvedReferenceErrors.add("Impossible to resolve reference to filed: " + item);
}
if (item.trim().startsWith("dmFields")) {
dmFields.put(seed, 1000);
} else {
qFields.put(seed, 1000);
}
}
// ... in attributes
items = new ArrayList();
items.addAll(extractItems("attributes", expression));
for (int i = 0; i < items.size(); i++) {
String item = (String) items.get(i);
seedMatcher = seedPattern.matcher(item);
seedMatcher.find();
String seed = seedMatcher.group().substring(1, seedMatcher.group().length() - 1);
if (!attributes.containsKey(seed)) {
uresolvedReferenceErrors.add("Impossible to resolve reference to attribute: " + item);
}
}
// ... in parameters
items = new ArrayList();
items.addAll(extractItems("parameters", expression));
for (int i = 0; i < items.size(); i++) {
String item = (String) items.get(i);
seedMatcher = seedPattern.matcher(item);
seedMatcher.find();
String seed = seedMatcher.group().substring(1, seedMatcher.group().length() - 1);
if (!parameters.containsKey(seed)) {
uresolvedReferenceErrors.add("Impossible to resolve reference to parameter: " + item);
}
}
JSONResponse jsonResponse = null;
if (uresolvedReferenceErrors.size() > 0) {
SpagoBIEngineServiceException validationException;
String msg = "Unresolved reference error: ";
for (int i = 0; i < uresolvedReferenceErrors.size(); i++) {
String error = (String) uresolvedReferenceErrors.get(i);
msg += "\n" + error + "; ";
}
validationException = new SpagoBIEngineServiceException(getActionName(), msg);
jsonResponse = new JSONFailure(validationException);
} else {
Map<String, Object> bindings = new HashMap<String, Object>();
// bindings ...
bindings.put("attributes", attributes);
bindings.put("parameters", parameters);
bindings.put("qFields", qFields);
bindings.put("dmFields", dmFields);
bindings.put("fields", qFields);
bindings.put("api", new GroovyScriptAPI());
Object calculatedValue = null;
try {
GroovySandbox gs = new GroovySandbox(new Class[] { GroovyScriptAPI.class });
gs.setBindings(bindings);
calculatedValue = gs.evaluate(expression);
jsonResponse = new JSONAcknowledge();
} catch (Exception e) {
SpagoBIEngineServiceException validationException;
Throwable t = e;
String msg = t.getMessage();
while ((msg = t.getMessage()) == null && t.getCause() != null)
t = t.getCause();
if (msg == null)
msg = e.toString();
// msg = "Syntatic error at line:" + e.getLineNumber() + ", column:" + e.getColumnNumber() + ". Error details: " + msg;
validationException = new SpagoBIEngineServiceException(getActionName(), msg, e);
jsonResponse = new JSONFailure(validationException);
// logger.error("validation error", e);
}
}
try {
writeBackToClient(jsonResponse);
} catch (IOException e) {
String message = "Impossible to write back the responce to the client";
throw new SpagoBIEngineServiceException(getActionName(), message, e);
}
} catch (Throwable t) {
throw SpagoBIEngineServiceExceptionHandler.getInstance().getWrappedException(getActionName(), getEngineInstance(), t);
} finally {
logger.debug("OUT");
}
}
private List extractItems(String itemGroupName, String expression) {
List items;
Pattern itemPattern;
Matcher itemMatcher;
items = new ArrayList();
itemPattern = Pattern.compile(itemGroupName + "\\['[^']+'\\]");
itemMatcher = itemPattern.matcher(expression);
while (itemMatcher.find()) {
items.add(itemMatcher.group());
}
return items;
}
}
| [
"[email protected]"
] | |
1edf3b30d523662076743180488b9015acbd549f | 099df70b95db8c3902ebdf05cb561f9b8024d302 | /app/src/main/java/org/twinone/util/DialogSequencer.java | f46b6b50f8ad3c2670d7f61906d2b7bafcc1d646 | [] | no_license | rohitshampur/AppLocker | 3d04c34b74850574e90ca8a5947caf89e8f33387 | c66b265eddf427dfa1685e9a935307362af66d59 | refs/heads/master | 2021-01-16T20:07:00.412604 | 2015-08-10T21:41:25 | 2015-08-10T21:41:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,442 | java | package org.twinone.util;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import java.util.ArrayList;
import java.util.List;
/**
* Utility class to display some Android dialogs in sequence.
* <p/>
* Using this class your {@link DialogInterface.OnDismissListener} will be
* remapped to
*
* @author Twinone
*/
public class DialogSequencer {
// private Context mContext;
private final List<DialogInterface> mDialogs;
private DialogSequenceListener mListener;
private int mCurrentDialog = 0;
private final OnDismissListener mOnDismissListener = new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (mListener != null) {
mListener.onDismiss(dialog, mCurrentDialog);
}
displayNext();
}
};
public DialogSequencer() {
// mContext = context;
mDialogs = new ArrayList<>();
}
public DialogSequencer(DialogSequenceListener listener) {
this();
mListener = listener;
}
public int size() {
return mDialogs.size();
}
public void setListener(DialogSequenceListener listener) {
mListener = listener;
}
/**
* @param dialog The dialog to add. <br>
* <b>Warning: </b> Don't use this {@link Dialog}'s
* {@link Dialog#setOnDismissListener(OnDismissListener)} This
* library needs the listener know when the dialog has been
* dismissed. use
* {@link DialogSequenceListener#onDismiss(DialogInterface, int)}
* .
* @return
*/
public DialogSequencer addDialog(Dialog dialog) {
if (dialog != null) {
mDialogs.add(dialog);
dialog.setOnDismissListener(mOnDismissListener);
}
return this;
}
public DialogSequencer addDialogs(Dialog... dialogs) {
if (dialogs != null) {
for (Dialog d : dialogs) {
addDialog(d);
}
}
return this;
}
/**
* Always call stop in {@link Activity#onResume()}, to hide dialogs that
* were still open.
* <p/>
* <br>
* This will do nothing if there are no dialogs left
*
* @return
*/
public DialogSequencer start() {
displayNext();
return this;
}
private void displayNext() {
if (mCurrentDialog == mDialogs.size()) {
return;
}
DialogInterface d = mDialogs.get(mCurrentDialog);
((Dialog) d).show();
if (mListener != null) {
mListener.onShow(d, mCurrentDialog);
}
mCurrentDialog++;
}
/**
* Remove next dialog in the {@link DialogSequencer} <br>
* If you're running this from in a #{@link DialogInterface.OnClickListener}
* you can use the {@link DialogInterface} provided to you.
*
* @param dialog A reference to the current Dialog to determine its position
*/
public void removeNext(DialogInterface dialog) {
mDialogs.remove(mDialogs.indexOf(dialog) + 1);
}
public int indexOf(DialogInterface dialog) {
return mDialogs.indexOf(dialog);
}
/**
* Don't show any more dialogs.
*/
void cancel() {
mCurrentDialog = mDialogs.size();
}
void remove(int index) {
if (index < 0 || index > mDialogs.size()) {
return;
}
if (index < mCurrentDialog) {
mCurrentDialog--;
}
mDialogs.remove(index);
}
/**
* Go to this position in the list
*
* @param index
* @param wait False to go directly to the specified dialog, false to wait
* until current dialog is dismissed.
*/
void gotoDialog(int index, boolean wait) {
int oldIndex = mCurrentDialog;
mCurrentDialog = index;
if (!wait) {
mDialogs.get(oldIndex).dismiss();
}
}
/**
* Go to this dialog in the list
*
* @param dialog The dialog to go to, if the same dialog was added multiple
* times, this will go to the first occurrence.
* @param wait False to go directly to the specified dialog, false to wait
* until current dialog is dismissed.
*/
public void gotoDialog(Dialog dialog, boolean wait) {
gotoDialog(mDialogs.indexOf(dialog), wait);
}
public void insert(Dialog dialog, int index) {
if (index <= mCurrentDialog) {
mCurrentDialog++;
}
mDialogs.add(index, dialog);
}
/**
* Insert a dialog just after the currently displayed dialog
*
* @param dialog
*/
public void insert(Dialog dialog) {
mDialogs.add(mCurrentDialog + 1, dialog);
}
public void remove(Dialog d) {
remove(mDialogs.indexOf(d));
}
public void stop() {
cancel();
for (DialogInterface d : mDialogs) {
d.dismiss();
}
}
public interface DialogSequenceListener {
/**
* A dialog has been shown
*
* @param dialog
*/
void onShow(DialogInterface dialog, int position);
void onDismiss(DialogInterface dialog, int position);
}
}
| [
"[email protected]"
] | |
27e476542fbde729ef8933e7028ea826a64b75b8 | 59ca721ca1b2904fbdee2350cd002e1e5f17bd54 | /aliyun-java-sdk-ccc/src/main/java/com/aliyuncs/ccc/transform/v20170705/GetNumberRegionInfoResponseUnmarshaller.java | b1f84fb03bf9e8736520cfb4862328705a0036d7 | [
"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,870 | 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.ccc.transform.v20170705;
import com.aliyuncs.ccc.model.v20170705.GetNumberRegionInfoResponse;
import com.aliyuncs.ccc.model.v20170705.GetNumberRegionInfoResponse.PhoneNumber;
import com.aliyuncs.transform.UnmarshallerContext;
public class GetNumberRegionInfoResponseUnmarshaller {
public static GetNumberRegionInfoResponse unmarshall(GetNumberRegionInfoResponse getNumberRegionInfoResponse, UnmarshallerContext context) {
getNumberRegionInfoResponse.setRequestId(context.stringValue("GetNumberRegionInfoResponse.RequestId"));
getNumberRegionInfoResponse.setSuccess(context.booleanValue("GetNumberRegionInfoResponse.Success"));
getNumberRegionInfoResponse.setCode(context.stringValue("GetNumberRegionInfoResponse.Code"));
getNumberRegionInfoResponse.setMessage(context.stringValue("GetNumberRegionInfoResponse.Message"));
PhoneNumber phoneNumber = new PhoneNumber();
phoneNumber.setNumber(context.stringValue("GetNumberRegionInfoResponse.PhoneNumber.Number"));
phoneNumber.setProvince(context.stringValue("GetNumberRegionInfoResponse.PhoneNumber.Province"));
phoneNumber.setCity(context.stringValue("GetNumberRegionInfoResponse.PhoneNumber.City"));
getNumberRegionInfoResponse.setPhoneNumber(phoneNumber);
return getNumberRegionInfoResponse;
}
} | [
"[email protected]"
] | |
2be81e2f211977424576872b5355b7217ad1eb07 | b7439338623fce86fcff2001c8203ebceb9ea51e | /WhatsApp/app/src/main/java/com/muneiah/example/whatsapp/StartActivity.java | 4f3b7a05ff79788a10340efb325dae63a133afb3 | [] | no_license | ourfriendsprojects/OurFirstRepo | 94fec945c14dc629636bb89a3f646037de73c280 | 53c87815553d8ca6f33602cc5bcb8f449ce070b3 | refs/heads/master | 2023-06-06T17:50:05.051755 | 2021-07-14T11:01:45 | 2021-07-14T11:01:45 | 311,347,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package com.muneiah.example.whatsapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class StartActivity extends AppCompatActivity {
Button mRegButton,mLogin_AlreadyAcct;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
mRegButton=findViewById(R.id.button_reg);
mLogin_AlreadyAcct=findViewById(R.id.button_alredy_acct);
mLogin_AlreadyAcct.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent loginIntent=new Intent(getApplicationContext(),LoginActivity.class);
startActivity(loginIntent);
}
});
mRegButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent reg_intent=new Intent(getApplicationContext(),RegisterActivity.class);
startActivity(reg_intent);
}
});
}
}
| [
"[email protected]"
] | |
262afa4d1061e95b2790ad8fd628aa066c574794 | 61f06aae402e885f8e9954c87c8904275b97becc | /src/main/java/ru/sbrf/shareholderbot/service/LocaleMessageService.java | 4939ee00522b127e5f0eceb7aa9f63e830198129 | [] | no_license | mrchuvyzgalov/ShareholderBot | 8e0bdbc7118b27ed9d36027f78d48541228868cd | 3ba510500354873f7d3db37e40a68cf6f3d7286b | refs/heads/main | 2023-07-06T20:11:14.321201 | 2021-08-22T18:47:10 | 2021-08-22T18:47:10 | 396,690,002 | 0 | 0 | null | 2021-08-22T18:47:11 | 2021-08-16T08:10:56 | Java | UTF-8 | Java | false | false | 848 | java | package ru.sbrf.shareholderbot.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Service;
import java.util.Locale;
@Service
public class LocaleMessageService {
private final Locale locale;
private final MessageSource messageSource;
public LocaleMessageService(@Value("${localeTag}") String localeTag, MessageSource messageSource) {
this.locale = Locale.forLanguageTag(localeTag);
this.messageSource = messageSource;
}
public String getMessage(String message) {
return messageSource.getMessage(message, null, locale);
}
public String getMessage(String message, Object... args) {
return messageSource.getMessage(message, args, locale);
}
}
| [
"[email protected]"
] | |
a08c0d9bb443802ad9de8d0c01cec140a858b254 | 2eea615ae45cf8743c9172f2f7a00d2b20c5f131 | /WEB-INF/classes/com/thinking/machines/webrock/annotations/SecuredAccess.java | bbc630865192cf9f28b3a60595a45f2cc430d174 | [] | no_license | harshit012/Web_Services_Framework | de08fab629e51b2c3ecddc56c7793e1baa06257a | f8bd2874c3d54f8127c494852f52d81ffcd65c05 | refs/heads/master | 2023-04-11T11:11:09.715611 | 2021-04-20T12:52:10 | 2021-04-20T12:52:10 | 351,510,238 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.thinking.machines.webrock.annotations;
import java.lang.annotation.*;
import java.lang.reflect.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(value={ElementType.METHOD,ElementType.TYPE})
public @interface SecuredAccess
{
String checkPost() default "";
String guard() default "";
}
| [
"harshit012"
] | harshit012 |
6ab01d8e913b077ac4d69244177e4ff8e7dcf511 | 6ae307399ef9cf162620acc59ca0c76ab6c06d2a | /forge/mcp/temp/src/minecraft/net/minecraft/world/storage/MapCoord.java | f40061624f06ebfc508c70ec4390608cc013b829 | [
"BSD-3-Clause"
] | permissive | SuperStarGamesNetwork/IronManMod | b153ee5024066bf1ea74d7e2fc88848044801b30 | 6ae7ae4bb570e95a28048b991dec9e126da3d5e3 | refs/heads/master | 2021-01-16T18:29:24.771631 | 2014-08-08T14:08:52 | 2014-08-08T14:08:52 | 15,351,078 | 1 | 0 | null | 2013-12-21T04:20:44 | 2013-12-21T00:00:10 | Java | UTF-8 | Java | false | false | 622 | java | package net.minecraft.world.storage;
import net.minecraft.world.storage.MapData;
public class MapCoord {
public byte field_76216_a;
public byte field_76214_b;
public byte field_76215_c;
public byte field_76212_d;
// $FF: synthetic field
final MapData field_76213_e;
public MapCoord(MapData p_i2139_1_, byte p_i2139_2_, byte p_i2139_3_, byte p_i2139_4_, byte p_i2139_5_) {
this.field_76213_e = p_i2139_1_;
this.field_76216_a = p_i2139_2_;
this.field_76214_b = p_i2139_3_;
this.field_76215_c = p_i2139_4_;
this.field_76212_d = p_i2139_5_;
}
}
| [
"[email protected]"
] | |
ea498475ae7661a8ffdee1010fcf989532c0d053 | 412073592eadc1a8835dbc4b47fd5dcbd810c070 | /domain/src/main/java/net/kemitix/thorp/domain/channel/Channel.java | 06d7e7b35c72438dc57983f49e92a7643fbba05a | [
"MIT"
] | permissive | kemitix/thorp | be1d70677909fe2eeb328128fb28ee6b2499bf2a | 8c5c84c1d8fede9e092b28de65bea45840f943d0 | refs/heads/master | 2022-12-11T22:10:47.251527 | 2022-12-03T11:49:19 | 2022-12-03T12:08:17 | 185,944,622 | 2 | 1 | MIT | 2022-12-03T12:08:59 | 2019-05-10T07:55:16 | Java | UTF-8 | Java | false | false | 748 | java | package net.kemitix.thorp.domain.channel;
import java.util.Collection;
import java.util.function.Consumer;
public interface Channel<T> extends Sink<T> {
static <T> Channel<T> create(String name) {
return new ChannelImpl<>(name, false);
}
static <T> Channel<T> createWithTracing(String name) {
return new ChannelImpl<>(name, true);
}
Channel<T> start();
Channel<T> add(T item);
Channel<T> addAll(Collection<T> items);
Channel<T> addListener(Listener<T> listener);
Channel<T> removeListener(Listener<T> listener);
Channel<T> run(Consumer<Sink<T>> program);
void shutdown();
void shutdownNow() throws InterruptedException;
void waitForShutdown() throws InterruptedException;
}
| [
"[email protected]"
] | |
a944b5abfd792c8028611ecf719b139b4102a5d3 | eb1f898cdda5bff9c3927a2e668c58f9065db5e8 | /m19/app/exception/NoSuchUserException.java | 50ec5f3d7514d35510e82c875dca48999dd298d7 | [] | no_license | ddavness/IST-PO-1920 | 8563518960bc050a9c89991c796340938e6c6828 | 79328c71ede4efa52c368bb3e49067618faede64 | refs/heads/master | 2020-07-27T14:03:21.192639 | 2020-01-23T21:25:19 | 2020-01-23T21:25:19 | 209,116,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 605 | java | package m19.app.exception;
import pt.tecnico.po.ui.DialogException;
/**
* Class encoding reference to an invalid user id.
*/
public class NoSuchUserException extends DialogException {
/** Serial number for serialization. */
static final long serialVersionUID = 201901091828L;
/**
* Bad user id.
*/
private int _id;
/**
* @param id
*/
public NoSuchUserException(int id) {
_id = id;
}
/** @see pt.tecnico.po.ui.DialogException#getMessage() */
@Override
public String getMessage() {
return Message.noSuchUser(_id);
}
}
| [
"[email protected]"
] | |
2d30213d67bc063f0ec9ee3d3d0bf5bcfee65c20 | 0c8d1286cee11268020f7a673cf8f22a948ad6d5 | /DaysOfMonth.java | 8cc2a6bbeaf08059e7107582d8374ee1c914b7d9 | [] | no_license | vuchtbk272000/OOLT.ICT.20202.20184332.NguyenTrinhVu | 77cc25b186d185383ee2aebeb1a452d509daa882 | 4ba2444126c138edbf110c4835374c184a45c133 | refs/heads/master | 2023-04-26T00:56:34.684526 | 2021-03-27T15:03:04 | 2021-03-27T15:03:04 | 342,426,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,734 | java | package lab01;
import java.util.Scanner;
public class DaysOfMonth {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("input year");
int iyear = keyboard.nextInt();
String s;
s = keyboard.nextLine();
int day=0;
String smonth;
do{
System.out.println("input month");
smonth= keyboard.nextLine();
System.out.println("___"+smonth+"____");
}
while ((smonth != "Jan.") && (smonth != "Feb.") && (smonth != "Mar.") && (smonth != "Apr.") && (smonth != "May") && (smonth != "June") && (smonth != "July") && (smonth != "Aug.") && (smonth != "Sep.") && (smonth != "Oct.") && (smonth != "Nov.") && (smonth != "Dec.") &&
(smonth != "Jan") && (smonth != "Feb") && (smonth != "Mar") && (smonth != "Apr") && (smonth != "May") && (smonth != "Jun") && (smonth != "Jul") && (smonth != "Aug") && (smonth != "Sep") && (smonth != "Oct") && (smonth != "Nov") && (smonth != "Dec") &&
(smonth != "1") && (smonth != "2") && (smonth != "3") && (smonth != "4") && (smonth != "5") && (smonth != "6") && (smonth != "7") && (smonth != "8") && (smonth != "9") && (smonth != "10") && (smonth != "11") && (smonth != "12"));
if ((smonth == "Feb") ||(smonth == "Feb.") || (smonth == "2")) {
if (iyear%4 == 0) {
day = 29;}
else day = 28;
System.out.println(day);
}
else if ((smonth == "Apr.") || (smonth == "Apr") || (smonth == "4") || (smonth == "Jun.") || (smonth == "Jun") || (smonth == "6") || (smonth == "Sep.") || (smonth == "Sep") || (smonth == "9") || (smonth == "Nov.") || (smonth == "Nov") || (smonth == "11") ) {
day = 30;
System.out.println(day);
}
else {System.out.println(smonth);
day =31;}
System.out.println(day);
}
}
| [
"[email protected]"
] | |
e3d6a4a84df139dad039e2ebb3dbd045cbda3f3c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_2e40b8cb11db3a57481bbb1cdaeab84450e080f8/PaModule/2_2e40b8cb11db3a57481bbb1cdaeab84450e080f8_PaModule_t.java | ec7f467351461f9c2393641900dd43a9aed674c7 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 10,462 | java | package org.atlasapi.remotesite.pa;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.annotation.PostConstruct;
import org.atlasapi.feeds.upload.persistence.FileUploadResultStore;
import org.atlasapi.feeds.upload.persistence.MongoFileUploadResultStore;
import org.atlasapi.media.channel.ChannelGroupResolver;
import org.atlasapi.media.channel.ChannelGroupWriter;
import org.atlasapi.media.channel.ChannelResolver;
import org.atlasapi.media.channel.ChannelWriter;
import org.atlasapi.media.entity.Publisher;
import org.atlasapi.persistence.content.ContentGroupResolver;
import org.atlasapi.persistence.content.ContentGroupWriter;
import org.atlasapi.persistence.content.ContentResolver;
import org.atlasapi.persistence.content.ContentWriter;
import org.atlasapi.persistence.content.PeopleResolver;
import org.atlasapi.persistence.content.ScheduleResolver;
import org.atlasapi.persistence.content.people.ItemsPeopleWriter;
import org.atlasapi.persistence.content.people.PersonWriter;
import org.atlasapi.persistence.content.schedule.mongo.ScheduleWriter;
import org.atlasapi.persistence.logging.AdapterLog;
import org.atlasapi.persistence.logging.AdapterLogEntry;
import org.atlasapi.persistence.logging.AdapterLogEntry.Severity;
import org.atlasapi.remotesite.channel4.epg.BroadcastTrimmer;
import org.atlasapi.remotesite.channel4.epg.ScheduleResolverBroadcastTrimmer;
import org.atlasapi.remotesite.pa.channels.PaChannelDataHandler;
import org.atlasapi.remotesite.pa.channels.PaChannelGroupsIngester;
import org.atlasapi.remotesite.pa.channels.PaChannelsIngester;
import org.atlasapi.remotesite.pa.channels.PaChannelsUpdater;
import org.atlasapi.remotesite.pa.data.DefaultPaProgrammeDataStore;
import org.atlasapi.remotesite.pa.data.PaProgrammeDataStore;
import org.atlasapi.remotesite.pa.features.PaFeaturesProcessor;
import org.atlasapi.remotesite.pa.features.PaFeaturesUpdater;
import org.atlasapi.remotesite.pa.people.PaCompletePeopleUpdater;
import org.atlasapi.remotesite.pa.people.PaDailyPeopleUpdater;
import org.atlasapi.remotesite.pa.persistence.MongoPaScheduleVersionStore;
import org.atlasapi.remotesite.pa.persistence.PaScheduleVersionStore;
import org.atlasapi.remotesite.rt.RtFilmModule;
import org.atlasapi.s3.DefaultS3Client;
import org.atlasapi.s3.S3Client;
import org.joda.time.Duration;
import org.joda.time.LocalTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.metabroadcast.common.persistence.mongo.DatabasedMongo;
import com.metabroadcast.common.scheduling.RepetitionRule;
import com.metabroadcast.common.scheduling.RepetitionRules;
import com.metabroadcast.common.scheduling.SimpleScheduler;
import com.metabroadcast.common.security.UsernameAndPassword;
@Configuration
@Import(RtFilmModule.class)
public class PaModule {
private final static RepetitionRule PEOPLE_COMPLETE_INGEST = RepetitionRules.NEVER;
private final static RepetitionRule PEOPLE_INGEST = RepetitionRules.daily(LocalTime.MIDNIGHT);
private final static RepetitionRule CHANNELS_INGEST = RepetitionRules.every(Duration.standardHours(12));
private final static RepetitionRule FEATURES_INGEST = RepetitionRules.daily(LocalTime.MIDNIGHT);
private final static RepetitionRule RECENT_FILE_INGEST = RepetitionRules.every(Duration.standardMinutes(10)).withOffset(Duration.standardMinutes(15));
private final static RepetitionRule RECENT_FILE_DOWNLOAD = RepetitionRules.every(Duration.standardMinutes(10));
private final static RepetitionRule COMPLETE_INGEST = RepetitionRules.NEVER;//weekly(DayOfWeek.FRIDAY, new LocalTime(22, 0, 0));
private @Autowired SimpleScheduler scheduler;
private @Autowired ContentWriter contentWriter;
private @Autowired ContentResolver contentResolver;
private @Autowired ContentGroupWriter contentGroupWriter;
private @Autowired ContentGroupResolver contentGroupResolver;
private @Autowired PeopleResolver personResolver;
private @Autowired PersonWriter personWriter;
private @Autowired ChannelGroupWriter channelGroupWriter;
private @Autowired ChannelGroupResolver channelGroupResolver;
private @Autowired AdapterLog log;
private @Autowired ScheduleResolver scheduleResolver;
private @Autowired ItemsPeopleWriter peopleWriter;
private @Autowired ScheduleWriter scheduleWriter;
private @Autowired ChannelResolver channelResolver;
private @Autowired ChannelWriter channelWriter;
private @Autowired DatabasedMongo mongo;
// to ensure the complete and daily people ingest jobs are not run simultaneously
private final Lock peopleLock = new ReentrantLock();
private @Value("${pa.ftp.username}") String ftpUsername;
private @Value("${pa.ftp.password}") String ftpPassword;
private @Value("${pa.ftp.host}") String ftpHost;
private @Value("${pa.ftp.path}") String ftpPath;
private @Value("${pa.filesPath}") String localFilesPath;
private @Value("${s3.access}") String s3access;
private @Value("${s3.secret}") String s3secret;
private @Value("${pa.s3.bucket}") String s3bucket;
private @Value("${pa.people.enabled}") boolean peopleEnabled;
private @Value("${pa.content.updater.threads}") int contentUpdaterThreadCount;
@PostConstruct
public void startBackgroundTasks() {
if (peopleEnabled) {
scheduler.schedule(paCompletePeopleUpdater().withName("PA Complete People Updater"), PEOPLE_COMPLETE_INGEST);
scheduler.schedule(paDailyPeopleUpdater().withName("PA People Updater"), PEOPLE_INGEST);
}
scheduler.schedule(paChannelsUpdater().withName("PA Channels Updater"), CHANNELS_INGEST);
scheduler.schedule(paFeaturesUpdater().withName("PA Features Updater"), FEATURES_INGEST);
scheduler.schedule(paFileUpdater().withName("PA File Updater"), RECENT_FILE_DOWNLOAD);
scheduler.schedule(paCompleteUpdater().withName("PA Complete Updater"), COMPLETE_INGEST);
scheduler.schedule(paRecentUpdater().withName("PA Recent Updater"), RECENT_FILE_INGEST);
log.record(new AdapterLogEntry(Severity.INFO).withDescription("PA update scheduled task installed").withSource(PaCompleteUpdater.class));
}
private PaCompletePeopleUpdater paCompletePeopleUpdater() {
return new PaCompletePeopleUpdater(paProgrammeDataStore(), personResolver, personWriter, peopleLock);
}
private PaDailyPeopleUpdater paDailyPeopleUpdater() {
return new PaDailyPeopleUpdater(paProgrammeDataStore(), personResolver, personWriter, fileUploadResultStore(), peopleLock);
}
private FileUploadResultStore fileUploadResultStore() {
return new MongoFileUploadResultStore(mongo);
}
@Bean PaChannelsUpdater paChannelsUpdater() {
return new PaChannelsUpdater(paProgrammeDataStore(), channelDataHandler());
}
@Bean PaChannelDataHandler channelDataHandler() {
return new PaChannelDataHandler(new PaChannelsIngester(), new PaChannelGroupsIngester(), channelResolver, channelWriter, channelGroupResolver, channelGroupWriter);
}
@Bean PaFeaturesUpdater paFeaturesUpdater() {
return new PaFeaturesUpdater(paProgrammeDataStore(), fileUploadResultStore(), new PaFeaturesProcessor(contentResolver, contentGroupResolver, contentGroupWriter));
}
@Bean PaFtpFileUpdater ftpFileUpdater() {
return new PaFtpFileUpdater(ftpHost, new UsernameAndPassword(ftpUsername, ftpPassword), ftpPath, paProgrammeDataStore());
}
@Bean PaProgrammeDataStore paProgrammeDataStore() {
S3Client s3client = new DefaultS3Client(s3access, s3secret, s3bucket);
return new DefaultPaProgrammeDataStore(localFilesPath, s3client);
}
@Bean PaProgDataProcessor paProgrammeProcessor() {
return new PaProgrammeProcessor(contentWriter, contentResolver, peopleWriter, log);
}
@Bean PaCompleteUpdater paCompleteUpdater() {
PaEmptyScheduleProcessor processor = new PaEmptyScheduleProcessor(paProgrammeProcessor(), scheduleResolver);
PaChannelProcessor channelProcessor = new PaChannelProcessor(processor, broadcastTrimmer(), scheduleWriter, paScheduleVersionStore());
ExecutorService executor = Executors.newFixedThreadPool(contentUpdaterThreadCount, new ThreadFactoryBuilder().setNameFormat("pa-complete-updater-%s").build());
PaCompleteUpdater updater = new PaCompleteUpdater(executor, channelProcessor, paProgrammeDataStore(), channelResolver);
return updater;
}
@Bean PaRecentUpdater paRecentUpdater() {
PaChannelProcessor channelProcessor = new PaChannelProcessor(paProgrammeProcessor(), broadcastTrimmer(), scheduleWriter, paScheduleVersionStore());
ExecutorService executor = Executors.newFixedThreadPool(contentUpdaterThreadCount, new ThreadFactoryBuilder().setNameFormat("pa-recent-updater-%s").build());
PaRecentUpdater updater = new PaRecentUpdater(executor, channelProcessor, paProgrammeDataStore(), channelResolver, fileUploadResultStore(), paScheduleVersionStore());
return updater;
}
@Bean BroadcastTrimmer broadcastTrimmer() {
return new ScheduleResolverBroadcastTrimmer(Publisher.PA, scheduleResolver, contentResolver, contentWriter);
}
@Bean PaFileUpdater paFileUpdater() {
return new PaFileUpdater(ftpFileUpdater());
}
public @Bean PaSingleDateUpdatingController paUpdateController() {
PaChannelProcessor channelProcessor = new PaChannelProcessor(paProgrammeProcessor(), broadcastTrimmer(), scheduleWriter, paScheduleVersionStore());
return new PaSingleDateUpdatingController(channelProcessor, scheduleResolver, channelResolver, paProgrammeDataStore());
}
public @Bean PaScheduleVersionStore paScheduleVersionStore() {
return new MongoPaScheduleVersionStore(mongo);
}
}
| [
"[email protected]"
] | |
703494979a6895ec22f3e42cba4908c27e20e0a2 | 77c92fa4a55c16a1dfccb718175d67914b041c26 | /src/day12_classobject_string/GetBeverage.java | 60b057653fb6cfbb32d069f470379052631b717d | [] | no_license | afnvld/JavaProgramming | 6e65ac181ea43033f7e6f9ed651a3b6bf73eb8d8 | 55bca8cde1868ba0bd2a134041ec1ed9a687ebc8 | refs/heads/master | 2020-04-06T16:09:07.235095 | 2018-11-14T20:35:33 | 2018-11-14T20:35:33 | 157,607,566 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package day12_classobject_string;
import java.util.Scanner;
public class GetBeverage {
public static void main(String[] args) {
/*
* tea- $3
* coffee $4
* water $2
* juice $5
*
*
* String drink
* double price
*/
//switch statement, your total price
Scanner scan = new Scanner(System.in);
System.out.println("Choose your drink:");
String drink = scan.next();
double price = 0.0;
switch(drink) {
case "tea":
price = 3.0;
break;
case "coffee":
price = 4.0;
break;
case "water":
price = 2.0;
break;
case "juice":
price = 5.0;
break;
default:
System.out.println("invalid drink");
}
System.out.println("Your total is $" + price);
}
}
| [
"[email protected]"
] | |
87516b1ded6f6a6d6b9f3feb7767fc5003a89cce | 84bbc98a856e58fcd877cf95f996d19727221dc9 | /gds-service/src/main/java/com/bs/service/modules/sc/viewfieldconfig/IViewFieldConfigDao.java | 799717195687017a03fa8a3b23724a004abc292d | [] | no_license | daiedaie/supply-chain | 567ea06554947ac46a8f73a047728c4c89f6efda | 2df81d7a5961be2ce2fb894c2e8da506e8f6511a | refs/heads/master | 2020-03-17T02:43:35.983050 | 2017-09-29T06:58:49 | 2017-09-29T06:58:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package com.bs.service.modules.sc.viewfieldconfig;
import org.apache.ibatis.annotations.Mapper;
import com.bs.service.modules.sc.viewfieldconfig.base.BaseViewFieldConfigDao;
@Mapper
public interface IViewFieldConfigDao extends BaseViewFieldConfigDao{
}
| [
"[email protected]"
] | |
68047f782462e4f333711500c7ea2b285dd77eaf | 4cac772dcce8b0d003148c21c2b86b01772fc566 | /ZensarTraining/src/module-info.java | 84d4029f6b6237032c0195ab7f67c641147eee31 | [] | no_license | ankitbadwaik/Assignments | 776243dd66fbd073928f9cfbfd6c44d5b632b38f | 3cf9bf06da323448c9b600584792a3032ea10d90 | refs/heads/master | 2023-07-28T18:43:11.089517 | 2021-09-11T17:42:22 | 2021-09-11T17:42:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25 | java | module ZensarTraining {
} | [
"[email protected]"
] | |
02c9c670aeb351fe837b680b0737b17d72d9d182 | b906e525c7a5dd3b54b17342b0bcfbd20241b1b1 | /github/TellMeTellYou/src/com/bean/CityBean.java | 19488bfc02c0063c47ff35b28bfe1254b7b3d22b | [] | no_license | zcs0/githup-sw | 34f06f75abf44ccae112bd5ebbbd5f1900e302f1 | 000b63458271a2c35f6694df3d3465e9086ef603 | refs/heads/master | 2016-09-11T06:12:05.742249 | 2015-08-27T05:34:01 | 2015-08-27T05:34:01 | 41,461,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package com.bean;
/**
* @ClassName: CityBean.java
* @author zcs
* @Date 2015年4月5日 下午2:06:19
* @Description: TODO(用一句话描述该文件做什么)
*/
public class CityBean {
public int _id;
public int adcode;
public int city_code;
public String name;
public String center;
public String level;
public CityBean(int _id, int adcode, int city_code, String name,
String center, String level) {
this._id = _id;
this.adcode = adcode;
this.city_code = city_code;
this.name = name;
this.center = center;
this.level = level;
}
}
| [
"[email protected]"
] | |
13b8e66715fb39378ec2e8be3cbd0742a2479747 | 6f861b5443996d45d10503a1e92aae2b7d46f2f0 | /TeamProject/src/main/java/config/MvcConfig.java | d67977254be72842026f00a13a6898284c73bd7d | [] | no_license | mdj44518/TeamProject | bf6da382d679d8ee9a9cdbd78592217077fb2125 | 4adff3d090b6b9f120b7d189f0bc6f86faeacb8f | refs/heads/develop | 2022-12-22T15:57:15.447891 | 2019-12-27T09:20:26 | 2019-12-27T09:20:26 | 228,788,641 | 0 | 1 | null | 2022-12-15T23:45:46 | 2019-12-18T08:00:57 | Java | UTF-8 | Java | false | false | 994 | java | package config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@EnableWebMvc
public class MvcConfig implements WebMvcConfigurer {
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
registry.jsp("/WEB-INF/view/", ".jsp");
}
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
}
| [
"[email protected]"
] | |
586f449420f9a2dc8bce55c58d72cb4db544bd85 | cd89deb87c35dd6eec3d0ab064ca0398828ea50e | /app/src/main/java/com/example/smilabus/SettingsActivity.java | ded63624a7f385bb15c8b17a6b2e567fa9b33993 | [] | no_license | Koiji/SmilaBus | 6bef9cb5f79fdf4b0793f975b2a5bd0364bec7d4 | 642890fecdb70287f5afdb6911f69954404b88b3 | refs/heads/main | 2023-03-09T04:35:16.845621 | 2021-02-26T08:50:01 | 2021-02-26T08:50:01 | 340,032,902 | 1 | 1 | null | 2021-02-20T15:42:05 | 2021-02-18T11:45:17 | Java | UTF-8 | Java | false | false | 1,123 | java | package com.example.smilabus;
import android.app.UiModeManager;
import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceFragmentCompat;
public class SettingsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_activity);
if (savedInstanceState == null) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.settings, new SettingsFragment())
.commit();
}
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
public static class SettingsFragment extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.root_preferences, rootKey);
}
}
}
| [
"[email protected]"
] | |
e948e19eae2b49579004b723523f87a553b52a5a | ec96f6e6d9dee3e56f1d3210dda01618a16d27ec | /java-training/src/com/tech/javabasics/step17files/CopyFile.java | 100a64a7d714e83cfaf4deba11f2356cb3981d5a | [] | no_license | vlearn-tech/java-training-b001 | a7fa6b77c7ec2df39da3dcfd1c858246cc4fde9d | 0384f8cf3bf5c8a8e015956618cfa2c2c8e53b5f | refs/heads/master | 2023-05-30T22:54:22.809409 | 2021-06-09T04:33:44 | 2021-06-09T04:33:44 | 344,059,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 499 | java | package com.tech.javabasics.step17files;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
public class CopyFile {
public static void main(String[] args) throws IOException {
List<String> lines = Files.readAllLines(Paths.get("C:\\Users\\HP\\Desktop\\JavaFiles\\SampleCSVFile.csv"));
Files.write(Paths.get("C:\\Users\\HP\\Desktop\\JavaFiles\\SampleCSVFile_Copy.csv"), lines);
System.out.println("File copied");
}
}
| [
"[email protected]"
] | |
215adfd646be160703d629e9b601adef4a80bd9c | 9b75d8540ff2e55f9ff66918cc5676ae19c3bbe3 | /cab.snapp.passenger.play_184.apk-decompiled/sources/com/google/android/gms/internal/zzavh.java | 5fe342245523cbb6e7f5dc854ab4dd4bc11c593c | [] | no_license | BaseMax/PopularAndroidSource | a395ccac5c0a7334d90c2594db8273aca39550ed | bcae15340907797a91d39f89b9d7266e0292a184 | refs/heads/master | 2020-08-05T08:19:34.146858 | 2019-10-06T20:06:31 | 2019-10-06T20:06:31 | 212,433,298 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package com.google.android.gms.internal;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.android.gms.common.internal.ap;
public final class zzavh extends zzbfm {
public static final Parcelable.Creator<zzavh> CREATOR = new cn();
/* renamed from: a reason: collision with root package name */
private int f3550a;
/* renamed from: b reason: collision with root package name */
private String f3551b;
public zzavh(String str) {
this(str, (byte) 0);
}
zzavh(String str, byte b2) {
this.f3550a = 1;
this.f3551b = (String) ap.checkNotNull(str);
}
public final void writeToParcel(Parcel parcel, int i) {
int zze = el.zze(parcel);
el.zzc(parcel, 1, this.f3550a);
el.zza(parcel, 2, this.f3551b, false);
el.zzai(parcel, zze);
}
}
| [
"[email protected]"
] | |
2247f965ce0db3b946a22ffc782bb7d2f796a95c | 837f788245a39acf5e5d882bdbf957e5c9c6dad1 | /android/app/src/main/java/com/desafio/MainApplication.java | 02d79f655989b0bc95e92ba6a597d1298f75567a | [] | no_license | JheovannyCampos/TestePraticoDrmais-Mobile | a1ba385d3946b7f3951c26bc6f1f4f8a21ac363f | 3f6ca154e5d8d258fb56268a3447850383bbdbb4 | refs/heads/main | 2023-09-02T06:23:40.454882 | 2021-11-04T18:21:13 | 2021-11-04T18:21:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,251 | java | package com.desafio;
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import androidx.annotation.NonNull;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import expo.modules.ApplicationLifecycleDispatcher;
import expo.modules.ReactNativeHostWrapper;
import com.facebook.react.bridge.JSIModulePackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper(
this,
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
}
});
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
ApplicationLifecycleDispatcher.onApplicationCreate(this);
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.desafio.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
9110b0134a012f91d379dc6505f244f487670068 | 2fd2ace4725e4ddc22adfd202bed37b1e788851c | /web20191213/src/main/java/Beans/Rank.java | 8f805b666bfc3dc850342359a839e496d7db8899 | [] | no_license | lg0125/OnlineStudy_Web | 478e6a8eb92cf27793b8ac0ca11ebaf91a2780e9 | ed7186e8ebb210e2a26cb3ddd3e23c6c942d25e9 | refs/heads/master | 2022-07-08T07:35:43.741772 | 2019-12-31T15:25:51 | 2019-12-31T15:25:51 | 216,825,463 | 0 | 0 | null | 2021-04-26T19:50:20 | 2019-10-22T13:49:41 | JavaScript | UTF-8 | Java | false | false | 228 | java | package Beans;
public class Rank {
private String rank_name;
public String getRank_name() {
return rank_name;
}
public void setRank_name(String rank_name) {
this.rank_name = rank_name;
}
}
| [
"[email protected]"
] | |
33984d18f9686806039fac3283ed19556e1f7120 | b67cb746e4ecd1b9cb52c422ab3ed6b5c781bda6 | /src/test/java/handlers/MisawaHandlersTest.java | 4dc76f6923fcebb8d98b6e62dc383f2cadb7a1fc | [
"Apache-2.0"
] | permissive | chory-amam/slack-capybara | bbeb07580c60b1a73ab21ead541f3cb6593a5c4a | 8be4d6dc06f595c9e8029003bc26810a02e6f4d7 | refs/heads/master | 2021-08-05T22:20:46.961195 | 2020-09-03T23:20:13 | 2020-09-03T23:20:13 | 33,994,266 | 9 | 1 | Apache-2.0 | 2021-07-20T20:40:32 | 2015-04-15T13:05:25 | Java | UTF-8 | Java | false | false | 1,305 | java | package handlers;
import adapter.MockAdapter;
import com.github.masahitojp.botan.Botan;
import com.github.masahitojp.botan.brain.LocalBrain;
import com.github.masahitojp.botan.exception.BotanException;
import handlers.misawa.MisawaHandlers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import utils.HandlersTestUtils;
import utils.pattern.InvocationRegexPattern;
import utils.pattern.NotInvocationRegexPattern;
import utils.pattern.RegexTestPattern;
import java.util.Arrays;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class MisawaHandlersTest {
Botan botan;
@Before
public void setUp() throws BotanException {
botan = new Botan.BotanBuilder()
.setAdapter(new MockAdapter())
.setBrain(new LocalBrain())
.setMessageHandlers(new MisawaHandlers())
.build();
botan.start();
}
@After
public void tearDown() {
botan.stop();
}
@Test
public void handlersRegistrationTest() {
assertThat(botan.getHandlers().size(), is(1));
}
@Test
public void regex() {
new HandlersTestUtils().regexTest(
botan,
Arrays.asList(
new InvocationRegexPattern("botan misawa"),
new InvocationRegexPattern("botan MISAWA"),
new NotInvocationRegexPattern("botan misawa-jigoku")
)
);
}
}
| [
"[email protected]"
] | |
6c9da31e50d2eab16360cb88b0ce880a2f0715ce | 5f79a9193a033348918d83a0e0d6ca9b98abc609 | /IPXACT-ECore/src/org/spiritconsortium/xml/schema/spirit/_1685/_2009/impl/BusInterfacesTypeImpl.java | 208090e9708f92b70b34a2b8a37e3f4303f57e53 | [] | no_license | hgvanpariya/IPXact-ECore-Object | 6cf988b3b6a262bbc987870b7021010c189e1ad0 | 362d61c820268c88136dc29511110c9725b8ef7e | refs/heads/master | 2020-05-15T15:23:15.875044 | 2014-07-03T02:45:06 | 2014-07-03T02:45:06 | 21,447,544 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,030 | java | /**
*/
package org.spiritconsortium.xml.schema.spirit._1685._2009.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.spiritconsortium.xml.schema.spirit._1685._2009.BusInterfaceType;
import org.spiritconsortium.xml.schema.spirit._1685._2009.BusInterfacesType;
import org.spiritconsortium.xml.schema.spirit._1685._2009._2009Package;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Bus Interfaces Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.spiritconsortium.xml.schema.spirit._1685._2009.impl.BusInterfacesTypeImpl#getBusInterface <em>Bus Interface</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class BusInterfacesTypeImpl extends MinimalEObjectImpl.Container implements BusInterfacesType {
/**
* The cached value of the '{@link #getBusInterface() <em>Bus Interface</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBusInterface()
* @generated
* @ordered
*/
protected EList<BusInterfaceType> busInterface;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BusInterfacesTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return _2009Package.eINSTANCE.getBusInterfacesType();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<BusInterfaceType> getBusInterface() {
if (busInterface == null) {
busInterface = new EObjectContainmentEList<BusInterfaceType>(BusInterfaceType.class, this, _2009Package.BUS_INTERFACES_TYPE__BUS_INTERFACE);
}
return busInterface;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case _2009Package.BUS_INTERFACES_TYPE__BUS_INTERFACE:
return ((InternalEList<?>)getBusInterface()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case _2009Package.BUS_INTERFACES_TYPE__BUS_INTERFACE:
return getBusInterface();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case _2009Package.BUS_INTERFACES_TYPE__BUS_INTERFACE:
getBusInterface().clear();
getBusInterface().addAll((Collection<? extends BusInterfaceType>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case _2009Package.BUS_INTERFACES_TYPE__BUS_INTERFACE:
getBusInterface().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case _2009Package.BUS_INTERFACES_TYPE__BUS_INTERFACE:
return busInterface != null && !busInterface.isEmpty();
}
return super.eIsSet(featureID);
}
} //BusInterfacesTypeImpl
| [
"[email protected]"
] | |
b65d414e6c7158086695db1389474400dd694646 | df65a9159b55d4bb543ff0e4706b97c6f1d29397 | /app/src/main/java/in/cyberwalker/alliance/view/QuickContactHelper.java | 7c2260167ff27ea89fc929dacbba8597e41c6b35 | [
"MIT"
] | permissive | cyph3rcod3r/Alliance | 854ee898f7b1874df59dfd04d4f71f21a55f1073 | 7130e3a10361eef98be1b2731410199f48a924db | refs/heads/master | 2020-03-21T09:15:49.452228 | 2018-06-23T10:25:02 | 2018-06-23T10:25:02 | 138,390,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,797 | java | package in.cyberwalker.alliance.view;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.provider.ContactsContract;
import de.hdodenhof.circleimageview.CircleImageView;
import in.cyberwalker.alliance.R;
public final class QuickContactHelper {
private static final String[] PHOTO_ID_PROJECTION = new String[]{
ContactsContract.Contacts.PHOTO_ID
};
private static final String[] PHOTO_BITMAP_PROJECTION = new String[]{
ContactsContract.CommonDataKinds.Photo.PHOTO
};
private final CircleImageView badge;
private final String phoneNumber;
private final ContentResolver contentResolver;
public QuickContactHelper(final Context context, final CircleImageView badge, final String phoneNumber) {
this.badge = badge;
this.phoneNumber = phoneNumber;
contentResolver = context.getContentResolver();
}
public void addThumbnail() {
final Integer thumbnailId = fetchThumbnailId();
if (thumbnailId != null) {
final Bitmap thumbnail = fetchThumbnail(thumbnailId);
if (thumbnail != null) {
badge.setImageBitmap(thumbnail);
} else {
badge.setImageResource(R.drawable.ic_person);
}
}
}
private Integer fetchThumbnailId() {
final Uri uri = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI, Uri.encode(phoneNumber));
final Cursor cursor = contentResolver.query(uri, PHOTO_ID_PROJECTION, null, null, ContactsContract.Contacts.DISPLAY_NAME + " ASC");
try {
Integer thumbnailId = null;
if (cursor.moveToFirst()) {
thumbnailId = cursor.getInt(cursor.getColumnIndex(ContactsContract.Contacts.PHOTO_ID));
}
return thumbnailId;
} finally {
cursor.close();
}
}
final Bitmap fetchThumbnail(final int thumbnailId) {
final Uri uri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, thumbnailId);
final Cursor cursor = contentResolver.query(uri, PHOTO_BITMAP_PROJECTION, null, null, null);
try {
Bitmap thumbnail = null;
if (cursor.moveToFirst()) {
final byte[] thumbnailBytes = cursor.getBlob(0);
if (thumbnailBytes != null) {
thumbnail = BitmapFactory.decodeByteArray(thumbnailBytes, 0, thumbnailBytes.length);
}
}
return thumbnail;
} finally {
cursor.close();
}
}
} | [
"[email protected]"
] | |
6fb787f49cc602c3b05438fd8ff33c34b185d701 | b3bb1815c5e1c6ce8f5e81b2bbd3d49079d77ecc | /src/main/java/org/food/supplier/model/UserProfileType.java | b2eaaa25951cfffa9eaffece3bce6efe7f62d153 | [] | no_license | PushpendraParmar/food_services | 7071f4846f731a2b5ddb68cf7aa0c62898ef7ecc | ecf6501853c1a3f9f07d133616cdbdd0558b1895 | refs/heads/master | 2021-04-18T19:42:25.364624 | 2018-04-05T17:35:52 | 2018-04-05T17:35:52 | 126,660,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package org.food.supplier.model;
import java.io.Serializable;
public enum UserProfileType implements Serializable{
USER("USER"),
DBA("DBA"),
ADMIN("ADMIN");
String userProfileType;
private UserProfileType(String userProfileType){
this.userProfileType = userProfileType;
}
public String getUserProfileType(){
return userProfileType;
}
}
| [
"[email protected]"
] | |
1b9e74197835cffbeb74a70b1179a3c859a37460 | d54955068bb150acebc8e7300ce70a3e680f41b4 | /src/test/java/ece448/iot_sim/MqttCommandsTests.java | be38ee782f2e044b0eb569eede5cb3f579cc8780 | [] | no_license | sc-9/IoT-SmartHub | 91b7e8d80e74ef640bb9ddfc0444ea1b4ba97025 | 6c6d3b2638c8c1cef7a439f12680ca153aa05ca4 | refs/heads/master | 2022-11-26T02:00:33.521948 | 2020-08-04T16:20:20 | 2020-08-04T16:20:20 | 285,027,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,633 | java | // package ece448.iot_sim;
// import static org.junit.Assert.*;
// import java.util.ArrayList;
// import java.util.Arrays;
// import org.eclipse.paho.client.mqttv3.MqttMessage;
// import org.junit.Test;
// import ece448.iot_sim.PlugSim.Observer;
// public class MqttCommandsTests {
// public static class ObserverOne implements Observer {
// private String name, key, value;
// @Override
// public void update (String name, String key, String value){
// this.name = name;
// this.key = key;
// this.value = value;
// }
// public String getName() {
// return name;
// }
// public void setName(String name) {
// this.name = name;
// }
// public String getKey() {
// return key;
// }
// public void setKey(String key) {
// this.key = key;
// }
// public String getValue() {
// return value;
// }
// public void setValue(String value) {
// this.value = value;
// }
// }
// @Test
// public void testObserver() {
// PlugSim plug = new PlugSim("a");
// ObserverOne o1 = new ObserverOne();
// plug.addObserver(o1);
// plug.switchOn();
// assertEquals(o1.getName(), "a");
// assertEquals(o1.getKey(), "state");
// assertEquals(o1.getValue(), "on");
// plug.switchOff();
// assertEquals(o1.getName(), "a");
// assertEquals(o1.getKey(), "state");
// assertEquals(o1.getValue(), "off");
// }
// @Test
// public void test002() {
// PlugSim plug = new PlugSim("Saluton");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// MqttCommands mqttCmd = new MqttCommands(plugs, "iot_ece448/");
// MqttUpdates mqttupd = new MqttUpdates("iot_ece448/");
// System.out.println(mqttCmd);
// System.out.println(mqttupd);
// }
// @Test
// public void test003() {
// PlugSim plug = new PlugSim("Hola");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// SimConfig config = new SimConfig(8080, Arrays.asList(plug.getName()), "tacp://127.0.0.1", "iot_sim", "iot_ece448");
// try {
// Main mm = new Main(config);
// } catch (Exception e) {
// e.printStackTrace();
// }
// MqttCommands mqttCmd = new MqttCommands(plugs, "iot_ece448");
// MqttUpdates mqttupd = new MqttUpdates("iot_ece448");
// String topic = "update/hello/state";
// MqttMessage msg = mqttupd.getMessage("toggle");
// System.out.print(mqttCmd.getTopic());
// mqttCmd.handleMessage(topic, msg);
// }
// @Test
// public void test004() {
// PlugSim plug = new PlugSim("Hola");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// MqttUpdates mqttupd = new MqttUpdates("iot_ece448");
// mqttupd.getTopic("state", "on");
// }
// @Test
// public void test005() {
// PlugSim plug = new PlugSim("Hola");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// SimConfig config = new SimConfig(8080, Arrays.asList(plug.getName()), "tacp://127.0.0.1", "iot_sim", "iot_ece448");
// config.getMqttTopicPrefix();
// }
// @Test
// public void test006() {
// PlugSim plug = new PlugSim("Hola");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// MqttUpdates mqttupd = new MqttUpdates("iot_ece448");
// mqttupd.getTopic("power", "100.00");
// }
// @Test
// public void test007() {
// PlugSim plug = new PlugSim("Hola");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// MqttUpdates mqttupd = new MqttUpdates("iot_ece448");
// mqttupd.getTopic("state", "off");
// }
// @Test
// public void test008() {
// PlugSim plug = new PlugSim("Hola");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// MqttUpdates mqttupd = new MqttUpdates("iot_ece448");
// mqttupd.getTopic("power", "0.0");
// }
// @Test
// public void test009() {
// PlugSim plug = new PlugSim("Hola");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// MqttUpdates mqttupd = new MqttUpdates("iot_ece448");
// mqttupd.getTopic("state", "toggle");
// }
// @Test
// public void test010() {
// PlugSim plug = new PlugSim("Hola");
// ArrayList<PlugSim> plugs = new ArrayList<>();
// plugs.add(plug);
// MqttUpdates mqttupd = new MqttUpdates("iot_ece448");
// mqttupd.getTopic("state", "off");
// }
// @Test
// public void test011() {
// PlugSim plug = new PlugSim("xyz");
// ObserverOne o1 = new ObserverOne();
// plug.addObserver(o1);
// if(plug.isOn()) {
// plug.switchOn();
// assertEquals(o1.getName(), "xyz");
// assertEquals(o1.getKey(), "state");
// assertEquals(o1.getValue(), "on");
// } else {
// plug.switchOff();
// assertEquals(o1.getName(), "xyz");
// assertEquals(o1.getKey(), "state");
// assertEquals(o1.getValue(), "off");
// }
// }
// } | [
"[email protected]"
] | |
d5a14b39120aeaee5a854dcf97ca038c8693a19e | 625c1e10d7f6208e52c65f615a65196248cf8351 | /floatingShort/src/main/java/co/yoyu/sidebar/view/SideBar.java | 30739740b6819d3d9ff0c4b5517332e36af49b96 | [
"Apache-2.0"
] | permissive | zf617525633/Sidebar | a982ebb4cecb979bb15735219ef78d398d4cf177 | 682cb64dbbbbcdee5235ba66fc18cec17ae1305b | refs/heads/master | 2016-09-15T19:33:49.654898 | 2015-08-12T12:14:24 | 2015-08-12T12:14:24 | 40,245,103 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37,397 | java | package co.yoyu.sidebar.view;
import java.util.ArrayList;
import java.util.List;
import wei.mark.standout.StandOutWindow;
import wei.mark.standout.Utils;
import wei.mark.standout.constants.StandOutFlags;
import wei.mark.standout.ui.Window;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Process;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import co.yoyu.sidebar.ContentAdapter;
import co.yoyu.sidebar.FlowAdapter;
import co.yoyu.sidebar.R;
import co.yoyu.sidebar.cache.LocalImageCache;
import co.yoyu.sidebar.db.AppInfoCacheDB;
import co.yoyu.sidebar.db.AppInfoModel;
import co.yoyu.sidebar.drag.DragController;
import co.yoyu.sidebar.drag.DragLayer;
import co.yoyu.sidebar.handler.HandlerDragController;
import co.yoyu.sidebar.handler.HandlerDragLayer;
import co.yoyu.sidebar.handler.HandlerWindowDragController;
import co.yoyu.sidebar.utils.Constant;
import co.yoyu.sidebar.utils.ParseUtils;
/**
*
*/
public class SideBar extends StandOutWindow implements OnGestureListener {
public static final int WINDOW_ID_SIDE_BAR = 1;
public static final int WINDOW_ID_SIDE_BAR_HANDLER = 2;
public static final int CODE_SHOW_SIDE_BAR_WINDOW = 6;
public static final int CODE_SHOW_SIDE_BAR_HANDLER_WINDOW = 7;
private PackageManager mPackageManager;
private WindowManager mWindowManager;
private ArrayList<AppInfoModel> mFlowData = new ArrayList<AppInfoModel>();
private ArrayList<AppInfoModel> mContentData = new ArrayList<AppInfoModel>();
private FlowAdapter mFlowAdapter = null;
private ContentAdapter mContentAdapter = null;
private LayoutInflater mInflater;
private SideBarContentPanel mContentPanel;
private SideBarFlowPanel mFlowPanel;
private TextView mEditButton;
private SideBarLinearLayout mSideBarLinearLayout;
private ImageView mLeftDrag;
private ImageView mRightDrag;
private ImageView mWindowLeftDrag;
private ImageView mWindowRightDrag;
private View mFlowList;
private DragLayer mDragLayer;
private DragController mDragController;
/**handler in Window body dragLayer*/
private HandlerDragLayer mHandlerDragLayer;
/**handler in Window dragLayer*/
private HandlerDragLayer mWindowHandlerDragLayer;
private HandlerDragController mWindowHandlerController;
private HandlerWindowDragController mHandlerWindowController;
private static final long MSG_DELAY_TIME = 3000L;
private static final int MSG_LEFT_EXPEND_TO_NORMAL = 1;
private static final int MSG_RIGHT_EXPEND_TO_NORMAL = 2;
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
switch(msg.what) {
case MSG_LEFT_EXPEND_TO_NORMAL:
leftExpendToNormal();
break;
case MSG_RIGHT_EXPEND_TO_NORMAL:
rightExpendToNormal();
break;
}
}
};
/**WindowId*/
private int mWindowID;
/**HandlerWindowId*/
private int mHandlerWindowID;
//正常模式
public static final int MODE_NORMAL = 0;
//拖拽块模式
public static final int MODE_DRAG = 1;
//编辑模式
public static final int MODE_EDIT = 2;
//拖拽块展开模式
public static final int MODE_EXPEND = 3;
//拖拽块展开且拖拽模式
public static final int MODE_EXPEND_DRAG = 4;
//编辑模式 拖拽
public static final int MODE_EDIT_DRAG = 5;
private int mMode = MODE_NORMAL;
//window body view
private View mWindowBody;
private View mHandlerWindowBody;
public static final int POSITION_LEFT_HALF = 0;
public static final int POSITION_RIGHT_HALF = 1;
private int mPosition = POSITION_LEFT_HALF;
private Animation mLeftEditExpanAnimation;
/**
* Helper for detecting touch gestures.
*/
private GestureDetector mGestureDetector;
public static void showSidebar(Context context) {
sendData(context, SideBar.class, DISREGARD_ID, CODE_SHOW_SIDE_BAR_WINDOW,null, null, DISREGARD_ID);
}
public static void showSideBarHandler(Context context) {
sendData(context, SideBar.class, DISREGARD_ID, CODE_SHOW_SIDE_BAR_HANDLER_WINDOW,null, null, DISREGARD_ID);
}
@Override
public void onCreate() {
super.onCreate();
mPackageManager = getPackageManager();
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
mInflater = LayoutInflater.from(this);
mDragController = new DragController(this);
mHandlerWindowController = new HandlerWindowDragController(this);
mHandlerWindowController.setSideBar(this);
mGestureDetector = new GestureDetector(this, this);
mLeftEditExpanAnimation = AnimationUtils.loadAnimation(this, R.anim.left_to_expand);
registerBroadCastReceiver();
}
@Override
public String getAppName() {
return "Sidebar";
}
@Override
public int getAppIcon() {
return R.drawable.ic_launcher;
}
public int getPosition(){
return mPosition;
}
/**
* create two window attach View
* one is body view the other is handler view
* */
@Override
public void createAndAttachView(final int id, FrameLayout frame) {
if(id == WINDOW_ID_SIDE_BAR) {
mWindowID = id;
// inflate the Window Body view ,it's invisable by default.
mWindowBody = (FrameLayout) mInflater.inflate(R.layout.sidebar_frame, frame, true);
mWindowBody.setOnTouchListener(null);
mDragLayer = (DragLayer) mWindowBody.findViewById(R.id.drag_layer);
mDragLayer.setDragController(mDragController);
mDragLayer.setSideBar(this);
mSideBarLinearLayout = (SideBarLinearLayout) mWindowBody.findViewById(R.id.sidebar);
mFlowList = mDragLayer.findViewById(R.id.sidebar_content);
// setup content panel ui and data
mContentPanel = (SideBarContentPanel) mSideBarLinearLayout.findViewById(R.id.appgrid);
mContentPanel.setDragController(mDragController);
mContentPanel.setSideBar(this);
loadContentData();
mContentAdapter = new ContentAdapter(this, R.layout.app_row, mContentData);
mContentPanel.setAdapter(mContentAdapter);
// setup flow panel ui and data
mFlowPanel = (SideBarFlowPanel) mSideBarLinearLayout.findViewById(R.id.flow);
mFlowPanel.setDragController(mDragController);
mFlowPanel.setSideBar(this);
loadFlowData();
mFlowAdapter = new FlowAdapter(this, mFlowData);
mFlowPanel.setAdapter(mFlowAdapter);
mDragController.addDropTarget(mContentPanel);
mDragController.addDropTarget(mFlowPanel);
// setup edit button
mEditButton = (TextView) mSideBarLinearLayout.findViewById(R.id.edit);
mEditButton.setOnClickListener(mEditClickListener);
mHandlerDragLayer = (HandlerDragLayer) mWindowBody.findViewById(R.id.handler_drag_layer);
mHandlerDragLayer.setSideBar(this);
mHandlerDragLayer.setWindowDragControl(mHandlerWindowController);
mLeftDrag = (ImageView) mHandlerDragLayer.findViewById(R.id.preview_left);
mLeftDrag.setOnTouchListener(mDragTouchListener);
mRightDrag = (ImageView) mHandlerDragLayer.findViewById(R.id.preview_right);
mRightDrag.setOnTouchListener(mDragTouchListener);
// asyn load content data
asynLoadContentData();
} else {
mHandlerWindowID = id;
FrameLayout windowBody = (FrameLayout) mInflater.inflate(R.layout.sidebar_handler, frame, true);
windowBody.setOnTouchListener(null);
mWindowHandlerController = new HandlerDragController(this);
mWindowHandlerDragLayer = (HandlerDragLayer) windowBody.findViewById(R.id.window_handler_drag_layer);
mWindowHandlerDragLayer.setDragController(mWindowHandlerController);
mWindowHandlerDragLayer.setSideBar(this);
mWindowLeftDrag = (ImageView) mWindowHandlerDragLayer.findViewById(R.id.window_preview_left);
mWindowLeftDrag.setOnTouchListener(mDragTouchListener);
mWindowRightDrag = (ImageView) mWindowHandlerDragLayer.findViewById(R.id.window_preview_right);
mWindowRightDrag.setOnTouchListener(mDragTouchListener);
int margin = getResources().getDimensionPixelSize(R.dimen.sidesar_handler_height);
mWindowHandlerController.setSideBar(this, margin / 2);
}
}
@Override
public StandOutLayoutParams getParams(int id, Window window) {
if(id == mWindowID) {
return new StandOutLayoutParams(id, StandOutLayoutParams.WRAP_CONTENT, StandOutLayoutParams.MATCH_PARENT, 0, 0);
}
int margin = getResources().getDimensionPixelSize(R.dimen.sidesar_handler_height);
int y = (mWindowManager.getDefaultDisplay().getHeight() - margin) /2;
return new StandOutLayoutParams(id, StandOutLayoutParams.WRAP_CONTENT, StandOutLayoutParams.WRAP_CONTENT, 0, y);
}
@Override
public int getFlags(int id) {
return super.getFlags(id) | StandOutFlags.FLAG_ADD_FUNCTIONALITY_DROP_DOWN_DISABLE | StandOutFlags.FLAG_BODY_MOVE_ENABLE;
}
@Override
public void onReceiveData(int id, int requestCode, Bundle data, Class<? extends StandOutWindow> fromCls, int fromId) {
switch (requestCode) {
case CODE_SHOW_SIDE_BAR_WINDOW:
show(WINDOW_ID_SIDE_BAR);
break;
case CODE_SHOW_SIDE_BAR_HANDLER_WINDOW:
show(WINDOW_ID_SIDE_BAR_HANDLER);
break;
default:
break;
}
}
@Override
public boolean onTouchBody(final int id, final Window window, final View view, MotionEvent event) {
removeCloseExpendMessage();
if(id == mWindowID && (event.getAction() == MotionEvent.ACTION_CANCEL
|| event.getAction() == MotionEvent.ACTION_UP
|| event.getAction() == MotionEvent.ACTION_OUTSIDE)) {
doBackOperate();
}
if(!Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_MOVE_ENABLE)) {
return false;
}
if (event.getAction() == MotionEvent.ACTION_MOVE) {
final StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams();
if (mPosition == POSITION_RIGHT_HALF && params.x < mWindowManager.getDefaultDisplay().getWidth() / 2 - mFlowList.getWidth()) { // not
mPosition = POSITION_LEFT_HALF;
changeHandlerPosition(mRightDrag, mLeftDrag);
mLeftDrag.setVisibility(View.VISIBLE);
mRightDrag.setVisibility(View.GONE);
mFlowList.setVisibility(View.VISIBLE);
mFlowList.setBackgroundResource(R.drawable.bar_left);
StandOutLayoutParams originalParams = getParams(id, window);
params.width = originalParams.width;
params.height = originalParams.height;
mSideBarLinearLayout.removeAllViews();
setLeftHandlerDragLayerPosition();
System.out.println("AddView");
mSideBarLinearLayout.addView(mFlowList);
mSideBarLinearLayout.addView(mHandlerDragLayer);
mSideBarLinearLayout.addView(mContentPanel);
mContentPanel.setVisibility(View.GONE);
mSideBarLinearLayout.requestLayout();
mSideBarLinearLayout.invalidate();
updateViewLayout(id, params);
} else if(mPosition == POSITION_LEFT_HALF && params.x >= mWindowManager.getDefaultDisplay().getWidth() / 2 - mFlowList.getWidth()) {
mPosition = POSITION_RIGHT_HALF;
changeHandlerPosition(mLeftDrag, mRightDrag);
mLeftDrag.setVisibility(View.GONE);
mRightDrag.setVisibility(View.VISIBLE);
mFlowList.setVisibility(View.VISIBLE);
mFlowList.setBackgroundResource(R.drawable.bar_right);
StandOutLayoutParams originalParams = getParams(id, window);
params.width = originalParams.width;
params.height = originalParams.height;
mSideBarLinearLayout.removeAllViews();
mContentPanel.setVisibility(View.GONE);
mSideBarLinearLayout.addView(mHandlerDragLayer);
mSideBarLinearLayout.addView(mContentPanel);
mSideBarLinearLayout.addView(mFlowList);
mSideBarLinearLayout.setTopView(mHandlerDragLayer);
//set handler position
setRightHandlerDragLayerPosition();
mSideBarLinearLayout.requestLayout();
mSideBarLinearLayout.invalidate();
updateViewLayout(id, params);
}//end if
} else if (event.getAction() == MotionEvent.ACTION_CANCEL
|| event.getAction() == MotionEvent.ACTION_UP) {
doActionUp(id, window);
}//end if
return false;
}
private void setLeftHandlerDragLayerPosition() {
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).leftMargin = (int)getResources().getDimensionPixelSize(R.dimen.flow_handler_left_margin);
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).rightMargin = 0;
}
private void setRightHandlerDragLayerPosition() {
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).leftMargin = 0;
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).rightMargin = (int)getResources().getDimensionPixelSize(R.dimen.flow_handler_left_margin);
}
void doBackOperate() {
if(mPosition == POSITION_LEFT_HALF && mMode == MODE_EXPEND) {
leftExpendToNormal();
} else if(mPosition == POSITION_RIGHT_HALF && mMode == MODE_EXPEND) {
rightExpendToNormal();
}
}
private void changeHandlerPosition(ImageView oldView, ImageView newView) {
FrameLayout.LayoutParams oldParams = (FrameLayout.LayoutParams) oldView.getLayoutParams();
int topMargin = oldParams.topMargin;
FrameLayout.LayoutParams newParams = (FrameLayout.LayoutParams) newView.getLayoutParams();
newParams.topMargin = topMargin;
}
/**
* TODO 拖动结束的时候设置
*
* @author user
* @date 2013-6-3
* @return void
*/
private void doActionUp(final int id, final Window window) {
getWindow().removeFlag(StandOutFlags.FLAG_WINDOW_MOVE_ENABLE);
getHandlerWindow().removeFlag(StandOutFlags.FLAG_WINDOW_MOVE_ENABLE);
final StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams();
// if touch edge,这个时候是大块的
if (params.x <= - mFlowList.getWidth()) {
//TO LEFT NORMAL
expendDragToLeftNormal(id, params, window);
} else if (params.x > - mFlowList.getWidth() && params.x <= mWindowManager.getDefaultDisplay().getWidth() / 2- mFlowList.getWidth()) {
//TO LEFT EXPEND
expendDragToLeftExpend(id, params, window);
} else if (params.x > mWindowManager.getDefaultDisplay().getWidth() / 2- mFlowList.getWidth()
&& params.x <= mWindowManager.getDefaultDisplay().getWidth() - mFlowList.getWidth()) {
//TO RIGHT EXPEND
expendDragToRightExpend(id, params, window);
} else {
//TO RIGHT NORMAL
expendDragToRightNormal(id, params, window);
}
}
public String getPersistentNotificationMessage(int id) {
return "Click to close all windows.";
}
public Intent getPersistentNotificationIntent(int id) {
return StandOutWindow.getCloseAllIntent(this, SideBar.class);
}
private OnTouchListener mDragTouchListener = new OnTouchListener() {
public boolean onTouch(View v, MotionEvent ev) {
if(ev.getAction() == MotionEvent.ACTION_DOWN) {
mHandlerWindowController.dispatchTouch(ev);
mWindowHandlerController.dispatchTouch(ev);
}
boolean retValue = mGestureDetector.onTouchEvent(ev);
return retValue;
}
};
private OnClickListener mEditClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
removeCloseExpendMessage();
if(mContentPanel.isShown()){
editToExpend();
} else {
expendToEdit();
}//end if
}
};
private void loadFlowData() {
mFlowData.clear();
mFlowData = AppInfoCacheDB.getInstance(SideBar.this).getAllFlowPanelItems();
}
private void loadContentData() {
mContentData.clear();
}
private void asynLoadContentData() {
new Thread(new Runnable() {
@Override
public void run() {
ArrayList<AppInfoModel> contentPanelItems = AppInfoCacheDB.getInstance(SideBar.this).getAllContentPanelItems();
if (contentPanelItems.size() > 0) {
mContentData.clear();
for (AppInfoModel appInfoModel : contentPanelItems) {
final AppInfoModel model = appInfoModel;
mHandler.post(new Runnable() {
@Override
public void run() {
mContentData.add(model);
mContentAdapter.notifyDataSetChanged();
}// end run
});// end post
}// end for
} else {
final List<ResolveInfo> systemInfo = ParseUtils.getAllApps(SideBar.this);
for (ResolveInfo resolveApp : systemInfo) {
final AppInfoModel appInfoModel = new AppInfoModel();
appInfoModel.packageName = resolveApp.activityInfo.packageName;
appInfoModel.className = resolveApp.activityInfo.name;
appInfoModel.title = resolveApp.loadLabel(mPackageManager).toString();
appInfoModel.iconkey = resolveApp.activityInfo.packageName
+ appInfoModel.title;
appInfoModel.container = Constant.CONTAINER_CONTENT_PANEL;
long result = AppInfoCacheDB.getInstance(SideBar.this).insertSiderBarItems(appInfoModel);
if (result == -1)
continue;
BitmapDrawable bitmapDrawable = (BitmapDrawable) resolveApp
.loadIcon(mPackageManager);
LocalImageCache.getInstance(SideBar.this).put(appInfoModel.iconkey,
bitmapDrawable.getBitmap());
mHandler.post(new Runnable() {
@Override
public void run() {
mContentData.add(appInfoModel);
mContentAdapter.notifyDataSetChanged();
}
});
}
}
}
}).start();
}
//when destory clear all database data and save new data from listView
@Override
public void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
unRigisterBroadcastReceiver();
if(mFlowAdapter!=null)
mFlowAdapter.onDestory();
AppInfoCacheDB.getInstance(this).deleteAllFlowPanelItems();
if(mFlowPanel!=null){
ArrayList<AppInfoModel> list = (ArrayList<AppInfoModel>) ((FlowAdapter)mFlowPanel.getAdapter()).getActivityInfoList();
for(AppInfoModel model:list){
model.container = Constant.CONTAINER_FLOW_PANEL;
try {
AppInfoCacheDB.getInstance(this).insertSiderBarItems(model);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
public void setMode(int mode) {
this.mMode = mode;
}
public int getMode() {
return mMode;
}
public Window getWindow() {
return super.getWindow(mWindowID);
}
public Window getHandlerWindow() {
return super.getWindow(mHandlerWindowID);
}
public View getWindowBody() {
return mWindowBody;
}
@Override
public boolean onDown(MotionEvent arg0) {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
System.out.println("velocityX="+velocityX);
if (mMode == MODE_NORMAL) {
if(mPosition == POSITION_RIGHT_HALF) {
if(velocityX < 0) {
rightNormalToExpend();
}//end if
} else {
if(velocityX > 0) {
leftNormalToExpend();
}//end if
}//end if
return true;
} else if(mMode == MODE_EXPEND) {
if(mPosition == POSITION_RIGHT_HALF) {
if(velocityX > 0) {
rightExpendToNormal();
}//end if
} else {
if(velocityX < 0) {
leftExpendToNormal();
}//end if
}//end if
}//end if
return false;
}
@Override
public void onLongPress(MotionEvent arg0) {
if(mMode == MODE_NORMAL) {
normalToDrag();
} else if(mMode == MODE_EXPEND) {
expendToExpendDrag();
}//end if
}
@Override
public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onShowPress(MotionEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public boolean onSingleTapUp(MotionEvent arg0) {
if(mPosition == POSITION_LEFT_HALF) {
if (mMode == MODE_NORMAL) {
leftNormalToExpend();
} else if (mMode == MODE_EXPEND) {
leftExpendToNormal();
}//end if
} else {
if (mMode == MODE_NORMAL) {
rightNormalToExpend();
} else if (mMode == MODE_EXPEND) {
rightExpendToNormal();
}
}//end if
return true;
}
private void expendToEdit() {
mEditButton.setText(R.string.edit_button_state_ok);
mHandlerDragLayer.setVisibility(View.GONE);
if(mPosition == POSITION_RIGHT_HALF){
mFlowList.setBackgroundResource(R.drawable.bar_right);
mContentPanel.setVisibility(View.VISIBLE);
mSideBarLinearLayout.setBackgroundResource(R.drawable.multiwindow_edit_bg);
StandOutLayoutParams layoutParams = (StandOutLayoutParams)getWindow(mWindowID).getLayoutParams();
layoutParams.x = 0;
layoutParams.y = 0;
updateViewLayout(mWindowID, layoutParams);
mMode = MODE_EDIT;
getWindow(mWindowID).removeFlag(StandOutFlags.FLAG_WINDOW_MOVE_ENABLE);
} else {
mFlowList.setBackgroundResource(R.drawable.bar_left);
mLeftEditExpanAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation arg0) {
}
@Override
public void onAnimationRepeat(Animation arg0) {
}
@Override
public void onAnimationEnd(Animation arg0) {
mContentPanel.setVisibility(View.VISIBLE);
mSideBarLinearLayout.setBackgroundResource(R.drawable.multiwindow_edit_bg);
mSideBarLinearLayout.requestLayout();
mMode = MODE_EDIT;
getWindow(mWindowID).removeFlag(StandOutFlags.FLAG_WINDOW_MOVE_ENABLE);
}
});
mContentPanel.startAnimation(mLeftEditExpanAnimation);
}
removeCloseExpendMessage();
}
//edit state to expend
private void editToExpend() {
mEditButton.setText(R.string.edit_button_state_edit);
mContentPanel.setVisibility(View.GONE);
mSideBarLinearLayout.setBackgroundResource(0);
mMode = MODE_EXPEND;
mHandlerDragLayer.setVisibility(View.VISIBLE);
getWindow(mWindowID).addFlag(StandOutFlags.FLAG_WINDOW_MOVE_ENABLE);
if(mPosition == POSITION_RIGHT_HALF){
StandOutLayoutParams layoutParams = (StandOutLayoutParams)getWindow(mWindowID).getLayoutParams();
layoutParams.y = 0;
layoutParams.x = mWindowManager.getDefaultDisplay().getWidth() - mFlowList.getWidth() - mRightDrag.getWidth()
-getResources().getDimensionPixelSize(R.dimen.flow_handler_left_margin);
updateViewLayout(mWindowID, layoutParams);
mFlowList.setBackgroundResource(R.drawable.bar_right);
sendCloseRightExpendMessage();
} else {
sendCloseLeftExpendMessage();
mFlowList.setBackgroundResource(R.drawable.bar_left);
}
}
//normal state to handler drag state
private void normalToDrag() {
Window window = getWindow(mHandlerWindowID);
mMode = MODE_DRAG;
window.addFlag(StandOutFlags.FLAG_WINDOW_MOVE_ENABLE);
mWindowHandlerController.startDrag();
removeCloseExpendMessage();
}
//handler expend state to handler expend drag state
private void expendToExpendDrag() {
Window window = getWindow(mWindowID);
mMode = MODE_EXPEND_DRAG;
window.addFlag(StandOutFlags.FLAG_WINDOW_MOVE_ENABLE);
mHandlerWindowController.startDrag();
removeCloseExpendMessage();
}
//expend drag to left expend
private void expendDragToLeftExpend(int id, StandOutLayoutParams params, Window window) {
mLeftDrag.setVisibility(View.VISIBLE);
mRightDrag.setVisibility(View.GONE);
mFlowList.setVisibility(View.VISIBLE);
mFlowList.setBackgroundResource(R.drawable.bar_left);
StandOutLayoutParams originalParams = getParams(id, window);
params.y = 0;
params.x = 0;
params.width = originalParams.width;
params.height = originalParams.height;
updateViewLayout(id, params);
setMode(MODE_EXPEND);
sendCloseLeftExpendMessage();
}
//expend drag to left normal
private void expendDragToLeftNormal(int id, StandOutLayoutParams params, Window window) {
mLeftDrag.setVisibility(View.VISIBLE);
Window handlerWindow = getHandlerWindow();
StandOutLayoutParams handlerParams = handlerWindow.getLayoutParams();
handlerParams.y = ((FrameLayout.LayoutParams)mLeftDrag.getLayoutParams()).topMargin;
updateViewLayout(mHandlerWindowID, handlerParams);
mHandlerDragLayer.setVisibility(View.GONE);
mRightDrag.setVisibility(View.GONE);
mFlowList.setVisibility(View.GONE);
params.y = 0;
params.x = 0;
updateViewLayout(id, params);
mWindowHandlerDragLayer.setVisibility(View.VISIBLE);
mWindowLeftDrag.setVisibility(View.VISIBLE);
setMode(MODE_NORMAL);
removeCloseExpendMessage();
}
//expend drag to right expend
private void expendDragToRightExpend(int id, StandOutLayoutParams params, Window window) {
mLeftDrag.setVisibility(View.GONE);
mRightDrag.setVisibility(View.VISIBLE);
mFlowList.setVisibility(View.VISIBLE);
mFlowList.setBackgroundResource(R.drawable.bar_right);
StandOutLayoutParams originalParams = getParams(id, window);
params.y = 0;
params.x = mWindowManager.getDefaultDisplay().getWidth() - mFlowList.getWidth() - mRightDrag.getWidth()
-getResources().getDimensionPixelSize(R.dimen.flow_handler_left_margin);
params.width = originalParams.width;
params.height = originalParams.height;
updateViewLayout(id, params);
setMode(MODE_EXPEND);
sendCloseRightExpendMessage();
}
//expend drag to right normal
private void expendDragToRightNormal(int id, StandOutLayoutParams params, Window window) {
mFlowList.setVisibility(View.GONE);
mLeftDrag.setVisibility(View.GONE);
mRightDrag.setVisibility(View.VISIBLE);
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).leftMargin = 0;
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).rightMargin = 0;
StandOutLayoutParams originalParams = getParams(id, window);
params.y = 0;
params.x = mWindowManager.getDefaultDisplay().getWidth() - mRightDrag.getWidth();
params.width = originalParams.width;
params.height = originalParams.height;
updateViewLayout(id, params);
setMode(MODE_NORMAL);
removeCloseExpendMessage();
}
public void leftExpendToNormal() {
final StandOutLayoutParams params = (StandOutLayoutParams) getWindow(mHandlerWindowID).getLayoutParams();
mWindowHandlerDragLayer.setVisibility(View.VISIBLE);
mWindowLeftDrag.setVisibility(View.VISIBLE);
mWindowRightDrag.setVisibility(View.INVISIBLE);
mDragLayer.setVisibility(View.INVISIBLE);
mHandlerDragLayer.setVisibility(View.INVISIBLE);
mFlowList.setVisibility(View.INVISIBLE);
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).leftMargin = 0;
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).rightMargin = 0;
params.x = 0;
mMode = MODE_NORMAL;
updateViewLayout(mHandlerWindowID, params);
getHandlerWindow().requestFocus();
removeCloseExpendMessage();
}
private void leftNormalToExpend() {
final StandOutLayoutParams handlerParams = (StandOutLayoutParams) getWindow(mHandlerWindowID).getLayoutParams();
final StandOutLayoutParams params = (StandOutLayoutParams) this.getParams(mWindowID, getWindow());
mDragLayer.setVisibility(View.VISIBLE);
mHandlerDragLayer.setVisibility(View.VISIBLE);
mWindowHandlerDragLayer.setVisibility(View.INVISIBLE);
mFlowList.setVisibility(View.VISIBLE);
handlerParams.x = 0;
updateViewLayout(mHandlerWindowID, handlerParams);
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).leftMargin = (int)getResources().getDimensionPixelSize(R.dimen.flow_handler_left_margin);
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).rightMargin = 0;
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).topMargin = handlerParams.y;
params.x = 0;
params.y = 0;
updateViewLayout(mWindowID, params);
mMode = MODE_EXPEND;
sendCloseLeftExpendMessage();
}
public void rightExpendToNormal() {
final StandOutLayoutParams params = (StandOutLayoutParams) getWindow(mHandlerWindowID).getLayoutParams();
mWindowHandlerDragLayer.setVisibility(View.VISIBLE);
mWindowLeftDrag.setVisibility(View.INVISIBLE);
mWindowRightDrag.setVisibility(View.VISIBLE);
mDragLayer.setVisibility(View.INVISIBLE);
mHandlerDragLayer.setVisibility(View.INVISIBLE);
mFlowList.setVisibility(View.INVISIBLE);
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).leftMargin = 0;
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).rightMargin = 0;
mMode = MODE_NORMAL;
params.x = mWindowManager.getDefaultDisplay().getWidth() - mRightDrag.getWidth();
updateViewLayout(mHandlerWindowID, params);
getHandlerWindow().requestFocus();
removeCloseExpendMessage();
}
private void rightNormalToExpend() {
final StandOutLayoutParams handlerParams = (StandOutLayoutParams) getWindow(mHandlerWindowID).getLayoutParams();
final StandOutLayoutParams params = (StandOutLayoutParams) this.getParams(mWindowID, getWindow());
mDragLayer.setVisibility(View.VISIBLE);
mHandlerDragLayer.setVisibility(View.VISIBLE);
mWindowHandlerDragLayer.setVisibility(View.INVISIBLE);
mFlowList.setVisibility(View.VISIBLE);
updateViewLayout(mHandlerWindowID, handlerParams);
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).leftMargin = 0;
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).rightMargin = (int)getResources().getDimensionPixelSize(R.dimen.flow_handler_left_margin);
((LinearLayout.LayoutParams)mHandlerDragLayer.getLayoutParams()).topMargin = handlerParams.y;
mMode = MODE_EXPEND;
params.y = 0;
params.x = mWindowManager.getDefaultDisplay().getWidth() - mFlowList.getWidth() - mRightDrag.getWidth()
-getResources().getDimensionPixelSize(R.dimen.flow_handler_left_margin);
updateViewLayout(mWindowID, params);
sendCloseRightExpendMessage();
}
public boolean onKeyEvent(int id, Window window, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if(mPosition == POSITION_LEFT_HALF && mMode == MODE_EXPEND) {
leftExpendToNormal();
} else if(mPosition == POSITION_RIGHT_HALF && mMode == MODE_EXPEND) {
rightExpendToNormal();
} else if(mMode == MODE_EDIT) {
editToExpend();
return true;
}//end if
break;
}
} else if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.isLongPress()) {
SideBar.this.stopSelf();
android.os.Process.killProcess(Process.myPid());
}
break;
default:
break;
}
}
return false;
}
/**
* TODO
* @author zhangf
* @date 2013-6-17
* @return void
*/
public void notifyDataSize(int count) {
// TODO Auto-generated method stub
}
private void registerBroadCastReceiver(){
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_LOCALE_CHANGED);
SideBar.this.registerReceiver(mConfigChangeReceiver, intentFilter);
}
BroadcastReceiver mConfigChangeReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
mContentAdapter.chageLocal();
mFlowAdapter.chageLoacal();
mEditButton.setText(R.string.edit_button_state_edit);
}
};
private void unRigisterBroadcastReceiver(){
unregisterReceiver(mConfigChangeReceiver);
}
/**
* close left handler
*/
private void sendCloseLeftExpendMessage() {
removeCloseExpendMessage();
mHandler.sendEmptyMessageDelayed(MSG_LEFT_EXPEND_TO_NORMAL, MSG_DELAY_TIME);
}
private void removeCloseExpendMessage() {
if(mHandler.hasMessages(MSG_LEFT_EXPEND_TO_NORMAL)) {
mHandler.removeMessages(MSG_LEFT_EXPEND_TO_NORMAL);
}
if(mHandler.hasMessages(MSG_RIGHT_EXPEND_TO_NORMAL)) {
mHandler.removeMessages(MSG_RIGHT_EXPEND_TO_NORMAL);
}
}
private void sendCloseRightExpendMessage() {
removeCloseExpendMessage();
mHandler.sendEmptyMessageDelayed(MSG_RIGHT_EXPEND_TO_NORMAL, MSG_DELAY_TIME);
}
}
| [
"[email protected]"
] | |
b856908f4029e3479af573de74bb9906e1840fbd | c26912f3375141bb2fb3c07357289f20d88bcf2d | /JavaAlgorithm/src/main/java/algo/tzashinorpu/ThirdRound/Chapter11/isPerfectSquare_367.java | 7e72ec4d9a31700f9ca5f43970fb4601c67af084 | [
"MIT"
] | permissive | TzashiNorpu/Algorithm | 2013b5781d0ac517f2857633c39aee7d2e64d240 | bc9155c4daf08041041f84c2daa9cc89f82c2240 | refs/heads/main | 2023-07-08T06:30:50.080352 | 2023-06-28T10:01:58 | 2023-06-28T10:01:58 | 219,323,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 815 | java | package algo.tzashinorpu.ThirdRound.Chapter11;
public class isPerfectSquare_367 {
public boolean isPerfectSquare(int num) {
/*long l = 0, r = num;
long mid;
while (l <= r) {
mid = (l + r) / 2;
if (mid * mid > num) {
r = mid - 1;
}
if (mid * mid < num) {
l = mid + 1;
}
if (mid * mid == num) return true;
}
return false;*/
/* 1 = 1
4 = 1 + 3
9 = 1 + 3 + 5
16 = 1 + 3 + 5 + 7
25 = 1 + 3 + 5 + 7 + 9
36 = 1 + 3 + 5 + 7 + 9 + 11
....
so 1+3+...+(2n-1) = (2n-1 + 1)n/2 = n*n*/
int k = 1;
while (num > 0) {
num -= k;
k += 2;
}
return num == 0;
}
}
| [
"[email protected]"
] | |
c2d6760193aee851f54c7c10da2ec12c82fbddb0 | 8d6b7d9fbe7bee2c2ce0f211ff204a051d47763c | /jbm/src/main/java/com/innovazions/jbm/controller/CustomerInfoController.java | faa302f2f166bffac9553bc6db87dde3dd098c16 | [] | no_license | sharafnu/jbm | bdc36c7fcd72776cabc8e3a34f33e62238117b56 | e1dff76a34f38a852667b36306c967abebafb4e9 | refs/heads/master | 2021-01-19T20:24:47.206860 | 2014-01-01T15:25:51 | 2014-01-01T15:25:51 | 15,563,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,603 | java | package com.innovazions.jbm.controller;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Handles requests for the customer related actions.
*/
@Controller
public class CustomerInfoController {
private static final Logger logger = LoggerFactory.getLogger(CustomerInfoController.class);
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/customerInfoAdd", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "customerInfoAdd";
}
@RequestMapping(value = "/customerInfoEdit", method = RequestMethod.GET)
public String welcome(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "customerInfoEdit";
}
}
| [
"[email protected]"
] | |
be1605c152c303fb4d5c4888bec6fea85db603f5 | eba18ce6b87ac8836808a8e60fd10955deb49892 | /chapter_001/src/main/java/ru/job4j/tracker/Input.java | 8637cca69d7e6da8e05b0398c366417a4e8f7583 | [] | no_license | gvg-job4j/job4j-junior | 18681646ac6ff660be0499ed8f3d6e17d80dad02 | 108763cba45e387bda577106e09fa8f151c3450d | refs/heads/master | 2022-09-21T17:16:45.386711 | 2020-10-15T22:01:57 | 2020-10-15T22:01:57 | 144,773,008 | 0 | 0 | null | 2022-09-08T00:59:45 | 2018-08-14T21:17:37 | Java | UTF-8 | Java | false | false | 189 | java | package ru.job4j.tracker;
/**
* @author Valeriy Gyrievskikh
* @since 21.06.2018.
*/
public interface Input {
String ask(String message);
int ask(String message, int[] range);
}
| [
"[email protected]"
] | |
3b95c1bb1a770efee17f6291b05afda7f8a09626 | 2c37aa70407c4970702cc1d148f215969b1caeb7 | /kafka-producer-consumer/code/producer/src/main/java/Main.java | 165d06985aafa17d081e25f596a9d8e809e60e6e | [] | no_license | kafka-learn/demos | fc4a3c7faa32de440c4da13b1bca427d7f647cb6 | 4fc588891e03ccd777f89a0c491dcb9c58ca7fe8 | refs/heads/master | 2020-03-18T06:44:27.783147 | 2018-06-09T07:55:24 | 2018-06-09T07:55:24 | 134,412,622 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,789 | java |
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import java.util.Arrays;
import java.util.Properties;
import java.util.Scanner;
/**
* @Author mubi
* @Date 2018/5/28 上午8:27
*/
public class Main {
public static void main(String args[]){
Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
// props.put("acks", "all");
// props.put("retries", 0);
// props.put("batch.size", 16384);
// props.put("linger.ms", 1);
// props.put("buffer.memory", 33554432);
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
// props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
// props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
//生产者发送消息
String topic = "topic-test1";
Producer<String, String> procuder = new KafkaProducer<String, String>(props);
for (int i = 1; i <= 10; i++) {
//String value = "value_" + i;
Scanner scanner = new Scanner(System.in);
String value = scanner.next();
//System.out.println(value);
ProducerRecord<String, String> msg = new ProducerRecord<String, String>(topic, value);
procuder.send(msg);
}
procuder.flush();
}
}
| [
"[email protected]"
] | |
273b28f32ac0325ea7f4642895c5a889cd393f6b | 6e414199f2f81f57e4bb775ed1fcf03af34acfb4 | /spring_proxy/src/main/java/com/jdkproxy/Main.java | 73cc36a6f197f1709facdf4d4fad53d9d37274e4 | [] | no_license | wh1t3zz-baole/spring_review | 0d87ef8ee743ecae3be2ea51001509859209bf14 | 069e6dab06750c50ba80c4abac0b09d06a4ecbae | refs/heads/main | 2023-08-28T14:34:26.379359 | 2021-10-29T08:09:38 | 2021-10-29T08:09:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package com.jdkproxy;
import com.jdkproxy.impl.AdminServiceImpl;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* @author mac guopan
* @description spring_review Main
* @date 2021/10/22 1:41 下午
*/
public class Main {
public static void main(String[] args) {
System.out.println("创建目标对象");
AdminService adminService = new AdminServiceImpl();
System.out.println("目标对象:"+adminService.getClass());
AdminService proxy = (AdminService) Proxy.newProxyInstance(adminService.getClass().getClassLoader(), adminService.getClass().getInterfaces(), new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
System.out.println("前置");
Object object = method.invoke(adminService);
System.out.println("后置");
return object;
}
});
Object ob = proxy.find();
System.out.println("代理对象:"+ob.getClass());
}
}
| [
"[email protected]"
] | |
ef04a08e08a6e157bfdd018aee52715394364c38 | e79e1dc6fb1138a2f8b55a4da6d4888cff35b64a | /ctci/linkedlist/LinkedListNode.java | e64b2e5f59db4ffae41541977fb96d35b6952404 | [] | no_license | iShiBin/info6205 | d65cccede748ddaa0d896d9eff07c1801036cfd8 | 1b4220d5fcff55f12d1b72b9406e60468a9b5b2d | refs/heads/master | 2021-08-28T01:07:56.864802 | 2017-12-11T01:17:00 | 2017-12-11T01:17:00 | 103,600,468 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,144 | java | package linkedlist;
public class LinkedListNode {
LinkedListNode next = null;
int data;
public LinkedListNode(){}
public LinkedListNode(int d) {data = d;}
public LinkedListNode(int[] nums) {
if(nums == null) return;
this.data = nums[0];
for(int i = 1; i < nums.length; i++){
this.append(nums[i]);
}
}
public void append(int d){
LinkedListNode end = new LinkedListNode(d);
LinkedListNode n = this;
while(n.next != null) {
n = n.next;
}
n.next = end;
}
public void append(LinkedListNode node){
LinkedListNode tail = this;
while(tail.next != null) tail = tail.next;
tail.next = node;
}
public int getLength() {
if(this == null) return 0;
LinkedListNode literator = this;
int length = 0;
while(literator != null) {
length++;
literator = literator.next;
}
return length;
}
public void reverse() {
int l = getLength();
int[] datas = new int[l];
LinkedListNode node = this;
for(int i = 0; i<l; i++) {
datas[i] = node.data;
node = node.next;
}
node = this;
for(int i=l-1; i>=0; i--) {
node.data = datas[i];
node = node.next;
}
}
//todo
public void removeHead() {
if(this == null) return ;
// cannot move remove head if there is only one node
if(this.next == null) return ;
LinkedListNode node = this;
do{
node.data = node.next.data;
node = node.next;
}while(node.next != null);
node = null;
}
//todo
public void removeTail() {
if(this == null) return ;
LinkedListNode node = this.next;
do{
node = node.next;
}while(false);
}
public boolean isCircling(){
LinkedListNode slow=this, fast=this;
while(fast!=null && fast.next!=null){
slow=slow.next;
fast=fast.next.next;
if(fast==slow) break;
}
if(fast==null || fast.next==null) return false;
else return true;
}
public String toString(){
if(this == null) return "null";
StringBuffer buffer = new StringBuffer("[");
buffer.append(this.data);
LinkedListNode node = next;
while(node != null ) {
buffer.append("->");
buffer.append(node.data);
node = node.next;
}
buffer.append("]");
return buffer.toString();
}
}
| [
"[email protected]"
] | |
356c27ea587535a6f98b4688770428c186af53b7 | b6b5d78453dd0d091d8b5522880b37ab4c02a0ad | /soul-client/soul-client-dubbo/soul-client-apache-dubbo/src/test/java/org/dromara/soul/client/apache/dubbo/ApacheDubboServiceBeanPostProcessorTest.java | f1cd854260408e995230e197548787e3683107fd | [
"Apache-2.0"
] | permissive | Yejiajun/soul | aaf8b263ec7e0dcec8f33d73e012cfb82396df38 | a00c8e153ae9a427567320389fecdcb5724170df | refs/heads/master | 2023-02-05T09:03:52.187300 | 2020-12-24T02:53:30 | 2020-12-24T02:53:30 | 318,404,435 | 1 | 0 | Apache-2.0 | 2020-12-24T02:53:32 | 2020-12-04T04:37:21 | Java | UTF-8 | Java | false | false | 6,334 | 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 org.dromara.soul.client.apache.dubbo;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.config.spring.ServiceBean;
import org.dromara.soul.client.dubbo.common.annotation.SoulDubboClient;
import org.dromara.soul.client.dubbo.common.config.DubboConfig;
import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.aop.interceptor.PerformanceMonitorInterceptor;
import org.springframework.aop.support.NameMatchMethodPointcutAdvisor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.event.ContextRefreshedEvent;
import java.util.Collections;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* Test case for {@link ApacheDubboServiceBeanPostProcessor}.
*
* @author HoldDie
*/
@RunWith(MockitoJUnitRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public final class ApacheDubboServiceBeanPostProcessorTest {
private static ApacheDubboServiceBeanPostProcessor apacheDubboServiceBeanPostProcessor;
@Test
public void testOnApplicationEventWithNonDubboConfigContextPath() {
DubboConfig mockDubboConfig = new DubboConfig();
mockDubboConfig.setAppName("dubbo");
try {
mockDubboConfig.setAdminUrl("http://127.0.0.1:28080");
mockDubboConfig.setContextPath(null);
apacheDubboServiceBeanPostProcessor = new ApacheDubboServiceBeanPostProcessor(mockDubboConfig);
} catch (RuntimeException e) {
Assert.assertEquals("apache dubbo client must config the contextPath, adminUrl", e.getMessage());
}
try {
mockDubboConfig.setAdminUrl(null);
mockDubboConfig.setContextPath("/dubbo");
apacheDubboServiceBeanPostProcessor = new ApacheDubboServiceBeanPostProcessor(mockDubboConfig);
} catch (RuntimeException e) {
Assert.assertEquals("apache dubbo client must config the contextPath, adminUrl", e.getMessage());
}
}
@Test
public void testOnApplicationEventNormally() {
DubboConfig mockDubboConfig = new DubboConfig();
mockDubboConfig.setAdminUrl("http://127.0.0.1:28080");
mockDubboConfig.setContextPath("/dubbo");
apacheDubboServiceBeanPostProcessor = new ApacheDubboServiceBeanPostProcessor(mockDubboConfig);
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MockApplicationConfiguration.class);
ContextRefreshedEvent contextRefreshedEvent = new ContextRefreshedEvent(applicationContext);
apacheDubboServiceBeanPostProcessor.onApplicationEvent(contextRefreshedEvent);
}
@Test
public void testOnApplicationEventWithNonNullContextRefreshedEventParent() {
DubboConfig mockDubboConfig = new DubboConfig();
mockDubboConfig.setAdminUrl("http://127.0.0.1:28080");
mockDubboConfig.setContextPath("/dubbo");
apacheDubboServiceBeanPostProcessor = new ApacheDubboServiceBeanPostProcessor(mockDubboConfig);
ApplicationContext mockApplicationContext = mock(ApplicationContext.class);
when(mockApplicationContext.getParent()).thenReturn(new AnnotationConfigApplicationContext());
ContextRefreshedEvent contextRefreshedEvent = new ContextRefreshedEvent(mockApplicationContext);
apacheDubboServiceBeanPostProcessor.onApplicationEvent(contextRefreshedEvent);
}
interface MockDubboService {
String foo();
}
static class MockDubboServiceImpl implements MockDubboService {
@Override
@SoulDubboClient(path = "/mock/foo")
public String foo() {
return "bar";
}
}
static class MockApplicationConfiguration {
@Bean
public MockDubboService dubboService() {
NameMatchMethodPointcutAdvisor advisor = new NameMatchMethodPointcutAdvisor();
advisor.setAdvice(new PerformanceMonitorInterceptor());
advisor.setMappedName("foo");
ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
proxyFactoryBean.setProxyTargetClass(true);
proxyFactoryBean.setTarget(new MockDubboServiceImpl());
return (MockDubboService) proxyFactoryBean.getObject();
}
@Bean
public ServiceBean<Object> mockServiceBean() {
Service service = mock(Service.class);
when(service.interfaceName()).thenReturn(MockDubboService.class.getName());
ServiceBean<Object> serviceBean = new ServiceBean<>(service);
serviceBean.setRef(this.dubboService());
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("ApacheDubboServiceBeanPostProcessorTest");
serviceBean.setApplication(applicationConfig);
RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress(RegistryConfig.NO_AVAILABLE);
serviceBean.setRegistries(Collections.singletonList(registryConfig));
return serviceBean;
}
}
}
| [
"[email protected]"
] | |
5de32b30adfb12e50d861b51fcd99deb3a222de5 | 55cd1d6c2dbc7289815c6599e709c960724c8c13 | /app/src/main/java/com/example/hrsystem/employee/ApiClient.java | e66aa2a5ceac3971ee9e6779b035ca312953a8c1 | [] | no_license | atharvara/Hrsystem | 0becc033b2ed51465cf64e7e36d9663f0e6b054d | 012d3c8f7a7840131efacf218c0faad109d94e73 | refs/heads/master | 2023-06-10T23:58:44.230775 | 2021-06-26T04:57:46 | 2021-06-26T04:57:46 | 348,231,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.example.hrsystem.employee;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
public static final String BASE_URL = "https://shinetech.site/shinetech.site/hrmskbp/Employee/";
public static Retrofit retrofit;
public static Retrofit getApiClient(){
if (retrofit==null){
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
| [
"[email protected]"
] | |
825f2df51167eea02076b6bdd98fbde57c6710ac | 5a0f9c6479c6256970c6de4a4709f06cbadbd45c | /상속/Test.java | b001c4d708d721edf00776b0f3b35dca7f3b631c | [] | no_license | zaas0768/Java_Kopo | 93de256468463714d3fd04c467314c1291c443a0 | 72258fa608a756297bd3abdba55cbb317215d1c0 | refs/heads/master | 2020-05-03T02:28:57.491601 | 2019-04-19T12:52:36 | 2019-04-19T12:52:36 | 178,370,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | import java.util.Scanner;
public class Test {
int number1 = 0;
int number2 = 0;
public void inputNumber() {
System.out.println("두개의 숫자를 입력해주세요.");
System.out.println("첫번째 숫자 입력");
Scanner scanner = new Scanner(System.in);
this.number1 = scanner.nextInt();
System.out.println("두번째 숫자 입력");
this.number2 = scanner.nextInt();
}
public void printResult() {
System.out.println("입력된 숫자는 : " + this.number1 + ", " + this.number2 + "입니다.");
}
}
| [
"[email protected]"
] | |
f85b688ad9f25115a9b88f9c525aa5ce909475e8 | c02ca0d6a603ca2406c11dc9c1eb7c9c9157663d | /Uniclick/src/campana353/uniclick_05d.java | bf089162f9a869e31c4d87325c2411b883c2260f | [] | no_license | ivanhoeGA/AutomationVisor | 6e1f3619cbf8126f5e9a05c0ccb1bdb2c082204a | a7967157953cb4dd5cc6206d501a98ec6553a971 | refs/heads/master | 2021-03-28T07:53:30.742207 | 2020-03-13T00:47:56 | 2020-03-13T00:47:56 | 247,850,988 | 1 | 0 | null | 2020-03-17T01:20:05 | 2020-03-17T01:20:04 | null | WINDOWS-1250 | Java | false | false | 4,598 | java | package campana353;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class uniclick_05d {
public static void main(String[] args) throws InterruptedException {
// Abrir el browser y navegar a la url
ChromeOptions opts = new ChromeOptions();
opts.addArguments("--disable-notifications");
WebDriver driver = new ChromeDriver(opts);
driver.navigate().to("https://uniclick.visor.io/login/uniclick");
driver.manage().window().maximize();
// Ingresar credenciales para abrir navegador
driver.findElement(By.id("emaIndex")).sendKeys("[email protected]");
driver.findElement(By.id("pswIndex")).sendKeys("Mexico123*");
driver.findElement(By.id("submit")).click();
Thread.sleep(5500);
// Ubicarse en la etapa correspondiente para la carga de los documentos del solicitante
driver.findElement(By.xpath("//*[contains(text(),'Documentos del solicitante PM')]")).click();
//Se carga el documento para "Financieros en original no mayor a 3 meses"
driver.findElement(By.xpath("//*[@id='btnSubirFile'][contains( @data-campo, 'Documentos_del_Solicitante__Financieros_en_original_no_mayor_a_3_meses')]")).click();
driver.findElement(By.name("upl")).sendKeys("C:\\b2c64374-15e6-4aa7-af9b-b94c537a875c.pdf");
Thread.sleep(2000);
driver.findElement(By.xpath("//*[contains( @value, 'Guardar')]")).click();
Thread.sleep(4000);
//Se carga el documento para "Estados de cuenta (3 últimos meses)"
driver.findElement(By.xpath("//*[@id='btnSubirFile'][contains( @data-campo, 'Documentos_del_Solicitante__Estados_de_cuenta_3_últimos_meses')]")).click();
driver.findElement(By.name("upl")).sendKeys("C:\\b2c64374-15e6-4aa7-af9b-b94c537a875c.pdf");
Thread.sleep(2000);
driver.findElement(By.xpath("//*[contains( @value, 'Guardar')]")).click();
Thread.sleep(4000);
//Se carga el documento para "Comprobante de domicilio"
driver.findElement(By.xpath("//*[@id='btnSubirFile'][contains( @data-campo, 'Documentos_del_Solicitante__Comprobante_de_domicilio')]")).click();
driver.findElement(By.name("upl")).sendKeys("C:\\b2c64374-15e6-4aa7-af9b-b94c537a875c.pdf");
Thread.sleep(2000);
driver.findElement(By.xpath("//*[contains( @value, 'Guardar')]")).click();
Thread.sleep(4000);
//Se carga el documento para "Identificación vigente (rep. legal o PFAE)"
driver.findElement(By.xpath("//*[@id='btnSubirFile'][contains( @data-campo, 'Documentos_del_Solicitante__Identificación_vigente_rep_legal_o_PFAE')]")).click();
driver.findElement(By.name("upl")).sendKeys("C:\\b2c64374-15e6-4aa7-af9b-b94c537a875c.pdf");
Thread.sleep(2000);
driver.findElement(By.xpath("//*[contains( @value, 'Guardar')]")).click();
Thread.sleep(4000);
//Se carga el documento para "Constancia de identificación fiscal"
driver.findElement(By.xpath("//*[@id='btnSubirFile'][contains( @data-campo, 'Documentos_del_Solicitante__Constancia_de_identificación_fiscal')]")).click();
driver.findElement(By.name("upl")).sendKeys("C:\\b2c64374-15e6-4aa7-af9b-b94c537a875c.pdf");
Thread.sleep(2000);
driver.findElement(By.xpath("//*[contains( @value, 'Guardar')]")).click();
Thread.sleep(4000);
//Se carga el documento para "FIEL (Impresión SAT)"
driver.findElement(By.xpath("//*[@id='btnSubirFile'][contains( @data-campo, 'Documentos_del_Solicitante__FIEL_Impresión_SAT')]")).click();
driver.findElement(By.name("upl")).sendKeys("C:\\b2c64374-15e6-4aa7-af9b-b94c537a875c.pdf");
Thread.sleep(2000);
driver.findElement(By.xpath("//*[contains( @value, 'Guardar')]")).click();
Thread.sleep(4000);
//Se carga el documento para "Acta constitutiva"
driver.findElement(By.xpath("//*[@id='btnSubirFile'][contains( @data-campo, 'Documentos_del_Solicitante__Acta_constitutiva')]")).click();
driver.findElement(By.name("upl")).sendKeys("C:\\b2c64374-15e6-4aa7-af9b-b94c537a875c.pdf");
Thread.sleep(2000);
driver.findElement(By.xpath("//*[contains( @value, 'Guardar')]")).click();
Thread.sleep(4000);
//Se carga el documento para "Acta de poderes"
driver.findElement(By.xpath("//*[@id='btnSubirFile'][contains( @data-campo, 'Documentos_del_Solicitante__Acta_de_poderes')]")).click();
driver.findElement(By.name("upl")).sendKeys("C:\\b2c64374-15e6-4aa7-af9b-b94c537a875c.pdf");
Thread.sleep(2000);
driver.findElement(By.xpath("//*[contains( @value, 'Guardar')]")).click();
Thread.sleep(4000);
// Cerrar la ventana del navegador para liberar la memoria
// driver.close();
}
}
| [
"[email protected]"
] | |
b1a25cb7878f6eb91fb7329c6346407d7d38b596 | fb0e9ec409efa20ec069a88b732708912c113d02 | /java_se_sample/src/com/will/ch_4/Selection_4_1.java | 453ca869b65f0f3ea1c396c217b25d3bcce83e13 | [] | no_license | willhsu0604/java_se_sample | fe792bbb478ce1f6a77f8fa10b6d31d5de87de41 | 1d8dd87343192e8bba9978792b5adebaeae5f308 | refs/heads/master | 2021-01-22T23:53:33.625305 | 2019-03-08T06:21:16 | 2019-03-08T06:21:16 | 85,676,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package com.will.ch_4;
public class Selection_4_1 {
public static void main(String[] args) {
double n = Math.random();
if(n > 0.5) {
System.out.println("正面");
} else {
System.out.println("反面");
}
}
}
| [
"[email protected]"
] | |
5130271734341f43dac12d5655515d2874d8cfb5 | 5d5556eb02e79afb710a7262e366ab6a2fae2a44 | /src/test/java/TestExecutor/TestNG_TestExecutor.java | 91227052838d313143488b452f3cf7f12ef195b2 | [] | no_license | ShahnawazSayyed/SeleniumFramework_Java | 6dae25077eba789155723c315289c0e92c23c265 | 18d94af9c9d4dbb4479eabface53e1eb6a7331d3 | refs/heads/master | 2022-02-03T01:30:21.370071 | 2020-09-26T15:57:13 | 2020-09-26T15:57:13 | 216,561,049 | 0 | 0 | null | 2022-01-04T16:36:03 | 2019-10-21T12:20:39 | Java | UTF-8 | Java | false | false | 2,059 | java | package TestExecutor;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.testSite.BaseClass.BaseClass;
import com.testSite.Utils.InitializeBrowser;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
public class TestNG_TestExecutor {
private WebDriver driver = null;
private ExtentHtmlReporter htmlreporters;
private ExtentReports extent;
public ExtentTest test;
private Logger logger;
@BeforeSuite
public void setUpTest(){
htmlreporters = new ExtentHtmlReporter("src/test/ExtentReports/extent.html");
extent = new ExtentReports();
extent.attachReporter(htmlreporters);
logger = LogManager.getLogger(TestNG_TestExecutor.class);
//PropertyConfigurator.configure(path);
String browser;
browser = "chrome";
driver = InitializeBrowser.LaunchBrowser(browser);
System.out.println("Launched the " + browser + " Browser Successfully");
}
@Test
public void executeTests() throws InterruptedException {
ExtentTest test = extent.createTest("My First Test", "Test Description");
test.log(Status.INFO,"Starting the Test Execution");
test.info("Test Execution Started using TestNG Framework using Maven");
logger.debug("This is a debug message");
logger.info("This is an info message");
logger.warn("This is a warn message");
logger.error("This is an error message");
BaseClass b = new BaseClass(driver);
b.Test1();
}
@AfterSuite
public void tearDownTest(){
extent.flush();
driver.close();
System.out.println("Closed the Browser Successfully");
driver.quit();
}
}
| [
"[email protected]"
] | |
7db7f031a16d689c6929ff6c146ef1d0602d6507 | 8d175e1c52015cc2657833831ea5beb66e59280b | /src/test/java/com/zhuguang/netty/day1/aio/client/ReadHandler.java | c964fb9bbc7c4ee5baa7b08bd17ee166cd716938 | [] | no_license | doctorLdd/mytest | 3991dde94b103b8547ce01af58bafbdbb97972e6 | 193448b65da723afcbbfd7629c825cea10251404 | refs/heads/master | 2022-12-26T16:06:00.818099 | 2020-04-22T15:45:57 | 2020-04-22T15:45:57 | 257,913,243 | 0 | 0 | null | 2020-10-13T21:24:54 | 2020-04-22T13:42:11 | Java | UTF-8 | Java | false | false | 1,328 | java | package com.zhuguang.netty.day1.aio.client;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.CompletionHandler;
import java.util.concurrent.CountDownLatch;
public class ReadHandler implements CompletionHandler<Integer, ByteBuffer> {
private AsynchronousSocketChannel clientChannel;
private CountDownLatch latch;
public ReadHandler(AsynchronousSocketChannel clientChannel,CountDownLatch latch) {
this.clientChannel = clientChannel;
this.latch = latch;
}
public void completed(Integer result,ByteBuffer buffer) {
buffer.flip();
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
String body;
try {
body = new String(bytes,"UTF-8");
System.out.println("客户端收到结果:"+ body);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
public void failed(Throwable exc,ByteBuffer attachment) {
System.err.println("数据读取失败...");
try {
clientChannel.close();
latch.countDown();
} catch (IOException e) {
}
}
} | [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.