blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e67399e706e708d5584b6bf2011c784b0f2e070f | 5832504c187692c3410ab0754d647af1d191bec2 | /bin/ext-accelerator/acceleratorcms/src/de/hybris/platform/acceleratorcms/setup/AcceleratorCmsSystemSetup.java | bc790d336b31e7b49c4ec079b0fe132064d92c6b | [] | no_license | ramamohan/Hybris_TEST | d8505769885edc66ed85831def9e2b9f93bf33a6 | 820654707f194feb785483f9bf9851a1381af9d0 | refs/heads/master | 2021-12-09T05:35:58.257789 | 2016-04-28T23:42:26 | 2016-04-28T23:42:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2015 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package de.hybris.platform.acceleratorcms.setup;
import java.util.Collections;
import java.util.List;
import de.hybris.platform.acceleratorcms.constants.AcceleratorCmsConstants;
import de.hybris.platform.commerceservices.setup.AbstractSystemSetup;
import de.hybris.platform.core.initialization.SystemSetup;
import de.hybris.platform.core.initialization.SystemSetupContext;
import de.hybris.platform.core.initialization.SystemSetupParameter;
@SystemSetup(extension = AcceleratorCmsConstants.EXTENSIONNAME)
public class AcceleratorCmsSystemSetup extends AbstractSystemSetup
{
@Override
public List<SystemSetupParameter> getInitializationOptions()
{
return Collections.emptyList();
}
@SystemSetup(type = SystemSetup.Type.ESSENTIAL, process = SystemSetup.Process.ALL)
public void createEssentialData(final SystemSetupContext context)
{
importImpexFile(context, "/acceleratorcms/import/essential-data.impex", true);
}
}
| [
"kevind@mail.ru"
] | kevind@mail.ru |
14c819abc293a7eb55301b13847d37b7b9f5027b | 5e9b0875f77769a4c21a21ff04c7041639563202 | /src/main/java/com/xuehaizi/sell/controller/WechatController.java | a762b840a5904a011fa2a8f677fd6f0de7c1bd26 | [] | no_license | wanxueqing/sell | 6915972f755b4baff4b8a346dc12dcb6f610d567 | 061000ef2802000791e23f01e1e643b9927944ac | refs/heads/master | 2022-08-02T17:49:47.943013 | 2019-10-07T09:13:39 | 2019-10-07T09:13:39 | 213,339,049 | 0 | 0 | null | 2022-06-21T01:59:56 | 2019-10-07T09:06:28 | Java | UTF-8 | Java | false | false | 3,226 | java | package com.xuehaizi.sell.controller;
import com.xuehaizi.sell.config.ProjectUrlConfig;
import com.xuehaizi.sell.enums.ResultEnum;
import com.xuehaizi.sell.exception.SellException;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.net.URLEncoder;
@Controller
@RequestMapping("/wechat")
@Slf4j
public class WechatController {
@Autowired
private WxMpService wxMpService;
@Autowired
private WxMpService wxOpenService;
@Autowired
private ProjectUrlConfig projectUrlConfig;
@GetMapping("/authorize")
public String authorize(@RequestParam("returnUrl") String returnUrl){
//1.配置
//2.调用方法
String url = projectUrlConfig.getWechatMpAuthorize() + "/sell/wechat/userInfo";
String redirectUrl = wxMpService.oauth2buildAuthorizationUrl(url, WxConsts.OAuth2Scope.SNSAPI_BASE, URLEncoder.encode(returnUrl));
// log.info("【微信网页授权】获取code,result={}",redirectUrl);
return "redirect:"+redirectUrl;
}
@GetMapping("/userInfo")
public String userInfo(@RequestParam("code")String code,
@RequestParam("state")String returnUrl){
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken ();
try {
wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
} catch (WxErrorException e) {
log.error("【微信网页授权】{}",e);
throw new SellException(ResultEnum.WECHAT_MP_ERROR.getCode(),e.getError().getErrorMsg());
}
String openId = wxMpOAuth2AccessToken.getOpenId();
return "redirect:" + returnUrl + "?openId=" + openId;
}
@GetMapping("/qrAuthorize")
public String qrAuthorize(@RequestParam("returnUrl") String returnUrl){
String url = projectUrlConfig.getWechatopenAuthorize() + "/sell/wechat/qrUserInfo";
String redirectUrl = wxOpenService.buildQrConnectUrl(url,WxConsts.QrConnectScope.SNSAPI_LOGIN,URLEncoder.encode(returnUrl));
return "redirect:"+redirectUrl;
}
@GetMapping("/qrUserInfo")
public String qrUserInfo(@RequestParam("code")String code,
@RequestParam("state")String returnUrl){
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken ();
try {
wxMpOAuth2AccessToken = wxOpenService.oauth2getAccessToken(code);
} catch (WxErrorException e) {
log.error("【微信网页授权】{}",e);
throw new SellException(ResultEnum.WECHAT_MP_ERROR.getCode(),e.getError().getErrorMsg());
}
String openId = wxMpOAuth2AccessToken.getOpenId();
return "redirect:" + returnUrl + "?openId=" + openId;
}
}
| [
"xueqing_wan@163.com"
] | xueqing_wan@163.com |
30052aabf8107e452128f2611429d238e9a4864d | 61c5a1db29c049b2ad1d1c01c8d02304039608b1 | /src/chapter_1/Exercise1_4__SimpleTable.java | 98a804da57c4512c4b2cd6399484cf8a85ed37b9 | [] | no_license | odielag/Java_book_started_2-10-2016 | 490b64ad4169e2627fc9689650561806bb3f5ac3 | bca39a3b3dc5f39338da333604eb3c961f55046d | refs/heads/master | 2020-05-21T23:38:37.834737 | 2016-11-06T10:36:59 | 2016-11-06T10:36:59 | 51,508,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 497 | java | package chapter_1;
public class Exercise1_4__SimpleTable {
public static void main(String[] args) {
// This program is for outputting a table
/*
* // example
*
* a a^2 a^3
* 1 1 1
* 2 4 8
* 3 9 27
* 4 16 64
*
*/
int[] a = {1, 2, 3, 4};
System.out.printf("a a^2 a^3\n");
for(int i = 0; i < 4; i++){
System.out.println(a[i] + "\t" + Math.pow((a[i]),2) + "\t" + Math.pow(a[i],3));
}
}
}
| [
"odielag@gmail.com"
] | odielag@gmail.com |
6d97298d440c24747e99ea09467d07cc1ad4bd89 | f4cc04502801992aad4dfdcff92297d4abd333d4 | /src/main/java/com/ofemmy/librarymanager/models/user/MyUserDetails.java | 9be612832689c1aca445c3f19aea0879e8f88896 | [] | no_license | ofemmy/library-manager | 15424b3ede469d1bf6688725338b64cc571dd758 | f72accb5b5fb022d0cb7491f66383b42ccfe3d89 | refs/heads/master | 2022-12-05T12:09:10.001241 | 2020-08-29T02:35:06 | 2020-08-29T02:35:06 | 288,858,749 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package com.ofemmy.librarymanager.models.user;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
public class MyUserDetails implements UserDetails {
private String userName;
private String password;
private boolean isActive;
private List<GrantedAuthority> authorities = new ArrayList<>();
public MyUserDetails(UserAccount user) {
this.userName = user.getEmail();
this.password = user.getPassword();
this.isActive = user.getEnabled();
this.authorities.add(new SimpleGrantedAuthority(user.getRole().name()));
}
/* public MyUserDetails(String userName) {
this.userName = userName;
this.password = "foo";
}*/
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return this.authorities;
}
@Override
public String getPassword() {
return this.password;
}
@Override
public String getUsername() {
return this.userName;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return this.isActive;
}
}
| [
"oofagbemi@outlook.com"
] | oofagbemi@outlook.com |
bb8a4633ab465fd71087b6d2d3087ed723bc8b65 | 79ad64833f328397b1093779ef37bba5424de6ba | /app/src/main/java/vn/com/vnpt/vinaphone/vnptsoftware/vnptoffice/adapter/FileChiDaoAdapter.java | 0ce0c8703e7a5dac880467d8ba05d4f029b027f3 | [] | no_license | nguyenkiemhieu1/VNPT_01 | 75a047485b009b992ce8530acef4c18098a517c8 | 630612ff55049e6a68fa0aa0fb20f2d932f0b565 | refs/heads/master | 2023-02-01T00:40:09.029586 | 2020-12-18T08:27:30 | 2020-12-18T08:27:30 | 322,534,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,779 | java | package vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.List;
import vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.R;
import vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.common.Constants;
import vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.configuration.Application;
import vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.view.activity.EditchiDaoV2Activity;
import vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.view.activity.ForwardChiDaoV2Activity;
import vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.view.activity.ReplyChiDaoV2Activity;
import vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.view.activity.SendChiDaoV2Activity;
import vn.com.vnpt.vinaphone.vnptsoftware.vnptoffice.view.model.FileChiDao;
/**
* Created by LinhLK - 0948012236 on 8/31/2017.
*/
public class FileChiDaoAdapter extends ArrayAdapter<FileChiDao> {
private Context context;
private int resource;
private List<FileChiDao> attachFileInfoList;
private String type;
public FileChiDaoAdapter(Context context, int resource, List<FileChiDao> attachFileInfoList, String type) {
super(context, resource, attachFileInfoList);
this.context = context;
this.resource = resource;
this.attachFileInfoList = attachFileInfoList;
this.type = type;
}
public View getView(final int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(this.resource, null);
final LinearLayout itemAttackFile = (LinearLayout) view.findViewById(R.id.itemAttackFile);
ImageView ic_file = (ImageView) view.findViewById(R.id.ic_file);
ImageView ic_remove = (ImageView) view.findViewById(R.id.ic_remove);
TextView filename = (TextView) view.findViewById(R.id.filename);
filename.setTypeface(Application.getApp().getTypeface());
final FileChiDao attachFileInfo = attachFileInfoList.get(position);
filename.setText(attachFileInfo.getName());
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.DOC) || attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.DOCX)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_doc));
}
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.XLS) || attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.XLSX)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_xls));
}
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.PPT) || attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.PPTX)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_ppt));
}
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.PDF)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_pdf));
}
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.ZIP)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_zip));
}
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.RAR)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_rar));
}
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.TXT)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_txt));
}
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.MPP)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_mpp));
}
if (attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.JPG)
|| attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.JPEG)
|| attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.PNG)
|| attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.GIF)
|| attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.TIFF)
|| attachFileInfo.getName().trim().toUpperCase().endsWith(Constants.BMP)) {
ic_file.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_image));
}
ic_remove.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
itemAttackFile.setVisibility(View.GONE);
if (type.equals("SEND")) {
((SendChiDaoV2Activity) context).removeFile(attachFileInfo.getName());
itemAttackFile.removeAllViews();
}
if (type.equals("EDIT")) {
((EditchiDaoV2Activity) context).removeFile(attachFileInfo.getName());
itemAttackFile.removeAllViews();
}
// if (type.equals("FW")) {
// ((ForwardChiDaoV2Activity) context).removeFile(attachFileInfo.getName());
// itemAttackFile.removeAllViews();
// }
if (type.equals("REPLY")) {
((ReplyChiDaoV2Activity) context).removeFile(attachFileInfo.getName());
itemAttackFile.removeAllViews();
}
}
});
return view;
}
}
| [
"hieunguyen18021999@gmail.com"
] | hieunguyen18021999@gmail.com |
0fa31d1e9761bfe8ddbb44d7a4f3391bf3246343 | d3085f203677fea8b9d0b8cd5e8d0f321cdbf119 | /src/test/java/com/dong/dao/UserDaoTest.java | d416dc1a436359b72e3fbc22e32983a97b8d8c13 | [] | no_license | hifdong/ssh-x | 53cd7740e95bb71b1186ba96121f50a9af65507e | 659ee6505fcb03d6219c150290ff052aff104c52 | refs/heads/master | 2021-01-22T12:52:57.927640 | 2016-01-17T08:27:48 | 2016-01-17T08:27:48 | 49,581,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,426 | java | package com.dong.dao;
import com.dong.model.User;
import com.dong.service.UserService;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.junit.Test;
import org.springframework.web.context.ContextLoader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author: hifdong
* @Date: 16/1/10.
*/
public class UserDaoTest {
private UserService userService;
@Test // 未整合spring前对hibernate配置测试
public void testConnect() {
Configuration config= new Configuration();
config.configure("hibernate.cfg.xml");
SessionFactory sf = config.buildSessionFactory();
Session session = sf.openSession();
Transaction trans = session.beginTransaction();
User user = new User();
user.setUserName("testSave");
user.setPassword("pas");
session.save(user);
trans.commit();
session.close();
}
// @Test
// public void testQueryUserList() {
// UserService userService = ContextLoader("");
// Map<String, Object> paramMap = new HashMap<String, Object>();
// try {
// List<User> userList = userService.queryUserList();
// assertTrue(userList.size() > 0);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
| [
"hifdong@gmail.com"
] | hifdong@gmail.com |
b4d8ef2d0264d435881b194863b44278b0a6732d | 5978399b0d8eb18049dccf040cd6cc9264fa79af | /src/main/java/dao/ServiceDAO.java | 891466fda90ee74ede97ac79a07cf87457e734b2 | [] | no_license | artezious/OSMD | 967fb5215c1eb0a5fc660f542a5b00d84bb7eea4 | 27652ec63c432cd98eb45ace216d49ba6f666218 | refs/heads/master | 2020-06-18T01:27:19.229131 | 2016-11-28T10:40:34 | 2016-11-28T10:40:34 | 74,960,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package dao;
import model.ServiceEntity;
import javax.persistence.EntityManager;
import java.util.List;
import static dao.Singleton.ENTITY_MANAGER;
/**
* Created by WEO on 9/12/16.
*/
public class ServiceDAO {
EntityManager entityManager = ENTITY_MANAGER.getEntityManager();
public List<ServiceEntity> getService() {
return entityManager.createQuery("Select Service from ServiceEntity service").getResultList();
}
public void saveService(ServiceEntity entity) {
entityManager.getTransaction().begin();
entityManager.merge(entity);
entityManager.getTransaction().commit();
}
}
| [
"artezious@icloud.com"
] | artezious@icloud.com |
1ff36e43ec3cb889b886f4e4f4a6602af0bb06e6 | 64c2988de61650f5217a404c06d7e9354818c20f | /app/src/main/java/metrowebz/com/quizforyou/Activity/Fragment/SkipQuestionDilaog.java | e81b29f26ac6587c775e1e6e51b945d2019be225 | [
"Apache-2.0"
] | permissive | abhilash002/QuizForYou | 38dba327f47fdf9559b333943d8407a967303841 | 1182d188f7f40e99a0731a8b3a98a020cddf2e49 | refs/heads/master | 2021-05-16T13:10:45.506146 | 2018-04-24T06:26:24 | 2018-04-24T06:26:24 | 105,362,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,716 | java | package metrowebz.com.quizforyou.Activity.Fragment;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import metrowebz.com.quizforyou.R;
/**
* Created by Abhilash on 30-09-2017.
*/
public class SkipQuestionDilaog extends DialogFragment implements View.OnClickListener {
private View.OnClickListener listener;
private AlertDialog.Builder alertDBuilder;
private AlertDialog dialog;
private Button mDenyButton, mAcceptButton;
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
alertDBuilder = new AlertDialog.Builder(getContext());
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.skip_question_dialog, null);
mDenyButton = (Button) view.findViewById(R.id.deny);
mAcceptButton = (Button) view.findViewById(R.id.accept);
alertDBuilder.setView(view);
alertDBuilder.setCancelable(false);
mDenyButton.setOnClickListener(this);
mAcceptButton.setOnClickListener(this);
dialog = alertDBuilder.create();
return dialog;
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.deny:
dismiss();
break;
case R.id.accept:
this.onClick(v);
break;
}
}
public void setSkipDialogClickListener(View.OnClickListener listener){
this.listener = listener;
}
}
| [
"abhilashmaurya211094@gmail.com"
] | abhilashmaurya211094@gmail.com |
8b036511072bf1b85d589bf917cb3b2d89815e98 | 3385b9d15b34c4d67e142bb2c61e5557bd59a76d | /ch25/InterfaceBaseConst.java | 82c5f52fe79c34bc9e621881e492889b00dad3a6 | [] | no_license | j-hoon/Java | 69572bdf0039c7d2ded44526f5299dea3ff0ff00 | 6ebeb89cb3f7c34f3e102c07f482750a74e926b9 | refs/heads/master | 2021-08-28T12:34:08.644096 | 2017-12-12T08:31:14 | 2017-12-12T08:31:14 | 103,651,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | interface Scale {
int DO = 0; int RE = 1;
int MI = 2; int FA = 3;
int SO = 4; int RA = 5;
int TI = 6;
}
class InterfaceBaseConst {
public static void main(String[] args) {
int sc = Scale.DO;
switch(sc) {
case Scale.DO:
System.out.println("도~ ");
break;
case Scale.RE:
System.out.println("레~ ");
break;
case Scale.MI:
System.out.println("미~ ");
break;
case Scale.FA:
System.out.println("파~ ");
break;
default:
System.out.println("솔~ 라~ 시~ ");
}
}
}
| [
"joen7619@gmail.com"
] | joen7619@gmail.com |
1e62f5087bf66f9502341b82df0f7e9381ee07e2 | f389f0a6d3fd9bb3dff1f348fc15ed693bfb7e1d | /src/main/java/mk/ukim/finki/ampleapi/domain/exceptions/InvalidPasswordException.java | 5367d6454ba30097c03b4f012691964c3ab0c127 | [] | no_license | atodorovska/ample-api | 651a1d59635f517505025658ce4480eb2a4a5ef1 | bad7ca49e2eede1a4a8851763d11129b166e5ce0 | refs/heads/master | 2022-12-09T07:38:03.503289 | 2020-09-04T11:46:56 | 2020-09-04T11:46:56 | 284,299,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package mk.ukim.finki.ampleapi.domain.exceptions;
public class InvalidPasswordException extends Exception{
public InvalidPasswordException(String message) {
super(message);
}
public InvalidPasswordException() {}
}
| [
"ana5todorovska@gmail.com"
] | ana5todorovska@gmail.com |
36663279911a74d2643136f64c0eda69eeba06cf | b11d56e8c20e80b8221e99606d5d8ed32b30ddb3 | /bundles/model/src/main/java/org/karaf/winecellar/model/EntityWithId.java | 5dba1bb31ca0ab598ed2295bd2f3718be28d753a | [] | no_license | boodoopl/karaf-wine-cellar | f42fc88d2fdd19c275722bcf1fc00bc5b521e87e | 7bdc95e3f8904ee2fdec04cb27ecdff869f0bd09 | refs/heads/master | 2016-08-11T20:09:53.162611 | 2015-10-10T20:23:20 | 2015-10-10T20:23:20 | 44,023,437 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package org.karaf.winecellar.model;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
@MappedSuperclass
public class EntityWithId {
@Id
@GeneratedValue
protected long id;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
| [
"maciej.mraczek@gmail.com"
] | maciej.mraczek@gmail.com |
804be21d8dca63804225e9bea53093019d97a1f8 | 08f11bfcfe8c380516c4054ec5564d7345daa962 | /project-group-02-Backend/src/main/java/ca/mcgill/ecse321/projectgroup02/model/DeliveryMethod.java | cfc093c4e5feec012460663ff2a37ec9dd57a536 | [] | no_license | McGill-ECSE321-Fall2020/project-group-02 | f8ccdeacce89b0ba2eb4ffeac955d5fda25d97ef | 178005a77f49a68c8370647cf7cf457d977457c2 | refs/heads/master | 2023-01-23T04:42:03.482808 | 2020-11-28T03:20:00 | 2020-11-28T03:20:00 | 298,360,432 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 174 | java | package ca.mcgill.ecse321.projectgroup02.model;
import javax.persistence.Entity;
import javax.persistence.Id;
public enum DeliveryMethod{
INSTOREPICKUP,
HOMEDELIVERY;
} | [
"59708264+GurdarshanS@users.noreply.github.com"
] | 59708264+GurdarshanS@users.noreply.github.com |
0e7f46a38b3b319d508f7edc1b7ae5d7ace38e27 | 191e63ed6283cdd8454aed37c32e79fde1031ca4 | /20. Web Service and RESTful/BlogManagerREST/src/main/java/com/codegym/blog/controller/model/Post.java | 849547aa6a3b14456efa56ce0a7d8f5dd47ffe5b | [] | no_license | nhatnpa2508/NhatModule02 | 095e3b898618d34d75395bbc8bf6e6a6749bd94d | 1fb19e26c40de4a5830e941e78e57330ed6bbe95 | refs/heads/master | 2022-12-22T15:40:46.324037 | 2019-08-19T07:34:09 | 2019-08-19T07:34:09 | 191,078,938 | 0 | 0 | null | 2022-12-16T09:43:46 | 2019-06-10T01:58:44 | CSS | UTF-8 | Java | false | false | 1,695 | java | /*
*************************************
* Created by IntelliJ IDEA *
* User: Nhat *
* Email: nhatnpa2508@gmail.com *
* Date: 7/25/2019 *
* Time: 11:55 PM *
*************************************
*/
package com.codegym.blog.controller.model;
import javax.persistence.*;
@Entity
@Table(name="posts")
public class Post {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String title;
private String content;
private String author;
@ManyToOne
@JoinColumn(name = "category_id")
private Category category;
public Post() {
}
public Post(String title, String content, String author) {
this.title = title;
this.content = content;
this.author = author;
}
@Override
public String toString(){
return String.format("Post[id=%d,title='%s',content='%s',author='%s']",id, title,content,author);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
}
| [
"nhatnpa2508@gmail.com"
] | nhatnpa2508@gmail.com |
ebf3c07ddfc6c875688a613b3e996b20cc126d1f | ac759cb40142e92cb52d102bf09f4780c4973e97 | /user-registration-server-ws/enroll-mgmt/src/main/java/com/google/cloud/healthcare/fdamystudies/util/TokenUtil.java | 2a2e3503485d31a93db1b5ac277f0392a6ec3590 | [
"MIT"
] | permissive | ashokr8142/phanitest | b128f5f21043ad68858e57c4183aa23a992d04a5 | 04ca2cd502fd953e64971292480fd2261dd0be17 | refs/heads/master | 2023-03-03T06:31:10.344379 | 2021-01-13T07:42:28 | 2021-01-13T07:42:28 | 340,147,907 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | /*
* Copyright 2020 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package com.google.cloud.healthcare.fdamystudies.util;
import java.security.SecureRandom;
public class TokenUtil {
private static final String SOURCE = "0123456789ABCDEFGHIJKLMNOPQRSWXYZ";
private static SecureRandom secureRnd = new SecureRandom();
private TokenUtil() {}
public static String randomString(int length) {
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; i++) sb.append(SOURCE.charAt(secureRnd.nextInt(SOURCE.length())));
return sb.toString();
}
}
| [
"yuchikuo@google.com"
] | yuchikuo@google.com |
e70923ed900b5b4efffb2989ad30c3a61a1b7ed2 | 5fd36bb90f5bbf7f261bdc7696c4c6f129d87cae | /src/main/java/com/minheum/app/repository/LanguageRepository.java | f6a8483d66ab53c03cc80acca1c565903e0734ae | [] | no_license | MinHeum/ks-web | c1f622f2d5a7b81aa60394484635f7249629e88a | 80bc337c091909b1dfd4b94d873598a59a6fdbdc | refs/heads/master | 2021-05-23T19:15:10.065318 | 2020-05-11T09:28:25 | 2020-05-11T09:28:25 | 253,431,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.minheum.app.repository;
import com.minheum.app.Entity.Language;
import org.springframework.data.jpa.repository.JpaRepository;
public interface LanguageRepository extends JpaRepository<Language, Long> {
}
| [
"plutokor@gmail.com"
] | plutokor@gmail.com |
846e91afbaab561f7d4784e06ef89898b83b3177 | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i1484.java | e025ce791eb2cd291091c1ccfd357fc3c0010d5d | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68 | java | package number_of_direct_superinterfaces;
public interface i1484 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
c08c1dca87f64853c75372ebe534ecd074f4b627 | 737f75f2d6936f4901f29412a041ee3039e24643 | /Hedgehog Photo/plugins/Search/JPopupPreview.java | 730b4f8d17ece71617f9d2740ed70ac6abf01268 | [] | no_license | S-Vortex/Hedgehog-Photo | b4acef82d9465882b5a21f9caab468fb9dce8dd8 | c706f26736450f2a93d698d7bde9ecbdf777b1cd | refs/heads/master | 2020-12-25T00:27:54.476543 | 2012-05-23T04:51:36 | 2012-05-23T04:51:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,177 | java | import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.util.List;
import java.util.Observable;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import se.cth.hedgehogphoto.database.PictureObject;
/**
* @author Barnabas Sapan
*/
@SuppressWarnings("serial")
public class JPopupPreview extends JPopupMenu implements PreviewI {
/** Better to add everything to a JPanel first
* instead of adding directly to a JPopup to prevent some rendering issues. */
private JPanel panel;
private JTextField textField;
private SearchModel model;
private final NotificationListItem messageItem = new NotificationListItem();
private final JPopupListItem [] listItems;
private static final int MAX_LIST_ITEMS = 5;
public JPopupPreview(){
this.listItems = new JPopupListItem[JPopupPreview.MAX_LIST_ITEMS];
for (int index = 0; index < JPopupPreview.MAX_LIST_ITEMS; index++) {
this.listItems[index] = new JPopupListItem();
}
this.panel = new JPanel();
this.panel.setLayout(new BoxLayout(this.panel, BoxLayout.PAGE_AXIS));
add(this.panel);
setFocusable(false);
}
/**
* Adds the same listener to all the PopupPreview's
* items.
* @param listener the PopupItem-listener
*/
@Override
public void addMouseListener(MouseAdapter listener) {
this.messageItem.addMouseListener(listener);
for (JPopupListItem item : listItems) {
item.addMouseListener(listener);
}
}
@Override
public void setTextField(JTextField textField){
this.textField = textField;
}
public void setListItems(List<PictureObject> pictures) {
this.messageItem.setPictures(pictures);
for (int index = 0; index < JPopupPreview.MAX_LIST_ITEMS; index++) {
if (pictures.size() > index){
this.listItems[index].setPicture(pictures.get(index));
}
else{
this.listItems[index].setPicture(null);
}
}
}
@Override
public void setModel(SearchModel model) {
this.model = model;
}
@Override
public JPopupMenu getPopupView() {
return this;
}
@Override
public void update(Observable o, Object arg) {
if (arg instanceof SearchModel) {
this.model = (SearchModel) arg;
}
/**-50 to count for the offset of the textbox*/
show(this.textField, -50, this.textField.getHeight());
List<PictureObject> pictures = this.model.getPictures();
this.setListItems(pictures);
this.panel.removeAll();
/**Adds the search results to the popup, if result resulted in no matches, add
a no result label.*/
if (!pictures.isEmpty()) {
if (pictures.size() > 2) {
this.messageItem.setMessage(SearchConstants.SEE_MORE);
this.panel.add(this.messageItem);
this.panel.add(new JSeparator());
}
int nbrOfItems = 0;
for (JPopupListItem item : listItems) {
if (item.hasPicture()) {
this.panel.add(item);
nbrOfItems++;
}
}
setPopupSize(250, (nbrOfItems * 70));
} else {
this.messageItem.setBackground(Color.GRAY);
this.messageItem.setMessage(SearchConstants.NO_ITEMS);
this.panel.add(this.messageItem);
setPopupSize(250, 40);
}
this.panel.revalidate();
}
}
| [
"barnabas.sapan@gmail.com"
] | barnabas.sapan@gmail.com |
ba6a201650e7230c172e0a8b02d8c1c1eee767fa | 136344baac16df8fbcef2e758739b338682f9bca | /Array1/src/newhomeworkonCoreJava/DistributionSweets.java | 6d6e533d96a57813ae8cf52e1536d6510d6a3726 | [] | no_license | tanusgit/HomeworkJava | 4551b7319a18100febf3b89130878dd41d400f40 | 63dac005f961d8e1cc9799cc23fbee913c4e899c | refs/heads/master | 2021-01-06T18:48:51.514203 | 2020-05-22T20:50:19 | 2020-05-22T20:50:19 | 241,447,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package newhomeworkonCoreJava;
/*
* Input1: No of people
Input2: No of distribution
Input3 : position Number from which the distribution starts
Output:
The position number who receives the last chocolate
*/
public class DistributionSweets {
public static void main(String[] args) {
int people = 100;
int sweets = 250;
int position = 27;
int pos = distribute2(people, sweets, position);
System.out.println(pos);
}
private static int distribute(int people, int sweet, int position) {
// TODO Auto-generated method stub
int res = ((position + sweet)-1)% people;
return res;
}
private static int distribute2(int people, int sweet, int position) {
// TODO Auto-generated method stub
int person = position;
for(int i =1 ; i < sweet; i ++) {
if(person == people) {
person = 1;
} else {
person = person +1;
}
}
return person;
}
}
| [
"24976766+tanusgit@users.noreply.github.com"
] | 24976766+tanusgit@users.noreply.github.com |
cb27934f4a0d5df0b10b8d1a2c86c9241cb35814 | 42601eac40ddeed525346b6f7b3fa1fa90ee9661 | /src/main/java/com/appsdevelopersblog/app/ws/security/AuthenticationFilter.java | 37ac7e83d5c4bb71f022d2e538a764ac27072344 | [] | no_license | gitvineeth/KukuSergey | dac7f52ee440023924dcafe16120aed3fad74a20 | 88a9ba4028bca3af5c453aaefdb620ac5c823d34 | refs/heads/master | 2023-08-03T10:18:00.642030 | 2021-09-07T05:43:31 | 2021-09-07T05:43:31 | 403,852,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,287 | java | package com.appsdevelopersblog.app.ws.security;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import com.appsdevelopersblog.app.ws.SpringApplicationContext;
import com.appsdevelopersblog.app.ws.service.UserService;
import com.appsdevelopersblog.app.ws.shared.dto.UserDto;
import com.appsdevelopersblog.app.ws.ui.request.UserLoginRequestModel;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.security.core.userdetails.*;
public class AuthenticationFilter extends UsernamePasswordAuthenticationFilter {
private final AuthenticationManager authenticationManager;
public AuthenticationFilter(AuthenticationManager authenticationManager) {
super();
this.authenticationManager = authenticationManager;
}
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws AuthenticationException {
// below code populates UserLoginRequestModel
try {
UserLoginRequestModel creds = new ObjectMapper().readValue(request.getInputStream(), UserLoginRequestModel.class);
//db lookup loadUserByemail etc happen here internally
return authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(creds.getEmail(), creds.getPassword(),new ArrayList<>())
);
} catch (IOException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
}
}
@Override
protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain,
Authentication authResult) throws IOException, ServletException {
// We use JWT to give a token to the user who are authenticated so that he can use it in the subsequent requests
// need to use this in the request header
String userName = ((User) authResult.getPrincipal()).getUsername();
String token = Jwts.builder()
.setSubject(userName)
.setExpiration(new Date(System.currentTimeMillis()+SecurityConstants.EXPIRATION_TIME))
.signWith(SignatureAlgorithm.HS512, SecurityConstants.getTokenSecret())
.compact();
UserService userservice = (UserService) SpringApplicationContext.getBean("userServiceImpl");
UserDto userDto = userservice.getUser(userName);
response.addHeader(SecurityConstants.HEADER_STRING, SecurityConstants.TOKEN_PREFIX+token);
response.addHeader("Public User ID", userDto.getUserId());
// above is used to set a header field and value and send along with response
//next time add this value to the request header
}
}
| [
"amvineethcalicut@gmail.com"
] | amvineethcalicut@gmail.com |
8466e8ab9ca639e43826a2864aeb827e9ee99684 | e6c9f28cdb6fcc99a4c84a1661d68fce463d4a1a | /app/src/test/java/com/example/gamegoroda/UITests/Pages/PageNewGameCountries.java | 405c47b2034833b84150e3bdec0626c00619bcbc | [] | no_license | Telelichko/testing_mobile_application | d58c5f08de8a472c7f7dbff93dd2e37aff5e991c | 66f658710378317a6d4cc813e4d50343e62a5fd7 | refs/heads/master | 2022-12-31T16:01:14.720902 | 2020-10-25T16:44:29 | 2020-10-25T16:44:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,449 | java | package com.example.gamegoroda.UITests.Pages;
import com.example.gamegoroda.UITests.CommonMethods;
import com.example.gamegoroda.UITests.Constants;
import com.example.gamegoroda.UITests.DomHelper;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebElement;
public class PageNewGameCountries {
@Before
public void setUp(){
CommonMethods.setUp();
}
@Test
public void test_new_game_countries_page_filling_country() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
String country = Constants.default_country;
String input_last_char = country.substring(country.length() - 1);
WebElement inputs_in_start_game = CommonMethods.wait_element(DomHelper.input_in_start_game);
inputs_in_start_game.sendKeys(country);
WebElement button_send = CommonMethods.wait_element(DomHelper.button_send);
button_send.click();
WebElement label_info_new_game = CommonMethods.wait_element(DomHelper.label_info_new_game);
String output_first_char = label_info_new_game.getText().substring(0, 1).toLowerCase();
Assert.assertEquals("Start page. Expected text \"" + input_last_char +
"\" does not match actual text \"" + output_first_char + "\".",
input_last_char, output_first_char);
}
@Test
public void test_new_game_countries_page_label_info_exist() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
WebElement label_info = CommonMethods.wait_element(DomHelper.label_info_new_game);
Assert.assertNotNull("New game page. There isn't button \""+ label_info.getText() +"\" on it.",
label_info);
}
@Test
public void test_new_game_countries_page_label_info_name() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
String expected_text = Constants.enter_word;
String label_info_text = CommonMethods.wait_element(DomHelper.get_label_by_index(0)).getText();
Assert.assertEquals("Game page. Expected button text " + expected_text +
" does not match actual text" + label_info_text + ".",
expected_text, label_info_text);
}
@Test
public void test_new_game_countries_page_label_warning_exist() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
WebElement label_warning = CommonMethods.wait_element(DomHelper.label_warning_new_game);
Assert.assertNotNull("New game page. There isn't button \""+ label_warning.getText() +"\" on it.",
label_warning);
}
@Test
public void test_new_game_countries_page_label_warning_name_before_mistake() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
String expected_text = "";
String label_warning_text = CommonMethods.wait_element(DomHelper.get_label_by_index(1)).getText();
Assert.assertEquals("Game page. Expected button text " + expected_text +
" does not match actual text" + label_warning_text + ".",
expected_text, label_warning_text);
}
@Test
public void test_new_game_countries_page_label_warning_name_after_mistake() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
String expected_text = Constants.warning_text;
WebElement inputs_in_start_game = CommonMethods.wait_element(DomHelper.input_in_start_game);
inputs_in_start_game.sendKeys(Constants.country_to_get_warning);
WebElement button_send = CommonMethods.wait_element(DomHelper.button_send);
button_send.click();
String label_warning_text = CommonMethods.wait_element(DomHelper.get_label_by_index(1)).getText();
Assert.assertEquals("Game page. Expected button text " + expected_text +
" does not match actual text" + label_warning_text + ".",
expected_text, label_warning_text);
}
@Test
public void test_new_game_countries_page_input_words_exist() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
WebElement input_words = CommonMethods.wait_element(DomHelper.input_in_start_game);
Assert.assertNotNull("New game page. There isn't input on it.", input_words);
}
@Test
public void test_new_game_countries_page_button_send_exist() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
WebElement button_send = CommonMethods.wait_element(DomHelper.button_send);
Assert.assertNotNull("New game page. There isn't button \""+ button_send.getText() +"\" on it.",
button_send);
}
@Test
public void test_new_game_countries_page_button_send_clickable() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
WebElement button_send = CommonMethods.wait_element(DomHelper.button_send);
String button_send_clickable_str = button_send.getAttribute("clickable");
Assert.assertEquals("Game page. Button \"" + button_send.getText() + "\" isn't clickable.",
"true", button_send_clickable_str);
}
@Test
public void test_new_game_countries_page_button_send_name() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
String expected_text = Constants.send;
String button_send_text = CommonMethods.wait_element(DomHelper.get_button_by_index(3)).getText();
Assert.assertEquals("Game page. Expected button text " + expected_text +
" does not match actual text" + button_send_text + ".",
expected_text, button_send_text);
}
@Test
public void test_new_game_countries_page_button_surrender_exist() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
WebElement button_surrender = CommonMethods.wait_element(DomHelper.button_surrender);
Assert.assertNotNull("New game page. There isn't button \""+ button_surrender.getText() +"\" on it.",
button_surrender);
}
@Test
public void test_new_game_countries_page_button_surrender_clickable() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
WebElement button_surrender = CommonMethods.wait_element(DomHelper.button_surrender);
String button_surrender_clickable_str = button_surrender.getAttribute("clickable");
Assert.assertEquals("Game page. Button \"" + button_surrender.getText() + "\" isn't clickable.",
"true", button_surrender_clickable_str);
}
@Test
public void test_new_game_countries_page_button_surrender_name() throws Exception {
CommonMethods.go_to_new_game_page(Constants.countries);
String expected_text = Constants.surrender;
String button_surrender_text = CommonMethods.wait_element(DomHelper.get_button_by_index(4)).getText();
Assert.assertEquals("Game page. Expected button text " + expected_text +
" does not match actual text" + button_surrender_text + ".",
expected_text, button_surrender_text);
}
@After
public void End() {
CommonMethods.End();
}
}
| [
"telelichko@yandex.ru"
] | telelichko@yandex.ru |
a2ebf21971cf94daad08ac08e5a7f3f00354fedb | 255fad6b8eb20b574ab8514ba20176844814be79 | /app/src/main/java/faceapp/com/myapplication/persongroupmanagement/AddFaceToPersonActivity.java | 18337e2fb420ba78e88f29b7fb7f502e6cef70ef | [] | no_license | MinhUITk9/Foto | c0da4234f237a9bd180eb5e3da76b4779f0251d2 | 4cd0b8205d6cc182718bb8690553fe01f1ca81cc | refs/heads/master | 2021-01-12T05:03:15.868534 | 2017-01-02T14:24:53 | 2017-01-02T14:24:53 | 77,838,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,943 | java | package faceapp.com.myapplication.persongroupmanagement;
/**
* Created by Admin on 11/10/2016.
*/
import android.app.ProgressDialog;
import android.content.Context;
import android.content.ContextWrapper;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import com.microsoft.projectoxford.face.FaceServiceClient;
import com.microsoft.projectoxford.face.contract.AddPersistedFaceResult;
import com.microsoft.projectoxford.face.contract.Face;
import com.microsoft.projectoxford.face.contract.FaceRectangle;
import faceapp.com.myapplication.R;
import faceapp.com.myapplication.helper.ImageHelper;
import faceapp.com.myapplication.helper.LogHelper;
import faceapp.com.myapplication.helper.FaceApp;
import faceapp.com.myapplication.helper.StorageHelper;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
public class AddFaceToPersonActivity extends AppCompatActivity {
// Background task of adding a face to person.
class AddFaceTask extends AsyncTask<Void, String, Boolean> {
List<Integer> mFaceIndices;
AddFaceTask(List<Integer> faceIndices) {
mFaceIndices = faceIndices;
}
@Override
protected Boolean doInBackground(Void... params) {
// Get an instance of face service client to detect faces in image.
FaceServiceClient faceServiceClient = FaceApp.getFaceServiceClient();
try{
publishProgress("Adding face...");
UUID personId = UUID.fromString(mPersonId);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
InputStream imageInputStream = new ByteArrayInputStream(stream.toByteArray());
for (Integer index: mFaceIndices) {
FaceRectangle faceRect = mFaceGridViewAdapter.faceRectList.get(index);
addLog("Request: Adding face to person " + mPersonId);
// Start the request to add face.
AddPersistedFaceResult result = faceServiceClient.addPersonFace(
mPersonGroupId,
personId,
imageInputStream,
"User data",
faceRect);
mFaceGridViewAdapter.faceIdList.set(index, result.persistedFaceId);
}
return true;
} catch (Exception e) {
publishProgress(e.getMessage());
addLog(e.getMessage());
return false;
}
}
@Override
protected void onPreExecute() {
setUiBeforeBackgroundTask();
}
@Override
protected void onProgressUpdate(String... progress) {
setUiDuringBackgroundTask(progress[0]);
}
@Override
protected void onPostExecute(Boolean result) {
setUiAfterAddingFace(result, mFaceIndices);
}
}
// Background task of face detection.
private class DetectionTask extends AsyncTask<InputStream, String, Face[]> {
private boolean mSucceed = true;
@Override
protected Face[] doInBackground(InputStream... params) {
// Get an instance of face service client to detect faces in image.
FaceServiceClient faceServiceClient = FaceApp.getFaceServiceClient();
try{
publishProgress("Detecting...");
// Start detection.
return faceServiceClient.detect(
params[0], /* Input stream of image to detect */
true, /* Whether to return face ID */
false, /* Whether to return face landmarks */
/* Which face attributes to analyze, currently we support:
age,gender,headPose,smile,facialHair */
null);
} catch (Exception e) {
mSucceed = false;
publishProgress(e.getMessage());
addLog(e.getMessage());
return null;
}
}
@Override
protected void onPreExecute() {
setUiBeforeBackgroundTask();
}
@Override
protected void onProgressUpdate(String... progress) {
setUiDuringBackgroundTask(progress[0]);
}
@Override
protected void onPostExecute(Face[] faces) {
if (mSucceed) {
addLog("Response: Success. Detected " + (faces == null ? 0 : faces.length)
+ " Face(s)");
}
// Show the result on screen when detection is done.
setUiAfterDetection(faces, mSucceed);
}
}
private void setUiBeforeBackgroundTask() {
mProgressDialog.show();
}
// Show the status of background detection task on screen.
private void setUiDuringBackgroundTask(String progress) {
mProgressDialog.setMessage(progress);
setInfo(progress);
}
private void setUiAfterAddingFace(boolean succeed, List<Integer> faceIndices) {
mProgressDialog.dismiss();
if (succeed) {
String faceIds = "";
for (Integer index : faceIndices) {
String faceId = mFaceGridViewAdapter.faceIdList.get(index).toString();
faceIds += faceId + ", ";
FileOutputStream fileOutputStream = null;
try {
File file = new File(getApplicationContext().getFilesDir(), faceId);
fileOutputStream = new FileOutputStream(file);
mFaceGridViewAdapter.faceThumbnails.get(index)
.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
fileOutputStream.flush();
Uri uri = Uri.fromFile(file);
StorageHelper.setFaceUri(
faceId, uri.toString(), mPersonId, AddFaceToPersonActivity.this);
} catch (IOException e) {
setInfo(e.getMessage());
} finally {
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e) {
setInfo(e.getMessage());
}
}
}
}
addLog("Response: Success. Face(s) " + faceIds + "added to person " + mPersonId);
finish();
}
}
// Show the result on screen when detection is done.
private void setUiAfterDetection(Face[] result, boolean succeed) {
mProgressDialog.dismiss();
if (succeed) {
// Set the information about the detection result.
if (result != null) {
setInfo(result.length + " face"
+ (result.length != 1 ? "s" : "") + " detected");
} else {
setInfo("0 face detected");
}
// Set the adapter of the ListView which contains the details of the detected faces.
mFaceGridViewAdapter = new FaceGridViewAdapter(result);
// Show the detailed list of detected faces.
GridView gridView = (GridView) findViewById(R.id.gridView_faces_to_select);
gridView.setAdapter(mFaceGridViewAdapter);
}
}
String mPersonGroupId;
String mPersonId;
String mImageUriStr;
Bitmap mBitmap;
FaceGridViewAdapter mFaceGridViewAdapter;
// Progress dialog popped up when communicating with server.
ProgressDialog mProgressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_face_to_person);
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
mPersonId = bundle.getString("PersonId");
mPersonGroupId = bundle.getString("PersonGroupId");
mImageUriStr = bundle.getString("ImageUriStr");
}
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setTitle(getString(R.string.progress_dialog_title));
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("PersonId", mPersonId);
outState.putString("PersonGroupId", mPersonGroupId);
outState.putString("ImageUriStr", mImageUriStr);
}
@Override
protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mPersonId = savedInstanceState.getString("PersonId");
mPersonGroupId = savedInstanceState.getString("PersonGroupId");
mImageUriStr = savedInstanceState.getString("ImageUriStr");
}
@Override
protected void onResume() {
super.onResume();
Uri imageUri = Uri.parse(mImageUriStr);
mBitmap = ImageHelper.loadSizeLimitedBitmapFromUri(
imageUri, getContentResolver());
if (mBitmap != null) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
InputStream imageInputStream = new ByteArrayInputStream(stream.toByteArray());
addLog("Request: Detecting " + mImageUriStr);
new DetectionTask().execute(imageInputStream);
}
}
public void doneAndSave(View view) {
if (mFaceGridViewAdapter != null) {
List<Integer> faceIndices = new ArrayList<>();
for (int i = 0; i < mFaceGridViewAdapter.faceRectList.size(); ++i) {
if (mFaceGridViewAdapter.faceChecked.get(i)) {
faceIndices.add(i);
}
}
if (faceIndices.size() > 0) {
new AddFaceTask(faceIndices).execute();
} else {
finish();
}
}
}
// Add a log item.
private void addLog(String log) {
LogHelper.addIdentificationLog(log);
}
// Set the information panel on screen.
private void setInfo(String info) {
TextView textView = (TextView) findViewById(R.id.info);
textView.setText(info);
}
private class FaceGridViewAdapter extends BaseAdapter {
List<UUID> faceIdList;
List<FaceRectangle> faceRectList;
List<Bitmap> faceThumbnails;
List<Boolean> faceChecked;
FaceGridViewAdapter(Face[] detectionResult) {
faceIdList = new ArrayList<>();
faceRectList = new ArrayList<>();
faceThumbnails = new ArrayList<>();
faceChecked = new ArrayList<>();
if (detectionResult != null) {
List<Face> faces = Arrays.asList(detectionResult);
for (Face face : faces) {
try {
// Crop face thumbnail with five main landmarks drawn from original image.
faceThumbnails.add(ImageHelper.generateFaceThumbnail(
mBitmap, face.faceRectangle));
faceIdList.add(null);
faceRectList.add(face.faceRectangle);
faceChecked.add(false);
} catch (IOException e) {
// Show the exception when generating face thumbnail fails.
setInfo(e.getMessage());
}
}
}
}
@Override
public int getCount() {
return faceRectList.size();
}
@Override
public Object getItem(int position) {
return faceRectList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// set the item view
if (convertView == null) {
LayoutInflater layoutInflater =
(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView =
layoutInflater.inflate(R.layout.item_face_with_checkbox, parent, false);
}
convertView.setId(position);
((ImageView)convertView.findViewById(R.id.image_face))
.setImageBitmap(faceThumbnails.get(position));
// set the checked status of the item
CheckBox checkBox = (CheckBox) convertView.findViewById(R.id.checkbox_face);
checkBox.setChecked(faceChecked.get(position));
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
faceChecked.set(position, isChecked);
}
});
return convertView;
}
}
}
| [
"14520515@gm.uit.edu.vn"
] | 14520515@gm.uit.edu.vn |
f0b39f3ec33bbeea579091036b030733ab7d74b2 | 5ecd15baa833422572480fad3946e0e16a389000 | /framework/MCS-Open/subsystems/eclipse-ab/main/api/java/com/volantis/mcs/eclipse/ab/editors/xml/XMLDocumentProvider.java | 2f49a2d576109fa7ea6214a14e9f32e5dc703da1 | [] | no_license | jabley/volmobserverce | 4c5db36ef72c3bb7ef20fb81855e18e9b53823b9 | 6d760f27ac5917533eca6708f389ed9347c7016d | refs/heads/master | 2021-01-01T05:31:21.902535 | 2009-02-04T02:29:06 | 2009-02-04T02:29:06 | 38,675,289 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,222 | java | /*
This file is part of Volantis Mobility Server.
Volantis Mobility Server 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.
Volantis Mobility Server 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 Volantis Mobility Server. If not, see <http://www.gnu.org/licenses/>.
*/
/* ----------------------------------------------------------------------------
* (c) Volantis Systems Ltd 2003.
* ----------------------------------------------------------------------------
*/
package com.volantis.mcs.eclipse.ab.editors.xml;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.DefaultPartitioner;
import org.eclipse.ui.editors.text.FileDocumentProvider;
import java.io.InputStream;
/**
* A document provided for XML documents.
*
* DISCLAIMER: This class and its associated classes are a quick fix built to
* provide the ability to edit themes and layouts without the Design
* parts. As such there are more likely to be bugs, bits missing and
* bits that could be better designed.
*/
public class XMLDocumentProvider extends FileDocumentProvider {
// javadoc inherited
protected IDocument createDocument(Object element) throws CoreException {
IDocument document = super.createDocument(element);
if (document != null) {
establishPartitioner(document);
}
return document;
}
/**
* Establish document partitioner for this document provider.
* @param document The document for the partitioner. Must not be null.
* @throws IllegalArgumentException If document is null.
*/
private void establishPartitioner(IDocument document) {
if (document == null) {
throw new IllegalArgumentException("Cannot be null: document"); //$NON-NLS-1$
}
IDocumentPartitioner partitioner =
new DefaultPartitioner(
new XMLPartitionScanner(),
new String[]{
XMLPartitionScanner.XML_TAG,
XMLPartitionScanner.XML_COMMENT});
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
/**
* Set the document content.
* @param element The element (e.g. IEditorInput) associciated with the
* document.
* @param contentStream The InputStream from which to derive the
* content. The content is expected to be well-formed xml.
* @throws CoreException If the contentStream cannot be read.
*/
public void setDocumentContent(Object element, InputStream contentStream,
boolean isDirty)
throws CoreException {
setDocumentContent(getDocument(element), contentStream,
getEncoding(element));
FileInfo info = (FileInfo) getElementInfo(element);
if (info != null) {
if (isDirty != info.fCanBeSaved && info.fCanBeSaved) {
// This means that the document from which this content
// has been set has been saved making it non dirty.
// Because it has been saved the resource is now out
// of sync with this document provided and an attempt
// to save will therefore bring up a dialog asking the
// user if they wish to override the changes. To avoid
// this dialog we synchronize here.
synchronize(element);
} else {
fireElementContentAboutToBeReplaced(element);
info.fDocument.set(getDocument(element).get());
if (info.fCanBeSaved && !isDirty) {
addUnchangedElementListeners(element, info);
}
fireElementContentReplaced(element);
if (isDirty != info.fCanBeSaved) {
info.fCanBeSaved = isDirty;
fireElementDirtyStateChanged(element, isDirty);
}
}
}
}
}
/*
===========================================================================
Change History
===========================================================================
$Log$
08-Dec-04 6416/3 ianw VBM:2004120703 New Build
08-Dec-04 6416/1 ianw VBM:2004120703 New Build
03-Feb-04 2820/1 doug VBM:2004013002 Used the eclipse 'externalize strings wizard' to identify language specific resources
06-Jan-04 2412/2 allan VBM:2004010407 Fixed dirty status handling when switching editor page.
04-Jan-04 2309/2 allan VBM:2003122202 Provide an MCS source editor for multi-page and stand-alone policy editing.
===========================================================================
*/
| [
"iwilloug@b642a0b7-b348-0410-9912-e4a34d632523"
] | iwilloug@b642a0b7-b348-0410-9912-e4a34d632523 |
39bd992849390728fc08d30c1a002be639ff03e0 | 6859fffb898bdbfb4f9ee6fba96a19ac27cde13a | /ch13/src/com/manning/hsia/dvdstore/TestRegex.java | 8bbdde7c89999756eb11788774c12271a859b15d | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | zutjmx/hibernate-search-in-action | cae3bdd7d85f2598f8122e9f0b3ff8769b37e32a | 9d3b61b29dd703989f323ea2f137cfa96c2b7869 | refs/heads/main | 2023-06-18T02:36:05.689172 | 2021-07-04T21:09:56 | 2021-07-04T21:09:56 | 382,948,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,167 | java | package com.manning.hsia.dvdstore;
import com.manning.hsia.test.ch13.SearchTestCase;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.regex.JakartaRegexpCapabilities;
import org.apache.lucene.search.regex.RegexQuery;
import org.apache.lucene.search.regex.SpanRegexQuery;
import org.apache.lucene.search.spans.SpanNearQuery;
import org.apache.lucene.search.spans.SpanQuery;
import org.hibernate.Transaction;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.Search;
import org.testng.annotations.Test;
import java.util.List;
public class TestRegex extends SearchTestCase {
private FullTextSession s;
private Transaction tx;
String texts[] = {
"Keanu Reeves is completely wooden in this romantic misfired flick",
"Reeves plays a traveling salesman and agrees to help a woman",
"Jamie Lee Curtis finds out that he's not really a salesman"
};
@Test(groups="ch13")
public void testRegex1() throws Exception {
try {
buildIndex();
assert regexHitCount( "sa.[aeiou]s.*" ) == 2;
cleanup();
}
finally {
s.close();
}
}
@Test(groups="ch13")
public void testRegex2() throws Exception {
try {
buildIndex();
assert regexHitCount( "sa[aeiou]s.*" ) == 0;
cleanup();
}
finally {
s.close();
}
}
@Test(groups="ch13")
public void testSpanRegex1() throws Exception {
try {
buildIndex();
assert spanRegexHitCount( "sa.[aeiou]s", "woman", 5, true ) == 1;
cleanup();
}
finally {
s.close();
}
}
@Test(groups="ch13")
public void testSpanRegex2() throws Exception {
try {
buildIndex();
assert spanRegexHitCount( "sa.[aeiou]s", "woman", 1, true ) == 0;
cleanup();
}
finally {
s.close();
}
}
private int regexHitCount( String regex ) throws Exception {
RegexQuery query = new RegexQuery( newTerm( regex ) );
query.setRegexImplementation( new JakartaRegexpCapabilities() );
org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Dvd.class );
List results = hibQuery.list();
return results.size();
}
private int spanRegexHitCount( String regex1, String regex2, int slop, boolean ordered )
throws Exception {
SpanRegexQuery q1 = new SpanRegexQuery( newTerm( regex1 ) );
SpanRegexQuery q2 = new SpanRegexQuery( newTerm( regex2 ) );
SpanNearQuery query = new SpanNearQuery( new SpanQuery[]{q1, q2}, slop, ordered );
org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Dvd.class );
List results = hibQuery.list();
return results.size();
}
private Term newTerm( String value ) {
return new Term( "description", value );
}
private void buildIndex() {
s = Search.getFullTextSession( openSession() );
tx = s.beginTransaction();
for (int x = 0; x < texts.length; x++) {
Dvd dvd = new Dvd();
dvd.setId( x );
dvd.setDescription( texts[x] );
s.save( dvd );
}
tx.commit();
s.clear();
}
private void cleanup() {
tx = s.beginTransaction();
for (Object element : s.createQuery( "from " + Dvd.class.getName() ).list()) {
s.delete( element );
}
tx.commit();
}
protected Class[] getMappings() {
return new Class[]{
Dvd.class
};
}
}
| [
"jesus.zuniga.contractor@bbva.com"
] | jesus.zuniga.contractor@bbva.com |
0b8320986a8504cc260d71a3b673673b006e5a05 | 24e94e79466b6761e26e838ba6cb393cb464115b | /src/main/java/com/kylin/electricassistsys/entity/facility/ZyxlEntity.java | f1c41a55e39ba7f3c35b18c5f2852d2703660d76 | [
"Apache-2.0"
] | permissive | radtek/oldDlxt | da5d065bbd9972c76e823968145d0e8c837a8f21 | 7fc8cbf0db983fc8f04fa704995b4efd8e9e5255 | refs/heads/master | 2020-05-27T14:51:17.131055 | 2018-07-01T03:41:15 | 2018-07-01T03:41:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,341 | java | package com.kylin.electricassistsys.entity.facility;
/**
* 设备-中压线路
*/
public class ZyxlEntity
{
/**
* 主键jgNf
*/
private String glid;
/**
* open3000设备编号
*/
private String opensbid;
/**
* open3000设备名称
*/
private String opensbname;
/**
* open3000厂站编号
*/
private String id;
/**
* 设备类型 变压器,变电站 ,交流线路 , 中压线路
*/
private String sbtype;
/**
* 关联设备
*/
private String mysbid;
/**
* 关联设备
*/
private String xlmc;
/**
* 关联日期
*/
private String sbgltime;
/**
* 关联类型 手动,自动
*/
private String gltype;
/**
* 备注
*/
private String remark;
public String getGlid()
{
return glid;
}
public void setGlid(String glid)
{
this.glid = glid;
}
public String getOpensbid()
{
return opensbid;
}
public void setOpensbid(String opensbid)
{
this.opensbid = opensbid;
}
public String getOpensbname()
{
return opensbname;
}
public void setOpensbname(String opensbname)
{
this.opensbname = opensbname;
}
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public String getSbtype()
{
return sbtype;
}
public void setSbtype(String sbtype)
{
this.sbtype = sbtype;
}
public String getMysbid()
{
return mysbid;
}
public void setMysbid(String mysbid)
{
this.mysbid = mysbid;
}
public String getXlmc()
{
return xlmc;
}
public void setXlmc(String xlmc)
{
this.xlmc = xlmc;
}
public String getSbgltime()
{
return sbgltime;
}
public void setSbgltime(String sbgltime)
{
this.sbgltime = sbgltime;
}
public String getGltype()
{
return gltype;
}
public void setGltype(String gltype)
{
this.gltype = gltype;
}
public String getRemark()
{
return remark;
}
public void setRemark(String remark)
{
this.remark = remark;
}
}
| [
"609676374@qq.com"
] | 609676374@qq.com |
2be4007ec734622c180c3d76bca323d4d56c79d2 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-11113/u-11-111-1112-11113-f6264.java | c822d6ebcfef48d002fb4521eb4c51e78486dfb5 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 105 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
164173735407 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
b694a5eca89c4cec883ef500d686c2c73f8e0a41 | d2286fa79ed37b90ed3a49a7d15996664244ccec | /src/test/java/io/nats/client/NatsServerProtocolMock.java | d7e72b544423704710a29edda271321a080becb4 | [
"Apache-2.0"
] | permissive | altmind/java-nats | ed2dfa62d9428df3865b6e8b747741e97c99ee10 | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | refs/heads/master | 2020-05-09T11:35:59.709158 | 2019-04-09T20:42:08 | 2019-04-09T20:42:08 | 181,086,695 | 0 | 0 | Apache-2.0 | 2019-04-12T21:37:43 | 2019-04-12T21:37:43 | null | UTF-8 | Java | false | false | 8,896 | java | // Copyright 2015-2018 The NATS 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 io.nats.client;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.CompletableFuture;
/**
* Handles the begining of the connect sequence, all hard coded, but
* is configurable to fail at specific points to allow client testing.
*/
public class NatsServerProtocolMock implements Closeable{
// Default is to exit after pong
public enum ExitAt {
SLEEP_BEFORE_INFO,
EXIT_BEFORE_INFO,
EXIT_AFTER_INFO,
EXIT_AFTER_CONNECT,
EXIT_AFTER_PING,
EXIT_AFTER_CUSTOM,
NO_EXIT
}
public enum Progress {
NO_CLIENT,
CLIENT_CONNECTED,
SENT_INFO,
GOT_CONNECT,
GOT_PING,
SENT_PONG,
STARTED_CUSTOM_CODE,
COMPLETED_CUSTOM_CODE,
}
public interface Customizer {
public void customizeTest(NatsServerProtocolMock ts, BufferedReader reader, PrintWriter writer);
}
private int port;
private ExitAt exitAt;
private Progress progress;
private boolean protocolFailure;
private CompletableFuture<Boolean> waitForIt;
private Customizer customizer;
private String customInfo;
private String separator = " ";
private boolean customInfoIsFullInfo = false;
public NatsServerProtocolMock(ExitAt exitAt) {
this(NatsTestServer.nextPort(), exitAt);
}
public NatsServerProtocolMock(int port, ExitAt exitAt) {
this.port = port;
this.exitAt = exitAt;
start();
}
public NatsServerProtocolMock(Customizer custom) {
this.port = NatsTestServer.nextPort();
this.exitAt = ExitAt.NO_EXIT;
this.customizer = custom;
start();
}
public NatsServerProtocolMock(Customizer custom, int port, boolean exitAfterCustom) {
this.port = port;
if (exitAfterCustom) {
this.exitAt = ExitAt.EXIT_AFTER_CUSTOM;
} else {
this.exitAt = ExitAt.NO_EXIT;
}
this.customizer = custom;
start();
}
// CustomInfo is just the JSON string, not the full protocol string
// or the \r\n.
public NatsServerProtocolMock(Customizer custom, String customInfo) {
this.port = NatsTestServer.nextPort();
this.exitAt = ExitAt.NO_EXIT;
this.customizer = custom;
this.customInfo = customInfo;
start();
}
private void start() {
this.progress = Progress.NO_CLIENT;
this.waitForIt = new CompletableFuture<>();
Thread t = new Thread(() -> {accept();});
t.start();
try {
Thread.sleep(100);
} catch (Exception exp) {
//Give the server time to get going
}
}
public void useTabs() {
this.separator = "\t";
}
public void useCustomInfoAsFullInfo() {
customInfoIsFullInfo = true;
}
public int getPort() {
return port;
}
public String getURI() {
return "nats://localhost:" + this.getPort();
}
public Progress getProgress() {
return this.progress;
}
// True if the failure was not intentional
public boolean wasProtocolFailure() {
return protocolFailure;
}
public void close() {
waitForIt.complete(Boolean.TRUE);
}
public void accept() {
ServerSocket serverSocket = null;
Socket socket = null;
PrintWriter writer = null;
BufferedReader reader = null;
try {
serverSocket = new ServerSocket(this.port);
serverSocket.setSoTimeout(5000);
System.out.println("*** Mock Server @" + this.port + " started...");
socket = serverSocket.accept();
this.progress = Progress.CLIENT_CONNECTED;
System.out.println("*** Mock Server @" + this.port + " got client...");
writer = new PrintWriter(socket.getOutputStream());
reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
if (exitAt == ExitAt.EXIT_BEFORE_INFO) {
throw new Exception("exit");
}
if (exitAt == ExitAt.SLEEP_BEFORE_INFO) {
try {
Thread.sleep(3000);
} catch ( InterruptedException e) {
// ignore
}
}
if (this.customInfo != null) {
if (customInfoIsFullInfo) {
writer.write(customInfo);
} else {
writer.write("INFO" + this.separator + customInfo + "\r\n");
}
} else {
writer.write("INFO" + this.separator + "{\"server_id\":\"test\"}\r\n");
}
writer.flush();
this.progress = Progress.SENT_INFO;
System.out.println("*** Mock Server @" + this.port + " sent info...");
if (exitAt == ExitAt.EXIT_AFTER_INFO) {
throw new Exception("exit");
}
String connect = reader.readLine();
if (connect != null && connect.startsWith("CONNECT")) {
this.progress = Progress.GOT_CONNECT;
System.out.println("*** Mock Server @" + this.port + " got connect...");
} else {
throw new IOException("First message wasn't CONNECT");
}
if (exitAt == ExitAt.EXIT_AFTER_CONNECT) {
throw new Exception("exit");
}
String ping = reader.readLine();
if (ping.startsWith("PING")) {
this.progress = Progress.GOT_PING;
System.out.println("*** Mock Server @" + this.port + " got ping...");
} else {
throw new IOException("Second message wasn't PING");
}
if (exitAt == ExitAt.EXIT_AFTER_PING) {
throw new Exception("exit");
}
writer.write("PONG\r\n");
writer.flush();
this.progress = Progress.SENT_PONG;
System.out.println("*** Mock Server @" + this.port + " sent pong...");
if (this.customizer != null) {
this.progress = Progress.STARTED_CUSTOM_CODE;
System.out.println("*** Mock Server @" + this.port + " starting custom code...");
this.customizer.customizeTest(this, reader, writer);
this.progress = Progress.COMPLETED_CUSTOM_CODE;
}
if (exitAt == ExitAt.EXIT_AFTER_CUSTOM) {
throw new Exception("exit");
}
waitForIt.get(); // Wait for the test to cancel us
} catch (IOException io) {
protocolFailure = true;
System.out.println("\n*** Mock Server @" + this.port + " got exception "+io.getMessage());
io.printStackTrace();
} catch (Exception ex) {
System.out.println("\n*** Mock Server @" + this.port + " got exception "+ex.getMessage());
if (!"exit".equals(ex.getMessage())) {
ex.printStackTrace();
}
}
finally {
if (serverSocket != null) {
try {
serverSocket.close();
} catch (IOException ex) {
System.out.println("\n*** Mock Server @" + this.port + " got exception "+ex.getMessage());
}
}
if (socket != null) {
try {
writer.close();
reader.close();
socket.close();
} catch (IOException ex) {
System.out.println("\n*** Mock Server @" + this.port + " got exception "+ex.getMessage());
}
}
}
System.out.println("*** Mock Server @" + this.port + " completed...");
}
} | [
"sasbury@synadia.com"
] | sasbury@synadia.com |
ad664c35c7f46cba5b21f2902928c11aad215713 | 5be64d018ff74811cecda17c0f95327a39388376 | /DesignPatterns/Visitor/src/main/java/org/practice/visitor/monitors/StateTaxMonitor.java | 6e0745444d0fa11f083f0f6779499b5de366549d | [] | no_license | sarkershantonu/java-novice-to-advance | 3767f0c772f28ef2f94514cda45d92acd2c21dbe | d8ccae2cb3c2574e296f0c847eb27e410070c83d | refs/heads/master | 2021-08-14T21:22:09.546356 | 2021-08-10T18:07:56 | 2021-08-10T18:07:56 | 181,795,654 | 2 | 4 | null | 2021-08-10T18:06:02 | 2019-04-17T01:38:55 | Java | UTF-8 | Java | false | false | 632 | java | package org.practice.visitor.monitors;
import org.practice.visitor.products.Chocolate;
import org.practice.visitor.products.Fruit;
import org.practice.visitor.products.SoftDrink;
public class StateTaxMonitor implements TaxMonitor {
public double addTax(Chocolate aChocolate) {
System.out.println("State Tax Added with a Chocolate");
return aChocolate.getPrice()*1.005;
}
public double addTax(SoftDrink aDrink) {
System.out.println("State Tax Added with a Drink");
return aDrink.getPrice()*1.005;
}
public double addTax(Fruit aFruit) {
System.out.println("No State Tax fora Fruit");
return aFruit.getPrice();
}
}
| [
"sarker.shantonu@gmail.com"
] | sarker.shantonu@gmail.com |
e607ec794d3d6eb4e499e562437c02202ed9cbd5 | a1cb037a4e538148664ffa30c9618d3222fd8aa5 | /stable/src/main/java/com/stable/utils/RedisUtil.java | 29b555ca1a34d5ee514e11be368305789378b415 | [] | no_license | ChengquanPeng/test | a5ebb9fa8c04552cba57a4cb305bbecae43002c8 | 36476c81464260d25bb27bb1664c701f36a0901e | refs/heads/master | 2023-07-28T05:39:07.647457 | 2023-07-25T14:09:11 | 2023-07-25T14:09:11 | 86,578,960 | 6 | 0 | null | 2022-06-17T02:18:27 | 2017-03-29T12:23:29 | Java | UTF-8 | Java | false | false | 30,999 | java | package com.stable.utils;
import java.time.Duration;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.DataType;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ZSetOperations.TypedTuple;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.stable.constant.RedisConstant;
@Component
public class RedisUtil {
@Autowired
private StringRedisTemplate redisTemplate;
/*
* @param key
*
* @return
*/
public byte[] dump(String key) {
return redisTemplate.dump(key);
}
/**
* 是否存在key
*
* @param key
* @return
*/
public Boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
/**
* 设置过期时间
*
* @param key
* @param timeout
* @param unit
* @return
*/
public Boolean expire(String key, long timeout, TimeUnit unit) {
return redisTemplate.expire(key, timeout, unit);
}
/**
* 设置过期时间
*
* @param key
* @param date
* @return
*/
public Boolean expireAt(String key, Date date) {
return redisTemplate.expireAt(key, date);
}
/**
* 查找匹配的key
*
* @param pattern
* @return
*/
public Set<String> keys(String pattern) {
return redisTemplate.keys(pattern);
}
/**
* 将当前数据库的 key 移动到给定的数据库 db 当中
*
* @param key
* @param dbIndex
* @return
*/
public Boolean move(String key, int dbIndex) {
return redisTemplate.move(key, dbIndex);
}
/**
* 移除 key 的过期时间,key 将持久保持
*
* @param key
* @return
*/
public Boolean persist(String key) {
return redisTemplate.persist(key);
}
/**
* 返回 key 的剩余的过期时间
*
* @param key
* @param unit
* @return
*/
public Long getExpire(String key, TimeUnit unit) {
return redisTemplate.getExpire(key, unit);
}
/**
* 返回 key 的剩余的过期时间
*
* @param key
* @return
*/
public Long getExpire(String key) {
return redisTemplate.getExpire(key);
}
/**
* 从当前数据库中随机返回一个 key
*
* @return
*/
public String randomKey() {
return redisTemplate.randomKey();
}
/**
* 修改 key 的名称
*
* @param oldKey
* @param newKey
*/
public void rename(String oldKey, String newKey) {
redisTemplate.rename(oldKey, newKey);
}
/**
* 仅当 newkey 不存在时,将 oldKey 改名为 newkey
*
* @param oldKey
* @param newKey
* @return
*/
public Boolean renameIfAbsent(String oldKey, String newKey) {
return redisTemplate.renameIfAbsent(oldKey, newKey);
}
/**
* 返回 key 所储存的值的类型
*
* @param key
* @return
*/
public DataType type(String key) {
return redisTemplate.type(key);
}
/** -------------------string相关操作--------------------- */
/**
* 设置指定 key 的值
*
* @param key
* @param value
*/
public void set(String key, String value) {
if (key.startsWith(RedisConstant.RDS_DIVIDEND_LAST_DAY_)) {// 前复权
redisTemplate.opsForValue().set(key, value);
} else {
redisTemplate.opsForValue().set(key, value, Duration.ofDays(30));// 默认30天
}
}
public void set(String key, Object value) {
this.set(key, getjsonstirng(value));
}
public void set(String key, Object value, Duration timeout) {
this.set(key, getjsonstirng(value), timeout);
}
public void set(String key, String value, Duration timeout) {
redisTemplate.opsForValue().set(key, value, timeout);
}
public String getjsonstirng(Object value) {
return JSON.toJSONString(value, SerializerFeature.WriteDateUseDateFormat);
}
public void del(String key) {
redisTemplate.delete(key);
}
/**
* 获取指定 key 的值
*
* @param key
* @return
*/
public String get(String key) {
return redisTemplate.opsForValue().get(key);
}
public String get(String key, String def) {
String value = redisTemplate.opsForValue().get(key);
if (StringUtils.isBlank(value)) {
return def;
}
return value;
}
public int get(String key, int def) {
String value = redisTemplate.opsForValue().get(key);
if (StringUtils.isBlank(value)) {
return def;
}
return Integer.valueOf(value);
}
public double get(String key, double def) {
String value = redisTemplate.opsForValue().get(key);
if (StringUtils.isBlank(value)) {
return def;
}
return Double.valueOf(value);
}
/**
* 返回 key 中字符串值的子字符
*
* @param key
* @param start
* @param end
* @return
*/
public String getRange(String key, long start, long end) {
return redisTemplate.opsForValue().get(key, start, end);
}
/**
* 将给定 key 的值设为 value ,并返回 key 的旧值(old value)
*
* @param key
* @param value
* @return
*/
public String getAndSet(String key, String value) {
return redisTemplate.opsForValue().getAndSet(key, value);
}
/**
* 对 key 所储存的字符串值,获取指定偏移量上的位(bit)
*
* @param key
* @param offset
* @return
*/
public Boolean getBit(String key, long offset) {
return redisTemplate.opsForValue().getBit(key, offset);
}
/**
* 批量获取
*
* @param keys
* @return
*/
public List<String> multiGet(Collection<String> keys) {
return redisTemplate.opsForValue().multiGet(keys);
}
/**
* 设置ASCII码, 字符串'a'的ASCII码是97, 转为二进制是'01100001', 此方法是将二进制第offset位值变为value
*
* @param key
* @param postion 位置
* @param value 值,true为1, false为0
* @return
*/
public boolean setBit(String key, long offset, boolean value) {
return redisTemplate.opsForValue().setBit(key, offset, value);
}
/**
* 将值 value 关联到 key ,并将 key 的过期时间设为 timeout
*
* @param key
* @param value
* @param timeout 过期时间
* @param unit 时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES
* 秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS
*/
public void setEx(String key, String value, long timeout, TimeUnit unit) {
redisTemplate.opsForValue().set(key, value, timeout, unit);
}
public void setEx(String key, Object value, long timeout, TimeUnit unit) {
this.setEx(key, getjsonstirng(value), timeout, unit);
}
/**
* 只有在 key 不存在时设置 key 的值
*
* @param key
* @param value
* @return 之前已经存在返回false,不存在返回true
*/
public boolean setIfAbsent(String key, String value) {
return redisTemplate.opsForValue().setIfAbsent(key, value);
}
/**
* 用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始
*
* @param key
* @param value
* @param offset 从指定位置开始覆写
*/
public void setRange(String key, String value, long offset) {
redisTemplate.opsForValue().set(key, value, offset);
}
/**
* 获取字符串的长度
*
* @param key
* @return
*/
public Long size(String key) {
return redisTemplate.opsForValue().size(key);
}
/**
* 批量添加
*
* @param maps
*/
public void multiSet(Map<String, String> maps) {
redisTemplate.opsForValue().multiSet(maps);
}
/**
* 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在
*
* @param maps
* @return 之前已经存在返回false,不存在返回true
*/
public boolean multiSetIfAbsent(Map<String, String> maps) {
return redisTemplate.opsForValue().multiSetIfAbsent(maps);
}
/**
* 增加(自增长), 负数则为自减
*
* @param key
* @param value
* @return
*/
public Long incrBy(String key, long increment) {
return redisTemplate.opsForValue().increment(key, increment);
}
/**
*
* @param key
* @param value
* @return
*/
public Double incrByFloat(String key, double increment) {
return redisTemplate.opsForValue().increment(key, increment);
}
/**
* 追加到末尾
*
* @param key
* @param value
* @return
*/
public Integer append(String key, String value) {
return redisTemplate.opsForValue().append(key, value);
}
/** -------------------hash相关操作------------------------- */
/**
* 获取存储在哈希表中指定字段的值
*
* @param key
* @param field
* @return
*/
public Object hGet(String key, String field) {
return redisTemplate.opsForHash().get(key, field);
}
/**
* 获取所有给定字段的值
*
* @param key
* @return
*/
public Map<Object, Object> hGetAll(String key) {
return redisTemplate.opsForHash().entries(key);
}
/**
* 获取所有给定字段的值
*
* @param key
* @param fields
* @return
*/
public List<Object> hMultiGet(String key, Collection<Object> fields) {
return redisTemplate.opsForHash().multiGet(key, fields);
}
public void hPut(String key, String hashKey, String value) {
redisTemplate.opsForHash().put(key, hashKey, value);
}
public void hPutAll(String key, Map<String, String> maps) {
redisTemplate.opsForHash().putAll(key, maps);
}
/**
* 仅当hashKey不存在时才设置
*
* @param key
* @param hashKey
* @param value
* @return
*/
public Boolean hPutIfAbsent(String key, String hashKey, String value) {
return redisTemplate.opsForHash().putIfAbsent(key, hashKey, value);
}
/**
* 删除一个或多个哈希表字段
*
* @param key
* @param fields
* @return
*/
public Long hDelete(String key, Object... fields) {
return redisTemplate.opsForHash().delete(key, fields);
}
/**
* 查看哈希表 key 中,指定的字段是否存在
*
* @param key
* @param field
* @return
*/
public boolean hExists(String key, String field) {
return redisTemplate.opsForHash().hasKey(key, field);
}
/**
* 为哈希表 key 中的指定字段的整数值加上增量 increment
*
* @param key
* @param field
* @param increment
* @return
*/
public Long hIncrBy(String key, Object field, long increment) {
return redisTemplate.opsForHash().increment(key, field, increment);
}
/**
* 为哈希表 key 中的指定字段的整数值加上增量 increment
*
* @param key
* @param field
* @param delta
* @return
*/
public Double hIncrByFloat(String key, Object field, double delta) {
return redisTemplate.opsForHash().increment(key, field, delta);
}
/**
* 获取所有哈希表中的字段
*
* @param key
* @return
*/
public Set<Object> hKeys(String key) {
return redisTemplate.opsForHash().keys(key);
}
/**
* 获取哈希表中字段的数量
*
* @param key
* @return
*/
public Long hSize(String key) {
return redisTemplate.opsForHash().size(key);
}
/**
* 获取哈希表中所有值
*
* @param key
* @return
*/
public List<Object> hValues(String key) {
return redisTemplate.opsForHash().values(key);
}
/**
* 迭代哈希表中的键值对
*
* @param key
* @param options
* @return
*/
public Cursor<Entry<Object, Object>> hScan(String key, ScanOptions options) {
return redisTemplate.opsForHash().scan(key, options);
}
/** ------------------------list相关操作---------------------------- */
/**
* 通过索引获取列表中的元素
*
* @param key
* @param index
* @return
*/
public String lIndex(String key, long index) {
return redisTemplate.opsForList().index(key, index);
}
/**
* 获取列表指定范围内的元素
*
* @param key
* @param start 开始位置, 0是开始位置
* @param end 结束位置, -1返回所有
* @return
*/
public List<String> lRange(String key, long start, long end) {
return redisTemplate.opsForList().range(key, start, end);
}
/**
* 存储在list头部
*
* @param key
* @param value
* @return
*/
public Long lLeftPush(String key, String value) {
return redisTemplate.opsForList().leftPush(key, value);
}
/**
*
* @param key
* @param value
* @return
*/
public Long lLeftPushAll(String key, String... value) {
return redisTemplate.opsForList().leftPushAll(key, value);
}
/**
*
* @param key
* @param value
* @return
*/
public Long lLeftPushAll(String key, Collection<String> value) {
return redisTemplate.opsForList().leftPushAll(key, value);
}
/**
* 当list存在的时候才加入
*
* @param key
* @param value
* @return
*/
public Long lLeftPushIfPresent(String key, String value) {
return redisTemplate.opsForList().leftPushIfPresent(key, value);
}
/**
* 如果pivot存在,再pivot前面添加
*
* @param key
* @param pivot
* @param value
* @return
*/
public Long lLeftPush(String key, String pivot, String value) {
return redisTemplate.opsForList().leftPush(key, pivot, value);
}
/**
*
* @param key
* @param value
* @return
*/
public Long lRightPush(String key, String value) {
return redisTemplate.opsForList().rightPush(key, value);
}
/**
*
* @param key
* @param value
* @return
*/
public Long lRightPushAll(String key, String... value) {
return redisTemplate.opsForList().rightPushAll(key, value);
}
/**
*
* @param key
* @param value
* @return
*/
public Long lRightPushAll(String key, Collection<String> value) {
return redisTemplate.opsForList().rightPushAll(key, value);
}
/**
* 为已存在的列表添加值
*
* @param key
* @param value
* @return
*/
public Long lRightPushIfPresent(String key, String value) {
return redisTemplate.opsForList().rightPushIfPresent(key, value);
}
/**
* 在pivot元素的右边添加值
*
* @param key
* @param pivot
* @param value
* @return
*/
public Long lRightPush(String key, String pivot, String value) {
return redisTemplate.opsForList().rightPush(key, pivot, value);
}
/**
* 通过索引设置列表元素的值
*
* @param key
* @param index 位置
* @param value
*/
public void lSet(String key, long index, String value) {
redisTemplate.opsForList().set(key, index, value);
}
/**
* 移出并获取列表的第一个元素
*
* @param key
* @return 删除的元素
*/
public String lLeftPop(String key) {
return redisTemplate.opsForList().leftPop(key);
}
/**
* 移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
*
* @param key
* @param timeout 等待时间
* @param unit 时间单位
* @return
*/
public String lBLeftPop(String key, long timeout, TimeUnit unit) {
return redisTemplate.opsForList().leftPop(key, timeout, unit);
}
/**
* 移除并获取列表最后一个元素
*
* @param key
* @return 删除的元素
*/
public String lRightPop(String key) {
return redisTemplate.opsForList().rightPop(key);
}
/**
* 移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
*
* @param key
* @param timeout 等待时间
* @param unit 时间单位
* @return
*/
public String lBRightPop(String key, long timeout, TimeUnit unit) {
return redisTemplate.opsForList().rightPop(key, timeout, unit);
}
/**
* 移除列表的最后一个元素,并将该元素添加到另一个列表并返回
*
* @param sourceKey
* @param destinationKey
* @return
*/
public String lRightPopAndLeftPush(String sourceKey, String destinationKey) {
return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, destinationKey);
}
/**
* 从列表中弹出一个值,将弹出的元素插入到另外一个列表中并返回它; 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止
*
* @param sourceKey
* @param destinationKey
* @param timeout
* @param unit
* @return
*/
public String lBRightPopAndLeftPush(String sourceKey, String destinationKey, long timeout, TimeUnit unit) {
return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, destinationKey, timeout, unit);
}
/**
* 删除集合中值等于value得元素
*
* @param key
* @param index index=0, 删除所有值等于value的元素; index>0, 从头部开始删除第一个值等于value的元素;
* index<0, 从尾部开始删除第一个值等于value的元素;
* @param value
* @return
*/
public Long lRemove(String key, long index, String value) {
return redisTemplate.opsForList().remove(key, index, value);
}
/**
* 裁剪list
*
* @param key
* @param start
* @param end
*/
public void lTrim(String key, long start, long end) {
redisTemplate.opsForList().trim(key, start, end);
}
/**
* 获取列表长度
*
* @param key
* @return
*/
public Long lLen(String key) {
return redisTemplate.opsForList().size(key);
}
/** --------------------set相关操作-------------------------- */
/**
* set添加元素
*
* @param key
* @param values
* @return
*/
public Long sAdd(String key, String... values) {
return redisTemplate.opsForSet().add(key, values);
}
/**
* set移除元素
*
* @param key
* @param values
* @return
*/
public Long sRemove(String key, Object... values) {
return redisTemplate.opsForSet().remove(key, values);
}
/**
* 移除并返回集合的一个随机元素
*
* @param key
* @return
*/
public String sPop(String key) {
return redisTemplate.opsForSet().pop(key);
}
/**
* 将元素value从一个集合移到另一个集合
*
* @param key
* @param value
* @param destKey
* @return
*/
public Boolean sMove(String key, String value, String destKey) {
return redisTemplate.opsForSet().move(key, value, destKey);
}
/**
* 获取集合的大小
*
* @param key
* @return
*/
public Long sSize(String key) {
return redisTemplate.opsForSet().size(key);
}
/**
* 判断集合是否包含value
*
* @param key
* @param value
* @return
*/
public Boolean sIsMember(String key, Object value) {
return redisTemplate.opsForSet().isMember(key, value);
}
/**
* 获取两个集合的交集
*
* @param key
* @param otherKey
* @return
*/
public Set<String> sIntersect(String key, String otherKey) {
return redisTemplate.opsForSet().intersect(key, otherKey);
}
/**
* 获取key集合与多个集合的交集
*
* @param key
* @param otherKeys
* @return
*/
public Set<String> sIntersect(String key, Collection<String> otherKeys) {
return redisTemplate.opsForSet().intersect(key, otherKeys);
}
/**
* key集合与otherKey集合的交集存储到destKey集合中
*
* @param key
* @param otherKey
* @param destKey
* @return
*/
public Long sIntersectAndStore(String key, String otherKey, String destKey) {
return redisTemplate.opsForSet().intersectAndStore(key, otherKey, destKey);
}
/**
* key集合与多个集合的交集存储到destKey集合中
*
* @param key
* @param otherKeys
* @param destKey
* @return
*/
public Long sIntersectAndStore(String key, Collection<String> otherKeys, String destKey) {
return redisTemplate.opsForSet().intersectAndStore(key, otherKeys, destKey);
}
/**
* 获取两个集合的并集
*
* @param key
* @param otherKeys
* @return
*/
public Set<String> sUnion(String key, String otherKeys) {
return redisTemplate.opsForSet().union(key, otherKeys);
}
/**
* 获取key集合与多个集合的并集
*
* @param key
* @param otherKeys
* @return
*/
public Set<String> sUnion(String key, Collection<String> otherKeys) {
return redisTemplate.opsForSet().union(key, otherKeys);
}
/**
* key集合与otherKey集合的并集存储到destKey中
*
* @param key
* @param otherKey
* @param destKey
* @return
*/
public Long sUnionAndStore(String key, String otherKey, String destKey) {
return redisTemplate.opsForSet().unionAndStore(key, otherKey, destKey);
}
/**
* key集合与多个集合的并集存储到destKey中
*
* @param key
* @param otherKeys
* @param destKey
* @return
*/
public Long sUnionAndStore(String key, Collection<String> otherKeys, String destKey) {
return redisTemplate.opsForSet().unionAndStore(key, otherKeys, destKey);
}
/**
* 获取两个集合的差集
*
* @param key
* @param otherKey
* @return
*/
public Set<String> sDifference(String key, String otherKey) {
return redisTemplate.opsForSet().difference(key, otherKey);
}
/**
* 获取key集合与多个集合的差集
*
* @param key
* @param otherKeys
* @return
*/
public Set<String> sDifference(String key, Collection<String> otherKeys) {
return redisTemplate.opsForSet().difference(key, otherKeys);
}
/**
* key集合与otherKey集合的差集存储到destKey中
*
* @param key
* @param otherKey
* @param destKey
* @return
*/
public Long sDifference(String key, String otherKey, String destKey) {
return redisTemplate.opsForSet().differenceAndStore(key, otherKey, destKey);
}
/**
* key集合与多个集合的差集存储到destKey中
*
* @param key
* @param otherKeys
* @param destKey
* @return
*/
public Long sDifference(String key, Collection<String> otherKeys, String destKey) {
return redisTemplate.opsForSet().differenceAndStore(key, otherKeys, destKey);
}
/**
* 获取集合所有元素
*
* @param key
* @param otherKeys
* @param destKey
* @return
*/
public Set<String> setMembers(String key) {
return redisTemplate.opsForSet().members(key);
}
/**
* 随机获取集合中的一个元素
*
* @param key
* @return
*/
public String sRandomMember(String key) {
return redisTemplate.opsForSet().randomMember(key);
}
/**
* 随机获取集合中count个元素
*
* @param key
* @param count
* @return
*/
public List<String> sRandomMembers(String key, long count) {
return redisTemplate.opsForSet().randomMembers(key, count);
}
/**
* 随机获取集合中count个元素并且去除重复的
*
* @param key
* @param count
* @return
*/
public Set<String> sDistinctRandomMembers(String key, long count) {
return redisTemplate.opsForSet().distinctRandomMembers(key, count);
}
/**
*
* @param key
* @param options
* @return
*/
public Cursor<String> sScan(String key, ScanOptions options) {
return redisTemplate.opsForSet().scan(key, options);
}
/** ------------------zSet相关操作-------------------------------- */
/**
* 添加元素,有序集合是按照元素的score值由小到大排列
*
* @param key
* @param value
* @param score
* @return
*/
public Boolean zAdd(String key, String value, double score) {
return redisTemplate.opsForZSet().add(key, value, score);
}
/**
*
* @param key
* @param values
* @return
*/
public Long zAdd(String key, Set<TypedTuple<String>> values) {
return redisTemplate.opsForZSet().add(key, values);
}
/**
*
* @param key
* @param values
* @return
*/
public Long zRemove(String key, Object... values) {
return redisTemplate.opsForZSet().remove(key, values);
}
/**
* 增加元素的score值,并返回增加后的值
*
* @param key
* @param value
* @param delta
* @return
*/
public Double zIncrementScore(String key, String value, double delta) {
return redisTemplate.opsForZSet().incrementScore(key, value, delta);
}
/**
* 返回元素在集合的排名,有序集合是按照元素的score值由小到大排列
*
* @param key
* @param value
* @return 0表示第一位
*/
public Long zRank(String key, Object value) {
return redisTemplate.opsForZSet().rank(key, value);
}
/**
* 返回元素在集合的排名,按元素的score值由大到小排列
*
* @param key
* @param value
* @return
*/
public Long zReverseRank(String key, Object value) {
return redisTemplate.opsForZSet().reverseRank(key, value);
}
/**
* 获取集合的元素, 从小到大排序
*
* @param key
* @param start 开始位置
* @param end 结束位置, -1查询所有
* @return
*/
public Set<String> zRange(String key, long start, long end) {
return redisTemplate.opsForZSet().range(key, start, end);
}
/**
* 获取集合元素, 并且把score值也获取
*
* @param key
* @param start
* @param end
* @return
*/
public Set<TypedTuple<String>> zRangeWithScores(String key, long start, long end) {
return redisTemplate.opsForZSet().rangeWithScores(key, start, end);
}
/**
* 根据Score值查询集合元素
*
* @param key
* @param min 最小值
* @param max 最大值
* @return
*/
public Set<String> zRangeByScore(String key, double min, double max) {
return redisTemplate.opsForZSet().rangeByScore(key, min, max);
}
/**
* 根据Score值查询集合元素, 从小到大排序
*
* @param key
* @param min 最小值
* @param max 最大值
* @return
*/
public Set<TypedTuple<String>> zRangeByScoreWithScores(String key, double min, double max) {
return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max);
}
/**
*
* @param key
* @param min
* @param max
* @param start
* @param end
* @return
*/
public Set<TypedTuple<String>> zRangeByScoreWithScores(String key, double min, double max, long start, long end) {
return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max, start, end);
}
/**
* 获取集合的元素, 从大到小排序
*
* @param key
* @param start
* @param end
* @return
*/
public Set<String> zReverseRange(String key, long start, long end) {
return redisTemplate.opsForZSet().reverseRange(key, start, end);
}
/**
* 获取集合的元素, 从大到小排序, 并返回score值
*
* @param key
* @param start
* @param end
* @return
*/
public Set<TypedTuple<String>> zReverseRangeWithScores(String key, long start, long end) {
return redisTemplate.opsForZSet().reverseRangeWithScores(key, start, end);
}
/**
* 根据Score值查询集合元素, 从大到小排序
*
* @param key
* @param min
* @param max
* @return
*/
public Set<String> zReverseRangeByScore(String key, double min, double max) {
return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max);
}
/**
* 根据Score值查询集合元素, 从大到小排序
*
* @param key
* @param min
* @param max
* @return
*/
public Set<TypedTuple<String>> zReverseRangeByScoreWithScores(String key, double min, double max) {
return redisTemplate.opsForZSet().reverseRangeByScoreWithScores(key, min, max);
}
/**
*
* @param key
* @param min
* @param max
* @param start
* @param end
* @return
*/
public Set<String> zReverseRangeByScore(String key, double min, double max, long start, long end) {
return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max, start, end);
}
/**
* 根据score值获取集合元素数量
*
* @param key
* @param min
* @param max
* @return
*/
public Long zCount(String key, double min, double max) {
return redisTemplate.opsForZSet().count(key, min, max);
}
/**
* 获取集合大小
*
* @param key
* @return
*/
public Long zSize(String key) {
return redisTemplate.opsForZSet().size(key);
}
/**
* 获取集合大小
*
* @param key
* @return
*/
public Long zZCard(String key) {
return redisTemplate.opsForZSet().zCard(key);
}
/**
* 获取集合中value元素的score值
*
* @param key
* @param value
* @return
*/
public Double zScore(String key, Object value) {
return redisTemplate.opsForZSet().score(key, value);
}
/**
* 移除指定索引位置的成员
*
* @param key
* @param start
* @param end
* @return
*/
public Long zRemoveRange(String key, long start, long end) {
return redisTemplate.opsForZSet().removeRange(key, start, end);
}
/**
* 根据指定的score值的范围来移除成员
*
* @param key
* @param min
* @param max
* @return
*/
public Long zRemoveRangeByScore(String key, double min, double max) {
return redisTemplate.opsForZSet().removeRangeByScore(key, min, max);
}
/**
* 获取key和otherKey的并集并存储在destKey中
*
* @param key
* @param otherKey
* @param destKey
* @return
*/
public Long zUnionAndStore(String key, String otherKey, String destKey) {
return redisTemplate.opsForZSet().unionAndStore(key, otherKey, destKey);
}
/**
*
* @param key
* @param otherKeys
* @param destKey
* @return
*/
public Long zUnionAndStore(String key, Collection<String> otherKeys, String destKey) {
return redisTemplate.opsForZSet().unionAndStore(key, otherKeys, destKey);
}
/**
* 交集
*
* @param key
* @param otherKey
* @param destKey
* @return
*/
public Long zIntersectAndStore(String key, String otherKey, String destKey) {
return redisTemplate.opsForZSet().intersectAndStore(key, otherKey, destKey);
}
/**
* 交集
*
* @param key
* @param otherKeys
* @param destKey
* @return
*/
public Long zIntersectAndStore(String key, Collection<String> otherKeys, String destKey) {
return redisTemplate.opsForZSet().intersectAndStore(key, otherKeys, destKey);
}
/**
*
* @param key
* @param options
* @return
*/
public Cursor<TypedTuple<String>> zScan(String key, ScanOptions options) {
return redisTemplate.opsForZSet().scan(key, options);
}
}
| [
"348000443@qq.com"
] | 348000443@qq.com |
32085344c03876effb94a25ec00ccdea3de51907 | 3735f3caf04bc5ddc5f974139c83fed709ef6b9d | /src/main/java/com/softmetrix/service/impl/OpenDoorServiceImpl.java | f328811cc0ae00dd97dace6ac58a84ef3481cb8f | [] | no_license | mukyz/gradebook | 2337e96af93e8d7f6e56f632b890735d92d455b2 | 16396856f8d902bfb2eeb9df627278ba3dfa1af3 | refs/heads/master | 2020-09-24T05:03:46.171487 | 2019-12-03T17:04:18 | 2019-12-03T17:04:18 | 225,669,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,429 | java | package com.softmetrix.service.impl;
import com.softmetrix.model.DTO.OpenDoorDTO;
import com.softmetrix.model.OpenDoor;
import com.softmetrix.model.Role;
import com.softmetrix.model.User;
import com.softmetrix.repository.OpenDoorRepository;
import com.softmetrix.service.OpenDoorService;
import com.softmetrix.service.UserService;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class OpenDoorServiceImpl implements OpenDoorService{
@Autowired OpenDoorRepository openDoorRepository;
@Autowired UserService userService;
@Override
public List<OpenDoor> getOpenDoorRequest(User user) {
if(user.getRole().getRoleName().equals(Role.TEACHER))
return openDoorRepository.findByTeacher(user);
if(user.getRole().getRoleName().equals(Role.PARENT))
return openDoorRepository.findByParent(user);
return null;
}
@Override
public void setStatus(Integer id, String status) {
OpenDoor od = openDoorRepository.findById(id).orElse(null);
if(od != null){
if(status.equals("accept")){
od.setIsAccepted(Boolean.TRUE);
} else if(status.equals("reject")){
od.setIsAccepted(Boolean.FALSE);
}
openDoorRepository.save(od);
}
}
@Override
public void save(OpenDoorDTO openDoorDTO) {
User parent = userService.findById(openDoorDTO.getParentId()).orElse(null);
if (parent == null) return;
User teacher = userService.findById(openDoorDTO.getTeacherId()).orElse(null);
if (teacher == null) return;
OpenDoor od = new OpenDoor();
od.setParent(parent);
od.setTeacher(teacher);
od.setDate(openDoorDTO.getDate());
openDoorRepository.save(od);
}
@Override
public OpenDoor getNextApointment(User user) {
if(user.getRole().getRoleName().equals(Role.PARENT))
return openDoorRepository.findTopByParentAndDateAfterAndIsAcceptedOrderByDateAsc(user, new Date(), Boolean.TRUE);
if(user.getRole().getRoleName().equals(Role.TEACHER))
return openDoorRepository.findTopByTeacherAndDateAfterAndIsAcceptedOrderByDateAsc(user, new Date(), Boolean.TRUE);
return null;
}
}
| [
"dimitrije.muzur@gmail.com"
] | dimitrije.muzur@gmail.com |
dd9d9b2f86dcab7648e3dda23699cf9f8d854146 | f0547e0454012f424fdb77c9fe6e2b87e876cda3 | /src/main/utils/Utils.java | 917fb094bd594d1ab399b62c32647bce5982e411 | [] | no_license | zollder/ADS | e04b7c3782e2486ad4401229a11d61cfec51ef56 | b1c1ffcd0eb9d2936532f60a741d188b0b452e39 | refs/heads/master | 2021-01-17T07:28:23.101956 | 2017-03-09T00:27:41 | 2017-03-09T00:27:41 | 83,709,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,433 | java | package main.utils;
import java.util.Random;
public class Utils {
public static <E> void printArray(E[] array) {
for (E element : array) {
System.out.printf("%s ", element);
}
System.out.println();
}
public static void printArray(int[] array) {
for (int i = 0; i < array.length; i++) {
if (i == array.length - 1) {
System.out.println(array[i]);
} else {
System.out.print(array[i] + " ");
}
}
System.out.print("\n");
}
public static void printArray(char[] array) {
for (int i = 0; i < array.length; i++) {
if (i == array.length - 1) {
System.out.println(array[i]);
} else {
System.out.print(array[i] + " ");
}
}
System.out.print("\n");
}
public static void printArray(boolean[][] array) {
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array.length; j++) {
System.out.print(array[i][j] + " ");
}
System.out.print("\n");
}
System.out.print("\n");
}
public static int getRandomInt(int min, int max) {
Random random = new Random();
return random.nextInt(max - min + 1) + min;
}
public static void printMatrix(long[][] matrix, String comment) {
if (comment != null && comment.length() > 0) {
System.out.println(comment);
}
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix.length; j++) {
System.out.print(matrix[i][j] + " ");
}
System.out.println("");
}
System.out.println("");
}
} | [
"goodzollder@gmail.com"
] | goodzollder@gmail.com |
7a7e4c716be63e3caecf8da2b11d0566b5f18e20 | 624a7008337317592650f6e423c8f82158ed52dd | /Whatie-Demo-With-Tuya/app/src/main/java/com/whatie/ati/androiddemo/views/SetNewPasswordActivity.java | b4b00a78afc09d2a03cbd86f2d110b1b8adf1650 | [
"MIT"
] | permissive | ATI-Wuhan/WhatieSDKDemo_Android_with_Tuya | fd97d9b234baad648d5613f178fe844a62dbd42f | fcef101057cdf68b7666a7b9cbc00f5deb316b96 | refs/heads/master | 2020-03-21T02:45:34.113287 | 2018-11-20T12:08:13 | 2018-11-20T12:08:13 | 138,016,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,307 | java | package com.whatie.ati.androiddemo.views;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.whatie.ati.androiddemo.R;
import com.d9lab.ati.whatiesdk.bean.BaseResponse;
import com.d9lab.ati.whatiesdk.callback.BaseCallback;
import com.d9lab.ati.whatiesdk.ehome.EHomeInterface;
import com.d9lab.ati.whatiesdk.util.LogUtil;
import com.lzy.okgo.model.Response;
import butterknife.BindView;
import butterknife.OnClick;
/**
* Created by 神火 on 2018/6/8.
*
* 这里的重置密码我没找到应该用哪个接口,所以先没写
*
*
*/
public class SetNewPasswordActivity extends BaseActivity {
private static final String TAG = "SetNewPasswordActivity";
@BindView(R.id.et_new_password)
EditText etNewPassword;
@BindView(R.id.et_new_password_confirm)
EditText etNewPasswordConfirm;
@BindView(R.id.iv_recover_pwd_back)
ImageView ivRecoverPwdBack;
@BindView(R.id.tv_set_new_password)
TextView tvSetNewPassword;
private String email;
@Override
protected int getContentViewId() {
return R.layout.act_reset_password;
}
@Override
protected void initViews() {
email = getIntent().getStringExtra("email");
}
@Override
protected void initEvents() {
}
@Override
protected void initDatas() {
}
public void setNewPassword(final String password) {
EHomeInterface.getINSTANCE().resetPasswordByEmail(mContext, email, password, new BaseCallback() {
@Override
public void onSuccess(Response<BaseResponse> response) {
Toast.makeText(mContext, getString(R.string.set_new_psw_success), Toast.LENGTH_SHORT).show();
finish();
}
@Override
public void onError(Response<BaseResponse> response) {
super.onError(response);
Toast.makeText(mContext, getString(R.string.set_new_psw_fail), Toast.LENGTH_SHORT).show();
}
});
}
public void login(){
}
@OnClick({R.id.iv_recover_pwd_back, R.id.tv_set_new_password})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_recover_pwd_back:
finish();
break;
case R.id.tv_set_new_password:
String password1 = etNewPassword.getText().toString().trim();
String Password2 = etNewPasswordConfirm.getText().toString().trim();
if (password1.equals("") || Password2.equals("")){
LogUtil.log(TAG, "new pwd"+password1 +" confirm:"+Password2);
Toast.makeText(SetNewPasswordActivity.this,getString(R.string.change_password_tip),
Toast.LENGTH_SHORT).show();
} else{
if (!password1.equals(Password2)) {
Toast.makeText(SetNewPasswordActivity.this,getString(R.string.change_password_match),
Toast.LENGTH_SHORT).show();
}
else{
setNewPassword(password1);
}
}
break;
}
}
}
| [
"whatie@qq.com"
] | whatie@qq.com |
c6f9e7ecc412a28c9fb3432af7e87048416d3b84 | 216a2141fcb7ae1698543bb196489767c3fce96a | /algorithms/java/347_top_k_frequent_elements/TopK.java | 890085158af513fc71afd27b265cc7ff9a4d633b | [] | no_license | zhangzz2015/code | 87aedb9c5ceb7279903b42036431891b2338a39d | 28d0d6fd8fb154644bb09a43b932a8a1d9d2593f | refs/heads/master | 2023-06-19T22:22:39.739097 | 2021-07-18T21:28:21 | 2021-07-18T21:28:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | class TopK {
public int[] topKFrequent(int[] nums, int k) {
if (nums == null || nums.length == 0 || k <= 0) return nums;
Map<Integer, Integer> freqMap = buildMap(nums);
PriorityQueue<Map.Entry<Integer, Integer>> minHeap = new PriorityQueue<>(new MyComparator());
for (Map.Entry<Integer, Integer> entry : freqMap.entrySet()) {
minHeap.offer(entry);
if (minHeap.size() > k) {
minHeap.poll();
}
}
int[] res = new int[k];
int i = 0;
while (!minHeap.isEmpty()) {
res[i++] = minHeap.poll().getKey();
}
return res;
}
static class MyComparator implements Comparator<Map.Entry<Integer, Integer>> {
@Override
public int compare(Map.Entry<Integer, Integer> e1, Map.Entry<Integer, Integer> e2) {
return Integer.compare(e1.getValue(), e2.getValue());
}
}
private Map<Integer, Integer> buildMap(int[] nums) {
Map<Integer, Integer> map = new HashMap<>();
for (int i : nums) {
map.put(i, map.getOrDefault(i, 0) + 1);
}
return map;
}
} | [
"zk.zhengkai@outlook.com"
] | zk.zhengkai@outlook.com |
2d98617d8561a096455e32ce98e968e406f7a48e | 54483b23a46153e9d52f1575632bd2a86f4f3146 | /screenshotlib/src/main/java/com/junie/screenshot/allscreen/ScreenShotActivity.java | 24bad8b9ff2ad05b37bbc7f48b30bbd8df17b3e9 | [] | no_license | junie233/screenshot | a3ba7253ca66964ec9d317f8894cf777fb8b4cd7 | e15646b9a2144e458c91d9112fd52b24edd6da32 | refs/heads/master | 2021-05-11T18:15:13.694452 | 2018-01-18T12:40:35 | 2018-01-18T12:40:35 | 117,815,677 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,225 | java | package com.junie.screenshot.allscreen;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.media.projection.MediaProjectionManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.util.Log;
import android.view.Window;
import com.junie.screenshot.listener.ShotListener;
/**
* Created by niejun on 2018/1/18.
*/
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public class ScreenShotActivity extends Activity{
private static String TAG = ScreenShotActivity.class.getSimpleName();
public static final int REQUEST_MEDIA_PROJECTION = 10001;
private ScreenShotManager shotManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
getWindow().setDimAmount(0f);
requestScreenShot();
}
public void requestScreenShot() {
Log.d(TAG,"请求权限");
startActivityForResult(
((MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE)).createScreenCaptureIntent(),
REQUEST_MEDIA_PROJECTION
);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_MEDIA_PROJECTION: {
if (resultCode == -1 && data != null) {
shotManager = new ScreenShotManager(ScreenShotActivity.this,data,new ShotListener() {
@Override
public void onShotFinish() {
}
});
shotManager.startScreenShot();
}
}
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if(shotManager != null) {
shotManager.release();
shotManager = null;
}
}
}
| [
"junnie@iflytek.com"
] | junnie@iflytek.com |
0fc63a29853a985218884f8b198f17e83d67a217 | ab7687c36b9587c3460f3aad4ae8c7b31f9b0eff | /src/main/java/mum/asd/patterns/FactoryMethod/WinterHolidayPromotion.java | b0cff8ade0b6254d34cb1cff956b37be2514c1d0 | [] | no_license | thonguyen1302/ProjectASD_Design_pattern | ebbd5164b7429bed4de0c3c410e9a0c12ef5a5e5 | 4f813ca1592d0a64b40cda799a549627472e79a5 | refs/heads/master | 2020-03-17T01:38:51.094405 | 2018-05-21T03:48:18 | 2018-05-21T03:48:18 | 133,161,296 | 0 | 0 | null | 2018-05-19T19:31:17 | 2018-05-12T16:01:27 | Java | UTF-8 | Java | false | false | 493 | java | package mum.asd.patterns.FactoryMethod;
import mum.asd.patterns.Command.PromotionCommandInterface;
public class WinterHolidayPromotion extends HolidayPromotion implements PromotionCommandInterface {
public WinterHolidayPromotion(){
// super("WinterHoliday",5,5);
this.setDiscount(5);
this.setPercent(5);
this.setName("WinterHoliday");
}
@Override
public int executeGetDiscout() {
return new ComputeDiscount().getDiscount(this);
}
}
| [
"trantuansangcntt@gmail.com"
] | trantuansangcntt@gmail.com |
a1a2177420013c5b6299d7983af6a3683834fc70 | b12bfdb5983a82e837569d166ad2a9dc9d0063e3 | /app/src/main/java/com/example/calculator/MainActivity.java | 5a3ad7aa0d7883bdb64ff3c6f79c76d2e70ab412 | [] | no_license | Manasbekoff/Calculator | 4f1b3d222eaa2c7fa484644a3915660b23dc1d2e | 48f88f1223b0950424b71c181f5a27e92c81e854 | refs/heads/master | 2022-11-20T16:57:50.986831 | 2020-07-13T16:15:36 | 2020-07-13T16:15:36 | 273,230,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,469 | java | package com.example.calculator;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
public static final String RESULT_KEY = "result_key";
private CalculatorModel calculator;
public static String savedResult = "";
private TextView text;
@Override
public void onSaveInstanceState(@NonNull Bundle outState, @NonNull PersistableBundle outPersistentState) {
super.onSaveInstanceState(outState, outPersistentState);
outState.putSerializable("calc", calculator);
}
@Override
protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
calculator = (CalculatorModel) savedInstanceState.getSerializable("calc");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button saveBtn = findViewById(R.id.saveBtn);
saveBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (savedResult != null) {
Intent intent = getIntent();
intent.putExtra(MainActivity.RESULT_KEY, savedResult);
setResult(RESULT_OK, intent);
finish();
}
}
});
int[] numberIds = new int[]{
R.id.zero,
R.id.one,
R.id.two,
R.id.three,
R.id.four,
R.id.five,
R.id.six,
R.id.seven,
R.id.eight,
R.id.nine,
};
int[] actionsIds = new int[]{
R.id.plus,
R.id.minus,
R.id.multiply,
R.id.divide,
R.id.equal
};
text = findViewById(R.id.text);
calculator = new CalculatorModel();
View.OnClickListener numberButtonClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
calculator.onNumPressed(view.getId());
text.setText(calculator.getText());
}
};
View.OnClickListener actionButtonOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
calculator.onActionPressed(view.getId());
text.setText(calculator.getText());
}
};
for (int i = 0; i < numberIds.length; i++) {
findViewById(numberIds[i]).setOnClickListener(numberButtonClickListener);
}
for (int i = 0; i < actionsIds.length; i++) {
findViewById(actionsIds[i]).setOnClickListener(actionButtonOnClickListener);
}
findViewById(R.id.clean).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
calculator.clean();
text.setText(calculator.getText());
}
});
}
}
| [
"manasbekov@gmail.com"
] | manasbekov@gmail.com |
e6deb2b70e7c5c9de388778c359a6d95a788bae8 | 7e8b6fa53e2885d11ae030d2bddf2963f034a937 | /src/com/patteren/factory/Circle.java | 973747b783c3bc615131adedbb5aed22ba8cc13c | [] | no_license | koritalaashok2/DesignPattrens | 9f1c29e28c157252df28058f112b8f8b12af4d89 | 0989e8dee093b68eb7dc14f0c3665ae18f3db411 | refs/heads/master | 2020-04-12T10:29:47.345121 | 2018-12-19T13:30:40 | 2018-12-19T13:30:40 | 162,431,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 171 | java | package com.patteren.factory;
public class Circle implements Shape {
@Override
public void draw() {
System.out.println(" Circle created ....!!");
}
}
| [
"oritalaashok2@gmail.com"
] | oritalaashok2@gmail.com |
5edaf10bc1783b75d8a417b5d783223208bb0336 | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/osmdroid_osmdroid/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/TileDownloader.java | 55463263b5e703d527bd4f6ecc9426718f31a2f2 | [] | no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297493 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,898 | java | // isComment
package org.osmdroid.tileprovider.modules;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.Log;
import org.osmdroid.api.IMapView;
import org.osmdroid.config.Configuration;
import org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants;
import org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase;
import org.osmdroid.tileprovider.tilesource.OnlineTileSourceBase;
import org.osmdroid.tileprovider.util.Counters;
import org.osmdroid.tileprovider.util.StreamUtils;
import org.osmdroid.util.MapTileIndex;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.Map;
/**
* isComment
*/
public class isClassOrIsInterface {
public Drawable isMethod(final long isParameter, final IFilesystemCache isParameter, final OnlineTileSourceBase isParameter) throws CantContinueException {
return isMethod(isNameExpr, isIntegerConstant, isNameExpr.isMethod(isNameExpr), isNameExpr, isNameExpr);
}
/**
* isComment
*/
public Drawable isMethod(final long isParameter, final int isParameter, final String isParameter, final IFilesystemCache isParameter, final OnlineTileSourceBase isParameter) throws CantContinueException {
// isComment
if (isNameExpr > isIntegerConstant) {
return null;
}
InputStream isVariable = null;
OutputStream isVariable = null;
HttpURLConnection isVariable = null;
ByteArrayInputStream isVariable = null;
ByteArrayOutputStream isVariable = null;
try {
final String isVariable = isNameExpr;
if (isNameExpr.isMethod().isMethod()) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr);
}
if (isNameExpr.isMethod(isNameExpr)) {
return null;
}
// isComment
if (isNameExpr.isMethod().isMethod() != null) {
isNameExpr = (HttpURLConnection) new URL(isNameExpr).isMethod(isNameExpr.isMethod().isMethod());
} else {
isNameExpr = (HttpURLConnection) new URL(isNameExpr).isMethod();
}
isNameExpr.isMethod(true);
isNameExpr.isMethod(isNameExpr.isMethod().isMethod(), isNameExpr.isMethod().isMethod());
for (final Map.Entry<String, String> isVariable : isNameExpr.isMethod().isMethod().isMethod()) {
isNameExpr.isMethod(isNameExpr.isMethod(), isNameExpr.isMethod());
}
isNameExpr.isMethod();
if (isNameExpr.isMethod() != isIntegerConstant) {
switch(isNameExpr.isMethod()) {
case isIntegerConstant:
case isIntegerConstant:
case isIntegerConstant:
case isIntegerConstant:
if (isNameExpr.isMethod().isMethod()) {
// isComment
String isVariable = isNameExpr.isMethod("isStringConstant");
if (isNameExpr != null) {
if (isNameExpr.isMethod("isStringConstant")) {
// isComment
URL isVariable = new URL(isNameExpr);
int isVariable = isNameExpr.isMethod();
boolean isVariable = isNameExpr.isMethod().isMethod("isStringConstant");
if (isNameExpr == -isIntegerConstant)
if (isNameExpr.isMethod().isMethod("isStringConstant")) {
isNameExpr = isIntegerConstant;
} else {
isNameExpr = isIntegerConstant;
}
isNameExpr = (isNameExpr ? "isStringConstant" : "isStringConstant") + isNameExpr.isMethod() + "isStringConstant" + isNameExpr + isNameExpr;
}
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr.isMethod(isNameExpr) + "isStringConstant" + isNameExpr.isMethod() + "isStringConstant" + isNameExpr);
return isMethod(isNameExpr, isNameExpr + isIntegerConstant, isNameExpr, isNameExpr, isNameExpr);
}
break;
}
// isComment
default:
{
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr.isMethod(isNameExpr) + "isStringConstant" + isNameExpr.isMethod());
if (isNameExpr.isMethod().isMethod()) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr);
}
isNameExpr.isFieldAccessExpr++;
// isComment
isNameExpr = isNameExpr.isMethod();
return null;
}
}
}
String isVariable = isNameExpr.isMethod("isStringConstant");
if (isNameExpr.isMethod().isMethod()) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr + "isStringConstant" + isNameExpr);
}
if (isNameExpr != null && !isNameExpr.isMethod().isMethod("isStringConstant")) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr + "isStringConstant" + isNameExpr);
}
isNameExpr = isNameExpr.isMethod();
isNameExpr = new ByteArrayOutputStream();
isNameExpr = new BufferedOutputStream(isNameExpr, isNameExpr.isFieldAccessExpr);
final long isVariable = isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr), isNameExpr.isMethod(isNameExpr.isFieldAccessExpr), isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr, isNameExpr);
isNameExpr.isMethod();
final byte[] isVariable = isNameExpr.isMethod();
isNameExpr = new ByteArrayInputStream(isNameExpr);
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr, isNameExpr, isNameExpr, isNameExpr);
isNameExpr.isMethod();
}
return isNameExpr.isMethod(isNameExpr);
} catch (final UnknownHostException isParameter) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr.isMethod(isNameExpr) + "isStringConstant" + isNameExpr);
isNameExpr.isFieldAccessExpr++;
} catch (final BitmapTileSourceBase.LowMemoryException isParameter) {
// isComment
isNameExpr.isFieldAccessExpr++;
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr.isMethod(isNameExpr) + "isStringConstant" + isNameExpr);
throw new CantContinueException(isNameExpr);
} catch (final FileNotFoundException isParameter) {
isNameExpr.isFieldAccessExpr++;
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr.isMethod(isNameExpr) + "isStringConstant" + isNameExpr);
} catch (final IOException isParameter) {
isNameExpr.isFieldAccessExpr++;
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr.isMethod(isNameExpr) + "isStringConstant" + isNameExpr);
} catch (final Throwable isParameter) {
isNameExpr.isFieldAccessExpr++;
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr.isMethod(isNameExpr), isNameExpr);
} finally {
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod(isNameExpr);
try {
isNameExpr.isMethod();
} catch (Exception isParameter) {
}
}
return null;
}
/**
* isComment
*/
public Long isMethod(final String isParameter) {
if (isNameExpr != null && isNameExpr.isMethod() > isIntegerConstant) {
try {
final Date isVariable = isNameExpr.isMethod().isMethod().isMethod(isNameExpr);
return isNameExpr.isMethod();
} catch (final Exception isParameter) {
if (isNameExpr.isMethod().isMethod())
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr, isNameExpr);
}
}
return null;
}
/**
* isComment
*/
public Long isMethod(final String isParameter) {
if (isNameExpr != null && isNameExpr.isMethod() > isIntegerConstant) {
try {
final String[] isVariable = isNameExpr.isMethod("isStringConstant");
final String isVariable = "isStringConstant";
for (final String isVariable : isNameExpr) {
final int isVariable = isNameExpr.isMethod(isNameExpr);
if (isNameExpr == isIntegerConstant) {
final String isVariable = isNameExpr.isMethod(isNameExpr.isMethod());
return isNameExpr.isMethod(isNameExpr);
}
}
} catch (final Exception isParameter) {
if (isNameExpr.isMethod().isMethod())
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, "isStringConstant" + isNameExpr, isNameExpr);
}
}
return null;
}
/**
* isComment
*/
public long isMethod(final String isParameter, final String isParameter, final long isParameter) {
final Long isVariable = isNameExpr.isMethod().isMethod();
if (isNameExpr != null) {
return isNameExpr + isNameExpr;
}
final long isVariable = isNameExpr.isMethod().isMethod();
final Long isVariable = isMethod(isNameExpr);
if (isNameExpr != null) {
return isNameExpr + isNameExpr * isIntegerConstant + isNameExpr;
}
final Long isVariable = isMethod(isNameExpr);
if (isNameExpr != null) {
return isNameExpr + isNameExpr;
}
return isNameExpr + isNameExpr.isFieldAccessExpr + isNameExpr;
}
}
| [
"matheus@melsolucoes.net"
] | matheus@melsolucoes.net |
208cb5addff1ac29329d06e3a3fc9d74f7f5d1ef | 20174f41be533ddb2fd26b24f5fa50e8a0cc5f40 | /authentication/authentication-repository/src/main/java/org/deschutter/authentication/user/UserRepository.java | e9b5d4f2581bc012dc412e6b19a53eb57eb54d07 | [] | no_license | kovpey/Larp | 159fc5d6f1782a0ca4410f0dc8d2df4eea4e905e | 19ae7a6c23295c969d4d10be1742f1678d091d6b | refs/heads/master | 2021-05-26T22:32:58.346045 | 2014-03-05T14:03:52 | 2014-03-05T14:03:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package org.deschutter.authentication.user;
public interface UserRepository {
public User findByUsernameAndPassword(String username, String password);
}
| [
"Berten"
] | Berten |
39c90e7719f1caccf32a7ec854c145f367efd58b | 83a4e2fc957f9812dbc574eb0fe4ff6ba2f5b1b3 | /logistics/src/main/java/com/cl/logistics/service/IGoodsBillService.java | bd2944814892dc0bf6922fea950cdbec2416331e | [] | no_license | TANGWO/code | 8c82eaa55712d904f25caf4bdd92f0cedf0071f5 | 2dccc788e5e1b5a9ca4e1432d299bad2b91b3441 | refs/heads/master | 2020-04-15T02:29:27.086977 | 2019-01-04T09:33:16 | 2019-01-04T09:33:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,135 | java | package com.cl.logistics.service;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.cl.logistics.bean.CargoReceiptDetail;
import com.cl.logistics.bean.GoodsBill;
import com.cl.logistics.bean.GoodsBillEvent;
public interface IGoodsBillService {
public Map<?, ?> save(GoodsBill goodsBill);
public boolean saveGoods(String goodsBillDetailId, CargoReceiptDetail cargoReceiptDetail);
public Page<GoodsBillEvent> selectAllGoogsBillByPage(Pageable pageable);
public Page<GoodsBillEvent> selectGoodsBillByEvent(String eventName, Pageable pageable);
public GoodsBill selectByGoodsBillCode(String goodsBillCode);
public boolean update(GoodsBill goodsBill);
public boolean delete(String goodsBillCode);
public List<GoodsBill> findDriverIdIsNull();
public List<GoodsBill> findWaitReceive(String customerCode);
public Page<GoodsBill> findInformGet(String type, Pageable pageable);
public Page<GoodsBill> findOldInform(String type, Pageable pageable);
public Page<GoodsBill> findAllGot(Pageable pageable);
} | [
"chenlingys@live.com"
] | chenlingys@live.com |
52e7f05caeb53e655a05d7f7c89af2eecc645caf | d06577e8649397cc825813c4652765bc6bdf6594 | /src/AnisotropicDiffusion_.java | 3495dcb736e63d385e84154e6d94d8c990d20480 | [] | no_license | h1dden-da3m0n/bva-ue | 5a0019a55b28bcfb891be82f14bb69529c7e5fe3 | c4cbaf910c59c8010c820b4e297cbeb67ebb86b9 | refs/heads/master | 2020-05-19T15:56:52.949014 | 2019-05-20T17:08:42 | 2019-05-20T17:08:42 | 185,096,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,484 | java | import bva.util.ConvolutionFilter;
import bva.util.ImageJUtility;
import ij.IJ;
import ij.ImagePlus;
import ij.gui.GenericDialog;
import ij.plugin.filter.PlugInFilter;
import ij.process.ImageProcessor;
public class AnisotropicDiffusion_ implements PlugInFilter {
public int setup(String arg, ImagePlus imp) {
if (arg.equals("about")) {
showAbout();
return DONE;
}
return DOES_8G + DOES_STACKS + SUPPORTS_MASKING;
} //setup
public void run(ImageProcessor ip) {
byte[] pixels = (byte[]) ip.getPixels();
int width = ip.getWidth();
int height = ip.getHeight();
int[][] inDataArrInt = ImageJUtility.convertFrom1DByteArr(pixels, width, height);
double[][] inDataArrDouble = ImageJUtility.convertToDoubleArr2D(inDataArrInt, width, height);
double[][] imageData = ImageJUtility.convertToDoubleArr2D(inDataArrInt, width, height);
GenericDialog gd = new GenericDialog("Anisotropic Diffusion");
gd.addSlider("K:", 0, 100, 20, 1);
gd.addNumericField("Iter.:", 10, 0);
gd.addCheckbox("Show all Iter:", false);
gd.showDialog();
if (gd.wasCanceled()) {
return;
} //if
int k = (int) gd.getNextNumber();
int iter = (int) gd.getNextNumber();
boolean showIter = gd.getNextBoolean();
for (int i = 0; i < iter; ++i) {
// calc gradients
double[][] gN = ConvolutionFilter.ConvolveDouble(
imageData, width, height, new double[][]{{0, 0, 0}, {1, -1, 0}, {0, 0, 0}}, 1);
double[][] gNE = ConvolutionFilter.ConvolveDouble(
imageData, width, height, new double[][]{{0, 0, 0}, {0, -1, 0}, {1, 0, 0}}, 1);
double[][] gE = ConvolutionFilter.ConvolveDouble(
imageData, width, height, new double[][]{{0, 0, 0}, {0, -1, 0}, {0, 1, 0}}, 1);
double[][] gSE = ConvolutionFilter.ConvolveDouble(
imageData, width, height, new double[][]{{0, 0, 0}, {0, -1, 0}, {0, 0, 1}}, 1);
double[][] gS = ConvolutionFilter.ConvolveDouble(
imageData, width, height, new double[][]{{0, 0, 0}, {0, -1, 1}, {0, 0, 0}}, 1);
double[][] gSW = ConvolutionFilter.ConvolveDouble(
imageData, width, height, new double[][]{{0, 0, 1}, {0, -1, 0}, {0, 0, 0}}, 1);
double[][] gW = ConvolutionFilter.ConvolveDouble(
imageData, width, height, new double[][]{{0, 1, 0}, {0, -1, 0}, {0, 0, 0}}, 1);
double[][] gNW = ConvolutionFilter.ConvolveDouble(
imageData, width, height, new double[][]{{1, 0, 0}, {0, -1, 0}, {0, 0, 0}}, 1);
// calc diffusion coefficient
double[][] cN = calcDiffCoeff(gN, width, height, k);
double[][] cNE = calcDiffCoeff(gNE, width, height, k);
double[][] cE = calcDiffCoeff(gE, width, height, k);
double[][] cSE = calcDiffCoeff(gSE, width, height, k);
double[][] cS = calcDiffCoeff(gS, width, height, k);
double[][] cSW = calcDiffCoeff(gSW, width, height, k);
double[][] cW = calcDiffCoeff(gW, width, height, k);
double[][] cNW = calcDiffCoeff(gNW, width, height, k);
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
// calculate delta
imageData[x][y] += (1.0 / 7.0) * (
gN[x][y] * cN[x][y] +
gNE[x][y] * cNE[x][y] * 0.7 +
gE[x][y] * cE[x][y] +
gSE[x][y] * cSE[x][y] * 0.7 +
gS[x][y] * cS[x][y] +
gSW[x][y] * cSW[x][y] * 0.7 +
gW[x][y] * cW[x][y] +
gNW[x][y] * cNW[x][y] * 0.7
);
}
}
if (showIter)
ImageJUtility.showNewImage(imageData, width, height,
"Anisotropic Diffusion [k=" + k + ", i=" + (i + 1) + "]");
}
if (!showIter)
ImageJUtility.showNewImage(imageData, width, height,
"Anisotropic Diffusion [k=" + k + ", i=" + iter + "]");
ImageJUtility.showNewImageChequerboard(3, width, height, imageData, inDataArrDouble);
} //run
void showAbout() {
IJ.showMessage("About AnisotropicDiffusion_...",
"this is a PluginFilter template\n");
} //showAbout
private double[][] calcDiffCoeff(double[][] nabla, int width, int height, int k) {
double[][] diffCoeff = new double[width][height];
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
diffCoeff[x][y] = Math.pow(Math.E, -(Math.pow(Math.abs(nabla[x][y]), 2) / (2 * (k * k))));
}
}
return diffCoeff;
}
} //class FilterTemplate_
| [
"33120068+h1dden-da3m0n@users.noreply.github.com"
] | 33120068+h1dden-da3m0n@users.noreply.github.com |
525332d609a959adb8860c56342b0cbcfd20a37c | 287d1065ec24669e5deae3b2a9e91febd4bcc5a1 | /Practice/src/practice11/PTra11_03.java | 95eeb0876561223c04672b6cd3e6116237d30e14 | [] | no_license | KentoTajima/JavaBasic | 308a0404b3a8c2d3dd53ee87a3356cd86042b444 | 456f3b0e91f75094d19fd57dc485e4a2f7524199 | refs/heads/master | 2020-03-12T12:47:20.980435 | 2018-07-04T09:03:46 | 2018-07-04T09:03:46 | 130,626,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | package practice11;
/*
* PTra11_03.java
* 作成 LIKEIT 2017
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
public class PTra11_03 {
/*
* ★ PTra11_03クラスに、クラスフィールドでint型のnumberを定義してください
*/
int number;
/*
* ★ PTra11_03クラスのコンストラクタを引数なしで定義してください
* ★ 処理は、クラスフィールドnumberに1を加算してください
*/
PTra11_03(){
this.number+=1;
}
public static void main(String[] args) {
// ★ sumメソッドを呼び出してください
PTra11_03 ptr=new PTra11_03();
ptr.sum(7,5);
}
public void sum(int x, int y) {
System.out.println("sumメソッドを呼び出しました。" + x + "+" + y + "=" + (x + y));
System.out.println("クラスフィールドnumber:"+this.number );
}
}/* + ★ クラスフィールドnumberの出力をしてください */
| [
"tajiken1214@gmail.com"
] | tajiken1214@gmail.com |
4d9bfa6a4d1e2d89f8c8b259f9c96a948e82e255 | 59e465493e16822e697236f26ca156f4b7c99dae | /cobra2D-engine/src/main/java/de/schuette/cobra2D/ressource/Animation.java | f6773272c01f104775ec05c6273e88b0eb3586ac | [] | no_license | schuettec/2d-engine | c735132a7f65091c570790fdf57813c3df75ded8 | 6975c046d2be2b0a71dd9254b3bb94d6cc00a0b7 | refs/heads/master | 2022-12-20T15:44:09.499454 | 2022-12-07T12:55:00 | 2022-12-07T12:55:00 | 151,825,266 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,928 | java | package de.schuette.cobra2D.ressource;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.RGBImageFilter;
import java.awt.image.VolatileImage;
import de.schuette.cobra2D.rendering.RenderToolkit;
public class Animation {
private final int width, height;
private final int cols, rows;
private transient VolatileImage image;
private Rectangle rect;
private int currentIndex = 0;
protected RGBImageFilter filter;
public Animation(final VolatileImage image, final int width,
final int height) {
this.width = width;
this.height = height;
this.image = image;
this.rect = new Rectangle(new Dimension(width, height));
this.cols = (int) Math.round((image.getWidth() / (double) width));
this.rows = (int) Math.round((image.getHeight() / (double) height));
}
private void setIndex(final int index) throws IllegalArgumentException {
if (index < 0 || index >= (this.getPictureCount())) {
throw new IllegalArgumentException(
"Picture-Index out of bounds. \n Min-Index: 0 \n Max-Index: "
+ (this.getPictureCount() - 1) + "\n"
+ "Requested Index: " + index);
}
this.rect = this.calculateRect(index);
this.currentIndex = index;
}
protected Rectangle calculateRect(final int index) {
final int x = (index % this.cols) * this.width;
final int y = (index / this.cols) * this.height;
return new Rectangle(x, y, this.width, this.height);
}
public int getIndex() {
return this.currentIndex;
}
public int getPictureCount() {
return (this.cols * this.rows);
}
/**
* Returns the current image drawn on a new created backbuffer image.
*
* @param index
* The index of the requested frame of the animation.
* @return Returns a new VolatileImage with the requested frame.
*/
public VolatileImage getImage(final int index) {
this.setIndex(index);
final VolatileImage tmpImage = RenderToolkit.createVolatileImage(
this.width, this.height);
final Graphics2D g = (Graphics2D) tmpImage.getGraphics();
g.drawImage(this.image, 0, 0, this.width, this.height, this.rect.x,
this.rect.y, this.rect.x + this.width, this.rect.y
+ this.height, null);
if (this.filter != null) {
return RenderToolkit.convertSpriteToTransparentSprite(tmpImage,
this.filter);
}
return tmpImage;
}
public RGBImageFilter getFilter() {
return this.filter;
}
public void setFilter(final RGBImageFilter filter) {
this.filter = filter;
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
public int getCols() {
return this.cols;
}
public int getRows() {
return this.rows;
}
public Rectangle getRect() {
return this.rect;
}
public int getCurrentIndex() {
return this.currentIndex;
}
}
| [
"cschue88@googlemail.com"
] | cschue88@googlemail.com |
37d5530fd2f892501e50636724ea5030e2a414be | f13df3be13e9192134a4a2d1accaa469844266e9 | /src/LBJ2/nlp/coref/ForcePronounLink.java | ff5d3a72a178832f8ba889ac8c39a1eed42506c8 | [] | no_license | cos/evaluation-coref | 4e5eb6c1429419c03c642a1944b807c0a3864956 | e1e39477d4efc3e7e253c25c89ebed253f834d86 | refs/heads/master | 2021-01-19T07:49:42.654540 | 2012-06-15T16:28:44 | 2012-06-15T17:06:37 | 4,754,886 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,378 | java | // Modifying this comment will cause the next execution of LBJ2 to overwrite this file.
// F1B88000000000000000592914B43C040158FFAC4B7AD5A526FC985F2D22A011A0E5DBC29C447262BB2BBB1B2A8FFDD9963D4B01F0D093406FD7F66ED033583B12A734632CDB3F50EECB3BEA3B939D775B57547D22B25A68F10972C237A011E3C3E729BE2C31B84C5006D0617F71482D91C9CD94F4D0E21ABB6A9C0A27E1494762E7A556CFBB582390C83AD20384195C284A7F046D742BE309D6FDEF1DE37FE15470F4D2E915FF2A3FE56A953B5F5136FFCA869053BB8A205342C9D132A499F766557E145F84F4A86C9549CE325C495E0D285FF505D742983F086A45A398E277B74FB1318B604A92CCFD07E0F2730751A4DE41630635D40E3C5DC6892991DF4167A5666E7EA16D777E5DE0BC804FD28DC25859008F5CBDC03E3A9618CE8DDA16B62A9D83F859ABC36AD912FAAD5E92C9E34C88EB3CB8370E30AE569310EFEF002761B7D738300000
package LBJ2.nlp.coref;
import LBJ2.classify.*;
import LBJ2.infer.*;
import LBJ2.learn.*;
import LBJ2.parse.*;
import java.util.*;
public class ForcePronounLink extends ParameterizedConstraint
{
private static final DataCoref __DataCoref = new DataCoref();
public ForcePronounLink() { super("LBJ2.nlp.coref.ForcePronounLink"); }
public String getInputType() { return "LBJ2.nlp.coref.Document"; }
public String discreteValue(Object __example)
{
if (!(__example instanceof Document))
{
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Constraint 'ForcePronounLink(Document)' defined on line 56 of dataCoref.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
Document d = (Document) __example;
LinkedList previousMentions = new LinkedList();
Document.Mention previous = null;
for (int i = 0; i < d.sentences(); ++i)
{
for (int j = 0; j < d.mentionsInSentence(i); ++j)
{
Document.Mention current = d.getMention(i, j);
if (previous != null)
{
previousMentions = (LinkedList) previousMentions.clone();
previousMentions.add(previous);
}
{
boolean LBJ2$constraint$result$0;
{
boolean LBJ2$constraint$result$1;
{
boolean LBJ2$constraint$result$2;
{
boolean LBJ2$constraint$result$3;
{
boolean LBJ2$constraint$result$4;
{
boolean LBJ2$constraint$result$5;
{
boolean LBJ2$constraint$result$6;
{
boolean LBJ2$constraint$result$7;
{
boolean LBJ2$constraint$result$8;
LBJ2$constraint$result$8 = ("" + (current.getHead().toLowerCase())).equals("" + ("he"));
if (!LBJ2$constraint$result$8)
LBJ2$constraint$result$7 = ("" + (current.getHead().toLowerCase())).equals("" + ("him"));
else LBJ2$constraint$result$7 = true;
}
if (!LBJ2$constraint$result$7)
LBJ2$constraint$result$6 = ("" + (current.getHead().toLowerCase())).equals("" + ("himself"));
else LBJ2$constraint$result$6 = true;
}
if (!LBJ2$constraint$result$6)
LBJ2$constraint$result$5 = ("" + (current.getHead().toLowerCase())).equals("" + ("his"));
else LBJ2$constraint$result$5 = true;
}
if (!LBJ2$constraint$result$5)
LBJ2$constraint$result$4 = ("" + (current.getHead().toLowerCase())).equals("" + ("she"));
else LBJ2$constraint$result$4 = true;
}
if (!LBJ2$constraint$result$4)
LBJ2$constraint$result$3 = ("" + (current.getHead().toLowerCase())).equals("" + ("her"));
else LBJ2$constraint$result$3 = true;
}
if (!LBJ2$constraint$result$3)
LBJ2$constraint$result$2 = ("" + (current.getHead().toLowerCase())).equals("" + ("herself"));
else LBJ2$constraint$result$2 = true;
}
if (!LBJ2$constraint$result$2)
LBJ2$constraint$result$1 = ("" + (current.getHead().toLowerCase())).equals("" + ("hers"));
else LBJ2$constraint$result$1 = true;
}
if (LBJ2$constraint$result$1)
{
boolean LBJ2$constraint$result$9;
LBJ2$constraint$result$9 = !("" + (previousMentions.size())).equals("" + (0));
if (LBJ2$constraint$result$9)
{
LBJ2$constraint$result$0 = false;
for (java.util.Iterator __I0 = (previousMentions).iterator(); __I0.hasNext() && !LBJ2$constraint$result$0; )
{
Document.Mention m = (Document.Mention) __I0.next();
LBJ2$constraint$result$0 = ("" + (__DataCoref.discreteValue((Object) d.getMentionPair(m, current)))).equals("" + (true));
}
}
else LBJ2$constraint$result$0 = true;
}
else LBJ2$constraint$result$0 = true;
}
if (!LBJ2$constraint$result$0) return "false";
}
previous = current;
}
}
return "true";
}
public FeatureVector[] classify(Object[] examples)
{
for (int i = 0; i < examples.length; ++i)
if (!(examples[i] instanceof Document))
{
System.err.println("Classifier 'ForcePronounLink(Document)' defined on line 56 of dataCoref.lbj received '" + examples[i].getClass().getName() + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
return super.classify(examples);
}
public int hashCode() { return "ForcePronounLink".hashCode(); }
public boolean equals(Object o) { return o instanceof ForcePronounLink; }
public FirstOrderConstraint makeConstraint(Object __example)
{
if (!(__example instanceof Document))
{
String type = __example == null ? "null" : __example.getClass().getName();
System.err.println("Constraint 'ForcePronounLink(Document)' defined on line 56 of dataCoref.lbj received '" + type + "' as input.");
new Exception().printStackTrace();
System.exit(1);
}
Document d = (Document) __example;
FirstOrderConstraint __result = new FirstOrderConstant(true);
LinkedList previousMentions = new LinkedList();
Document.Mention previous = null;
for (int i = 0; i < d.sentences(); ++i)
{
for (int j = 0; j < d.mentionsInSentence(i); ++j)
{
Document.Mention current = d.getMention(i, j);
if (previous != null)
{
previousMentions = (LinkedList) previousMentions.clone();
previousMentions.add(previous);
}
{
Object[] LBJ$constraint$context = new Object[3];
LBJ$constraint$context[0] = d;
LBJ$constraint$context[1] = current;
LBJ$constraint$context[2] = previousMentions;
FirstOrderConstraint LBJ2$constraint$result$0 = null;
{
FirstOrderConstraint LBJ2$constraint$result$1 = null;
{
FirstOrderConstraint LBJ2$constraint$result$2 = null;
{
FirstOrderConstraint LBJ2$constraint$result$3 = null;
{
FirstOrderConstraint LBJ2$constraint$result$4 = null;
{
FirstOrderConstraint LBJ2$constraint$result$5 = null;
{
FirstOrderConstraint LBJ2$constraint$result$6 = null;
{
FirstOrderConstraint LBJ2$constraint$result$7 = null;
{
FirstOrderConstraint LBJ2$constraint$result$8 = null;
LBJ2$constraint$result$8 = new FirstOrderConstant(("" + (current.getHead().toLowerCase())).equals("" + ("he")));
FirstOrderConstraint LBJ2$constraint$result$9 = null;
LBJ2$constraint$result$9 = new FirstOrderConstant(("" + (current.getHead().toLowerCase())).equals("" + ("him")));
LBJ2$constraint$result$7 = new FirstOrderDisjunction(LBJ2$constraint$result$8, LBJ2$constraint$result$9);
}
FirstOrderConstraint LBJ2$constraint$result$10 = null;
LBJ2$constraint$result$10 = new FirstOrderConstant(("" + (current.getHead().toLowerCase())).equals("" + ("himself")));
LBJ2$constraint$result$6 = new FirstOrderDisjunction(LBJ2$constraint$result$7, LBJ2$constraint$result$10);
}
FirstOrderConstraint LBJ2$constraint$result$11 = null;
LBJ2$constraint$result$11 = new FirstOrderConstant(("" + (current.getHead().toLowerCase())).equals("" + ("his")));
LBJ2$constraint$result$5 = new FirstOrderDisjunction(LBJ2$constraint$result$6, LBJ2$constraint$result$11);
}
FirstOrderConstraint LBJ2$constraint$result$12 = null;
LBJ2$constraint$result$12 = new FirstOrderConstant(("" + (current.getHead().toLowerCase())).equals("" + ("she")));
LBJ2$constraint$result$4 = new FirstOrderDisjunction(LBJ2$constraint$result$5, LBJ2$constraint$result$12);
}
FirstOrderConstraint LBJ2$constraint$result$13 = null;
LBJ2$constraint$result$13 = new FirstOrderConstant(("" + (current.getHead().toLowerCase())).equals("" + ("her")));
LBJ2$constraint$result$3 = new FirstOrderDisjunction(LBJ2$constraint$result$4, LBJ2$constraint$result$13);
}
FirstOrderConstraint LBJ2$constraint$result$14 = null;
LBJ2$constraint$result$14 = new FirstOrderConstant(("" + (current.getHead().toLowerCase())).equals("" + ("herself")));
LBJ2$constraint$result$2 = new FirstOrderDisjunction(LBJ2$constraint$result$3, LBJ2$constraint$result$14);
}
FirstOrderConstraint LBJ2$constraint$result$15 = null;
LBJ2$constraint$result$15 = new FirstOrderConstant(("" + (current.getHead().toLowerCase())).equals("" + ("hers")));
LBJ2$constraint$result$1 = new FirstOrderDisjunction(LBJ2$constraint$result$2, LBJ2$constraint$result$15);
}
FirstOrderConstraint LBJ2$constraint$result$16 = null;
{
FirstOrderConstraint LBJ2$constraint$result$17 = null;
LBJ2$constraint$result$17 = new FirstOrderConstant(!("" + (previousMentions.size())).equals("" + (0)));
FirstOrderConstraint LBJ2$constraint$result$18 = null;
{
FirstOrderConstraint LBJ2$constraint$result$19 = null;
{
EqualityArgumentReplacer LBJ$EAR =
new EqualityArgumentReplacer(LBJ$constraint$context, true)
{
public Object getLeftObject()
{
Document d = (Document) context[0];
Document.Mention current = (Document.Mention) context[1];
Document.Mention m = (Document.Mention) quantificationVariables.get(0);
return d.getMentionPair(m, current);
}
};
LBJ2$constraint$result$19 = new FirstOrderEqualityWithValue(true, new FirstOrderVariable(__DataCoref, null), "" + (true), LBJ$EAR);
}
LBJ2$constraint$result$18 = new ExistentialQuantifier("m", previousMentions, LBJ2$constraint$result$19);
}
LBJ2$constraint$result$16 = new FirstOrderImplication(LBJ2$constraint$result$17, LBJ2$constraint$result$18);
}
LBJ2$constraint$result$0 = new FirstOrderImplication(LBJ2$constraint$result$1, LBJ2$constraint$result$16);
}
__result = new FirstOrderConjunction(__result, LBJ2$constraint$result$0);
}
previous = current;
}
}
return __result;
}
}
| [
"cosmin.radoi@gmail.com"
] | cosmin.radoi@gmail.com |
a11b291ec0c1ffddcdf0e22f418dee143c02827d | 3013a056f27c6b844c02ec53f3572e43953596cc | /cashMachine/src/main/java/controller/command/highCashier/CancelCheck.java | 4576d434aa3803bd8cbf76f2fb71c5f9d1a88ab5 | [] | no_license | potOfMyCode/finalProject | f551f79da8c6af9998c69aaf1a9c27fe9487ba15 | 21599c482c7dae92b1b6bdce196595c19e1d6f97 | refs/heads/master | 2020-05-16T07:16:22.438990 | 2019-04-23T06:49:20 | 2019-04-23T06:49:20 | 182,806,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package controller.command.highCashier;
import controller.command.Command;
import model.service.highCashierService.HighCashierService;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
public class CancelCheck implements Command {
private final static Logger LOGGER = Logger.getLogger(CancelCheck.class.getSimpleName());
private HighCashierService highCashierService;
public CancelCheck(HighCashierService highCashierService) {
this.highCashierService = highCashierService;
}
@Override
public String execute(HttpServletRequest request) {
String id = request.getParameter("idCheck");
highCashierService.cancelCheck(Integer.valueOf(id));
LOGGER.info("Check with id: " + id + " successfully deleted!");
request.getServletContext().setAttribute("checks", highCashierService.getAllChecks());
return "/WEB-INF/highCashier/highCashierBase.jsp";
}
}
| [
"demyanenko.dimasik@gmail.com"
] | demyanenko.dimasik@gmail.com |
bb30786c000a3fb73215414c2a72793b5711d5fc | ae2edb8565cc9753989c46e5b16ec620568c2dde | /app/src/main/java/cn/deepkolos/simplemusic3/Widget/Layout/ClipFrameLayout.java | a3acd746dd47419fd099b9ee5553df835e250fc1 | [] | no_license | glucin/mymusic | b9ba99f83d086e5fb0fe98c8bd77f1f15aca2d12 | 807e8fa391c13200846ed2bc1d37f9563aebce5d | refs/heads/master | 2020-04-17T15:00:05.336400 | 2019-01-20T16:05:44 | 2019-01-20T16:05:44 | 166,681,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,788 | java | package cn.deepkolos.simplemusic3.Widget.Layout;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import cn.deepkolos.simplemusic3.R;
import cn.deepkolos.simplemusic3.Utils.UnitHelper;
public class ClipFrameLayout extends FrameLayout {
private int topLeftRadius = 0;
private int topRightRadius = 0;
private int bottomLeftRadius = 0;
private int bottomRightRadius = 0;
private Path path = new Path();
private RectF topLeftRect = new RectF();
private RectF topRightRect = new RectF();
private RectF bottomLeftRect = new RectF();
private RectF bottomRightRect = new RectF();
private int insetTop = 0;
private int insetLeft = 0;
private int insetRight = 0;
private int insetBottom = 0;
Paint paint = new Paint();
public ClipFrameLayout(Context context) {
super(context);
init();
}
public ClipFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ClipLayoutAttrs);
int radius = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_radius, -1);
if (radius != -1) {
topLeftRadius = radius;
topRightRadius = radius;
bottomLeftRadius = radius;
bottomRightRadius = radius;
}
int _topLeftRadius = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_topLeftRadius, -1);
if (_topLeftRadius != -1) topLeftRadius = _topLeftRadius;
int _topRightRadius = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_topRightRadius, -1);
if (_topRightRadius != -1) topRightRadius = _topRightRadius;
int _bottomRightRadius = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_bottomRightRadius, -1);
if (_bottomRightRadius != -1) bottomRightRadius = _bottomRightRadius;
int _bottomLeftRadius = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_bottomLeftRadius, -1);
if (_bottomLeftRadius != -1) topRightRadius = _bottomLeftRadius;
int _inset = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_inset, -1);
if (_inset != -1) {
insetTop = _inset;
insetLeft = _inset;
insetRight = _inset;
insetBottom = _inset;
}
int _insetTop = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_topInset, -1);
if (_insetTop != -1) insetTop = _insetTop;
int _insetBottom = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_bottomInset, -1);
if (_insetBottom != -1) insetBottom = _insetBottom;
int _insetLeft = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_leftInset, -1);
if (_insetLeft != -1) insetLeft = _insetLeft;
int _insetRight = ta.getDimensionPixelOffset(R.styleable.ClipLayoutAttrs_rightInset, -1);
if (_insetRight != -1) insetRight = _insetRight;
ta.recycle();
init();
}
private void init() {
setWillNotDraw(false);
}
public void setRadius (int all) {
topLeftRadius = all;
topRightRadius = all;
bottomLeftRadius = all;
bottomRightRadius = all;
postInvalidate();
}
public void setRadius (int topLeft, int topRight, int bottomLeft, int bottomRight) {
topLeftRadius = topLeft;
topRightRadius = topRight;
bottomLeftRadius = bottomLeft;
bottomRightRadius = bottomRight;
postInvalidate();
}
public void setInset (int all) {
insetTop = all;
insetLeft = all;
insetRight = all;
insetBottom = all;
postInvalidate();
}
public void setInset (int left, int top, int right, int bottom) {
insetTop = top;
insetLeft = left;
insetRight = right;
insetBottom = bottom;
postInvalidate();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// init arc rect
int height = getHeight();
int width = getWidth();
topLeftRect.set(insetLeft, insetTop, topLeftRadius*2 + insetLeft, topLeftRadius*2 + insetTop);
topRightRect.set(width - (topRightRadius*2 + insetRight), insetTop, width - insetRight, topRightRadius*2+insetTop);
bottomLeftRect.set(insetLeft, height - (bottomLeftRadius*2 + insetBottom), bottomLeftRadius*2 + insetLeft, height - insetBottom);
bottomRightRect.set(width - (bottomRightRadius*2 + insetRight), height - (bottomRightRadius*2 + insetBottom), width - insetRight, height - insetBottom);
// draw clip-path
path.moveTo(insetLeft, topLeftRadius+insetTop);
path.arcTo(topLeftRect, 180, 90, false);
path.lineTo(width - (topRightRadius + insetRight),insetTop);
path.arcTo(topRightRect, 270, 90, false);
path.lineTo(width - insetRight, height - (bottomRightRadius + insetBottom));
path.arcTo(bottomRightRect, 0, 90, false);
path.lineTo(bottomLeftRadius+insetLeft, height - insetBottom);
path.arcTo(bottomLeftRect, 90, 90, false);
path.lineTo(insetLeft, topLeftRadius+insetTop);
path.close();
paint.setColor(Color.BLACK);
paint.setStrokeWidth(UnitHelper.dpToPx(2));
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
canvas.clipPath(path);
}
}
| [
"ghm_1996@163.com"
] | ghm_1996@163.com |
314cc6a976b54d9ffc5241e9a8a0678a9b065801 | eca650e80b3ff57d6dd8aa2c911b729de466d001 | /KruskalsMSF/src/KruskalsMSF.java | 7ce1c10ed1a4d26145712275e77d7b96b2638214 | [] | no_license | yjean0624/CSE2221-2231 | 9bfc9451889128ca49fa37b33957774554a00f98 | 3d8172f436dd4d2455dbb932e0a3ab2a167ef374 | refs/heads/master | 2020-12-10T08:00:41.855456 | 2020-01-13T07:59:55 | 2020-01-13T07:59:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,421 | java | import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;
public class KruskalsMSF {
/**
* Edge class.
*
* @author Xingyue Zhao
*
*/
static class Edge {
int source;
int destination;
int weight;
public Edge(int source, int destination, int weight) {
this.source = source;
this.destination = destination;
this.weight = weight;
}
}
static class Graph {
int vertices;
ArrayList<Edge> edges = new ArrayList<>();
Graph(int vertices) {
this.vertices = vertices;
}
public void addE(int source, int destination, int weight) {
Edge temp = new Edge(source, destination, weight);
this.edges.add(temp);
}
public void kruskalMST() {
PriorityQueue<Edge> pq = new PriorityQueue<>(this.edges.size(),
Comparator.comparingInt(o -> o.weight));
for (int i = 0; i < this.edges.size(); i++) {
Edge temp = this.edges.get(i);
pq.add(temp);
}
int[] parent = this.makeSet(this.vertices);
ArrayList<Edge> mst = new ArrayList<>();
int temp = 0;
while (temp < this.vertices - 1) {
Edge e = pq.remove();
if (this.find(parent, e.source) != this.find(parent,
e.destination)) {
mst.add(e);
temp++;
this.union(parent, this.find(parent, e.source),
this.find(parent, e.destination));
}
}
for (int i = 0; i < mst.size(); i++) {
Edge e = mst.get(i);
System.out.println(
e.source + "," + e.destination + ":" + e.weight);
}
}
public int[] makeSet(int parent) {
int[] temp = new int[parent];
for (int i = 0; i < temp.length; i++) {
temp[i] = i;
}
return temp;
}
public int find(int[] parent, int vertex) {
int temp = vertex;
if (parent[vertex] != vertex) {
temp = this.find(parent, parent[vertex]);
}
return temp;
}
public void union(int[] parent, int x, int y) {
parent[this.find(parent, y)] = this.find(parent, x);
}
}
public static void main(String[] args) throws IOException {
File graphX = new File(
"C:\\Users\\yjean\\Desktop\\sampleGraphs\\10-20.txt");
Scanner graphXfile = new Scanner(graphX);
int number = Integer.parseInt(graphXfile.nextLine());
Graph graph = new Graph(number);
while (graphXfile.hasNextLine()) {
String temp = graphXfile.nextLine();
int source = Integer.parseInt(temp.substring(0, temp.indexOf(',')));
int destination = Integer.parseInt(
temp.substring(temp.indexOf(',') + 1, temp.indexOf(':')));
int weight = Integer
.parseInt(temp.substring(temp.indexOf(':') + 1));
graph.addE(source, destination, weight);
}
graph.kruskalMST();
}
}
| [
"zhao.2014@buckeyemail.osu.edu"
] | zhao.2014@buckeyemail.osu.edu |
d8f89ce67dc264d86c9dc4a1b946101404b0f0e1 | 6493557dc38baa34293cf9a1500246a568cc8d99 | /src/main/java/sunny/util/CharArrayCompares.java | dd2df7ce0d2b9b83a2a5dd8d360000fe9b291688 | [] | no_license | stlin100/jarraypool | 5236409ecba1bc87d175b1ac12a99a03695ac7ba | bd5473c52c837b6b7794ac83174ad19256024982 | refs/heads/master | 2021-09-14T16:38:45.820040 | 2018-04-09T12:35:11 | 2018-04-09T12:35:11 | 103,514,333 | 0 | 0 | null | 2018-05-16T07:29:35 | 2017-09-14T09:34:56 | Java | UTF-8 | Java | false | false | 1,653 | java | package sunny.util;
import sunny.arraylist.CharArray;
/**
* Created by lzx on 17/9/18.
*/
public class CharArrayCompares {
public static int compare(char[] chars1, int len1, char[] chars2, int len2)
{
int lim = Math.min(len1, len2);
int k = 0;
while (k < lim) {
char c1 = chars1[k];
char c2 = chars2[k];
if (c1 != c2) {
return c1 - c2;
}
k++;
}
return len1 - len2;
}
public static int compare(CharArray chars1, int len1, char[] chars2, int len2)
{
int lim = Math.min(len1, len2);
int k = 0;
while (k < lim) {
char c1 = chars1.get(k);
char c2 = chars2[k];
if (c1 != c2) {
return c1 - c2;
}
k++;
}
return len1 - len2;
}
public static int compare(char[] chars1, int len1, CharArray chars2, int len2)
{
int lim = Math.min(len1, len2);
int k = 0;
while (k < lim) {
char c1 = chars1[k];
char c2 = chars2.get(k);
if (c1 != c2) {
return c1 - c2;
}
k++;
}
return len1 - len2;
}
public static int compare(CharArray chars1, int len1, CharArray chars2, int len2)
{
int lim = Math.min(len1, len2);
int k = 0;
while (k < lim) {
char c1 = chars1.get(k);
char c2 = chars2.get(k);
if (c1 != c2) {
return c1 - c2;
}
k++;
}
return len1 - len2;
}
}
| [
"3908282@qq.com"
] | 3908282@qq.com |
5295403a1d98130a9141c525e969990995ae3779 | e7bc73cdfaef9307790c59f5fbefa5669cd665fe | /hw3/hw3sol/SortedComparableListLauncher.java | e417123d8ada11cdc89e35f49c33d70b69aa93cb | [] | no_license | amyncarol/CS61B | e39e378f5d2e9f2ada3ae4e5e5ba774338b484b9 | b4397304b28d4f432a827244c5468db664794293 | refs/heads/master | 2020-03-09T23:09:09.813750 | 2015-05-04T07:33:05 | 2015-05-04T07:33:05 | 129,052,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 283 | java | public class SortedComparableListLauncher{
public static void main(String[] args){
SortedComparableList L = new SortedComparableList();
L.insert(-1);
L.insert(2);
L.insert(3);
L.insert(3);
L.insert(-1);
L.insert(1.5);
System.out.println(L.toString());
}
} | [
"yao@yaos-MacBook-Pro.local"
] | yao@yaos-MacBook-Pro.local |
fb45717cb5b2ef0b6cd66e8146165c143ce9c707 | 6ee714a678762d4562bc481586c5953e61b34cb0 | /src/main/java/com/sjsu/cmpe/sstreet/webserver/utils/SensorDataByClusterQuery.java | 1b6dd9f6ee3b34ca154ce34ce854ddcafbf973ce | [] | no_license | aliaksei-matsarski/web-server | b38c6d5a8ce37636e45b72e656f92757a53789b7 | f7b47a9caf092b7afd4911486933143d64c9fedc | refs/heads/master | 2020-04-03T18:10:23.982992 | 2018-12-09T04:25:01 | 2018-12-09T04:25:01 | 155,473,686 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package com.sjsu.cmpe.sstreet.webserver.utils;
import com.sjsu.cmpe.sstreet.webserver.model.SensorType;
public class SensorDataByClusterQuery extends SensorDataSearchQuery {
private Integer clusterId;
public SensorDataByClusterQuery(){
super();
}
public SensorDataByClusterQuery(Integer clusterId) {
super();
this.clusterId = clusterId;
}
public SensorDataByClusterQuery(
Integer maxResult,
String continuation,
Integer clusterId
) {
super(maxResult, continuation);
this.clusterId = clusterId;
}
public Integer getClusterId() {
return clusterId;
}
public void setClusterId(Integer clusterId) {
this.clusterId = clusterId;
}
}
| [
"aliaksei.matsarski@sjsu.edu"
] | aliaksei.matsarski@sjsu.edu |
6690fed2885931ea6f356056fbfa6ed7cd5aa688 | ee4f9ef8ee8affb4b5bca6a99e3334673f4f8a1c | /app/src/main/java/com/example/travel_helper/Screen/checkListScreen/DTO/ToDo.java | 91caec37d9c8d61992fc8586bc263fbf0887f661 | [] | no_license | thaycacac/trumina | ba569dc88afb7a75954a058318bca4dc429773b2 | ff206f152ddcd262f0e83f0ae93615c99925a0a7 | refs/heads/master | 2020-11-24T11:54:04.704513 | 2019-12-30T02:30:23 | 2019-12-30T02:30:23 | 228,131,407 | 3 | 1 | null | 2020-08-09T04:07:56 | 2019-12-15T05:04:46 | Java | UTF-8 | Java | false | false | 715 | java | package com.example.travel_helper.Screen.checkListScreen.DTO;
import java.util.ArrayList;
import java.util.List;
public class ToDo {
private long id = -1;
private String name = "";
private String createdAt = "";
private List items = (List)(new ArrayList());
public final long getId() {
return this.id;
}
public final void setId(long var1) {
this.id = var1;
}
public final String getName() {
return this.name;
}
public final void setName( String name) {
this.name = name;
}
public final List getItems() {
return this.items;
}
public final void setItems( List items) {
this.items = items;
}
}
| [
"thaycacac@gmail.com"
] | thaycacac@gmail.com |
17f4cb0d3b01f006f022679c46b44d786932e0b9 | a8a556ba82bc3b1793ee4df924d78e2e4563d782 | /StrategePattern/src/Cat.java | 6ba24e31de5f78b6dfe91e4ffa8f854a3a4624b9 | [] | no_license | icarus8050/DesignPattern-Practice | 0b7eb8236dc16306a668b81d2c2cae581b0cdb63 | ea7fa2bd2ac002af0343336b52696baa99bafb9f | refs/heads/master | 2020-05-03T00:55:42.631969 | 2019-05-04T08:53:03 | 2019-05-04T08:53:03 | 178,323,480 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 242 | java |
public class Cat extends Animal {
@Override
public void cry() {
// TODO Auto-generated method stub
System.out.println("Meow");
}
@Override
public void movePerform() {
// TODO Auto-generated method stub
getMove().move();
}
}
| [
"icarus8050@naver.com"
] | icarus8050@naver.com |
02471166484f56f585b5f5c136b8825af43c0151 | fdf78937830eec352c16a0b5b725936ac2be27e3 | /mall-02/src/main/java/com/ceshi/controller/FrontDeskIndexController.java | aee52978ff4652c451a039577c6ff8818e8a6fce | [] | no_license | Hi-jing/cart | 765857b5dff94ddf5dc9de9e85bc685fc5494ec2 | ff53cd218eef6ea049f69cc1d142b0c17cf311df | refs/heads/master | 2021-06-24T07:02:26.471653 | 2017-09-13T14:34:45 | 2017-09-13T14:34:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,412 | java | package com.ceshi.controller;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import com.ceshi.bean.Go_evaluate;
import com.ceshi.bean.Go_pictureWithBLOBs;
import com.ceshi.bean.Good;
import com.ceshi.bean.Good_searchrecord;
import com.ceshi.bean.Me_address;
import com.ceshi.bean.Member;
import com.ceshi.bean.Msg;
import com.ceshi.bean.Myorder;
import com.ceshi.service.FrontDeskIndexService;
/**
* 处理前台移动端index页面的数据
*
* @author dhj
*
*/
@Controller
public class FrontDeskIndexController {
@Autowired
FrontDeskIndexService frontDeskIndexService;
/**
* 对移动端index页面的轮播图片查询
*
* @return
*/
@RequestMapping("/frontDesk/index/lb")
@ResponseBody
public Msg getIndexInfoLb(HttpSession session) {
List<Go_pictureWithBLOBs> go_pictureWithBLOBsList = frontDeskIndexService.getPi_lb();
return Msg.success().add("picbyte", go_pictureWithBLOBsList);
}
/**
* 对移动端index页面的特价商品查询
*
* @return
*/
@RequestMapping("/frontDesk/index/specialPrice")
@ResponseBody
public Msg getIndexInfoSpecialPrice() {
List<Integer> specialPriceGoodId = frontDeskIndexService.getSpecialPrice();
List<Integer> lbGoodId = frontDeskIndexService.getLbGoodId();
for (int i = 0; i < lbGoodId.size(); i++) {
for (int j = 0; j < specialPriceGoodId.size(); j++) {
if (lbGoodId.get(i).equals(specialPriceGoodId.get(j))) {
specialPriceGoodId.remove(j);
}
}
}
List<Good> gList = frontDeskIndexService.getSpecialPriceGood(specialPriceGoodId.get(0),
specialPriceGoodId.get(1), specialPriceGoodId.get(2));
return Msg.success().add("gList", gList);
}
/**
* 对移动端index页面的热销商品查询
*
* @return
*/
@RequestMapping("/frontDesk/index/HotSellGood")
@ResponseBody
public Msg getIndexInfoHotSellGood() {
List<Good> gList = frontDeskIndexService.getHotSellGood();
return Msg.success().add("gList", gList);
}
/**
* 对移动端index页面的服装商品查询
*
* @return
*/
@RequestMapping("/frontDesk/index/clothing")
@ResponseBody
public Msg getIndexInfoClothing() {
List<Good> gList = frontDeskIndexService.getClothing();
return Msg.success().add("gList", gList);
}
/**
* 对移动端index页面的手机数码商品查询
*
* @return
*/
@RequestMapping("/frontDesk/index/mobiles")
@ResponseBody
public Msg getIndexInfoMobiles() {
List<Good> gList = frontDeskIndexService.getMobiles();
return Msg.success().add("gList", gList);
}
/**
* 对移动端index页面的搜索内容进行保存
*
* @return
*/
@RequestMapping("/frontDesk/index/search")
@ResponseBody
public Msg searchSave(@RequestParam("se_val") String seval) {
boolean b = frontDeskIndexService.searchSave(seval);
if (b) {
return Msg.success().add("msg", "保存成功");
}else {
return Msg.fail().add("msg", "保存失败");
}
}
/**
* 对移动端index页面的搜索内容进行查询
*
* @return
*/
@RequestMapping("/frontDesk/index/searchText/check")
@ResponseBody
public Msg checkSearchText() {
List<Good_searchrecord> list = frontDeskIndexService.checkSearchText();
return Msg.success().add("list", list);
}
/**
* 对移动端index页面的搜索内容进行删除
*
* @return
*/
@RequestMapping("/frontDesk/index/searchText/delete")
@ResponseBody
public Msg deleteSearchText() {
boolean b = frontDeskIndexService.deleteSearchText();
if (b) {
return Msg.success().add("msg", "删除成功");
}else {
return Msg.fail().add("msg", "删除失败");
}
}
/**
* 对移动端index页面的搜索后的商品
*
* @return
*/
@RequestMapping("/frontDesk/index/good/search")
@ResponseBody
public Msg searchGood(@RequestParam("search_text") String text) {
String textStrings = text.trim();
String[] strings = new String[textStrings.length()];
for (int i = 0; i < textStrings.length(); i++) {
strings[i] = textStrings.substring(i, i+1);
}
List<Good> list = frontDeskIndexService.searchGood(strings);
return Msg.success().add("list", list);
}
/**
* 对移动端商品详情查询(不包含商品评价)
*
* @return
*/
@RequestMapping("/frontDesk/index/good/details")
@ResponseBody
public Msg goodDetails(@RequestParam("goodid") int goodid) {
Good good = frontDeskIndexService.goodDetails(goodid);
return Msg.success().add("good", good);
}
/**
* 对移动端商品详情查询(包含商品评价)
*
* @return
*/
@RequestMapping("/frontDesk/index/good/evaluate")
@ResponseBody
public Msg getEvaluate(@RequestParam("goodid") int goodid) {
List<Go_evaluate> gEvaluate = frontDeskIndexService.getEvaluate(goodid);
return Msg.success().add("gEvaluate", gEvaluate);
}
/**
* 确认订单得到我的默认地址
* @return
*/
@RequestMapping("/frontDesk/index/good/affirm-order")
@ResponseBody
public Msg affirmOrder(HttpSession session) {
//1、得到该会员 的默认收货地址
//2、根据goodid获得商品信息(页面跳转传值 :缩略图,商品名称,规格名称,数量,现价)
String name = "";
name = (String) session.getAttribute("username");
if (name!=null&&!name.equals("")) {
Me_address me_address = frontDeskIndexService.affirmOrder(name);
return Msg.success().add("me_address", me_address);
}else {
return Msg.fail().add("msg", "没有登录!");
}
}
/**
* 确认订单付款
* @return
*/
@RequestMapping("/frontDesk/index/good/affirm-order/pay")
@ResponseBody
public Msg affirmPay(HttpSession session,@RequestParam("goodid") int goodid,
@RequestParam("kindid") int kindid,
@RequestParam("buysum") int buysum,
@RequestParam("addressid") int addressid,
@RequestParam("leavemsg") String leavemsg,
@RequestParam("price") Double price) {
//收货地址由页面中获取
String name = "";
name = (String) session.getAttribute("username");
if (name!=null&&!name.equals("")) {
boolean b = frontDeskIndexService.affirmPay(name,goodid,kindid,buysum,addressid,leavemsg);
if (b) {
frontDeskIndexService.reduceMoney(name,price);
return Msg.success().add("msg", "付款成功");
}else {
return Msg.fail().add("msg", "付款失败");
}
}else {
return Msg.fail().add("msg", "没有登录!");
}
}
/**
* 个人信息资料查看
* @return
*/
@RequestMapping("/frontDesk/personal/personal-date")
@ResponseBody
public Msg getPersonalData(HttpSession session) {
String name = "";
name = (String) session.getAttribute("username");
if (name!=null&&!name.equals("")) {
Member member = frontDeskIndexService.getPersonalData(name);
return Msg.success().add("member", member);
}else {
return Msg.fail().add("msg", "没有登录!");
}
}
/**
* 个人信息资料查看
* @return
*/
@RequestMapping("/frontDesk/personal/membercard/trade-record")
@ResponseBody
public Msg getRecord(HttpSession session) {
String name = "";
name = (String) session.getAttribute("username");
if (name!=null&&!name.equals("")) {
List<Myorder> myorder = frontDeskIndexService.getRecord(name);
return Msg.success().add("myorder", myorder);
}else {
return Msg.fail().add("msg", "没有登录!");
}
}
/**
* 个人信息资料查看
* @return
*/
@RequestMapping("/frontDesk/personal/membercard/isExist")
@ResponseBody
public Msg isExist(HttpSession session) {
String name = "";
name = (String) session.getAttribute("username");
if (name!=null&&!name.equals("")) {
boolean b = frontDeskIndexService.isExist(name);
if (b) {
return Msg.success().add("msg", "会员卡存在");
}else {
return Msg.fail().add("msg", "会员卡不存在");
}
}else {
return Msg.fail().add("msg", "没有登录!");
}
}
/**
*用户注销
* @return
*/
@RequestMapping("/frontDesk/personal/cancel")
@ResponseBody
public Msg cancel(HttpSession session) {
String name = "";
name = (String) session.getAttribute("username");
if (name!=null&&!name.equals("")) {
session.removeAttribute("username");
return Msg.success().add("msg", "注销成功");
}else {
return Msg.fail().add("msg", "没有登录!");
}
}
/**
*用户反馈信息
* @return
*/
@RequestMapping("/frontDesk/personal/feedback/information")
@ResponseBody
public Msg feedbackInformation(@RequestParam("title") String title,
@RequestParam("content") String content, HttpSession session) {
String name = "";
name = (String) session.getAttribute("username");
if (name!=null&&!name.equals("")) {
boolean b = frontDeskIndexService.feedbackInformation(title,content,name);
if (b) {
return Msg.success().add("msg", "反馈成功");
}else
{
return Msg.fail().add("msg", "反馈失败");
}
}else {
return Msg.fail().add("msg", "没有登录!");
}
}
/**
*用户反馈信息
* @return
*/
@RequestMapping("/frontDesk/personal/password/edit")
@ResponseBody
public Msg passwordEdit(@RequestParam("password") String password,HttpSession session) {
String name = "";
name = (String) session.getAttribute("username");
if (name!=null&&!name.equals("")) {
boolean b = frontDeskIndexService.passwordEdit(password,name);
if (b) {
return Msg.success().add("msg", "更改成功");
}else
{
return Msg.fail().add("msg", "更改失败");
}
}else {
return Msg.fail().add("msg", "没有登录!");
}
}
}
| [
"Administrator@USER-20160908WE"
] | Administrator@USER-20160908WE |
9277f282aa58c36d78e2724f37e3fde6382478f0 | 0cdf3e16b686a36eb2da820b821ba69f66e98868 | /Android/013. Google Translator/gen/buet/rafi/google_translator/R.java | 9efa50e2a10e0ca022d7454d7c4dfe72d229f71b | [] | no_license | ash018/AndroidClass | 62358443c9df7f9f437752995c53ee7bb03e254e | 0d5888c181e51900a27d42700d2c81e4b8f51e49 | refs/heads/master | 2020-04-20T07:34:54.205860 | 2019-03-02T08:02:14 | 2019-03-02T08:02:14 | 168,714,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,461 | 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 buet.rafi.google_translator;
public final class R {
public static final class array {
public static final int languages=0x7f040000;
}
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int ScrollView1=0x7f060000;
public static final int from_language=0x7f060002;
public static final int original_text=0x7f060001;
public static final int retranslated_text=0x7f060005;
public static final int to_language=0x7f060003;
public static final int translated_text=0x7f060004;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f050000;
public static final int back_text=0x7f050004;
public static final int empty=0x7f050005;
public static final int from_text=0x7f050001;
public static final int original_text_hint=0x7f050002;
public static final int to_text=0x7f050003;
public static final int translate_error=0x7f050007;
public static final int translating=0x7f050006;
}
}
| [
"sadatakash018@gmail.com"
] | sadatakash018@gmail.com |
d63e5438c27a0eddb0dfa90e3b05d227814f0b93 | a7ad9e086a49d3bca1726e09a962cd69d0e2a0c6 | /src/main/java/com/example/demo/exceptions/AccountDoesNotExistException.java | 6f37a7d0808e1383177e3a099a9bac2f6192bb98 | [] | no_license | EkoGroszek/RestApiTest | 22f4193820aaa25570e132a6acc213610c2632f1 | 3b45f092c3aa1df7abd1b2d3cfdc39b0fb2c456a | refs/heads/master | 2020-06-15T21:46:04.157911 | 2019-07-30T09:58:04 | 2019-07-30T09:58:04 | 195,400,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.example.demo.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.NOT_FOUND)
public class AccountDoesNotExistException extends RuntimeException {
public AccountDoesNotExistException(String message) {
super(message);
}
}
| [
"jachimczak3125@gmail.com"
] | jachimczak3125@gmail.com |
84d9c80cd9238b271d26e79c91bc3e0c4d94b3d6 | 99db30cac9ad89c8fc8ffefa819135cebb01d7b1 | /GluePS/src/org/coppercore/component/IntegerProperty.java | 9613a55d6e4d21a5ffaf2dae3cf719817ea74ded | [] | no_license | METIS-Project/ILDE | b4bbf52c39fae24b7dafda7f0c3684cb3901f201 | f6e87f7f08dbe251a26ac78302bc30288142a9dd | refs/heads/master | 2021-01-01T16:30:40.596086 | 2015-02-06T16:45:17 | 2015-02-06T16:45:17 | 7,796,946 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,080 | java | /*
* CopperCore, an IMS-LD level C engine
* Copyright (C) 2003 Harrie Martens and Hubert Vogten
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (/license.txt); if not,
* write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Contact information:
* Open University of the Netherlands
* Valkenburgerweg 177 Heerlen
* PO Box 2960 6401 DL Heerlen
* e-mail: hubert.vogten@ou.nl or
* harrie.martens@ou.nl
*
*
* Open Universiteit Nederland, hereby disclaims all copyright interest
* in the program CopperCore written by
* Harrie Martens and Hubert Vogten
*
* prof.dr. Rob Koper,
* director of learning technologies research and development
*
*/
package org.coppercore.component;
import org.coppercore.business.Run;
import org.coppercore.business.Uol;
import org.coppercore.business.User;
import org.coppercore.datatypes.LDDataType;
import org.coppercore.datatypes.LDInteger;
import org.coppercore.exceptions.PropertyException;
import org.coppercore.exceptions.TypeCastException;
/**
* This Property represents an IMS LD integer Property. It extends
* ExplicitProperty adding type cast and restriction checking to the standard
* Property mechanism.
*
* @author Harrie Martens
* @author Hubert Vogten
* @version $Revision: 1.16 $, $Date: 2005/01/19 16:31:27 $
*/
public class IntegerProperty extends ExplicitProperty {
private static final long serialVersionUID = 42L;
/**
* Default constructor during run time.
*
* @param uol Uol the Uol in which this Property was declared
* @param run Run the Run in which this Property was referenced
* @param user User the User referring to this Property
* @param propId String the identifier of this Property as defined in the IMS
* LD instance
* @throws PropertyException when the constructor fails to create this
* Property
* @throws TypeCastException when the stored value can not be type casted to
* the type of the Property. This may occur especially after republication
* of the IMS LD instance.
*/
public IntegerProperty(Uol uol, Run run, User user, String propId) throws
PropertyException, TypeCastException {
super(uol, run, user, propId);
}
/**
* Returns the corresponding PropertyDefinition belonging to this component.
*
* @throws PropertyException when this operation fails
* @return PropertyDef the PropertyDefinition for this component
*/
protected PropertyDef findPropertyDef() throws
PropertyException {
return new IntegerPropertyDef(uolId, propId);
}
/**
* Creates the LDDataType object corresponding with the object and its String
* value.
*
* @param aValue String the value of this object
* @throws TypeCastException when the passed value can not be converted to
* the required LDDataType
* @return LDDataType the LDDataType object representing the value
*/
protected LDDataType createPropertyValue(String aValue) throws
TypeCastException {
LDInteger result = null;
if (aValue != null) {
result = new LDInteger(aValue);
}
return result;
}
/**
* Returns the passed value in the correct LDDataType by casting it.
*
* @param aValue LDDataType the value to be type casted
* @throws TypeCastException if type cast fails
* @return LDDataType the type casted value
*/
public LDDataType typeCast(LDDataType aValue) throws TypeCastException {
return aValue.toLDInteger();
}
}
| [
"javierht@gmail.com"
] | javierht@gmail.com |
a7635e472378225ddc300ef005d06f777869bf5c | 50beb0622db9d8957d82c9b89530dbd187543a01 | /livestore/src/utils/DaoFactory.java | eb2a5dc21594115e5a0862c850a11d6659a57c42 | [] | no_license | ruochenxu92/Personal-practice | 6576fb299327f6617a2c46f2c408e7a719caf6a9 | a8996563adaf6ef57414c311b3b9561c284fbaae | refs/heads/master | 2021-05-28T10:24:15.404025 | 2014-07-09T05:06:24 | 2014-07-09T05:06:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package utils;
public class DaoFactory {
private static final DaoFactory factory = new DaoFactory();
private DaoFactory(){}
public static DaoFactory getInstance(){
return factory;
}
public <T> T createDao(String className,Class<T> clazz){
try {
T t = (T) Class.forName(className).newInstance();
return t;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
| [
"xxu46@illinois.edu"
] | xxu46@illinois.edu |
193a61ede9c2d7ce32319743f508b4cdc3a0c2fc | 2fbd0602154935914fa4d6c45f6b10d42093c2bc | /src/models/Main.java | 04e9c34c5ee406d2f0751f568a99d39d0be47cfc | [] | no_license | nilsma/jobApplicationTracker | c2619f0c2d9d6e01ae7bb2e34cf17790dde45eb2 | 56af7f74e157ef3f547471f5599bfdd6ce2cd0c2 | refs/heads/master | 2021-01-02T09:20:24.216400 | 2014-01-31T11:47:47 | 2014-01-31T12:11:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package models;
import controllers.ApplicationController;
public class Main {
/**
* Launches the job application tracker, which is a an application to
* keep track of where one has applied for a job
* @param args
*/
@SuppressWarnings("unused")
public static void main(String[] args) {
ApplicationController application = new ApplicationController();
}
}
| [
"nilsma231@gmail.com"
] | nilsma231@gmail.com |
4412c2d031fbdae955357f3e05eecf8daca9eec8 | 6e69f74c34a3b3aedd323b2d78d796890ef9a8fd | /src/parseotglist/ParseOtgList.java | a31fa57624b2598c0c90ee7823a8a830c5e420d9 | [] | no_license | spidchenko/ParseOtgList | 8bc2f1615ad2d7dfb9dbdd1c78709d656e8d71e9 | 1903f100c3a60d83c7475e78b20a8cfb56455f90 | refs/heads/master | 2020-04-18T07:10:15.661690 | 2019-01-24T10:49:37 | 2019-01-24T10:49:37 | 167,351,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,735 | 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 parseotglist;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
/**
*
* @author spidchenko.d
*/
public class ParseOtgList {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
updateOTGDatabase("0552");
ubdateVillagesAndTgDatabase();
// Parser parser = new Parser("http://decentralization.gov.ua/areas/0552/gromadu");
// parser.setEncoding("UTF-8");
//
// NodeList nodeList = parser.parse(new HasAttributeFilter("title","Назва громади"));
//
// System.out.println(nodeList.toString());
}
static void updateOTGDatabase(String areaCode) throws IOException{ //0552 KS 0512 MK
DBConnection connection = new DBConnection();
System.setProperty("javax.net.ssl.trustStore", "c:/Users/spidchenko.d/Downloads/decentralizationgovua.jks");
Document doc = Jsoup.connect("https://decentralization.gov.ua/areas/"+areaCode+"/gromadu").get();
Elements otgTitleElements = doc.getElementsByAttributeValue("title","Назва громади");
//System.out.println(otgTitleElements.html());
Iterator itr = otgTitleElements.iterator();
Element e;
while(itr.hasNext()){
e = (Element)itr.next();
connection.setNewOTG(Integer.parseInt(e.attr("href").split("/")[2]), e.html());
}
}
static void ubdateVillagesAndTgDatabase() throws IOException{
DBConnection connection = new DBConnection();
System.setProperty("javax.net.ssl.trustStore", "c:/Users/spidchenko.d/Downloads/decentralizationgovua.jks");
ArrayList ids = connection.getOTGIds();
Iterator liTags = null, itr = ids.iterator();
Document doc;
Element divList, liElement;
int numElements, currentOTG;
while(itr.hasNext()){
currentOTG = (int)itr.next();
doc = Jsoup.connect("https://decentralization.gov.ua/gromada/"+currentOTG+"/composition").get();
divList = doc.getElementById("consist");
System.out.println(divList.html());
numElements = divList.getElementsByTag("ul").size();
System.out.println(currentOTG+"; Number of ul tags = "+numElements);
if (numElements > 1){ //OTG has TG
for(int i = 0; i < numElements; i++){
System.out.println(">>>>> "+divList.getElementsByTag("p").eq(i).text());
int newTgId = connection.setNewTG(currentOTG, divList.getElementsByTag("p").eq(i).text()); //DB
//System.out.println("> "+divList.getElementsByTag("ul").get(i).children().iterator());
liTags = divList.getElementsByTag("ul").get(i).children().iterator();
while(liTags.hasNext()){
String villageName = ((Element)liTags.next()).text().replace(",", "");
System.out.println("> "+villageName);
connection.setNewVillage(newTgId, currentOTG, villageName); //DB
}
}
} else{ //OTG has no TG, only Villages
try{
liTags = divList.getElementsByTag("ul").get(0).children().iterator();
while(liTags.hasNext()){
String villageName = ((Element)liTags.next()).text().replace(",", "");
System.out.println("> "+villageName);
connection.setNewVillage(0, currentOTG, villageName); //DB
}
}catch (java.lang.IndexOutOfBoundsException err){
System.out.println("OTG has no villages!");
}
}
// System.out.println(divList.getElementsByTag("p").text());
}
}
}
| [
"spidchenko.d@gmail.com"
] | spidchenko.d@gmail.com |
4d8a18266c9756e69a1e6a7fd6051eb5741b1101 | 509d496f1d4a37d1b56693d19cf96c528938baaa | /src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java | 8192729b0b85cc913997c65a361f09791563984e | [
"LicenseRef-scancode-other-permissive",
"BSD-3-Clause"
] | permissive | SofienBoutaib/argouml | bb65203a680b6d2c977c0bb96637914fd30584b1 | 71809598cfc3793b14809c51c975ac305e9bea6a | refs/heads/master | 2022-06-20T21:36:50.184555 | 2011-11-01T17:43:21 | 2011-11-01T17:43:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,698 | java | /* $Id: FigStereotypeDeclaration.java 17735 2010-01-04 14:49:32Z bobtarling $
*******************************************************************************
* Copyright (c) 2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tom Morris
* Bob Tarling
*******************************************************************************
*
* Some portions of this file was previously release using the BSD License:
*/
// $Id: FigStereotypeDeclaration.java 17735 2010-01-04 14:49:32Z bobtarling $
// Copyright (c) 1996-2009 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
// and this paragraph appear in all copies. This software program and
// documentation are copyrighted by The Regents of the University of
// California. The software program and documentation are supplied "AS
// IS", without any accompanying services from The Regents. The Regents
// does not warrant that the operation of the program will be
// uninterrupted or error-free. The end-user understands that the program
// was developed for research purposes and is advised not to rely
// exclusively on the program for any reason. IN NO EVENT SHALL THE
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
package org.argouml.uml.diagram.static_structure.ui;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.util.HashSet;
import java.util.Set;
import java.util.Vector;
import javax.swing.Action;
import org.argouml.model.Model;
import org.argouml.ui.ArgoJMenu;
import org.argouml.uml.diagram.DiagramSettings;
import org.argouml.uml.diagram.ui.ActionAddNote;
import org.argouml.uml.diagram.ui.ActionCompartmentDisplay;
import org.argouml.uml.diagram.ui.ActionEdgesDisplay;
import org.argouml.uml.diagram.ui.CompartmentFigText;
import org.argouml.uml.diagram.ui.FigCompartmentBox;
import org.argouml.uml.ui.foundation.extension_mechanisms.ActionNewTagDefinition;
import org.tigris.gef.base.Selection;
/**
* Class to display a Stereotype declaration figure using
* Classifier box notation.<p>
*
* TODO: This is just a place-holder right now! - tfm
* This needs to show tags and constraints.
*/
public class FigStereotypeDeclaration extends FigCompartmentBox {
private void constructFigs(Rectangle bounds) {
// Put all the bits together, suppressing bounds calculations until
// we're all done for efficiency.
enableSizeChecking(false);
setSuppressCalcBounds(true);
getStereotypeFig().setKeyword("stereotype");
getStereotypeFig().setVisible(true);
/* The next line is needed so that we have the right dimension
* when drawing this Fig on the diagram by pressing down
* the mouse button, even before releasing the mouse button: */
getNameFig().setTopMargin(
getStereotypeFig().getMinimumSize().height);
addFig(getBigPort());
addFig(getNameFig());
// stereotype fig covers the name fig:
addFig(getStereotypeFig());
// TODO: Need named Tags and Constraints compartments here
// addFig(tagsFig);
// addFig(constraintsFig);
// Make all the parts match the main fig
setFilled(true);
setFillColor(FILL_COLOR);
setLineColor(LINE_COLOR);
setLineWidth(LINE_WIDTH);
/* Set the drop location in the case of D&D: */
if (bounds != null) {
setLocation(bounds.x, bounds.y);
}
setSuppressCalcBounds(false);
setBounds(getBounds());
}
/**
* Construct a Fig for a Stereotype on a diagram.
*
* @param owner owning stereotype
* @param bounds position and size
* @param settings render settings
*/
public FigStereotypeDeclaration(Object owner, Rectangle bounds,
DiagramSettings settings) {
super(owner, bounds, settings);
constructFigs(bounds);
enableSizeChecking(true);
}
@Override
public Selection makeSelection() {
return new SelectionStereotype(this);
}
/**
* Build a collection of menu items relevant for a right-click
* pop-up menu on a Stereotype.
* {@inheritDoc}
*/
@Override
public Vector getPopUpActions(MouseEvent me) {
Vector popUpActions = super.getPopUpActions(me);
// Add...
ArgoJMenu addMenu = new ArgoJMenu("menu.popup.add");
// TODO: Add Tags & Constraints
// addMenu.add(TargetManager.getInstance().getAddAttributeAction());
// addMenu.add(TargetManager.getInstance().getAddOperationAction());
addMenu.add(new ActionAddNote());
addMenu.add(new ActionNewTagDefinition());
addMenu.add(ActionEdgesDisplay.getShowEdges());
addMenu.add(ActionEdgesDisplay.getHideEdges());
popUpActions.add(popUpActions.size() - getPopupAddOffset(), addMenu);
// Show ...
ArgoJMenu showMenu = new ArgoJMenu("menu.popup.show");
for (Action action : ActionCompartmentDisplay.getActions()) {
showMenu.add(action);
}
if (showMenu.getComponentCount() > 0) {
popUpActions.add(popUpActions.size() - getPopupAddOffset(),
showMenu);
}
// Modifiers ...
popUpActions.add(popUpActions.size() - getPopupAddOffset(),
buildModifierPopUp(ABSTRACT | LEAF | ROOT));
// Visibility ...
popUpActions.add(popUpActions.size() - getPopupAddOffset(),
buildVisibilityPopUp());
return popUpActions;
}
@Override
protected CompartmentFigText unhighlight() {
CompartmentFigText fc = super.unhighlight();
if (fc == null) {
// TODO: Try unhighlighting our child compartments
// fc = unhighlight(getAttributesFig());
}
return fc;
}
@Override
protected void updateListeners(Object oldOwner, Object newOwner) {
Set<Object[]> listeners = new HashSet<Object[]>();
if (newOwner != null) {
listeners.add(new Object[] {newOwner, null});
// register for tagDefinitions:
for (Object td : Model.getFacade().getTagDefinitions(newOwner)) {
listeners.add(new Object[] {td,
new String[] {"name", "tagType", "multiplicity"}});
}
/* TODO: constraints, ... */
}
updateElementListeners(listeners);
}
}
| [
"email@cs-ware.de"
] | email@cs-ware.de |
a256b01b6cb2a49ec13c9e72229c3b641275d94b | 56362fb8af0ef3e6f44078f22ad3755895b05b06 | /TeamDestinyProject/src/main/java/kr/kosa/destiny/analytics/model/Book.java | 27a0bd0049dc3e9748260e78f2064921f3f0e401 | [] | no_license | shiincs/DAIA_Project | 8673c635b424eb4cdf133e3444bf2861ecdff33c | c6b1ae0642449103add63f81286e6b237137ac97 | refs/heads/master | 2020-03-08T01:30:49.253835 | 2017-08-24T00:46:47 | 2017-08-24T00:46:47 | 127,832,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 470 | java | package kr.kosa.destiny.analytics.model;
public class Book {
private String title;
private String author;
public Book(String title, String author) {
this.title = title;
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
} | [
"COM@COM-PC"
] | COM@COM-PC |
88f07bf81b558ff3f7b6c3a02500354758b48dc6 | 8fd46e13a75d648767338a49753b88086ca7609b | /numberone-framework/src/main/java/com/numberone/framework/web/service/DictService.java | 34ddf5a1ebb04ae2077ac0d6d25e1abf73d5eb58 | [
"MIT"
] | permissive | wangrifeng/numberone-springboot | 14198b57430ec4d0f110baeb17662052fbb5ba3c | 82a6f913afe8034a88804d78160f4f22658d418b | refs/heads/master | 2022-09-14T23:38:42.468813 | 2020-02-21T03:58:40 | 2020-02-21T03:58:40 | 238,162,726 | 1 | 1 | MIT | 2022-09-01T23:19:50 | 2020-02-04T08:57:55 | Java | UTF-8 | Java | false | false | 1,089 | java | package com.numberone.framework.web.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.numberone.system.domain.SysDictData;
import com.numberone.system.service.ISysDictDataService;
/**
* numberone首创 html调用 thymeleaf 实现字典读取
*
* @author numberone
*/
@Service("dict")
public class DictService
{
@Autowired
private ISysDictDataService dictDataService;
/**
* 根据字典类型查询字典数据信息
*
* @param dictType 字典类型
* @return 参数键值
*/
public List<SysDictData> getType(String dictType)
{
return dictDataService.selectDictDataByType(dictType);
}
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String getLabel(String dictType, String dictValue)
{
return dictDataService.selectDictLabel(dictType, dictValue);
}
}
| [
"1426878506@qq.com"
] | 1426878506@qq.com |
67a66a30b16863957a73ced19fa222964e2c905e | 4d737b636c581fc0d28f040a507891fd83d6cb52 | /app/src/main/java/com/wangtotang/ttchatdemo/adapter/EmoteAdapter.java | 8693ebd637ed43d72f54f4f4151494d2a330da57 | [] | no_license | wangtotang/TTChatDemo | 173d19da79c9e2183a39973d366e12738524497a | 3514d9250a3c6553e40364dc3159691db996e9be | refs/heads/master | 2016-09-05T12:15:22.028799 | 2015-04-23T12:07:23 | 2015-04-23T12:07:23 | 33,064,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | package com.wangtotang.ttchatdemo.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.wangtotang.ttchatdemo.R;
import com.wangtotang.ttchatdemo.bean.FaceText;
import java.util.List;
/**
* Created by Wangto Tang on 2015/3/31.
*/
public class EmoteAdapter extends BaseArrayListAdapter {
public EmoteAdapter(Context context, List<FaceText> datas) {
super(context, datas);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item_face_text, null);
holder = new ViewHolder();
holder.mIvImage = (ImageView) convertView
.findViewById(R.id.v_face_text);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
FaceText faceText = (FaceText) getItem(position);
String key = faceText.text.substring(1);
Drawable drawable =mContext.getResources().getDrawable(mContext.getResources().getIdentifier(key, "drawable", mContext.getPackageName()));
holder.mIvImage.setImageDrawable(drawable);
return convertView;
}
class ViewHolder {
ImageView mIvImage;
}
}
| [
"252554922@qq.com"
] | 252554922@qq.com |
a99b227dca6831e18affb86f7945862df8fa8ba9 | 0b981934c0932b8c76211a9685a9a346e4e1a601 | /src/main/java/springproj_1/demo/mapper/TeacherMapper.java | 203a3cfeac6b62e3c1f97516c1770fd20940b107 | [] | no_license | xw6938/javaDB | 830947b348a1c6584e7bb7a0e66059bd700e4230 | b21620ed98f6aa36d883460e6bc723bbb37d653b | refs/heads/master | 2020-06-24T05:17:46.784206 | 2019-08-05T15:49:42 | 2019-08-05T15:49:42 | 198,859,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package springproj_1.demo.mapper;
import org.springframework.stereotype.Repository;
import springproj_1.demo.entity.Teacher;
@Repository
public interface TeacherMapper {
Teacher getTeacherInfo(String Tno);
}
| [
"wx2209@columbia.edu"
] | wx2209@columbia.edu |
c8b404786b3e9cbbd06884ed0e0ffaeaa73115f8 | 1d00e12ce9581d6ae7409eae371acb109ecc8589 | /src/main/java/com/app/pas/dao/impl/ProjectDaoImpl.java | d320785a8584871c0aac597be549c45d5d765ff2 | [] | no_license | yjy1987/PASProject | 9ee8aa38fe49181f6a50594501e4a3d478f65d9a | 761e1c687b06b7000fcc5ec33eff8a21f5ba523b | refs/heads/master | 2021-04-15T04:04:18.963629 | 2018-03-22T07:08:03 | 2018-03-22T07:08:03 | 126,294,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,494 | java | package com.app.pas.dao.impl;
import java.sql.SQLException;
import java.util.List;
import com.app.pas.dao.ProjectDao;
import com.app.pas.dto.MemPositionViewVo;
import com.app.pas.dto.MemberVo;
import com.app.pas.dto.ProjectJoinVo;
import com.app.pas.dto.ProjectVo;
import com.ibatis.sqlmap.client.SqlMapClient;
public class ProjectDaoImpl implements ProjectDao {
private SqlMapClient client;
public void setClient(SqlMapClient client) {
this.client = client;
}
@Override
public List<ProjectVo> selectProjectList() throws SQLException {
List<ProjectVo> list = client.queryForList("selectProjectList");
return list;
}
@Override
public ProjectVo selectProject(int proj_Num) throws SQLException {
ProjectVo projectVo = (ProjectVo) client.queryForObject(
"selectProject", proj_Num);
return projectVo;
}
@Override
public void insertProject(ProjectVo projectVo) throws SQLException {
client.insert("insertProject", projectVo);
}
@Override
public void updateProject(ProjectVo projectVo) throws SQLException {
client.update("updateProject", projectVo);
}
@Override
public void deleteProject(int proj_Num) throws SQLException {
client.update("deleteProject", proj_Num);
}
@Override
public List<MemPositionViewVo> selectMemPositionViewListByProjNum(
int proj_Num) throws SQLException {
List<MemPositionViewVo> list = client.queryForList(
"selectMemPositionViewListByProjNum", proj_Num);
return list;
}
//내가 참여한 프로젝트 검색리스트
@Override
public List<ProjectVo> selectMyProjectListById(ProjectVo projectVo)throws SQLException {
List<ProjectVo> list = client.queryForList("selectMyProjectListById",projectVo);
return list;
}
//외부프로젝트 --------------------------------------------------------------------
@Override
public List<ProjectVo> selectOtherProjectListById(ProjectVo projectVo)
throws SQLException {
List<ProjectVo> list = client.queryForList(
"selectOtherProjectListById", projectVo);
return list;
}
@Override
public ProjectVo selectLastInsertProject(String mem_Email)
throws SQLException {
ProjectVo projectVo = (ProjectVo) client.queryForObject(
"selectLastInsertProject", mem_Email);
return projectVo;
}
@Override
public void updateProjectImg(ProjectVo projectVo) throws SQLException {
client.update("updateProjectImg", projectVo);
}
@Override
public void updateProjectColor(ProjectVo projectVo) throws SQLException {
client.update("updateProjectColor", projectVo);
}
@Override
public List<Integer> selectInviteProjNumByMemEmail(String mem_Email)
throws SQLException {
List<Integer> list =client.queryForList("selectInviteProjNumByMemEmail", mem_Email);
return list;
}
@Override
public int selectProjectTotalCount() throws SQLException {
int totalCount = (Integer) client.queryForObject("selectProjectTotalCount");
return totalCount;
}
@Override
public List<ProjectVo> selectProjectList2(String proj_Name) throws SQLException {
List<ProjectVo> list = client.queryForList("selectProjectList2",proj_Name);
return list;
}
@Override
public List<ProjectJoinVo> selectMemberToProjNum(int proj_Num) throws SQLException {
List<ProjectJoinVo> list = client.queryForList("selectMemberToProjNum",proj_Num);
return list;
}
@Override
public List<ProjectVo> selectProjCreateToday() throws SQLException {
List<ProjectVo> projCreateList = client.queryForList("selectProjCreateToday");
return projCreateList;
}
}
| [
"yeogandalf@gmail.com"
] | yeogandalf@gmail.com |
a9b92bdf5a3909869b1fdb5a7561e746c01af9fd | eeaa439297f177d92d56b37869c85f3bb59d7436 | /sigil/eclipse/runtime/src/org/apache/felix/sigil/eclipse/runtime/config/OSGiLaunchConfigurationConstants.java | 47a3d3621bf2a024149bb566d8e59be670c1ff53 | [
"Apache-2.0"
] | permissive | wmzsoft/felix | c1416837c88be170fb7a83cce6ad010e27c9934d | 226f0cfa3a0093e3d63364da0b0cb9ccac9bd7ac | refs/heads/trunk | 2021-01-21T07:41:44.863799 | 2015-07-18T18:13:01 | 2015-07-18T18:13:01 | 39,355,234 | 1 | 3 | null | 2015-07-20T00:48:00 | 2015-07-20T00:48:00 | null | UTF-8 | Java | false | false | 328 | java | package org.apache.felix.sigil.eclipse.runtime.config;
public interface OSGiLaunchConfigurationConstants
{
String FORM_FILE_LOCATION = "org.apache.felix.sigil.form.location";
String AUTOMATIC_ADD = "org.apache.felix.sigil.automatic.add";
String CLASSPATH_PROVIDER = "org.apache.felix.sigil.classpath.Provider";
}
| [
"dsavage@apache.org"
] | dsavage@apache.org |
fc6bf056cdebcf4f75b2a1fc653928c2dd525cad | 8eb059ab34cb24751e9d9a04d49c4cd5d53d20ce | /remoting2/src/main/java/org/jboss/ejb3/remoting/endpoint/client/RemoteContextDataInterceptor.java | b9c98fc3af51f6cf59722daedabbae6b4c2c3a3f | [] | no_license | wolfc/jboss-ejb3.obsolete | 0109c9f12100e0983333cb11803d18b073b0dbb5 | 4df1234e2f81312b3ff608f9965f9a6ad4191c92 | refs/heads/master | 2020-04-07T03:03:19.723537 | 2009-12-02T11:37:57 | 2009-12-02T11:37:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,616 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.ejb3.remoting.endpoint.client;
import javax.interceptor.InvocationContext;
import org.jboss.ejb3.sis.Interceptor;
/**
* @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
* @version $Revision: $
*/
public class RemoteContextDataInterceptor implements Interceptor
{
public Object invoke(InvocationContext context) throws Exception
{
RemoteContextData.setContextData(context.getContextData());
try
{
return context.proceed();
}
finally
{
RemoteContextData.cleanContextData();
}
}
}
| [
"cdewolf@redhat.com"
] | cdewolf@redhat.com |
e4dc18e89e57dce406fd702a51962901b185735c | f5ff8696048a4280eed25fd3fd58fcf89a4cdb2e | /src/map/ksj/BusRoute.java | d8befedcdf6eff66cc98938a3c3cb218189603df | [
"MIT"
] | permissive | ma38su/ksj | 316fcd7f6ee0be80bec1e7cef4cfa5d019cfc34e | 63731db102919176bbb8df2956bdd2cb0bb4fbf8 | refs/heads/master | 2021-01-22T22:56:52.034232 | 2020-11-21T14:38:08 | 2020-11-21T14:38:08 | 5,350,876 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,584 | java | package map.ksj;
import java.awt.Graphics2D;
import java.awt.Rectangle;
/**
* バスルートのクラス
* @author fujiwara
*/
public class BusRoute implements Data {
/**
* 路線
*/
private GmlCurve curve;
/**
* バス路線情報のクラス
*/
private BusRouteInfo info;
/**
* 平日運行頻度
*/
private double ratePerDay;
/**
* 土曜日運行頻度
*/
private double ratePerSaturday;
/**
* 日祝日運行頻度
*/
private double ratePerHoliday;
/**
* バス路線の系統番号・系統名
* 系統が未整備であれば路線名・事業者名と連番
*/
private String line;
public BusRoute() {
this.info = new BusRouteInfo();
}
public BusRoute(GmlCurve curve, BusRouteInfo info) {
this.curve = curve;
this.info = info;
}
public Rectangle getBounds() {
return this.curve.getBounds();
}
/**
* @return バス路線情報のクラス
*/
public BusRouteInfo getInfo() {
return this.info;
}
public void setInfo(BusRouteInfo info) {
this.info = info;
}
/**
* @return 路線
*/
public GmlCurve getCurve() {
return this.curve;
}
public void setCurve(GmlCurve curve) {
this.curve = curve;
}
/**
* @return バス系統
*/
public String getLine() {
return this.line;
}
public void draw(Graphics2D g) {
this.curve.draw(g);
}
/**
* @return 平日運行頻度
*/
public double getRateParDay() {
return this.ratePerDay;
}
/**
* @return 日祝日運行頻度
*/
public double getRatePerHoliday() {
return this.ratePerHoliday;
}
/**
* @return 土曜日運行頻度
*/
public double getRatePerSaturday() {
return this.ratePerSaturday;
}
@Override
public void link(String tag, Object obj) {
if (obj instanceof GmlCurve) {
if ("ksj:brt".equals(tag)) {
this.curve = (GmlCurve) obj;
}
} else if (obj instanceof String) {
String string = (String) obj;
if ("ksj:bsc".equals(tag)) {
int type = Integer.parseInt(string);
this.info.setType(type);
} else if ("ksj:boc".equals(tag)) {
this.info.setOperationCommunity(string);
} else if ("ksj:bln".equals(tag)) {
this.info.setLine(string);
} else if ("ksj:rpd".equals(tag)) {
this.ratePerDay = Double.parseDouble(string);
} else if ("ksj:rps".equals(tag)) {
this.ratePerSaturday = Double.parseDouble(string);
} else if ("ksj:rph".equals(tag)) {
this.ratePerHoliday = Double.parseDouble(string);
} else if ("ksj:rmk".equals(tag)) {
if (!"".equals(string)) {
System.out.println("remark: "+ string);
}
}
}
}
}
| [
"ma38su@gmail.com"
] | ma38su@gmail.com |
54043131f60fc60580b578250e95fef006b81091 | 2bf21ae67ed1a68596bb5953e1a79b860b61ef19 | /src/DisKMeansWorkflow.java | dce751904ff3080aabd0e42c45b1d1fd48889b07 | [] | no_license | FireTemple/DataView-bohan | 2ee6b7aa34359454f9db5a2347280c248e908efc | d9790e1cc346d332a3b65d83787c01151e40d76b | refs/heads/main | 2023-03-14T09:29:58.401375 | 2021-03-10T02:04:05 | 2021-03-10T02:04:05 | 340,830,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,412 | java | import dataview.models.DATAVIEW_BigFile;
import dataview.models.Task;
import dataview.models.Workflow;
public class DisKMeansWorkflow extends Workflow {
public static int K = 2; // number of clusters
public static int M = 1; // number splitting datasets/ partitions
public static int iteration = 2; // number of iteration
public DisKMeansWorkflow() {
super("Distributed K-means", " Calculating K means clustering for huge number of datasets");
wins = new Object[1];
wins[0] = new DATAVIEW_BigFile("KMeansInput.txt");
wouts = new Object[M];
for(int i = 0; i < M; i++){
wouts[i] = new DATAVIEW_BigFile("KMoutput" + i + ".txt");
}
}
public void design()
{
Task T1 = addTask("DisKMeansInitialization");
Task[] T2 = new Task[M * iteration];
Task[] T3 = new Task[iteration];
Task[] T4 = new Task[M * iteration];
for (int i = 0; i < M * iteration; i++) {
T2[i] = addTask("DisCalculateCentroidStep1");
T4[i] = addTask("DisReassignCluster");
}
for (int i = 0; i < iteration; i++) {
T3[i] = addTask("DisCalculateCentroid");
}
addEdge(0,T1,0);
//addEdge("originalInput.enc", T1, 0);
for (int i = 0; i < M; i++) {
addEdge(T1, i, T2[i], 0);
}
for (int it = 0; it < iteration; it++) {
// Step1 to Centroit && Step1 to Reassign
int index = it * M;
for (int i = 0; i < M; i++) {
addEdge(T2[index + i], 0, T3[it], i);
addEdge(T2[index + i], 1, T4[index + i], 0);
}
for (int i = 0; i < M; i++) {
addEdge(T3[it], i, T4[index + i], 1);
}
for (int i = 0; i < M; i++) {
if (it != iteration - 1){
addEdge(T4[index + i], 0, T2[(it + 1) * M + i], 0);
}else{
addEdge(T4[index + i], 0, i);
}
}
}
/*for (int count = 0; count < iteration; count++) {
int index = 0;
int i = count * M;
int limitT2 = i + M;
for (i = count * M; i < limitT2; i++) {
addEdge(T2[i], 0, T3[count], index++);
//addEdge(T2[i], 1, T3[count], index++);
addEdge(T2[i], 1, T4[i], 0);
}
i = count * M;
int limitT4 = i + M;
for (i = count * M; i < limitT4; i++) {
addEdge(T3[count], i, T4[i], 1);
}
if (count == iteration - 1) {
for (i = count * M; i < limitT4; i++) {
addEdge(T4[i], 0, "output" + i+ ".txt");
}
} else {
index = (count + 1) * M;
for (i = count * M; i < limitT4; i++) {
addEdge(T4[i], 0, T2[index++], 0);
}
}
}*/
}
}
| [
"gk6511@wayne.edu"
] | gk6511@wayne.edu |
5b9b85d30924f15d0821b0e5489f34ff0b76dd48 | 74d9b00d259a60ee910477abf325c3d6a1335b80 | /src/main/java/com/springboot/common/util/ToolUtil.java | dc412c2e5a8aa39e2fa7773aa4e790829a8855aa | [] | no_license | zihanbobo/springboot-master | d023babca702fe2ad4705d4ad780702cbd27e09c | e50d99b0c499c14191ac6ad5191796a745150039 | refs/heads/master | 2022-01-12T20:48:04.490601 | 2019-05-16T05:54:06 | 2019-05-16T05:54:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,968 | java | package com.springboot.common.util;
import java.text.SimpleDateFormat;
import java.util.*;
public class ToolUtil {
/**
* 获取随机位数的字符串
*
* @param length
* @return
*/
public static String getRandomString(int length) {
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
}
/**
* 短信验证码
*
* @return
*/
public static String getRandomNumber() {
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 6; i++) {
sb.append(random.nextInt(10));
}
return sb.toString();
}
/**
* 时间戳转日期格式
*
* @param timeStmp
* @return
*/
public static String getDateFormat(long timeStmp) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateFormat.format(new Date(timeStmp));
}
public static <T> List<T> newLinkedList(T... values) {
return (LinkedList) list(true, values);
}
public static <T> List<T> list(boolean isLinked, T... values) {
if (isEmpty(values)) {
return list(isLinked);
} else {
List<T> arrayList = isLinked ? new LinkedList() : new ArrayList(values.length);
Object[] arr$ = values;
int len$ = values.length;
for (int i$ = 0; i$ < len$; ++i$) {
T t = (T) arr$[i$];
(arrayList).add(t);
}
return arrayList;
}
}
public static <T> boolean isEmpty(T... array) {
return array == null || array.length == 0;
}
}
| [
"798776228@qq.com"
] | 798776228@qq.com |
2cd3eda757b6ac2b13cfe763c562abc8c41d042b | dcdcf6d252eae4c8f1d36f2fc60d55642db6770d | /curso/src/main/java/com/java/so/Book.java | 90e63805027740172347f79dbf4aa27fda89e763 | [] | no_license | AlbertProfe/JAVA_pqtm2019 | 7b509b4aa943fc9b9514ba301c4fd5b0fe302da7 | 8bb59d1709f307548e1eac8b8dd3ca39f87152e4 | refs/heads/master | 2022-12-05T07:20:10.900783 | 2020-10-09T11:43:57 | 2020-10-09T11:43:57 | 186,802,817 | 1 | 0 | null | 2022-11-24T08:17:31 | 2019-05-15T10:20:17 | Java | UTF-8 | Java | false | false | 2,005 | java |
package com.java.so;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Book implements Serializable {
@Id
private String title;
private String author;
private Date date;
@OneToMany(mappedBy = "book", cascade = CascadeType.ALL)
private List<Page> pages = new ArrayList<Page>();
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((title == null) ? 0 : title.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Book other = (Book) obj;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
return true;
}
public Book(String title, String author, Date date) {
super();
this.title = title;
this.author = author;
this.date = date;
}
public Book(String title) {
super();
this.title = title;
}
public Book() {
super();
}
public void addPage(Page p) {
pages.add(p);
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public List<Page> getPages() {
return pages;
}
public void setPages(List<Page> pages) {
this.pages = pages;
}
@Override
public String toString() {
return "Book [title=" + title + ", author=" + author + ", date=" + date + ", pages=" + pages + "]";
}
}
| [
"inspiratalbert@DESKTOP-E24ITDK"
] | inspiratalbert@DESKTOP-E24ITDK |
a1ad4246400cd7257f212c8de40eb11e0260bb50 | 673a2dd7cd3087407be4d9e56d3bdc57922f16ce | /testPjt/src/StringBufferClass.java | 6b9af3d9291ae2497ce3c32aef79384d9c4c5def | [] | no_license | hyeonjerry/Java-Tutorial | 3a219632db567c384febf44e7fb71efa93e2ff96 | a982f731007cd3aab38a67c75c684bd572ca8f7c | refs/heads/main | 2023-08-18T04:31:13.513613 | 2021-06-30T06:53:43 | 2021-06-30T06:53:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | package testPjt.src;
public class StringBufferClass {
public static void main(String[] args) {
StringBuffer sb = new StringBuffer();
// 문자열을 추가하거나 변경할 때 사용하는 자료형
sb.append(" ");
sb.append("jump to java");
sb.insert(0, "hello");
System.out.println(sb);
System.out.println(sb.substring(14));
String temp = "";
temp += "hello";
temp += " ";
temp += "jump to java";
System.out.println(temp);
System.out.println(sb.equals(temp));
System.out.println((sb.toString().equals(temp)));
// toString() -> String 자료형으로 변경
}
}
| [
"rnjsguswo012@hufs.ac.kr"
] | rnjsguswo012@hufs.ac.kr |
37788ab71f95b9e633dd15f77159bb3d1a7fbcd0 | 17fdc38df32efbd873302f699889f8b3e93690ff | /android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/camera/CameraViewManager.java | 2e892e89788027538cc276fd0012c81a095eed42 | [
"MIT",
"BSD-3-Clause",
"CC-BY-4.0",
"Apache-2.0"
] | permissive | mohebifar/expo | a83d51a1e2f886375aa6fb5c535719891dc3efdd | 083f2254c65e71385054172e147765edfb676fe4 | refs/heads/master | 2021-01-15T21:24:31.714042 | 2017-08-09T23:02:36 | 2017-08-09T23:02:36 | 99,859,373 | 2 | 0 | null | 2017-08-09T22:58:22 | 2017-08-09T22:58:22 | null | UTF-8 | Java | false | false | 2,981 | java | package versioned.host.exp.exponent.modules.api.components.camera;
import android.support.annotation.Nullable;
import com.facebook.react.bridge.Promise;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.google.android.cameraview.AspectRatio;
import java.util.Map;
import java.util.Set;
public class CameraViewManager extends ViewGroupManager<ExpoCameraView> {
public enum Events {
EVENT_CAMERA_READY("onCameraReady");
private final String mName;
Events(final String name) {
mName = name;
}
@Override
public String toString() {
return mName;
}
}
private static final String REACT_CLASS = "ExponentCamera";
private static CameraViewManager instance;
private ExpoCameraView mCameraView;
public CameraViewManager() {
super();
instance = this;
}
public static CameraViewManager getInstance() { return instance; }
@Override
public String getName() {
return REACT_CLASS;
}
@Override
protected ExpoCameraView createViewInstance(ThemedReactContext themedReactContext) {
mCameraView = new ExpoCameraView(themedReactContext);
return mCameraView;
}
@Override
@Nullable
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
for (Events event : Events.values()) {
builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
}
return builder.build();
}
@ReactProp(name = "type")
public void setType(ExpoCameraView view, int type) {
view.setFacing(type);
}
@ReactProp(name = "ratio")
public void setRatio(ExpoCameraView view, String ratio) {
view.setAspectRatio(AspectRatio.parse(ratio));
}
@ReactProp(name = "flashMode")
public void setFlashMode(ExpoCameraView view, int torchMode) {
view.setFlash(torchMode);
}
@ReactProp(name = "autoFocus")
public void setAutoFocus(ExpoCameraView view, boolean autoFocus) {
view.setAutoFocus(autoFocus);
}
@ReactProp(name = "focusDepth")
public void setFocusDepth(ExpoCameraView view, float depth) {
view.setFocusDepth(depth);
}
@ReactProp(name = "zoom")
public void setZoom(ExpoCameraView view, float zoom) {
view.setZoom(zoom);
}
@ReactProp(name = "whiteBalance")
public void setWhiteBalance(ExpoCameraView view, int whiteBalance) {
view.setWhiteBalance(whiteBalance);
}
public void takePicture(Promise promise) {
if (mCameraView.isCameraOpened()) {
mCameraView.takePicture(promise);
} else {
promise.reject("E_CAMERA_UNAVAILABLE", "Camera is not running");
}
}
public Set<AspectRatio> getSupportedRatios() {
if (mCameraView.isCameraOpened()) {
return mCameraView.getSupportedAspectRatios();
}
return null;
}
}
| [
"aurora@exp.host"
] | aurora@exp.host |
3bb64aacd01e13384e0ddd6d244126673c4680f7 | a0d6199649b7947718e290133d1565732b817cf5 | /onlinehelp/src/main/java/uk/co/o2/soa/useraccountsdata_1/BillingDataType.java | ee2b2af7102b3c37a84738a5d6bee8d64c42775f | [] | no_license | palaksareen/projectt | c05b487ac5db65a650b6da2b2ae10544c54699c8 | 70d3ac600306f0e73b9e1895d04741dcf3a70feb | refs/heads/master | 2021-08-16T22:48:57.296252 | 2017-11-20T12:58:01 | 2017-11-20T12:58:01 | 111,407,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,256 | java |
package uk.co.o2.soa.useraccountsdata_1;
import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import uk.co.o2.soa.pscommonregistrationdata_2.IdentityReferenceType;
/**
* Billing information
*
* <p>Java class for billingDataType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="billingDataType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="billingMsisdn" type="{http://soa.o2.co.uk/coredata_1}msisdnType" minOccurs="0"/>
* <element name="billingAccountId" type="{http://soa.o2.co.uk/pscommonregistrationdata_2}billingAccountIdType" minOccurs="0"/>
* <element name="billingAccountName" type="{http://soa.o2.co.uk/pscommonregistrationdata_2}billingAccountNameType" minOccurs="0"/>
* <element name="billingAccountType" type="{http://soa.o2.co.uk/pscommonregistrationdata_2}accountCategoryType" minOccurs="0"/>
* <element name="owningPortalAccount" type="{http://soa.o2.co.uk/pscommonregistrationdata_2}identityReferenceType" minOccurs="0"/>
* <element name="customerNumber" type="{http://soa.o2.co.uk/pscommonregistrationdata_2}customerNumberType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "billingDataType", propOrder = {
"billingMsisdn",
"billingAccountId",
"billingAccountName",
"billingAccountType",
"owningPortalAccount",
"customerNumber"
})
public class BillingDataType {
protected String billingMsisdn;
protected String billingAccountId;
protected String billingAccountName;
protected String billingAccountType;
protected IdentityReferenceType owningPortalAccount;
protected BigInteger customerNumber;
/**
* Gets the value of the billingMsisdn property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBillingMsisdn() {
return billingMsisdn;
}
/**
* Sets the value of the billingMsisdn property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBillingMsisdn(String value) {
this.billingMsisdn = value;
}
/**
* Gets the value of the billingAccountId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBillingAccountId() {
return billingAccountId;
}
/**
* Sets the value of the billingAccountId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBillingAccountId(String value) {
this.billingAccountId = value;
}
/**
* Gets the value of the billingAccountName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBillingAccountName() {
return billingAccountName;
}
/**
* Sets the value of the billingAccountName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBillingAccountName(String value) {
this.billingAccountName = value;
}
/**
* Gets the value of the billingAccountType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBillingAccountType() {
return billingAccountType;
}
/**
* Sets the value of the billingAccountType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBillingAccountType(String value) {
this.billingAccountType = value;
}
/**
* Gets the value of the owningPortalAccount property.
*
* @return
* possible object is
* {@link IdentityReferenceType }
*
*/
public IdentityReferenceType getOwningPortalAccount() {
return owningPortalAccount;
}
/**
* Sets the value of the owningPortalAccount property.
*
* @param value
* allowed object is
* {@link IdentityReferenceType }
*
*/
public void setOwningPortalAccount(IdentityReferenceType value) {
this.owningPortalAccount = value;
}
/**
* Gets the value of the customerNumber property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getCustomerNumber() {
return customerNumber;
}
/**
* Sets the value of the customerNumber property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setCustomerNumber(BigInteger value) {
this.customerNumber = value;
}
}
| [
"palak.sareen@cognizant.com"
] | palak.sareen@cognizant.com |
255969d7b941e6f32ed27c681429e46a3168562d | 920aa81ed6b7d933f428a4b3ea52a0c7a4457527 | /Java/annotations_app/src/com/techlabs/annotations/test/FooTest.java | 348a547c7bd91a78e693c0e153571d5f83f6b6fd | [] | no_license | NiranjanShetty8/Swabhav | 3f4700b9cf5195b3ed3905171c0ea534018956a9 | 0b5235b476a393bdb041920639a2c138c2fa1ad7 | refs/heads/master | 2023-01-11T08:06:45.055672 | 2020-03-18T11:55:23 | 2020-03-18T11:55:23 | 218,492,278 | 0 | 0 | null | 2023-01-07T15:06:05 | 2019-10-30T09:39:04 | Java | UTF-8 | Java | false | false | 948 | java | package com.techlabs.annotations.test;
import java.lang.annotation.Annotation;
import java.lang.reflect.*;
import com.techlabs.annotations.*;
public class FooTest {
public static void main(String[] args) {
int i = 0;
Foo obj = new Foo();
// Class<? extends Foo> cls = obj.getClass();
// Method[] totalMethods = cls.getMethods();
Method[] totalMethods = obj.getClass().getMethods();
Method[] annoMethods = new Method[totalMethods.length];
for (Method method : totalMethods) {
if (method.getAnnotation(RequireRefactor.class) != null) {
annoMethods[i] = method;
i++;
}
}
System.out.println("Number of annoted methods: " + i);
for (Method met : annoMethods) {
if (met != null)
System.out.println(met.getName());
}
}
}
// Annotation anno = methody.getAnnotation(RequireRefactor.class);
//RequireRefactor rf = (RequireRefactor)anno;
//if(rf.key() == 10);
//{
// System.out.println(methody.getName());
//} | [
"shetty.niranjan4@gmail.com"
] | shetty.niranjan4@gmail.com |
0b2559a655c6be6336feb667672e723fc8602c71 | 7cc39b1ee93832aed70e14224f8a3d991570cca6 | /aws-java-sdk-personalizeevents/src/main/java/com/amazonaws/services/personalizeevents/AmazonPersonalizeEventsClient.java | f2a6659c6f42e6b9c90e69859466244ddaf637c3 | [
"Apache-2.0"
] | permissive | yijiangliu/aws-sdk-java | 74e626e096fe4cee22291809576bb7dc70aef94d | b75779a2ab0fe14c91da1e54be25b770385affac | refs/heads/master | 2022-12-17T10:24:59.549226 | 2020-08-19T23:46:40 | 2020-08-19T23:46:40 | 289,107,793 | 1 | 0 | Apache-2.0 | 2020-08-20T20:49:17 | 2020-08-20T20:49:16 | null | UTF-8 | Java | false | false | 11,863 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.personalizeevents;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.personalizeevents.AmazonPersonalizeEventsClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.personalizeevents.model.*;
import com.amazonaws.services.personalizeevents.model.transform.*;
/**
* Client for accessing Amazon Personalize Events. All service calls made using this client are blocking, and will not
* return until the service call completes.
* <p>
* <p>
* Amazon Personalize can consume real-time user event data, such as <i>stream</i> or <i>click</i> data, and use it for
* model training either alone or combined with historical data. For more information see <a>recording-events</a>.
* </p>
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonPersonalizeEventsClient extends AmazonWebServiceClient implements AmazonPersonalizeEvents {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AmazonPersonalizeEvents.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "personalize";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.withContentTypeOverride("")
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidInputException").withExceptionUnmarshaller(
com.amazonaws.services.personalizeevents.model.transform.InvalidInputExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.personalizeevents.model.AmazonPersonalizeEventsException.class));
public static AmazonPersonalizeEventsClientBuilder builder() {
return AmazonPersonalizeEventsClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on Amazon Personalize Events using the specified parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonPersonalizeEventsClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on Amazon Personalize Events using the specified parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonPersonalizeEventsClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("personalize-events.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/personalizeevents/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/personalizeevents/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
* <p>
* Records user interaction event data. For more information see <a>event-record-api</a>.
* </p>
*
* @param putEventsRequest
* @return Result of the PutEvents operation returned by the service.
* @throws InvalidInputException
* Provide a valid value for the field or parameter.
* @sample AmazonPersonalizeEvents.PutEvents
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/personalize-events-2018-03-22/PutEvents" target="_top">AWS
* API Documentation</a>
*/
@Override
public PutEventsResult putEvents(PutEventsRequest request) {
request = beforeClientExecution(request);
return executePutEvents(request);
}
@SdkInternalApi
final PutEventsResult executePutEvents(PutEventsRequest putEventsRequest) {
ExecutionContext executionContext = createExecutionContext(putEventsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<PutEventsRequest> request = null;
Response<PutEventsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PutEventsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putEventsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Personalize Events");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutEvents");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<PutEventsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutEventsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
* <p>
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> anonymousInvoke(Request<Y> request,
HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> doInvoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler<AmazonServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
}
| [
""
] | |
d3e0ff6d1b01d5413b89bdc43c6793a4a83acc2e | 9df9ce504ec5695be97ff610badc441808f4ae97 | /ood-week2-factory/src/edu/lewisu/ood/week2/factory/TopCandles.java | 35fbbf828aecb2912c72df4b27c4a7f64f5100aa | [] | no_license | Stephen-Montague/lewis-ood-week2 | 3af5ae9f7137c97167e9286c613a3edb76444678 | ab70f2b4f7550f4be9e05715590671999a424c59 | refs/heads/master | 2020-07-21T10:16:32.074423 | 2019-09-16T12:08:52 | 2019-09-16T12:08:52 | 206,830,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package edu.lewisu.ood.week2.factory;
public class TopCandles extends CakeDecorator {
public TopCandles(Cake cake) {
this.cake = cake;
}
public String getDescription() {
return cake.getDescription() + ", Candles";
}
public double cost() {
return cake.cost() + 0.50;
}
} | [
"54737111+Stephen-Montague@users.noreply.github.com"
] | 54737111+Stephen-Montague@users.noreply.github.com |
cbcaaf32ee9edc3d106305f9c3e453a7ba18034f | 056a186236f1dab99c2cf8e553eddd1cedb47734 | /drools-wb-services/drools-wb-verifier/drools-wb-verifier-api/src/main/java/org/drools/workbench/services/verifier/api/client/cache/inspectors/FieldInspector.java | ea06044735626c89b2ae7eb309ca0cd3d78703b4 | [
"Apache-2.0"
] | permissive | bingyue/drools-wb | bdd5ae52606771c95cb2aedccc14ef927753d3aa | 88dcdfc366c97984ac39a27f971a76d2a702af07 | refs/heads/master | 2021-01-12T16:36:58.397797 | 2016-10-19T14:43:17 | 2016-10-19T14:43:17 | 71,418,437 | 1 | 0 | null | 2016-10-20T02:34:16 | 2016-10-20T02:34:16 | null | UTF-8 | Java | false | false | 9,080 | java | /*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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.drools.workbench.services.verifier.api.client.cache.inspectors;
import java.util.Collection;
import org.drools.workbench.services.verifier.api.client.cache.inspectors.action.ActionInspectorFactory;
import org.drools.workbench.services.verifier.api.client.cache.inspectors.condition.ConditionInspector;
import org.drools.workbench.services.verifier.api.client.cache.util.HasConflicts;
import org.drools.workbench.services.verifier.api.client.cache.util.maps.InspectorList;
import org.drools.workbench.services.verifier.api.client.cache.util.maps.UpdatableInspectorList;
import org.drools.workbench.services.verifier.api.client.checks.util.Conflict;
import org.drools.workbench.services.verifier.api.client.checks.util.IsConflicting;
import org.drools.workbench.services.verifier.api.client.checks.util.IsRedundant;
import org.drools.workbench.services.verifier.api.client.checks.util.IsSubsuming;
import org.drools.workbench.services.verifier.api.client.index.Action;
import org.drools.workbench.services.verifier.api.client.index.Condition;
import org.drools.workbench.services.verifier.api.client.index.Field;
import org.drools.workbench.services.verifier.api.client.index.ObjectField;
import org.drools.workbench.services.verifier.api.client.index.keys.Key;
import org.drools.workbench.services.verifier.api.client.index.keys.UUIDKey;
import org.drools.workbench.services.verifier.api.client.index.select.AllListener;
import org.drools.workbench.services.verifier.api.client.cache.inspectors.action.ActionInspector;
import org.drools.workbench.services.verifier.api.client.cache.inspectors.condition.ConditionInspectorFactory;
import org.drools.workbench.services.verifier.api.client.cache.util.HasKeys;
import org.drools.workbench.services.verifier.api.client.checks.util.HumanReadable;
import org.drools.workbench.services.verifier.api.client.configuration.AnalyzerConfiguration;
import org.uberfire.commons.validation.PortablePreconditions;
public class FieldInspector
implements HasConflicts,
IsConflicting,
IsSubsuming,
IsRedundant,
HumanReadable,
HasKeys {
private final ObjectField objectField;
private final UpdatableInspectorList<ActionInspector, Action> actionInspectorList;
private final UpdatableInspectorList<ConditionInspector, Condition> conditionInspectorList;
private final UUIDKey uuidKey;
private final RuleInspectorUpdater ruleInspectorUpdater;
public FieldInspector( final Field field,
final RuleInspectorUpdater ruleInspectorUpdater,
final AnalyzerConfiguration configuration ) {
this( field.getObjectField(),
ruleInspectorUpdater,
configuration );
configuration.getUUID( this );
updateActionInspectors( field.getActions()
.where( Action.value()
.any() )
.select()
.all() );
updateConditionInspectors( field.getConditions()
.where( Condition.value()
.any() )
.select()
.all() );
setupActionsListener( field );
setupConditionsListener( field );
}
public FieldInspector( final ObjectField field,
final RuleInspectorUpdater ruleInspectorUpdater,
final AnalyzerConfiguration configuration ) {
this.objectField = PortablePreconditions.checkNotNull( "field",
field );
this.ruleInspectorUpdater = PortablePreconditions.checkNotNull( "ruleInspectorUpdater",
ruleInspectorUpdater );
uuidKey = configuration.getUUID( this );
actionInspectorList = new UpdatableInspectorList<>( new ActionInspectorFactory( configuration ),
configuration );
conditionInspectorList = new UpdatableInspectorList<>( new ConditionInspectorFactory( configuration ),
configuration );
}
private void setupConditionsListener( final Field field ) {
field.getConditions()
.where( Condition.value()
.any() )
.listen()
.all( new AllListener<Condition>() {
@Override
public void onAllChanged( final Collection<Condition> all ) {
updateConditionInspectors( all );
ruleInspectorUpdater.resetConditionsInspectors();
}
} );
}
private void setupActionsListener( final Field field ) {
field.getActions()
.where( Action.value()
.any() )
.listen()
.all( new AllListener<Action>() {
@Override
public void onAllChanged( final Collection<Action> all ) {
updateActionInspectors( all );
ruleInspectorUpdater.resetActionsInspectors();
}
} );
}
public ObjectField getObjectField() {
return objectField;
}
private void updateConditionInspectors( final Collection<Condition> all ) {
conditionInspectorList.update( all );
}
private void updateActionInspectors( final Collection<Action> all ) {
actionInspectorList.update( all );
}
public InspectorList<ActionInspector> getActionInspectorList() {
return actionInspectorList;
}
public InspectorList<ConditionInspector> getConditionInspectorList() {
return conditionInspectorList;
}
@Override
public Conflict hasConflicts() {
int index = 1;
for ( final ConditionInspector conditionInspector : conditionInspectorList ) {
for ( int j = index; j < conditionInspectorList.size(); j++ ) {
if ( conditionInspector.conflicts( conditionInspectorList.get( j ) ) ) {
return new Conflict( conditionInspector,
conditionInspectorList.get( j ) );
}
}
index++;
}
return Conflict.EMPTY;
}
@Override
public boolean conflicts( final Object other ) {
if ( other instanceof FieldInspector && objectField.equals( ( (FieldInspector) other ).objectField ) ) {
final boolean conflicting = actionInspectorList.conflicts( ( (FieldInspector) other ).actionInspectorList );
if ( conflicting ) {
return true;
} else {
return conditionInspectorList.conflicts( ( (FieldInspector) other ).conditionInspectorList );
}
} else {
return false;
}
}
@Override
public boolean isRedundant( final Object other ) {
if ( other instanceof FieldInspector && objectField.equals( ( (FieldInspector) other ).objectField ) ) {
return actionInspectorList.isRedundant( ( (FieldInspector) other ).actionInspectorList )
&& conditionInspectorList.isRedundant( ( (FieldInspector) other ).conditionInspectorList );
} else {
return false;
}
}
@Override
public boolean subsumes( final Object other ) {
if ( other instanceof FieldInspector && objectField.equals( ( (FieldInspector) other ).objectField ) ) {
return actionInspectorList.subsumes( ( (FieldInspector) other ).actionInspectorList )
&& conditionInspectorList.subsumes( ( (FieldInspector) other ).conditionInspectorList );
} else {
return false;
}
}
@Override
public String toHumanReadableString() {
return objectField.getName();
}
@Override
public UUIDKey getUuidKey() {
return uuidKey;
}
@Override
public Key[] keys() {
return new Key[]{
uuidKey
};
}
}
| [
"manstis@users.noreply.github.com"
] | manstis@users.noreply.github.com |
9e6f01bc5ab8c337a540eb1cf625e2374817df7f | 81b1cb8a87554af156ed7b84a21d24d0e074f25b | /src/main/java/com/creditharmony/core/common/type/SelectOptionType.java | a988b880bf1f153ef0aa949e9142e9ebb5653669 | [] | no_license | sengeiou/chp-core | 03e5abd12d242b04e0060372e0dcfad3ad52ccd2 | bdc410a1682ba2983ed64cc8377b5e7707210819 | refs/heads/master | 2020-05-16T02:55:41.694666 | 2017-07-06T06:17:16 | 2017-07-06T06:17:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package com.creditharmony.core.common.type;
/**
* 页面下拉列表框选项的类型常量
* @Class Name SelectOptionType
* @author 张永生
* @Create In 2015年12月9日
*/
public interface SelectOptionType {
/**
* 下拉列表默认被选中的选中项对应的String类型数值
*/
public static final String STRING_DEFAULT_VALUE = "-1";
/**
* 下拉列表默认被选中的选中项对应的Integer类型数值
*/
public static final Integer INTEGER_DEFAULT_VALUE = -1;
/**
* -1转换成默认的null
*/
public static final String DEFAULT_NULL = null;
}
| [
"qiang.guo3@creditharmony.cn"
] | qiang.guo3@creditharmony.cn |
486b0457964476a66ff8b62ee85f8d55e828c430 | b237e189b215391b0866674ca1a62516343bb645 | /src/main/java/com/mirakl/client/mmp/request/shop/AbstractMiraklGetShopDocumentsRequest.java | 787845c53481efd2af62a9ceb9e54aa9d9cc5360 | [] | no_license | blacwood/MIRAKL | 86ddc1974f1881df57cf6ac36dbb8e4c17849db3 | fb8dd37a9b90224f859b41450e79e7e2facbe7b0 | refs/heads/master | 2020-05-23T10:11:55.664123 | 2017-04-18T20:13:38 | 2017-04-18T20:13:38 | 80,401,817 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | /**
* Copyright © 2016 Mirakl. www.mirakl.com - info@mirakl.com
* All Rights Reserved. Tous droits réservés.
* Strictly Confidential, this data may not be reproduced or redistributed
* Use of this data is pursuant to a license agreement with Mirakl.
*/
package com.mirakl.client.mmp.request.shop;
import com.mirakl.client.core.internal.MiraklApiEndpoint;
import com.mirakl.client.domain.common.Unicity;
import com.mirakl.client.mmp.core.internal.MiraklMarketplacePlatformCommonApiEndpoint;
import com.mirakl.client.request.AbstractMiraklApiRequest;
@Unicity(includeAll = true)
public abstract class AbstractMiraklGetShopDocumentsRequest extends AbstractMiraklApiRequest {
@Override
public MiraklApiEndpoint getEndpoint() {
return MiraklMarketplacePlatformCommonApiEndpoint.S30;
}
}
| [
"mnprasad78@gmail.com"
] | mnprasad78@gmail.com |
b26a99d445a77eaecf4431b2ae5af9c2e83d35b4 | 37c01a0727825d52d81f9e17f853967e304a1046 | /src/com/jeecms/bbs/entity/base/BaseBbsConfig.java | 322e06c79009fa983075daeac5b75dccddd51d11 | [] | no_license | cnywb/jeecms | a86bd027a8e3550daf4ff5eaaea9113bbd9c3936 | 93c86a863db61d45bfb4b05822ca0d6774eca697 | refs/heads/master | 2020-04-08T02:26:24.359947 | 2018-11-24T13:20:58 | 2018-11-24T13:20:58 | 158,935,834 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,456 | java | package com.jeecms.bbs.entity.base;
import java.io.Serializable;
/**
* This is an object that contains data related to the BBS_CONFIG table.
* Do not modify this class because it will be overwritten if the configuration file
* related to this class is modified.
*
* @hibernate.class
* table="BBS_CONFIG"
*/
public abstract class BaseBbsConfig implements Serializable {
public static String REF = "BbsConfig";
public static String PROP_AVATAR_WIDTH = "avatarWidth";
public static String PROP_POST_MAX = "postMax";
public static String PROP_AVATAR_HEIGHT = "avatarHeight";
public static String PROP_SITE = "site";
public static String PROP_DEF_AVATAR = "defAvatar";
public static String PROP_REGISTER_GROUP = "registerGroup";
public static String PROP_TOPIC_TOTAL = "topicTotal";
public static String PROP_LAST_USER = "lastUser";
public static String PROP_REGISTER_RULE = "registerRule";
public static String PROP_DEFAULT_GROUP = "defaultGroup";
public static String PROP_POST_MAX_DATE = "postMaxDate";
public static String PROP_KEYWORDS = "keywords";
public static String PROP_POST_YESTERDAY = "postYesterday";
public static String PROP_AUTO_REGISTER = "autoRegister";
public static String PROP_REGISTER_STATUS = "registerStatus";
public static String PROP_POST_TOTAL = "postTotal";
public static String PROP_TOPIC_COUNT_PER_PAGE = "topicCountPerPage";
public static String PROP_DESCRIPTION = "description";
public static String PROP_TOPIC_HOT_COUNT = "topicHotCount";
public static String PROP_USER_TOTAL = "userTotal";
public static String PROP_POST_COUNT_PER_PAGE = "postCountPerPage";
public static String PROP_ID = "id";
public static String PROP_POST_TODAY = "postToday";
// constructors
public BaseBbsConfig () {
initialize();
}
/**
* Constructor for primary key
*/
public BaseBbsConfig (java.lang.Integer id) {
this.setId(id);
initialize();
}
/**
* Constructor for required fields
*/
public BaseBbsConfig (
java.lang.Integer id,
com.jeecms.bbs.entity.BbsUser lastUser,
com.jeecms.bbs.entity.BbsUserGroup registerGroup,
com.jeecms.bbs.entity.BbsUserGroup defaultGroup,
java.lang.String defAvatar,
java.lang.Integer avatarWidth,
java.lang.Integer avatarHeight,
java.lang.Integer topicCountPerPage,
java.lang.Integer postCountPerPage,
java.lang.String keywords,
java.lang.String description,
java.lang.Short registerStatus,
java.lang.Integer topicHotCount,
java.lang.Integer postToday,
java.lang.Integer postYesterday,
java.lang.Integer postMax,
java.util.Date postMaxDate,
java.lang.Integer topicTotal,
java.lang.Integer postTotal,
java.lang.Integer userTotal) {
this.setId(id);
this.setLastUser(lastUser);
this.setRegisterGroup(registerGroup);
this.setDefaultGroup(defaultGroup);
this.setDefAvatar(defAvatar);
this.setAvatarWidth(avatarWidth);
this.setAvatarHeight(avatarHeight);
this.setTopicCountPerPage(topicCountPerPage);
this.setPostCountPerPage(postCountPerPage);
this.setKeywords(keywords);
this.setDescription(description);
this.setRegisterStatus(registerStatus);
this.setTopicHotCount(topicHotCount);
this.setPostToday(postToday);
this.setPostYesterday(postYesterday);
this.setPostMax(postMax);
this.setPostMaxDate(postMaxDate);
this.setTopicTotal(topicTotal);
this.setPostTotal(postTotal);
this.setUserTotal(userTotal);
initialize();
}
protected void initialize () {}
private int hashCode = Integer.MIN_VALUE;
// primary key
private java.lang.Integer id;
// fields
private java.lang.String defAvatar;
private java.lang.Integer avatarWidth;
private java.lang.Integer avatarHeight;
private java.lang.Integer topicCountPerPage;
private java.lang.Integer postCountPerPage;
private java.lang.String keywords;
private java.lang.String description;
private java.lang.Short registerStatus;
private java.lang.String registerRule;
private java.lang.Integer topicHotCount;
private java.lang.Integer postToday;
private java.lang.Integer postYesterday;
private java.lang.Integer postMax;
private java.util.Date postMaxDate;
private java.lang.Integer topicTotal;
private java.lang.Integer postTotal;
private java.lang.Integer userTotal;
private java.lang.Boolean autoRegister;
private java.lang.Boolean emailValidate;
// one to one
private com.jeecms.cms.entity.main.CmsSite site;
// many to one
private com.jeecms.bbs.entity.BbsUser lastUser;
private com.jeecms.bbs.entity.BbsUserGroup registerGroup;
private com.jeecms.bbs.entity.BbsUserGroup defaultGroup;
/**
* Return the unique identifier of this class
* @hibernate.id
* generator-class="foreign"
* column="CONFIG_ID"
*/
public java.lang.Integer getId () {
return id;
}
/**
* Set the unique identifier of this class
* @param id the new ID
*/
public void setId (java.lang.Integer id) {
this.id = id;
this.hashCode = Integer.MIN_VALUE;
}
/**
* Return the value associated with the column: DEF_AVATAR
*/
public java.lang.String getDefAvatar () {
return defAvatar;
}
/**
* Set the value related to the column: DEF_AVATAR
* @param defAvatar the DEF_AVATAR value
*/
public void setDefAvatar (java.lang.String defAvatar) {
this.defAvatar = defAvatar;
}
/**
* Return the value associated with the column: AVATAR_WIDTH
*/
public java.lang.Integer getAvatarWidth () {
return avatarWidth;
}
/**
* Set the value related to the column: AVATAR_WIDTH
* @param avatarWidth the AVATAR_WIDTH value
*/
public void setAvatarWidth (java.lang.Integer avatarWidth) {
this.avatarWidth = avatarWidth;
}
/**
* Return the value associated with the column: AVATAR_HEIGHT
*/
public java.lang.Integer getAvatarHeight () {
return avatarHeight;
}
/**
* Set the value related to the column: AVATAR_HEIGHT
* @param avatarHeight the AVATAR_HEIGHT value
*/
public void setAvatarHeight (java.lang.Integer avatarHeight) {
this.avatarHeight = avatarHeight;
}
/**
* Return the value associated with the column: TOPIC_COUNT_PER_PAGE
*/
public java.lang.Integer getTopicCountPerPage () {
return topicCountPerPage;
}
/**
* Set the value related to the column: TOPIC_COUNT_PER_PAGE
* @param topicCountPerPage the TOPIC_COUNT_PER_PAGE value
*/
public void setTopicCountPerPage (java.lang.Integer topicCountPerPage) {
this.topicCountPerPage = topicCountPerPage;
}
/**
* Return the value associated with the column: POST_COUNT_PER_PAGE
*/
public java.lang.Integer getPostCountPerPage () {
return postCountPerPage;
}
/**
* Set the value related to the column: POST_COUNT_PER_PAGE
* @param postCountPerPage the POST_COUNT_PER_PAGE value
*/
public void setPostCountPerPage (java.lang.Integer postCountPerPage) {
this.postCountPerPage = postCountPerPage;
}
/**
* Return the value associated with the column: KEYWORDS
*/
public java.lang.String getKeywords () {
return keywords;
}
/**
* Set the value related to the column: KEYWORDS
* @param keywords the KEYWORDS value
*/
public void setKeywords (java.lang.String keywords) {
this.keywords = keywords;
}
/**
* Return the value associated with the column: DESCRIPTION
*/
public java.lang.String getDescription () {
return description;
}
/**
* Set the value related to the column: DESCRIPTION
* @param description the DESCRIPTION value
*/
public void setDescription (java.lang.String description) {
this.description = description;
}
/**
* Return the value associated with the column: REGISTER_STATUS
*/
public java.lang.Short getRegisterStatus () {
return registerStatus;
}
/**
* Set the value related to the column: REGISTER_STATUS
* @param registerStatus the REGISTER_STATUS value
*/
public void setRegisterStatus (java.lang.Short registerStatus) {
this.registerStatus = registerStatus;
}
/**
* Return the value associated with the column: REGISTER_RULE
*/
public java.lang.String getRegisterRule () {
return registerRule;
}
/**
* Set the value related to the column: REGISTER_RULE
* @param registerRule the REGISTER_RULE value
*/
public void setRegisterRule (java.lang.String registerRule) {
this.registerRule = registerRule;
}
/**
* Return the value associated with the column: TOPIC_HOT_COUNT
*/
public java.lang.Integer getTopicHotCount () {
return topicHotCount;
}
/**
* Set the value related to the column: TOPIC_HOT_COUNT
* @param topicHotCount the TOPIC_HOT_COUNT value
*/
public void setTopicHotCount (java.lang.Integer topicHotCount) {
this.topicHotCount = topicHotCount;
}
/**
* Return the value associated with the column: CACHE_POST_TODAY
*/
public java.lang.Integer getPostToday () {
return postToday;
}
/**
* Set the value related to the column: CACHE_POST_TODAY
* @param postToday the CACHE_POST_TODAY value
*/
public void setPostToday (java.lang.Integer postToday) {
this.postToday = postToday;
}
/**
* Return the value associated with the column: CACHE_POST_YESTERDAY
*/
public java.lang.Integer getPostYesterday () {
return postYesterday;
}
/**
* Set the value related to the column: CACHE_POST_YESTERDAY
* @param postYesterday the CACHE_POST_YESTERDAY value
*/
public void setPostYesterday (java.lang.Integer postYesterday) {
this.postYesterday = postYesterday;
}
/**
* Return the value associated with the column: CACHE_POST_MAX
*/
public java.lang.Integer getPostMax () {
return postMax;
}
/**
* Set the value related to the column: CACHE_POST_MAX
* @param postMax the CACHE_POST_MAX value
*/
public void setPostMax (java.lang.Integer postMax) {
this.postMax = postMax;
}
/**
* Return the value associated with the column: CACHE_POST_MAX_DATE
*/
public java.util.Date getPostMaxDate () {
return postMaxDate;
}
/**
* Set the value related to the column: CACHE_POST_MAX_DATE
* @param postMaxDate the CACHE_POST_MAX_DATE value
*/
public void setPostMaxDate (java.util.Date postMaxDate) {
this.postMaxDate = postMaxDate;
}
/**
* Return the value associated with the column: CACHE_TOPIC_TOTAL
*/
public java.lang.Integer getTopicTotal () {
return topicTotal;
}
/**
* Set the value related to the column: CACHE_TOPIC_TOTAL
* @param topicTotal the CACHE_TOPIC_TOTAL value
*/
public void setTopicTotal (java.lang.Integer topicTotal) {
this.topicTotal = topicTotal;
}
/**
* Return the value associated with the column: CACHE_POST_TOTAL
*/
public java.lang.Integer getPostTotal () {
return postTotal;
}
/**
* Set the value related to the column: CACHE_POST_TOTAL
* @param postTotal the CACHE_POST_TOTAL value
*/
public void setPostTotal (java.lang.Integer postTotal) {
this.postTotal = postTotal;
}
/**
* Return the value associated with the column: CACHE_USER_TOTAL
*/
public java.lang.Integer getUserTotal () {
return userTotal;
}
/**
* Set the value related to the column: CACHE_USER_TOTAL
* @param userTotal the CACHE_USER_TOTAL value
*/
public void setUserTotal (java.lang.Integer userTotal) {
this.userTotal = userTotal;
}
/**
* Return the value associated with the column: AUTO_REGISTER
*/
public java.lang.Boolean getAutoRegister () {
return autoRegister;
}
/**
* Set the value related to the column: AUTO_REGISTER
* @param autoRegister the AUTO_REGISTER value
*/
public void setAutoRegister (java.lang.Boolean autoRegister) {
this.autoRegister = autoRegister;
}
public java.lang.Boolean getEmailValidate() {
return emailValidate;
}
public void setEmailValidate(java.lang.Boolean emailValidate) {
this.emailValidate = emailValidate;
}
/**
* Return the value associated with the column: site
*/
public com.jeecms.cms.entity.main.CmsSite getSite () {
return site;
}
/**
* Set the value related to the column: site
* @param site the site value
*/
public void setSite (com.jeecms.cms.entity.main.CmsSite site) {
this.site = site;
}
/**
* Return the value associated with the column: last_user_id
*/
public com.jeecms.bbs.entity.BbsUser getLastUser () {
return lastUser;
}
/**
* Set the value related to the column: last_user_id
* @param lastUser the last_user_id value
*/
public void setLastUser (com.jeecms.bbs.entity.BbsUser lastUser) {
this.lastUser = lastUser;
}
/**
* Return the value associated with the column: REGISTER_GROUP_ID
*/
public com.jeecms.bbs.entity.BbsUserGroup getRegisterGroup () {
return registerGroup;
}
/**
* Set the value related to the column: REGISTER_GROUP_ID
* @param registerGroup the REGISTER_GROUP_ID value
*/
public void setRegisterGroup (com.jeecms.bbs.entity.BbsUserGroup registerGroup) {
this.registerGroup = registerGroup;
}
/**
* Return the value associated with the column: DEFAULT_GROUP_ID
*/
public com.jeecms.bbs.entity.BbsUserGroup getDefaultGroup () {
return defaultGroup;
}
/**
* Set the value related to the column: DEFAULT_GROUP_ID
* @param defaultGroup the DEFAULT_GROUP_ID value
*/
public void setDefaultGroup (com.jeecms.bbs.entity.BbsUserGroup defaultGroup) {
this.defaultGroup = defaultGroup;
}
public boolean equals (Object obj) {
if (null == obj) return false;
if (!(obj instanceof com.jeecms.bbs.entity.BbsConfig)) return false;
else {
com.jeecms.bbs.entity.BbsConfig bbsConfig = (com.jeecms.bbs.entity.BbsConfig) obj;
if (null == this.getId() || null == bbsConfig.getId()) return false;
else return (this.getId().equals(bbsConfig.getId()));
}
}
public int hashCode () {
if (Integer.MIN_VALUE == this.hashCode) {
if (null == this.getId()) return super.hashCode();
else {
String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
this.hashCode = hashStr.hashCode();
}
}
return this.hashCode;
}
public String toString () {
return super.toString();
}
} | [
"cn_ywb@163.com"
] | cn_ywb@163.com |
230f23b5f2490c456722856fb5af126a204fef5b | 4569dc304e5c362e4df855fb6ed2841792bb70d1 | /app/src/main/java/gerenciador/engefourjunior/com/gerenciadorengefour/SplashScreen.java | b6d4e569903e64181e920b287dbe8438343e0761 | [
"MIT"
] | permissive | LeoFuchs/SalesManager | ee08c3d94e2653dfe9c1204b8dcc423734ba9de1 | 7515dd071ace8fbf616688ad49981174aca8d3cd | refs/heads/master | 2022-12-11T07:09:29.162849 | 2020-09-14T19:20:57 | 2020-09-14T19:20:57 | 88,899,556 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package gerenciador.engefourjunior.com.gerenciadorengefour;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import java.util.Timer;
import java.util.TimerTask;
public class SplashScreen extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
new Timer().schedule(new TimerTask()
{
@Override
public void run() {
finish();
Intent it = new Intent(SplashScreen.this, MainActivity.class);
startActivity(it);
}
}, 3000);
}
}
| [
"fuchs_leo@hotmail.com"
] | fuchs_leo@hotmail.com |
9df59c8e75199718583178cea1f1b21b8bb31285 | c3468758f7aff503340e7356fbc60d6774997a22 | /app/src/main/src/com/anipr/beaconstores/OfferDetails.java | 58df5e36bcea6e2c31c3a82d33a583d461de8488 | [] | no_license | tymiles003/Beacons-Stores | 96ec4b6e6e2e1b6de2f1b38bc2fc9ba7cf20067f | 9da64eeb276518edeb330f6cd058ce445c0efb06 | refs/heads/master | 2021-04-18T19:43:38.032075 | 2015-01-22T14:00:24 | 2015-01-22T14:00:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,258 | java | package com.anipr.beaconstores;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import com.anipr.beaconstores.dbhandler.DbHelper;
public class OfferDetails extends Activity {
private TextView welcomeMsg, offerName, offerDetails;
private String offerCode;
private Cursor offerDetailCursor;
private SQLiteDatabase dbWrite;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_offer_details);
welcomeMsg = (TextView) findViewById(R.id.welcome_msg);
offerName = (TextView) findViewById(R.id.offer_name);
offerDetails = (TextView) findViewById(R.id.offer_desc);
offerCode = getIntent().getStringExtra(DbHelper.offerCode);
dbWrite = DbHelper.getInstance(getApplicationContext())
.getWritableDatabase();
String query = "SELECT * FROM " + DbHelper.OFFERS_TABLE
+ " WHERE "+DbHelper.offerCode+" = '" + offerCode + "'";
offerDetailCursor = dbWrite.rawQuery(query, null);
if (offerDetailCursor.moveToFirst()) {
if (offerDetailCursor.getString(
offerDetailCursor.getColumnIndex(DbHelper.offerType))
.equals(DbHelper.OFFER_TYPE_ENTRY+"")) {
welcomeMsg.setText(getString(R.string.entry_offer_welcome_msg));
}else{
welcomeMsg.setText(getString(R.string.exit_offer_welcome_msg));
}
}
offerName.setText(offerDetailCursor.getString(offerDetailCursor
.getColumnIndex(DbHelper.offerName)));
offerDetails.setText(offerDetailCursor.getString(offerDetailCursor
.getColumnIndex(DbHelper.offerDesc)));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.offer_details, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public static Bitmap getRoundedRectBitmap(Bitmap bitmap, int pixels) {
Bitmap result = null;
try {
result = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
int color = 0xff424242;
Paint paint = new Paint();
Rect rect = new Rect(0, 0, 200, 200);
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawCircle(50, 50, 50, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
} catch (NullPointerException e) {
} catch (OutOfMemoryError o) {
}
return result;
}
}
| [
"routbedprakash@gmail.com"
] | routbedprakash@gmail.com |
99b33ee08af47237ad0cacd55c04d4ed0095f5d8 | 5aa9e450293ea0b3df344153521faba659361717 | /src/main/java/com/huangchao/acef/service/OrdinaryArticleRichTextService.java | 7a67dd641e8c316f774bc4d423ec23ba9fd7aff2 | [] | no_license | HuangQAQ/acef | 0df6ca9cee5e90b5ee02f0ab9d36a3da08e41c61 | 80d29cd0984032547076b8411814020c75e2eb1c | refs/heads/master | 2020-07-28T21:49:29.861377 | 2019-06-30T07:51:56 | 2019-06-30T07:51:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,684 | java | package com.huangchao.acef.service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.huangchao.acef.dao.OrdinaryArticleRichTextMapper;
import com.huangchao.acef.dao.PictureMapper;
import com.huangchao.acef.entity.OrdinaryArticle;
import com.huangchao.acef.utils.CookieUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import static com.huangchao.acef.global.Common.deletePreviousPicture;
/**
* 本类为普通文章操作类
*/
@Service
public class OrdinaryArticleRichTextService {
//注入富文本活动文章操作类
@Autowired
private OrdinaryArticleRichTextMapper ordinaryArticleRichTextMapper;
//注入图片操作类
@Autowired
private PictureMapper pictureMapper;
//注入图片保存路径
@Value("${filePath}")
String filePath;
//注入图片保存路径,相对根路径
@Value("${imgPath}")
String imgPath;
//注入文章图片/海报保存路径
@Value("${activityArticleImgPath}")
String activityArticleImgPath;
//普通文章上传
public void uploadOrdinaryArticle(OrdinaryArticle oa, HttpServletRequest request, HttpServletResponse response) {
ordinaryArticleRichTextMapper.uploadOrdinaryArticle(oa);
//获取cookie
Cookie[] cookies = request.getCookies();
Cookie cookie = CookieUtil.findCookie(cookies, "articleId");
//若id为articleId的cookie为不为空或者和当前文章id相同,则认为文章上传未中断,清除保存再cookie的文章id
if (cookie != null && cookie.getValue().equals(oa.getArticleId()))
CookieUtil.saveCookie("articleId", oa.getArticleId(), response, 0);
}
//根据普通文章id删除普通文章
public void deleteOrdinaryArticle(String[] articleId) throws IOException {
if (articleId != null) {
for (int i = 0; i < articleId.length; i++) {
//删除文章中的图片
String[] imgPaths = pictureMapper.getRiceTextPictures(articleId[i]);
if (imgPaths != null) {
for (String imgUrl : imgPaths) {
//删除图片
deletePreviousPicture(imgUrl, filePath, imgPath + activityArticleImgPath);
//删除数据库中保存的图片链接
pictureMapper.deleteRichTextPicture(articleId[i]);
}
}
}
//删除文章
ordinaryArticleRichTextMapper.deleteOrdinaryArticle(articleId);
}
}
//根据普通文章id获取普通文章
public OrdinaryArticle getOneOrdinaryArticle(String articleId) {
if (articleId != null) {
OrdinaryArticle ordinaryArticle = ordinaryArticleRichTextMapper.getOneOrdinaryArticle(articleId);
//截断时间
ordinaryArticle.setDisplayTime(ordinaryArticle.getDisplayTime().substring(0, 10));
return ordinaryArticle;
} else
return null;
}
//批量获取普通文章
public PageInfo<OrdinaryArticle> getOrdinaryArticle(String language, int currentPage, int pageSize, String part) {
if (language.equals("all"))
language = null;
//对数据库的操作必须在此定义的下一条语句执行,且只有一条语句有分页效果,若要多条语句都有分页效果,需写多条本语句
Page<?> page = PageHelper.startPage(currentPage, pageSize);
List<OrdinaryArticle> ordinaryArticleList = ordinaryArticleRichTextMapper.getOrdinaryArticle(language, part);
//截断时间
for (OrdinaryArticle o : ordinaryArticleList) {
o.setDisplayTime(o.getDisplayTime().substring(0, 10));
}
//用PageInfo对结果进行包装
PageInfo<OrdinaryArticle> pageInfo = (PageInfo<OrdinaryArticle>) page.toPageInfo();
return pageInfo;
}
// 判断articleId是否已经存在,即此普通文章是否已经上传
public boolean existOrdinaryArticleId(String articleId) {
return ordinaryArticleRichTextMapper.existOrdinaryArticleId(articleId) != null;
}
//修改普通文章
public void changeOrdinaryArticle(OrdinaryArticle oa) {
ordinaryArticleRichTextMapper.changeOrdinaryArticle(oa);
}
}
| [
"1711591690@qq.com"
] | 1711591690@qq.com |
acf68b30d2317145b9f7ac411dffd24e214c1e6e | bb018e9f866e4df1df10aeaaad45b02c06cc70be | /app/src/main/java/ru/drom/gitgrep/util/OnSubscribeAddAccount.java | 2cb9bfbc2e0116d1bd59e870f23d275d045b463a | [] | no_license | vaginessa/gitgrep | 8f55d1c9262158acd7abf866d42b5afe05b74f11 | 0973ed6dee6273825f5a721f36f669217a488626 | refs/heads/master | 2021-10-10T22:23:29.912898 | 2017-04-30T09:16:12 | 2017-04-30T09:16:12 | 116,833,115 | 0 | 0 | null | 2019-01-18T09:30:33 | 2018-01-09T15:22:19 | Java | UTF-8 | Java | false | false | 7,732 | java | package ru.drom.gitgrep.util;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorActivity;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
/**
* Initiate creation of {@link Account} via {@link AccountManager} and subscribe to results.
*<p>
* You will typically want to use {@link RxAndroid#requireAccount(Builder)}
* to create Account on-demand, only if it does not exist yet.
*<p>
* This method uses {@link AccountManagerCallback} to avoid creation of separate thread
* for blocking call, and as such, won't work for non-graphical AccountAuthenticator, as well
* as implementations, incompatible with {@link AccountAuthenticatorActivity}.
* If you want to create such AccountAuthenticator (which is generally a bad idea) or need to
* work around issues of existing one, use {@link AccountManagerFuture#getResult()}
* instead.
*/
final class OnSubscribeAddAccount implements Observable.OnSubscribe<Account> {
private Activity activity;
private final String accountType;
private final String authTokenType;
private final String[] requiredFeatures;
private final Bundle addAccountOptions;
private volatile Handler handler;
/**
* Performs {@link AccountManager#addAccount(String, String, String[], Bundle, Activity, AccountManagerCallback, Handler)}
* to create an account without additional parameters. Account creation and Observable callbacks will
* be invoked on current thread or main thread (if current thread does not have a {@link Looper})
*<p>
* Use {@link #OnSubscribeAddAccount(Activity, String, Handler)} if you don't want
* current thread to be used.
*<p>
* Use {@link Builder} if you want to provide account creation parameters.
*
* @param activity used by AccountManager to launch Account creation Activity.
* @param accountType type of created Account.
*/
public OnSubscribeAddAccount(@NonNull Activity activity, @NonNull String accountType) {
this(activity, accountType, new Handler(chooseLooper()));
}
/**
* Performs {@link AccountManager#addAccount(String, String, String[], Bundle, Activity, AccountManagerCallback, Handler)}
* to create an account without additional parameters. Account creation and Observable callbacks will
* be invoked on thread, associated with specified {@link Looper}.
*<p>
* Use {@link Builder} if you want to provide account creation parameters.
*
* @param activity used by AccountManager to launch account creation Activity.
* @param accountType type of created Account.
* @param handler used to invoke account creation and callbacks.
*/
public OnSubscribeAddAccount(@NonNull Activity activity, @NonNull String accountType, @NonNull Handler handler) {
this(activity, accountType, handler, null, null, null);
}
private OnSubscribeAddAccount(Activity activity, String accountType, Handler handler,
String authTokenType,
String[] requiredFeatures,
Bundle addAccountOptions) {
if (activity == null || TextUtils.isEmpty(accountType))
throw new IllegalArgumentException("activity and account type must be specified");
this.activity = activity;
this.accountType = accountType;
this.handler = handler;
this.authTokenType = authTokenType;
this.requiredFeatures = requiredFeatures;
this.addAccountOptions = addAccountOptions;
}
@Override
public void call(final Subscriber<? super Account> subscriber) {
if (handler == null) {
handler = new Handler(chooseLooper());
}
if (Thread.currentThread() == handler.getLooper().getThread()) {
subscribe(subscriber);
} else {
// follow the Observable contract if isn't subscribed to on the same thread as created
handler.post(() -> subscribe(subscriber));
}
}
private void subscribe(final Subscriber<? super Account> subscriber) {
final Context appContext = activity.getApplication();
final AccountManager am = AccountManager.get(appContext);
final AccountManagerCallback<Bundle> callback = new AccountManagerCallback<Bundle>() {
@Override
public void run(AccountManagerFuture<Bundle> future) {
if (subscriber.isUnsubscribed())
return;
Exception errorDescription = null;
try {
final Bundle results = future.getResult();
Account[] accs = am.getAccountsByType(accountType);
if (accs.length == 0) {
errorDescription = new IllegalStateException("No Account created; results: " + results);
} else {
for (Account acc:accs) {
subscriber.onNext(acc);
}
subscriber.onCompleted();
}
} catch (Exception e) {
errorDescription = e;
} finally {
if (errorDescription != null) {
subscriber.onError(errorDescription);
}
}
}
};
final AccountManagerFuture<Bundle> f = am.addAccount(accountType,
authTokenType, requiredFeatures, addAccountOptions, activity, callback, handler);
// slightly reduce chance of leak, if something goes terribly wrong
activity = null;
subscriber.add(RxAndroid.unsubscribeInHandlerThread(new Action0() {
@Override
public void call() {
f.cancel(true);
}
}, handler));
}
public final static class Builder {
final Activity activity;
final String accountType;
private Handler handler;
private String authTokenType;
private String[] requiredFeatures;
private Bundle addAccountOptions;
public Builder(@NonNull Activity activity, @NonNull String accountType) {
this.activity = activity;
this.accountType = accountType;
}
public Builder setHandler(Handler handler) {
this.handler = handler;
return this;
}
public Builder setAuthTokenType(String authTokenType) {
this.authTokenType = authTokenType;
return this;
}
public Builder setAddAccountOptions(Bundle addAccountOptions) {
this.addAccountOptions = addAccountOptions;
return this;
}
public Builder setRequiredFeatures(String... requiredFeatures) {
this.requiredFeatures = requiredFeatures;
return this;
}
public OnSubscribeAddAccount build() {
return new OnSubscribeAddAccount(
activity,
accountType,
handler,
authTokenType,
requiredFeatures,
addAccountOptions);
}
}
private static Looper chooseLooper() {
return Looper.myLooper() == null ? Looper.getMainLooper() : Looper.myLooper();
}
} | [
"alexander.r@gmx.com"
] | alexander.r@gmx.com |
ec946bfd4bacdd1267bec5db599b5a90f93c0ad0 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/fastjson/2016/12/FastJsonProvider.java | f3343e605986d7bd5d9f665af2f11c8ee9303474 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 9,245 | java | package com.alibaba.fastjson.support.jaxrs;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.util.IOUtils;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Fastjson for JAX-RS Provider.
*
* @author smallnest
* @author VictorZeng
* @see MessageBodyReader
* @see MessageBodyWriter
* @since 1.2.9
*/
@Provider
@Consumes({MediaType.WILDCARD})
@Produces({MediaType.WILDCARD})
public class FastJsonProvider //
implements MessageBodyReader<Object>, MessageBodyWriter<Object> {
@Deprecated
protected Charset charset = IOUtils.UTF8;
@Deprecated
protected SerializerFeature[] features = new SerializerFeature[0];
@Deprecated
protected SerializeFilter[] filters = new SerializeFilter[0];
@Deprecated
protected String dateFormat;
/**
* with fastJson config
*/
private FastJsonConfig fastJsonConfig = new FastJsonConfig();
/**
* allow serialize/deserialize types in clazzes
*/
private Class<?>[] clazzes = null;
/**
* whether set PrettyFormat while exec WriteTo()
*/
private boolean pretty;
/**
* @return the fastJsonConfig.
* @since 1.2.11
*/
public FastJsonConfig getFastJsonConfig() {
return fastJsonConfig;
}
/**
* @param fastJsonConfig the fastJsonConfig to set.
* @since 1.2.11
*/
public void setFastJsonConfig(FastJsonConfig fastJsonConfig) {
this.fastJsonConfig = fastJsonConfig;
}
/**
* Can serialize/deserialize all types.
*/
public FastJsonProvider() {
}
/**
* Only serialize/deserialize all types in clazzes.
*/
public FastJsonProvider(Class<?>[] clazzes) {
this.clazzes = clazzes;
}
/**
* Set pretty format
*/
public FastJsonProvider setPretty(boolean p) {
this.pretty = p;
return this;
}
/**
* Set charset. the default charset is UTF-8
*/
@Deprecated
public FastJsonProvider(String charset) {
this.fastJsonConfig.setCharset(Charset.forName(charset));
}
@Deprecated
public Charset getCharset() {
return this.fastJsonConfig.getCharset();
}
@Deprecated
public void setCharset(Charset charset) {
this.fastJsonConfig.setCharset(charset);
}
@Deprecated
public String getDateFormat() {
return this.fastJsonConfig.getDateFormat();
}
@Deprecated
public void setDateFormat(String dateFormat) {
this.fastJsonConfig.setDateFormat(dateFormat);
}
@Deprecated
public SerializerFeature[] getFeatures() {
return this.fastJsonConfig.getSerializerFeatures();
}
@Deprecated
public void setFeatures(SerializerFeature... features) {
this.fastJsonConfig.setSerializerFeatures(features);
}
@Deprecated
public SerializeFilter[] getFilters() {
return this.fastJsonConfig.getSerializeFilters();
}
@Deprecated
public void setFilters(SerializeFilter... filters) {
this.fastJsonConfig.setSerializeFilters(filters);
}
/**
* Check whether a class can be serialized or deserialized. It can check
* based on packages, annotations on entities or explicit classes.
*
* @param type class need to check
* @return true if valid
*/
protected boolean isValidType(Class<?> type, Annotation[] classAnnotations) {
if (type == null)
return false;
if (clazzes != null) {
for (Class<?> cls : clazzes) { // must strictly equal. Don't check
// inheritance
if (cls == type)
return true;
}
return false;
}
return true;
}
/**
* Check media type like "application/json".
*
* @param mediaType media type
* @return true if the media type is valid
*/
protected boolean hasMatchingMediaType(MediaType mediaType) {
if (mediaType != null) {
String subtype = mediaType.getSubtype();
return (("json".equalsIgnoreCase(subtype)) //
|| (subtype.endsWith("+json")) //
|| ("javascript".equals(subtype)) //
|| ("x-javascript".equals(subtype)) //
|| ("x-json".equals(subtype)) //
|| ("x-www-form-urlencoded".equalsIgnoreCase(subtype)) //
|| (subtype.endsWith("x-www-form-urlencoded")));
}
return true;
}
/*
* /********************************************************** /* Partial
* MessageBodyWriter impl
* /**********************************************************
*/
/**
* Method that JAX-RS container calls to try to check whether given value
* (of specified type) can be serialized by this provider.
*/
public boolean isWriteable(Class<?> type, //
Type genericType, //
Annotation[] annotations, //
MediaType mediaType) {
if (!hasMatchingMediaType(mediaType)) {
return false;
}
return isValidType(type, annotations);
}
/**
* Method that JAX-RS container calls to try to figure out serialized length
* of given value. always return -1 to denote "not known".
*/
public long getSize(Object t, //
Class<?> type, //
Type genericType, //
Annotation[] annotations, //
MediaType mediaType) {
return -1;
}
/**
* Method that JAX-RS container calls to serialize given value.
*/
public void writeTo(Object obj, //
Class<?> type, //
Type genericType, //
Annotation[] annotations, //
MediaType mediaType, //
MultivaluedMap<String, Object> httpHeaders, //
OutputStream entityStream //
) throws IOException, WebApplicationException {
SerializerFeature[] serializerFeatures = fastJsonConfig.getSerializerFeatures();
if (pretty) {
if (serializerFeatures == null)
serializerFeatures = new SerializerFeature[]{SerializerFeature.PrettyFormat};
else {
List<SerializerFeature> featureList = new ArrayList<SerializerFeature>(Arrays
.asList(serializerFeatures));
featureList.add(SerializerFeature.PrettyFormat);
serializerFeatures = featureList.toArray(serializerFeatures);
}
fastJsonConfig.setSerializerFeatures(serializerFeatures);
}
int len = JSON.writeJSONString(entityStream, //
fastJsonConfig.getCharset(), //
obj, //
fastJsonConfig.getSerializeConfig(), //
fastJsonConfig.getSerializeFilters(), //
fastJsonConfig.getDateFormat(), //
JSON.DEFAULT_GENERATE_FEATURE, //
fastJsonConfig.getSerializerFeatures());
// add Content-Length
httpHeaders.add("Content-Length", len);
entityStream.flush();
}
/*
* /********************************************************** /*
* MessageBodyReader impl
* /**********************************************************
*/
/**
* Method that JAX-RS container calls to try to check whether values of
* given type (and media type) can be deserialized by this provider.
*/
public boolean isReadable(Class<?> type, //
Type genericType, //
Annotation[] annotations, //
MediaType mediaType) {
if (!hasMatchingMediaType(mediaType)) {
return false;
}
return isValidType(type, annotations);
}
/**
* Method that JAX-RS container calls to deserialize given value.
*/
public Object readFrom(Class<Object> type, //
Type genericType, //
Annotation[] annotations, //
MediaType mediaType, //
MultivaluedMap<String, String> httpHeaders, //
InputStream entityStream) throws IOException, WebApplicationException {
return JSON.parseObject(entityStream, fastJsonConfig.getCharset(), genericType, fastJsonConfig.getFeatures());
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
b900453f3b859016f5dd94c64a9c5c6cbd19d516 | 60172c192e2ed2fa3b822d251e184c99a132f484 | /代码/mysql_wade/cashiersys/src/com/linkage/common/components/Suggest.java | cfee31b942eb0b102d891f61ba62e8c0008a94a2 | [] | no_license | wangscript/kawasaka-web | a73087df301b8ec6e894c7fa8f133c940b44409e | 70f9917e280e7d20271f9f0242289e145356a74a | refs/heads/master | 2020-04-30T23:29:27.833981 | 2011-12-13T11:04:28 | 2011-12-13T11:04:28 | 39,171,839 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,783 | java | package com.linkage.common.components;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.IForm;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.html.Body;
import com.linkage.appframework.data.DataMap;
import com.linkage.appframework.data.DatasetList;
import com.linkage.appframework.data.IData;
import com.linkage.appframework.data.IDataset;
import com.linkage.webframework.tapestry.components.BaseFormComponent;
public abstract class Suggest extends BaseFormComponent
{
public abstract String getValue();
public abstract Object getModel();
public abstract String getStyle();
public abstract String getEnterAction();
//public abstract void setUploads(IDataset uploads);
//public abstract void setOtherConnectInfos(IDataset otherConnectInfos);
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
IForm form = getForm(cycle);
String name = form.getElementId(this);
String value = getValue();
Object model = getModel();
String style = getStyle();
String enterAction = getEnterAction();
IDataset dataModel = null;
if (model == null) {
model = new DatasetList();
}
if ((model == null) || (model instanceof IDataset)) {
dataModel = (IDataset)model;
} else if (model instanceof IPropertySelectionModel) {
dataModel = convertToDataset((IPropertySelectionModel)model);
} else {
throw new ApplicationRuntimeException("Suggest component " + name + ": type of parameter model is no other than com.linkage.appframework.data.IDataset or org.apache.tapestry.form.IPropertySelectionModel.");
}
if (!cycle.isRewinding()) {
Body body = Body.get(cycle);
if (body == null) {
throw new ApplicationRuntimeException(Tapestry.format(
"must-be-contained-by-body", "Suggest"));
}
//String value = getValue();
//body.includeExternalScript(writer, "./common/scripts/suggest.js");
writer.beginEmpty("input");
writer.attribute("type", "hidden");
writer.attribute("name", name);
writer.attribute("id", name);
writer.attribute("value", value);
renderInformalParameters(writer, cycle);
writer.beginEmpty("input");
writer.attribute("type", "text");
writer.attribute("name", "input_" + name);
writer.attribute("id", "input_" + name);
writer.attribute("value", "");
writer.attribute("autocomplete", "off");
writer.attribute("style", style);
if (enterAction != null) writer.attribute("onkeypress", "if (window.event.keyCode == 13) { Wade.event.stopEvent(); return " + enterAction + "; }");
renderInformalParameters(writer, cycle);
writer.printRaw("\r\n");
writer.printRaw("<div id=\"suggest_" + name + "\" style=\"z-index:100;display:none;\"></div>\r\n");
writer.printRaw("<script type=\"text/javascript\" src=\"./common/scripts/suggest.js\"></script>\r\n");
StringBuffer html = new StringBuffer();
html.append("<script>");
html.append("document.getElementById(\"" + "input_" + name + "\").style.display = \"block\";");
html.append("var suggestCode"+ name +"List = [];");
html.append("var suggestText"+ name +"List = [];");
for (int i = 0; i < dataModel.size(); ++i) {
IData data = (IData)dataModel.get(i);
html.append("suggestCode"+ name +"List.push(\""+ data.getString("DATA_ID") +"\");");
html.append("suggestText"+ name +"List.push(\""+ pinjieStr(data.getString("DATA_NAME")) +"\");");
}
html.append("var suggest = new Suggest.Local(\""+ name +"\",\""+ "input_" + name +"\", \"" + "suggest_" + name +"\", suggestCode"+ name +"List, suggestText"+ name +"List, {dispAllKey: true});");
html.append("</script>");
html.append("\r\n");
writer.printRaw(html.toString());
}
}
private IDataset convertToDataset(IPropertySelectionModel model) {
IDataset dataset = new DatasetList();
int count = model.getOptionCount();
for (int i = 0; i < count; ++i) {
IData data = new DataMap();
String value = model.getValue(i);
if (value != null) {
if (!"".equals(value)){
data.put("DATA_ID", model.getValue(i));
data.put("DATA_NAME", model.getLabel(i));
dataset.add(data);
}
}
}
return dataset;
}
private String pinjieStr(String src){
return makeStringToPinyin(src) + ":" + src;
}
private String makeStringToPinyin(String src){
StringBuilder outStr = new StringBuilder();
if(src!=null && !src.trim().equalsIgnoreCase("")){
char[] srcChar ;
srcChar=src.toCharArray();
//汉语拼音格式输出类
HanyuPinyinOutputFormat hanYuPinOutputFormat = new HanyuPinyinOutputFormat();
//输出设置,大小写,音标方式等
hanYuPinOutputFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE);
hanYuPinOutputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
hanYuPinOutputFormat.setVCharType(HanyuPinyinVCharType.WITH_V);
String[] temp = new String[src.length()];
for(int i=0;i<srcChar.length;i++){
char c = srcChar[i];
//是中文或者a-z或者A-Z转换拼音(我的需求,是保留中文或者a-z或者A-Z)
if(String.valueOf(c).matches("[\\u4E00-\\u9FA5]+")){
try{
String tmp[] = PinyinHelper.toHanyuPinyinStringArray(srcChar[i], hanYuPinOutputFormat);
temp[i] = tmp[0].substring(0, 1);
}catch(BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
}else if(((int)c>=65 && (int)c<=90) || ((int)c>=97 && (int)c<=122)){
temp[i] = String.valueOf(srcChar[i]);
}else{
temp[i] = String.valueOf(srcChar[i]);
}
}
int i=0;
for(String s : temp){
if(i == temp.length - 1){
outStr.append(s);
}else{
outStr.append(s + "");
}
i++;
}
}
return outStr.toString();
}
}
| [
"153166355@qq.com"
] | 153166355@qq.com |
7051626ade731d5cdf23022461d58ed8b3a1d339 | 4902adfb7a5b6347121b0ea8e46a87e32b453981 | /app/src/main/java/com/weizhan/superlook/widget/banners/Transformer.java | 249fe17d5f4f43bb9807c526cf74a8ce28ef0ec8 | [] | no_license | cherry-cheng/PlayDemo | 5098cd8f8062fc267e26858114bdf1440b9c62de | d3d1b55f8c96f7d2f4b9393fb261cd088b04920e | refs/heads/master | 2020-04-06T09:58:49.223906 | 2018-11-19T10:51:25 | 2018-11-19T10:51:25 | 157,364,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,064 | java | package com.weizhan.superlook.widget.banners;
import android.support.v4.view.ViewPager.PageTransformer;
import com.weizhan.superlook.widget.banners.transformer.AccordionTransformer;
import com.weizhan.superlook.widget.banners.transformer.BackgroundToForegroundTransformer;
import com.weizhan.superlook.widget.banners.transformer.CubeInTransformer;
import com.weizhan.superlook.widget.banners.transformer.CubeOutTransformer;
import com.weizhan.superlook.widget.banners.transformer.DefaultTransformer;
import com.weizhan.superlook.widget.banners.transformer.DepthPageTransformer;
import com.weizhan.superlook.widget.banners.transformer.FlipHorizontalTransformer;
import com.weizhan.superlook.widget.banners.transformer.FlipVerticalTransformer;
import com.weizhan.superlook.widget.banners.transformer.ForegroundToBackgroundTransformer;
import com.weizhan.superlook.widget.banners.transformer.RotateDownTransformer;
import com.weizhan.superlook.widget.banners.transformer.RotateUpTransformer;
import com.weizhan.superlook.widget.banners.transformer.ScaleInOutTransformer;
import com.weizhan.superlook.widget.banners.transformer.StackTransformer;
import com.weizhan.superlook.widget.banners.transformer.TabletTransformer;
import com.weizhan.superlook.widget.banners.transformer.ZoomInTransformer;
import com.weizhan.superlook.widget.banners.transformer.ZoomOutSlideTransformer;
import com.weizhan.superlook.widget.banners.transformer.ZoomOutTranformer;
public class Transformer {
public static Class<? extends PageTransformer> Default = DefaultTransformer.class;
public static Class<? extends PageTransformer> Accordion = AccordionTransformer.class;
public static Class<? extends PageTransformer> BackgroundToForeground = BackgroundToForegroundTransformer.class;
public static Class<? extends PageTransformer> ForegroundToBackground = ForegroundToBackgroundTransformer.class;
public static Class<? extends PageTransformer> CubeIn = CubeInTransformer.class;
public static Class<? extends PageTransformer> CubeOut = CubeOutTransformer.class;
public static Class<? extends PageTransformer> DepthPage = DepthPageTransformer.class;
public static Class<? extends PageTransformer> FlipHorizontal = FlipHorizontalTransformer.class;
public static Class<? extends PageTransformer> FlipVertical = FlipVerticalTransformer.class;
public static Class<? extends PageTransformer> RotateDown = RotateDownTransformer.class;
public static Class<? extends PageTransformer> RotateUp = RotateUpTransformer.class;
public static Class<? extends PageTransformer> ScaleInOut = ScaleInOutTransformer.class;
public static Class<? extends PageTransformer> Stack = StackTransformer.class;
public static Class<? extends PageTransformer> Tablet = TabletTransformer.class;
public static Class<? extends PageTransformer> ZoomIn = ZoomInTransformer.class;
public static Class<? extends PageTransformer> ZoomOut = ZoomOutTranformer.class;
public static Class<? extends PageTransformer> ZoomOutSlide = ZoomOutSlideTransformer.class;
}
| [
"chengyonghui@yizhanit.com"
] | chengyonghui@yizhanit.com |
75cf69de9866b0db3ad41eaa914917cbb219de3e | 760508a4d9eb914f84ad747428651ae44b7f81e0 | /FinalProject_fourMyung/src/main/java/fourMyung/Command/KaKaoPayReadyCommand.java | 3c35c561a9a0940691e77a67c2c1fc929c727adc | [] | no_license | Choiyunsuk92/FourMyung_Project | 81e1e3d2fa26b3815ab29b1bf9be9f9dd1d58efc | 61d50995782928901f76888070e317e7724e87ee | refs/heads/master | 2023-01-08T17:18:55.609247 | 2020-11-12T07:07:51 | 2020-11-12T07:07:51 | 297,205,592 | 0 | 0 | null | 2020-10-12T06:58:57 | 2020-09-21T02:15:23 | HTML | UTF-8 | Java | false | false | 197 | java | package fourMyung.Command;
import java.util.Date;
import lombok.Data;
@Data
public class KaKaoPayReadyCommand {
private String tid, next_redirect_pc_url;
private Date created_at;
}
| [
"사용자@LAPTOP-9IFJ2FT0"
] | 사용자@LAPTOP-9IFJ2FT0 |
0428861e76da512b3bd9268829a38e76447699cd | e5d739a063a1cf76ffe62bdefc57b62f75e841a9 | /src/main/java/nl/bsoft/data/graphql/model/postgresql/Vehicle.java | 0237db4a475f4d889b5a9c3ad65e845ec9c3bf9d | [
"MIT"
] | permissive | bvpelt/graphql | a104d22d01056e1c02866c40a1a15fa2366fb3de | 1bf733a0dc1273d9c5cf718a545418b47e18a4e9 | refs/heads/master | 2021-07-24T21:27:36.105191 | 2019-12-04T18:22:08 | 2019-12-04T18:22:08 | 225,834,303 | 0 | 0 | MIT | 2020-10-13T17:58:26 | 2019-12-04T09:56:31 | Java | UTF-8 | Java | false | false | 844 | java | package nl.bsoft.data.graphql.model.postgresql;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.*;
import java.time.LocalDate;
@Data
@EqualsAndHashCode
@Entity
@Table(name = "VEHICLE")
public class Vehicle {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@Column(name = "type", nullable = false)
private String type;
@Column(name = "model_code", nullable = false)
private String modelCode;
@Column(name = "brand_name")
private String brandName;
@Column(name = "launch_date")
private LocalDate launchDate;
private transient String formattedDate; // Getter and setter public String getFormattedDate() { return getLaunchDate().toString(); }
}
| [
"bart.vanpelt@gmail.com"
] | bart.vanpelt@gmail.com |
22e99b9c3e6966255aeac38d7c52af6edc2c432a | de5c496b0ae24e5c61075b1ba0ea6248909c8980 | /src/main/java/com/luoyifan/voyage/constants/PlatformEnum.java | 92e3278eecf75afd0548d1fff1284a78301f5332 | [
"MIT"
] | permissive | woluoyifan/voyage-clone | 578a127b8260e256799e3050a6ae631b4804f619 | b5a43c9f1811a225d43220b23e75e68b30f0d579 | refs/heads/master | 2022-06-22T07:15:27.140069 | 2020-01-04T05:55:59 | 2020-01-04T05:55:59 | 230,713,655 | 0 | 0 | MIT | 2022-06-21T02:32:18 | 2019-12-29T06:43:46 | Java | UTF-8 | Java | false | false | 397 | java | package com.luoyifan.voyage.constants;
/**
* @author EvanLuo
*/
public enum PlatformEnum {
WINDOWS("Windows"),
MAC("MacOS"),
ANDROID("Android"),
LINUX("Linux"),
UNKNOWN("未知");
private String description;
PlatformEnum(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
| [
"woluoyifan@foxmail.com"
] | woluoyifan@foxmail.com |
eda3b842a7972f7348da6d88e470a26ee163387a | eb5af3e0f13a059749b179c988c4c2f5815feb0f | /eclipsecode/java_se/src/com/woniu/chapter12_Extends_workT_vhicle/Car.java | dc5feb980010d21c2337a0871efaeaaecc14cf55 | [] | no_license | xiakai007/wokniuxcode | ae686753da5ec3dd607b0246ec45fb11cf6b8968 | d9918fb349bc982f0ee9d3ea3bf7537e11d062a2 | refs/heads/master | 2023-04-13T02:54:15.675440 | 2021-05-02T05:09:47 | 2021-05-02T05:09:47 | 363,570,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package com.woniu.chapter12_Extends_workT_vhicle;
public class Car extends MotoVehicle {
private String type;
public Car(String no,String brand,String type) {
super(no,brand);
this.type = type;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public int calRent(int days) {
if("1".equals(type)) {
return days*500;
}else if("2".equals(type)) {
return days*600;
}else {
return days*300;
}
}
}
| [
"980385778@qq.com"
] | 980385778@qq.com |
302fadff531320ab2c284fb78723792897300cf4 | 891691776a65c9f55ea13fe13a4cc769f8f23e86 | /chapter01_myfirstapp/src/main/java/ru/fedorsirotkin/chapter01_myfirstapp/MainActivity.java | 6a9783992e6b48c9b48cbfd182cc9bf787d855b1 | [] | no_license | fedorsirotkin/HeadFirstAndroid | 7522749cf5c49950194c1b76ac4dcc74e24fa917 | a2d501b539d6866fa2ae9381792a7f8bbbaae33a | refs/heads/master | 2020-06-29T12:14:18.880936 | 2019-08-26T16:50:01 | 2019-08-26T16:50:01 | 200,531,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | // Имя пакета
package ru.fedorsirotkin.chapter01_myfirstapp;
// Классы Android, используемые в MainActivity
import android.app.Activity;
import android.os.Bundle;
// MainActivity расширяет класс Activity
public class MainActivity extends Activity {
// Реализация метода onCreate() из класса Activity.
// Вызывается при первом создании активности
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Указывает, какой макет должен использоваться
setContentView(R.layout.activity_main);
}
}
| [
"fedorsirotkin@mail.ru"
] | fedorsirotkin@mail.ru |
219105134cf79ca6ed4b8f293a9d3769be1e2182 | b2f07f3e27b2162b5ee6896814f96c59c2c17405 | /java/security/spec/ECPoint.java | 82ed7b317af6d0b02107b325f6b2935c3739f933 | [] | no_license | weiju-xi/RT-JAR-CODE | e33d4ccd9306d9e63029ddb0c145e620921d2dbd | d5b2590518ffb83596a3aa3849249cf871ab6d4e | refs/heads/master | 2021-09-08T02:36:06.675911 | 2018-03-06T05:27:49 | 2018-03-06T05:27:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,805 | java | /* */ package java.security.spec;
/* */
/* */ import java.math.BigInteger;
/* */
/* */ public class ECPoint
/* */ {
/* */ private final BigInteger x;
/* */ private final BigInteger y;
/* 47 */ public static final ECPoint POINT_INFINITY = new ECPoint();
/* */
/* */ private ECPoint()
/* */ {
/* 51 */ this.x = null;
/* 52 */ this.y = null;
/* */ }
/* */
/* */ public ECPoint(BigInteger paramBigInteger1, BigInteger paramBigInteger2)
/* */ {
/* 64 */ if ((paramBigInteger1 == null) || (paramBigInteger2 == null)) {
/* 65 */ throw new NullPointerException("affine coordinate x or y is null");
/* */ }
/* 67 */ this.x = paramBigInteger1;
/* 68 */ this.y = paramBigInteger2;
/* */ }
/* */
/* */ public BigInteger getAffineX()
/* */ {
/* 77 */ return this.x;
/* */ }
/* */
/* */ public BigInteger getAffineY()
/* */ {
/* 86 */ return this.y;
/* */ }
/* */
/* */ public boolean equals(Object paramObject)
/* */ {
/* 97 */ if (this == paramObject) return true;
/* 98 */ if (this == POINT_INFINITY) return false;
/* 99 */ if ((paramObject instanceof ECPoint)) {
/* 100 */ return (this.x.equals(((ECPoint)paramObject).x)) && (this.y.equals(((ECPoint)paramObject).y));
/* */ }
/* */
/* 103 */ return false;
/* */ }
/* */
/* */ public int hashCode()
/* */ {
/* 111 */ if (this == POINT_INFINITY) return 0;
/* 112 */ return this.x.hashCode() << 5 + this.y.hashCode();
/* */ }
/* */ }
/* Location: C:\Program Files\Java\jdk1.7.0_79\jre\lib\rt.jar
* Qualified Name: java.security.spec.ECPoint
* JD-Core Version: 0.6.2
*/ | [
"yuexiahandao@gmail.com"
] | yuexiahandao@gmail.com |
6e7de8a12a4c7d37d050f6031ebaa639823392d2 | 003c5c763306eb26d7f01dd6530a0cff54cfc6f5 | /src/main/java/consumer/ConsumerStringSASL.java | 779d8824083d733ab4cfbb5e3a808b0b5ab5a088 | [] | no_license | HerveRiviere/kafka-examples | 16f8e2c03a037b26306875ca7b764b7fb3564bad | f82187f89d305a9d47d4814f622fac22e15984ed | refs/heads/master | 2021-06-13T08:19:26.100951 | 2017-02-25T22:57:28 | 2017-02-25T22:57:28 | 79,327,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,933 | java | package consumer;
import org.apache.kafka.clients.consumer.*;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.serialization.StringDeserializer;
import java.util.*;
public class ConsumerStringSASL {
public static void main(String[] args) {
Properties props = new Properties();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9093");//SASL-PLAINTEXT
props.put(ConsumerConfig.GROUP_ID_CONFIG, "my_group");
props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true");
props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000");
props.put("security.protocol", "SASL_PLAINTEXT");
props.put("sasl.mechanism", "PLAIN");
props.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=alice password=alice-secret;");
props = ConsumerConfig.addDeserializerToConfig(props, new StringDeserializer(), new StringDeserializer());
List<String> topics_to_consume = Arrays.asList("my-topic");
KafkaConsumer<String, String> consumer = null;
try {
consumer = new KafkaConsumer<>(props);
consumer.subscribe(topics_to_consume);
consumer.poll(0);
HashMap<TopicPartition, Long> timePartition = new HashMap<TopicPartition, Long>();
//Look at all assignated partitions
Iterator<TopicPartition> partitions = consumer.assignment().iterator();
while (partitions.hasNext()) {
TopicPartition partition = partitions.next();
System.out.println(String.format("Got partition %d assignated from topic : %s", partition.partition(), partition.topic()));
timePartition.put(partition, 0L);//seek earliest offet
}
//Go to earliest offset for each partition
Iterator<Map.Entry<TopicPartition, OffsetAndTimestamp>> offsets = consumer.offsetsForTimes(timePartition).entrySet().iterator();
while (offsets.hasNext()) {
Map.Entry<TopicPartition, OffsetAndTimestamp> offset = offsets.next();
System.out.println(String.format("Consumer will go to : Topic %s partition %d : offset : %d", offset.getKey().topic(), offset.getKey().partition(), offset.getValue().offset()));
consumer.seek(offset.getKey(), offset.getValue().offset());
}
//Consume message
while (true) {
ConsumerRecords<String, String> records = consumer.poll(100);
for (ConsumerRecord<String, String> record : records)
System.out.printf("offset = %d, key = %s, partition = %s, value = %s timestamp = %s \n", record.offset(), record.key(), record.partition(), record.value(), new Date(record.timestamp()).toString());
}
} finally {
consumer.close();
}
}
}
| [
"hriviere@anonymous.com"
] | hriviere@anonymous.com |
c0e649626b9696a2bebafd349206cf3c034f1921 | ad91719cc0193918abd605b9424ff44e07883540 | /le-tbtSps/trunk/le-tbtSps-webservice/src/main/java/com/letv/tbtSps/sdk/api/response/dto/RelationTbrelationMedicineProductResponseDto.java | 64fb75848a0e51b1498600f52a6d2780d2452714 | [] | no_license | 267062491/review | 0f25289bad673a5344e246d120a9fd221ba1c8a6 | a0b33dd5e58934587f608d6cadf3a32de5b1e31b | refs/heads/master | 2021-01-22T22:28:29.812317 | 2017-11-26T13:21:59 | 2017-11-26T13:21:59 | 85,545,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,303 | java | package com.letv.tbtSps.sdk.api.response.dto;
import com.letv.common.sdk.api.dto.LetvDto;
import java.util.Date;
/**
* RelationTbrelationMedicineProductResponse:tbt信息表-相关农产品关联表返回对象<br/>
* 提供rest接口时方法的返回对象
*
* @author yuguodong
* @version 2017-3-25 22:43:05
*
*/
public class RelationTbrelationMedicineProductResponseDto extends LetvDto {
/** 序列化标识 */
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 相关农产品 */
private String relationMedicineProductCode;
/** sps编码 */
private String spsCode;
/** 创建时间 */
private Date createTime;
/** 修改时间 */
private Date updateTime;
/** 创建人 */
private String createUser;
/** 修改人 */
private String updateUser;
/** yn */
private Integer yn;
public Long getId(){
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRelationMedicineProductCode(){
return relationMedicineProductCode;
}
public void setRelationMedicineProductCode(String relationMedicineProductCode) {
this.relationMedicineProductCode = relationMedicineProductCode;
}
public String getSpsCode(){
return spsCode;
}
public void setSpsCode(String spsCode) {
this.spsCode = spsCode;
}
public Date getCreateTime(){
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime(){
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getCreateUser(){
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public String getUpdateUser(){
return updateUser;
}
public void setUpdateUser(String updateUser) {
this.updateUser = updateUser;
}
public Integer getYn(){
return yn;
}
public void setYn(Integer yn) {
this.yn = yn;
}
}
| [
"207062491@qq.com"
] | 207062491@qq.com |
514e2cf898a4cc0598c48a14ebc384df9d3b09fe | 8ae17726b0de5e18aef08a8ab9d624fb306c292e | /src/main/java/com/beecode/rest/RestProductController.java | c82e9afa4fb23b12426d55d7be5383aaa1437f3d | [] | no_license | JoelRCVargas/santiandsophe-services | c3bc41f8d6e4345ce07280bf4d87bc9f5dfec436 | 5901036cc2e453a7e3affbdca25d6d312eff3d5f | refs/heads/master | 2023-01-02T21:15:38.754002 | 2020-10-21T17:20:00 | 2020-10-21T17:20:00 | 306,100,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,845 | java | package com.beecode.rest;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.beecode.entity.Product;
import com.beecode.interfaces.ProductService;
import com.beecode.projection.ProductCardProjection;
import com.beecode.projection.ProductProjection;
@RestController
public class RestProductController {
@Autowired
private ProductService productService;
@GetMapping(value = "/public/product/all", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<List<Product>> getAllProduct(){
return ResponseEntity.ok().body(productService.getAllProduct());
}
//Get products -> Home
@GetMapping(value = "/public/product/pagination", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<Page<ProductCardProjection>> getAllProductPage(Pageable pageable ,@RequestParam("pageNo")
int pageNo, @RequestParam("pageSize") int pageSize, @RequestParam("type") List<String> type){
return ResponseEntity.ok().body(this.productService.getProductPage(pageable, pageNo, pageSize, type));
}
//Get products -> Menu
@GetMapping(value = "/public/product/by/type", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<Collection<ProductProjection>> getProductsByType(){
return ResponseEntity.ok().body(productService.getCustomProducts());
}
//Get products -> Search
@GetMapping(value = "/public/product/like/name", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<Slice<ProductProjection>> getProductsLikeName(@RequestParam("name") String name){
return ResponseEntity.ok().body(productService.getLikeCustomProductsByName(name, PageRequest.of(0, 7)));
}
//Get products -> Details
@GetMapping(value = "/public/product/bysku", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<Optional<Product>> getProductBySku(@RequestParam("sku") String sku){
return ResponseEntity.ok().body(productService.getBySku(sku));
}
//Get products by category id
@GetMapping(value = "/public/product/by/category/id", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<Collection<ProductCardProjection>> getProductByCategoryId(@RequestParam("id_category") Long id ){
return ResponseEntity.ok().body(productService.getProductProjectionByCategoryId(id));
}
//Create products
@PostMapping(value = "/admin/product/create", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<Product> bannerCreate(@RequestBody Product product){
return ResponseEntity.ok().body(productService.createProduct(product));
}
@GetMapping(value = "/admin/product/delete", consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = {
MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<String> deleteBannerById(@RequestParam("id_product") Long productId) {
return this.productService.deleteProduct(productId);
}
}
| [
"infobeecompany@gmail.com"
] | infobeecompany@gmail.com |
1bb65e666b76b0c7844bcb8a8b8439c61d72db6b | b00c54389a95d81a22e361fa9f8bdf5a2edc93e3 | /external/conscrypt/src/main/java/org/conscrypt/ClientSessionContext.java | d2e23c9a219dea7a0c0082756def851e087c5036 | [] | no_license | mirek190/x86-android-5.0 | 9d1756fa7ff2f423887aa22694bd737eb634ef23 | eb1029956682072bb7404192a80214189f0dc73b | refs/heads/master | 2020-05-27T01:09:51.830208 | 2015-10-07T22:47:36 | 2015-10-07T22:47:36 | 41,942,802 | 15 | 20 | null | 2020-03-09T00:21:03 | 2015-09-05T00:11:19 | null | UTF-8 | Java | false | false | 4,417 | java | /*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.conscrypt;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.SSLSession;
/**
* Caches client sessions. Indexes by host and port. Users are typically
* looking to reuse any session for a given host and port.
*/
public class ClientSessionContext extends AbstractSessionContext {
/**
* Sessions indexed by host and port. Protect from concurrent
* access by holding a lock on sessionsByHostAndPort.
*/
final Map<HostAndPort, SSLSession> sessionsByHostAndPort
= new HashMap<HostAndPort, SSLSession>();
private SSLClientSessionCache persistentCache;
public ClientSessionContext() {
super(10, 0);
}
public int size() {
return sessionsByHostAndPort.size();
}
public void setPersistentCache(SSLClientSessionCache persistentCache) {
this.persistentCache = persistentCache;
}
@Override
protected void sessionRemoved(SSLSession session) {
String host = session.getPeerHost();
int port = session.getPeerPort();
if (host == null) {
return;
}
HostAndPort hostAndPortKey = new HostAndPort(host, port);
synchronized (sessionsByHostAndPort) {
sessionsByHostAndPort.remove(hostAndPortKey);
}
}
/**
* Finds a cached session for the given host name and port.
*
* @param host of server
* @param port of server
* @return cached session or null if none found
*/
public SSLSession getSession(String host, int port) {
if (host == null) {
return null;
}
SSLSession session;
HostAndPort hostAndPortKey = new HostAndPort(host, port);
synchronized (sessionsByHostAndPort) {
session = sessionsByHostAndPort.get(hostAndPortKey);
}
if (session != null && session.isValid()) {
return session;
}
// Look in persistent cache.
if (persistentCache != null) {
byte[] data = persistentCache.getSessionData(host, port);
if (data != null) {
session = toSession(data, host, port);
if (session != null && session.isValid()) {
super.putSession(session);
synchronized (sessionsByHostAndPort) {
sessionsByHostAndPort.put(hostAndPortKey, session);
}
return session;
}
}
}
return null;
}
@Override
public void putSession(SSLSession session) {
super.putSession(session);
String host = session.getPeerHost();
int port = session.getPeerPort();
if (host == null) {
return;
}
HostAndPort hostAndPortKey = new HostAndPort(host, port);
synchronized (sessionsByHostAndPort) {
sessionsByHostAndPort.put(hostAndPortKey, session);
}
// TODO: This in a background thread.
if (persistentCache != null) {
byte[] data = toBytes(session);
if (data != null) {
persistentCache.putSessionData(session, data);
}
}
}
static class HostAndPort {
final String host;
final int port;
HostAndPort(String host, int port) {
this.host = host;
this.port = port;
}
@Override
public int hashCode() {
return host.hashCode() * 31 + port;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof HostAndPort)) {
return false;
}
HostAndPort lhs = (HostAndPort) o;
return host.equals(lhs.host) && port == lhs.port;
}
}
}
| [
"mirek190@gmail.com"
] | mirek190@gmail.com |
34f2888f6e088b2e2629dd0b7e61439b1ef5032c | 997efa7602debb5062de4e64b0897ca5182fbf18 | /experiment1/src/main/java/no/hvl/dat250/expass6/experiment1/servingwebcontent/ServingWebContentApplication.java | 2654cd4f150de707af3f8753a3386ca9efabf77b | [] | no_license | mhhundvin/Expass6 | fb710e95c5f8043ce66666103d8e0fc43b58584c | e8ae701b9bdc254ea87a8605a1a8efe1928738fe | refs/heads/main | 2023-08-29T07:03:46.746008 | 2021-10-06T13:28:43 | 2021-10-06T13:28:43 | 414,168,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package no.hvl.dat250.expass6.experiment1.servingwebcontent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ServingWebContentApplication {
public static void main(String[] args) {
SpringApplication.run(ServingWebContentApplication.class, args);
}
}
| [
"mhhundvin@hotmail.com"
] | mhhundvin@hotmail.com |
c205d3310f5f4f35f493f3bce6eba0a08e353ec9 | ef645ea312daf0b583340bca32d01899283189ff | /maze_solver.ui/src/module-info.java | a4335cfa177714bd634fe706454dc627bd4706b3 | [] | no_license | huangdarz/Maze-Solver | 7af7c9ef18ee623dcdf0f998aec5e10428525ae4 | 55ec6e9c33283e2d7b0902d76fe7d32935c3c90f | refs/heads/master | 2022-04-27T13:24:38.031725 | 2020-04-29T19:16:52 | 2020-04-29T19:16:52 | 259,996,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | module maze.solver.ui {
requires javafx.graphics;
requires javafx.controls;
requires java.desktop;
requires javafx.swing;
requires maze.solver.search;
requires maze.solver.path;
exports maze_solver.ui;
} | [
"huangdarin465@gmail.com"
] | huangdarin465@gmail.com |
4d31f9192da70fa4dcc63c18a3f3589ff656d2f1 | ff6358a30f8068a5b30af5e119e26d3782cfeb62 | /src/main/java/softuni/mobilelele/init/DataInit.java | 423e3280d033d75e2f2a974f82367d227c951fbd | [] | no_license | yavor300/Mobilelele | ce919079f33ed456157f53f524b528b795c713d6 | 4d96813d396c8f3e3b360d2d91b5a976e38a413c | refs/heads/master | 2023-03-06T14:06:04.346055 | 2021-02-13T16:38:07 | 2021-02-13T16:38:07 | 332,311,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,257 | java | package softuni.mobilelele.init;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import softuni.mobilelele.domain.entities.Brand;
import softuni.mobilelele.domain.entities.Model;
import softuni.mobilelele.domain.entities.User;
import softuni.mobilelele.domain.entities.enums.CategoryType;
import softuni.mobilelele.repository.BrandRepository;
import softuni.mobilelele.repository.ModelRepository;
import softuni.mobilelele.repository.UserRepository;
import java.time.LocalDateTime;
@Component
public class DataInit implements CommandLineRunner {
private final BrandRepository brandRepository;
private final ModelRepository modelRepository;
private final PasswordEncoder passwordEncoder;
private final UserRepository userRepository;
@Autowired
public DataInit(BrandRepository brandRepository, ModelRepository modelRepository, PasswordEncoder passwordEncoder, UserRepository userRepository) {
this.brandRepository = brandRepository;
this.modelRepository = modelRepository;
this.passwordEncoder = passwordEncoder;
this.userRepository = userRepository;
}
@Override
public void run(String... args) throws Exception {
if (brandRepository.count() == 0) {
Brand tesla = new Brand();
tesla.setName("Tesla");
tesla.setCreated(LocalDateTime.now());
tesla.setModified(LocalDateTime.now());
brandRepository.saveAndFlush(tesla);
Brand porsche = new Brand();
porsche.setName("Porsche");
porsche.setCreated(LocalDateTime.now());
porsche.setModified(LocalDateTime.now());
brandRepository.saveAndFlush(porsche);
Model taycan = new Model();
taycan.setCategory(CategoryType.CAR);
taycan.setCreated(LocalDateTime.now());
taycan.setEndYear(2021);
taycan.setImageUrl("https://cdn.motor1.com/images/mgl/kJWEN/s1/2020-porsche-taycan.jpg");
taycan.setStartYear(2020);
taycan.setModified(LocalDateTime.now());
taycan.setName("Taycan");
taycan.setBrand(porsche);
modelRepository.saveAndFlush(taycan);
Model modelX = new Model();
modelX.setCategory(CategoryType.CAR);
modelX.setCreated(LocalDateTime.now());
modelX.setEndYear(2021);
modelX.setImageUrl("https://www.tesla.com/sites/default/files/modelsx-new/social/model-x-social.jpg");
modelX.setStartYear(2017);
modelX.setModified(LocalDateTime.now());
modelX.setName("Model X");
modelX.setBrand(tesla);
modelRepository.saveAndFlush(modelX);
}
// if (userRepository.count() == 1) {
// User admin = new User();
// admin.setFirstName("Peter");
// admin.setLastName("Dimitrov");
// admin.setUsername("admin");
// admin.setPassword(passwordEncoder.encode("topsecret"));
// userRepository.saveAndFlush(admin);
// }
}
}
| [
"yavor300@gmail.com"
] | yavor300@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.