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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4f1ce828b39e8739edb8aa56d3526991e7f44919 | 1e67a0851d3a1ca55cb814d05d6248d5e8e7aa24 | /code/projects_2018/project_03/P0305c_005_Counter_Inheritance_accessor/src/counter/SimpleCounter.java | d3addb29afb46148f2bb2b5af291947026b072ac | [] | no_license | iijima-lab/Lecture_2018_Soft_Eng_Practice | 95bdf3011774d325d918b6ca3e980f0bc02845df | 1bd694c2922c7b078ee4e0edd54a3d03bfa12d77 | refs/heads/master | 2020-03-09T08:18:22.812055 | 2018-05-14T06:52:32 | 2018-05-14T06:52:32 | 128,686,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,957 | java | // =============================================================================
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
// =============================================================================
// 慶應義塾大学・理工学部・飯島研究室
// 2018年度・ソフトウェア工学実習
// Counter 2018-04 飯島 正 (iijima@ae.keio.ac.jp)
// =============================================================================
package counter;
// =============================================================================
/**
* カウンタ(SimpleCounter): モデル(単純なカウンタ).
* @author 飯島 正 (iijima@ae.keio.ac.jp)
* @version <br>
* ---- 0305c-005-20180423a [iijima] カウンタ(Counter) △継承の導入(メソッドのオーバーライド; アクセッサによるアクセス)<br>
* ---- 0305b-005-20180423a [iijima] カウンタ(Counter) 継承の導入(メソッドのオーバーライド; 属性をpublicに変更)<br>
* ---- 0305a-005-20180423a [iijima] カウンタ(Counter) △継承の導入(属性/メソッドの追加)<br>
* ---- 0304a-004-20180423a [iijima] カウンタ(Counter) 進捗バーを追加し多重ビューを実現する<br>
* ---- 0303b-003-20180420a [iijima] カウンタ(Counter) モデルに限界値を格納し,上限値もチェックする<br>
* ---- 0303a-003-20180420a [iijima] カウンタ(Counter) エラーを例外で識別する<br>
* ---- 0302f-002-20180420a [iijima] カウンタ(Counter) パッケージの導入<br>
* ---- 0302e-002-20180420a [iijima] カウンタ(Counter) JOptionPaneによるエラーメッセージの表示<br>
* ---- 0302d-002-20180420a [iijima] カウンタ(Counter) JDialogによるエラーメッセージの表示<br>
* ---- 0302b-002-20180416a [iijima] カウンタ(Counter) エラーメッセージを配列で管理する<br>
* ---- 0302a-002-20180416a [iijima] カウンタ(Counter) エラーコードでエラーを識別する<br>
* ---- 0301c-001-20180416a [iijima] カウンタ(Counter) 共通部分をprivateの下請けメソッドに抽出する<br>
* ---- 0301b-001-20180416a [iijima] カウンタ(Counter) モデルを抽出する(MVCの分離)<br>
* ---- 0301a-001-20180413a [iijima] カウンタ(Counter) モデル抽出前の準備(0201a-001のコピー)
*/
// =============================================================================
public class SimpleCounter {
// =========================================================================
// /////////////////////////////////////////////////////////////////////////
// ///// 属性(カウンターの内部状態) ////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// =========================================================================
/**
* [値属性] カウント値.
*/
// =========================================================================
private int count = 0; // <----- private
// =========================================================================
// /////////////////////////////////////////////////////////////////////////
// ///// コンストラクタ (初期化) ///////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// =========================================================================
/**
* [コンストラクタ] 初期化する.
*/
// =========================================================================
public SimpleCounter() {
// ---------------------------------------------------------------------
count = 0;
// ---------------------------------------------------------------------
}
// =========================================================================
// /////////////////////////////////////////////////////////////////////////
// ///// インスタンスメソッド //////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// =========================================================================
/**
* カウントアップする.
*/
// =========================================================================
public void up() {
// ---------------------------------------------------------------------
count++;
// ---------------------------------------------------------------------
}
// =========================================================================
/**
* カウントダウンする.
*/
// =========================================================================
public void down() {
// ---------------------------------------------------------------------
count--;
// ---------------------------------------------------------------------
}
// =========================================================================
/**
* カウントをリセットする.
*/
// =========================================================================
public void reset() {
// ---------------------------------------------------------------------
count = 0;
// ---------------------------------------------------------------------
}
// =========================================================================
// /////////////////////////////////////////////////////////////////////////
// ///// インスタンスメソッド: アクセッサ //////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// =========================================================================
/**
* [getter] カウント値を返す.
*
* @return カウント値.
*/
// =========================================================================
public int getCount() {
// ---------------------------------------------------------------------
return (count);
// ---------------------------------------------------------------------
}
// =========================================================================
/**
* [setter] カウント値を設定する.
*
* @param count 設定するカウント値.
*/
// =========================================================================
public void setCount(int count) {
// ---------------------------------------------------------------------
this.count = count;
// ---------------------------------------------------------------------
}
// =========================================================================
}
// =============================================================================
| [
"iijima.tad@gmail.com"
] | iijima.tad@gmail.com |
fae700630af5c5fca7e3ddc545d5206509a35f45 | 3b33d6e3c2067446ecb2475f68de74328a6ea66a | /DeveloperStudioWorkspace/quick-daan-project-workspace/modules/crowd-funding-database/crowd-funding-database-api/src/main/java/com/crowd/funding/database/service/DonorRegistrationServiceWrapper.java | 362fc0e514bdd1490ef020d1d1c7fc8120fa7291 | [] | no_license | Sumit9727/QuickDaan_LifeRay1 | bbeced3e386f732be861073106848b4237e967ba | 96320146033f182ab32f13a54bdc7a2306986b53 | refs/heads/master | 2020-09-18T11:21:16.519127 | 2019-11-26T09:04:17 | 2019-11-26T09:04:17 | 224,142,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,724 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library 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 library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.crowd.funding.database.service;
import aQute.bnd.annotation.ProviderType;
import com.liferay.portal.kernel.service.ServiceWrapper;
/**
* Provides a wrapper for {@link DonorRegistrationService}.
*
* @author Brian Wing Shun Chan
* @see DonorRegistrationService
* @generated
*/
@ProviderType
public class DonorRegistrationServiceWrapper implements DonorRegistrationService,
ServiceWrapper<DonorRegistrationService> {
public DonorRegistrationServiceWrapper(
DonorRegistrationService donorRegistrationService) {
_donorRegistrationService = donorRegistrationService;
}
/**
* Returns the OSGi service identifier.
*
* @return the OSGi service identifier
*/
@Override
public String getOSGiServiceIdentifier() {
return _donorRegistrationService.getOSGiServiceIdentifier();
}
@Override
public DonorRegistrationService getWrappedService() {
return _donorRegistrationService;
}
@Override
public void setWrappedService(
DonorRegistrationService donorRegistrationService) {
_donorRegistrationService = donorRegistrationService;
}
private DonorRegistrationService _donorRegistrationService;
} | [
"rohit@prakat.in"
] | rohit@prakat.in |
17465e6b7746a42d148d8c0587bfaa7dd9ef1150 | af2fee288a263cd55aaecdefb249d5c8b7bfb11b | /app/src/main/java/com/example/android/finalapp/MessagesMan.java | 6bcf3466f943e59087a2b37285e858a2238d317a | [] | no_license | dHRUSHIT/MECO | 2d000bcc31d72b7df8d2d9f89bf7cda03ac28779 | ab1581a158a3e6decba97d7c3a8df234fd80c1f0 | refs/heads/master | 2016-09-13T09:23:49.693012 | 2016-05-21T17:24:36 | 2016-05-21T17:24:36 | 57,521,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,767 | java | package com.example.android.finalapp;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Telephony;
import android.telephony.SmsManager;
import java.util.Calendar;
/**
* Created by dhrushit.s on 2/17/2016.
*/
public class MessagesMan {
private boolean allowFeature = false;
public static String fetchNotifications(String contents, Context context) {
return null;
}
public static String getMessages(String content, Context context) {
SmsManager smsManager = SmsManager.getDefault();
Calendar calendar = Calendar.getInstance();
calendar.add(calendar.DATE,-1);
String[] args = {String.valueOf(calendar.getTime())};
// String[] args = {String.valueOf(calendar.getTime()),"0"};
ContentResolver contentResolver = context.getContentResolver();
/*please uncomment in the next line for the final app*/
// Cursor cursor = contentResolver.query(Telephony.Sms.Inbox.CONTENT_URI, null, Telephony.Sms.Inbox.DATE + ">= ?", args, null);
// Cursor cursor = contentResolver.query(Telephony.Sms.Inbox.CONTENT_URI, null, "date>= ? AND read = ?", args, null);
Cursor cursor = contentResolver.query(Telephony.Sms.Inbox.CONTENT_URI, null, null, null, null);
int numberOfMessages = cursor.getCount();
cursor.moveToFirst();
String ret="";
while (cursor.moveToNext()){
ret = ret + cursor.getString(cursor.getColumnIndex("address")) + ":\n";
ret = ret + cursor.getString(cursor.getColumnIndex("body")) + "\n\n";
}
cursor.close();
return ret;
}
}
| [
"dhrushit.raval@hotmail.com"
] | dhrushit.raval@hotmail.com |
e032eb7750a9e58830986eeb589c84d2c98c8a2d | f80ced44f41091f5cc030d9f2908b70e719d2e14 | /src/zoneserver/src/test/java/bronzethistle/zoneserver/dao/ZoneDaoTest.java | 48041ea61c2738eebb9d289b912a992ae1530f87 | [] | no_license | trasa/BronzeThistle | cede793b4fdd0f951729d49544b398c1e9385897 | 30396f41395d7c87cb33248efeb692a86913b182 | refs/heads/master | 2023-04-30T07:39:59.178998 | 2022-11-18T18:59:38 | 2022-11-18T18:59:38 | 2,722,900 | 0 | 0 | null | 2023-04-17T17:43:54 | 2011-11-06T22:59:41 | Java | UTF-8 | Java | false | false | 883 | java | package bronzethistle.zoneserver.dao;
import bronzethistle.zoneserver.Zone;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class ZoneDaoTest {
private ZoneDao zoneDao;
@Before
public void setUp() {
zoneDao = new ZoneDao();
zoneDao.init();
}
@Test
public void zerothZoneIsTheLobby() {
Zone z = zoneDao.getZoneById(ZoneDao.LOBBY_ZONE_ID);
assertEquals(ZoneDao.LOBBY_ZONE_ID, z.getZoneId());
assertEquals("Lobby", z.getName());
}
@Test
@Ignore("not implemented yet")
public void create_a_zone() {
// needs to not overwrite the existing 0th zone,
// start numbering from 1, etc.
assertTrue("todo", false);
}
}
| [
"trasa@meancat.com"
] | trasa@meancat.com |
0478db1e6d3009dff1fc39d321584f49daf0a5c9 | c6d7b5092c710002a9bf213b8ca01b48b935e17a | /petPetBoot/src/main/java/com/petAdopt/springboot/controller/Basic.java | d9d767e03d6b38468799f34822701991dce7e039 | [] | no_license | roger0968672/TEST | eea9ceafb4feb42cb818e91e0ea4fcf37ef6e87f | d02fe085d05ddabe5495981d2f4d7cb184e074d3 | refs/heads/main | 2023-08-05T06:45:41.773271 | 2021-09-13T13:13:29 | 2021-09-13T13:13:29 | 389,244,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package com.petAdopt.springboot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class Basic {
@GetMapping("/Test")
public String testajax() {
return"TestAjax";
}
@GetMapping("/hello")
public String hello(
@RequestParam(value="name",required=false) String vis
,Model m) {
String mes=vis !=null ? vis+"您好" : "訪客,您好";
m.addAttribute("hellomsg", mes);
return "greeting";
}
}
| [
"Student@DESKTOP-EKRVM5K"
] | Student@DESKTOP-EKRVM5K |
c4822722367f57513fd28d7dd01b23822cb3fbe8 | 78bdc24b10434008c4361ae104e8338146515eb0 | /src/main/java/br/com/alura/forum/Models/Topico.java | 603b38360277a3079e2367d717ed2fbdb0e70a84 | [] | no_license | gabrielpoke/Spring-boot-API-REST | 6913b4010c96da72a986ae7fe65031e0669020f5 | 0a3dc519fa1e882526752da015e028e03e2907d6 | refs/heads/main | 2023-05-28T21:44:27.218015 | 2021-06-15T21:34:32 | 2021-06-15T21:34:32 | 376,944,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,284 | java | package br.com.alura.forum.Models;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Entity
public class Topico {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String titulo;
private String mensagem;
private LocalDateTime dataCriacao = LocalDateTime.now();
@Enumerated(EnumType.STRING)
private StatusTopico status = StatusTopico.NAO_RESPONDIDO;
@ManyToOne
private Usuario autor;
@ManyToOne
private Curso curso;
@OneToMany(mappedBy = "topico")
private List<Resposta> respostas = new ArrayList<>();
public Topico(){}
public Topico(String titulo, String mensagem, Curso curso) {
this.titulo = titulo;
this.mensagem = mensagem;
this.curso = curso;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.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;
Topico other = (Topico) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getMensagem() {
return mensagem;
}
public void setMensagem(String mensagem) {
this.mensagem = mensagem;
}
public LocalDateTime getDataCriacao() {
return dataCriacao;
}
public void setDataCriacao(LocalDateTime dataCriacao) {
this.dataCriacao = dataCriacao;
}
public StatusTopico getStatus() {
return status;
}
public void setStatus(StatusTopico status) {
this.status = status;
}
public Usuario getAutor() {
return autor;
}
public void setAutor(Usuario autor) {
this.autor = autor;
}
public Curso getCurso() {
return curso;
}
public void setCurso(Curso curso) {
this.curso = curso;
}
public List<Resposta> getRespostas() {
return respostas;
}
public void setRespostas(List<Resposta> respostas) {
this.respostas = respostas;
}
}
| [
"gabriel_victor_prestes@hotmail.com"
] | gabriel_victor_prestes@hotmail.com |
5e0005c4be6ee09086a8df11b987f28b190b7c9c | b6f5d180d2366dfd9a6b42e9465612a1faa99455 | /DistWrapper/src/main/java/ash/nazg/dist/Main.java | c1b16714d4a7fb1a109f5d96996910359d22a0f6 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | d3v3l0/OneRing | 830fe43870be409edea58a2425ad5dfb42f41477 | c301dfa6880c844ee2c02f0170258302d54f2539 | refs/heads/master | 2022-11-09T08:59:26.772117 | 2020-06-17T20:09:11 | 2020-06-17T20:09:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,406 | java | /**
* Copyright (C) 2020 Locomizer team and Contributors
* This project uses New BSD license with do no evil clause. For full text, check the LICENSE file in the root directory.
*/
package ash.nazg.dist;
import ash.nazg.config.TaskWrapperConfigBuilder;
import ash.nazg.config.WrapperConfig;
import ash.nazg.spark.WrapperBase;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
public class Main {
public static void main(String[] args) {
TaskWrapperConfigBuilder configBuilder = new TaskWrapperConfigBuilder();
JavaSparkContext context = null;
try {
configBuilder.addRequiredOption("c", "config", true, "Config file");
configBuilder.addOption("d", "direction", true, "Copy direction. Can be 'from', 'to', or 'nop' to just validate the config file and exit");
configBuilder.addOption("o", "output", true, "Path to output distcp.ini");
configBuilder.setCommandLine(args);
SparkConf sparkConf = new SparkConf()
.setAppName(WrapperBase.APP_NAME)
.set("spark.serializer", org.apache.spark.serializer.KryoSerializer.class.getCanonicalName());
if (configBuilder.hasOption("local")) {
sparkConf
.setMaster("local[*]")
.set("spark.network.timeout", "10000");
if (configBuilder.hasOption("driverMemory")) {
sparkConf
.set("spark.driver.memory", configBuilder.getOptionValue("driverMemory"));
}
}
context = new JavaSparkContext(sparkConf);
context.hadoopConfiguration().set(FileInputFormat.INPUT_DIR_RECURSIVE, Boolean.TRUE.toString());
WrapperConfig config = configBuilder.build(context);
configBuilder.overrideFromCommandLine("distcp.ini", "o");
configBuilder.overrideFromCommandLine("distcp.wrap", "d");
configBuilder.overrideFromCommandLine("distcp.store", "S");
new DistWrapper(context, config)
.go();
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
} finally {
if (context != null) {
context.stop();
}
}
}
}
| [
"a.evdokimov@russianit.ru"
] | a.evdokimov@russianit.ru |
91dadae1de7e68b36a24eac6287b6a97d5b441a8 | 944900e3d66eb8ce606c791239ed90dbe04de05d | /SistemaPontoAcesso/src/main/java/com/dio/live/swagger/SwaggerConfig.java | 17450cb3abdc5e27daf5dd83f8a68c2f93edfd9e | [] | no_license | gerson002/controle-acesso-spring-boot | 64030469c2da43fd310bb054380cc906bb5a3540 | 7784f607b0fbc67541ce00d371988fe787abda87 | refs/heads/main | 2023-07-08T16:27:34.198426 | 2021-08-11T01:46:31 | 2021-08-11T01:46:31 | 394,825,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,125 | java | package com.dio.live.swagger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.Collections;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket apiAdmin() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.dio.live"))
.paths(PathSelectors.ant("/**"))
.build()
.apiInfo(apiInfo())
.globalOperationParameters(
Collections.singletonList(
new ParameterBuilder()
.name("Authorization")
.description("Header para Token JWT")
.modelRef(new ModelRef("string"))
.parameterType("header")
.required(false)
.build()));
}
@Bean
public ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("API-REST")
.description("super live code")
.version("1.0.0")
.license("Apache License Version 2.0")
.licenseUrl("https://www.apache.org/licenses/LICENSE-2.0")
.contact(new Contact("DIO", "https://web.digitalinnovation.one", "contato@digitalinnovationone.com.br"))
.build();
}
}
| [
"gerson002@gmail.com"
] | gerson002@gmail.com |
722477b8582d082cc51799235c2a6d8d9dd6b4a8 | de911552d30f5b640987ff8387163205e6ea6ea3 | /app/src/main/java/com/newsdemo/model/http/response/GoldHttpResponse.java | 5e27775965127fbf5050c80093a9ad4031e4e7b8 | [] | no_license | MrHuJianQiang/NewsDemo | d170b8639df243129223ed469caa0519937196aa | bdab42e59cb4a36d8d2f74c06cde7ab91ff45c4c | refs/heads/master | 2021-01-20T16:27:29.851681 | 2017-06-09T08:11:21 | 2017-06-09T08:11:21 | 90,842,185 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package com.newsdemo.model.http.response;
/**
* Created by jianqiang.hu on 2017/5/11.
*/
public class GoldHttpResponse<T> {
private T results;
public T getResults(){
return results;
}
public void setResults(T results){
this.results=results;
}
}
| [
"Mrhujianqiang@163.com"
] | Mrhujianqiang@163.com |
f77d0aa50aa312bf6907d13a5463558dbdb3a531 | 5275bc4932db32eb7f2e06b799e7f124c2f06181 | /cis/src/main/java/cn/haohao/cis/notice/vo/NoticeQueryObj.java | 901c6a655b620b2901aa459314c0b51fb63342e4 | [] | no_license | liyl1991/commission-info-system | 7a93dae3d180537f9ff708ce9ea3648970ef6965 | ceaa3c47813268eca1fce7b5b0eef180c838cd48 | refs/heads/master | 2021-01-23T02:30:03.393207 | 2015-08-27T03:01:36 | 2015-08-27T03:01:36 | 31,420,391 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,163 | java | package cn.haohao.cis.notice.vo;
//j-import-b
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import cn.haohao.vas.core.vo.IPageable;
import cn.haohao.cis.notice.model.Notice;
//j-import-e
/**
* VO
*/
public class NoticeQueryObj extends Notice implements IPageable{
private static final long serialVersionUID = 1L;
/**
* 名字匹配
*/
private String titleMatch;
/**
* 访问者id
*/
private Integer visitorId;
/**
* 页面大小
*/
private int pageSize = 10;
/**
* 当前页
*/
private int currentPage = 1;
/**
* 排序
*/
private Sort sort;
public Integer getVisitorId() {
return visitorId;
}
public void setVisitorId(Integer visitorId) {
this.visitorId = visitorId;
}
public String getTitleMatch() {
return titleMatch;
}
public void setTitleMatch(String titleMatch) {
this.titleMatch = titleMatch;
}
public Integer getStartRowNum() {
if (currentPage < 1)
currentPage = 1;
return (currentPage - 1) * pageSize;
}
public Integer getEndRowNum() {
if (currentPage < 1)
currentPage = 1;
return (currentPage) * pageSize;
}
public int getPageNumber() {
return this.currentPage;
}
public int getPageSize() {
return this.pageSize;
}
public int getOffset() {
return currentPage*pageSize;
}
public Sort getSort() {
return this.sort;
}
public NoticeQueryObj next() {
this.currentPage += 1;
return this;
}
public NoticeQueryObj previousOrFirst() {
if(currentPage != 1)
this.currentPage -= 1;
return this;
}
public NoticeQueryObj first() {
this.currentPage = 1;
return this;
}
public boolean hasPrevious() {
return this.currentPage>1;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public void setSort(Sort sort){
this.sort = sort;
}
public void setSort(List<Order> orders){
this.sort = new Sort(orders);
}
} | [
"343158083@qq.com"
] | 343158083@qq.com |
574a628a8b050d0379f4e643d4b345b1b8188472 | 389e2751dc19c8e6213ae566e6fbd70fff820de9 | /tropicraft/1.6.2/src/packages/CoroUtil/util/CoroUtilNBT.java | 89a42b2a4c3374e2cd25ecee127df58c0c3edbd8 | [] | no_license | Cojomax99/Tropicraft-Archive | 9bbb47da5e00bf45ed1397fea1db9d45b546294c | 130497ac9cd146af3a6f6c800474e382c909b710 | refs/heads/master | 2021-01-13T02:24:11.791169 | 2014-11-06T16:54:06 | 2014-11-06T16:54:06 | 26,279,814 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,413 | java | package CoroUtil.util;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
import CoroUtil.OldUtil;
public class CoroUtilNBT {
public static NBTTagCompound copyOntoNBT(NBTTagCompound nbtSource, NBTTagCompound nbtDest) {
NBTTagCompound newNBT = (NBTTagCompound) nbtDest.copy();
//do magic
try {
Collection dataCl = nbtSource.getTags();
Iterator it = dataCl.iterator();
while (it.hasNext()) {
NBTBase data = (NBTBase)it.next();
newNBT.setTag(data.getName(), data);
}
} catch (Exception ex) {
ex.printStackTrace();
}
return newNBT;
}
/*private static NBTTagCompound copyOntoNBTTagCompound nbtSource, NBTTagCompound nbtDest) {
NBTTagCompound
}*/
//this should probably be recursive
/*private static NBTTagCompound copyOntoRecursive(NBTTagCompound nbtSource, NBTTagCompound nbttagcompound)
{
try {
Collection dataCl = nbtSource.getTags();
Iterator it = dataCl.iterator();
while (it.hasNext()) {
NBTBase data = (NBTBase)it.next();
if (data instanceof NBTTagCompound) {
NBTTagCompound resultCopy = copyOntoRecursive((NBTTagCompound)data, nbttagcompound);
}
String entryName = data.getName();
}
//nbttagcompound = new NBTTagCompound(this.getName());
Map tagMap = (Map)c_CoroAIUtil.getPrivateValueSRGMCP(NBTTagCompound.class, nbtSource, "tagMap", "tagMap");
Iterator iterator = tagMap.entrySet().iterator();
while (iterator.hasNext())
{
String s = (String)iterator.next();
nbttagcompound.setTag(s, ((NBTBase)tagMap.get(s)).copy());
}
} catch (Exception ex) {
ex.printStackTrace();
}
return nbttagcompound;
}*/
public static void writeCoords(String name, ChunkCoordinates coords, NBTTagCompound nbt) {
nbt.setInteger(name + "X", coords.posX);
nbt.setInteger(name + "Y", coords.posY);
nbt.setInteger(name + "Z", coords.posZ);
}
public static ChunkCoordinates readCoords(String name, NBTTagCompound nbt) {
if (nbt.hasKey(name + "X")) {
return new ChunkCoordinates(nbt.getInteger(name + "X"), nbt.getInteger(name + "Y"), nbt.getInteger(name + "Z"));
} else {
return null;
}
}
}
| [
"cojomax99@gmail.com"
] | cojomax99@gmail.com |
c36dd33a2516edaae9c400a9434832b004ac811f | 545ed699c8fcf2f77e38c8978f70bef74c4d0b4c | /app/src/main/java/appewtc/masterung/bookmeetingpbru/MyOpenHelper.java | ebf41ed647d0dff8851964aa30eaa89fe8868e4f | [] | no_license | kayapon/Book-Meeting-PBRU | 4a4fb1b4f72c06f13308ebbaeb3d0da0a8577501 | c61cebccc7c0736994f273d3475a3f3f3886980c | refs/heads/master | 2016-09-13T11:36:20.281841 | 2016-05-25T11:43:17 | 2016-05-25T11:43:17 | 59,450,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | package appewtc.masterung.bookmeetingpbru;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by masterUNG on 5/24/16 AD.
*/
public class MyOpenHelper extends SQLiteOpenHelper{
//Explicit
public static final String database_name = "Pbru.db";
private static final int database_version = 1;
private static final String create_user_table = "create table userTABLE (" +
"_id integer primary key," +
"Name text," +
"Surname text," +
"IDcard text," +
"Office text," +
"User text," +
"Password text);";
public MyOpenHelper(Context context) {
super(context, database_name, null,database_version);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL(create_user_table);
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
} // Main Class
| [
"aporn.soo@mail.pbru.ac.th"
] | aporn.soo@mail.pbru.ac.th |
5ce1bb693040191086fc8c0d607534b925c9b846 | 19ca16ce5f224da01df497e73f5f6a83fca9b781 | /src/main/java/com/zxh/springbootl/mapper/UserMapper.java | d880177888db8b475fdb14f0612ea368472b8e38 | [] | no_license | zxhzxhtest/Community | c2208b8fe3064c012445feff1def8805074c0a0f | c70ecc89f098f2d2d30f8f643205b3e51978a5aa | refs/heads/master | 2022-06-26T12:56:23.144656 | 2019-12-26T13:40:36 | 2019-12-26T13:40:36 | 230,090,761 | 0 | 0 | null | 2022-06-17T02:46:52 | 2019-12-25T11:08:54 | Java | UTF-8 | Java | false | false | 488 | java | package com.zxh.springbootl.mapper;
import com.zxh.springbootl.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface UserMapper {
// @Select("select * from user where id=#{id}")
@Insert("insert into User (name,account_id,token,gmt_create,gmt_modified) values (#{name},#{accountId},#{token},#{gmtCreate},#{gmtModified})")
void insertUser(User user);
}
| [
"zxh@email.com"
] | zxh@email.com |
0e43b55767c6d116184615d16ba5621ba25077fd | 8cc604d67d76f07a5c43926d56f5db42d64c6879 | /weixiao/weixiao/weixiao-entity/src/main/java/com/zjw/graduation/enums/EnumStatusType.java | 4aec02fbf0ee81f0bda22e699e633318bc516839 | [] | no_license | small-little-time/weixiao-center | 7b702aa83a94c20bd263d756e86ebe55bd68e28b | f7f60de9b4551b2e93647b6bd79085e4621b81c2 | refs/heads/master | 2022-12-16T03:13:49.684757 | 2020-09-11T07:14:52 | 2020-09-11T07:14:52 | 293,831,699 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package com.zjw.graduation.enums;
public enum EnumStatusType {
ERROR(-1,"数据异常"),LOSE(-2, "token失效"),NOTALLOW(-3, "没有权限");
private Integer value;
private String type;
EnumStatusType(Integer value, String type) {
this.value = value;
this.type = type;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"623203239@qq.com"
] | 623203239@qq.com |
c48ad0d5cbe176d15c4b3d2e82dab030668b3c2f | 18f5ebbb2ede8c9d0501f09430e294b2232e2535 | /app/src/main/java/com/app/cpk/adapter/PelSupAdapter.java | 80141810f95e8cdd5aee7e70289ccb9f2705d75d | [] | no_license | healer32/cpk | 9e3c9cea6cae0ae5a45c8f2774acb1d7799d2e2c | 1ed5e8cd056bf3998a6a0b7ca18a58a836984200 | refs/heads/master | 2020-12-03T15:26:29.670781 | 2020-01-02T11:55:21 | 2020-01-02T11:55:21 | 231,371,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,932 | java | package com.app.cpk.adapter;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.app.cpk.R;
import com.app.cpk.activity.BayarPembelianActivity;
import com.app.cpk.activity.ListPelSupActivity;
import com.app.cpk.activity.PelSupSelectedActivity;
import com.app.cpk.model.PelSup;
import java.util.ArrayList;
import java.util.List;
public class PelSupAdapter extends RecyclerView.Adapter<PelSupAdapter.HolderData> {
private List<PelSup> pelSupList;
private Activity activity;
private String jenis;
public PelSupAdapter(ArrayList<PelSup> pelSupList, Activity activity, String jenis) {
this.pelSupList = pelSupList;
this.activity = activity;
this.jenis = jenis;
}
@Override
public HolderData onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_pelsup, parent, false);
HolderData holderData = new HolderData(v);
return holderData;
}
@Override
public void onBindViewHolder(HolderData holder, int position) {
PelSup pelSup = pelSupList.get(position);
holder.txNick.setText(pelSup.getNama().substring(0,1));
holder.txNama.setText(pelSup.getNama().toString());
holder.txNoTelp.setText(pelSup.getTelephone());
holder.id = pelSup.getId();
holder.tipe = pelSup.getTipe();
holder.alamat = pelSup.getAlamat();
holder.pos = String.valueOf(position);
}
@Override
public int getItemCount() {
return pelSupList.size();
}
public class HolderData extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView txNama, txNoTelp, txNick;
String id,tipe,alamat,pos;
public HolderData(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
txNama = (TextView)itemView.findViewById(R.id.tx_namaps);
txNoTelp = (TextView)itemView.findViewById(R.id.tx_notelpps);
txNick = (TextView)itemView.findViewById(R.id.tx_nickps);
}
@Override
public void onClick(View v) {
Context context = v.getContext();
if (jenis.equals("0")||jenis.equals("1")){
Intent intent = new Intent(context, PelSupSelectedActivity.class);
intent.putExtra("id",id);
intent.putExtra("nama",txNama.getText().toString());
intent.putExtra("alamat",alamat);
intent.putExtra("notelp",txNoTelp.getText().toString());
intent.putExtra("tipe",tipe);
intent.putExtra("flag","0");
context.startActivity(intent);
}else if (jenis.equals("3")){
Intent returnIntent = new Intent();
returnIntent.putExtra("result",String.valueOf(pos));
returnIntent.putExtra("id_pelsup",id);
returnIntent.putExtra("nama",txNama.getText().toString());
((ListPelSupActivity)activity).setResult(Activity.RESULT_OK,returnIntent);
((ListPelSupActivity)activity).setFinish();
}else if(jenis.equals("4")){
((BayarPembelianActivity)activity).setSupplier(Integer.parseInt(pos));
}
}
}
// Clean all elements of the recycler
public void clear() {
pelSupList.clear();
notifyDataSetChanged();
}
// Add a list of items -- change to type used
public void addAll(List<PelSup> list) {
pelSupList.addAll(list);
notifyDataSetChanged();
}
public void updateList(List<PelSup> list){
pelSupList = list;
notifyDataSetChanged();
}
}
| [
"dion.k.wijaya@gmail.com"
] | dion.k.wijaya@gmail.com |
ae15bf7c1c99537fa54388aa8351f706b0d6590a | 2d16fd9d1b9d57445cf0419ffd1ac710600416aa | /Documents/NetBeansProjects/JavaApplication7/src/HotelPackage/FicheChambres.java | ee552193ca20dadc6296e7e18ef5bbcb1b93ff27 | [] | no_license | Yasmine-amrn/HotelLaGazelle | cd415595e60972858b1977acadbda8965a12de06 | 93e10a24d6690d6dbe87e35ce01b0567d0dce70f | refs/heads/master | 2023-04-03T00:02:00.240278 | 2021-04-09T23:25:07 | 2021-04-09T23:25:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,987 | 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 HotelPackage;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author pc-click
*/
public class FicheChambres extends javax.swing.JFrame {
Connection cnx=null;
/**
* Creates new form FicheChambres
*/
public FicheChambres() {
setUndecorated(true);
setResizable(false);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jLabel17 = new javax.swing.JLabel();
NumChambre = new javax.swing.JTextField();
jLabel18 = new javax.swing.JLabel();
NumBloc = new javax.swing.JTextField();
jLabel19 = new javax.swing.JLabel();
NumEtage = new javax.swing.JTextField();
jLabel20 = new javax.swing.JLabel();
Categorie = new javax.swing.JTextField();
jLabel21 = new javax.swing.JLabel();
NbrLits = new javax.swing.JTextField();
jLabel22 = new javax.swing.JLabel();
Prix = new javax.swing.JTextField();
Confirme = new javax.swing.JButton();
Annuler = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(2, 5, 8));
jLabel1.setFont(new java.awt.Font("Bell MT", 1, 28)); // NOI18N
jLabel1.setForeground(new java.awt.Color(242, 236, 228));
jLabel1.setText("Fiche Chambre");
jButton1.setBackground(new java.awt.Color(2, 5, 8,0));
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/HotelPackage/exitpng.png"))); // NOI18N
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
jButton1MousePressed(evt);
}
});
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 1122, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(111, 111, 111))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addContainerGap(14, Short.MAX_VALUE))
);
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1460, 60));
jPanel2.setBackground(new java.awt.Color(250, 249, 248));
jLabel17.setFont(new java.awt.Font("Bell MT", 0, 22)); // NOI18N
jLabel17.setForeground(new java.awt.Color(2, 5, 8));
jLabel17.setText("N° de chambre");
NumChambre.setBackground(new java.awt.Color(250, 249, 248));
NumChambre.setFont(new java.awt.Font("Bell MT", 0, 20)); // NOI18N
NumChambre.setForeground(new java.awt.Color(2, 5, 8));
jLabel18.setFont(new java.awt.Font("Bell MT", 0, 22)); // NOI18N
jLabel18.setForeground(new java.awt.Color(2, 5, 8));
jLabel18.setText("N° de bloc");
NumBloc.setBackground(new java.awt.Color(250, 249, 248));
NumBloc.setFont(new java.awt.Font("Bell MT", 0, 20)); // NOI18N
NumBloc.setForeground(new java.awt.Color(2, 5, 8));
jLabel19.setFont(new java.awt.Font("Bell MT", 0, 22)); // NOI18N
jLabel19.setForeground(new java.awt.Color(2, 5, 8));
jLabel19.setText("N° de étage");
NumEtage.setBackground(new java.awt.Color(250, 249, 248));
NumEtage.setFont(new java.awt.Font("Bell MT", 0, 20)); // NOI18N
NumEtage.setForeground(new java.awt.Color(2, 5, 8));
jLabel20.setFont(new java.awt.Font("Bell MT", 0, 22)); // NOI18N
jLabel20.setForeground(new java.awt.Color(2, 5, 8));
jLabel20.setText("Catégorie");
Categorie.setBackground(new java.awt.Color(250, 249, 248));
Categorie.setFont(new java.awt.Font("Bell MT", 0, 20)); // NOI18N
Categorie.setForeground(new java.awt.Color(2, 5, 8));
jLabel21.setFont(new java.awt.Font("Bell MT", 0, 22)); // NOI18N
jLabel21.setForeground(new java.awt.Color(2, 5, 8));
jLabel21.setText("Nbr de lits");
NbrLits.setBackground(new java.awt.Color(250, 249, 248));
NbrLits.setFont(new java.awt.Font("Bell MT", 0, 20)); // NOI18N
NbrLits.setForeground(new java.awt.Color(2, 5, 8));
jLabel22.setFont(new java.awt.Font("Bell MT", 0, 22)); // NOI18N
jLabel22.setForeground(new java.awt.Color(2, 5, 8));
jLabel22.setText("Prix de chambre");
Prix.setBackground(new java.awt.Color(250, 249, 248));
Prix.setFont(new java.awt.Font("Bell MT", 0, 20)); // NOI18N
Prix.setForeground(new java.awt.Color(2, 5, 8));
Confirme.setBackground(new java.awt.Color(0, 0, 0));
Confirme.setFont(new java.awt.Font("Bell MT", 0, 22)); // NOI18N
Confirme.setForeground(new java.awt.Color(250, 249, 248));
Confirme.setText("Confirmer");
Confirme.setPreferredSize(new java.awt.Dimension(150, 52));
Confirme.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseMoved(java.awt.event.MouseEvent evt) {
ConfirmeMouseMoved(evt);
}
});
Confirme.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
ConfirmeFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
ConfirmeFocusLost(evt);
}
});
Confirme.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ConfirmeMouseClicked(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
ConfirmeMousePressed(evt);
}
});
Confirme.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ConfirmeActionPerformed(evt);
}
});
Annuler.setBackground(new java.awt.Color(0, 0, 0));
Annuler.setFont(new java.awt.Font("Bell MT", 0, 22)); // NOI18N
Annuler.setForeground(new java.awt.Color(250, 249, 248));
Annuler.setText("Annuler");
Annuler.setPreferredSize(new java.awt.Dimension(150, 52));
Annuler.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
AnnulerFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
AnnulerFocusLost(evt);
}
});
Annuler.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AnnulerActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(98, 98, 98)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel19)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(NumEtage, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel17)
.addComponent(jLabel18))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(NumChambre, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(NumBloc, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(113, 113, 113)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel22)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 77, Short.MAX_VALUE)
.addComponent(Prix, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel20)
.addComponent(jLabel21))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Categorie, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(NbrLits, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(261, 261, 261))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Confirme, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Annuler, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(177, 177, 177))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(86, 86, 86)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel20)
.addComponent(Categorie, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel21)
.addComponent(NbrLits, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel22)
.addComponent(Prix, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel17)
.addComponent(NumChambre, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel18)
.addComponent(NumBloc, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel19)
.addComponent(NumEtage, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 359, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Confirme, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Annuler, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(305, 305, 305))
);
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 60, 1460, 960));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
}//GEN-LAST:event_jButton1MouseClicked
private void jButton1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MousePressed
}//GEN-LAST:event_jButton1MousePressed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
new Chambre().setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed
private void ConfirmeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ConfirmeFocusGained
Confirme.setBackground(new java.awt.Color(250,249,248));
Confirme.setForeground(new java.awt.Color(2, 5, 8));
}//GEN-LAST:event_ConfirmeFocusGained
private void ConfirmeFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ConfirmeFocusLost
Confirme.setBackground(new java.awt.Color(0,0,0));
Confirme.setForeground(new java.awt.Color(250,249,248));
}//GEN-LAST:event_ConfirmeFocusLost
private void ConfirmeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ConfirmeMouseClicked
}//GEN-LAST:event_ConfirmeMouseClicked
private void ConfirmeMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ConfirmeMousePressed
}//GEN-LAST:event_ConfirmeMousePressed
private void ConfirmeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConfirmeActionPerformed
// conditions sur les champs
int k=0;
String catégorie= Categorie.getText().toString();
try{
Integer.parseInt(NumChambre.getText());
k++;
}catch(Exception e){JOptionPane.showMessageDialog(null, "la N° de chambre doit etre un nombre entier !!");;}
try{
Integer.parseInt(NumBloc.getText());
k++;
}catch(Exception e){JOptionPane.showMessageDialog(null, "la N° de bloc doit etre un nombre entier !!");}
try{
Integer.parseInt(NumEtage.getText());
k++;
}catch(Exception e){JOptionPane.showMessageDialog(null, "la N° de l'étage doit etre un nombre entier !!");}
try{
Integer.parseInt(NbrLits.getText());
k++;
}catch(Exception e){JOptionPane.showMessageDialog(null, "le nombre de lits doit etre un nombre entier !!");}
try{
Double.parseDouble(Prix.getText());
k++;
}catch(Exception e){JOptionPane.showMessageDialog(null, "le prix de chambre doit etre un nombre !!");}
//remplir BD
if(k==5){
try{
Class.forName("com.mysql.jdbc.Driver");
System.err.println("connected");
Connection cnx =DriverManager.getConnection("jdbc:mysql://localhost:3306/hotellagazelle","root","");
Statement st =cnx.createStatement();
//requete
String SQL ="insert into chambre(NumChambre,NumBloc,NumEtage,Categorie,NbrLits,PrixChambre,Disponible)"+
"values("+NumChambre.getText().toString()+","+NumBloc.getText().toString()+","+NumEtage.getText().toString()+","+"\""+Categorie.getText().toString()+"\"" +","+NbrLits.getText().toString()+","+Prix.getText().toString()+","+1+");";
st.executeUpdate(SQL);
JOptionPane.showMessageDialog(null, "Oprération réussie");
this.dispose();
new Chambre().setVisible(true);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);}}
}//GEN-LAST:event_ConfirmeActionPerformed
private void AnnulerFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_AnnulerFocusGained
Annuler.setBackground(new java.awt.Color(250,249,248));
Annuler.setForeground(new java.awt.Color(2, 5, 8));
}//GEN-LAST:event_AnnulerFocusGained
private void AnnulerFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_AnnulerFocusLost
Annuler.setBackground(new java.awt.Color(0,0,0));
Annuler.setForeground(new java.awt.Color(250,249,248));
}//GEN-LAST:event_AnnulerFocusLost
private void AnnulerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AnnulerActionPerformed
new Chambre().setVisible(true);
this.dispose();
}//GEN-LAST:event_AnnulerActionPerformed
private void ConfirmeMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ConfirmeMouseMoved
}//GEN-LAST:event_ConfirmeMouseMoved
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FicheChambres.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FicheChambres.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FicheChambres.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FicheChambres.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FicheChambres().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Annuler;
private javax.swing.JTextField Categorie;
private javax.swing.JButton Confirme;
private javax.swing.JTextField NbrLits;
private javax.swing.JTextField NumBloc;
private javax.swing.JTextField NumChambre;
private javax.swing.JTextField NumEtage;
private javax.swing.JTextField Prix;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
// End of variables declaration//GEN-END:variables
}
| [
"aouinasara77@gmail.com"
] | aouinasara77@gmail.com |
6ceb23b900c3907d7865fb63308d172226b67b1f | fe0cf4ebaef708d5f47bf8401887f38132221a2e | /SJmp3/src/SJmp3/video/AviSampleReader.java | 9c81033330f5cadb7d0785187a51f03203b14fc3 | [] | no_license | Ygarr/sjmp3 | f78392a716537e83ca292af38532abd29bb3a0c7 | 7b2d99ac260487e4eec27a447a28eda7e78eedd2 | refs/heads/master | 2021-01-20T01:17:10.586579 | 2017-04-24T14:20:39 | 2017-04-24T14:20:39 | 89,249,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,852 | java | package SJmp3.video;
import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import net.sourceforge.parser.avi.Utils;
import net.sourceforge.parser.avi.type.AviIndexChunk;
import net.sourceforge.parser.avi.type.AviIndexIDX1;
import net.sourceforge.parser.avi.type.AviStandardIndex;
import net.sourceforge.parser.avi.type.AviStreamFormat;
import net.sourceforge.parser.avi.type.List;
import net.sourceforge.parser.util.ByteStream;
import net.sourceforge.parser.util.TreeNode;
public class AviSampleReader extends Thread
{
private boolean release_flag = false;
private BlockingQueue<byte[]> videoSampleQueue;
private AviParserWrapper wrapper;
private PipedInputStream audio_stream;
private PipedOutputStream audio_out;
public AviSampleReader(AviParserWrapper wrapper, BlockingQueue<byte[]> videoSampleQueue) throws IOException
{
this(wrapper, videoSampleQueue, null);
}
public AviSampleReader(AviParserWrapper wrapper, BlockingQueue<byte[]> videoSampleQueue, InputStream audio_stream) throws IOException
{
this.wrapper = wrapper;
this.videoSampleQueue = videoSampleQueue;
if (audio_stream != null)
{
this.audio_out = new PipedOutputStream((PipedInputStream)audio_stream);
this.audio_stream = (PipedInputStream)audio_stream;
}
start();
}
public void run()
{
while(!release_flag)
{
try {
readSamples();
release_flag = true;
} catch (Exception e)
{
e.printStackTrace();
release_flag = true;
}
}
}
public void release()
{
release_flag = true;
try
{
if (videoSampleQueue.remainingCapacity() == 0)
videoSampleQueue.take();
videoSampleQueue.clear();
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
public void readSamples() throws Exception
{
ByteStream stream = wrapper.getParser().getByteStream();
AviStreamFormat strf = (AviStreamFormat)wrapper.findChildByName("strf", wrapper.getVideoTrack(0));
AviIndexChunk video_super_index = (AviIndexChunk)wrapper.findChildByName("indx", wrapper.getVideoTrack(0));
AviIndexChunk audio_super_index = (AviIndexChunk)wrapper.findChildByName("indx", wrapper.getAudioTrack(0));
if (video_super_index == null || audio_super_index == null)
{
readSamplesIDX1();
return;
}
nextVideoStdIndex(video_super_index, stream);
nextAudioStdIndex(audio_super_index, stream);
boolean video_end = false;
boolean audio_end = false;
while(!release_flag || (video_end && audio_end))
{
long video_offset = nextVideoOffset(video_super_index, stream);
long audio_offset = nextAudioOffset(audio_super_index, stream);
video_end = video_offset == -1;
audio_end = audio_offset == -1;
video_offset += video_std_index.qwBaseOffset;
audio_offset += audio_std_index.qwBaseOffset;
if (video_offset < audio_offset)
{
if (video_end) continue;
video_index++;
int sample_size = video_std_index.idx.get(video_index++);
boolean key_frame = sample_size > 0;
if (!key_frame)
sample_size ^= (1 << 31);
byte[] sample_data = new byte[sample_size];
stream.position(video_offset);
stream.read(sample_data);
//VideoSample sample = new VideoSample(sample_data, strf.format, 0);
if(!release_flag)
videoSampleQueue.offer(sample_data, 1 << 25, TimeUnit.MILLISECONDS);
} else
{
if (audio_end) continue;
audio_index++;
int sample_size = audio_std_index.idx.get(audio_index++);
boolean key_frame = sample_size > 0;
if (!key_frame)
sample_size ^= (1 << 31);
if (audio_stream != null)
{
byte[] sample_data = new byte[sample_size];
stream.position(audio_offset);
stream.read(sample_data);
audio_out.write(sample_data);
}
}
}
}
private int video_index;
private int audio_index;
private AviStandardIndex video_std_index;
private AviStandardIndex audio_std_index;
private long nextVideoOffset(AviIndexChunk video_super_index, ByteStream stream) throws IOException
{
if (video_index >= video_std_index.idx.capacity())
{
nextVideoStdIndex(video_super_index, stream);
if (video_std_index == null) return -1;
video_index = 0;
}
return video_std_index.idx.get(video_index);
}
private void nextVideoStdIndex(AviIndexChunk video_super_index, ByteStream stream) throws IOException
{
long dwOffset = video_super_index.idx.get();
if (dwOffset == 0)
{
video_std_index = null;
} else
{
long dwSize_dwDuration = video_super_index.idx.get();
stream.position(dwOffset);
int type = (int)Utils.bytesToLong(stream, 4);
long size = (int) Utils.bytesToLongLE(stream, 4);
video_std_index = new AviStandardIndex(type, size);
video_std_index.readData(stream);
}
}
private long nextAudioOffset(AviIndexChunk audio_super_index, ByteStream stream) throws IOException
{
if (audio_index >= audio_std_index.idx.capacity())
{
nextAudioStdIndex(audio_super_index, stream);
if (audio_std_index == null) return -1;
audio_index = 0;
}
return audio_std_index.idx.get(audio_index);
}
private void nextAudioStdIndex(AviIndexChunk audio_super_index, ByteStream stream) throws IOException
{
long dwOffset = audio_super_index.idx.get();
if (dwOffset == 0)
{
audio_std_index = null;
} else
{
long dwSize_dwDuration = audio_super_index.idx.get();
stream.position(dwOffset);
int type = (int)Utils.bytesToLong(stream, 4);
long size = (int) Utils.bytesToLongLE(stream, 4);
audio_std_index = new AviStandardIndex(type, size);
audio_std_index.readData(stream);
}
}
private boolean new_index = false;
private int index = 0;
public synchronized void setIndex(int index)
{
this.index = index;
this.new_index = true;
videoSampleQueue.clear();
}
private static final int xt = 0x7874;
private static final int bw = 0x6277;
private static final int cd = 0x6364;
private static final int bd = 0x6264;
private static final int xi = 0x7869;
public void readSamplesIDX1() throws Exception
{
List movie = (List)wrapper.findNode("LIST-movi");
AviStreamFormat strf = (AviStreamFormat)wrapper.findChildByName("strf", wrapper.getVideoTrack(0));
TreeNode node = wrapper.findNode("idx1");
AviIndexIDX1 avi_index = (AviIndexIDX1)node;
boolean rel_pos = true;
while(index < avi_index.idx1.capacity())
{
if (release_flag) return;
int ckid = avi_index.idx1.get(index++);
int dwFlags = avi_index.idx1.get(index++);
int dwChunkOffset = avi_index.idx1.get(index++);
int dwChunkLength = avi_index.idx1.get(index++);
if (index == 4 && (dwChunkOffset == movie.offset)) rel_pos = false;
if (rel_pos)
{
wrapper.getParser().getByteStream().position((int)movie.offset + dwChunkOffset+4);
} else
wrapper.getParser().getByteStream().position(dwChunkOffset+8);
if ((ckid >>> 16) == cd)
{
byte[] sample_data = new byte[dwChunkLength];
wrapper.getParser().getByteStream().read(sample_data);
//VideoSample sample = new VideoSample(sample_data, strf.format, 0);
videoSampleQueue.offer(sample_data, 1<<25, TimeUnit.MILLISECONDS);
} else if ((ckid >>> 16) == bd)
{
byte[] sample_data = new byte[dwChunkLength];
wrapper.getParser().getByteStream().read(sample_data);
//VideoSample sample = new VideoSample(sample_data, strf.format, 0);
videoSampleQueue.offer(sample_data, 1<<25, TimeUnit.MILLISECONDS);
} else if ((ckid >>> 16) == bw)
{
if (audio_stream != null)
{
byte[] sample_data = new byte[dwChunkLength];
wrapper.getParser().getByteStream().read(sample_data);
audio_out.write(sample_data);
}
} else if ((ckid >>> 16) == xt)
{}
}
}
} | [
"Urbanterror1"
] | Urbanterror1 |
c85b792c0b1a698ad06b65c332845e7667be2886 | 961c1e82b1b1e58b6d34388209ed8aa8adad0e05 | /src/test/java/uk/gov/hmcts/probate/businessrule/PA16FormBusinessRuleTest.java | ca55e52dfb81706b01c3ebf56e7d5e9b2d0b8227 | [
"MIT"
] | permissive | hmcts/probate-back-office | 3f838cfde035e7ea4b0c02168d2ad99a731dcfc2 | 09f3b8502a4bcc7db31838981ba28e1af4578dcd | refs/heads/master | 2023-08-18T04:32:09.797012 | 2023-08-16T13:05:35 | 2023-08-16T13:05:35 | 128,388,317 | 5 | 10 | MIT | 2023-09-14T01:57:05 | 2018-04-06T11:50:57 | Java | UTF-8 | Java | false | false | 2,766 | java | package uk.gov.hmcts.probate.businessrule;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import uk.gov.hmcts.probate.model.ccd.raw.request.CaseData;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.openMocks;
import static uk.gov.hmcts.probate.model.Constants.NO;
import static uk.gov.hmcts.probate.model.Constants.YES;
class PA16FormBusinessRuleTest {
@InjectMocks
private PA16FormBusinessRule underTest;
@Mock
private CaseData mockCaseData;
@BeforeEach
public void setup() {
openMocks(this);
}
@Test
void shouldBeApplicableForChildAdoptedNoApplicantSiblingsRenouncing() {
when(mockCaseData.getSolsApplicantRelationshipToDeceased()).thenReturn("ChildAdopted");
when(mockCaseData.getSolsApplicantSiblings()).thenReturn(NO);
when(mockCaseData.getSolsSpouseOrCivilRenouncing()).thenReturn(YES);
assertTrue(underTest.isApplicable(mockCaseData));
}
@Test
void shouldBeApplicableForChildNoApplicantSiblingsYesRenouncing() {
when(mockCaseData.getSolsApplicantRelationshipToDeceased()).thenReturn("Child");
when(mockCaseData.getSolsApplicantSiblings()).thenReturn(NO);
when(mockCaseData.getSolsSpouseOrCivilRenouncing()).thenReturn(YES);
assertTrue(underTest.isApplicable(mockCaseData));
}
@Test
void shouldNOTBeApplicableForNotChildAdoptedNoApplicantSiblingsNoRenouncing() {
when(mockCaseData.getSolsApplicantRelationshipToDeceased()).thenReturn("SpouseOrCivil");
when(mockCaseData.getSolsApplicantSiblings()).thenReturn(NO);
when(mockCaseData.getSolsSpouseOrCivilRenouncing()).thenReturn(YES);
assertFalse(underTest.isApplicable(mockCaseData));
}
@Test
void shouldNOTBeApplicableForChildAdoptedYesApplicantSiblingsYesRenouncing() {
when(mockCaseData.getSolsApplicantRelationshipToDeceased()).thenReturn("ChildAdopted");
when(mockCaseData.getSolsApplicantSiblings()).thenReturn(YES);
when(mockCaseData.getSolsSpouseOrCivilRenouncing()).thenReturn(YES);
assertFalse(underTest.isApplicable(mockCaseData));
}
@Test
void shouldNOTBeApplicableForChildAdoptedNoApplicantSiblingsNoRenouncing() {
when(mockCaseData.getSolsApplicantRelationshipToDeceased()).thenReturn("ChildAdopted");
when(mockCaseData.getSolsApplicantSiblings()).thenReturn(NO);
when(mockCaseData.getSolsSpouseOrCivilRenouncing()).thenReturn(NO);
assertFalse(underTest.isApplicable(mockCaseData));
}
}
| [
"sanjay.parekh@hmcts.net"
] | sanjay.parekh@hmcts.net |
0e7453189d6bd704a37e6050d9d0863c7c2e05eb | b96ee7ae537733dba2046c13b053067b2845dee4 | /play-form/app/services/MyService.java | ab51259b2c397adf4390e4386d439046b3889941 | [
"Apache-2.0"
] | permissive | sangth95/play-service-ebean | 2ce7f093f57ac1e82730efe5ecadbdf8f1a19797 | beaffccee0cf3cdcc15662f9c345d371f5b61476 | refs/heads/master | 2020-06-17T14:42:44.906368 | 2016-11-30T10:57:12 | 2016-11-30T10:57:12 | 74,994,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package services;
import java.util.List;
import com.fasterxml.jackson.databind.node.ArrayNode;
import models.*;
public interface MyService {
//Course CRUD
Course createCourse(Course course);
Course readCourse(Integer id);
Course updateCourse(Course course);
Boolean deleteProject(Integer id);
List<Course> allCourse();
ArrayNode allStudentInCourse(Integer id);
Integer countCourse();
//Student CRUD
Student createStudent(Student student);
Student readStudent(Integer id);
Student updateStudent(Student student);
Boolean deleteStudent(Integer id);
List<Student> allStudent();
Integer countStudent();
}
| [
"truonghongsanglk95@gmail.com"
] | truonghongsanglk95@gmail.com |
2d4363fa211868212897f245a7a13933c4bd546f | dbe40c665f11ecfc3349bd84d7629f1e13720ac4 | /src/com/company/Main.java | f04f53d037c8d669540c996f7f11d74fb729eb70 | [] | no_license | SakanaKoi/NDrop | 3163183499d15d64463b5dcef9dccd1e14df6d78 | 252845fec77791fce689a1c18096277cfe45d2bb | refs/heads/master | 2023-01-05T16:28:21.740413 | 2020-11-03T07:07:47 | 2020-11-03T07:07:47 | 309,602,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 993 | java | package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//проблема: прямой доступ к полям класса. Такое нежелательно.
NDrob fract1 = new NDrob();
//fract1.num = 3;
//fract1.denom = 5;
fract1.setNum(3);
fract1.setDenom(5);
NDrob fract2 = new NDrob();
//fract2.num = sc.nextInt();
//fract2.denom = sc.nextInt();
fract2.setNum(sc.nextInt());
fract2.setDenom(sc.nextInt());
fract1.print();
System.out.println(fract2);
System.out.println(fract1.multi(fract2).evqleed(fract1.multi(fract2)));
System.out.println(fract1.div(fract2).evqleed(fract1.div(fract2)));
System.out.println(fract1.sum(fract2).evqleed(fract1.sum(fract2)));
System.out.println(fract1.differ(fract2).evqleed(fract1.differ(fract2)));
}
}
| [
"b.r.o.l@mail.ru"
] | b.r.o.l@mail.ru |
c92a0c2a4716d530af36c145d8e5de1143ec08f2 | 6eb86b69c3057d853daac3002ff4fa5e5dcadb36 | /src/view/javafx/MVVMDemoJFXController.java | c09d8d753021050cbd3b724471c5c8c6b4496c1f | [] | no_license | EWCMF/MVVMDemoJFX | 5fbd1ddfbc8620d47a36ef8bfb70326be8ae2943 | 3cfb52fb5500436c290b3be85a77f337b7b3bc22 | refs/heads/master | 2021-01-02T18:15:53.338663 | 2020-02-15T11:11:27 | 2020-02-15T11:11:27 | 239,739,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,203 | java | package view.javafx;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import persistence.SQLiteDBJava;
import view.TrueCasePresenter;
import java.util.Observable;
import java.util.Observer;
public class MVVMDemoJFXController {
@FXML private TextField textField;
@FXML private Label label;
@FXML private Button button;
SQLiteDBJava db;
TrueCasePresenter trueCasePresenter;
public void initialize() {
db = new SQLiteDBJava(null);
trueCasePresenter = new TrueCasePresenter(db.getModel());
label.setText(trueCasePresenter.getString());
button.setOnAction(event -> changeText());
trueCasePresenter.addObserver(new Observer() {
@Override
public void update(Observable observable, Object o) {
if (observable instanceof TrueCasePresenter) {
String string = ((TrueCasePresenter) observable).getString();
label.setText(string);
}
}
});
}
public void changeText() {
trueCasePresenter.setString(textField.getText());
}
}
| [
"54972963+EWCMF@users.noreply.github.com"
] | 54972963+EWCMF@users.noreply.github.com |
57a41308edfbe04022f042da1715f107d652aa4b | fda2971901092ec64e0ad508459bac688b796ceb | /src/main/java/com/win/payrollproject/PayRoll/EmployeeNotFoundAdvice.java | 5b94b37481ac0bfd01afd0886dd71e30cdce5c4e | [] | no_license | aprajitayadav/SpringBoot_PayRoll_HW0625_AY | df436326c78a52f8dbabac49331e0178b2ced2b8 | 5ae2bf371b10943399faa54d8c8f5374d4c8f9b5 | refs/heads/master | 2022-11-07T09:33:12.558451 | 2020-06-26T02:40:03 | 2020-06-26T02:40:03 | 275,058,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 611 | java | package com.win.payrollproject.PayRoll;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice
class EmployeeNotFoundAdvice {
@ResponseBody
@ExceptionHandler(EmployeeNotFoundException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
String employeeNotFoundHandler(EmployeeNotFoundException ex) {
return ex.getMessage();
}
} | [
"aprajita.yaduvanshi@gmail.com"
] | aprajita.yaduvanshi@gmail.com |
8173677f39ccd29502adb4bbdf817a035110832a | 792c024f4917fcaeccd7a4dfacf4f3e30fbaeab9 | /src/ua/artcode/week6/ex/TestUncheckedEx.java | e171f0432d3f54b223ab8cd918ffcff657f851cb | [] | no_license | presly808/ACO4 | 96db9134c3826bf2147c25927e698e81fa4c504b | 0cd4500c9dafac056ad1026ad112ac198ec8cc9e | refs/heads/master | 2021-01-02T09:19:46.728536 | 2015-04-04T11:56:19 | 2015-04-04T11:56:19 | 30,460,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package ua.artcode.week6.ex;
import java.util.Arrays;
/**
* Created by serhii on 21.03.15.
*/
public class TestUncheckedEx {
public static void main(String[] args) {
int a = 8;
int b = 10;
int res = b / a;
System.out.println("res = " + res);
}
}
| [
"presly808@gmail.com"
] | presly808@gmail.com |
3d317427879ad3b325cd541b5e98390f5a2a0d4d | ed3b5db79f904540bb8538b047d53f144f8ae3c5 | /src/ssm170730/Timer.java | dbaf221650b1d4a0f171d6f7482b86b8ba7729ef | [] | no_license | maneshreyash/SkipList | 9071530613d88514a7e22838682a09612a926a0e | 3a74dbe8de529f3b803e13120ae2dc8293ad5566 | refs/heads/master | 2020-03-31T10:39:52.405061 | 2018-10-15T01:47:09 | 2018-10-15T01:47:09 | 152,143,602 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 939 | java |
/** Timer class for roughly calculating running time of programs
* @author rbk
* Usage: Timer timer = new Timer();
* timer.start();
* timer.end();
* System.out.println(timer); // output statistics
*/
package ssm170730;
public class Timer {
long startTime, endTime, elapsedTime, memAvailable, memUsed;
public Timer() {
startTime = System.currentTimeMillis();
}
public void start() {
startTime = System.currentTimeMillis();
}
public Timer end() {
endTime = System.currentTimeMillis();
elapsedTime = endTime-startTime;
memAvailable = Runtime.getRuntime().totalMemory();
memUsed = memAvailable - Runtime.getRuntime().freeMemory();
return this;
}
public String toString() {
return "Time: " + elapsedTime + " msec.\n" + "Memory: " + (memUsed/1048576) + " MB / " + (memAvailable/1048576) + " MB.";
}
}
| [
"maneshreyashs@gmail.com"
] | maneshreyashs@gmail.com |
762cafb5802901505b18b533b9ce3b20d473ee29 | 28a6fc8602b1f1dc8bde851838836988309ff967 | /src/main/java/com/hzy/config/SwaggerConfig.java | a621c7dd80cbe3133b5cee0510efe3391f436012 | [] | no_license | sunyaohui/springboot-admin | 536f88185682c0560ca6892bbbb72db11adbdfe4 | 8040f483e5ae9db504ae6e0656b55c55c309d2f2 | refs/heads/master | 2022-07-01T03:43:02.527731 | 2019-05-30T01:28:58 | 2019-05-30T01:28:58 | 189,323,899 | 0 | 1 | null | 2020-07-01T18:47:51 | 2019-05-30T01:27:32 | Java | UTF-8 | Java | false | false | 2,565 | java | package com.hzy.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.common.base.Predicates;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
private static final String TITLE = "api文档";
private static final String VERSION = "1.0";
//监控所有的url
private static final String INTERCEPT_URL = "/.*";
//参数:token
private static final String HEADER_NAME = "token";
//参数备注信息
private static final String HEADER_DESCRIPTION = "请求头信息";
//请求参数类型,header
private static final String HEADER_PAR_TYPE = "header";
//是否必填:非必填
private static final Boolean HEADER_PAR_REQUIRED = false;
//参数数据类型,String
private static final String DATA_TYPE = "string";
@SuppressWarnings("unchecked")
@Bean
public Docket api() {
ApiSelectorBuilder asb = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo(TITLE))
.pathMapping("/")
.select();
List<String> list = YmlConfigStore.getBaseYmls().getSwagger().getSwaggerFilterUrl();
for (int i = 0; i < list.size(); i++) {
asb.paths(Predicates.not(PathSelectors.regex(list.get(i))));
}
return asb.paths(PathSelectors.regex(INTERCEPT_URL))
.build()
.globalOperationParameters(parameterBuilder());
}
private List<Parameter> parameterBuilder() {
ParameterBuilder tokenPar = new ParameterBuilder();
List<Parameter> pars = new ArrayList<Parameter>();
tokenPar.name(HEADER_NAME)
.description(HEADER_DESCRIPTION)
.modelRef(new ModelRef(DATA_TYPE))
.parameterType(HEADER_PAR_TYPE)
.required(HEADER_PAR_REQUIRED)
.build();
pars.add(tokenPar.build());
return pars;
}
private ApiInfo apiInfo(String desc) {
return new ApiInfoBuilder()
.title(desc)
.version(VERSION)
.build();
}
} | [
"sunyaohui107@163.com"
] | sunyaohui107@163.com |
7d6258441b1a4edef472ec55cc230a40a48d2fe4 | dd3fc6592c58341d8a2364d9f9a1695f59c9009a | /JDBCproject/src/com/ltts/dao/Playerdao.java | e8c8585fa8ee7a7193c68302c31010d6582f8a19 | [] | no_license | shreyansh1406/shareshadow | 820c36f47358a26ddaad8c58e501f631e2f2ad6f | 88906b977a9cf71b245eefcc0b39cd2db9023f28 | refs/heads/main | 2023-05-13T10:34:34.137908 | 2021-05-23T12:00:50 | 2021-05-23T12:00:50 | 345,407,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,379 | java | package com.ltts.dao;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.ltts.configuration.Connect;
import com.ltts.model.Player;
public class Playerdao {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void add() throws Exception
{
Connection con=Connect.getConnection();
PreparedStatement pst=con.prepareStatement("insert into Player values(?,?,?,?)");
System.out.println("enter id,name ,skill,nom");
int id=Integer.parseInt(br.readLine());
String name=br.readLine();
String skill=br.readLine();
int nom=Integer.parseInt(br.readLine());
Player p=new Player(id,name,skill,nom);
pst.setInt(1,id);
pst.setString(2,name);
pst.setString(3,skill);
pst.setInt(4,nom);
pst.executeUpdate();
System.out.println("record is inserted");
}
public void delete() throws Exception
{
Connection con2=Connect.getConnection();
PreparedStatement pst2=con2.prepareStatement("delete from Player where Id=?");
System.out.println("enter the id to delete");
int id2=Integer.parseInt(br.readLine());
pst2.setInt(1,id2);
pst2.executeUpdate();
System.out.println("record is deleted");
}
public void getall()
throws Exception
{
Connection con1=Connect.getConnection();
String query = "select * from Player";
PreparedStatement ps = con1.prepareStatement(query);
ResultSet rs = ps.executeQuery();
// List<Player> ls = new ArrayList();
// while (rs.next()) {
// Player emp = new Player();
// emp.setId(rs.getInt("Id"));
// emp.setName(rs.getString("name"));
// emp.setSkill(rs.getString("skill"));
// emp.setId(rs.getInt("numberofmatches"));
//
// ls.add(emp);
// }
// return ls;
while(rs.next()){
System.out.println(rs.getInt(1)+" " + rs.getString(2)+" " + rs.getString(3)+" " + rs.getInt(4));
}
}
public void update()
throws Exception
{
Connection con1=Connect.getConnection();
PreparedStatement pst1=con1.prepareStatement("update Player set id=? ");
System.out.println("enter the id to update");
int id1=Integer.parseInt(br.readLine());
pst1.setInt(1,id1);
pst1.executeUpdate();
System.out.println("record is updated");
}
}
| [
"shreyansh.jain@ltts.com"
] | shreyansh.jain@ltts.com |
f13b3df1fab6e7d8967d085519e8a53cd72c75f7 | f572e0ede050be232751940439b83a05f98273c0 | /src/main/java/br/com/vagas/service/mapper/CursoMapper.java | e5e5e5d00be56312c9436507f98e1ff3d36cf9ab | [] | no_license | adailtonlima/portal-vagas-bt | 8c4ba96115de6c387828a0be4f6fb98b341639cc | 1c2389881366f2ecc7f885e1c9b058497379636e | refs/heads/main | 2023-05-08T17:32:02.077641 | 2021-06-01T11:32:26 | 2021-06-01T11:32:26 | 372,805,501 | 0 | 0 | null | 2021-06-01T11:32:27 | 2021-06-01T11:28:34 | Java | UTF-8 | Java | false | false | 455 | java | package br.com.vagas.service.mapper;
import br.com.vagas.domain.*;
import br.com.vagas.service.dto.CursoDTO;
import org.mapstruct.*;
/**
* Mapper for the entity {@link Curso} and its DTO {@link CursoDTO}.
*/
@Mapper(componentModel = "spring", uses = { PessoaMapper.class })
public interface CursoMapper extends EntityMapper<CursoDTO, Curso> {
@Mapping(target = "pessoa", source = "pessoa", qualifiedByName = "nome")
CursoDTO toDto(Curso s);
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
3a89da85294a11fd0737d077020915ea3ebfc9ce | 166faa6f61e46955cda483af43ac77b01454ec52 | /sportify-v1/src/main/java/caa/sportify/utility/CustomJList.java | 1868d048e2aa958efe5b2b7b641b02928acc4368 | [] | no_license | crispinakomea/sportify-v1 | 791122ee410f6987f32f24730ef20a7f3de64941 | 0881368de18b9cf169958290979ea892de8b4e8c | refs/heads/master | 2021-04-29T16:03:40.516068 | 2018-10-06T20:37:51 | 2018-10-06T20:37:51 | 121,806,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package caa.sportify.utility;
import java.awt.Color;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
/**
* @author Crispin A.
*
*/
@SuppressWarnings("serial")
public class CustomJList extends JList<String> {
public CustomJList(String[] array) {
super(array);
setFixedCellWidth(175);
setFixedCellHeight(22);
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
setSelectionBackground(Color.darkGray);
}
}
| [
"Crispinakomea@gmail.com"
] | Crispinakomea@gmail.com |
d64076cd2e249ba50fe8329dfd6ac5038685c03a | 392d8ef9b7d8762f1b30fb55786cb9a2f04b34ae | /Sharif/src/test1.java | 6ec9cd66910888a86c0e8aaf86ffe35041ba4193 | [] | no_license | sharifulgeo/repo1 | 9945cb4dfea73e36979f6c8d18565e29b8b5f37e | b6cb517a1874ec54806821c13145c1f8b5e10ff0 | refs/heads/master | 2020-05-20T06:04:06.860272 | 2013-07-09T08:45:17 | 2013-07-09T08:45:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java |
public class test1 {
public test1() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
System.out.println("Im Bakul");
}
}
| [
"msig301331"
] | msig301331 |
2cca43f24792b57eb3937d9e45576ae102c82710 | 83d781a9c2ba33fde6df0c6adc3a434afa1a7f82 | /MarketBackend/src/com/newco/marketplace/business/businessImpl/so/pdf/TermsConditionsPDFTemplateImpl.java | d8734d3d3eed9054ca3cc1caab4fcf94a11b8308 | [] | no_license | ssriha0/sl-b2b-platform | 71ab8ef1f0ccb0a7ad58b18f28a2bf6d5737fcb6 | 5b4fcafa9edfe4d35c2dcf1659ac30ef58d607a2 | refs/heads/master | 2023-01-06T18:32:24.623256 | 2020-11-05T12:23:26 | 2020-11-05T12:23:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,713 | java | package com.newco.marketplace.business.businessImpl.so.pdf;
import java.io.StringReader;
import org.apache.log4j.Logger;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Image;
import com.lowagie.text.List;
import com.lowagie.text.PageSize;
import com.lowagie.text.Phrase;
import com.lowagie.text.html.simpleparser.StyleSheet;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import com.newco.marketplace.util.constants.SOPDFConstants;
import com.newco.marketplace.utils.ServiceLiveStringUtils;
public class TermsConditionsPDFTemplateImpl implements PDFTemplate{
private Logger logger = Logger.getLogger(TermsConditionsPDFTemplateImpl.class);
private Image logoImage;
private String termsCond;
public void execute(PdfWriter pdfWriter, Document document) throws DocumentException {
float pageWidth = PageSize.LETTER.getWidth();
float[] termsConditionsTableWidths = { 180, 180, 180 };
PdfPTable termsConditionsTable = new PdfPTable(termsConditionsTableWidths);
termsConditionsTable.setSplitLate(false);
PdfPCell cell = null;
termsConditionsTable.getDefaultCell().setBorder(0);
termsConditionsTable.setHorizontalAlignment(Element.ALIGN_CENTER);
termsConditionsTable.setTotalWidth(pageWidth - 72);
termsConditionsTable.setLockedWidth(true);
//adding terms and conditions
PdfPTable tableTermsCond = this.addTermsAndConditionsTable();
cell = new PdfPCell(tableTermsCond);
cell.setColspan(3);
cell.setMinimumHeight(300);
termsConditionsTable.addCell(cell);
// Empty Rows
SOPDFUtils.addEmptyRow(3, 0, -1, termsConditionsTable);
SOPDFUtils.addEmptyRow(3, 0, -1, termsConditionsTable);
document.newPage();
document.add(termsConditionsTable);
}
/**
* Method for adding terms and conditions to table
* @param so
* @return
*/
@SuppressWarnings("unchecked")
private PdfPTable addTermsAndConditionsTable() {
float[] tableTermsCondWidth = { 550 };
PdfPTable tableTermsCond = new PdfPTable(tableTermsCondWidth);
tableTermsCond.getDefaultCell().setBorder(1);
tableTermsCond.setHorizontalAlignment(Element.ALIGN_LEFT);
PdfPCell cellTermsCond = null;
StringReader strTermsCond = new StringReader(termsCond);
StyleSheet style = new StyleSheet();
cellTermsCond = new PdfPCell(new Phrase(SOPDFConstants.BUYER_TERMS_COND, SOPDFConstants.FONT_HEADER));
cellTermsCond.setBorder(0);
cellTermsCond.setHorizontalAlignment(Element.ALIGN_LEFT);
tableTermsCond.addCell(cellTermsCond);
//SL-20728
List termsAndConditions = null;
String terms = termsCond;
try {
//replace html character entities
terms = SOPDFUtils.getHtmlContent(terms);
//Convert the html content to rich text
termsAndConditions = SOPDFUtils.getRichText(terms, SOPDFConstants.FONT_LABEL_SMALL, null, SOPDFConstants.SPACE);
} catch (Exception e) {
logger.error("Error while converting rich text for " + SOPDFConstants.BUYER_TERMS_COND + e);
termsAndConditions = null;
}
if(null != termsAndConditions && !termsAndConditions.isEmpty()){
cellTermsCond = new PdfPCell();
cellTermsCond.addElement(termsAndConditions);
cellTermsCond.setBorder(0);
tableTermsCond.addCell(cellTermsCond);
}
else{
terms = termsCond;
//Remove the html tags
terms = ServiceLiveStringUtils.removeHTML(terms);
cellTermsCond = new PdfPCell(new Phrase(terms, SOPDFConstants.FONT_LABEL_SMALL));
cellTermsCond.setBorder(0);
tableTermsCond.addCell(cellTermsCond);
/*java.util.List<Paragraph> parasList = null;
try {
parasList = (java.util.List<Paragraph>)HTMLWorker.parseToList(strTermsCond, style);
} catch (IOException ioEx) {
logger.error("Unexpected IO Error while converting terms conditions HTML into list of iText Paragraphs", ioEx);
}
if (parasList != null) {
for(Paragraph para : parasList) {
cellTermsCond = new PdfPCell(new Phrase(para.getContent(), SOPDFConstants.FONT_LABEL_SMALL));
cellTermsCond.setBorder(0);
tableTermsCond.addCell(cellTermsCond);
}
}*/
}
cellTermsCond = new PdfPCell(new Phrase(" "));
cellTermsCond.setBorder(0);
tableTermsCond.addCell(cellTermsCond);
return tableTermsCond;
}
public Image getLogoImage() {
return logoImage;
}
public void setLogoImage(Image logoImage) {
this.logoImage = logoImage;
}
public String getTermsCond() {
return termsCond;
}
public void setTermsCond(String termsCond) {
this.termsCond = termsCond;
}
}
| [
"Kunal.Pise@transformco.com"
] | Kunal.Pise@transformco.com |
aa21135a5ecfeb4f58f360e239f607ba4a33849f | 9d6cca167c6ed884130b78e7867454cd2f2ad9c8 | /admin/src/main/java/com/wupaas/boot/admin/config/ShiroConfig.java | d1efa1c39756ad7395e5fcd860c14cdc8d9931f9 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-mulanpsl-1.0-en",
"MulanPSL-1.0"
] | permissive | jueyue/windbell | 470f6e7ad92d3b13dfa8df6afa0481bb34230bde | 8af280adcac4da0d96801999a667935871b5bdd1 | refs/heads/master | 2022-11-01T02:26:09.168901 | 2021-04-14T15:40:23 | 2021-04-14T15:40:23 | 196,199,062 | 5 | 2 | NOASSERTION | 2022-10-12T20:29:03 | 2019-07-10T12:13:13 | Java | UTF-8 | Java | false | false | 5,608 | java | package com.wupaas.boot.admin.config;
import com.wupaas.boot.core.business.security.shiro.*;
import com.wupaas.boot.core.business.security.shiro.cache.RedisCacheManager;
import org.apache.shiro.cache.CacheManager;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.session.mgt.SessionManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.web.filter.DelegatingFilterProxy;
import javax.servlet.Filter;
import java.util.*;
/**
* shiro的控制类
* Created by jeelus
*/
@Configuration
public class ShiroConfig {
@Bean
public static LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
public JwtAuthorizingRealm getJwtAuthorizingRealm() {
return new JwtAuthorizingRealm();
}
@Bean
public RedisCacheManager getRedisCacheManager() {
return new RedisCacheManager();
}
/**
* 并发登录控制
*
* @return
*/
@Bean
public LimitConcurrentSessionControlFilter limitConcurrentSessionControlFilter(CacheManager cacheManager) {
LimitConcurrentSessionControlFilter limitConcurrentSessionControlFilter = new LimitConcurrentSessionControlFilter();
//使用cacheManager获取相应的cache来缓存用户登录的会话;用于保存用户—会话之间的关系的;
limitConcurrentSessionControlFilter.setCacheManager(cacheManager);
//是否踢出后来登录的,默认是false;即后者登录的用户踢出前者登录的用户;
limitConcurrentSessionControlFilter.setKickoutAfter(false);
return limitConcurrentSessionControlFilter;
}
@Bean("shiroFilter")
public ShiroFilterFactoryBean factory(DefaultWebSecurityManager securityManager,
IShiroPermissionsHandler permissionsHandler) {
ShiroFilterFactoryBean factoryBean = new ShiroFilterFactoryBean();
Map<String, Filter> filterMap = new HashMap<>();
filterMap.put("restAuth", new RestUrlAuthorizationFilter());
filterMap.put("jwtAuth", new JwtAuthenticationFilter());
factoryBean.setFilters(filterMap);
factoryBean.setSecurityManager(securityManager);
factoryBean.setUnauthorizedUrl("/401");
Map<String, String> filterRuleMap = new LinkedHashMap<>();
permissionsHandler.getNotNeedPermissions().forEach(p -> filterRuleMap.put(p, "anon"));
filterRuleMap.put("/admin/userAuth/login", "anon");
filterRuleMap.put("/**", "jwtAuth,restAuth");
factoryBean.setFilterChainDefinitionMap(filterRuleMap);
return factoryBean;
}
@Bean(name = "basicHttpAuthenticationFilter")
public BasicHttpAuthenticationFilter casFilter() {
BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
basicHttpAuthenticationFilter.setLoginUrl("/login");
return basicHttpAuthenticationFilter;
}
@Bean(name = "securityManager")
public DefaultWebSecurityManager defaultWebSecurityManager(
JwtAuthorizingRealm authorizingRealm,
CacheManager cacheManager) {
DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager();
defaultWebSecurityManager.setCacheManager(cacheManager);
Collection<Realm> typeRealms = new ArrayList<>();
typeRealms.add(authorizingRealm);
defaultWebSecurityManager.setRealms(typeRealms);
return defaultWebSecurityManager;
}
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(
DefaultWebSecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
@Bean
public FilterRegistrationBean filterRegistrationBean() {
FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
filterRegistration.setFilter(new DelegatingFilterProxy("shiroFilter"));
filterRegistration.addInitParameter("targetFilterLifecycle", "true");
filterRegistration.setEnabled(true);
filterRegistration.setOrder(2);
filterRegistration.addUrlPatterns("/*");
return filterRegistration;
}
@Bean(name = "lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
@DependsOn("lifecycleBeanPostProcessor")
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
return defaultAdvisorAutoProxyCreator;
}
}
| [
"qrb.jueyue@gmail.com"
] | qrb.jueyue@gmail.com |
8dd1e3538650722eadd3fdde46afd100f35b7ce6 | 7ee56c8f8c1f34926107e00fb0abd3737dc4bcde | /ApplicationProgramming/src/Alphabet1.java | d2eb913008b058cc0392cdf19f18a436fb0a5f72 | [] | no_license | lamin1990/java_encoding | ee1ffbb930e1eaf800a7b02449902add1bb86f51 | 90bc110f79918993ea9ee60397a4928bd7f5365d | refs/heads/master | 2020-03-10T00:52:06.069019 | 2018-04-11T12:32:16 | 2018-04-11T12:32:16 | 129,093,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java |
public class Alphabet1 {
public static void main(String[] args) {
// 1. Write the shortest possible program that outputs the numbers between 0 and 100 to the console. hint: use a loop.
for(int i=1; i < 100; i++)
System.out.println(i);
// 2. Write the shortest possible program that outputs all the lower case letters of the alphabet to the console. hint: use a loop with a 'char' type variable.
for(char c='a'; c <= 'z'; c++)
System.out.println(c);
// 3. Write the shortest possible program that outputs all the upper case letters of the alphabet, in reverse order, to the console.
for(char c='Z'; c >= 'A'; c--)
System.out.println(c);
}
}
| [
"lamin.khanbsc@gmail.com"
] | lamin.khanbsc@gmail.com |
11c81d26cb78b5dc935c0b1cffb5b57f83c5b138 | e5e18e0421eb0f67ff7b297e21081e933a18768c | /app/src/main/java/com/dlvs/monstereditor/editor/RichTextEditorManager.java | 6e17d82628fc794f11ad3261865f071713636eff | [] | no_license | LaxusJie/MonsterEditor | aa8ff96d288dc510719b75ebefe6980c06650854 | 3c2ccb3391cf23eb060c2419376cdbaa55fa3eaf | refs/heads/master | 2021-01-22T21:17:23.977453 | 2017-08-18T09:18:08 | 2017-08-18T09:18:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,723 | java | package com.dlvs.monstereditor.editor;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Looper;
import android.widget.EditText;
import com.bumptech.glide.Glide;
import com.dlvs.monstereditor.Network;
import com.dlvs.monstereditor.R;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* desc:编辑器管理类
* author:mgq
* date:2017-06-06
*/
public class RichTextEditorManager {
/*编辑器所展示数据的集合*/
private List<EditorDataEntity> editShowList = new ArrayList<>();
/*编辑器中多媒体数据集合*/
private List<EditorDataEntity> editorDataList = new ArrayList<>();
/*富文本编辑器*/
private RichTextEditor editor;
/*上下文*/
private Context mContext;
/*标签长度*/
private int tagLength = -8;
private boolean richEditorStatus = true;
public int editorBackground = 0;
public RichTextEditorManager(Context mContext) {
this.mContext = mContext;
}
public RichTextEditorManager(RichTextEditor editor, Context mContext) {
this.editor = editor;
this.mContext = mContext;
}
public boolean isRichEditorStatus() {
return richEditorStatus;
}
public void setRichEditorStatus(boolean richEditorStatus) {
this.richEditorStatus = richEditorStatus;
}
/*回显数据*/
private void showData(boolean status) {
int k = 0;
for (int i = 0; i < editShowList.size(); i++) {
if (editShowList.get(i).getType().equals(RichTextEditor.TYPE_TEXT) || editShowList.get(i).getType().equals(RichTextEditor.TYPE_ALINK)) {
if (editShowList.get(i).getText().trim().length() <= 0) {
continue;
}
editor.addEditTextAtIndex(k, editShowList.get(i).getText(), editShowList.get(i).getType());
} else if (editShowList.get(i).getType().equals(RichTextEditor.TYPE_AUDIO)) {
// editor.addAudioViewAtIndex(k, editShowList.get(i));
} else if (editShowList.get(i).getType().equals(RichTextEditor.TYPE_VIDEO)) {
editor.addImageViewAtIndex(k, editShowList.get(i));
} else {
editor.addImageViewAtIndex(k, editShowList.get(i));
}
k++;
}
}
/*过滤html数据*/
public void filterHtml(final String htmlStr) {
//过滤
filterData(htmlStr);
//排序
sortMediaPosition();
}
/**
* 过滤数据
*
* @param htmlStr
* @return
*/
public String filterData(String htmlStr) {
// 替换换行
htmlStr = htmlStr.replace("<br>", "\n");
htmlStr = htmlStr.replace("</p>", "\n");
// 过滤script标签
htmlStr = getHtmlFilterString(EditorConstants.REGEX_SCRIPT, htmlStr);
// 过滤style标签
htmlStr = getHtmlFilterString(EditorConstants.REGEX_STYLE, htmlStr);
// 过滤html标签
htmlStr = getHtmlFilterString(EditorConstants.REGEX_HTML, htmlStr);
//过滤多媒体标签之前拆分数据
splitTextData(htmlStr);
//过滤附件a标签
htmlStr = getMediaFilterString(EditorConstants.REGEX_ATTACHMENT, htmlStr, RichTextEditor.TYPE_ALINK);
//过滤图片
htmlStr = getMediaFilterString(EditorConstants.REGEX_IMG, htmlStr, RichTextEditor.TYPE_IMAGE);
//过滤音频
htmlStr = getMediaFilterString(EditorConstants.REGEX_AUDIO, htmlStr, RichTextEditor.TYPE_AUDIO);
//过滤视频
htmlStr = getMediaFilterString(EditorConstants.REGEX_VEDIO, htmlStr, RichTextEditor.TYPE_VIDEO);
ensureMediaTagPosition(htmlStr, RichTextEditor.TYPE_ALINK);
ensureMediaTagPosition(htmlStr, RichTextEditor.TYPE_IMAGE);
ensureMediaTagPosition(htmlStr, RichTextEditor.TYPE_AUDIO);
ensureMediaTagPosition(htmlStr, RichTextEditor.TYPE_VIDEO);
htmlStr = replaceTagByUrl(htmlStr, RichTextEditor.TYPE_ALINK);
htmlStr = replaceTagByUrl(htmlStr, RichTextEditor.TYPE_IMAGE);
htmlStr = replaceTagByUrl(htmlStr, RichTextEditor.TYPE_AUDIO);
htmlStr = replaceTagByUrl(htmlStr, RichTextEditor.TYPE_VIDEO);
return htmlStr;
}
/*将tag标签替换为对应的url*/
private String replaceTagByUrl(String htmlStr, String tag) {
for (int i = 0; i < editorDataList.size(); i++) {
if (tag.equals(editorDataList.get(i).getType())) {
if (tag.equals(RichTextEditor.TYPE_ALINK)) {
htmlStr = htmlStr.replaceFirst(tag, editorDataList.get(i).getText());
} else {
htmlStr = htmlStr.replaceFirst(tag, editorDataList.get(i).getUrl());
}
}
}
return htmlStr;
}
/**
* 确定多媒体标签的位置
*
* @param htmlStr
*/
public void ensureMediaTagPosition(String htmlStr, String tag) {
int position = tagLength;
for (int i = 0; i < editorDataList.size(); i++) {
position = htmlStr.indexOf(tag, position + 8);
for (int k = 0; k < editorDataList.size(); k++) {
if (editorDataList.get(k).getPosition() == 0 && tag.equals(editorDataList.get(k).getType())) {
editorDataList.get(k).setPosition(position);
break;
}
}
}
}
/**
* 获取过滤多媒体标签后的数据
*/
public String getMediaFilterString(String reg, String htmlStr, String tag) {
EditorDataEntity editorDataEntity;
//过滤标签
Pattern p_img = Pattern.compile(reg, Pattern.CASE_INSENSITIVE);
Matcher m_img = p_img.matcher(htmlStr);
while (m_img.find()) {
editorDataEntity = new EditorDataEntity();
if (tag.equals(RichTextEditor.TYPE_ALINK)) {
editorDataEntity.setText(m_img.group(1));
} else {
editorDataEntity.setUrl(m_img.group(1));
}
editorDataEntity.setType(tag);
if (tag.equals(RichTextEditor.TYPE_AUDIO) || tag.equals(RichTextEditor.TYPE_VIDEO)) {
editorDataEntity.setName(m_img.group(3));
editorDataEntity.setPath(m_img.group(5));
editorDataEntity.setAliasname(m_img.group(7));
}
if (tag.equals(RichTextEditor.TYPE_VIDEO)) {
editorDataEntity.setPoster(m_img.group(9));
}
editorDataList.add(editorDataEntity);
}
htmlStr = m_img.replaceAll(tag);
return htmlStr;
}
/**
* 过滤普通Html标签
*/
public String getHtmlFilterString(String reg, String htmlStr) {
Pattern p_html = Pattern.compile(reg, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll("");
return htmlStr;
}
/*拆分文本数据*/
public void splitTextData(String htmlStr) {
String data = htmlStr;
data = insertSplitTag(data, EditorConstants.REGEX_ATTACHMENT);
data = insertSplitTag(data, EditorConstants.REGEX_IMG);
data = insertSplitTag(data, EditorConstants.REGEX_AUDIO);
data = insertSplitTag(data, EditorConstants.REGEX_VEDIO);
addTextToEditList(data);
}
/*插入拆分标签*/
public String insertSplitTag(String data, String reg) {
Pattern p_img = Pattern.compile(reg, Pattern.CASE_INSENSITIVE);
Matcher m_img = p_img.matcher(data);
data = m_img.replaceAll(EditorConstants.SPLITTAG);
return data;
}
/*将文本数据装载到编辑器集合中*/
public void addTextToEditList(String data) {
String filterData = getHtmlFilterString(EditorConstants.REGEX_AA,data);
String[] textData = filterData.split(EditorConstants.SPLITTAG);
for (int i = 0; i < textData.length; i++) {
editShowList.add(new EditorDataEntity(RichTextEditor.TYPE_TEXT, textData[i]));
}
}
/**
* 对多媒体资源位置进行排序
*/
private void sortMediaPosition() {
Collections.sort(editorDataList, new Comparator<EditorDataEntity>() {
@Override
public int compare(EditorDataEntity lhs, EditorDataEntity rhs) {
return lhs.getPosition() - rhs.getPosition();
}
});
setMediaBitmap();
}
/*设置bitmap*/
private void setMediaBitmap() {
new AsyncTask<Void, Void, Boolean>() {
@Override
protected Boolean doInBackground(Void... params) {
if (Looper.myLooper() == null) {
Looper.prepare();
}
try {
for (int i = 0; i < editorDataList.size(); i++) {
if (editorDataList.get(i).getType().equals(RichTextEditor.TYPE_IMAGE)) {
String url = editorDataList.get(i).getUrl();
if(!url.contains("http")){
url = Network.FILE_SERVER_COMMON_URL + url;
}
editorDataList.get(i).setBitmapResource(Glide.with(mContext).load(url).asBitmap().into(500, 500).get());
} else if (editorDataList.get(i).getType().equals(RichTextEditor.TYPE_VIDEO) || editorDataList.get(i).getType().equals(RichTextEditor.TYPE_AUDIO)) {
editorDataList.get(i).setBitmapResource(Glide.with(mContext).load(Network.FILE_SERVER_COMMON_URL + editorDataList.get(i).getPoster()).asBitmap().into(500, 500).get());
}
}
} catch (InterruptedException e) {
e.printStackTrace();
return false;
} catch (ExecutionException e) {
e.printStackTrace();
return false;
}
return true;
}
@Override
protected void onPostExecute(Boolean aBoolean) {
super.onPostExecute(aBoolean);
//组合文本数据和多媒体数据
for (int i = 0; i < editorDataList.size(); i++) {
if (editorDataList.get(i).getBitmapResource() == null) {
editorDataList.get(i).setBitmapResource(BitmapFactory.decodeResource(mContext.getResources(), R.mipmap.default_bg));
}
EditorDataEntity editData = new EditorDataEntity(editorDataList.get(i).getText(), editorDataList.get(i).getType(), editorDataList.get(i).getUrl(), editorDataList.get(i).getBitmapResource());
editData.setMediaPath(editData.getUrl());
int number = 2 * i + 1;
if (number > editShowList.size()) {
editShowList.add(editData);
} else {
editShowList.add(number, editData);
}
}
showData(isRichEditorStatus());
}
}.execute();
}
/**
* 添加图片到富文本剪辑器
*/
public void insertBitmap(EditorDataEntity editorDataEntity) {
editor.insertImage(editorDataEntity);
}
/**
* 获得多媒体个数
*
* @param type
* @return
*/
public int getMediaCount(String type) {
int audioCount = 0;
int videoCount = 0;
List<EditorDataEntity> editorDataEntityList = editor.buildEditData();
for (int i = 0; i < editorDataEntityList.size(); i++) {
if (editorDataEntityList.get(i).getType().equals(RichTextEditor.TYPE_AUDIO)) {
audioCount++;
continue;
}
if (editorDataEntityList.get(i).getType().equals(RichTextEditor.TYPE_VIDEO)) {
videoCount++;
}
}
if (type.equals(RichTextEditor.TYPE_AUDIO)) {
return audioCount;
} else {
return videoCount;
}
}
public void setEditorHint(String hint) {
editor.setEditHint(hint);
}
public List<EditorDataEntity> getEditorDataList() {
return editorDataList;
}
public List<EditorDataEntity> getEditShowList() {
return editShowList;
}
public EditText setEditTextFocus(){
return editor.setEditTextFocus();
}
}
| [
"394692633@qq.com"
] | 394692633@qq.com |
92b6c78f2c09da464e075fbed76960b71c237c66 | c309d18e695caf34b40efff3db98e75542071042 | /src/controller/TelaEditaAviaoController.java | 921191046b7e4537a7a22c2dc7a6e7e80f91522b | [] | no_license | LucasGuasselli/Venda_Passagem_Aerea_FX | 0c18e108fcdaaac9927d4099f40560174998c543 | b3409414eece96965d1f792216e488aad63ee303 | refs/heads/master | 2021-01-21T15:06:58.211799 | 2017-07-13T19:59:05 | 2017-07-13T19:59:05 | 95,376,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,935 | 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 controller;
import DAO.AviaoDAO;
import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import java.util.List;
import java.util.Optional;
import java.util.ResourceBundle;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import javafx.util.Callback;
import model.Aviao;
import util.Digita;
/**
*
* @author Lucas Guasselli
* @since 03/07/2017
* @version 3.2
*
*/
public class TelaEditaAviaoController implements Initializable {
@FXML
AnchorPane telaEditaAviao;
@FXML
private TextField tfCodigo_alterar;
@FXML
private TextField tfCodigo;
@FXML
private TextField tfNome;
@FXML
private TextField tfQtdeAssentos;
@FXML
private TableView<Aviao> tableViewAviao;
@FXML
private TableColumn<Aviao, String> tableColumnCodigo;
@FXML
private TableColumn<Aviao, String> tableColumnNome;
@FXML
private TableColumn<Aviao, String> tableColumnQtdeAssentos;
private List<Aviao> listaAvioes;
private ObservableList<Aviao> observableListAvioes;
private AviaoDAO aDAO = new AviaoDAO();
private Digita d = new Digita();
private Aviao avi = null;
@FXML
private void onActionEditar(ActionEvent event) throws ClassNotFoundException, SQLException {
if(verificaCamposVazios() == true){
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("CAMPOS VAZIOS");
alert.setHeaderText(null);
alert.setContentText("Voce deve preencher todos os campos!!");
alert.showAndWait();
}else{
if(validaCampos() == false){
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("CAMPOS CHEIOS");
alert.setHeaderText(null);
alert.setContentText("Voce excedeu a quantidade de caracteres de algum campo!!");
alert.showAndWait();
}else{
if(aDAO.verificaAviaoByCod(Integer.parseInt(tfCodigo_alterar.getText())) == true){
editarAviao();
}else{
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("ERRO");
alert.setHeaderText(null);
alert.setContentText("Aviao nao cadastrado!!");
alert.showAndWait();
}//fecha if-else
}//fecha if-else
}//fecha if-else
}//fecha handle event
@Override
public void initialize(URL url, ResourceBundle rb) {
try{
listaAvioes = aDAO.retornaListaAvioes();
carregaTableViewAvioes();
}catch(Exception e){
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("EXCEÇÃO");
alert.setHeaderText(null);
alert.setContentText("erro ao receber avioes do banco!");
alert.showAndWait();
}//try-catch
}//fecha initialize
private void carregaTableViewAvioes() {
tableColumnCodigo.setCellValueFactory(
new Callback<TableColumn.CellDataFeatures<Aviao,String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(TableColumn.CellDataFeatures<Aviao, String> linha) {
final Aviao aviao = linha.getValue();
final SimpleObjectProperty<String> simpleObject =
new SimpleObjectProperty(
Integer.toString(aviao.getCodigo())
);
return simpleObject;
}
});
tableColumnNome.setCellValueFactory(new PropertyValueFactory<>("nome"));
tableColumnQtdeAssentos.setCellValueFactory(
new Callback<TableColumn.CellDataFeatures<Aviao,String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(TableColumn.CellDataFeatures<Aviao, String> linha) {
final Aviao aviao = linha.getValue();
final SimpleObjectProperty<String> simpleObject =
new SimpleObjectProperty(
Integer.toString(aviao.getQtdeAssentos())
);
return simpleObject;
}
});
observableListAvioes = FXCollections.observableArrayList(listaAvioes);
tableViewAviao.setItems(observableListAvioes);
}//fecha metodo carregaTableView
private void editarAviao(){
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Confirmacao");
alert.setHeaderText(null);
alert.setContentText("Voce tem certeza sobre editar este aviao?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
try{
avi = (aDAO.retornaAviaoByCod(Integer.parseInt(tfCodigo_alterar.getText())));
String nome = tfNome.getText();
nome = nome.toLowerCase();
nome = nome.substring(0,1).toUpperCase().concat(nome.substring(1));
aDAO.editarAviao(new Aviao(avi.getId(),Integer.parseInt(tfCodigo.getText()),
nome, Integer.parseInt(tfQtdeAssentos.getText())));
alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("SUCESSO!");
alert.setHeaderText(null);
alert.setContentText("Aviao editado com sucesso!");
alert.showAndWait();
} catch (Exception e){
alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("EXCEÇÃO");
alert.setHeaderText(null);
alert.setContentText("erro ao editar aviao!");
alert.showAndWait();
}//try-catch
} else {
alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("CANCELADO!");
alert.setHeaderText(null);
alert.setContentText("edicao cancelada com sucesso!");
alert.showAndWait();
}//fecha if-else
}//fecha editar Aviao
@FXML
private void onActionLimpar(ActionEvent event){
limpar();
}//fecha onActionLimpar
@FXML
private void tratarBotaoVoltar(ActionEvent event) throws IOException {
System.out.println("Voltar");
Stage stage = (Stage) telaEditaAviao.getScene().getWindow();
stage.close();
}//fecha botao voltar
private void limpar(){
tfCodigo_alterar.setText("");
tfCodigo.setText("");
tfNome.setText("");
tfQtdeAssentos.setText("");
}//fecha limpar
private boolean verificaCamposVazios() {
if(tfCodigo_alterar.getText().isEmpty() || tfCodigo.getText().isEmpty() || tfNome.getText().isEmpty() || tfQtdeAssentos.getText().isEmpty()){
return true;
}//fecha if
return false;
}//fecha verificaCampos Vazios
private boolean validaCampos(){
try{
if(d.validaCodigo(tfCodigo_alterar.getText()) &&
d.validaCodigo(tfCodigo.getText()) == true &&
d.validaNome(tfNome.getText()) == true &&
d.validaQtdeAssentos(tfQtdeAssentos.getText()) == true){
return true;
}
}catch(Exception e){
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("EXCEÇÃO");
alert.setHeaderText(null);
alert.setContentText("DIGITE UM NUMERO INTEIRO");
alert.showAndWait();
}//fecha try-catch
return false;
}//fecha validaCampos
}//fecha classe
| [
"lucaszack265@gmail.com"
] | lucaszack265@gmail.com |
88a76683bdd3e74377b7efdd92964029926d7aa7 | b248accc100195100a05b3470c6dd87e881bc1fb | /espacedev.gaml.extensions.genstar/src/core/metamodel/attribute/emergent/filter/GSMatchFilter.java | 80fa1d4d159ce7fcb7a6ff05212ff5d19455b6c8 | [] | no_license | gama-platform/gama.experimental | e59df86a518295d3b4408b2ebe3e8ab343f27951 | f27c88cbe53a8850dc203b588b597f4162210774 | refs/heads/GAMA_1.9.0 | 2023-08-06T14:58:18.989889 | 2023-07-14T10:25:27 | 2023-07-14T10:25:27 | 59,318,904 | 19 | 7 | null | 2023-05-04T07:43:24 | 2016-05-20T18:53:28 | Java | UTF-8 | Java | false | false | 1,784 | java | package core.metamodel.attribute.emergent.filter;
import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonTypeName;
import core.metamodel.attribute.EmergentAttribute;
import core.metamodel.attribute.IAttribute;
import core.metamodel.entity.IEntity;
import core.metamodel.entity.matcher.IGSEntityMatcher;
import core.metamodel.entity.matcher.MatchType;
import core.metamodel.value.IValue;
/**
* Filter entity by matching at least one attribute with vector matcher.
*
* @author kevinchapuis
*
*/
@JsonTypeName(GSMatchFilter.SELF)
public class GSMatchFilter<T> extends AGSEntitySelector<Collection<IEntity<? extends IAttribute<? extends IValue>>>, T> {
public static final String SELF = "MATCH FILTER";
public GSMatchFilter(IGSEntityMatcher<T> matcher, MatchType match) {
super(matcher, match);
}
public GSMatchFilter(IGSEntityMatcher<T> matcher) {
super(matcher);
}
@Override
public Collection<IEntity<? extends IAttribute<? extends IValue>>> apply(IEntity<? extends IAttribute<? extends IValue>> superEntity) {
return superEntity.getChildren().stream()
.filter(e -> this.validate(super.getMatchType(), e))
.sorted(super.getComparator())
.collect(Collectors.toCollection(this.getSupplier()));
}
// TODO : turn this and IEntity parametric references to Map<Attribute,Value> abstract representation
// FIXME : this wont work because it make a reference to an EmergentAttribute that encapsulate a collection of Entity (rather than entities)
@Override
public <V extends IValue> Map<IAttribute<? extends IValue>, IValue> reverse(
EmergentAttribute<V, Collection<IEntity<? extends IAttribute<? extends IValue>>>, T> attribute, V value) {
return null;
}
}
| [
"kevin.chapuis@gmail.com"
] | kevin.chapuis@gmail.com |
90a6e58ad37c1633d2b613c934887b487ee0e003 | 73c99cac5b77da4dbaa8ac4731adf4d8e0d724f1 | /Snatch/app/src/main/java/cl/snatch/snatch/receivers/PhoneObserver.java | b4b19f97ec2b88561a24d166155af10c1ae30589 | [] | no_license | rmujica/snatch-android | 91ad3aee554e4ec4783c28d705b6f1d4cf438993 | fc3020e838ad3cfaab3210c554af1cc4ee8ca02b | refs/heads/master | 2021-01-15T12:32:28.679270 | 2015-03-25T22:40:00 | 2015-03-25T22:40:00 | 29,935,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | package cl.snatch.snatch.receivers;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.util.Log;
public class PhoneObserver extends ContentObserver {
/**
* Creates a content observer.
*
* @param handler The handler to run {@link #onChange} on, or null if none.
*/
public PhoneObserver(Handler handler) {
super(handler);
}
@Override
public void onChange(boolean selfChange) {
onChange(selfChange, null);
}
@Override
public void onChange(boolean selfChange, Uri uri) {
Log.d("cl.snatch.snatch", "change happened");
}
}
| [
"rene.mujica.m@gmail.com"
] | rene.mujica.m@gmail.com |
fda2ee58a166f29daad08849f77485ef9d86772e | adcea0d809a9307117bd2d6d7259c96efc88fc42 | /mm-core/src/main/java/com/wasu/springboot/integration/utils/DateUtils.java | 00b224abeb2639711f0155619084d4155ca652cc | [] | no_license | kalegege/springboot-integration | b72ef0a75a442beaff46d3b32c4d65f92aa50221 | 07f6e11acad5c486d6a4df82f3234e2e8cee5344 | refs/heads/master | 2022-10-27T11:47:06.600116 | 2019-11-29T07:19:22 | 2019-11-29T07:19:22 | 163,186,910 | 1 | 0 | null | 2022-10-12T20:28:12 | 2018-12-26T14:12:12 | Java | UTF-8 | Java | false | false | 7,608 | java | package com.wasu.springboot.integration.utils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class DateUtils {
private static final String[] DAYNAMES = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final List<String> DATE_FORMATE_LIST = new ArrayList<>(Arrays.asList(
"yyyy-MM-dd", "yyyy/MM/dd", "yyyy/MM/dd", "yyyyMMdd"
));
public static final String DATE_FORMATE_1 = "yyyy-MM-dd";
public static final String DATE_FORMATE_2 = "yyyy/MM/dd";
public static final String DATE_FORMATE_3 = "yyyy/MM/dd";
public static final String DATE_FORMATE_4 = "yyyyMMdd";
public static Date getNow() {
return new Date();
}
public static String formate(Date date){
return formatDateTime(date,"yyy-MM-dd HH:mm:ss");
}
public static Date parseDate(String dateTime) {
return parse(dateTime, DATE_FORMATE_1);
}
public static Date getAfterMonth(Date date, int month) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(2, month);
return c.getTime();
}
public static Date getLastDay(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(5, 1);
c.add(2, 1);
c.add(5, -1);
return c.getTime();
}
public static int getDiffMonth(Date startDate, Date endDate) {
Calendar cStart = Calendar.getInstance();
Calendar cEnd = Calendar.getInstance();
cStart.setTime(startDate);
cEnd.setTime(endDate);
int mStart = cStart.get(2) + 1;
int mEnd = cEnd.get(2) + 1;
int checkMonth = mEnd - mStart + (cEnd.get(1) - cStart.get(1)) * 12;
return checkMonth;
}
/**
* @param dateTime
* @return
*/
public static Boolean isDate(String dateTime) {
try {
parse(dateTime, DATE_FORMATE_1);
} catch (Exception ex) {
try {
parse(dateTime, DATE_FORMATE_2);
} catch (Exception ex1) {
try {
parse(dateTime, DATE_FORMATE_3);
} catch (Exception ex2) {
try {
parse(dateTime, DATE_FORMATE_4);
} catch (Exception ex3) {
return Boolean.valueOf(false);
}
}
}
}
return Boolean.valueOf(true);
}
/**
*
* @param date
* @return
*/
public static Date getDate(String date) {
for (int i = 0; i < DATE_FORMATE_LIST.size(); i++) {
Date d = parse(date, DATE_FORMATE_LIST.get(i));
if(null == d){
continue;
}else{
return d;
}
}
return null;
}
public static Date parseDateTime(String dateTime) {
return parse(dateTime, DATE_TIME_FORMAT);
}
public static Date parseDateTimeForUK(String dateTime) throws ParseException, RuntimeException {
DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
return dateFormat.parse(dateTime);
}
public static Date parse(String dateTime, String formate) {
if (StringUtils.isBlank(dateTime)) return null;
DateFormat dateFormat = new SimpleDateFormat(formate);
try {
return dateFormat.parse(dateTime);
} catch (ParseException e) {
throw new RuntimeException("formate date error!", e);
}
}
public static String formatDateTime(Date date, String format) {
if (date == null) return null;
DateFormat dateFormat = new SimpleDateFormat(format);
return dateFormat.format(date);
}
/**
* 获取两个日期之间的年份和月份
*
* @param minDate
* @param maxDate
* @return
*/
public static List<String> getMonthBetween(String minDate, String maxDate) {
List<String> result = new ArrayList<>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
Calendar min = Calendar.getInstance();
Calendar max = Calendar.getInstance();
try {
min.setTime(simpleDateFormat.parse(minDate));
min.set(min.get(Calendar.YEAR), min.get(Calendar.MONTH), 1);
max.setTime(simpleDateFormat.parse(maxDate));
max.set(max.get(Calendar.YEAR), max.get(Calendar.MONTH), 2);
Calendar curr = min;
while (curr.before(max)) {
result.add(simpleDateFormat.format(curr.getTime()));
curr.add(Calendar.MONTH, 1);
}
} catch (ParseException e) {
e.printStackTrace();
}
return result;
}
public static int getValidMonthInternal(Date fromDate, Date toDate) {
if (fromDate.after(toDate)) {
Date t = fromDate;
fromDate = toDate;
toDate = t;
}
Calendar fromCalender = Calendar.getInstance();
fromCalender.setTime(fromDate);
int fromYear = fromCalender.get(Calendar.YEAR);
int fromMonth = fromCalender.get(Calendar.MONTH);
Calendar toCalender = Calendar.getInstance();
toCalender.setTime(fromDate);
int toYear = toCalender.get(Calendar.YEAR);
int toMonth = toCalender.get(Calendar.MONTH);
int internal = (toYear - fromYear) * 12 + (toMonth - fromMonth);
return internal > 0 ? internal : 0;
}
public static int getSubDay(Date first, Date second) {
Calendar firstCalendar=Calendar.getInstance();
firstCalendar.setTime(first);
Calendar secondCalendar=Calendar.getInstance();
secondCalendar.setTime(second);
StringBuilder sbFirst=new StringBuilder();
sbFirst.append(firstCalendar.get(Calendar.YEAR));
sbFirst.append("-");
sbFirst.append(firstCalendar.get(Calendar.MONTH) + 1);
sbFirst.append("-");
sbFirst.append(firstCalendar.get(Calendar.DAY_OF_MONTH));
StringBuilder sbSecond=new StringBuilder();
sbSecond.append(secondCalendar.get(Calendar.YEAR));
sbSecond.append("-");
sbSecond.append(secondCalendar.get(Calendar.MONTH) + 1);
sbSecond.append("-");
sbSecond.append(secondCalendar.get(Calendar.DAY_OF_MONTH));
Date firstYmd=parse(sbFirst.toString(),"yyyy-M-dd");
Date secondYmd=parse(sbSecond.toString(),"yyyy-MM-dd");
return getDiffDay(firstYmd,secondYmd);
}
private static Integer getDiffDay(Date start, Date end) {
if(start.after(end)){
Date temp=start;
start=end;
end=temp;
}
Calendar startCalendar=Calendar.getInstance();
startCalendar.setTime(start);
Calendar endCalendar=Calendar.getInstance();
endCalendar.setTime(end);
Integer len=Integer.valueOf((endCalendar.get(1)-startCalendar.get(1)) * 12 + endCalendar.get(2)
- startCalendar.get(2));
if(endCalendar.get(5) < startCalendar.get(5)){
len=Integer.valueOf(len.intValue() - 1);
}
return len;
}
public static Date addOrSubDay(Date date, int day) {
Calendar calendar=Calendar.getInstance();
calendar.setTime(date);
calendar.add(5,day);
return calendar.getTime();
}
}
| [
"xv88133536@163.com"
] | xv88133536@163.com |
df629d4c703d41f15de5e7ea09d5019d787a7252 | bec1efb7d98851d1e274283ae1539b6e0cec3d83 | /client/app/src/main/java/ir/mohammadpour/app/ui/widget/slider/Transformers/ForegroundToBackgroundTransformer.java | 295b461ee939b5a99f2552daa53b20469d28cdce | [] | no_license | aminm1993/MultiCriteriaRecommendationSystem | 55f4632b6afe4cba0b2fec25cecdb67de1dbb18a | 54cfd6c18f4ee12dcdcf5813c1c57a0a4f84d12a | refs/heads/master | 2020-04-20T17:40:35.957789 | 2019-02-08T08:31:41 | 2019-02-08T08:31:41 | 168,995,816 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package ir.mohammadpour.app.ui.widget.slider.Transformers;
import android.view.View;
import com.nineoldandroids.view.ViewHelper;
public class ForegroundToBackgroundTransformer extends BaseTransformer {
@Override
protected void onTransform(View view, float position) {
final float height = view.getHeight();
final float width = view.getWidth();
final float scale = min(position > 0 ? 1f : Math.abs(1f + position), 0.5f);
ViewHelper.setScaleX(view,scale);
ViewHelper.setScaleY(view,scale);
ViewHelper.setPivotX(view,width * 0.5f);
ViewHelper.setPivotY(view,height * 0.5f);
ViewHelper.setTranslationX(view,position > 0 ? width * position : -width * position * 0.25f);
}
private static final float min(float val, float min) {
return val < min ? min : val;
}
}
| [
"amin.mohamadpour72@gmail.com"
] | amin.mohamadpour72@gmail.com |
d2e3c7fb6a8b871b8a05f3d21e0b7aeaf7b9cc11 | 4ec1401e1c2a0a049cdb8733bb02d922d64723eb | /app/src/main/java/com/wteam/carkeeper/map/NaviActivity.java | 2c1387716e420293788a2867188438250080cef4 | [] | no_license | LHBGit/Carkeeper | 6c4b4c5ada1a52929e7c158607e7e8f3b2e2e7fd | db415ab6e61820a0551e8dfa32339a95ba899379 | refs/heads/master | 2021-01-21T15:04:41.265781 | 2016-06-12T03:15:58 | 2016-06-12T03:15:58 | 58,925,118 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,993 | java | package com.wteam.carkeeper.map;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Window;
import android.widget.Toast;
import com.amap.api.navi.AMapNavi;
import com.amap.api.navi.AMapNaviListener;
import com.amap.api.navi.AMapNaviView;
import com.amap.api.navi.AMapNaviViewListener;
import com.amap.api.navi.enums.NaviType;
import com.amap.api.navi.enums.PathPlanningStrategy;
import com.amap.api.navi.model.AMapLaneInfo;
import com.amap.api.navi.model.AMapNaviCross;
import com.amap.api.navi.model.AMapNaviInfo;
import com.amap.api.navi.model.AMapNaviLocation;
import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo;
import com.amap.api.navi.model.AimLessModeCongestionInfo;
import com.amap.api.navi.model.AimLessModeStat;
import com.amap.api.navi.model.NaviInfo;
import com.amap.api.navi.model.NaviLatLng;
import com.amap.api.services.core.LatLonPoint;
import com.autonavi.tbt.TrafficFacilityInfo;
import com.wteam.carkeeper.R;
import com.wteam.carkeeper.util.TTSController;
import java.util.ArrayList;
import java.util.List;
/**
* Created by lhb on 2016/5/23.
*/
public class NaviActivity extends AppCompatActivity implements AMapNaviListener, AMapNaviViewListener {
private AMapNaviView mAMapNaviView;
private AMapNavi mAMapNavi;
private TTSController mTtsManager;
private List<NaviLatLng> mStartList = new ArrayList<NaviLatLng>();
private List<NaviLatLng> mEndList = new ArrayList<NaviLatLng>();
private List<NaviLatLng> mWayPointList = new ArrayList<NaviLatLng>();
private int wayFlag;
private int naviType;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
for(int i=0;i<5;i++) {
LatLonPoint latLonPoint = (LatLonPoint) getIntent().getExtras().get("point_" + i);
if(i == 0) {
mStartList.add(new NaviLatLng(latLonPoint.getLatitude(),latLonPoint.getLongitude()));
} else if(i == 4) {
mEndList.add(new NaviLatLng(latLonPoint.getLatitude(),latLonPoint.getLongitude()));
} else {
if(latLonPoint != null) {
mWayPointList.add(new NaviLatLng(latLonPoint.getLatitude(),latLonPoint.getLongitude()));
}
}
}
wayFlag = (int) getIntent().getExtras().get("wayFlag");
naviType = (int) getIntent().getExtras().get("naviType");
mTtsManager = TTSController.getInstance(getApplicationContext());
mTtsManager.init();
mTtsManager.startSpeaking();
mAMapNavi = AMapNavi.getInstance(getApplicationContext());
mAMapNavi.startGPS();
mAMapNavi.addAMapNaviListener(this);
mAMapNavi.addAMapNaviListener(mTtsManager);
mAMapNavi.setEmulatorNaviSpeed(200);
setContentView(R.layout.activity_navi);
mAMapNaviView = (AMapNaviView) findViewById(R.id.navi_view);
mAMapNaviView.onCreate(savedInstanceState);
mAMapNaviView.setAMapNaviViewListener(this);
}
@Override
protected void onResume() {
super.onResume();
mAMapNaviView.onResume();
/* mStartList.add(mStartLatlng);
mEndList.add(mEndLatlng);*/
mAMapNaviView.setNaviMode(AMapNaviView.CAR_UP_MODE);
}
@Override
protected void onPause() {
super.onPause();
mAMapNaviView.onPause();
// 仅仅是停止你当前在说的这句话,一会到新的路口还是会再说的
mTtsManager.stopSpeaking();
//
// 停止导航之后,会触及底层stop,然后就不会再有回调了,但是讯飞当前还是没有说完的半句话还是会说完
// mAMapNavi.stopNavi();
}
@Override
protected void onDestroy() {
super.onDestroy();
mAMapNaviView.onDestroy();
//since 1.6.0
//不再在naviview destroy的时候自动执行AMapNavi.stopNavi();
//请自行执行
mAMapNavi.stopNavi();
mAMapNavi.stopGPS();
mAMapNavi.destroy();
mTtsManager.destroy();
}
@Override
public void onInitNaviFailure() {
Toast.makeText(this, "init navi Failed", Toast.LENGTH_SHORT).show();
}
@Override
public void onInitNaviSuccess() {
if(wayFlag == RouteSelectActivity.WAY_FLAG_DRIVE) {
mAMapNavi.calculateDriveRoute(mStartList, mEndList, mWayPointList, PathPlanningStrategy.DRIVING_DEFAULT);
}
if(wayFlag == RouteSelectActivity.WAT_FLAG_WALK) {
mAMapNavi.calculateWalkRoute(mStartList.get(0), mEndList.get(0));
}
}
@Override
public void onStartNavi(int type) {
Log.e("tag","onStartNavi");
}
@Override
public void onTrafficStatusUpdate() {
Log.e("tag","onTrafficStatusUpdate");
}
@Override
public void onLocationChange(AMapNaviLocation location) {
Toast.makeText(this,"onLocationChange",Toast.LENGTH_LONG).show();
}
@Override
public void onGetNavigationText(int type, String text) {
Log.e("tag","onGetNavigationText");
}
@Override
public void onEndEmulatorNavi() {
Log.e("tag","onEndEmulatorNavi");
}
@Override
public void onArriveDestination() {
Log.e("tag","onArriveDestination");
}
@Override
public void onCalculateRouteSuccess() {
if(naviType == NaviType.EMULATOR) {
mAMapNavi.startNavi(NaviType.EMULATOR);
}
if(naviType == NaviType.GPS) {
mAMapNavi.startNavi(NaviType.GPS);
}
}
@Override
public void onCalculateRouteFailure(int errorInfo) {
}
@Override
public void onReCalculateRouteForYaw() {
}
@Override
public void onReCalculateRouteForTrafficJam() {
}
@Override
public void onArrivedWayPoint(int wayID) {
}
@Override
public void onGpsOpenStatus(boolean enabled) {
}
@Override
public void onNaviSetting() {
}
@Override
public void onNaviMapMode(int isLock) {
}
@Override
public void onNaviCancel() {
finish();
}
@Override
public void onNaviTurnClick() {
}
@Override
public void onNextRoadClick() {
}
@Override
public void onScanViewButtonClick() {
}
@Deprecated
@Override
public void onNaviInfoUpdated(AMapNaviInfo naviInfo) {
}
@Override
public void onNaviInfoUpdate(NaviInfo naviinfo) {
}
@Override
public void OnUpdateTrafficFacility(TrafficFacilityInfo trafficFacilityInfo) {
}
@Override
public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo) {
}
@Override
public void showCross(AMapNaviCross aMapNaviCross) {
}
@Override
public void hideCross() {
}
@Override
public void showLaneInfo(AMapLaneInfo[] laneInfos, byte[] laneBackgroundInfo, byte[] laneRecommendedInfo) {
}
@Override
public void hideLaneInfo() {
}
@Override
public void onCalculateMultipleRoutesSuccess(int[] ints) {
}
@Override
public void notifyParallelRoad(int i) {
}
@Override
public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos) {
}
@Override
public void updateAimlessModeStatistics(AimLessModeStat aimLessModeStat) {
}
@Override
public void updateAimlessModeCongestionInfo(AimLessModeCongestionInfo aimLessModeCongestionInfo) {
}
@Override
public void onLockMap(boolean isLock) {
}
@Override
public void onNaviViewLoaded() {
Log.d("wlx", "导航页面加载成功");
Log.d("wlx", "请不要使用AMapNaviView.getMap().setOnMapLoadedListener();会overwrite导航SDK内部画线逻辑");
}
@Override
public boolean onNaviBackClick() {
return false;
}
}
| [
"865719705@qq.com"
] | 865719705@qq.com |
bab015856bf60af25d7cbb306ed9262fe9e6521a | 307791dc81ec099b906bc6eef3d9eb70a92b65e9 | /NewsApp/app/src/androidTest/java/com/example/android/newsapp/ExampleInstrumentedTest.java | 61977e2f7c4ed89ace1c2675171ea8c0983099ea | [] | no_license | karthik-panambur/AndroidApps | 4d44b4d836da99c703430b5a31bc1aeaf41972a5 | d5592c354ba15fffa51ed5d129b584aff5b44f85 | refs/heads/master | 2022-09-03T23:20:09.502275 | 2020-05-26T17:18:53 | 2020-05-26T17:18:53 | 266,230,507 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package com.example.android.newsapp;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.android.newsapp", appContext.getPackageName());
}
}
| [
"prashkar666@gmail.com"
] | prashkar666@gmail.com |
e1122aefe57ba1facf22041eae9a0d9da7b037ae | e801e0c3be2aabd014c57c722cf2b8e7260b4c36 | /src/com/gmail/at/kevinburnseit/organizer/gui/DataFolderDialog.java | 772d9a1b3410d677f93368ff23bce270488b14c2 | [] | no_license | kjburns/task-calendar | c15c095b4ac1db7f6f5b7ba980d0d69c194bc580 | 2715ea3ed21022e9494421bf01e0016586ed0509 | refs/heads/master | 2020-04-18T01:14:46.985442 | 2015-10-18T14:43:39 | 2015-10-18T14:43:39 | 42,716,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,494 | java | package com.gmail.at.kevinburnseit.organizer.gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import com.gmail.at.kevinburnseit.organizer.Organizer;
import com.gmail.at.kevinburnseit.swing.DialogResult;
import com.gmail.at.kevinburnseit.swing.NewDialog;
import com.gmail.at.kevinburnseit.swing.ValidatingTextBox;
import com.gmail.at.kevinburnseit.swing.ValidatingTextBoxAction;
import com.gmail.at.kevinburnseit.swing.ValidatingTextBoxValidator;
public class DataFolderDialog extends NewDialog {
private enum FolderValidationFailReasonEnum {
READ_ONLY("Selected folder is read-only."),
IS_NOT_DIRECTORY("Selection is not a folder."),
PARENT_DNE("Parent of proposed folder does not exist."),
PARENT_READ_ONLY("Parent of proposed folder is read-only."),
PARENT_IS_NOT_DIRECTORY("Parent of proposed folder is not a folder."),
EMPTY("Folder path cannot be empty."),
ILLEGAL("Path name is not valid.");
private String message;
private FolderValidationFailReasonEnum(String msg) {
this.message = msg;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
}
private static final long serialVersionUID = 704172727734836624L;
private static FolderValidationFailReasonEnum pathFailureReason = null;
private static final ValidatingTextBoxValidator pathValidator =
new ValidatingTextBoxValidator() {
@Override
public boolean validate(String newValue) {
if (newValue == null) {
pathFailureReason = FolderValidationFailReasonEnum.EMPTY;
return false;
}
if (newValue.trim().length() == 0) {
pathFailureReason = FolderValidationFailReasonEnum.EMPTY;
return false;
}
File f = new File(newValue);
if (f.exists()) {
if (!f.isDirectory()) {
pathFailureReason = FolderValidationFailReasonEnum.IS_NOT_DIRECTORY;
return false;
}
if (!f.canWrite()) {
pathFailureReason = FolderValidationFailReasonEnum.READ_ONLY;
return false;
}
return true;
}
File parent = f.getParentFile();
if (parent == null) {
pathFailureReason = FolderValidationFailReasonEnum.PARENT_DNE;
return false;
}
if (!parent.exists()) {
pathFailureReason = FolderValidationFailReasonEnum.PARENT_DNE;
return false;
}
if (!parent.isDirectory()) {
pathFailureReason =
FolderValidationFailReasonEnum.PARENT_IS_NOT_DIRECTORY;
return false;
}
if (!parent.canWrite()) {
pathFailureReason = FolderValidationFailReasonEnum.PARENT_READ_ONLY;
return false;
}
return true;
}
};
private Organizer org;
private ValidatingTextBox dataPathTextBox;
private JLabel failureLabel;
private JButton browseButton;
private JButton okButton;
private JButton cancelBtn;
public DataFolderDialog(Organizer app) {
this.org = app;
this.buildUI();
this.failureLabel.setVisible(false);
}
private void buildUI() {
BoxLayout layout = new BoxLayout(this.contentPanel, BoxLayout.PAGE_AXIS);
this.contentPanel.setLayout(layout);
this.setTitle("Select Data Storage Folder");
JLabel label = new JLabel("Select folder to store program data:");
this.contentPanel.add(label);
this.dataPathTextBox = new ValidatingTextBox();
this.dataPathTextBox.setValidationKey("path-text-box");
this.dataPathTextBox.addValidationListener(pathValidator);
this.dataPathTextBox.setColumns(30);
this.dataPathTextBox.setText(this.org.getAppDataPath());
this.contentPanel.add(this.dataPathTextBox);
ImageIcon errorIcon = new ImageIcon(
this.getClass().getClassLoader().getResource("res/error.png"));
this.failureLabel = new JLabel(" ");
this.failureLabel.setIcon(errorIcon);
this.contentPanel.add(this.failureLabel);
this.dataPathTextBox.addAfterValidationAction(new ValidatingTextBoxAction() {
@Override
public void afterValidation(boolean ok) {
if (ok) failureLabel.setVisible(false);
else {
failureLabel.setText(pathFailureReason.getMessage());
failureLabel.setVisible(true);
}
}
});
this.browseButton = this.addButton(
"Browse for Folder...", null, ButtonTypeEnum.NONE);
this.browseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
showFolderChooser();
}
});
this.okButton = this.addButton("OK", DialogResult.OK, ButtonTypeEnum.DEFAULT);
this.okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
org.setAppDataPath(dataPathTextBox.getText());
setVisible(false);
}
});
this.cancelBtn = this.addButton("Cancel", DialogResult.CANCEL,
ButtonTypeEnum.CANCEL);
this.cancelBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
this.pack();
}
protected void showFolderChooser() {
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
File initFolder = new File(this.org.getAppDataPath());
if (!initFolder.exists()) initFolder = initFolder.getParentFile();
fc.setSelectedFile(initFolder);
int ret = fc.showOpenDialog(this.org);
if (ret == JFileChooser.APPROVE_OPTION) {
this.dataPathTextBox.setText(fc.getSelectedFile().getAbsolutePath());
}
}
}
| [
"kevin.burns.eit@gmail.com"
] | kevin.burns.eit@gmail.com |
c0ff1bcb5ed32c38d9e7a9775d3dd382fe0f1f87 | 5b2bc6e368a5357d009db3e1ded1967869c62900 | /src/main/java/com/luckydog/mapper/WyCleanPlanMapper.java | bd8db18cff04b968d33cbf82f08bac35accf470d | [] | no_license | wzy1142552920/family_service_platform | 0d68e1b0f884e970ec55505970f53340a3082409 | 5a68167215072baa1314faa6853f3b7d526c811f | refs/heads/master | 2023-02-05T04:14:51.623473 | 2020-11-22T15:50:47 | 2020-11-22T15:50:47 | 315,075,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package com.luckydog.mapper;
import com.luckydog.bean.WyCleanPlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 清洁安排 Mapper 接口
* </p>
*
* @author luckydog
* @since 2020-07-14
*/
public interface WyCleanPlanMapper extends BaseMapper<WyCleanPlan> {
}
| [
"wzy1142552920@outlook.com"
] | wzy1142552920@outlook.com |
a79f13481948e637c44c03242d329e5101924975 | 410c3edff13b40190e3ef38aa60a42a4efc4ad67 | /base/src/main/java/io/vproxy/base/util/ringbuffer/ProxyOutputRingBuffer.java | 9b5b9979c33d703d13f00fa3e1d739936f116971 | [
"MIT"
] | permissive | wkgcass/vproxy | f3d783531688676932f60f3df57e89ddabf3f720 | 6c891d43d6b9f2d2980a7d4feee124b054fbfdb5 | refs/heads/dev | 2023-08-09T04:03:10.839390 | 2023-07-31T08:28:56 | 2023-08-04T12:04:11 | 166,255,932 | 129 | 53 | MIT | 2022-09-15T08:35:53 | 2019-01-17T16:14:58 | Java | UTF-8 | Java | false | false | 5,254 | java | package io.vproxy.base.util.ringbuffer;
import io.vproxy.base.util.Logger;
import io.vproxy.base.util.RingBuffer;
import io.vproxy.base.util.RingBufferETHandler;
import io.vproxy.vfd.ReadableByteStream;
import io.vproxy.vfd.WritableByteStream;
import java.io.IOException;
public class ProxyOutputRingBuffer extends AbstractRingBuffer {
private class DefaultBufferETHandler implements RingBufferETHandler {
@Override
public void readableET() {
triggerReadable();
}
@Override
public void writableET() {
// dose not care, because this buffer is only used as output buffer
}
}
private class ProxiedETHandler implements RingBufferETHandler {
@Override
public void readableET() {
if (isProxy) {
triggerReadable();
}
}
@Override
public void writableET() {
// does not care, because this buffer is only used as output buffer
}
}
public interface ProxyDoneCallback {
void proxyDone();
}
private final ProxiedETHandler proxiedETHandler = new ProxiedETHandler();
private boolean isProxy = false; // true = write data from attached, false = write data from
private final SimpleRingBuffer defaultBuffer;
private final int cap;
private RingBuffer proxied;
private int proxyLen;
private ProxyDoneCallback proxyDoneCallback;
private ProxyOutputRingBuffer(SimpleRingBuffer defaultBuffer) {
this.defaultBuffer = defaultBuffer;
this.cap = defaultBuffer.capacity();
defaultBuffer.addHandler(new DefaultBufferETHandler());
}
public static ProxyOutputRingBuffer allocateDirect(int cap) {
return new ProxyOutputRingBuffer(SimpleRingBuffer.allocateDirect(cap));
}
public void proxy(RingBuffer proxied, int proxyLen, ProxyDoneCallback cb) {
if (this.proxied != null)
throw new IllegalStateException("has a proxied buffer, with proxyLen = " + proxyLen);
assert Logger.lowLevelDebug("get a buffer to proxy, data length is " + proxyLen);
this.proxied = proxied;
this.proxyLen = proxyLen;
this.proxyDoneCallback = cb;
this.proxied.addHandler(proxiedETHandler);
if (defaultBuffer.used() == 0) {
assert Logger.lowLevelDebug("the defaultBuffer is empty now, switch to proxy mode");
isProxy = true;
triggerReadable();
} else {
assert Logger.lowLevelDebug("still have data in the defaultBuffer");
}
}
public void newDataFromProxiedBuffer() {
if (proxied == null)
throw new IllegalStateException("no buffer to proxy but alarmed with 'new data from proxied buffer'");
if (isProxy) {
triggerReadable();
}
}
@Override
public int storeBytesFrom(ReadableByteStream channel) throws IOException {
if (proxied != null)
throw new IllegalStateException("has a proxied buffer, with proxyLen = " + proxyLen);
return defaultBuffer.storeBytesFrom(channel);
}
@Override
public int writeTo(WritableByteStream channel, int maxBytesToWrite) throws IOException {
if (isProxy) {
int toWrite = Math.min(maxBytesToWrite, proxyLen);
int wrote = proxied.writeTo(channel, toWrite);
proxyLen -= wrote;
if (proxyLen == 0) {
isProxy = false;
proxied.removeHandler(proxiedETHandler);
proxied = null;
ProxyDoneCallback cb = proxyDoneCallback;
proxyDoneCallback = null;
assert Logger.lowLevelDebug("proxy end, calling proxy done callback");
cb.proxyDone();
}
return wrote;
} else {
int wrote = defaultBuffer.writeTo(channel, maxBytesToWrite);
if (wrote == maxBytesToWrite)
return wrote;
if (proxied == null)
return wrote;
assert Logger.lowLevelDebug("wrote all data from defaultBuffer, switch to proxy mode");
isProxy = true;
return wrote + writeTo(channel, maxBytesToWrite - wrote);
}
}
@Override
public int free() {
return cap - used();
}
@Override
public int used() {
int proxyPart = 0;
if (proxied != null) {
int ret = cap;
if (ret > proxyLen) ret = proxyLen;
int foo = proxied.used();
if (ret > foo) ret = foo;
return ret; // the minimum of cap, proxyLen, and proxied.used()
}
if (isProxy) {
return proxyPart;
} else {
return Math.min(cap, defaultBuffer.used() + proxyPart);
}
}
@Override
public int capacity() {
return cap;
}
@Override
public void clean() {
if (proxied != null) {
proxied.removeHandler(proxiedETHandler);
proxied = null;
proxyLen = 0;
proxyDoneCallback = null;
}
defaultBuffer.clean();
}
@Override
public void clear() {
defaultBuffer.clear();
}
}
| [
"wkgcass@hotmail.com"
] | wkgcass@hotmail.com |
d8f19f20a9fdf732f166306ab75714977007e38f | 2ef47520194f98c3e905cf24be193c32b49990c6 | /proj13DeGrawHang/bantam/ast/ConstBooleanExpr.java | 977ac6c3feec8741a5ca16242a01ee0c0a805e78 | [] | no_license | jackiehang/proj13 | 15b0011934ad663475472c4869f5c8cfa7117265 | 4e6cf5a7291360ffeff56eb6adee70f90b864262 | refs/heads/master | 2020-04-26T21:10:30.119232 | 2019-03-08T06:00:10 | 2019-03-08T06:00:10 | 173,834,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,969 | java | /* Bantam Java Compiler and Language Toolset.
Copyright (C) 2009 by Marc Corliss (corliss@hws.edu) and
David Furcy (furcyd@uwosh.edu) and
E Christopher Lewis (lewis@vmware.com).
ALL RIGHTS RESERVED.
The Bantam Java toolset is distributed under the following
conditions:
You may make copies of the toolset for your own use and
modify those copies.
All copies of the toolset must retain the author names and
copyright notice.
You may not sell the toolset or distribute it in
conjunction with a commerical product or service without
the expressed written consent of the authors.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
*/
package proj13DeGrawHang.bantam.ast;
import proj13DeGrawHang.bantam.visitor.Visitor;
/**
* The <tt>ConstBooleanExpr</tt> class represents a boolean constant expression.
* It extends constant expressions so it containts a constant value (represented
* as a String). Since this class is similar to other subclasses most of the
* functionality can be implemented in the bantam.visitor method for the parent class.
*
* @see ASTNode
* @see ConstExpr
*/
public class ConstBooleanExpr extends ConstExpr {
/**
* ConstBooleanExpr constructor
*
* @param lineNum source line number corresponding to this AST node
* @param constant constant value (as a String)
*/
public ConstBooleanExpr(int lineNum, int colPos, String constant) {
super(lineNum,colPos, constant);
}
/**
* Visitor method
*
* @param v bantam.visitor object
* @return result of visiting this node
* @see proj13DeGrawHang.bantam.visitor.Visitor
*/
public Object accept(Visitor v) {
return v.visit(this);
}
}
| [
"jackieeehang@gmail.com"
] | jackieeehang@gmail.com |
df67251e23a933947bd121ae64546cb006cc1a30 | c212cdc56883b887e4e427475c8e24a72e4cd3d8 | /src/main/java/com/weiwudev/models/User.java | b14607dbeb49c69ac950ecb01f2a5e66246bf35e | [] | no_license | weiwuDev/AuthService-JWT | 209cd87bd998b6ea05413deda9b41b756f10ed67 | a77c90e56ca7fe2f765d0aed169e3f6f07024f15 | refs/heads/master | 2022-11-23T01:15:38.208776 | 2020-07-31T18:48:10 | 2020-07-31T18:48:10 | 283,006,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package com.weiwudev.models;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "login")
public class User {
@Id
private String id;
@Indexed(unique=true)
private String username;
private String password;
private List<String> roles;
public UserDetails toUserDetails(){
return new MyUserDetails(username,password, roles);
}
}
| [
"60204220+weiwu1994@users.noreply.github.com"
] | 60204220+weiwu1994@users.noreply.github.com |
a711fb192aa3b6fd408fb8de4087e44f12033b90 | 3a359498e646a0202d498fe67c3f5a2af1e0bf3e | /springboot/20200325/springboot-start/src/main/java/com/jikaigg/springbootstart/SpringbootStartApplication.java | c6d5c03e509a6bd2e34f6237fd77e9a3add8f3ff | [] | no_license | jikaigggg/Frame | d1172919612b2ed643bd784043ed274b47b62ee6 | 0afb9b972e1c3719564f4da1e63b0837cee02adf | refs/heads/master | 2023-01-11T02:49:19.685934 | 2020-05-07T10:21:52 | 2020-05-07T10:21:52 | 241,066,743 | 0 | 0 | null | 2022-12-27T14:46:53 | 2020-02-17T09:25:19 | Java | UTF-8 | Java | false | false | 426 | java | package com.jikaigg.springbootstart;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
@SpringBootApplication
public class SpringbootStartApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootStartApplication.class, args);
}
}
| [
"jikaigg@gmail.com"
] | jikaigg@gmail.com |
b690fbf7f23435afe6327e52b440cc7604d380cb | e3209724b56526e3981f5315cc8c959fdc3534ee | /src/main/java/com/edsonr/cursomc/domain/Categoria.java | 82cd60e1a8bb3d62511b4285b6dfea5c9948f547 | [] | no_license | EdsonRCJ/cursomc | 36a0dd66ffd8b6f7c23dfca5b3e864787afc0f74 | 887b8215c0e3cb7060c199a3f1e85bc372ad38af | refs/heads/master | 2020-03-20T19:09:34.832462 | 2018-06-24T04:04:10 | 2018-06-24T04:04:10 | 137,624,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,659 | java | package com.edsonr.cursomc.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import com.fasterxml.jackson.annotation.JsonManagedReference;
@Entity
public class Categoria implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
private String nome;
@JsonManagedReference
@ManyToMany(mappedBy="categorias")
private List<Produto> produtos = new ArrayList<>();
public Categoria() {
}
public Categoria(Integer id, String nome) {
super();
this.id = id;
this.nome = nome;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public List<Produto> getProdutos() {
return produtos;
}
public void setProdutos(List<Produto> produtos) {
this.produtos = produtos;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.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;
Categoria other = (Categoria) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"ed.juniior01@gmail.com"
] | ed.juniior01@gmail.com |
389b42e91fb4f0fcc16bf268c2b0d7203eb91623 | 5f3814219da2f88325491e29c993b1a511e2002d | /src/service/MemberService.java | e4b2bf1cce66e23c10fb182ef4032e4c46077749 | [] | no_license | JuveAlle/CatSoftVer2 | def3c8380cf945474e30260d3140c1fddc6791dd | 9bf57b0da8e4c5de385bc06df16196f289d464dc | refs/heads/master | 2021-07-12T05:27:35.768867 | 2017-10-10T11:54:18 | 2017-10-10T11:54:18 | 105,760,265 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package service;
import java.util.List;
import domain.Member;
public interface MemberService {
//회원 등록
int createMember(Member member);
//회원 반환하기
Member loginMember(String id);
//아이디 찾기(중복)
Boolean findMember(String id);
//회원 목록
List<Member> memberList();
//회원정보 수정
void ModifyMember(String id, String password);
//회원 삭제
void deleteMember(String id);
}
| [
"smsanffj@gmail.com"
] | smsanffj@gmail.com |
2eb0cef4d361f39e7ae2c15e9640aa8e19bca29c | 30c417ec27ea21ef65fedfd44a07c85d0205e8d9 | /src/main/java/com/example/demo/service/UserService.java | 7523d70d5ae19a57fdb2a3cea33cda42ce91c50f | [] | no_license | fjborquez/tutorial-aspectj-springboot | c1804d5ea48ddf025cc1da29205264df97b5eb68 | b60a3d493b8edf90e95b94139a7ba71c81532d1e | refs/heads/master | 2022-11-16T10:15:48.177009 | 2020-07-05T22:33:49 | 2020-07-05T22:33:49 | 276,540,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 156 | java | package com.example.demo.service;
import com.example.demo.dto.User;
import java.util.List;
public interface UserService {
List<User> getAllUsers();
}
| [
"fborquez@exe.cl"
] | fborquez@exe.cl |
4edb0ba5b7e9055fbd81815707d0564475136b7c | 6ef239bc1f3a4bb90a6e6d77bb54946b2e477dd9 | /WebTools_e-Med_Hospital Management System/Final_PatientCentricHealthCare/src/main/java/org/healthcare/hospitalapp/model/employee/PersistentObject.java | 1b60ae3367a62ab04592c240e16571576673a447 | [] | no_license | PraneethVellaboyana/Academic_Projects | 96699663ab0b7f53a2d56729ea4189afdf811eb2 | 9fbaf5773216cf1a80bb2de1f7b5b7e31c2ec140 | refs/heads/master | 2016-08-12T14:47:47.929506 | 2016-03-29T20:46:25 | 2016-03-29T20:46:25 | 46,273,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | package org.healthcare.hospitalapp.model.employee;
import java.io.Serializable;
public interface PersistentObject extends Serializable {
}
| [
"praneeth.reddy13@gmail.com"
] | praneeth.reddy13@gmail.com |
c753da3d8d22168960af89ea93bd946f8df28770 | 10a9cf79e5a4a0a12cc4eda75e9bc25d778c75b0 | /378_convert-binary-search-tree-to-doubly-linked-list/convert-binary-search-tree-to-doubly-linked-list.java | 788593eac47859883fdaff06a0cca6d0e0b9c295 | [] | no_license | SilverDestiny/LintCode | d1cd06bf7c218e61a9410dadbf03bbb47f0ce167 | eb4e3ba601675e37511635c0be307706db4f19c4 | refs/heads/master | 2020-12-02T18:10:48.963573 | 2017-07-07T15:45:55 | 2017-07-07T15:45:55 | 96,489,141 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,971 | java | /*
@Copyright:LintCode
@Author: yun16
@Problem: http://www.lintcode.com/problem/convert-binary-search-tree-to-doubly-linked-list
@Language: Java
@Datetime: 16-12-20 16:30
*/
/**
* Definition of TreeNode:
* public class TreeNode {
* public int val;
* public TreeNode left, right;
* public TreeNode(int val) {
* this.val = val;
* this.left = this.right = null;
* }
* }
* Definition for Doubly-ListNode.
* public class DoublyListNode {
* int val;
* DoublyListNode next, prev;
* DoublyListNode(int val) {
* this.val = val;
* this.next = this.prev = null;
* }
* }
*/
public class Solution {
/**
* @param root: The root of tree
* @return: the head of doubly list node
*/
class ResultType {
DoublyListNode first, last;
ResultType(DoublyListNode first, DoublyListNode last) {
first = this.first;
last = this.last;
}
}
public DoublyListNode bstToDoublyList(TreeNode root) {
// Write your code here
if (root == null) {
return null;
}
ResultType result = helper(root);
return result.first;
}
private ResultType helper(TreeNode root) {
if (root == null) {
return null;
}
ResultType left = helper(root.left);
ResultType right = helper(root.right);
DoublyListNode node = new DoublyListNode(root.val);
ResultType result = new ResultType(null, null);
if (left == null) {
result.first = node;
} else {
result.first = left.first;
node.prev = left.last;
left.last.next = node;
}
if (right == null) {
result.last = node;
} else {
result.last = right.last;
node.next = right.first;
right.first.prev = node;
}
return result;
}
}
| [
"ly890611@gmail.com"
] | ly890611@gmail.com |
a59ba2807015e9eefe757909c2abcb0b57353604 | e1e664b8783962091771e7de8ebe7dcb32e18767 | /joe-program/src/main/java/com/joe/qiao/domain/headfirst/command/undo/Command.java | 1e183331184bff98005717df931e8c2395cede0c | [] | no_license | qiaoyunlai66/butterfly | 4b76fc8a32f11b66d93e9fcd873eb537d80a4880 | eda50a90ff4102601a254e93a37c79407f6a1380 | refs/heads/master | 2020-03-10T22:17:59.831745 | 2018-04-21T05:32:39 | 2018-04-21T05:32:39 | 129,592,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package com.joe.qiao.domain.headfirst.command.undo;
public interface Command {
public void execute();
public void undo();
}
| [
"joeqiao@fortinet.com"
] | joeqiao@fortinet.com |
8f3e120e0a9bdc81f19051104aba6c053a0b7879 | cfc894ac317799b5bb997dff83465c056b740167 | /app/src/main/java/com/bryanrady/ui/view/paint/filter/ColorMatrixFilterOther.java | b912746d121539f9866b65e8e08e4cfab500916a | [] | no_license | bryanrady/UI | b3f919deeec7719bcce251898c91fb3440032ebf | edd8fb1c0069cfc7fc23a6f1421cd4a87dae87c4 | refs/heads/master | 2021-06-28T12:59:07.065515 | 2020-09-13T08:10:28 | 2020-09-13T08:10:28 | 139,309,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,429 | java | package com.bryanrady.ui.view.paint.filter;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.MotionEvent;
import android.view.View;
import com.bryanrady.ui.R;
/**
* 颜色矩阵的一些其他效果
* Created by wqb on 2018/6/26.
*/
public class ColorMatrixFilterOther extends View {
private Paint mPaint;
private Bitmap mBitmap;
private int progress1;
private int progress2;
public ColorMatrixFilterOther(Context context) {
super(context);
setLayerType(LAYER_TYPE_SOFTWARE,null);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.xyjy2);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
RectF rectF = new RectF(100,100,mBitmap.getWidth(),mBitmap.getHeight());
canvas.drawBitmap(mBitmap, null , rectF , mPaint);
//1.设置矩阵缩放 setScale
RectF rectF1 = new RectF(100+mBitmap.getWidth(),100,mBitmap.getWidth()*2,mBitmap.getHeight());
ColorMatrix colorMatrix = new ColorMatrix();
//图片变亮了
colorMatrix.setScale(1.2f,1.2f,1.2f,1);
mPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
canvas.drawBitmap(mBitmap, null , rectF1 , mPaint);
mPaint.setColorFilter(null);
// 2.设置饱和度 setSaturation 图片能变深沉
RectF rectF2 = new RectF(100,mBitmap.getHeight()+100,mBitmap.getWidth(),mBitmap.getHeight()*2);
ColorMatrix colorMatrix2 = new ColorMatrix();
colorMatrix2.setSaturation(progress1);
mPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix2));
canvas.drawBitmap(mBitmap,null,rectF2,mPaint);
mPaint.setColorFilter(null);
//3.设置旋转 setRotate 颜色变换
RectF rectF3 = new RectF(100+mBitmap.getWidth(),mBitmap.getHeight()+100,mBitmap.getWidth()*2,mBitmap.getHeight()*2);
ColorMatrix colorMatrix3 = new ColorMatrix();
//aixs-- 0 红色轴,1,绿色,2,蓝色
// degrees -- 旋转的角度
colorMatrix3.setRotate(0,progress2);
mPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix3));
canvas.drawBitmap(mBitmap,null, rectF3, mPaint);
mPaint.setColorFilter(null);
//4.两个矩阵组合 setConcat
RectF rectF4 = new RectF(100,mBitmap.getHeight()*2+100,mBitmap.getWidth(),mBitmap.getHeight()*3);
ColorMatrix colorMatrix4 = new ColorMatrix();
colorMatrix4.setConcat(colorMatrix2,colorMatrix3);
mPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix4));
canvas.drawBitmap(mBitmap,null, rectF4, mPaint);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()){
case MotionEvent.ACTION_DOWN:
//progress1 += 1f;
progress1 += 20f;
progress2 = 0xff0000;
invalidate();
break;
case MotionEvent.ACTION_UP:
progress2 = 0x000000;
invalidate();
break;
}
return true;
}
}
| [
"bryanrady@163.com"
] | bryanrady@163.com |
f1312a362635881f7943746df754b3132301d523 | 9ab0308e383dd05dcd405f7ff1541b00f21736e5 | /utilities/src/main/java/com/gravity/utilities/MD5Hash.java | d80618f12986a8f37d8890699e6b8af79078ead0 | [
"Apache-2.0"
] | permissive | BenLloydPearson/common-libs | 3492a18dd7cc70627589a0036695ea8d63bfba7a | 82c4c5db4750be6a4d9d07d932598e0604eca0b4 | refs/heads/master | 2020-04-02T15:42:06.249110 | 2017-08-07T19:27:42 | 2017-08-07T19:27:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,723 | java | package com.gravity.utilities; /**
* User: chris
* Date: Sep 1, 2010
* Time: 9:45:58 PM
*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5Hash {
private static final Logger logger = LoggerFactory.getLogger(MD5Hash.class);
public static BigInteger hashString(String data) {
try {
MessageDigest instance = MessageDigest.getInstance("MD5");
instance.update(data.getBytes("UTF-8"));
byte[] bytes = instance.digest();
instance.reset();
BigInteger bi = new BigInteger(bytes);
return bi;
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
private static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9)) {
buf.append((char) ('0' + halfbyte));
} else {
buf.append((char) ('a' + (halfbyte - 10)));
}
halfbyte = data[i] & 0x0F;
} while (two_halfs++ < 1);
}
return buf.toString();
}
public static String MD5(String text) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
byte[] md5hash;
md.update(text.getBytes());
md5hash = md.digest();
return convertToHex(md5hash);
}
}
| [
"apatel@gravity.com"
] | apatel@gravity.com |
c69811b6d8a3203e4768e32bc37563aff0fdc723 | 3b51cf95fc110510d269cd98a68e3f107de40e39 | /src/BinarySearchRecursive.java | bcda2f5ce8804410ef14520318c943005c5da158 | [] | no_license | khoand10/pf-java-algorithm-binary-search-recursive | 7b1b34371974f3f22e749ee8fe29337653b4e1ae | 06c0720efea61f57afe362ebe0ca205a4e0f59b2 | refs/heads/master | 2020-03-09T09:24:04.543247 | 2018-04-09T03:56:31 | 2018-04-09T03:56:31 | 128,712,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 624 | java | public class BinarySearchRecursive {
static int binarySearch(int[] arr, int row, int high, int value) {
if (high >= row) {
int mid = (row + high) / 2;
if (value == arr[mid]) return mid;
if (value > arr[mid])
return binarySearch(arr, mid + 1, high, value);
return binarySearch(arr, row, mid - 1, value);
}
return -1;
}
public static void main(String[] args) {
int[] numbers = {1, 4, 6, 8, 10, 13, 44};
int index = binarySearch(numbers, 0, numbers.length - 1, 45);
System.out.println(index);
}
}
| [
"khoand10@gmail.com"
] | khoand10@gmail.com |
d9033ea900725cf9405512d524f087db347712b9 | 84325f97bb51a75378491508d22b1610b7a0f526 | /src/main/java/com/lagopusempire/zmessages/commands/MsgCommand.java | d5fa5572a745e44e3e6894d659aee557dc785ff5 | [
"ISC"
] | permissive | ZorasOldBukkitPlugins/ZMessages | bce51d95fdc64c8e7750074493a6256ec9c1dac5 | 2e0167995f80af77c577e0e5af326df3392f22d4 | refs/heads/master | 2020-05-20T06:03:21.164304 | 2015-03-01T22:30:04 | 2015-03-01T22:30:04 | 31,493,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,543 | java | package com.lagopusempire.zmessages.commands;
import com.lagopusempire.zmessages.MessageFormatter;
import com.lagopusempire.zmessages.MessageSystem;
import com.lagopusempire.zmessages.Messages;
import com.lagopusempire.zmessages.Utils;
import java.util.Arrays;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
/**
*
* @author MrZoraman
*/
public class MsgCommand extends CommandBase
{
public MsgCommand(MessageSystem messageSystem, Messages messages)
{
super(messageSystem, messages);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args)
{
if(args.length < 1)
{
Utils.sendMessage(sender, MessageFormatter.create(messages.get("error.noTarget")).colorize());
return false;
}
if(args.length < 2)
{
Utils.sendMessage(sender, MessageFormatter.create(messages.get("error.noMessage")).colorize());
return false;
}
CommandSender target = Utils.matchCommandSender(args[0]);
if(target == null)
{
Utils.sendMessage(sender, MessageFormatter.create(messages.get("notFound.general")).replace("receiver", args[0]).colorize());
return true;
}
String message = Utils.toMessage(Arrays.copyOfRange(args, 1, args.length));
messageSystem.sendMessage(sender, target, message);
return true;
}
}
| [
"MrZoraman@Gmail.com"
] | MrZoraman@Gmail.com |
ad84963fc84a8f7f5db56bf3e6851a55533d7a48 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/yauaa/learning/1231/UselessMatcherException.java | 3fc01b70d8d59038acfac05fd45a47b9d09936ed | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | /*
* Yet Another UserAgent Analyzer
* Copyright (C) 2013-2018 Niels Basjes
*
* 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
*
* https://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 nl.basjes.parse.useragent.analyze;
public class UselessMatcherException extends Exception {
public UselessMatcherException(String message) {
super(message);
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
793db8240de8497b5951823f271a426536b160db | fd3cd767e56750d2cf8e1b177deb4f4495dbe8bf | /src/downloader/DownloadTableModel.java | 572f883dfc015d3cb2ba3c1666d9e9cf7ad42ad8 | [] | no_license | jiashuo/downloader | bed3c9b348e6b16240d65c2461d87a2897caa452 | f9c161e05254738d482ba3d9c29188a8f8564895 | refs/heads/master | 2016-09-16T11:02:52.051511 | 2013-04-10T01:43:23 | 2013-04-10T01:43:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,389 | java | package downloader;
import java.awt.EventQueue;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JProgressBar;
import javax.swing.table.AbstractTableModel;
/**
* This class manages the download table's data.
*
*/
public class DownloadTableModel extends AbstractTableModel implements Observer {
private final DownloadManager downloadManager;
public DownloadTableModel(DownloadManager downloadManager)
{
this.downloadManager=downloadManager;
}
// These are the names for the table's columns.
private static final String[] columnNames = {"URL", "Size (KB)",
"Progress", "Status","Priority"};
// These are the classes for each column's values.
@SuppressWarnings("rawtypes")
private static final Class[] columnClasses = {String.class,
String.class, JProgressBar.class, String.class,String.class};
/**
* Add a new download to the table.
*/
public void addNewDownload(SingleTask download) {
// Register to be notified when the download changes.
download.addObserver(this);
// Fire table row insertion notification to table.
fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1);
}
/**
* Remove a download from the list.
*/
public void clearDownload(int row) {
// Fire table row deletion notification to table.
fireTableRowsDeleted(row, row);
}
/**
* Get table's column count.
*/
public int getColumnCount() {
return columnNames.length;
}
/**
* Get a column's name.
*/
public String getColumnName(int col) {
return columnNames[col];
}
/**
* Get a column's class.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public Class getColumnClass(int col) {
return columnClasses[col];
}
/**
* Get table's row count.
*/
public int getRowCount() {
return downloadManager.getDownloadList().size();
}
/**
* Get value for a specific row and column combination.
*/
public Object getValueAt(int row, int col) {
// Get download from download list
SingleTask download = downloadManager.getDownloadList().get(row);
switch (col) {
case 0: // URL
return download.getURL();
case 1: // Size
long size = download.getFileSize();
return (size == -1) ? "" : (Long.toString(size/1000));
case 2: // Progress
return new Float(download.getProgress());
case 3: // Status
return SingleTask.STATUSES[download.getState()];
case 4: //priority
return SingleTask.PRIORITIES[download.getPriority()];
}
return "";
}
/**
* Update is called when a Download notifies its observers of any changes
*/
public void update(Observable o, Object arg) {
final int index = downloadManager.getDownloadList().indexOf(o);
// Fire table row update notification to table.
EventQueue.invokeLater(new Runnable() {
public void run() {
fireTableRowsUpdated(index, index);
}
} );
}
} | [
"shuojia.ufl@gmail.com"
] | shuojia.ufl@gmail.com |
8c12f3531a4712476ec0a3eb7425d308f199282b | 2e3ef35731ae78c18f808f50f2395025c731212f | /src/main/java/com/hys/spring4demo/mybatis/TestMapper.java | 6276c659ac35444f4d129bb13560dfd29753f627 | [] | no_license | raduihys/spring4-demo | 8c0e049d4c03e565ae862e43a4106e839103d808 | 383b45bfd9dd1570aa898f1d2e8f814570af1dc4 | refs/heads/master | 2021-01-19T01:32:45.296174 | 2017-11-16T01:42:47 | 2017-11-16T01:42:47 | 65,177,791 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package com.hys.spring4demo.mybatis;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import com.bt.qq.common.mybatis.Mapper;
@Mapper(db="test")
public interface TestMapper {
@Delete("DELETE FROM mybatis_test1")
boolean deleteAll();
@Insert("INSERT INTO mybatis_test1(id,intCol1,strCol1) VALUES(${id},${intCol1},#{strCol1})")
void insert(@Param("id")int id,@Param("intCol1") int intCol1,@Param("strCol1") String strCol1);
}
| [
"huangyongsheng@rd.com"
] | huangyongsheng@rd.com |
ab7c024fba42b67c51d6a8cfe024d6e819dea545 | 4a6454a57012326f41336bd291ef196f23ef90be | /XMISA/src/com/nti56/xmisa/adapter/MyListView.java | 94637fc2c9a3c9cef2fdfd28a45582afb281e312 | [] | no_license | chenchengtyh/XMISA | 1f121f00cf27fe52707afa9c7fa71f72f40057b4 | 7f4d7afa8f166f3b4b22e5e4593b0929cf573d94 | refs/heads/master | 2021-09-01T13:07:31.615630 | 2017-12-27T05:21:05 | 2017-12-27T05:21:05 | 115,484,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,854 | java | package com.nti56.xmisa.adapter;
import java.lang.reflect.Field;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.nti56.xmisa.MyApplication;
import com.nti56.xmisa.R;
import com.nti56.xmisa.util.Content;
import com.nti56.xmisa.util.MyLog;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences.Editor;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.AbsListView.OnScrollListener;
public class MyListView extends ListView implements OnScrollListener {
private Context mContext;
private int state;
private final static int CLOSE = 0;
private final static int OPENING = 1; // 下拉过程中
private final static int OPEN = 2;// 下拉完成
private final static int LOADING = 3;// 正在刷新的状态值
private int mMode;
private final static int NONE = 0;
private final static int VERTICAL = 5;// 垂直移动
private final static int HORIZONTAL = 10;// 水平移动
private final static int RATIO = 3;// 实际的padding的距离与界面上偏移距离的比例
private int headerContentHeight;// 定义头部下拉刷新的布局的高度
private int startX, startY;
private LayoutInflater inflater;
// ListView头部下拉刷新的布局
private LinearLayout headerView;
private TextView lvHeaderTipsTv;
private TextView lvHeaderLastUpdatedTv;
private ImageView lvHeaderArrowIv;
private ProgressBar lvHeaderProgressBar;
private RotateAnimation animation;
private RotateAnimation reverseAnimation;
private boolean isBack;
public boolean isOnMeasure;
private boolean Refreshable = false;
private int mListCode;
// private Editor editor;
private String TAG = "MyListView";
private OnRefreshListener refreshListener;
public interface OnRefreshListener {
public void onRefresh();
}
public MyListView(Context context) {
super(context);
mContext = context;
}
public MyListView(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
isOnMeasure = true;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
public void onLayout(boolean changed, int l, int t, int r, int b) {
isOnMeasure = false;
super.onLayout(changed, l, t, r, b);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (Refreshable) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
MyLog.e(TAG, "onTouchEvent", "MotionEvent.ACTION_DOWN");
mMode = NONE;
startX = (int) ev.getX();// 手指按下时记录当前位置
startY = (int) ev.getY();// 手指按下时记录当前位置
break;
case MotionEvent.ACTION_MOVE:
MyLog.d(TAG, "onTouchEvent", "MotionEvent.ACTION_MOVE");
int DifValueX = ((int) ev.getX() - startX) / RATIO;// Y轴移动距离
int DifValueY = ((int) ev.getY() - startY) / RATIO;// Y轴移动距离
if (mMode == NONE && (Math.abs(DifValueX) > 2 || Math.abs(DifValueY) > 2)) {
if (Math.abs(DifValueX) > Math.abs(DifValueY)) {
mMode = HORIZONTAL;// 水平模式
} else {
mMode = VERTICAL;// 垂直模式
}
}
if (mMode == VERTICAL && state != LOADING) {// 当未正在刷新时
if (DifValueY <= 0) {// 关闭
if (state != CLOSE) {
state = CLOSE;
isBack = false;
changeHeaderViewByState();
}
} else if (DifValueY < headerContentHeight && state != OPENING) {// 正在下拉
state = OPENING;
changeHeaderViewByState();
} else if (DifValueY >= headerContentHeight && state != OPEN) {// 下拉完成
state = OPEN;
isBack = true;
changeHeaderViewByState();
}
if (state != CLOSE) {// 动态改变界面高度
headerView.setPadding(0, DifValueY - headerContentHeight, 0, 0);
}
}
break;
case MotionEvent.ACTION_UP:
MyLog.e(TAG, "onTouchEvent", "MotionEvent.ACTION_UP");
if (state == OPEN) {
state = LOADING;
changeHeaderViewByState();
onLvRefresh();
} else if (state == OPENING) {
state = CLOSE;
changeHeaderViewByState();
}
break;
default:
break;
}
}
return super.onTouchEvent(ev);
}
@Override
public void setAdapter(ListAdapter adapter) {
if (Refreshable) {
initHeaderView();
UpdateLastTime();//TODO 此处要从MyApplication.mySharedPreferences获得上次刷新时间写入
}
super.setAdapter(adapter);
}
private void InitSharedPreferences(){
if (MyApplication.mySharedPreferences == null) {
MyApplication.mySharedPreferences = mContext.getSharedPreferences("mysharepreferences", Activity.MODE_PRIVATE);
}
if(MyApplication.editor == null){
MyApplication.editor = MyApplication.mySharedPreferences.edit();
}
}
private void UpdateLastTime(){
InitSharedPreferences();
String lastUpdate= "";
switch (mListCode) {
case Content.LIST_RECEIVE:
lastUpdate = MyApplication.mySharedPreferences.getString("rec_update", "");
break;
case Content.LIST_INPUT:
lastUpdate = MyApplication.mySharedPreferences.getString("ipt_update", "");
break;
case Content.LIST_OUTPUT:
lastUpdate = MyApplication.mySharedPreferences.getString("opt_update", "");
break;
case Content.LIST_INVENTORY:
lastUpdate = MyApplication.mySharedPreferences.getString("ivt_update", "");
break;
case Content.LIST_ASSIGN:
lastUpdate = MyApplication.mySharedPreferences.getString("asg_update", "");
break;
case Content.LIST_EXAMINE:
lastUpdate = MyApplication.mySharedPreferences.getString("exm_update", "");
break;
case Content.LIST_SURVEY:
lastUpdate = MyApplication.mySharedPreferences.getString("sur_update", "");
break;
case Content.LIST_FUMIGATE:
lastUpdate = MyApplication.mySharedPreferences.getString("fmg_update", "");
break;
case Content.LIST_PESTS:
lastUpdate = MyApplication.mySharedPreferences.getString("pts_update", "");
break;
case Content.LIST_PATROL:
lastUpdate = MyApplication.mySharedPreferences.getString("ptl_update", "");
break;
default:
break;
}
lvHeaderLastUpdatedTv.setText("上次更新时间:" + lastUpdate);
}
public void setOnRefreshListener(OnRefreshListener refreshListener, int listCode) {
this.Refreshable = true;
this.refreshListener = refreshListener;
mListCode = listCode;
}
public void onRefreshComplete(boolean Success, int listCode) {
state = CLOSE;
if(Success){//TODO 此处要将时间写入 MyApplication.mySharedPreferences
DateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault());
String updateTime = format.format(new Date());
lvHeaderLastUpdatedTv.setText("上次更新时间:" + updateTime);
InitSharedPreferences();
switch (listCode) {
case Content.LIST_RECEIVE:
MyApplication.editor.putString("rec_update", updateTime);
break;
case Content.LIST_INPUT:
MyApplication.editor.putString("ipt_update", updateTime);
break;
case Content.LIST_OUTPUT:
MyApplication.editor.putString("opt_update", updateTime);
break;
case Content.LIST_INVENTORY:
MyApplication.editor.putString("ivt_update", updateTime);
break;
case Content.LIST_ASSIGN:
MyApplication.editor.putString("asg_update", updateTime);
break;
case Content.LIST_EXAMINE:
MyApplication.editor.putString("exm_update", updateTime);
break;
case Content.LIST_SURVEY:
MyApplication.editor.putString("sur_update", updateTime);
break;
case Content.LIST_FUMIGATE:
MyApplication.editor.putString("fmg_update", updateTime);
break;
case Content.LIST_PESTS:
MyApplication.editor.putString("pts_update", updateTime);
break;
case Content.LIST_PATROL:
MyApplication.editor.putString("ptl_update", updateTime);
break;
default:
break;
}
MyApplication.editor.commit();
}
changeHeaderViewByState();
}
@Override
public Drawable getDivider() {
return super.getDivider();
}
@Override
public int getDividerHeight() {
return super.getDividerHeight();
}
private void initHeaderView() {
MyLog.e(TAG, "initHeaderView");
setCacheColorHint(mContext.getResources().getColor(R.color.yellow));
inflater = LayoutInflater.from(mContext);
headerView = (LinearLayout) inflater.inflate(R.layout.listview_header, null);
lvHeaderTipsTv = (TextView) headerView.findViewById(R.id.lvHeaderTipsTv);
lvHeaderLastUpdatedTv = (TextView) headerView.findViewById(R.id.lvHeaderLastUpdatedTv);
lvHeaderArrowIv = (ImageView) headerView.findViewById(R.id.lvHeaderArrowIv);
// 设置下拉刷新图标的最小高度和宽度
lvHeaderArrowIv.setMinimumWidth(70);
lvHeaderArrowIv.setMinimumHeight(50);
lvHeaderProgressBar = (ProgressBar) headerView.findViewById(R.id.lvHeaderProgressBar);
measureView(headerView);
headerContentHeight = headerView.getMeasuredHeight();
// 设置内边距,正好距离顶部为一个负的整个布局的高度,正好把头部隐藏
headerView.setPadding(0, -1 * headerContentHeight, 0, 0);
// 头部存在时会有间隙,去掉此间隙
setY(0 - getDividerHeight());
// 重绘一下
headerView.invalidate();
// 将下拉刷新的布局加入ListView的顶部
addHeaderView(headerView, null, true);//第三参数设置为false会导致headerView与itemView的分割线为透明
setOnScrollListener(this);
// 设置旋转动画事件
animation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
animation.setInterpolator(new LinearInterpolator());
animation.setDuration(250);
animation.setFillAfter(true);
reverseAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
reverseAnimation.setInterpolator(new LinearInterpolator());
reverseAnimation.setDuration(200);
reverseAnimation.setFillAfter(true);
}
// 当状态改变时候,调用该方法,以更新界面
private void changeHeaderViewByState() {
switch (state) {
case CLOSE:
headerView.setPadding(0, 0 - headerContentHeight, 0, 0);
lvHeaderTipsTv.setText("下拉刷新");
lvHeaderProgressBar.setVisibility(View.GONE);
lvHeaderArrowIv.setVisibility(View.VISIBLE);
lvHeaderArrowIv.clearAnimation();
lvHeaderArrowIv.setImageResource(R.drawable.arrow);
break;
case OPENING:
lvHeaderTipsTv.setText("下拉刷新");
if (isBack) {// 是由OPEN状态转变来的
isBack = false;
lvHeaderArrowIv.clearAnimation();
lvHeaderArrowIv.startAnimation(reverseAnimation);
}
break;
case OPEN:
lvHeaderTipsTv.setText("松开刷新");
lvHeaderProgressBar.setVisibility(View.GONE);
lvHeaderArrowIv.clearAnimation();// 清除动画
lvHeaderArrowIv.startAnimation(animation);// 开始动画效果
break;
case LOADING:
headerView.setPadding(0, 0, 0, 0);
lvHeaderTipsTv.setText("正在刷新...");
lvHeaderProgressBar.setVisibility(View.VISIBLE);
lvHeaderArrowIv.clearAnimation();
lvHeaderArrowIv.setVisibility(View.GONE);
break;
}
}
// 此方法直接照搬自网络上的一个下拉刷新的demo,此处是“估计”headView的width以及height
private void measureView(View child) {
ViewGroup.LayoutParams params = child.getLayoutParams();
if (params == null) {
params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, params.width);
int lpHeight = params.height;
int childHeightSpec;
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthSpec, childHeightSpec);
}
private void onLvRefresh() {
if (refreshListener != null) {
refreshListener.onRefresh();
}
}
public boolean isOnMeasure() {
return isOnMeasure;
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
}
| [
"cc593101427@qq.com"
] | cc593101427@qq.com |
2b97c0819b898c9e3d4dd9da95438104728817da | aea1e1f753124c936e7a5f9e0f7e65766e8db70b | /app/src/main/java/com/wishland/www/aicaipiao2/utils/SPUtils.java | 82f8527d2b1df220fcc1af2b4b7df624dabae589 | [] | no_license | RightManCode/myProject | 0371a0aa8a62ee3502e25891026163f886aad611 | d28fed9e157338d16c02c2b6cb83846b6894b54e | refs/heads/master | 2021-07-05T14:15:04.386969 | 2017-09-27T05:45:56 | 2017-09-27T05:45:56 | 103,805,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,689 | java | package com.wishland.www.aicaipiao2.utils;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import java.util.LinkedHashSet;
import java.util.Set;
/**
* Created by admin on 2017/9/12.
*/
public class SPUtils {
private static SharedPreferences sharedPreferences;
private static final String preferencesName = "preferences";
private static final String LENGTH = "_length";
private static final String DEFAULT_STRING_VALUE = "";
private static final int DEFAULT_INT_VALUE = -1;
private static final double DEFAULT_DOUBLE_VALUE = -1d;
private static final float DEFAULT_FLOAT_VALUE = -1f;
private static final long DEFAULT_LONG_VALUE = -1L;
private static final boolean DEFAULT_BOOLEAN_VALUE = false;
public static Context context;
private static SharedPreferences getSharedPreferences() {
if (sharedPreferences == null) {
sharedPreferences = context
.getApplicationContext().getSharedPreferences(
preferencesName,
Context.MODE_PRIVATE
);
}
return sharedPreferences;
}
/**
* @param what
* @return Returns the stored value of 'what'
*/
public static String getString(String what) {
return getSharedPreferences().getString(what, DEFAULT_STRING_VALUE);
}
/**
* @param what
* @param defaultString
* @return Returns the stored value of 'what'
*/
public static String getString(String what, String defaultString) {
return getSharedPreferences().getString(what, defaultString);
}
/**
* @param where
* @param what
*/
public static void putString(String where, String what) {
getSharedPreferences().edit().putString(where, what).apply();
}
// int related methods
/**
* @param what
* @return Returns the stored value of 'what'
*/
public static int getInt(String what) {
return getSharedPreferences().getInt(what, DEFAULT_INT_VALUE);
}
/**
* @param what
* @param defaultInt
* @return Returns the stored value of 'what'
*/
public static int getInt(String what, int defaultInt) {
return getSharedPreferences().getInt(what, defaultInt);
}
/**
* @param where
* @param what
*/
public static void putInt(String where, int what) {
getSharedPreferences().edit().putInt(where, what).apply();
}
// double related methods
/**
* @param what
* @return Returns the stored value of 'what'
*/
public static double getDouble(String what) {
if (!contains(what))
return DEFAULT_DOUBLE_VALUE;
return Double.longBitsToDouble(getLong(what));
}
/**
* @param what
* @param defaultDouble
* @return Returns the stored value of 'what'
*/
public double getDouble(String what, double defaultDouble) {
if (!contains(what))
return defaultDouble;
return Double.longBitsToDouble(getLong(what));
}
/**
* @param where
* @param what
*/
public void putDouble(String where, double what) {
putLong(where, Double.doubleToRawLongBits(what));
}
// float related methods
/**
* @param what
* @return Returns the stored value of 'what'
*/
public float getFloat(String what) {
return getSharedPreferences().getFloat(what, DEFAULT_FLOAT_VALUE);
}
/**
* @param what
* @param defaultFloat
* @return Returns the stored value of 'what'
*/
public float getFloat(String what, float defaultFloat) {
return getSharedPreferences().getFloat(what, defaultFloat);
}
/**
* @param where
* @param what
*/
public void putFloat(String where, float what) {
getSharedPreferences().edit().putFloat(where, what).apply();
}
// long related methods
/**
* @param what
* @return Returns the stored value of 'what'
*/
public static long getLong(String what) {
return getSharedPreferences().getLong(what, DEFAULT_LONG_VALUE);
}
/**
* @param what
* @param defaultLong
* @return Returns the stored value of 'what'
*/
public static long getLong(String what, long defaultLong) {
return getSharedPreferences().getLong(what, defaultLong);
}
/**
* @param where
* @param what
*/
public static void putLong(String where, long what) {
getSharedPreferences().edit().putLong(where, what).apply();
}
// boolean related methods
/**
* @param what
* @return Returns the stored value of 'what'
*/
public static boolean getBoolean(String what) {
return getSharedPreferences().getBoolean(what, DEFAULT_BOOLEAN_VALUE);
}
/**
* @param what
* @param defaultBoolean
* @return Returns the stored value of 'what'
*/
public static boolean getBoolean(String what, boolean defaultBoolean) {
return getSharedPreferences().getBoolean(what, defaultBoolean);
}
/**
* @param where
* @param what
*/
public static void putBoolean(String where, boolean what) {
getSharedPreferences().edit().putBoolean(where, what).apply();
}
// String set methods
/**
* @param key
* @param value
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void putStringSet(final String key, final Set<String> value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getSharedPreferences().edit().putStringSet(key, value).apply();
} else {
// Workaround for pre-HC's lack of StringSets
putOrderedStringSet(key, value);
}
}
/**
* @param key
* @param value
*/
public static void putOrderedStringSet(String key, Set<String> value) {
int stringSetLength = 0;
if (getSharedPreferences().contains(key + LENGTH)) {
// First getString what the value was
stringSetLength = getInt(key + LENGTH);
}
putInt(key + LENGTH, value.size());
int i = 0;
for (String aValue : value) {
putString(key + "[" + i + "]", aValue);
i++;
}
for (; i < stringSetLength; i++) {
// Remove any remaining values
remove(key + "[" + i + "]");
}
}
/**
* @param key
* @param defValue
* @return Returns the String Set with HoneyComb compatibility
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public Set<String> getStringSet(final String key, final Set<String> defValue) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return getSharedPreferences().getStringSet(key, defValue);
} else {
// Workaround for pre-HC's missing getStringSet
return getOrderedStringSet(key, defValue);
}
}
/**
* @param key
* @param defValue
* @return Returns the ordered String Set
*/
public Set<String> getOrderedStringSet(String key, final Set<String> defValue) {
if (contains(key + LENGTH)) {
LinkedHashSet<String> set = new LinkedHashSet<>();
int stringSetLength = getInt(key + LENGTH);
if (stringSetLength >= 0) {
for (int i = 0; i < stringSetLength; i++) {
set.add(getString(key + "[" + i + "]"));
}
}
return set;
}
return defValue;
}
// end related methods
/**
* @param key
*/
public static void remove(final String key) {
if (contains(key + LENGTH)) {
// Workaround for pre-HC's lack of StringSets
int stringSetLength = getInt(key + LENGTH);
if (stringSetLength >= 0) {
getSharedPreferences().edit().remove(key + LENGTH).apply();
for (int i = 0; i < stringSetLength; i++) {
getSharedPreferences().edit().remove(key + "[" + i + "]").apply();
}
}
}
getSharedPreferences().edit().remove(key).apply();
}
/**
* @param key
* @return Returns if that key exists
*/
public static boolean contains(final String key) {
return getSharedPreferences().contains(key);
}
/**
* Clear all the preferences
*/
public static void clear() {
getSharedPreferences().edit().clear().apply();
}
}
| [
"bing@163.com"
] | bing@163.com |
ac516d9e90992615e63e0869d516f62553a26aa3 | dee8cddb2f465ca99a628825b2f7e1efe974fb87 | /app/src/main/java/com/sahni/rahul/ieee_niec/activity/SignInActivity.java | fdc29c97db6a4016f8b77c121d2a19e1fe3b0c92 | [] | no_license | rahulsahni06/IEEE-NIEC-Android-app | 0b11a9f121b2502ef3b880e439c00fef981ffd9b | eca8ccc0de321354441c99673f92da2a575cf54b | refs/heads/master | 2021-03-31T01:05:53.750358 | 2018-04-06T06:36:31 | 2018-04-06T06:36:31 | 111,327,642 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,745 | java | package com.sahni.rahul.ieee_niec.activity;
import android.content.Intent;
import android.content.IntentSender;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.sahni.rahul.ieee_niec.R;
import com.sahni.rahul.ieee_niec.helpers.ContentUtils;
import com.sahni.rahul.ieee_niec.models.User;
import static com.sahni.rahul.ieee_niec.helpers.ContentUtils.STATE_RESOLVING_ERROR;
public class SignInActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener
,GoogleApiClient.ConnectionCallbacks {
private static final String TAG = "SignInActivity";
private static final int RC_GET_USER_DETAILS = 600;
private GoogleApiClient mGoogleApiClient;
private int RC_SIGN_IN = 1;
private ProgressBar mProgressBar;
private SignInButton mSignInButton;
private AlertDialog mAlertDialog;
private FirebaseAuth mAuth;
private int REQUEST_RESOLVE_ERROR = 1001;
private String mAction;
private boolean mResolvingError = false;
private CollectionReference mUsersCollection;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
mResolvingError = savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);
}
setContentView(R.layout.activity_sign_in);
mUsersCollection = FirebaseFirestore.getInstance().collection("users");
Intent intent = getIntent();
mAction = intent.getStringExtra(ContentUtils.ACTION_SIGN);
mAuth = FirebaseAuth.getInstance();
mProgressBar = findViewById(R.id.sign_in_progress);
mProgressBar.getIndeterminateDrawable().setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
ImageView closeImageView = findViewById(R.id.close_image_view);
closeImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
mSignInButton = findViewById(R.id.sign_in_button);
mSignInButton.setSize(SignInButton.SIZE_WIDE);
mSignInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
signIn();
}
});
if (mAction != null && mAction.equals(ContentUtils.SIGNED_OUT)) {
mSignInButton.setEnabled(false);
View dialogView = getLayoutInflater().inflate(R.layout.progress_dialog_layout, null);
TextView progressTextView = dialogView.findViewById(R.id.progress_text_view);
progressTextView.setText("Signing out...");
mAlertDialog = new AlertDialog.Builder(this)
.setView(dialogView)
.setCancelable(false)
.create();
mAlertDialog.show();
} else if (mAction != null && mAction.equals(ContentUtils.DELETE_ACCOUNT)) {
mSignInButton.setEnabled(false);
View dialogView = getLayoutInflater().inflate(R.layout.progress_dialog_layout, null);
TextView progressTextView = dialogView.findViewById(R.id.progress_text_view);
progressTextView.setText("Deleting...");
mAlertDialog = new AlertDialog.Builder(this)
.setView(dialogView)
.setCancelable(false)
.create();
mAlertDialog.show();
}
}
private void signIn() {
mProgressBar.setVisibility(View.VISIBLE);
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
} else if (requestCode == REQUEST_RESOLVE_ERROR) {
mResolvingError = false;
if (resultCode == RESULT_OK) {
// Make sure the app is not already connected or attempting to connect
if (!mGoogleApiClient.isConnecting() &&
!mGoogleApiClient.isConnected()) {
mGoogleApiClient.connect();
}
}
} else if(requestCode == RC_GET_USER_DETAILS){
if(resultCode == RESULT_OK){
User user = data.getParcelableExtra(ContentUtils.USER_KEY);
saveDetails(user);
} else {
mProgressBar.setVisibility(View.INVISIBLE);
mSignInButton.setEnabled(true);
Snackbar.make(mProgressBar, "Sign in failed!, Try Again", Snackbar.LENGTH_SHORT).show();
}
}
}
private void handleSignInResult(GoogleSignInResult result) {
if (result.isSuccess()) {
mSignInButton.setEnabled(false);
final GoogleSignInAccount acct = result.getSignInAccount();
firebaseAuthWithGoogle(acct);
} else {
mProgressBar.setVisibility(View.INVISIBLE);
}
}
private void firebaseAuthWithGoogle(final GoogleSignInAccount acct) {
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
FirebaseUser firebaseUser = mAuth.getCurrentUser();
checkForUserDetailsOnline(firebaseUser);
} else {
mProgressBar.setVisibility(View.INVISIBLE);
mSignInButton.setEnabled(true);
Toast.makeText(SignInActivity.this, "Login failed, try again", Toast.LENGTH_SHORT).show();
}
}
})
.addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
}
});
}
private void checkForUserDetailsOnline(final FirebaseUser firebaseUser) {
mUsersCollection.document(firebaseUser.getUid())
.get()
.addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document.exists()) {
User user = document.toObject(User.class);
Toast.makeText(SignInActivity.this, "Welcome back, " + user.getName() + "!", Toast.LENGTH_SHORT).show();
saveDetailsLocally(user);
} else {
User user = new User(
firebaseUser.getUid(), firebaseUser.getDisplayName(),
firebaseUser.getEmail(), firebaseUser.getPhotoUrl().toString()
);
getAdditionalDetailsFromUser(user);
}
} else {
mProgressBar.setVisibility(View.INVISIBLE);
mSignInButton.setEnabled(true);
Snackbar.make(mProgressBar, "Sign in failed!, Try Again", Snackbar.LENGTH_SHORT).show();
}
}
});
}
@Override
protected void onStart() {
mGoogleApiClient.connect();
if (mAuth == null) {
mAuth = FirebaseAuth.getInstance();
}
super.onStart();
}
@Override
protected void onStop() {
mGoogleApiClient.disconnect();
super.onStop();
}
private void signOut() {
Auth.GoogleSignInApi.signOut(mGoogleApiClient)
.setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(@NonNull Status status) {
FirebaseAuth.getInstance().signOut();
ContentUtils.deleteUserDataFromSharedPref(SignInActivity.this);
Snackbar.make(mProgressBar, "Goodbye!", Snackbar.LENGTH_LONG).show();
mAlertDialog.dismiss();
mSignInButton.setEnabled(true);
}
}
);
}
private void deleteAccount() {
final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
Auth.GoogleSignInApi.revokeAccess(mGoogleApiClient)
.setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(@NonNull Status status) {
if (status.isSuccess()) {
mUsersCollection.document(firebaseUser.getUid())
.delete()
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
ContentUtils.deleteUserDataFromSharedPref(SignInActivity.this);
Snackbar.make(mProgressBar, "Goodbye!", Snackbar.LENGTH_LONG).show();
mAlertDialog.dismiss();
mSignInButton.setEnabled(true);
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
}
});
}
}
});
}
private void saveDetails(final User user) {
mProgressBar.setVisibility(View.VISIBLE);
mSignInButton.setEnabled(false);
mUsersCollection.document(user.getuId())
.set(user)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(SignInActivity.this, "Welcome, " + user.getName() + "!", Toast.LENGTH_SHORT).show();
saveDetailsLocally(user);
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
mProgressBar.setVisibility(View.INVISIBLE);
mSignInButton.setEnabled(true);
Snackbar.make(mProgressBar, "Sign in failed!, Try Again", Snackbar.LENGTH_SHORT).show();
}
});
}
private void saveDetailsLocally(User user) {
ContentUtils.saveUserDataInSharedPref(user, this);
Intent intent = new Intent();
intent.putExtra(ContentUtils.USER_KEY, user);
setResult(RESULT_OK, intent);
finish();
}
private void getAdditionalDetailsFromUser(User user) {
Intent intent = new Intent(this, GetUserDetailsActivity.class);
intent.putExtra(ContentUtils.USER_KEY, user);
startActivityForResult(intent, RC_GET_USER_DETAILS);
}
@Override
public void onBackPressed() {
startActivity(new Intent(this, MainActivity.class));
}
@Override
public void onConnected(@Nullable Bundle bundle) {
if (mAction != null && mAction.equals(ContentUtils.SIGNED_OUT)) {
signOut();
} else if (mAction != null && mAction.equals(ContentUtils.DELETE_ACCOUNT)) {
deleteAccount();
}
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
if (mResolvingError) {
return;
} else if (connectionResult.hasResolution()) {
try {
mResolvingError = true;
connectionResult.startResolutionForResult(this, REQUEST_RESOLVE_ERROR);
} catch (IntentSender.SendIntentException e) {
mGoogleApiClient.connect();
}
} else {
GoogleApiAvailability.getInstance().getErrorDialog(this, connectionResult.getErrorCode(), REQUEST_RESOLVE_ERROR).show();
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(STATE_RESOLVING_ERROR, mResolvingError);
}
}
| [
"rahul.sahni06@gmail.com"
] | rahul.sahni06@gmail.com |
0239fff7e1bbd3d6570ca570be8d60a52acb23b5 | a5a2c13cd166e72461d4c4ced88c735df2f7b020 | /info2/contract/Date.java | 462cec3782ec8169370d979a24ae836ac0cc0ec6 | [] | no_license | dvdhrm/uni | 98916787a331218fd98a08c654d2fecbfde87b22 | 740137ee580e5137628578ea34818549b311d236 | refs/heads/master | 2020-05-14T21:20:58.377919 | 2012-01-29T21:01:57 | 2012-01-29T21:01:57 | 1,653,767 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | // David Herrmann
// Single date
public class Date
{
// Year (eg. 2011, 1991, 2000)
int year;
// Month (1-12)
int month;
// Day (1-31)
int day;
public Date(int year, int month, int day)
{
this.year = year;
this.month = month;
this.day = day;
}
public boolean isEarlierThan(Date date)
{
if (this.year < date.year)
return true;
else if (this.year > date.year)
return false;
else if (this.month < date.month)
return true;
else if (this.month > date.month)
return false;
else if (this.day < date.day)
return true;
else
return false;
}
}
| [
"dh.herrmann@googlemail.com"
] | dh.herrmann@googlemail.com |
d07166f244fef79166906b862dfe8fb7c468f159 | 72003cab6711efe96e7080599376d758e065fc33 | /PCLApp/JavaSource/com/citibank/ods/modules/product/player/functionality/PlayerDetailFnc.java | 3778d11e6aefba40f75410fcfad9abd8a2258b38 | [] | no_license | mv58799/PCLApp | 39390b8ff5ccaf95c654f394e32ed03b7713e8ad | 2f8772a60fee035104586bbbf2827567247459c4 | refs/heads/master | 2020-03-19T09:06:30.870074 | 2018-06-06T03:10:07 | 2018-06-06T03:10:07 | 136,260,531 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 29,784 | java | package com.citibank.ods.modules.product.player.functionality;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.struts.action.ActionForm;
import com.citibank.ods.Globals;
import com.citibank.ods.common.entity.BaseODSEntity;
import com.citibank.ods.common.functionality.ODSDetailFnc;
import com.citibank.ods.common.functionality.valueobject.BaseFncVO;
import com.citibank.ods.common.functionality.valueobject.BaseODSFncVO;
import com.citibank.ods.common.util.ODSConstraintDecoder;
import com.citibank.ods.entity.pl.BaseTplPlayerRoleEntity;
import com.citibank.ods.entity.pl.TplPlayerEntity;
import com.citibank.ods.entity.pl.TplPlayerMovEntity;
import com.citibank.ods.entity.pl.TplPlayerRoleMovEntity;
import com.citibank.ods.entity.pl.TplShortNamePlayerMovEntity;
import com.citibank.ods.entity.pl.valueobject.TplPlayerEntityVO;
import com.citibank.ods.entity.pl.valueobject.TplPlayerRoleMovEntityVO;
import com.citibank.ods.modules.product.player.form.PlayerDetailForm;
import com.citibank.ods.modules.product.player.functionality.valueobject.PlayerDetailFncVO;
import com.citibank.ods.modules.product.player.functionality.valueobject.ShortNameVO;
import com.citibank.ods.persistence.pl.dao.BaseTplPlayerDAO;
import com.citibank.ods.persistence.pl.dao.BaseTplPlayerRoleDAO;
import com.citibank.ods.persistence.pl.dao.TplPlayerDAO;
import com.citibank.ods.persistence.pl.dao.TplPlayerMovDAO;
import com.citibank.ods.persistence.pl.dao.TplPlayerRoleDAO;
import com.citibank.ods.persistence.pl.dao.TplPlayerRoleMovDAO;
import com.citibank.ods.persistence.pl.dao.TplProdPlayerRoleDAO;
import com.citibank.ods.persistence.pl.dao.TplShortNamePlayerDAO;
import com.citibank.ods.persistence.pl.dao.TplShortNamePlayerMovDAO;
import com.citibank.ods.persistence.pl.dao.factory.ODSDAOFactory;
/**
* @author angelica.almeida
*
*/
public class PlayerDetailFnc extends BasePlayerDetailFnc implements
ODSDetailFnc
{
private static final String C_ASSOCIATION = "Associações";
private static final String C_PLYR_ROLE = "Papel Player";
private static final String C_PLAYER = "Player";
/**
*
* @see com.citibank.ods.common.functionality.ODSDetailFnc#insert(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void insert( BaseFncVO fncVO_ )
{
BaseTplPlayerRoleEntity baseTplPlayerRoleEntity;
TplPlayerRoleMovEntity playerRoleMovEntity;
this.validateInsert( fncVO_ );
if ( !fncVO_.hasErrors() )
{
PlayerDetailFncVO detailFncVO = ( PlayerDetailFncVO ) fncVO_;
TplPlayerEntity tplPlayerEntity = ( TplPlayerEntity ) detailFncVO.getBaseTplPlayerEntity();
tplPlayerEntity.getData().setLastUpdDate( new Date() );
tplPlayerEntity.getData().setLastUpdUserId(
fncVO_.getLoggedUser() != null
? fncVO_.getLoggedUser().getUserID()
: "" );
TplPlayerMovEntity tplPlayerMovEntity = new TplPlayerMovEntity(
tplPlayerEntity,
TplPlayerMovEntity.C_OPERN_CODE_INSERT );
TplPlayerMovDAO tplPlayerMovDAO = ODSDAOFactory.getInstance().getTplPlayerMovDAO();
tplPlayerMovDAO.insert( tplPlayerMovEntity );
TplPlayerRoleMovDAO tplPlayerRoleMovDAO = ODSDAOFactory.getInstance().getTplPlayerRoleMovDAO();
ArrayList playerRoleNames = detailFncVO.getBaseTplPlayerEntity().getPlyrRoleNames();
for ( int i = 0; i < playerRoleNames.size(); i++ )
{
baseTplPlayerRoleEntity = ( BaseTplPlayerRoleEntity ) playerRoleNames.get( i );
playerRoleMovEntity = new TplPlayerRoleMovEntity();
playerRoleMovEntity.getData().setPlyrCnpjNbr(
baseTplPlayerRoleEntity.getData().getPlyrCnpjNbr() );
playerRoleMovEntity.getData().setPlyrRoleTypeCode(
baseTplPlayerRoleEntity.getData().getPlyrRoleTypeCode() );
playerRoleMovEntity.getData().setLastUpdDate( new Date() );
playerRoleMovEntity.getData().setLastUpdUserId(
fncVO_.getLoggedUser() != null
? fncVO_.getLoggedUser().getUserID()
: "" );
( ( TplPlayerRoleMovEntityVO ) playerRoleMovEntity.getData() ).setOpernCode( TplPlayerRoleMovEntity.C_OPERN_CODE_INSERT );
tplPlayerRoleMovDAO.insert( playerRoleMovEntity );
}
//Insere lista de Mnemonicos
ShortNameVO shortNameVO;
TplShortNamePlayerMovEntity tplShortNamePlayerMovEntity;
TplShortNamePlayerMovDAO tplShortNamePlayerMovDAO = ODSDAOFactory.getInstance().getTplShortNamePlayerMovDAO();
List<ShortNameVO> shortNameList = detailFncVO.getIssueShortNameList();
for(int i=0;i<shortNameList.size();i++){
shortNameVO = shortNameList.get(i);
shortNameVO.setOpernCode(BaseODSEntity.C_OPERN_CODE_INSERT);
shortNameVO.setLastUpdUserId( fncVO_.getLoggedUser() != null ? fncVO_.getLoggedUser().getUserID() : "");
shortNameVO.setLastUpdDate(new Date());
tplShortNamePlayerMovEntity = new TplShortNamePlayerMovEntity(shortNameVO);
tplShortNamePlayerMovDAO.insert(tplShortNamePlayerMovEntity);
}
}
}
/**
*
* @see com.citibank.ods.common.functionality.ODSDetailFnc#update(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void update( BaseFncVO fncVO_ )
{
BaseTplPlayerRoleEntity baseTplPlayerRoleEntity;
TplPlayerRoleMovEntity playerRoleMovEntity;
this.validateUpdate( fncVO_ );
if ( !fncVO_.hasErrors() )
{
PlayerDetailFncVO detailFncVO = ( PlayerDetailFncVO ) fncVO_;
TplPlayerEntity tplPlayerEntity = ( TplPlayerEntity ) detailFncVO.getBaseTplPlayerEntity();
tplPlayerEntity.getData().setLastUpdDate( new Date() );
tplPlayerEntity.getData().setLastUpdUserId(
fncVO_.getLoggedUser() != null
? fncVO_.getLoggedUser().getUserID()
: "" );
TplPlayerMovEntity tplPlayerMovEntity = new TplPlayerMovEntity(
tplPlayerEntity,
TplPlayerMovEntity.C_OPERN_CODE_UPDATE );
TplPlayerMovDAO tplPlayerMovDAO = ODSDAOFactory.getInstance().getTplPlayerMovDAO();
tplPlayerMovDAO.insert( tplPlayerMovEntity );
//Inserir papéis do player
TplPlayerRoleMovDAO tplPlayerRoleMovDAO = ODSDAOFactory.getInstance().getTplPlayerRoleMovDAO();
ArrayList playerRoleNames = detailFncVO.getBaseTplPlayerEntity().getPlyrRoleNames();
for ( int i = 0; i < playerRoleNames.size(); i++ )
{
baseTplPlayerRoleEntity = ( BaseTplPlayerRoleEntity ) playerRoleNames.get( i );
playerRoleMovEntity = new TplPlayerRoleMovEntity();
playerRoleMovEntity.getData().setPlyrCnpjNbr(
baseTplPlayerRoleEntity.getData().getPlyrCnpjNbr() );
playerRoleMovEntity.getData().setPlyrRoleTypeCode(
baseTplPlayerRoleEntity.getData().getPlyrRoleTypeCode() );
playerRoleMovEntity.getData().setLastUpdDate( new Date() );
playerRoleMovEntity.getData().setLastUpdUserId(
fncVO_.getLoggedUser() != null
? fncVO_.getLoggedUser().getUserID()
: "" );
( ( TplPlayerRoleMovEntityVO ) playerRoleMovEntity.getData() ).setOpernCode( TplPlayerMovEntity.C_OPERN_CODE_UPDATE );
tplPlayerRoleMovDAO.insert( playerRoleMovEntity );
}
//Insere lista de Mnemonicos
ShortNameVO shortNameVO;
TplShortNamePlayerMovEntity tplShortNamePlayerMovEntity;
TplShortNamePlayerMovDAO tplShortNamePlayerMovDAO = ODSDAOFactory.getInstance().getTplShortNamePlayerMovDAO();
List<ShortNameVO> shortNameList = detailFncVO.getIssueShortNameList();
for(int i=0;i<shortNameList.size();i++){
shortNameVO = shortNameList.get(i);
shortNameVO.setOpernCode(BaseODSEntity.C_OPERN_CODE_UPDATE);
shortNameVO.setLastUpdUserId( fncVO_.getLoggedUser() != null ? fncVO_.getLoggedUser().getUserID() : "");
shortNameVO.setLastUpdDate(new Date());
tplShortNamePlayerMovEntity = new TplShortNamePlayerMovEntity(shortNameVO);
tplShortNamePlayerMovDAO.insert(tplShortNamePlayerMovEntity);
}
}
}
/**
*
* @see com.citibank.ods.common.functionality.ODSDetailFnc#delete(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void delete( BaseFncVO fncVO_ )
{
BaseTplPlayerRoleEntity baseTplPlayerRoleEntity;
TplPlayerRoleMovEntity playerRoleMovEntity;
PlayerDetailFncVO detailFncVO = ( PlayerDetailFncVO ) fncVO_;
validateDelete( detailFncVO );
if ( !detailFncVO.hasErrors() )
{
TplPlayerDAO tplPlayerDAO = ODSDAOFactory.getInstance().getTplPlayerDAO();
TplPlayerEntity tplPlayerEntity = ( TplPlayerEntity ) tplPlayerDAO.find( detailFncVO.getBaseTplPlayerEntity() );
tplPlayerEntity.getData().setLastUpdDate( new Date() );
tplPlayerEntity.getData().setLastUpdUserId(
fncVO_.getLoggedUser() != null
? fncVO_.getLoggedUser().getUserID()
: "" );
TplPlayerMovEntity tplPlayerMovEntity = new TplPlayerMovEntity(
tplPlayerEntity,
TplPlayerMovEntity.C_OPERN_CODE_DELETE );
TplPlayerMovDAO tplPlayerMovDAO = ODSDAOFactory.getInstance().getTplPlayerMovDAO();
tplPlayerMovDAO.insert( tplPlayerMovEntity );
//Papéis do player
TplPlayerRoleMovDAO tplPlayerRoleMovDAO = ODSDAOFactory.getInstance().getTplPlayerRoleMovDAO();
TplPlayerRoleDAO tplPlayerRoleDAO = ODSDAOFactory.getInstance().getTplPlayerRoleDAO();
ArrayList playerRoleNames = tplPlayerRoleDAO.selectByPk( tplPlayerEntity.getData().getPlyrCnpjNbr() );
for ( int i = 0; i < playerRoleNames.size(); i++ )
{
baseTplPlayerRoleEntity = ( BaseTplPlayerRoleEntity ) playerRoleNames.get( i );
playerRoleMovEntity = new TplPlayerRoleMovEntity();
playerRoleMovEntity.getData().setPlyrCnpjNbr(
baseTplPlayerRoleEntity.getData().getPlyrCnpjNbr() );
playerRoleMovEntity.getData().setPlyrRoleTypeCode(
baseTplPlayerRoleEntity.getData().getPlyrRoleTypeCode() );
playerRoleMovEntity.getData().setLastUpdDate( new Date() );
playerRoleMovEntity.getData().setLastUpdUserId(
fncVO_.getLoggedUser() != null
? fncVO_.getLoggedUser().getUserID()
: "" );
( ( TplPlayerRoleMovEntityVO ) playerRoleMovEntity.getData() ).setOpernCode( TplPlayerMovEntity.C_OPERN_CODE_DELETE );
tplPlayerRoleMovDAO.insert( playerRoleMovEntity );
}
//Mnemonicos
ShortNameVO shortNameVO;
TplShortNamePlayerMovEntity tplShortNamePlayerMovEntity;
TplShortNamePlayerMovDAO tplShortNamePlayerMovDAO = ODSDAOFactory.getInstance().getTplShortNamePlayerMovDAO();
List<ShortNameVO> shortNameList = detailFncVO.getIssueShortNameList();
for(int i=0;i<shortNameList.size();i++){
shortNameVO = shortNameList.get(i);
shortNameVO.setOpernCode(BaseODSEntity.C_OPERN_CODE_DELETE);
shortNameVO.setLastUpdUserId( fncVO_.getLoggedUser() != null ? fncVO_.getLoggedUser().getUserID() : "");
shortNameVO.setLastUpdDate(new Date());
tplShortNamePlayerMovEntity = new TplShortNamePlayerMovEntity(shortNameVO);
tplShortNamePlayerMovDAO.insert(tplShortNamePlayerMovEntity);
}
}
}
/**
* Realiza as validações de inserção
* @see com.citibank.ods.common.functionality.ODSDetailFnc#validateInsert(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void validateInsert( BaseFncVO fncVO_ )
{
PlayerDetailFncVO playerDetailFncVO = ( PlayerDetailFncVO ) fncVO_;
TplPlayerEntityVO tplPlayerEntityVO = ( TplPlayerEntityVO ) playerDetailFncVO.getBaseTplPlayerEntity().getData();
//Validar Campos Obrigatórios
if ( tplPlayerEntityVO.getPlyrCnpjNbr() == null
|| tplPlayerEntityVO.getPlyrCnpjNbr().equals( "" ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_MANDATORY_FIELD,
C_DISPLAY_PLYR_CNPJ_NBR );
}
if ( tplPlayerEntityVO.getPlyrName() == null
|| tplPlayerEntityVO.getPlyrName().equals( "" ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_MANDATORY_FIELD,
C_DISPLAY_PLYR_NAME );
}
if ( playerDetailFncVO.getBaseTplPlayerEntity().getPlyrRoleNames() == null
|| playerDetailFncVO.getBaseTplPlayerEntity().getPlyrRoleNames().size() < 1 )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_MANDATORY_FIELD,
C_DISPLAY_PLYR_ROLE );
}
if ( !fncVO_.hasErrors() )
{
//Validar se já existe um registro com este codigo na "Current",
if ( this.existsActive( playerDetailFncVO ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_DUPLICATE_PK );
}
//Validar se já existe movimento com este codigo
if ( this.existsInMovement( playerDetailFncVO ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_IN_MOVEMENT );
}
//validar se já existe um mnemonico cadastrado com o este valor
if(this.existsInIssue( playerDetailFncVO )!= null){
fncVO_.addError(PlayerDetailFncVO.C_INVALID_ISSUE,this.existsInIssue( playerDetailFncVO ));
}
}
}
/**
* Realiza as validações de alteração
* @see com.citibank.ods.common.functionality.ODSDetailFnc#validateUpdate(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void validateUpdate( BaseFncVO fncVO_ )
{
PlayerDetailFncVO playerDetailFncVO = ( PlayerDetailFncVO ) fncVO_;
TplPlayerEntityVO tplPlayerEntityVO = ( TplPlayerEntityVO ) playerDetailFncVO.getBaseTplPlayerEntity().getData();
//Validar Campos Obrigatórios
if ( tplPlayerEntityVO.getPlyrCnpjNbr() == null
|| tplPlayerEntityVO.getPlyrCnpjNbr().equals( "" ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_MANDATORY_FIELD,
C_DISPLAY_PLYR_CNPJ_NBR );
}
if ( tplPlayerEntityVO.getPlyrName() == null
|| tplPlayerEntityVO.getPlyrName().equals( "" ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_MANDATORY_FIELD,
C_DISPLAY_PLYR_NAME );
}
if ( playerDetailFncVO.getBaseTplPlayerEntity().getPlyrRoleNames() == null
|| playerDetailFncVO.getBaseTplPlayerEntity().getPlyrRoleNames().size() < 1 )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_MANDATORY_FIELD,
C_DISPLAY_PLYR_ROLE );
}
if ( !fncVO_.hasErrors() )
{
//Validar se existe um registro com este codigo na "Current",
if ( !this.existsActive( playerDetailFncVO ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_PK_NOT_FOUND );
}
//Validar se já existe movimento com este codigo
if ( this.existsInMovement( playerDetailFncVO ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_IN_MOVEMENT );
}
//Validar se existem associações relacionadas a algum dos papéis
// excluidos
ArrayList listRoleTypes = new ArrayList();
listRoleTypes = this.verifyAssociations(
tplPlayerEntityVO.getPlyrCnpjNbr(),
playerDetailFncVO.getBaseTplPlayerEntity().getPlyrRoleNames() );
if ( listRoleTypes != null && listRoleTypes.size() > 0 )
{
for ( int i = 0; i < listRoleTypes.size(); i++ )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_IS_REFERENCED,
C_PLYR_ROLE + " " + listRoleTypes.get( i ),
" " + C_ASSOCIATION );
}
}
if ( this.existsInIssue(playerDetailFncVO) != null)
{
fncVO_.addError( PlayerDetailFncVO.C_INVALID_ISSUE, this.existsInIssue( playerDetailFncVO ) );
}
}
}
/**
* Realiza as validações de exclusão
* @see com.citibank.ods.common.functionality.ODSDetailFnc#validateDelete(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void validateDelete( BaseFncVO fncVO_ )
{
PlayerDetailFncVO playerDetailFncVO = ( PlayerDetailFncVO ) fncVO_;
if ( !fncVO_.hasErrors() )
{
//Validar se existe um registro com este codigo na "Current",
if ( !this.existsActive( playerDetailFncVO ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_PK_NOT_FOUND );
}
//Validar se já existe movimento com este codigo
if ( this.existsInMovement( playerDetailFncVO ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_IN_MOVEMENT );
}
if ( this.existsAssociation( playerDetailFncVO.getBaseTplPlayerEntity().getData().getPlyrCnpjNbr() ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_IS_REFERENCED, C_PLAYER,
C_ASSOCIATION );
}
}
}
/**
* Carregamento inicial - detalhe
* @see com.citibank.ods.common.functionality.ODSDetailFnc#loadForConsult(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void loadForConsult( BaseFncVO fncVO_ )
{
super.load( ( PlayerDetailFncVO ) fncVO_ );
super.loadDomains( ( PlayerDetailFncVO ) fncVO_ );
}
/**
* Carregamento inicial - inserção
* @see com.citibank.ods.common.functionality.ODSDetailFnc#loadForInsert(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void loadForInsert( BaseFncVO fncVO_ )
{
PlayerDetailFncVO detailFncVO = ( PlayerDetailFncVO ) fncVO_;
TplPlayerEntityVO tplPlayerEntityVO = ( TplPlayerEntityVO ) detailFncVO.getBaseTplPlayerEntity().getData();
tplPlayerEntityVO.setPlyrCnpjNbr( null );
tplPlayerEntityVO.setPlyrName( null );
tplPlayerEntityVO.setPlyrAddrText( null );
tplPlayerEntityVO.setPlyrDueDlgDate( null );
tplPlayerEntityVO.setPlyrDueDlgExecInd( null );
tplPlayerEntityVO.setPlyrDueDlgEndDate( null );
tplPlayerEntityVO.setPlyrDueDlgRnwDate( null );
tplPlayerEntityVO.setPlyrInvstCmtteApprvDate( null );
tplPlayerEntityVO.setPlyrApprvRstrnText( null );
tplPlayerEntityVO.setPlyrSuplServText( null );
tplPlayerEntityVO.setPlyrCmntText( null );
detailFncVO.getBaseTplPlayerEntity().setPlyrRoleNames( null );
detailFncVO.setIssueShortNameList(new ArrayList<ShortNameVO>());
detailFncVO.setIssueShortNameText(null);
}
/**
* Carregamento inicial - alteração
* @see com.citibank.ods.common.functionality.ODSDetailFnc#loadForUpdate(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void loadForUpdate( BaseFncVO fncVO_ )
{
if ( this.existsInMovement( ( PlayerDetailFncVO ) fncVO_ ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_IN_MOVEMENT );
}
else
{
super.load( ( PlayerDetailFncVO ) fncVO_ );
super.loadDomains( ( PlayerDetailFncVO ) fncVO_ );
}
}
/**
* Carregamento inicial - exclusão
* @see com.citibank.ods.common.functionality.ODSDetailFnc#loadForDelete(com.citibank.ods.common.functionality.valueobject.BaseFncVO)
*/
public void loadForDelete( BaseFncVO fncVO_ )
{
if ( this.existsInMovement( ( PlayerDetailFncVO ) fncVO_ ) )
{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_IN_MOVEMENT );
}
else
{
super.load( ( PlayerDetailFncVO ) fncVO_ );
super.loadDomains( ( PlayerDetailFncVO ) fncVO_ );
}
}
/**
* Verifica se existe um registro na tabela de movimento com os critérios
* passados
*/
private boolean existsInMovement( PlayerDetailFncVO playerDetailFncVO_ )
{
TplPlayerMovDAO tplPlayerMovDAO = ODSDAOFactory.getInstance().getTplPlayerMovDAO();
TplPlayerMovEntity tplPlayerMovEntity = new TplPlayerMovEntity();
tplPlayerMovEntity.getData().setPlyrCnpjNbr(
playerDetailFncVO_.getBaseTplPlayerEntity().getData().getPlyrCnpjNbr() );
return tplPlayerMovDAO.exists( tplPlayerMovEntity );
}
/**
* Verifica se já existe um registro na tabela de "Current" com o código
* passado e o seu status é "Ativo"
*/
private boolean existsActive( PlayerDetailFncVO playerDetailFncVO_ )
{
TplPlayerDAO tplPlayerDAO = ODSDAOFactory.getInstance().getTplPlayerDAO();
return tplPlayerDAO.existsActive( ( TplPlayerEntity ) playerDetailFncVO_.getBaseTplPlayerEntity() );
}
/**
* Retorna uma instancia do FncVO
* @see com.citibank.ods.common.functionality.BaseFnc#createFncVO()
*/
public BaseFncVO createFncVO()
{
return new PlayerDetailFncVO();
}
/**
* Retorna uma instancia do DAO da Current
*/
protected BaseTplPlayerDAO getDAO()
{
return ODSDAOFactory.getInstance().getTplPlayerDAO();
}
/**
* Retorna o DAO do Player Role
* @see com.citibank.ods.modules.product.player.functionality.BasePlayerDetailFnc#getPlayerRoleDAO()
*/
protected BaseTplPlayerRoleDAO getPlayerRoleDAO()
{
return ODSDAOFactory.getInstance().getTplPlayerRoleDAO();
}
/**
* Seta na Form os campos específicos de current
*/
public void updateFormFromFncVO( ActionForm form_, BaseFncVO fncVO_ )
{
super.updateFormFromFncVO( form_, fncVO_ );
PlayerDetailFncVO detailfncVO = ( PlayerDetailFncVO ) fncVO_;
PlayerDetailForm detailForm = ( PlayerDetailForm ) form_;
TplPlayerEntityVO tplPlayerEntityVO = ( TplPlayerEntityVO ) detailfncVO.getBaseTplPlayerEntity().getData();
SimpleDateFormat dateFormat = new SimpleDateFormat(
Globals.FuncionalityFormatKeys.C_FORMAT_DATE_DDMMYYYY );
detailForm.setLastAuthUserId( tplPlayerEntityVO.getLastAuthUserId() );
if ( tplPlayerEntityVO.getLastAuthDate() != null
&& !tplPlayerEntityVO.getLastAuthDate().equals( "" ) )
{
detailForm.setLastAuthDate( dateFormat.format( tplPlayerEntityVO.getLastAuthDate() ) );
}
else
{
detailForm.setLastAuthDate( null );
}
String recStatCode = ( ( TplPlayerEntityVO ) ( detailfncVO.getBaseTplPlayerEntity().getData() ) ).getRecStatCode();
if ( recStatCode != null && !"".equals( recStatCode ) )
{
String strRecStatCode = ODSConstraintDecoder.decodeRecStatus( recStatCode );
detailForm.setRecStatCode( strRecStatCode );
}
if(this.existsActive( detailfncVO )){
if(detailForm.getLoadIssue().equals("S")){
TplShortNamePlayerDAO tplShortNamePlayerDAO = ODSDAOFactory.getInstance().getTplShortNamePlayerDAO();
List<ShortNameVO> shortNameList = tplShortNamePlayerDAO.selectByPlyr(detailfncVO.getBaseTplPlayerEntity().getData().getPlyrCnpjNbr());
detailForm.setIssueShortNameList(shortNameList);
detailfncVO.setLoadIssue("N");
}
}
}
private ArrayList verifyAssociations( String plyrCnpjNbr_,
ArrayList listPlayerRole_ )
{
BaseTplPlayerRoleEntity tplPlayerRoleEntity;
ArrayList list = new ArrayList();
list = listPlayerRole_;
String roleTypes = "";
if ( list != null && list.size() > 0 )
{
for ( int i = 0; i < list.size(); i++ )
{
tplPlayerRoleEntity = ( BaseTplPlayerRoleEntity ) list.get( i );
roleTypes = roleTypes + ",'"
+ tplPlayerRoleEntity.getData().getPlyrRoleTypeCode() + "'";
}
}
roleTypes = roleTypes.substring( 1 );
TplProdPlayerRoleDAO tplProdPlayerRoleDAO = ODSDAOFactory.getInstance().getTplProdPlayerRoleDAO();
list = tplProdPlayerRoleDAO.getRoleTypes( plyrCnpjNbr_, roleTypes );
return list;
}
private boolean existsAssociation( String plyrCnpjNbr_ )
{
ArrayList listAssociation = new ArrayList();
TplProdPlayerRoleDAO tplProdPlayerRoleDAO = ODSDAOFactory.getInstance().getTplProdPlayerRoleDAO();
listAssociation = tplProdPlayerRoleDAO.selectByPlyr( plyrCnpjNbr_ );
if ( listAssociation.size() > 0 )
{
return true;
}
else
{
return false;
}
}
public void insertIssue(BaseFncVO fncVO_){
PlayerDetailFncVO detailfncVO = ( PlayerDetailFncVO ) fncVO_;
if(detailfncVO.getIssueShortNameText() != null && !detailfncVO.getIssueShortNameText().equals("")){
if(validateIssue(fncVO_)){
ShortNameVO shortNameVO = new ShortNameVO();
shortNameVO.setPlyrCnpjNbr(detailfncVO.getBaseTplPlayerEntity().getData().getPlyrCnpjNbr());
shortNameVO.setLastUpdUserId(detailfncVO.getBaseTplPlayerEntity().getData().getLastUpdUserId());
shortNameVO.setIssueShortName(detailfncVO.getIssueShortNameText().toUpperCase().trim());
detailfncVO.getIssueShortNameList().add(shortNameVO);
fncVO_.clearErrors();
}
}else{
fncVO_.addError( PlayerDetailFncVO.C_ERROR_MANDATORY_FIELD, C_DISPLAY_ISSUE );
}
}
public void deleteIssue(BaseFncVO fncVO_){
PlayerDetailFncVO detailfncVO = ( PlayerDetailFncVO ) fncVO_;
List<ShortNameVO> shortNameList = detailfncVO.getIssueShortNameList();
ShortNameVO shortNameVO = shortNameList.get(detailfncVO.getShortNameIdx());
shortNameList.remove(shortNameVO);
detailfncVO.setIssueShortNameList(shortNameList);
}
public boolean validateIssue(BaseFncVO fncVO_){
PlayerDetailFncVO detailfncVO = ( PlayerDetailFncVO ) fncVO_;
if(detailfncVO.getIssueShortNameList().size() > 0){
List<ShortNameVO> shortNameList = detailfncVO.getIssueShortNameList();
for(int i=0; i< shortNameList.size(); i++){
ShortNameVO shortNameVO = shortNameList.get(i);
if(shortNameVO.getIssueShortName().equals(detailfncVO.getIssueShortNameText().toUpperCase().trim())){
fncVO_.addError(BaseODSFncVO.C_INVALID_ISSUE,detailfncVO.getIssueShortNameText().toUpperCase());
return false;
}
}
}
return true;
}
private String existsInIssue( PlayerDetailFncVO playerDetailFncVO ){
//Lista valores contidos no objeto a ser inserido
List<ShortNameVO> shortNameObjList = playerDetailFncVO.getIssueShortNameList();
//Lista valores contidos na base tpl_short_name_player
TplShortNamePlayerDAO tplShortNamePlayerDAO = ODSDAOFactory.getInstance().getTplShortNamePlayerDAO();
List<ShortNameVO> shortNameDataList = tplShortNamePlayerDAO.selectByPlyrCnpj(playerDetailFncVO.getBaseTplPlayerEntity().getData().getPlyrCnpjNbr());;
//Lista valores contidos na base tpl_short_name_player_mov
TplShortNamePlayerMovDAO tplShortNamePlayerMovDAO = ODSDAOFactory.getInstance().getTplShortNamePlayerMovDAO();
List<ShortNameVO> shortNameDataMovList = tplShortNamePlayerMovDAO.selectByPlyr(null);
for(int indexObj = 0;indexObj< shortNameObjList.size();indexObj++){
ShortNameVO shortNameObjVO = shortNameObjList.get(indexObj);
//Verifica se o valor do obj se encontra na base
for(int indexData = 0;indexData< shortNameDataList.size();indexData++){
ShortNameVO shortNameDataVO = shortNameDataList.get(indexData);
if(shortNameObjVO.getIssueShortName().equals(shortNameDataVO.getIssueShortName())){
return shortNameDataVO.getIssueShortName();
}
}
//Verifica se o valor do obj se encontra na base mov
for(int indexDataMov = 0;indexDataMov< shortNameDataMovList.size();indexDataMov++){
ShortNameVO shortNameDataMovVO = shortNameDataMovList.get(indexDataMov);
if(shortNameObjVO.getIssueShortName().equals(shortNameDataMovVO.getIssueShortName())){
return shortNameDataMovVO.getIssueShortName();
}
}
}
return null;
}
} | [
"mv58799@LACBRA900W1153.lac.nsroot.net"
] | mv58799@LACBRA900W1153.lac.nsroot.net |
7fab215bf0b25b7898b03aba4922d0057df582bb | 39e074c9f61026a83701783237a4dbde047c3d0a | /src/main/java/com/tourism/datamodel/repository/UserRepository.java | 7bd336010bbe088a443bc32122727e02e993110e | [] | no_license | ganeshallampalli/tourism-service | 6770289b92efaf0571435246d65002d6461fe72f | c57f392066761a42409944da9bbc95b825da16b5 | refs/heads/master | 2021-06-19T13:31:05.892337 | 2019-07-25T08:00:14 | 2019-07-25T08:00:14 | 188,469,578 | 0 | 0 | null | 2021-03-31T21:18:50 | 2019-05-24T18:27:17 | Java | UTF-8 | Java | false | false | 435 | java | package com.tourism.datamodel.repository;
import com.tourism.datamodel.User;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends CrudRepository<User, Integer> {
@SuppressWarnings("unchecked")
User save(User user);
User findByEmailId(String emailId);
List<User> findAllByRoleId(Integer id);
}
| [
"ganeshallampalli@gmail.com"
] | ganeshallampalli@gmail.com |
0e1f50fbac8711f66d6fa42c3bcf66832311f44d | 53e1530d418dcda795cd140db4d736a65695f37b | /IdeaProjects/src/part2/chapter29/StreamDemo.java | 0715cbe60279fcca61ebf1b5285298eb6bbfcf0f | [] | no_license | Zed180881/Zed_repo | a03bac736e3c61c0bea61b2f81624c4bc604870b | 6e9499e7ec3cfa9dc11f9d7a92221522c56b5f61 | refs/heads/master | 2020-04-05T18:57:47.596468 | 2016-11-02T07:51:30 | 2016-11-02T07:51:30 | 52,864,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,508 | java | package part2.chapter29;
import java.util.ArrayList;
import java.util.Optional;
import java.util.stream.Stream;
class StreamDemo {
public static void main(String[] args) {
ArrayList<Integer> myList = new ArrayList<>();
myList.add(7);
myList.add(18);
myList.add(10);
myList.add(24);
myList.add(17);
myList.add(5);
System.out.println("Source list: " + myList);
Stream<Integer> myStream = myList.stream();
Optional<Integer> minVal = myStream.min(Integer::compare);
if (minVal.isPresent())
System.out.println("Min value: " + minVal.get());
myStream = myList.stream();
Optional<Integer> maxVal = myStream.max(Integer::compare);
if (maxVal.isPresent())
System.out.println("Max value: " + maxVal.get());
Stream<Integer> sortedStream = myList.stream().sorted();
System.out.print("Sorted Stream: ");
sortedStream.forEach(n -> System.out.print(n + " "));
System.out.println();
Stream<Integer> oddVals = myList.stream().sorted().filter(n -> (n % 2) == 1);
System.out.print("Odd values: ");
oddVals.forEach(n -> System.out.print(n + " "));
System.out.println();
oddVals = myList.stream().sorted().filter(n -> (n % 2) == 1).filter(n -> (n > 5));
System.out.print("Odd values greater than 5: ");
oddVals.forEach(n -> System.out.print(n + " "));
System.out.println();
}
}
| [
"zed180881@gmail.com"
] | zed180881@gmail.com |
4ce29a80e427ee1c08ae6ec2a9d356b06afb1f42 | b822ed0b104a2379c9f404cc69afda4bb1955f8c | /siweimapsdk/src/main/java/org/oscim/layers/tile/bitmap/BitmapTileLayer.java | e992eb5310d7fc68d27820189db74d525b1176c5 | [] | no_license | LonelyPluto/SiweidgMapSDK-V3.0.0 | a4a269a8663f770519f597430a36376f7fc4d3ef | c10514c1c29f997299f70a12b1e55e8372bf19de | refs/heads/master | 2022-12-02T19:30:02.727651 | 2020-08-13T07:51:46 | 2020-08-13T07:51:46 | 287,214,472 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,774 | java | /*
* Copyright 2013 Hannes Janetzek
* Copyright 2017 Andrey Novikov
* Copyright 2017-2018 devemux86
* Copyright 2019 Gustl22
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
* This program 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 3 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.layers.tile.bitmap;
import org.oscim.core.MapPosition;
import org.oscim.event.Event;
import org.oscim.layers.tile.TileLayer;
import org.oscim.layers.tile.TileLoader;
import org.oscim.layers.tile.TileManager;
import org.oscim.layers.tile.VectorTileRenderer;
import com.siweidg.siweimapsdk.map.SiweidgMap;
import com.siweidg.siweimapsdk.map.Viewport;
import org.oscim.renderer.bucket.TextureItem.TexturePool;
import org.oscim.tiling.TileSource;
import org.oscim.utils.FastMath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BitmapTileLayer extends TileLayer {
protected static final Logger log = LoggerFactory.getLogger(BitmapTileLayer.class);
private static final int CACHE_LIMIT = 40;
protected TileSource mTileSource;
/**
* Bitmap alpha in range 0 to 1.
*/
private float mBitmapAlpha = 1.0f;
public static class FadeStep {
public final double scaleStart, scaleEnd;
public final double zoomStart, zoomEnd;
public final float alphaStart, alphaEnd;
/**
* @param zoomStart the zoom start in range {@value Viewport#MIN_ZOOM_LEVEL} to {@value Viewport#MAX_ZOOM_LEVEL}
* @param zoomEnd the zoom end, must be greater than zoom start
* @param alphaStart the alpha start value in range 0 to 1
* @param alphaEnd the alpha end value in range 0 to 1
*/
public FadeStep(int zoomStart, int zoomEnd, float alphaStart, float alphaEnd) {
if (zoomEnd < zoomStart)
throw new IllegalArgumentException("zoomEnd must be larger than zoomStart");
this.scaleStart = 1 << zoomStart;
this.scaleEnd = 1 << zoomEnd;
this.zoomStart = zoomStart;
this.zoomEnd = zoomEnd;
this.alphaStart = alphaStart;
this.alphaEnd = alphaEnd;
}
public FadeStep(double scaleStart, double scaleEnd, float alphaStart, float alphaEnd) {
if (scaleEnd < scaleStart)
throw new IllegalArgumentException("scaleEnd must be larger than scaleStart");
this.scaleStart = scaleStart;
this.scaleEnd = scaleEnd;
this.zoomStart = Math.log(scaleStart) / Math.log(2);
this.zoomEnd = Math.log(scaleEnd) / Math.log(2);
this.alphaStart = alphaStart;
this.alphaEnd = alphaEnd;
}
}
public BitmapTileLayer(SiweidgMap map, TileSource tileSource) {
this(map, tileSource, CACHE_LIMIT);
}
public BitmapTileLayer(SiweidgMap map, TileSource tileSource, float bitmapAlpha) {
this(map, tileSource, CACHE_LIMIT, bitmapAlpha);
}
public BitmapTileLayer(SiweidgMap map, TileSource tileSource, int cacheLimit) {
this(map, tileSource, cacheLimit, tileSource.getAlpha());
}
public BitmapTileLayer(SiweidgMap map, TileSource tileSource, int cacheLimit, float bitmapAlpha) {
super(map,
new TileManager(map, cacheLimit),
new VectorTileRenderer());
mTileManager.setZoomLevel(tileSource.getZoomLevelMin(),
tileSource.getZoomLevelMax());
mTileSource = tileSource;
setBitmapAlpha(bitmapAlpha, false);
initLoader(getNumLoaders());
setFade(map.getMapPosition());
}
public void setBitmapAlpha(float bitmapAlpha, boolean redraw) {
mBitmapAlpha = FastMath.clamp(bitmapAlpha, 0f, 1f);
tileRenderer().setBitmapAlpha(mBitmapAlpha);
if (redraw)
map().updateMap(true);
}
@Override
public void onMapEvent(Event event, MapPosition pos) {
super.onMapEvent(event, pos);
if (event != SiweidgMap.POSITION_EVENT)
return;
setFade(pos);
}
private void setFade(MapPosition pos) {
FadeStep[] fade = mTileSource.getFadeSteps();
if (fade == null) {
//mRenderLayer.setBitmapAlpha(1);
return;
}
float alpha = mBitmapAlpha;
for (FadeStep f : fade) {
if (pos.scale < f.scaleStart || pos.scale > f.scaleEnd)
continue;
if (f.alphaStart == f.alphaEnd) {
alpha = f.alphaStart;
break;
}
// interpolate alpha between start and end
alpha = (float) (f.alphaStart + (pos.getZoom() - f.zoomStart) * (f.alphaEnd - f.alphaStart) / (f.zoomEnd - f.zoomStart));
break;
}
alpha = FastMath.clamp(alpha, 0f, 1f) * mBitmapAlpha;
tileRenderer().setBitmapAlpha(alpha);
}
@Override
protected TileLoader createLoader() {
return new BitmapTileLoader(this, mTileSource);
}
@Override
public void onDetach() {
super.onDetach();
if (mTileSource != null) {
mTileSource.close();
}
pool.clear();
}
static final int POOL_FILL = 20;
/**
* pool shared by TextLayers
*/
final TexturePool pool = new TexturePool(POOL_FILL) {
// int sum = 0;
//
// public TextureItem release(TextureItem item) {
// log.debug(getFill() + " " + sum + " release tex " + item.id);
// return super.release(item);
// };
//
// public synchronized TextureItem get() {
// log.debug(getFill() + " " + sum + " get tex ");
//
// return super.get();
// };
//
// protected TextureItem createItem() {
// log.debug(getFill() + " " + (sum++) + " create tex ");
//
// return super.createItem();
// };
//
// protected void freeItem(TextureItem t) {
// log.debug(getFill() + " " + (sum--) + " free tex ");
// super.freeItem(t);
//
// };
};
/**
* Sets the {@link TileSource} used by {@link TileLoader}.
*
* @return true when new TileSource was set (has changed)
*/
public boolean setTileSource(TileSource tileSource) {
pauseLoaders(true);
mTileManager.clearJobs();
if (mTileSource != null) {
mTileSource.close();
mTileSource = null;
}
TileSource.OpenResult msg = tileSource.open();
if (msg != TileSource.OpenResult.SUCCESS) {
log.debug(msg.getErrorMessage());
return false;
}
mTileSource = tileSource;
mTileManager.setZoomLevel(tileSource.getZoomLevelMin(),
tileSource.getZoomLevelMax());
for (TileLoader l : mTileLoader)
((BitmapTileLoader) l).setDataSource(tileSource.getDataSource());
mMap.clearMap();
resumeLoaders();
return true;
}
}
| [
"277857006@qq.com"
] | 277857006@qq.com |
3c589b8abad811354f8a6f94f947ca96aca7ebb8 | 635aa994ebc656d1db47bfeae7aa6fee56a12b98 | /Workout-master/app/src/main/java/com/example/calvin/workout/MapActivity.java | 19e4391bc23caeb772431646a20654fd26e1d75a | [] | no_license | FugiOP/CS4540 | b628bcff6a3a6d7e352eeff9023728a519cde136 | db58f963d461255d2fba55aa2c9258dc5a37e080 | refs/heads/master | 2021-01-01T19:18:40.119133 | 2018-09-30T03:00:07 | 2018-09-30T03:00:07 | 98,562,530 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 13,816 | java | package com.example.calvin.workout;
import android.content.ContentValues;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.location.Location;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.TextView;
import android.widget.Toast;
import com.example.calvin.workout.data.Contract;
import com.example.calvin.workout.data.DBHelper;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
/**
* Created by FugiBeast on 8/5/2017.
*/
public class MapActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
GoogleMap mMap;
ArrayList<LatLng> points;
private GoogleApiClient mGoogleApiClient;
private LocationRequest mLocationRequest;
Location oldLocation;
double distance = 0d;
double distanceCovered = 0;
private Marker mCurrLocationMarker;
private final LatLng mDefaultLocation = new LatLng(-122.084, 37.422); //Googleplex
private boolean mLocationPermissionGranted;
private boolean mRequestingLocationUpdates;
private static final long LOCATION_REQUEST_INTERVAL = 2000;
private static final long LOCATION_REQUEST_FASTEST_INTERVAL = 1000;
private CountDownTimer mCDTimer;
Chronometer myChronometer;
DecimalFormat df;
String date;
ArrayList<LatLng> routePoints;
private Polyline line;
Button startBtn;
TextView calcDist;
TextView caloriesBurnt;
double totalCalories = 0.00;
double prevCalories;
Cursor date_calorie_cursor;
private SQLiteDatabase db_date_calorie;
private DBHelper helper_date_calorie;
public static final int MY_PERMISSIONS_REQUEST_LOCATION = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
points = new ArrayList<LatLng>();
df = new DecimalFormat("0.00");
mRequestingLocationUpdates = true;
startBtn = (Button) findViewById(R.id.startBtn);
myChronometer = (Chronometer)findViewById(R.id.trackChrono);
calcDist = (TextView)findViewById(R.id.calcDistance);
calcDist.setText(".00 meters");
caloriesBurnt = (TextView)findViewById(R.id.caloriesBurnt);
caloriesBurnt.setText("Calories Burned : "+totalCalories);
oldLocation= new Location("dummy data");
helper_date_calorie = new DBHelper(this);
db_date_calorie = helper_date_calorie.getReadableDatabase();
buildGoogleApiClient();
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
initMap();
mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
centerMap();
myChronometer.setOnChronometerTickListener(
new Chronometer.OnChronometerTickListener(){
@Override
public void onChronometerTick(Chronometer chronometer) {
// TODO Auto-generated method stub
addToPolyline(oldLocation);
calcDist.setText(df.format(((distanceCovered*100.0)/100.0)*0.00062137119) + " miles");
caloriesBurnt.setText("Calories Burned: "+df.format((((distanceCovered*100.0)/100.0)*0.00062137119*0.76*200)));
updateUserCalories(db_date_calorie,(((distanceCovered*100.0)/100.0)*0.00062137119*0.76*200),date);
}
}
);
}
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addConnectionCallbacks(this)
.addApi(LocationServices.API)
.build();
mGoogleApiClient.connect();
}
@Override
public void onConnected(@Nullable Bundle bundle) {
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
}
private void createLocationRequest() {
mLocationRequest = new LocationRequest();
mLocationRequest.setSmallestDisplacement(20);
mLocationRequest.setInterval(LOCATION_REQUEST_INTERVAL);
mLocationRequest.setFastestInterval(LOCATION_REQUEST_FASTEST_INTERVAL);
mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
}
protected void startLocationUpdates() {
if (ContextCompat.checkSelfPermission(this.getApplicationContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
LocationServices.FusedLocationApi.requestLocationUpdates(
mGoogleApiClient, mLocationRequest, this);
}
}
protected void stopLocationUpdates() {
LocationServices.FusedLocationApi.removeLocationUpdates(
mGoogleApiClient, this);
}
@Override
public void onLocationChanged(Location location) {
distanceCovered = distanceCovered + oldLocation.distanceTo(location);
oldLocation = location;
centerMap();
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_LOCATION: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
initMap();
} else {
// Permission denied, Disable the functionality that depends on this permission.
Toast.makeText(this, "permission denied", Toast.LENGTH_LONG).show();
}
return;
}
// other 'case' lines to check for other permissions this app might request.
//You can add here other case statements according to your requirement.
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId()==R.id.routine){
Intent intent = new Intent(this, RoutineActivity.class);
startActivity(intent);
}
else if (item.getItemId() == R.id.music) {
Intent intent = new Intent(this, MusicActivity.class);
startActivity(intent);
}
else if (item.getItemId() == R.id.graph) {
Intent intent = new Intent(this, GraphActivity.class);
startActivity(intent);
}else if (item.getItemId() == R.id.profile) {
Intent intent = new Intent(this,UpdateProfile.class);
startActivity(intent);
}else if (item.getItemId() == R.id.calories) {
Intent intent = new Intent(this,FoodActivity.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}
private void initMap() {
if (mMap == null) {
return;
}
//Request location permission from user so we can pull location
if (ContextCompat.checkSelfPermission(this.getApplicationContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
mLocationPermissionGranted = true;
if (mRequestingLocationUpdates) {
createLocationRequest();
startLocationUpdates();
}
} else {
ActivityCompat.requestPermissions(this,
new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
1);
}
//Gets the most recent location of the device
if (mLocationPermissionGranted) {
oldLocation = LocationServices.FusedLocationApi
.getLastLocation(mGoogleApiClient);
mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
} else {
mMap.setMyLocationEnabled(false);
mMap.getUiSettings().setMyLocationButtonEnabled(false);
oldLocation = null;
}
// Set the map's camera position to the current location of the device.
// If it can't be found, defaults to GooglePlex
if (oldLocation != null) {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(oldLocation.getLatitude(),
oldLocation.getLongitude()), 15));
} else {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mDefaultLocation, 15));
mMap.getUiSettings().setMyLocationButtonEnabled(false);
}
}
//Centers the map on the device
private void centerMap() {
if (oldLocation != null) {
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(oldLocation.getLatitude(),
oldLocation.getLongitude()), 15));
}
}
@Override
protected void onPause() {
super.onPause();
stopLocationUpdates();
}
@Override
protected void onResume() {
super.onResume();
if (mGoogleApiClient.isConnected() && !mRequestingLocationUpdates) {
startLocationUpdates();
}
}
private void initPolyline() {
if (line != null) {
removePolyline();
}
PolylineOptions pLineOptions = new PolylineOptions()
.width(10)
.color(Color.BLUE);
line = mMap.addPolyline(pLineOptions);
routePoints = new ArrayList<>();
line.setPoints(routePoints);
}
//adds coordinates to the arraylist that will form the polyline
private void addToPolyline(Location location) {
routePoints.add(new LatLng(location.getLatitude(), location.getLongitude()));
line.setPoints(routePoints);
}
//clears existing polyline so there is no overlap
private void removePolyline() {
line.remove();
line = null;
}
//sorts between start and end tracking
public void trackBtn(View view) {
if(startBtn.getText().equals("Start"))
startTracking(view);
else
endTracking(view);
}
public void startTracking(View view) {
startBtn.setText("End");
initPolyline();
distanceCovered = 0;
SimpleDateFormat sdf = new SimpleDateFormat("YYYY MMM d");
Calendar calendar = Calendar.getInstance();
date = sdf.format(calendar.getTime());
prevCalories = getPrevCalories(db_date_calorie, date);
myChronometer.setBase(SystemClock.elapsedRealtime());
myChronometer.start();
}
public void endTracking(View view) {
startBtn.setText("Start");
caloriesBurnt.setText("Calories Burned: 0.00");
myChronometer.stop();
}
public int updateUserCalories(SQLiteDatabase db, double calories,String date){
ContentValues cv = new ContentValues();
cv.put(Contract.TABLE_USER_CALORIES.COLUMN_NAME_DATE, date);
cv.put(Contract.TABLE_USER_CALORIES.COLUMN_NAME_CALORIES,calories+prevCalories);
return db.update(Contract.TABLE_USER_CALORIES.TABLE_NAME, cv,Contract.TABLE_USER_CALORIES.COLUMN_NAME_DATE + "='"+date+"'", null);
}
private double getPrevCalories(SQLiteDatabase db,String date){
double result = 0;
Cursor cursor = db.query(
Contract.TABLE_USER_CALORIES.TABLE_NAME,
null,
Contract.TABLE_USER_CALORIES.COLUMN_NAME_DATE+"='"+date+"'",
null,
null,
null,
null
);
cursor.moveToFirst();
result = cursor.getDouble(cursor.getColumnIndex(Contract.TABLE_USER_CALORIES.COLUMN_NAME_CALORIES));
return result;
}
} | [
"ray55_king@yahoo.com"
] | ray55_king@yahoo.com |
f1704a7bfbcac77da025d4d44160af354b6b46c6 | 62d079c0cda5a5eec28aa9f39d1305aa6fac22cc | /soa-parent/soa-trade/soa-trade-api/src/main/java/com/soa/trade/facade/TradeFacade.java | 1781a6d0bc0be2722ecd26af638c0557a91b9d95 | [] | no_license | liyinyong/dubbo | 735118b8b98dccde259bc8b19650ba4c6c3d7696 | 3542b26202398d60435085615018e9e043be4e87 | refs/heads/master | 2020-05-07T21:37:53.535640 | 2019-04-12T02:20:22 | 2019-04-12T02:20:22 | 180,912,182 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java |
package com.soa.trade.facade;
import com.soa.trade.domain.Trade;
public interface TradeFacade {
public void createTrade(Trade obj);
}
| [
"0027010065@iwhalecloud.com"
] | 0027010065@iwhalecloud.com |
15f8ef73c1c8f904e3cd82d0366fc28cf35a95a7 | 9732150d3dedfc9a580046d80bf852fbb7175804 | /app/src/main/java/org/wikipedia/search/RelatedPagesSearchClient.java | b491762a937bd5202d4e02b2170ab30718045ad7 | [
"Apache-2.0"
] | permissive | lytellis/test | ea61fd6fb38215725163733657b16ed804b60667 | 8240be244d1bc98a3766d9f5498599eedd166fb0 | refs/heads/master | 2020-04-12T11:41:41.644842 | 2018-12-19T17:24:29 | 2018-12-19T17:24:29 | 162,467,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,031 | java | package org.wikipedia.search;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import org.wikipedia.dataclient.Service;
import org.wikipedia.dataclient.ServiceFactory;
import org.wikipedia.dataclient.WikiSite;
import org.wikipedia.dataclient.restbase.RbRelatedPages;
import org.wikipedia.dataclient.restbase.page.RbPageSummary;
import java.io.IOException;
import java.util.List;
import retrofit2.Call;
import retrofit2.Response;
public class RelatedPagesSearchClient {
public interface Callback {
void success(@NonNull Call<RbRelatedPages> call, @Nullable List<RbPageSummary> results);
void failure(@NonNull Call<RbRelatedPages> call, @NonNull Throwable caught);
}
public Call<RbRelatedPages> request(@NonNull String title, @NonNull WikiSite wiki, int limit, @NonNull Callback cb) {
return request(ServiceFactory.get(wiki), title, limit, cb);
}
@VisibleForTesting
Call<RbRelatedPages> request(@NonNull Service service, @NonNull String title, int limit, @NonNull Callback cb) {
Call<RbRelatedPages> call = service.getRelatedPages(title);
call.enqueue(new retrofit2.Callback<RbRelatedPages>() {
@Override public void onResponse(@NonNull Call<RbRelatedPages> call,
@NonNull Response<RbRelatedPages> response) {
if (response.body() != null && response.body().getPages() != null) {
// noinspection ConstantConditions
cb.success(call, limit < 0 ? response.body().getPages() : response.body().getPages(limit));
} else {
cb.failure(call, new IOException("An unknown error occurred."));
}
}
@Override
public void onFailure(@NonNull Call<RbRelatedPages> call, @NonNull Throwable t) {
cb.failure(call, t);
}
});
return call;
}
}
| [
"925946022@qq.com"
] | 925946022@qq.com |
891aae968321728f9d3586fd4b4a75b869cb62c6 | c557833ee5de95b7cb34b0c32739e52257beb922 | /src/main/java/com/huangning/java/spark/Day01java.java | a7458da833889e762ba8345bcc5393df66cd1a9b | [] | no_license | HuangNing616/neo_spark | 431b0ac857f61bb21224a58e344d68fbc69bab93 | af35349426a0de3c81cb582b9676494e6cec5fd6 | refs/heads/master | 2023-07-28T17:59:00.775841 | 2021-09-12T07:21:21 | 2021-09-12T07:21:21 | 338,257,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,510 | java | package com.huangning.java.spark;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.*;
import scala.Tuple2;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* 1. java 里面没有sortBy算子,只有sortByKey
* 2. JavaPairRDD<String, String> 叫k,v格式的rdd, 而JavaRDD<Tuple2<String, String>>只叫做tuple类型的rdd
* 3. transformation 算子中的sample中的fraction只代表大约的数量,即百分之10左右的数据
* 但是如果输入大于1的数,比如5:那么就会抽出当前样本量5倍的数据,但是scala中只代表抽出5条数据
*/
public class Day01java {
public static void main(String[] args) {
SparkConf conf = new SparkConf();
conf.setAppName("test");
conf.setMaster("local");
JavaSparkContext sc = new JavaSparkContext(conf);
JavaRDD<String> lines = sc.textFile("./data/words");
sc.setLogLevel("Error");
JavaRDD<String> sample = lines.sample(true, 0.1, 100L);
sample.foreach(new VoidFunction<String>() {
@Override
public void call(String s) throws Exception {
System.out.println(s);
}
});
// // return the first five item of the data
// List<String> take = lines.take(4);
// System.out.println(take);
// // return the first item of the data
// String first = lines.first();
// System.out.println(first);
// // count 算子
// long count = lines.count();
// System.out.println(count);
// // collect 算子
// List<String> collect = lines.collect();
// for(String one: collect){
// System.out.println(one);
// }
// // 按照提示来传递function, s.split(" ")是一个字符串数组,Arrays.asList是将String数组转成了一个list,
// // 然后可以通过List的iterator方法将其转换成Iterator
// JavaPairRDD<String, Integer> reduceRDD = lines.flatMap(new FlatMapFunction<String, String>() {
// @Override
// public Iterator<String> call(String s) throws Exception {
// List<String> list = Arrays.asList(s.split(" "));
// System.out.println("****" + list.iterator() + "****");
// return list.iterator();
// }
// }).mapToPair(new PairFunction<String, String, Integer>() {
//
// @Override
// public Tuple2<String, Integer> call(String s) throws Exception {
// return new Tuple2<>(s, 1);
// }
// }).reduceByKey(new Function2<Integer, Integer, Integer>() {
// @Override
// public Integer call(Integer v1, Integer v2) throws Exception {
// return v1 + v2;
// }
// });
//
// // 想要转出一对一格式的数据,并且转出来的还得是tuple类型
// reduceRDD.mapToPair(new PairFunction<Tuple2<String, Integer>, Integer, String>() {
// @Override
// public Tuple2<Integer, String> call(Tuple2<String, Integer> t2) throws Exception {
// return t2.swap();
// }
// }).sortByKey(false).mapToPair(new PairFunction<Tuple2<Integer, String>, String, Integer>() {
// @Override
// public Tuple2<String, Integer> call(Tuple2<Integer, String> t3) throws Exception {
// return t3.swap();
// }
// }).foreach(new VoidFunction<Tuple2<String, Integer>>() {
// @Override
// public void call(Tuple2<String, Integer> t4) throws Exception {
// System.out.println(t4);
// }
// });
// // 转成k,v格式的时候用mapToPair,不转成k,v格式的时候用map
// JavaPairRDD<String, String> stringStringJavaPairRDD = lines.mapToPair(new PairFunction<String, String, String>() {
// @Override
// public Tuple2<String, String> call(String s) throws Exception {
// return new Tuple2<String, String>(s, s + "#");
// }
// });
//
// JavaRDD<Tuple2<String, String>> map = lines.map(new Function<String, Tuple2<String, String>>() {
// @Override
// public Tuple2<String, String> call(String line) throws Exception {
// return new Tuple2<>(line, line + "*");
// }
// });
// map.foreach(new VoidFunction<String>() {
// @Override
// public void call(String s) throws Exception {
// System.out.println(s);
// }
// });
// // String 表示进来的当前行数据,boolean表示返回的值类型
// JavaRDD<String> result = lines.filter(new Function<String, Boolean>() {
// @Override
// public Boolean call(String s) throws Exception {
//
// return "hello spark".equals(s);
// }
// });
//
// long count = result.count();
// System.out.println(count);
// result.foreach(new VoidFunction<String>() {
// @Override
// public void call(String s) throws Exception {
// System.out.println(s);
// }
// });
// stop and close have the same meaning
// sc.close();
sc.stop();
}
}
| [
"huangning@123.com"
] | huangning@123.com |
7465c15be61eb4c7e08ccf6938f7d7e521d09168 | bcc8f7ae9fa638cc3a154544bad1dafcd67de548 | /src/com/richitec/donkey/conference/message/ActorMessage.java | 48583dfbab2b638ff06fa9dffc86350ba0bd9ae7 | [] | no_license | imeeting/donkey | e0cf4bc311194e7513a62c5786d27cfcffe34c15 | a983d9d141155d31f0855c29a3313c8be8a3a78c | refs/heads/master | 2021-01-23T09:52:41.526000 | 2012-11-30T08:48:37 | 2012-11-30T08:48:37 | 4,922,695 | 0 | 1 | null | 2012-11-30T08:48:32 | 2012-07-06T09:55:35 | JavaScript | UTF-8 | Java | false | false | 7,820 | java | package com.richitec.donkey.conference.message;
import java.io.IOException;
import javax.servlet.sip.SipApplicationSession;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.SipServletResponse;
import javax.servlet.sip.SipSession;
import com.richitec.donkey.conference.actor.AttendeeActor;
import com.richitec.donkey.conference.actor.ConferenceActor;
public class ActorMessage {
public static CmdDestroyConference destroyConference = new CmdDestroyConference();
public static EvtConferenceCreateSuccess createConferenceSuccess = new EvtConferenceCreateSuccess();
public static EvtConferenceCreateError createConferenceError = new EvtConferenceCreateError();
public static EvtControlChannelTerminated controlChannelTerminated = new EvtControlChannelTerminated();
public static EvtControlChannelExpired controlChannelExpired = new EvtControlChannelExpired();
public static class CmdCreateConference {
private String deleteWhen;
public CmdCreateConference(String deleteWhen) {
this.deleteWhen = deleteWhen;
}
public String getDeleteWhen(){
return this.deleteWhen;
}
}
public static class CmdDestroyConference {
public String getMethod(){
return "destroy";
}
}
private static class CmdMessage {
private String sipUri;
private String method;
public CmdMessage(String method, String sipUri) {
this.method = method;
this.sipUri = sipUri;
}
public String getSipUri(){
return this.sipUri;
}
public String getMethod(){
return this.method;
}
}
public static class CmdJoinConference extends CmdMessage {
public CmdJoinConference(String method, String sipUri) {
super(method, sipUri);
}
}
public static class CmdUnjoinConference extends CmdMessage {
public CmdUnjoinConference(String method, String sipUri) {
super(method, sipUri);
}
}
public static class CmdMuteAttendee extends CmdMessage{
private String conn;
public CmdMuteAttendee(String sipUri) {
super("mute", sipUri);
}
public void setConn(String conn){
this.conn = conn;
}
public String getConn(){
return this.conn;
}
}
public static class CmdUnmuteAttendee extends CmdMessage {
private String conn;
public CmdUnmuteAttendee(String sipUri) {
super("unmute", sipUri);
}
public void setConn(String conn){
this.conn = conn;
}
public String getConn(){
return this.conn;
}
}
public static class EvtAttendeeCallInConference {
private SipApplicationSession sipAppSession;
private SipSession userSession;
private SipSession mediaServerSession;
private String sipUri;
private String conn;
public EvtAttendeeCallInConference(SipApplicationSession sipAppSession,
SipSession userSession, SipSession mediaServerSession,
String sipUri, String conn){
this.sipAppSession = sipAppSession;
this.userSession = userSession;
this.mediaServerSession = mediaServerSession;
this.sipUri = sipUri;
this.conn = conn;
}
public SipApplicationSession getSipAppSession(){
return this.sipAppSession;
}
public SipSession getUserSession() {
return this.userSession;
}
public SipSession getMediaServerSession() {
return this.mediaServerSession;
}
public String getSipUri(){
return this.sipUri;
}
public String getConn(){
return this.conn;
}
public void bye(){
SipServletRequest byeMediaServer = mediaServerSession.createRequest("BYE");
try {
byeMediaServer.send();
} catch (IOException e) {
e.printStackTrace();
}
SipServletRequest byeAttendee = userSession.createRequest("BYE");
try {
byeAttendee.send();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 如果电话呼入会议时,该会议的状态不是Created,则向AttendeeActor发送该消息。
*/
public static class ErrConferenceStatusConflict {
private ConferenceActor.State state;
public ErrConferenceStatusConflict(ConferenceActor.State state){
this.state = state;
}
public String getState(){
return this.state.name();
}
}
public static class ErrAttendeeStatusConflict {
private AttendeeActor.AttendeeState state;
private String sipUri;
private String method;
public ErrAttendeeStatusConflict(String method, String sipUri, AttendeeActor.AttendeeState state){
this.method = method;
this.sipUri = sipUri;
this.state = state;
}
public String getMethod() {
return this.method;
}
public String getSipUri() {
return this.sipUri;
}
public String getState(){
return this.state.name();
}
}
/**
*
* Control Channel Messages
*/
public static class CreateControlChannelComplete {
private int status;
public CreateControlChannelComplete(int status) {
this.status = status;
}
public int getStatus(){
return this.status;
}
}
public static class EvtConferenceCreateSuccess {
}
public static class EvtConferenceCreateError {
}
public static class ControlChannelInfoRequest {
private SipServletRequest request;
public ControlChannelInfoRequest(SipServletRequest request) {
this.request = request;
}
public SipServletRequest getRequest(){
return this.request;
}
}
public static class ControlChannelInfoResponse {
private SipServletResponse response;
public ControlChannelInfoResponse(SipServletResponse response) {
this.response = response;
}
public SipServletResponse getResponse(){
return this.response;
}
}
public static class EvtControlChannelTerminated {
}
public static class EvtControlChannelExpired {
}
/**
* B2BUASipServlet related
*
* @author huuguanghui
*
*/
private static class SipResponse {
private SipServletResponse response;
public SipResponse(SipServletResponse response){
this.response = response;
}
public SipServletResponse getResponse(){
return this.response;
}
}
public static class SipProvisionalResponse extends SipResponse {
public SipProvisionalResponse(SipServletResponse response) {
super(response);
}
}
public static class SipSuccessResponse extends SipResponse {
public SipSuccessResponse(SipServletResponse response) {
super(response);
}
}
public static class SipErrorResponse extends SipResponse {
public SipErrorResponse(SipServletResponse response) {
super(response);
}
}
public static class SipByeRequest {
private SipSession session;
public SipByeRequest(SipSession session){
this.session = session;
}
public SipSession getSipSession(){
return this.session;
}
}
public static class EvtAttendeeCallEstablished {
private String conn;
private String sipUri;
public EvtAttendeeCallEstablished(String sipUri, String conn) {
this.sipUri = sipUri;
this.conn = conn;
}
public String getConn(){
return this.conn;
}
public String getSipUri() {
return this.sipUri;
}
}
public static class EvtAttendeeCallFailed {
private int status;
private String sipUri;
public EvtAttendeeCallFailed(String sipUri, int status) {
this.sipUri = sipUri;
this.status = status;
}
public int getStatus(){
return this.status;
}
public String getSipUri(){
return this.sipUri;
}
}
public static class EvtAttendeeCallTerminated {
private String sipUri;
public EvtAttendeeCallTerminated(String sipUri) {
this.sipUri = sipUri;
}
public String getSipUri(){
return this.sipUri;
}
}
public static class EvtMediaServerCallFailed extends EvtAttendeeCallFailed {
public EvtMediaServerCallFailed(String sipUri, int status) {
super(sipUri, status);
}
}
public static class SipSessionReadyToInvalidate {
private SipSession session;
public SipSessionReadyToInvalidate(SipSession session){
this.session = session;
}
public SipSession getSipSession(){
return this.session;
}
}
}
| [
"huuguanghui@hotmail.com"
] | huuguanghui@hotmail.com |
535d4cd92f7a6461dfb8287229ecb81606030b7b | 472d7820a5f5d9d5ab2ec150eab0c9bdeb2008c7 | /Protege-2000/source/Protege-2000/src/edu/stanford/smi/protege/util/ComponentUtilities.java | 760d76b410921f96ea8b8e7ea9bd2452ceaa868e | [] | no_license | slacker247/GPDA | 1ad5ebe0bea4528d9a3472d3c34580648ffb670e | fa9006d0877a691f1ddffe88799c844a3e8a669a | refs/heads/master | 2022-10-08T07:39:09.786313 | 2020-06-10T22:22:58 | 2020-06-10T22:22:58 | 105,063,261 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,013 | java | /*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The Original Code is Protege-2000.
*
* The Initial Developer of the Original Code is Stanford University. Portions
* created by Stanford University are Copyright (C) 2001. All Rights Reserved.
*
* Protege-2000 was developed by Stanford Medical Informatics
* (http://www.smi.stanford.edu) at the Stanford University School of Medicine
* with support from the National Library of Medicine, the National Science
* Foundation, and the Defense Advanced Research Projects Agency. Current
* information about Protege can be obtained at http://protege.stanford.edu
*
* Contributor(s):
*/
package edu.stanford.smi.protege.util;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.tree.*;
/**
* Description of the class
*
* @author Ray Fergerson <fergerson@smi.stanford.edu>
*/
public class ComponentUtilities {
private static final int BORDER_SIZE = 50;
private static final int STANDARD_ROW_HEIGHT = 60;
private static final int STANDARD_COLUMN_WIDTH = 125;
private static Collection _openWindows = new ArrayList();
public static void addColumn(JTable table, TableCellRenderer renderer) {
addColumn(table, renderer, null);
}
public static void addColumn(JTable table, TableCellRenderer renderer, TableCellEditor editor) {
int nColumns = table.getColumnCount();
TableColumn column = new TableColumn(nColumns);
column.setCellRenderer(renderer);
column.setCellEditor(editor);
table.addColumn(column);
}
public static int addListValue(JList list, Object newValue) {
return getModel(list).addValue(newValue);
}
public static void addListValue(JList list, Object newValue, int index) {
getModel(list).addValue(newValue, index);
}
public static int addListValue(JList list, Object newValue, Comparator comparator) {
int index = getPositionIndex(list, newValue, comparator);
addListValue(list, newValue, index);
return index;
}
public static void addListValues(JList list, Collection newValues) {
if (!newValues.isEmpty()) {
getModel(list).addValues(newValues);
}
}
public static int addSelectedListValue(JList list, Object newValue) {
int index = getModel(list).addValue(newValue);
list.setSelectedIndex(index);
return index;
}
public static void addSelectedListValues(JList list, Collection newValues) {
if (!newValues.isEmpty()) {
int index = getModel(list).addValues(newValues);
list.setSelectionInterval(index, index + newValues.size() - 1);
}
}
public static void addUniqueListValues(JList list, Collection newValues) {
Collection uniqueValues = new HashSet(newValues);
uniqueValues.removeAll(getModel(list).getValues());
addListValues(list, uniqueValues);
}
public static void apply(Component component, UnaryFunction f) {
f.apply(component);
applyToDescendents(component, f);
}
public static void applyToDescendents(Component component, UnaryFunction f) {
if (component instanceof Container) {
Container container = (Container) component;
int count = container.getComponentCount();
for (int i = 0; i < count; ++i) {
Component subComponent = container.getComponent(i);
apply(subComponent, f);
}
}
}
public static void center(Component c) {
Dimension screenSize = c.getToolkit().getScreenSize();
screenSize.width -= BORDER_SIZE;
screenSize.height -= BORDER_SIZE;
Dimension componentSize = c.getSize();
int xPos = (screenSize.width - componentSize.width) / 2;
xPos = Math.max(xPos, 0);
int yPos = (screenSize.height - componentSize.height) / 2;
yPos = Math.max(yPos, 0);
c.setLocation(new Point(xPos, yPos));
}
public static void clearListValues(JList list) {
getModel(list).clear();
}
private static void clearSelectionIfNecessary(JList list, int count) {
// Workaround for swing bug. Removing all elements from a list does not cause a selection event
// to get fired. setSelectedIndex(-1) also does not cause an event to fire. Thus we clear the
// selection manually if the result of the remove is that the list will be empty
if (list.getModel().getSize() == count) {
list.clearSelection();
}
}
public static void closeAllWindows() {
Iterator i = new ArrayList(_openWindows).iterator();
while (i.hasNext()) {
Window w = (Window) i.next();
closeWindow(w);
}
}
public static void closeWindow(Window window) {
window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
}
public static void deregisterWindow(Window window) {
_openWindows.remove(window);
}
private static void disassemble(Component component) {
if (component instanceof Container) {
Container container = (Container) component;
int nSubcomponents = container.getComponentCount();
for (int i = 0; i < nSubcomponents; ++i) {
disassemble(container.getComponent(i));
}
container.removeAll();
}
}
public static void dispose(Component component) {
component.setVisible(false);
UnaryFunction dispose = new UnaryFunction() {
public Object apply(Object o) {
if (o instanceof Disposable) {
((Disposable) o).dispose();
// Log.enter("ComponentUtilities.dispose", o.getClass().getName());
}
return Boolean.TRUE;
}
};
apply(component, dispose);
disassemble(component);
}
public static void ensureSelectionIsVisible(final JList list) {
/*
* SwingUtilities.invokeLater(new Runnable() {
* public void run() {
* int selection = list.getSelectedIndex();
* list.ensureIndexIsVisible(selection);
* }
* });
*/
}
public static void extendSelection(JTree tree, Object userObject) {
LazyTreeNode selectedNode = (LazyTreeNode) tree.getLastSelectedPathComponent();
int index = selectedNode.getUserObjectIndex(userObject);
TreeNode node = selectedNode.getChildAt(index);
setSelectedNode(tree, node);
}
private static int fullExpand(JTree tree, TreePath parentPath, int nExpansions) {
TreeNode parent = (TreeNode) parentPath.getLastPathComponent();
int count = parent.getChildCount();
for (int i = 0; i < count && nExpansions > 0; ++i) {
TreeNode child = parent.getChildAt(i);
TreePath childPath = parentPath.pathByAddingChild(child);
nExpansions = fullExpand(tree, childPath, nExpansions);
}
tree.expandPath(parentPath);
return --nExpansions;
}
public static void fullSelectionCollapse(JTree tree) {
int startRow = tree.getLeadSelectionRow();
int stopRow = getStopRow(tree, startRow);
for (int i = stopRow - 1; i >= startRow; --i) {
tree.collapseRow(i);
}
}
public static void fullSelectionExpand(JTree tree, int max_expansions) {
TreePath topPath = tree.getLeadSelectionPath();
fullExpand(tree, topPath, max_expansions);
}
public static LazyTreeNode getChildNode(LazyTreeNode node, Object userObject) {
LazyTreeNode childNode = null;
int nChildren = node.getChildCount();
for (int i = 0; i < nChildren; ++i) {
childNode = (LazyTreeNode) node.getChildAt(i);
if (childNode.getUserObject() == userObject) {
break;
}
}
return childNode;
}
public static Component getDescendentOfClass(Class componentClass, Component root) {
Collection c = getDescendentsOfClass(componentClass, root);
Assert.assertTrue("max 1 descendent", c.size() == 0 || c.size() == 1);
return (Component) CollectionUtilities.getFirstItem(c);
}
public static Collection getDescendentsOfClass(final Class componentClass, Component root) {
final Collection results = new ArrayList();
UnaryFunction f = new UnaryFunction() {
public Object result = null;
public Object apply(Object o) {
if (componentClass.isInstance(o)) {
results.add(o);
}
return null;
}
};
apply(root, f);
return results;
}
public static Dialog getDialog(Component c) {
return (Dialog) SwingUtilities.windowForComponent(c);
}
public static Object getFirstSelectionParent(JTree tree) {
Object parent;
LazyTreeNode node = (LazyTreeNode) tree.getLastSelectedPathComponent();
if (node == null) {
parent = null;
} else {
LazyTreeNode parentNode = node.getLazyTreeNodeParent();
if (parentNode instanceof LazyTreeRoot) {
parent = null;
} else {
parent = parentNode.getUserObject();
}
}
return parent;
}
public static Frame getFrame(Component c) {
Frame frame;
if (c instanceof Frame) {
frame = (Frame) c;
} else {
frame = (Frame) SwingUtilities.windowForComponent(c);
}
return frame;
}
public static Collection getListValues(JList list) {
return getModel(list).getValues();
}
private static SimpleListModel getModel(JList list) {
ListModel model = list.getModel();
if (!(model instanceof SimpleListModel)) {
model = new SimpleListModel();
list.setModel(model);
}
return (SimpleListModel) model;
}
private static int getPositionIndex(JList list, Object value, Comparator comparator) {
int index = Collections.binarySearch(getModel(list).getValues(), value, comparator);
if (index < 0) {
index = -(index + 1);
}
return index;
}
public static Object getSelectedValue(JList list) {
return CollectionUtilities.getFirstItem(getSelection(list));
}
public static Collection getSelection(JList list) {
return Arrays.asList(list.getSelectedValues());
}
public static Collection getSelection(JTable table) {
TableModel model = table.getModel();
int[] indices = table.getSelectedRows();
Collection selection = new ArrayList();
for (int i = 0; i < indices.length; ++i) {
selection.add(model.getValueAt(indices[i], 0));
}
return selection;
}
public static Collection getSelection(JTree tree) {
return getSelection(tree, Object.class);
}
public static Collection getSelection(JTree tree, Class c) {
Assert.assertNotNull("tree", tree);
Collection selections = new HashSet();
TreePath[] paths = tree.getSelectionModel().getSelectionPaths();
if (paths != null) {
for (int i = 0; i < paths.length; ++i) {
Object o = paths[i].getLastPathComponent();
if (o instanceof LazyTreeNode) {
o = ((LazyTreeNode) o).getUserObject();
}
if (c == null || c.isInstance(o)) {
selections.add(o);
}
}
}
return selections;
}
public static int getStandardColumnWidth() {
return STANDARD_COLUMN_WIDTH;
}
public static int getStandardRowHeight() {
return STANDARD_ROW_HEIGHT;
}
private static int getStopRow(JTree tree, int startRow) {
int startDepth = tree.getPathForRow(startRow).getPathCount();
int last = tree.getRowCount();
int stopRow = last;
for (int i = startRow + 1; i < last; ++i) {
int depth = tree.getPathForRow(i).getPathCount();
if (depth <= startDepth) {
stopRow = i;
break;
}
}
return stopRow;
}
public static TreePath getTreePath(JTree tree, Collection objectPath) {
List nodePath = new LinkedList();
LazyTreeNode node = (LazyTreeNode) tree.getModel().getRoot();
nodePath.add(node);
Iterator i = objectPath.iterator();
while (i.hasNext()) {
Object userObject = i.next();
node = getChildNode(node, userObject);
if (node == null) {
Log.warning("no node for " + userObject, ComponentUtilities.class, "getTreePath", objectPath);
break;
}
nodePath.add(node);
}
return new TreePath(nodePath.toArray());
}
public static void hide(final Component c, final int delayInMillisec) {
Thread t = new Thread() {
public void run() {
try {
sleep(delayInMillisec);
Component topComponent = SwingUtilities.getRoot(c);
topComponent.setVisible(false);
} catch (Exception e) {
e.printStackTrace();
}
}
};
t.start();
}
public static boolean isDragAndDropEnabled(JComponent c) {
Object o = c.getClientProperty(ComponentUtilities.class);
return (o == null) ? true : ((Boolean) o).booleanValue();
}
public static boolean listValuesContain(JList list, Object value) {
return getModel(list).contains(value);
}
public static ImageIcon loadImageIcon(Class cls, String name) {
ImageIcon icon = null;
URL url = cls.getResource(name);
if (url != null) {
icon = new ImageIcon(url);
if (icon.getIconWidth() == -1) {
Log.error("failed to load", SystemUtilities.class, "loadImageIcon", cls, name);
}
}
return icon;
}
// HACK: work around JDK1.2 swing layout bug by calling pack twice.
public static void pack(Component c) {
Window window = getFrame(c);
window.pack();
window.pack();
}
public static void paintImmediately(Component component) {
Graphics g = component.getGraphics();
component.paint(g);
g.dispose();
}
public static void pressButton(Component c, final Icon icon) {
Iterator i = getDescendentsOfClass(JButton.class, c).iterator();
while (i.hasNext()) {
JButton button = (JButton) i.next();
if (button.getIcon() == icon) {
button.doClick();
// Log.trace("doClick", ComponentUtilities.class, "pressButton", c, icon);
}
}
}
public static void registerWindow(Window window) {
_openWindows.add(window);
}
public static void removeListValue(JList list, Object oldValue) {
clearSelectionIfNecessary(list, 1);
int selectedIndex = list.getSelectedIndex();
int index = getModel(list).removeValue(oldValue);
if (selectedIndex == index) {
setSelectedIndex(list, index);
}
}
public static void removeListValues(JList list, Collection values) {
clearSelectionIfNecessary(list, values.size());
int selectedIndex = list.getSelectedIndex();
int index = getModel(list).removeValues(values);
if (selectedIndex == index) {
setSelectedIndex(list, index);
}
}
public static void removeSelection(JTree tree) {
LazyTreeNode selectedNode = (LazyTreeNode) tree.getLastSelectedPathComponent();
LazyTreeNode parentNode = selectedNode.getLazyTreeNodeParent();
int index = parentNode.getUserObjectIndex(selectedNode.getUserObject());
int nChildren = parentNode.getChildCount();
TreeNode newSelection;
if (index == nChildren - 1) {
if (nChildren == 1) {
newSelection = parentNode;
} else {
newSelection = parentNode.getChildAt(index - 1);
}
} else {
newSelection = parentNode.getChildAt(index + 1);
}
setSelectedNode(tree, newSelection);
}
public static void replaceListValue(JList list, Object oldValue, Object newValue) {
SimpleListModel model = getModel(list);
int index = model.indexOf(oldValue);
model.setValue(index, newValue);
}
public static void reposition(JList list, Object value, Comparator comparator) {
int oldSelectionIndex = list.getSelectedIndex();
SimpleListModel model = getModel(list);
int fromIndex = model.indexOf(value);
model.removeValue(value);
int toIndex = getPositionIndex(list, value, comparator);
getModel(list).addValue(value, toIndex);
if (oldSelectionIndex != -1) {
int newSelectionIndex = oldSelectionIndex;
if (fromIndex == oldSelectionIndex) {
newSelectionIndex = toIndex;
} else if (fromIndex < oldSelectionIndex && toIndex > oldSelectionIndex) {
--newSelectionIndex;
} else if (fromIndex > oldSelectionIndex && toIndex < oldSelectionIndex) {
++newSelectionIndex;
}
list.setSelectedIndex(newSelectionIndex);
list.ensureIndexIsVisible(newSelectionIndex);
}
}
public static void setDragAndDropEnabled(JComponent c, boolean enable) {
c.putClientProperty(ComponentUtilities.class, new Boolean(enable));
}
public static void setEnabled(Component component, final boolean enabled) {
apply(component,
new UnaryFunction() {
public Object apply(Object o) {
((Component) o).setEnabled(enabled);
return null;
}
}
);
}
public static void setExpanded(JTree tree, Collection objectPath, boolean expand) {
TreePath path = getTreePath(tree, objectPath);
if (expand) {
tree.scrollPathToVisible(path);
tree.expandPath(path);
} else {
tree.collapsePath(path);
}
}
public static void setFrameTitle(Component c, String title) {
getFrame(c).setTitle(title);
}
public static void setListValues(JList list, Collection values) {
getModel(list).setValues(values);
}
private static void setSelectedIndex(JList list, int index) {
int nElements = list.getModel().getSize();
index = Math.min(index, nElements - 1);
list.setSelectedIndex(index);
}
public static void setSelectedNode(JTree tree, TreeNode node) {
final TreePath path = new TreePath(((LazyTreeModel) tree.getModel()).getPathToRoot(node));
tree.scrollPathToVisible(path);
tree.setSelectionPath(path);
}
public static void setSelectedObjectPath(JTree tree, Collection objectPath) {
TreePath path = getTreePath(tree, objectPath);
tree.scrollPathToVisible(path);
tree.setSelectionPath(path);
}
}
| [
"jeffmac710@gmail.com"
] | jeffmac710@gmail.com |
ffecf1810113b4235b5cad3493194061880f6783 | 73346e3bbc1da866a4eb67968fa5bc49938a4d2b | /cacapalavra/src/test/java/br/com/ifsp/cacapalavra/modelo/ArquivoTest.java | aa2480f98f8e5db00465dc9f350fd1a4281958ed | [] | no_license | allima/isfpcacapalavra | 6012fe63c0159ddf9bda2fa75fec2123e2064963 | fadf983734e6f67d678837b59f05160ad6bca9d0 | refs/heads/master | 2021-01-17T15:17:23.199637 | 2015-02-13T19:32:07 | 2015-02-13T19:32:16 | 30,661,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package br.com.ifsp.cacapalavra.modelo;
import org.junit.Test;
public class ArquivoTest {
@Test
public void test() {
//fail("Not yet implemented");
}
}
| [
"allima1991@gmail.com"
] | allima1991@gmail.com |
2e010d30d9fd3495e6059daae196fa3591052769 | 232cd9491237f5d9ef6e0274898bdb906ae44c7f | /Velopatrol/app/src/main/java/ua/in/velopatrol/velopatrol/entities/UserPhotos.java | b3d9dfa6e102176950774ecd7a6b1fe77a3c9e7a | [] | no_license | avtehnik/velopatrol-app | 160432d5d914743e856ee7ccfb0f7c67d165a136 | f52314a5df06c85e767fc0638c25528030dbf0c6 | refs/heads/master | 2016-09-02T00:24:41.671386 | 2015-08-09T16:25:27 | 2015-08-09T16:25:27 | 40,442,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java | package ua.in.velopatrol.velopatrol.entities;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* Created by Anton on 1/31/2015.
*/
public class UserPhotos {
@JsonProperty("profile_thumb")
private String profileThumb;
@JsonProperty("profile_small_thumb")
private String profileSmallThumb;
@JsonProperty("profile_chat_thumb")
private String profileChatThumb;
public UserPhotos() {
}
public UserPhotos(String profileThumb, String profileSmallThumb, String profileChatThumb) {
this.profileThumb = profileThumb;
this.profileSmallThumb = profileSmallThumb;
this.profileChatThumb = profileChatThumb;
}
@Override
public String toString() {
return "UserPhotos{" +
"profileThumb='" + profileThumb + '\'' +
", profileSmallThumb='" + profileSmallThumb + '\'' +
", profileChatThumb='" + profileChatThumb + '\'' +
'}';
}
public String getProfileThumb() {
return profileThumb;
}
public void setProfileThumb(String profileThumb) {
this.profileThumb = profileThumb;
}
public String getProfileSmallThumb() {
return profileSmallThumb;
}
public void setProfileSmallThumb(String profileSmallThumb) {
this.profileSmallThumb = profileSmallThumb;
}
public String getProfileChatThumb() {
return profileChatThumb;
}
public void setProfileChatThumb(String profileChatThumb) {
this.profileChatThumb = profileChatThumb;
}
}
| [
"fenixhomepro@gmail.com"
] | fenixhomepro@gmail.com |
38a40b82b5c78b5db4485f7bc0047a6cf6ac4480 | 977d55bf914e439ffcc88b5974fc1c484eea0e66 | /src/test/java/TestBusStop.java | e1373eee04573235b380434990e423b739e625c9 | [] | no_license | philm1873/Week06_Day02_Bus_Lab | 73efc58aca92011997110e304ea665e32565317c | bfe9caf631c403e8d9169c829a2ace2185eef118 | refs/heads/master | 2021-08-23T15:51:18.437177 | 2017-12-05T14:11:03 | 2017-12-05T14:11:03 | 113,190,539 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 605 | java | import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TestBusStop {
Bus testBus;
Person dave;
BusStop lothianRoad;
@Before
public void before(){
testBus = new Bus("Stockbridge");
dave = new Person("Dave");
lothianRoad = new BusStop("Lothian Road");
}
@Test
public void queueStartsEmpty(){
assertEquals(0, lothianRoad.queueLength());
}
@Test
public void canAddToQueue(){
lothianRoad.addPerson(dave);
assertEquals(1, lothianRoad.queueLength());
}
}
| [
"pm1873@gmail.com"
] | pm1873@gmail.com |
c3bdc5944adbd7b9d3e7c719a98117fd1627dd52 | 14e8ed13c240b1447aec617539a362aa36322dff | /hcrp_web/src/main/java/com/hcis/hcrp/cms/site/dao/CmsSiteDao.java | 48958ed528df0cda613478141e45c7378c0f6a63 | [] | no_license | hongchentang/mvn-hong | e21600607c1a9f276e1095833e5e74d58d25100f | 32571fa424e1bb013e79777908ec40084a6f8a10 | refs/heads/master | 2022-07-12T05:55:19.771891 | 2020-04-20T03:48:40 | 2020-04-20T03:48:40 | 256,177,812 | 0 | 0 | null | 2022-06-25T07:30:42 | 2020-04-16T10:07:44 | Java | UTF-8 | Java | false | false | 1,013 | java | package com.hcis.hcrp.cms.site.dao;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.hcis.ipanther.core.persistence.dao.MyBatisDao;
import com.hcis.hcrp.cms.site.entity.CmsSite;
@Repository("cmsSiteDao")
public class CmsSiteDao extends MyBatisDao{
public CmsSite selectFirstSite() {
return (CmsSite) this.selectForVO(namespace+".selectFirstSite");
}
public CmsSite selectFirstByRoles(Map<String, Object> map) {
return (CmsSite) this.selectForVO(namespace+".selectFirstSite",map);
}
public int deleteMainSite(CmsSite cmsSite) {
return this.update(namespace+".deleteMainSite",cmsSite);
}
public CmsSite selectMainSite() {
return (CmsSite) this.selectForVO(namespace+".selectMainSite");
}
public int selectHaveSourcePath(String sourcePath) {
return this.selectForInt(namespace+".selectHaveSourcePath",sourcePath);
}
public CmsSite selectFirstSite(Map<String, Object> map) {
return (CmsSite) this.selectForVO(namespace+".selectFirstSite",map);
}
} | [
"1217365359@qq.com"
] | 1217365359@qq.com |
3ebedbf9c3a70bfb17c48e4e188e192379274411 | 11ed50703657e86b63b94a46e5e1aae4d8ef2ce6 | /Auction/src/com/dx/dao/ManagerDao.java | f120ff64b3556a923853a8896be96a5b1540a624 | [] | no_license | sxshanxin/bishe | f924044011b7be7ab18717792d9cb5c8cadb37d4 | 9a909c5f4ac4ce333b946966705eb5d9d0657fa9 | refs/heads/master | 2020-03-28T01:30:54.578909 | 2018-09-06T07:31:24 | 2018-09-06T07:31:24 | 147,510,399 | 0 | 0 | null | 2018-09-06T07:34:30 | 2018-09-05T11:56:19 | Java | UTF-8 | Java | false | false | 333 | java | package com.dx.dao;
import java.util.List;
import com.dx.entity.Manager;
public interface ManagerDao {
public Manager findByLoginm(String mname,String mpsw);
public boolean insertManager(Manager manager);
public boolean findByMname(String mname);
public List<Manager> findManagers();
public boolean delManager(String sid);
}
| [
"42988012+sxshanxin@users.noreply.github.com"
] | 42988012+sxshanxin@users.noreply.github.com |
e24594186a76cde8e54fb9f2e96117e6f0b02f83 | 13d0d6e5b5d4471952d4a7a1c7a4900d5323953c | /taglib/feilong-taglib-display/src/test/java/com/feilong/taglib/display/pager/BasePagerTest.java | a8ff1a4b79f0d65adfe740c291d0d9bc28af361f | [] | no_license | qq122343779/feilong-platform | 3c55867391620eb1283ca95c2aa30ea1bc156b1c | 5824b20445747ecd6e730c5a11c120d4e9f9838a | refs/heads/master | 2021-01-18T11:50:57.837512 | 2014-12-03T06:55:59 | 2014-12-03T06:55:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,859 | java | /*
* Copyright (C) 2008 feilong (venusdrogon@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.feilong.taglib.display.pager;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.feilong.commons.core.enumeration.CharsetType;
import com.feilong.taglib.display.pager.command.PagerConstants;
import com.feilong.taglib.display.pager.command.PagerParams;
/**
* The Class BasePagerTest.
*
* @author <a href="mailto:venusdrogon@163.com">feilong</a>
* @version 1.0.7 2014年5月24日 下午11:50:17
* @since 1.0.7
*/
public abstract class BasePagerTest{
/** The Constant log. */
@SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(BasePagerTest.class);
// Locale.ENGLISH;
/** The locale. */
private Locale locale = Locale.SIMPLIFIED_CHINESE;
/** The debug is not parse vm. */
boolean debugIsNotParseVM = false;
/**
* Gets the pager params.
*
* @return the pager params
*/
protected PagerParams getPagerParams(){
int count = 1024;
int currentPageNo = -1;
int pageSize = 10;
int maxIndexPages = 8;
String skin = PagerConstants.DEFAULT_SKIN;
// String pageUrl = "http://localhost:8888/pager.htm?a=b&b=c&d=a&name=jinxin";
String pageUrl = "http://item.blanja.com/items/search?oneNav=1190&priceTo=&twoNav=101706&priceFrom=100&pageNo=1&keyWords=Samsung";
// String pageUrl = "http://localhost:8888/pager.htm";
// pageUrl =
// "http://www.underarmour.cn/cmens-bottoms-pant/t-b-f-a-c-s-fLoose-p-g-e-i-o.htm?'\"--></style></script><script>netsparker(0x0000E1)</script>=";
String pageParamName = "pageNo";
String vmPath = PagerConstants.DEFAULT_TEMPLATE_IN_CLASSPATH;
// log.debug("===================================================");
PagerParams pagerParams = new PagerParams(count, pageUrl);
pagerParams.setCurrentPageNo(currentPageNo);
pagerParams.setPageSize(pageSize);
pagerParams.setMaxIndexPages(maxIndexPages);
pagerParams.setSkin(skin);
pagerParams.setPageParamName(pageParamName);
pagerParams.setVmPath(vmPath);
pagerParams.setCharsetType(CharsetType.UTF8);
pagerParams.setDebugIsNotParseVM(debugIsNotParseVM);
pagerParams.setLocale(locale);
return pagerParams;
}
} | [
"venusdrogon@163.com"
] | venusdrogon@163.com |
1f67c2ab85f2349b902e142f5e3df40dfd23c77f | 877b6d945bf0f5a174004d02b9534d905e74af92 | /ArStation/src/main/java/com/funoble/myarstation/socket/protocol/MBNotifyPlayAnimationTwo.java | 3fd3b1ebfdb3b7c8fa146f912127259d00be5913 | [] | no_license | Hengle/arstation | 47906e828c2a39f638bd7599e6c999f49524061c | e5550072cfd381372770eba457002e1ea4c8b564 | refs/heads/master | 2020-07-17T06:58:06.861077 | 2017-07-26T12:56:22 | 2017-07-26T12:56:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,314 | java | /*******************************************************************************
* Copyright (C) Inc.All Rights Reserved.
* FileName: MBReqDing.java
* Description:
* History:
* 版本号 作者 日期 简要介绍相关操作
* 1.0 cole 2012-5-24 上午11:05:42
*******************************************************************************/
package com.funoble.myarstation.socket.protocol;
import java.nio.ByteBuffer;
public class MBNotifyPlayAnimationTwo implements MsgPara {
//pak名称|起始位置类型(0---位置 1---坐标)|位置【X坐标】|0【Y坐标】
//|结束位置类型(0---位置 1---坐标)|位置【X坐标】|0【Y坐标】|开始动画ID|开始动画动作|结束动画ID|结束动画动作
public String szAnimDes; //
/**
* construct
*/
public MBNotifyPlayAnimationTwo() {
szAnimDes = "";
}
/*
* @see com.funoble.lyingdice.socket.protocol.MsgPara#Encode(byte[], short)
*/
@Override
public int Encode(byte[] aOutBuffer, short aOutLength) {
if(aOutBuffer == null || aOutLength <= 0) {
return -1;
}
ByteBuffer Temp = ByteBuffer.wrap(aOutBuffer);
int shLength = 2;
shLength += aOutLength;
Temp.position(shLength);
Temp.putShort((short) szAnimDes.getBytes().length);
if(szAnimDes.length() > 0) {
Temp.put(szAnimDes.getBytes());
}
shLength = Temp.position();
shLength -= aOutLength;
Temp.putShort(aOutLength, (short) shLength);
return Temp.position();
}
/*
* @see com.funoble.lyingdice.socket.protocol.MsgPara#Decode(byte[], short)
*/
@Override
public int Decode(byte[] aInBuffer, short aInLength) {
if(aInBuffer == null || aInLength <= 0) {
return -1;
}
ByteBuffer Temp = ByteBuffer.allocate(aInBuffer.length + 2);
Temp.put(aInBuffer);
Temp.position(aInLength);
int shLength = 0;
shLength = Temp.getShort();
if(shLength > aInBuffer.length - aInLength) {
return -1;
}
int len = Temp.getShort();
if(len > 0 ) {
byte[] data = new byte[len];
Temp.get(data);
szAnimDes = new String(data);
data = null;
}
return Temp.position();
}
/*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "MBNotifyPlayAnimationTwo [szAnimDes=" + szAnimDes + "]";
}
}
| [
"wmzh0003@qq.com"
] | wmzh0003@qq.com |
d2c3d26c2950e96aecca1260fe3a0d4c136e0546 | 060b4b8b5f42c45fe3002137fd737f1da5b0009d | /src/main/java/com/tony/server/controller/upload/UploadController.java | e8f06da59a98f2e2173c33f7ee1df40f82447879 | [] | no_license | tonypark0403/spring-mybatis | b31fe819db5ba7b455194a2e260befbf218a67e1 | 8678c86ffba7a193797c45c24783cc42ee58d32c | refs/heads/master | 2020-04-27T03:58:20.837979 | 2019-03-14T01:56:12 | 2019-03-14T01:56:12 | 174,039,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,674 | java | package com.tony.server.controller.upload;
import java.io.File;
import java.util.UUID;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class UploadController {
private static final Logger logger = LoggerFactory.getLogger(UploadController.class);
@Resource(name = "uploadPath")
String uploadPath;
@RequestMapping(value = "/upload/uploadForm", method = RequestMethod.GET)
public void uploadForm() {
// "upload/uploadForm";
}
@RequestMapping(value = "/upload/uploadForm", method = RequestMethod.POST)
public ModelAndView uploadForm(MultipartFile file, ModelAndView mav) throws Exception {
logger.info("Filename: " + file.getOriginalFilename());
String savedName = file.getOriginalFilename();
logger.info("Filesize: " + file.getSize());
logger.info("Content type: " + file.getContentType());
savedName = uploadFile(savedName, file.getBytes());
mav.setViewName("upload/uploadResult");
mav.addObject("savedName", savedName);
return mav;
}
String uploadFile(String originalName, byte[] fileData) throws Exception {
// Universal Unique IDentifier
UUID uid = UUID.randomUUID();
String savedName = uid.toString() + "_" + originalName;
File target = new File(uploadPath, savedName);
FileCopyUtils.copy(fileData, target);
return savedName;
}
}
| [
"tonypark0403@gmail.com"
] | tonypark0403@gmail.com |
5bf83b5d22860cecb828c530b3761a38c7aa5457 | bf48f398ef150bccfb874139d29141f046606323 | /src/test/java/org/zerock/persistence/JDBCTests.java | 91e9ea0cedf25a71ec5e19a6ca8042aeb1901e89 | [] | no_license | akinux1004/page705 | 7cda41f8ae2cd51a1fefef64c3677d8d5ec73671 | 76c1f8851846d792af346f4e50b35a9c62a65825 | refs/heads/master | 2023-01-19T14:08:38.269685 | 2020-11-18T11:51:18 | 2020-11-18T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package org.zerock.persistence;
import java.sql.Connection;
import java.sql.DriverManager;
import org.junit.Test;
import lombok.extern.log4j.Log4j;
@Log4j
public class JDBCTests {
static {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch(Exception e) {
e.printStackTrace();
}
}
@Test
public void testConnection() {
try(Connection con = DriverManager.getConnection("jdbc:orcle:thin:@localhost:1521:orcl", "book_ex", "book_ex")){
log.info(con);
} catch(Exception e) {
log.info(e.getMessage());
}
}
}
| [
"akinux1004@gmail.com"
] | akinux1004@gmail.com |
d216ef8d53746dfdc58f238c9e27afbc421c2193 | 8140184a7b07bf348b8b66647f0a24ae7db30c73 | /Lab1/Strategy/src/strategy/Check.java | 891f73fed33abfa4cc2516e186530c8bf24af0cc | [] | no_license | RemonShehata/ITI-Design-Patterns-Tasks | 42f9761bf30ca7d993832af0bba82190f9f76837 | e6e36e7e268eb0c2a8147cca6a9432cea85b6d09 | refs/heads/master | 2020-12-26T09:15:15.097223 | 2020-02-01T17:59:40 | 2020-02-01T17:59:40 | 237,461,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | 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 strategy;
/**
*
* @author remon
*/
public class Check implements PaymentStrategy{
@Override
public void pay(float amount) {
System.out.println("Pay using Check (" + amount + ")");
}
}
| [
"RemonGerges94@gmail.com"
] | RemonGerges94@gmail.com |
68db334b235a2dfa5ebdeb39fdbcbe73e59f6539 | fae82924cc0ad05790567385b736008362964beb | /14-security-spring/exercise/blog-application-extend/src/main/java/com/example/blogapplicationextend/model/bean/AppRole.java | fa513eb488b374c940808d3903c395496945de61 | [] | no_license | hauhp94/C0321G1_HuynhPhuocHau_Module4 | 4167b6ab0b28fe7387f79018eca2d37c79e87dcc | d636275a934876ea578dad8e7537e10be01f489a | refs/heads/master | 2023-07-03T21:52:13.330991 | 2021-08-12T17:25:20 | 2021-08-12T17:25:20 | 385,274,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package com.example.blogapplicationextend.model.bean;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
@Entity
@Getter
@Setter
@NoArgsConstructor
@Table(name = "App_Role", //
uniqueConstraints = { //
@UniqueConstraint(name = "APP_ROLE_UK", columnNames = "Role_Name") })
public class AppRole {
@Id
@GeneratedValue
@Column(name = "Role_Id", nullable = false)
private Long roleId;
@Column(name = "Role_Name", length = 30, nullable = false)
private String roleName;
} | [
"hauhpdn2015@gmail.com"
] | hauhpdn2015@gmail.com |
b3f85330909f3ef538783b11d91ccf04ae41fb03 | ed75c5192566767adf61a83b19bafcef41a60e9b | /app/src/test/java/com/zhc/KM/ExampleUnitTest.java | 6d60a5e6ef5c99533a1163b2ad6a34397cd5ab5a | [] | no_license | bczhc/KM | 2bc0a5aa2cff13a24905ddca74517758d8a18a94 | 392d37de522495ab2cc007b381b108fcb075c878 | refs/heads/master | 2022-01-13T08:29:18.817985 | 2019-05-01T05:11:54 | 2019-05-01T05:11:54 | 183,476,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.zhc.KM;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"bczhc0@126.com"
] | bczhc0@126.com |
f049a09f5c4f8b34b515dfb460872323ba30aec6 | 07496eea8b4ab50ca4c8eb6fe00320bfebca6a80 | /src/ua/artcode/week2/day2/_03CreateAndFillArrayBackwards.java | 719229e6fc6a9839bb13b5a74778737a92cb9290 | [] | no_license | presly808/ACB17 | d2308a41d2701dee7d6df94ce32e397f414ce40e | 79f9a20e85dfb0966391156ef185ccda48a398fd | refs/heads/master | 2021-01-20T20:15:48.104992 | 2016-07-11T07:20:23 | 2016-07-11T07:20:23 | 62,028,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package ua.artcode.week2.day2;
import ua.artcode.utils.ArrayUtils;
/**
* Created by gorobec on 03.07.16.
*/
public class _03CreateAndFillArrayBackwards {
public static void main(String[] args) {
// create and fill array 15 -> 0
int size = 16;
int[] arr = ArrayUtils.createAndFillArrayBackward(size);
/*new int[size];
for (int i = 0; i < arr.length; i++) {
arr[i] = size - i - 1;
}*/
/*size--;
for (int i = 0; i < arr.length; i++, size--) {
arr[i] = size;
}*/
/*for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();*/
ArrayUtils.printArray(arr);
}
}
| [
"yevhenijvorobiei@gmail.com"
] | yevhenijvorobiei@gmail.com |
81f63156b71f5e8cf65585aaf2afb531f8600944 | b400427d70d048312edd91c09e4818b64107b639 | /app/src/main/java/model/LastPosition.java | cb304698a44792780f243a496bdfc81f50d548e0 | [] | no_license | ksandyasa/mtrack-android | 4c464d2f810aae42c7d7459d784591f87484bea7 | c5bbb506e1058db04dd5af1081076bda169fdc40 | refs/heads/master | 2021-01-23T14:14:42.056269 | 2017-09-07T02:12:27 | 2017-09-07T02:12:27 | 102,679,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,761 | java | package model;
/**
* Created by Andy on 5/23/2016.
*/
public class LastPosition {
private String asset_id;
private String asset_code;
private String timestamp;
private String status_code;
private String input_mask;
private String phone_number;
private String distance;
private String address;
private String latitude;
private String longitude;
private String heading;
private String speed;
private String speed_violation;
private String geofence_point;
private String geofence_route;
private String duration;
public LastPosition() {
}
public LastPosition(String ai, String ac, String ts, String sc, String im, String pn, String dist, String add, String lat,
String lng, String head, String spd, String sv, String gp, String gr) {
this.asset_id = ai;
this.asset_code = ac;
this.timestamp = ts;
this.status_code = sc;
this.input_mask = im;
this.phone_number = pn;
this.distance = dist;
this.address = add;
this.latitude = lat;
this.longitude = lng;
this.heading = head;
this.speed = spd;
this.speed_violation = sv;
this.geofence_point = gp;
this.geofence_route = gr;
}
public void setAssetId(String ai) {
this.asset_id = ai;
}
public void setAssetCode(String ac) {
this.asset_code = ac;
}
public void setTimestamp(String ts) {
this.timestamp = ts;
}
public void setStatusCode(String sc) {
this.status_code = sc;
}
public void setInputMask(String im) {
this.input_mask = im;
}
public void setPhoneNumber(String pn) {
this.phone_number = pn;
}
public void setDistance(String dist) {
this.distance = dist;
}
public void setAddress(String add) {
this.address = add;
}
public void setHeading(String head) {
this.heading = head;
}
public void setLatitude(String lat) {
this.latitude = lat;
}
public void setLongitude(String lng) {
this.longitude = lng;
}
public void setSpeed(String spd) {
this.speed = spd;
}
public void setSpeedViolation(String sv) {
this.speed_violation = sv;
}
public void setGeofencePoint(String gp) {
this.geofence_point = gp;
}
public void setGeofenceRoute(String gr) {
this.geofence_route = gr;
}
public void setDuration(String dr) {
this.duration = dr;
}
public String getAssetId() {
return this.asset_id;
}
public String getAssetCode() {
return this.asset_code;
}
public String getTimestamp() {
return this.timestamp;
}
public String getStatusCode() {
return this.status_code;
}
public String getInputMask() {
return this.input_mask;
}
public String getPhoneNumber() {
return this.phone_number;
}
public String getDistance() {
return this.distance;
}
public String getAddress() {
return this.address;
}
public String getLatitude() {
return this.latitude;
}
public String getLongitude() {
return this.longitude;
}
public String getHeading() {
return this.heading;
}
public String getSpeed() {
return this.speed;
}
public String getSpeedViolation() {
return this.speed_violation;
}
public String getGeofencePoint() {
return this.geofence_point;
}
public String getGeofenceRoute() {
return this.geofence_route;
}
public String getDuration() {
return this.duration;
}
}
| [
"ksandyasa@gmail.com"
] | ksandyasa@gmail.com |
0aea2ab87ee80858a06ff36ed998a8f60dc14c44 | 886d59dcc67c3c3416eed11ead6655f89152c8da | /W3Schools/app/src/main/java/com/example/w3schools/MainActivity.java | 34bb0e87ae49c8936e56bdc5ee9d557eb4b71cbe | [] | no_license | Gopi3614/W3Schools | 980ce64049c25b10b4918cf82aad65a85be8a281 | bf3bbe50ae0f2d13616e98a34b5c24d95f27910d | refs/heads/main | 2023-04-12T06:58:22.295924 | 2021-05-02T16:51:20 | 2021-05-02T16:51:20 | 363,699,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,300 | java | package com.example.w3schools;
import androidx.appcompat.app.AppCompatActivity;
import android.app.DownloadManager;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.DownloadListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
WebView webView = findViewById(R.id.webview);
webView.loadUrl("https://www.w3schools.com");
webView.getSettings().setJavaScriptEnabled(true);
//webView.isHardwareAccelerated();
webView.getSettings().setLoadsImagesAutomatically(true);
webView.setWebViewClient(new WebViewClient());
webView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
DownloadManager.Request myRequest = new DownloadManager.Request(Uri.parse(url));
myRequest.allowScanningByMediaScanner();
myRequest.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
DownloadManager Mymanager = (DownloadManager)getApplicationContext().getSystemService(DOWNLOAD_SERVICE);
Mymanager.enqueue(myRequest);
Toast.makeText(getApplicationContext(),"File is Downloading...",Toast.LENGTH_LONG).show();
}
});
webView.setOnKeyListener((View.OnKeyListener) (v, keyCode, event) -> {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (webView.canGoBack()) {
webView.goBack();
//return true;
}
return MainActivity.super.onKeyDown(keyCode, event);
}
}
return true;
});
}
} | [
"gopi1134434@gmail.com"
] | gopi1134434@gmail.com |
6889b56ab574d44870c9c67df1cfa6f167ad2e17 | f441063b2edd8931c6fafd038584a2c4b5309935 | /Lab-1-Questionnaire/app/src/androidTest/java/com/example/lab1questionnaire/ExampleInstrumentedTest.java | e1f53fe3f2389e4ef9b2ec21132880d88695794c | [] | no_license | ICS-Brandon/SEG3125 | 5ae49cdbe3de6830f2f57531aea041f16f021eaa | 8d4dff0f8c741f64db024c64cdf2372e6ca2ba6d | refs/heads/master | 2020-12-14T04:16:52.956503 | 2020-04-02T20:52:20 | 2020-04-02T20:52:20 | 234,636,840 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package com.example.lab1questionnaire;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.lab1questionnaire", appContext.getPackageName());
}
}
| [
"wilson.brandonj15@gmail.com"
] | wilson.brandonj15@gmail.com |
a2f89e543e05295a8caa7b6e67c065f70584ee76 | d4987a5a3ecef263da0415ce3f7d19e2c930ecec | /app/src/main/java/com/zj/mqtt/ui/device/DeviceSettingActivity.java | 68ce94e7c0b7c06a9b33043414ad31bb2f8137ac | [] | no_license | dashuizhu/MQTT | 9bd72eb0b4bafecfb9f98ececd12761be6d10c2b | f1f0872522a2d7e43e90e4fbe8723321670b4cb0 | refs/heads/master | 2021-07-08T01:07:08.928765 | 2020-07-12T14:54:19 | 2020-07-12T14:56:37 | 146,264,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,988 | java | package com.zj.mqtt.ui.device;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.person.commonlib.view.HeaderView;
import com.zj.mqtt.R;
import com.zj.mqtt.bean.device.DeviceBean;
import com.zj.mqtt.constant.AppString;
import com.zj.mqtt.database.DeviceDao;
import com.zj.mqtt.ui.BaseActivity;
import com.zj.mqtt.view.InputNameDialog;
import com.zj.mqtt.view.MyItemView;
import com.zj.mqtt.view.PlaceDialog;
/**
* 设备设置
*
* @author zhuj 2018/9/5 下午6:40
*/
public class DeviceSettingActivity extends BaseActivity {
@BindView(R.id.headerView) HeaderView mHeaderView;
@BindView(R.id.item_name) MyItemView mItemName;
@BindView(R.id.item_place) MyItemView mItemPlace;
@BindView(R.id.item_info) MyItemView mItemInfo;
private DeviceBean mDeviceBean;
InputNameDialog mNameDialog;
PlaceDialog mPlaceDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_device_setting);
ButterKnife.bind(this);
initViews();
}
private void initViews() {
mDeviceBean = getIntent().getParcelableExtra(AppString.KEY_BEAN);
mItemPlace.setTextContent(mDeviceBean.getPlace());
mItemName.setTextContent(mDeviceBean.getName());
}
@OnClick(R.id.layout_header_right)
public void onRightClick() {
String name = mItemName.getTextContent();
String place = mItemPlace.getTextContent();
mDeviceBean.setName(name);
mDeviceBean.setPlace(place);
DeviceDao.saveOrUpdate(mDeviceBean);
getApp().updateDevice(mDeviceBean.getDeviceMac(), name, place);
setResult(RESULT_OK);
finish();
}
@OnClick(R.id.layout_header_back)
public void onFinishClick() {
finish();
}
@OnClick(R.id.btn_delete)
public void onDelete() {
DeviceDao.delete(mDeviceBean);
getApp().removeDevice(mDeviceBean.getDeviceMac());
Intent intent = new Intent();
intent.putExtra(AppString.KEY_DELETE, true);
setResult(RESULT_OK, intent);
finish();
}
@OnClick(R.id.item_name)
public void onViewNameClicked() {
if (mNameDialog == null) {
mNameDialog = new InputNameDialog(this, getString(R.string.label_device_name),
mDeviceBean.getName());
mNameDialog.setOnOkClickListener(new InputNameDialog.OnOkClickListener() {
@Override
public void clickCancel() {
}
@Override
public void clickConfirm(String str) {
if (TextUtils.isEmpty(str.trim())) {
showToast(R.string.toast_input_empty);
return;
}
mItemName.setTextContent(str);
mNameDialog.dismiss();
}
});
} else {
mNameDialog.setContent(mItemName.getTextContent());
}
mNameDialog.show();
}
@OnClick(R.id.item_place)
public void onViewPlaceClicked() {
if (mPlaceDialog == null) {
mPlaceDialog = new PlaceDialog(this, mDeviceBean.getPlace());
mPlaceDialog.setOnOkClickListener(new PlaceDialog.OnOkClickListener() {
@Override
public void clickConfirm(String str) {
mItemPlace.setTextContent(str);
}
});
} else {
mPlaceDialog.setContent(mItemPlace.getTextContent());
}
mPlaceDialog.show();
}
@OnClick(R.id.item_info)
public void onDeviceInfoClicked() {
Intent intent = new Intent(this, DeviceInfoActivity.class);
intent.putExtra(AppString.KEY_BEAN, mDeviceBean);
startActivity(intent);
}
}
| [
"328860252@qq.com"
] | 328860252@qq.com |
dae0657b27d3a152289c4075433ad998df2ccc5f | 81b6b2911cd8bcfd171d67c907351c818e6f02aa | /XRay/src/main/java/com/jbesu/mc/xray/App.java | 8bc51b8f07e4c0aceae32220e8947b2d42785954 | [
"MIT"
] | permissive | forewing/mc-xray | 06445399c82922b51571a516680d551215a8f7b7 | 128172211608a270168cf2fc71c9d6fca190063a | refs/heads/master | 2023-02-22T17:09:04.302694 | 2021-01-18T14:29:26 | 2021-01-18T14:29:26 | 330,657,764 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,684 | java | package com.jbesu.mc.xray;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import com.jbesu.mc.xray.command.CommandXRay;
import com.jbesu.mc.xray.player.PlayerInfo;
import com.jbesu.mc.xray.tasks.BlockTask;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class App extends JavaPlugin {
private Map<UUID, PlayerInfo> playerInfoMap;
private Set<String> targetBlocks;
public App() {
playerInfoMap = new HashMap<>();
}
public Set<String> getTargetBlocks() {
if (targetBlocks == null) {
targetBlocks = new HashSet<>();
for (String block : getConfig().getStringList("target")) {
targetBlocks.add(block);
}
}
return targetBlocks;
}
@Override
public void onEnable() {
this.getCommand("xray").setExecutor(new CommandXRay(this));
initConfig();
}
private void initConfig() {
FileConfiguration config = getConfig();
config.addDefault("mode", "block");
config.addDefault("range", 2);
List<String> defaultTarget = new ArrayList<>();
defaultTarget.add("AIR");
defaultTarget.add("COAL_ORE");
defaultTarget.add("REDSTONE_ORE");
defaultTarget.add("IRON_ORE");
defaultTarget.add("GOLD_ORE");
defaultTarget.add("DIAMOND_ORE");
defaultTarget.add("LAPIS_ORE");
defaultTarget.add("EMERALD_ORE");
defaultTarget.add("NETHER_GOLD_ORE");
defaultTarget.add("NETHER_QUARTZ_ORE");
defaultTarget.add("ANCIENT_DEBRIS");
defaultTarget.add("WATER");
defaultTarget.add("LAVA");
defaultTarget.add("BEDROCK");
config.addDefault("target", defaultTarget);
config.options().copyDefaults(true);
saveDefaultConfig();
}
public PlayerInfo getPlayerInfo(Player player) {
return playerInfoMap.computeIfAbsent(player.getUniqueId(), f -> new PlayerInfo(player.getUniqueId()));
}
public void removePlayerInfo(Player player) {
playerInfoMap.remove(player.getUniqueId());
}
public void startXRay(Player player) {
PlayerInfo playerInfo = getPlayerInfo(player);
playerInfo.setTask(new BlockTask(this, player));
playerInfo.getTask().start();
}
public void stopXRay(Player player) {
PlayerInfo playerInfo = getPlayerInfo(player);
playerInfo.getTask().stop();
getPlayerInfo(player).setTask(null);
}
}
| [
"jujianai@hotmail.com"
] | jujianai@hotmail.com |
4217319cf00f3e52199f79dff47b953d321f9e77 | 9a9f93532adb7a26307270a0f6876e24658117cd | /app/src/main/java/com/video/newqu/view/widget/ClickAnimationmageView.java | 95c4fab4c93f35654e4b2f96c88e595b9aaa4e60 | [] | no_license | jinkailong888/Video | fda7c0606eff676ca6672000c620fd8832af43d6 | 4513c2de0380b09896d9f2d5a5ff1c16f80854ec | refs/heads/master | 2020-04-24T08:55:37.866468 | 2018-04-28T09:20:59 | 2018-04-28T09:20:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,424 | java | package com.video.newqu.view.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
/**
* TinyHung@outlook.com
* 2017/9/13 16:36
* 点击有动画效果的ImageView
*/
public class ClickAnimationmageView extends ImageView {
private static String TAG = "EffectsButton";
private boolean clickable = true;
private ScaleAnimation upAnimation = createUpAnim();
private OnClickListener mOnClickListener;
private boolean shouldAbortAnim;
private int preX;
private int preY;
private int[] locationOnScreen;
private Animation.AnimationListener animationListener = new Animation.AnimationListener() {
public void onAnimationEnd(Animation paramAnonymousAnimation) {
//setSelected(!isSelected());
clearAnimation();
//Log.d(TAG, "onAnimationEnd: ");
if (mOnClickListener != null) {
mOnClickListener.onClickView(ClickAnimationmageView.this);
}
}
public void onAnimationRepeat(Animation paramAnonymousAnimation) {}
public void onAnimationStart(Animation paramAnonymousAnimation) {}
};
public ClickAnimationmageView(Context paramContext) {
this(paramContext, null);
}
public ClickAnimationmageView(Context paramContext, AttributeSet paramAttributeSet) {
this(paramContext, paramAttributeSet, 0);
}
public ClickAnimationmageView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
super(paramContext, paramAttributeSet, paramInt);
upAnimation.setAnimationListener(this.animationListener);
locationOnScreen = new int[2];
}
private ScaleAnimation createUpAnim() {
ScaleAnimation localScaleAnimation = new ScaleAnimation(1.2F, 1.0F, 1.2F, 1.0F, 1, 0.5F, 1, 0.5F);
localScaleAnimation.setDuration(50L);
localScaleAnimation.setFillEnabled(true);
localScaleAnimation.setFillEnabled(false);
localScaleAnimation.setFillAfter(true);
return localScaleAnimation;
}
private ScaleAnimation createDownAnim() {
ScaleAnimation localScaleAnimation = new ScaleAnimation(1.0F, 1.2F, 1.0F, 1.2F, 1, 0.5F, 1, 0.5F);
localScaleAnimation.setDuration(50L);
localScaleAnimation.setFillEnabled(true);
localScaleAnimation.setFillBefore(false);
localScaleAnimation.setFillAfter(true);
return localScaleAnimation;
}
public boolean onTouchEvent(MotionEvent motionEvent) {
super.onTouchEvent(motionEvent);
if (!this.clickable) {
return false;
}
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
clearAnimation();
startAnimation(createDownAnim());
this.shouldAbortAnim = false;
getLocationOnScreen(this.locationOnScreen);
preX = (this.locationOnScreen[0] + getWidth() / 2);
preY = (this.locationOnScreen[1] + getHeight() / 2);
}
if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
clearAnimation();
if (!this.shouldAbortAnim) {
startAnimation(this.upAnimation);
}
this.shouldAbortAnim = false;
}
else if (motionEvent.getAction() == MotionEvent.ACTION_CANCEL) {
clearAnimation();
startAnimation(createUpAnim());
this.shouldAbortAnim = false;
}
else if ((motionEvent.getAction() == MotionEvent.ACTION_MOVE) && (!this.shouldAbortAnim) && (!checkPos(motionEvent.getRawX(), motionEvent.getRawY()))) {
this.shouldAbortAnim = true;
clearAnimation();
startAnimation(createUpAnim());
}
return true;
}
boolean checkPos(float rawX, float rawY) {
rawX = Math.abs(rawX - this.preX);
rawY = Math.abs(rawY - this.preY);
return (rawX <= getWidth() / 2) && (rawY <= getHeight() / 2);
}
public void setClickable(boolean clickable) {
this.clickable = clickable;
}
public void setOnClickListener(OnClickListener parama) {
this.mOnClickListener = parama;
}
public interface OnClickListener {
void onClickView(ClickAnimationmageView view);
}
}
| [
"584312311@qq.com"
] | 584312311@qq.com |
5fc7a195d4581f960ee9e71320a308b5111a3fea | 57caa5c517ae23a0ac8a62e2d8dfde771660dd4b | /app/src/androidTest/java/cn/com/tianyudg/coordinatorlayoutdemo/ExampleInstrumentedTest.java | 581b5dbd1ba31566858feb3672a37d938f4f04e8 | [] | no_license | zhizhongbiao/CoordinatorLayoutDemo | 18c9f286a5bec6c33ccd7f1ba4ebc203c0204fc8 | 3d15ed49da62d6aeb1f318794fdd838528eaa7aa | refs/heads/master | 2021-05-10T15:21:55.958469 | 2018-01-23T03:00:43 | 2018-01-23T03:00:43 | 118,549,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package cn.com.tianyudg.coordinatorlayoutdemo;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cn.com.tianyudg.coordinatorlayoutdemo", appContext.getPackageName());
}
}
| [
"zhizhongbiao163@163.com"
] | zhizhongbiao163@163.com |
ba810790ff74f9b72143b86d819e302cf1143913 | 51934a954934c21cae6a8482a6f5e6c3b3bd5c5a | /output/61c6ce5e74154a46801b27a958bb3bbe.java | acde897fe3823fbcc5698b3b3d30393f6523c62c | [
"MIT",
"Apache-2.0"
] | permissive | comprakt/comprakt-fuzz-tests | e8c954d94b4f4615c856fd3108010011610a5f73 | c0082d105d7c54ad31ab4ea461c3b8319358eaaa | refs/heads/master | 2021-09-25T15:29:58.589346 | 2018-10-23T17:33:46 | 2018-10-23T17:33:46 | 154,370,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,181 | java | class vxKvC8PPj7FEot {
public int WLqbg7Q;
public static void orn (String[] x0Qk) throws O6pD7QT8 {
if ( -true.H()) {
int[] pIfxqMHdH2pug;
}
{
boolean[][] nizAYTRXcWO;
int dxlw_rN;
if ( ( this.PShoGqFLhVi9wM).A) return;
r[][] LULi;
void[] Akhck;
int OCNLXs0e;
}
}
public static void AEr9laosO (String[] foGA_L) {
;
void[][][] ls38toqOc;
int[][] kVUl5CFTTPlC;
int CERhsler = -!714[ saZdBuPJTgorg()[ !-onuJmw0zpDH[ -IrnGvzpnz.SNuJR()]]] = ( ---null[ ( -new void[ ( -!-new erOOkld8CDgo().KlQTtj).vtgB].Vxr()).ZRGyIs8()]).__dfZBo8h();
HHm0KDzy_MR sBzWwBky1E = --!-new y()[ !!-null.cLSJ_3mmaWC] = -false.i();
int[][] ZF0;
jCFV2rY__psK3[][][][] CFAqbj = --!!null[ -new ncyF40mHqmpmE()[ true.WvDJLF]] = -false[ ( !-this[ -!-2795.lK2GCyjYq4()]).zQXQ2gPyqtR()];
;
{
int[][] c7i;
while ( -964718155.JecC4vj()) if ( EKNL5aaG9().Rs()) return;
while ( new j3XwzPwPBD7tyU().f) new dU0GXq()[ false.Q1kcLRWsj4Fepr()];
if ( !--false[ -true.ZBS03RTd9EI7]) {
if ( pCNmQ21Bu().HO0ZCLCGgEgZ) return;
}
{
void[][] hJZ6T;
}
}
boolean n;
int bTQ6Oc0wLesu9n;
;
if ( -new FDZBoZTWc51lIL().WG) if ( !XVIirVbgD9SU.X) {
{
boolean wXGJ6edBHY2L;
}
}else return;
boolean[] nnEQFx3pN;
{
;
}
boolean[] r8V3;
while ( -77846321.k()) ;
boolean WvNT6fLABnqCX;
if ( !-!N_zvepuVk_.K2KS7FlMS()) null.GmvAiZ6WvmKq8I();else ;
int V = !true.v() = null.GspR0e5xaDg();
}
public int K;
public static void GVqHp1v9QY (String[] QRRxwZn4Bl) throws QzuBI1twmbQ {
if ( false.WjxMg) return;
if ( !!-!!-new H()[ !32648036.UY]) while ( !false.HzQIn8XLPgNW) if ( ySKEqo().Ae) ;else while ( -false[ -new oHZT()[ -true.OWEBjm4R]]) ;
!null.ljzJ();
void[][][] qfwlRjI59Fvkak;
if ( new sg[ g.tKaF][ !!Z3zhoCXEeLVVR.dO43()]) new int[ !FmjrhCzAJT[ Jf_4K[ -----!false.aFkE]]].JzX2n6pf3a;
boolean I1hYvg_y7ah5SQ;
boolean[][] xtraG3 = -this.YY4LUvPNX0NWO() = !new int[ 49.devI_C2g4h8].bshtiA4hJDZ;
if ( !!!!new void[ 66[ !new Ox().VnmJNWakgOVT()]].iHu) while ( !null.kBWAovoBGAiHj()) -new IayVZGABO0J().b();else while ( --!540048[ !-null.jzvCFZ]) ;
;
{
!-this.l1();
int[] qs2OUNpX;
vXm9YXhkB[] WuGPlHMs3;
if ( new boolean[ false.u0mzBksDzUlxv][ new Kj7wQXFxlN().zOvR5C_bVX5gc]) while ( !-true[ !!new W4MJugW5OX1v().djZe2eD_n]) while ( !null.pO26e0OCo) if ( -new TpegukDITr85e().lXBLhifYq) while ( -!( !-82826539.zL).S()) if ( !!true.UK6nsKPlFhk) ;
if ( true.JL6tZUNreK) while ( true[ null.EZUdUkuk6T_VO]) return;
boolean[] IGVt6F9QqT;
boolean _9hh;
while ( !-CLUk.y4n7rqmwYLAK37()) if ( --this[ -!wo8()[ this[ false.c2af1bZ5()]]]) !!-( qYC0zIAggh().R7DGyyP2Ul).xEt9jGdcR();
void[][][][] cvuY;
return;
void[][][][] g4gG;
void[][][] zGvUDWx0dIfXv;
iFmaCil.KHSSNZ;
CdMIKuD4sqr.xrFBNNYj20mz();
boolean ce1ykl5AJ5;
;
;
return;
}
int[] pvWZIaS3xt = true[ 58.Hw0hJB()];
void XDvnTx;
{
{
void[] b9tQPz;
}
Qdek6jTDgdA PM0JZND8Hka;
hk1i lpqOb01ah;
if ( --( !this[ --!!new UR3()[ new iT3().CwHGTWFW04E()]]).nNlnW2o) -this.b4BMOG();
boolean[] ESM_Q02zq0IK;
while ( true.DHaL()) ;
if ( ( true.jx3_wLzR)._jeNfElD()) while ( false.KVFT1lBTMk) {
return;
}
if ( Wn5aW()[ -AUHUR[ true.fdwtPwGI29dP()]]) if ( ( !!true.yAvDF).G1d6JL7V) return;
}
}
public static void IDR (String[] kEHx) throws pAY {
boolean[] hXUxBWDp4aefi;
boolean C2e911pShQj = L2Dem1WSSSFC().mNIVMv4;
boolean[][][] Js2 = !!-this.ITcNiYq;
int fTqxj = xeweeW1X11gSn9().dgvm() = --!-false.YR_bp();
--false.YVXlB0_oX();
FzLDMT[][] axSolKzorOTqk_ = -X4w().rLAau_znI08G2c;
;
int kD = ( --( 1640062.EWu8QIxlDPTkU).qrK9Dea4oi)[ J1gr_fBvNuqDbg().tPBG()] = new fGe7_MX0Ch6z[ !-true.JCUQ][ -!!( 312[ !this[ !---!!new vkDq[ --!-CaPEe0Jlr[ true.RHf4OSZJfJ1x]].iSYVvJS1GF()]])[ --false.dCgOmnLvs9UkLV()]];
boolean zSlyUXU = new void[ false[ true.Ocex]][ -new boolean[ !false.y2j0tYeznIPvJ()].z];
NDBnj vSghbDoO;
{
if ( V.VMi4PFypA) !!new int[ ( new yZXF()[ new I4e9WEt().EcKwf]).ZL4itkaMyi7vs4()][ !!new void[ ( TPtK5Amu.Y7q2kFboO)[ HqGk_8[ 3085.z0M8O0edXmy]]].FNCo()];
int[][] Sj4ss4zYz8rF3o;
int XPfx6q5;
void[][][][] Ys7xGWD;
void[][] ik;
boolean[][] Ezpi4hBFGN;
return;
}
void[] g;
boolean _;
while ( !null.fb()) ;
void[][][] Ym = Vg()[ -hTgZ().cD82HjOaC5T];
boolean[][][][][] Mi;
ZEkd[] xXYoICN;
;
}
public int O2jDvkR6dA () {
while ( this[ -!true.gksbUOjo]) while ( -true.ukP3EP7o()) while ( new rty().OO5g) return;
if ( !25262.T7C4VK4) if ( null.yj5W1oETYMIak) {
q6XMkCM8j43VZ yJHSnq2M6IS;
}else if ( !false.facY9VH2) while ( ZK_0_H2().QRmp1) {
void[][][] PuM7Q5nbaSk_;
}
boolean wg7FwNJB;
!false[ !-false.H6PC()];
}
}
class OhJOKHSbWaG3 {
public static void K1YAvunOR (String[] dxY0Zy) throws uI6kJ_Fxs5zR {
boolean[][] R = !-( -new int[ !false.gfHJHsV]._m6Ya8fuEy3Uja())[ YdZ_sZ4L3q().ZDF14yqsTU()] = new uBufp0PB5K_e().iQjd3Oh;
int SaQ_fhW;
V6mVw i723G = --_6FEP.M4Y7OoD7l4jT5 = this.NEkPrSQJVxsZ;
void[] n1K5;
void[] jtY3h3C5QSz = wOvtqB2Z3jYJp().OmbPvcaEEOVR = false.nPrHONJuLMq5();
{
void QIf;
uC6NEz7r[][][][][][][] vUlg_;
void[] EMMtVUi6mdT6;
void YJKCZ4oRLx;
while ( 49.BfmUbM6095S) return;
void N;
while ( M.xn()) if ( --7.jccqC2y6ngK7HP) while ( 797534948[ -xgX()[ true.aQHcJQBRKxbZN]]) {
P2hdBt[][] FBzbwqTa9pOX;
}
mAk eQVwTYy8Q;
}
;
{
void[][][][] SrMcRPTc4Rw;
void[] opw;
int[] TDF7FAI;
void gW0SuOEQKBX;
while ( null.D()) return;
{
UUEgBe jvUTJIZaYyxrX;
}
return;
return;
boolean _300b;
boolean zuOkjg;
}
boolean PhM5IK_Hk8;
void tmtaAgBe;
void vPU8m7d = !new vZ8JxEdPI()[ this.hZk()];
boolean GWu4QjqCxP;
return -!!true.zddTxgbHRiG;
}
public aEKqk0u[] aB () throws roXQCpD {
boolean[][] goj61ZrnUgIpM = !C3L277yKdskf.Vprgeqgkj = -!GNsNCWe().uYo_kKdlNah4F;
;
qjd XS_rebdsNxbf6C;
int jmH26RD6;
-!!new ykej61LvNn().mJzicPHFSbFA();
;
void dyp01OjL7dB = ( -VTGis()[ -!( !40540.zPaNuZdHGPOeju).BFRkz8R0hLS()]).w;
}
public boolean[][][][][][][][][][] Kr6TMYPex;
public int[][][][][][][][] IHd8IA4Zk8vu;
public static void q6v7Lkg6H (String[] olsGb) throws GTdiYkj23k {
if ( -63.AB6Y) while ( !!( Qgm.em()).vsBNfX()) while ( false.VCevzm07()) return;else while ( !!false.Oil_T23Fy) ;
q84bQ60VXIwQ[] smybdRa = ( null.iMIoRl7la).gprRrd();
return !-!false.dHh;
void[][][] xL7iHYI82xaV;
if ( Jk6P33d5.NUYWlZ()) if ( false[ --false.ip()]) if ( -OZ.spHOcDo7w6()) return;
int jXH = this.jWJkxyW335();
int[] hSJnDPcP28TDC;
boolean[][][] uwPQaUAQEOo;
if ( -new oJ4().OENZd) {
while ( -!( !this.Ga2XK)[ lJXQ().zBZTC5()]) {
return;
}
}
;
int[] I0U07NYb;
boolean aNv75DjF1mI3pC;
}
public GTyYer0duJ[] goF3ad (IljIX1kfIyJedE EtUenZ0fspT, boolean VxAHzj9vsH5, void[][] m_sZ1w_kN) {
new ph().yX05O2GPYyHq();
return null.U_mUOGZXerUjXb;
;
;
void UN8Pe4w_8p;
DVMyKFeCiT GBUymnKawyzKA = !---Ndlq9().c56G;
void neHbyKqqNG = -!0546861[ !false.eomU4h1VAAA4()];
q3qmxt[] JtnDSohfm6utCq;
{
void[] yOYm3Y2IMSKhN;
;
return;
if ( !false.chM_NriJJIl) {
return;
}
int[] XwG7smcI8TQam;
OFUfOr hPMDOpc;
;
{
return;
}
-null.TgwoXg;
{
{
boolean[][] ElTWQMCrCWhCr;
}
}
boolean[][] SwjgXkgGBw;
;
if ( ( null[ true[ IopZzpAoUWeM.TvsAGDbkm()]]).tneHg()) {
void[][][][] HIL9nHvH2sF;
}
;
}
return new EAupkUB4OpUMzd().Q0();
}
public void[] TRuYXXUb () throws JewuEPkif {
{
if ( KNKiAObgMZL5ho().WT()) while ( new eL[ false[ -new Wa().mmoJfW()]].p_tO_yJ()) !this.m4V9O5();
boolean[] FB;
;
void AKT;
boolean[] vv8;
int uLDBn7X;
if ( new B1Ir6p().gaJ1Hp4Y) if ( --true.oGSd8xYHs1Vd) while ( !!!--false.g05NG_FcL()) ;
if ( null.h()) ;
null.yuZl8C_MVX();
kvid8b_hNF os5Vb07ccZbz;
while ( new ppulae().KD()) while ( !true.Cx()) e9RFalXt.s14wuziFKfaJ();
while ( !( --false.oPy).NSTgceJFYm) {
return;
}
int[][][][] dmEx9oN;
if ( 3194868[ 946131.BH9z]) ;
void[] iR;
}
int[][][] MBL = -( !new Akm3Eu7Pcv().Up9PQmG4W57jW()).qCeSWiv();
if ( -( this.AeY).e6W38Anq_9tpy) return;
void[] iCDk6RAH9p6ie1;
return;
}
public ibWJHrZY zXealbw;
public void EpcV6W1k (boolean UT2vpSXqQq, boolean[][] NeG4M, int[][][] AooQc6, int pe6yb, OR9pk[] zTX7J) {
if ( -this.K0F8V()) while ( kWkfQMqIS().UTkgOdzuBIID) while ( -( ( true[ new weDf().Onuq8jKwCmxdyU]).g).bw97()) ;else return;
while ( !-new boolean[ 85149.YcylZyZBnU8Ax].jyCtfPb) {
return;
}
!new tlV4rvaBMlE().lcDcptRc;
boolean F42bZA46;
pnmGmCim qgY6aOFuk1f7 = -!!-new ZP().ByULLIHAhet() = -pYrs[ new dMfAfkyFz().o()];
while ( false.VArAWXF3B1) f0S_.Z;
new Xw0_adv().D1muRX;
while ( -false.z3MvNbVjzdM3Yb()) ;
{
!-this.m_ZctAPqAM;
}
KuZzm_[] BFwfD;
}
public static void KJKKPBw (String[] kHm) {
return null[ new q()[ new BkBxPrOYu4O2_C().xmyOhm()]];
;
;
void EqRq_TmN = true[ !true.zv()];
while ( false.UlLT9fBR()) ;
if ( !53417.B6c7bvPG90T()) while ( this.FCo) null.ybj6QcgN4o;else ;
}
public int[] ngA687Y7cOkBE () {
if ( -true.c7hnce1()) if ( ( false[ !!!!false.uQnR7DGEaN])[ null.oT()]) return;
{
boolean[] s786AHcG;
boolean[] xOmfwRpR;
}
{
wCewXZWrf ifNgQ;
if ( L9Y5zL3e[ false.iy5gyYn9()]) return;
zaqdLfZg4JTS6l DwSWBlw4;
-!!!!!-true.sFkpzg();
int jBhiX60ojRUCqC;
{
boolean[][] lu;
}
;
int[][][] VDAFb7eNrLDSvo;
if ( -new xEpNQ3SDNP()[ true.W2UTnzNa()]) ;
j4Z3x saMKOf;
if ( -new sQ5wBKuG().lYu1BoZq2()) if ( !!-84038714.cED9OFQCq) {
void[] UuA3g5taXEVRcY;
}
Ix7MO5HFhldd[] ACHe7gN5Ax;
}
int sa7Nqa3LSL10_c;
}
public z1_FjqHTW[][] h3YoZq;
public Cg_7[][][] P;
public int[] tbDEv99V;
public JFziqv[][][][][] ifsj4v9;
}
| [
"hello@philkrones.com"
] | hello@philkrones.com |
d541cc0a0faed61c640e5c63992ec2c4e87c9509 | eca4a253fe0eba19f60d28363b10c433c57ab7a1 | /server/openjacob.engine/java/de/tif/jacob/core/model/Searchconstraint.java | ac611eae51ca577841a4a85635ca05b147fcfe5c | [] | no_license | freegroup/Open-jACOB | 632f20575092516f449591bf6f251772f599e5fc | 84f0a6af83876bd21c453132ca6f98a46609f1f4 | refs/heads/master | 2021-01-10T11:08:03.604819 | 2015-05-25T10:25:49 | 2015-05-25T10:25:49 | 36,183,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,182 | java | /**************************************************************************
* Project : jacob.admin
* Date : Mon Nov 16 16:19:57 EET 2009
*
* THIS IS A GENERATED FILE - DO NOT CHANGE!
*
*************************************************************************/
package de.tif.jacob.core.model;
import de.tif.jacob.core.Context;
import de.tif.jacob.core.data.IDataAccessor;
import de.tif.jacob.core.data.IDataTableRecord;
import de.tif.jacob.core.data.IDataTransaction;
/**
*
*
* Condition: <b></b>
* DB table: <b>searchconstraint</b>
*
**/
public final class Searchconstraint
{
private Searchconstraint(){}
// the name of the table alias
public final static String NAME = "searchconstraint";
// All field names of the table alias "searchconstraint"
/**
* <br>
* <br>
* required: <b>true</b><br>
* type: <b>LONG</b><br>
**/
public final static String pkey = "pkey";
/**
* <br>
* <br>
* required: <b>true</b><br>
* type: <b>TEXT</b><br>
**/
public final static String applicationname = "applicationname";
/**
* <br>
* <br>
* required: <b>true</b><br>
* type: <b>TEXT</b><br>
**/
public final static String applicationversion = "applicationversion";
/**
* <br>
* <br>
* required: <b>true</b><br>
* type: <b>LONGTEXT</b><br>
**/
public final static String definition = "definition";
/**
* <br>
* <br>
* required: <b>true</b><br>
* type: <b>TEXT</b><br>
**/
public final static String ownerid = "ownerid";
/**
* <br>
* <br>
* required: <b>true</b><br>
* type: <b>TEXT</b><br>
**/
public final static String name = "name";
/**
* <br>
* <br>
* required: <b>true</b><br>
* type: <b>TIMESTAMP</b><br>
**/
public final static String created = "created";
/**
* <br>
* <br>
* required: <b>false</b><br>
* type: <b>TIMESTAMP</b><br>
**/
public final static String lastusage = "lastUsage";
/**
* Create a new Record within the current DataAccessor of the Context with a new transaction
**/
public static IDataTableRecord newRecord(Context context) throws Exception
{
return newRecord(context,context.getDataAccessor().newTransaction());
}
/**
* Create a new Record within the current DataAccessor of the Context and the handsover
* transaction.
**/
public static IDataTableRecord newRecord(Context context, IDataTransaction trans) throws Exception
{
return newRecord(context.getDataAccessor(),trans);
}
/**
* Create a new Record within the hands over DataAccessor and a new transaction.
**/
public static IDataTableRecord newRecord(IDataAccessor acc) throws Exception
{
return acc.getTable(NAME).newRecord(acc.newTransaction());
}
/**
* Create a new Record within the hands over DataAccessor and transaction.
**/
public static IDataTableRecord newRecord(IDataAccessor acc, IDataTransaction trans) throws Exception
{
return acc.getTable(NAME).newRecord(trans);
}
} | [
"a.herz@freegroup.de"
] | a.herz@freegroup.de |
3a564e38aace834517d275530feafeb3dc71b66b | cbbe9f674af56de5d4a3b79e008a9029c5730c02 | /src/edu/uconn/newclientmodel/Height.java | c7e3167f29459c140b3bce9f2ead8aae309e23c4 | [] | no_license | TylerWilliamsEH/CSE2102 | 44a2d307245023dc76e02f925977f53d4b0093c7 | f242e7760617a13001a92bde3fc2551ac678fb20 | refs/heads/master | 2016-09-06T08:26:54.162147 | 2013-10-13T22:59:41 | 2013-10-13T22:59:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 725 | java | package edu.uconn.newclientmodel;
import edu.uconn.common.MyTimeStamp;
public class Height {
protected String heightValue = "";
protected String when = "";
protected MyTimeStamp heightDayandTime;
public Height() {
};
public String getHeightValue() {
return heightValue;
}
public void setHeightValue(String heightValue) {
this.heightValue = heightValue;
}
public String getWhen() {
return when;
}
public void setWhen(String when) {
this.when = when;
}
public void setheightDayandTime(MyTimeStamp heightDayandTime) {
this.heightDayandTime = heightDayandTime;
}
public MyTimeStamp getheightDayandTime() {
return heightDayandTime;
}
public String toString() {
return heightValue;
}
}
| [
"tyler.williams@uconn.edu"
] | tyler.williams@uconn.edu |
278a754498ef81733523ab4639052b829d0ff9a1 | b5153be915d94d1232a4fdebf1464b50809c361a | /src/main/java/com/amazonaws/services/ec2/model/DescribeAddressesRequest.java | e038f3bb018e9eff308f34a4321bf6907214e9ac | [
"Apache-2.0"
] | permissive | KonishchevDmitry/aws-sdk-for-java | c68f0ee7751f624eeae24224056db73e0a00a093 | 6f8b2f9a3cd659946db523275ba1dd55b90c6238 | refs/heads/master | 2021-01-18T05:24:52.275578 | 2010-05-31T06:20:22 | 2010-05-31T06:20:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,297 | java | /*
* Copyright 2010 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.ec2.model;
import com.amazonaws.AmazonWebServiceRequest;
/**
* <p>
* A request to describe a user's available Elasitc IPs.
* </p>
*/
public class DescribeAddressesRequest extends AmazonWebServiceRequest {
/**
* The optional list of Elastic IP addresses to describe.
*/
private java.util.List<String> publicIps;
/**
* The optional list of Elastic IP addresses to describe.
*
* @return The optional list of Elastic IP addresses to describe.
*/
public java.util.List<String> getPublicIps() {
if (publicIps == null) {
publicIps = new java.util.ArrayList<String>();
}
return publicIps;
}
/**
* The optional list of Elastic IP addresses to describe.
*
* @param publicIps The optional list of Elastic IP addresses to describe.
*/
public void setPublicIps(java.util.Collection<String> publicIps) {
java.util.List<String> publicIpsCopy = new java.util.ArrayList<String>();
if (publicIps != null) {
publicIpsCopy.addAll(publicIps);
}
this.publicIps = publicIpsCopy;
}
/**
* The optional list of Elastic IP addresses to describe.
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param publicIps The optional list of Elastic IP addresses to describe.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public DescribeAddressesRequest withPublicIps(String... publicIps) {
for (String value : publicIps) {
getPublicIps().add(value);
}
return this;
}
/**
* The optional list of Elastic IP addresses to describe.
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param publicIps The optional list of Elastic IP addresses to describe.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public DescribeAddressesRequest withPublicIps(java.util.Collection<String> publicIps) {
java.util.List<String> publicIpsCopy = new java.util.ArrayList<String>();
if (publicIps != null) {
publicIpsCopy.addAll(publicIps);
}
this.publicIps = publicIpsCopy;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("PublicIps: " + publicIps + ", ");
sb.append("}");
return sb.toString();
}
}
| [
"aws-dr-tools@amazon.com"
] | aws-dr-tools@amazon.com |
4de08d3a853bf730b72c2846664123dad3d5c9ce | 58bddff7318e0dd3a3dd1c837ba1913b475a8f57 | /src/main/java/com/small/missionboard/util/RedisUtils.java | d76bcafbfbf00b4ebd7bdcc5b1668f25ee9253b3 | [] | no_license | yan42685/mission-board | 795a8b0ae67d021ee90ee0e5d6d74c7f12b498b9 | 1514a067de44037b13ea971324e832f16794a20c | refs/heads/dev | 2022-10-23T15:22:16.727496 | 2020-05-31T05:47:33 | 2020-05-31T05:47:33 | 254,113,268 | 0 | 0 | null | 2020-04-19T11:03:22 | 2020-04-08T14:36:54 | Java | UTF-8 | Java | false | false | 3,599 | java | package com.small.missionboard.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.CollectionUtils;
import java.util.concurrent.TimeUnit;
/**
* 方便操作缓存
*/
public class RedisUtils {
// 静态注入bean
private static RedisTemplate<String, String> redisTemplate = SpringContextUtils
.getBean("redisTemplate", RedisTemplate.class);
/**
* 指定缓存失效时间 (秒)
*/
public static Boolean expire(String key, Long time) {
try {
if (time > 0) {
redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 根据key 获取过期时间
*
* @param key 键 不能为null
* @return 时间(秒) 返回0代表为永久有效 失效时间为负数,说明该主键未设置失效时间(失效时间默认为-1)
*/
public static Long getExpire(String key) {
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
}
/**
* 判断key是否存在
*/
public static Boolean hasKey(String key) {
if (key == null) {
return null;
}
return redisTemplate.hasKey(key);
}
/**
* 删除缓存
*
* @param key 可以传一个值 或多个
*/
@SuppressWarnings("unchecked")
public static void del(String... key) {
if (key != null && key.length > 0) {
if (key.length == 1) {
redisTemplate.delete(key[0]);
} else {
redisTemplate.delete(CollectionUtils.arrayToList(key));
}
}
}
/**
* 默认获取字符串类型缓存
*/
public static String get(String key) {
String result = null;
try {
String json = redisTemplate.opsForValue().get(key);
result = json == null ? null : JsonUtils.json2Object(json, String.class);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return result;
}
/**
* 获取指定类型的缓存
*/
public static <T> T get(String key, Class<T> objClass) {
T result = null;
try {
String json = redisTemplate.opsForValue().get(key);
result = json == null ? null : JsonUtils.json2Object(json, objClass);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return result;
}
/**
* 以JSON格式放入缓存
*/
public static boolean set(String key, Object value) {
try {
redisTemplate.opsForValue().set(key, JsonUtils.object2Json(value));
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 放入缓存并设置时间
*
* @param key 键
* @param value 值
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
*/
public static boolean set(String key, Object value, Long time) {
try {
if (time > 0) {
redisTemplate.opsForValue().set(key, JsonUtils.object2Json(value), time, TimeUnit.SECONDS);
} else {
set(key, value);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
| [
"419725794@qq.com"
] | 419725794@qq.com |
3ed96d249d628347f8c4a19be2f2f3dbe33990f4 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_7576f88566a7ac2836a63027a42a57986142ad38/Activator/3_7576f88566a7ac2836a63027a42a57986142ad38_Activator_t.java | f46c331db4f3d5be13a421706081e26d2a8a6539 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,528 | java | /*******************************************************************************
* Copyright (c) 2008, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tm.internal.tcf.cdt.ui;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tm.tcf.protocol.Protocol;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.eclipse.tm.tcf.cdt.ui";
private static Activator plugin;
private static TCFBreakpointStatusListener bp_status_listener;
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
EvaluationContextManager.startup();
Protocol.invokeLater(new Runnable() {
public void run() {
if (bp_status_listener == null) bp_status_listener = new TCFBreakpointStatusListener();
}
});
}
public void stop(BundleContext context) throws Exception {
Protocol.invokeAndWait(new Runnable() {
public void run() {
if (bp_status_listener != null) {
bp_status_listener.dispose();
bp_status_listener = null;
}
}
});
plugin = null;
super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
}
public static IWorkbenchWindow getActiveWorkbenchWindow() {
return getDefault().getWorkbench().getActiveWorkbenchWindow();
}
public static IWorkbenchPage getActivePage() {
IWorkbenchWindow w = getActiveWorkbenchWindow();
if (w != null) return w.getActivePage();
return null;
}
public static Shell getActiveWorkbenchShell() {
IWorkbenchWindow window = getActiveWorkbenchWindow();
if (window != null) return window.getShell();
return null;
}
public static void errorDialog(String message, IStatus status) {
log(status);
Shell shell = getActiveWorkbenchShell();
if (shell == null) return;
ErrorDialog.openError(shell, "Error", message, status);
}
public static void errorDialog(String message, Throwable t) {
log(t);
Shell shell = getActiveWorkbenchShell();
if (shell == null) return;
IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, 1, t.getMessage(), null);
ErrorDialog.openError(shell, "Error", message, status);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
5216130e19b9b45f301d535768e803175eebf121 | 420cb9e2c7d42b7613ace92eeef4daad29d1afdd | /src/main/java/com/example/spring/boot/rest/service/DmServiceImpl.java | 47fe99bfe87ed65ebe6c131d9dd1f1096208d2c2 | [] | no_license | nandpoot23/SpringBootAspectWebService | 4403551ea6727f336cc4bb3ff592f320f39bb265 | 7c82a895f25516e530e49a5ac71fb8d02ab26241 | refs/heads/master | 2021-01-15T19:04:59.841842 | 2017-08-09T12:41:51 | 2017-08-09T12:41:51 | 99,682,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,536 | java | package com.example.spring.boot.rest.service;
import java.util.List;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.example.spring.boot.rest.handler.SelectAllDmCustomerHandler;
import com.example.spring.boot.rest.handler.SingleSelectDmCustomerHandler;
import com.example.spring.boot.rest.types.EmpAddress;
import com.example.spring.boot.rest.types.EmpConfigIdentifier;
import com.example.spring.boot.rest.types.EmpDetails;
/**
* @author mlahariya
* @version 1.0, Dec 2016
*/
@Component("DmServiceImpl")
public class DmServiceImpl implements DmServiceInterface {
private static org.slf4j.Logger LOG = LoggerFactory.getLogger(DmServiceImpl.class);
@Autowired
private SingleSelectDmCustomerHandler singleSelectDmCustomerHandler;
@Autowired
private SelectAllDmCustomerHandler selectAllDmCustomerHandler;
@Override
public EmpDetails queryEmpConfigs(EmpConfigIdentifier id) {
if (id != null) {
LOG.debug("MyServiceImpl::queryEmpConfigs id : " + id.getId());
}
return singleSelectDmCustomerHandler.queryEmpConfigs(id);
}
@Override
public List<EmpDetails> selectAllEmpAllData(EmpAddress empAddr) {
if (empAddr.getAddress() != null) {
LOG.debug("MyServiceImpl::selectAllEmpAllData address of your sector : " + empAddr.getAddress());
}
return selectAllDmCustomerHandler.selectAllEmpAllData(empAddr);
}
}
| [
"mlahariya@xavient.com"
] | mlahariya@xavient.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.