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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e63f225c15baac9ad2b45efc626bcba2be619730 | 09fda2339fe3bf9b718c0081ce0d6dcaa569c0fd | /shared-kernel/src/main/java/emt/proekt/eshop/sharedkernel/domain/financial/Currency.java | 955cbcf7bd2465c7a6c5a9f1a70737a93bd3bb2f | [] | no_license | stefanikostic/eshop | 218d25f8c08b96744caeaf16fc65572b20d978ba | 664b098a9776ab3b415b8ffedacb52bece135938 | refs/heads/master | 2023-06-20T03:42:14.543133 | 2021-07-20T18:12:51 | 2021-07-20T18:12:51 | 302,281,492 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 100 | java | package emt.proekt.eshop.sharedkernel.domain.financial;
public enum Currency {
MKD, USD, EUR
}
| [
"stefani.kostic@pelagus-it.com"
] | stefani.kostic@pelagus-it.com |
eb5fb88818dc94eaec36e27bed61db3c830eefbb | d3fb074cbe8739afa9a0f18043d930c7d819b933 | /app/src/main/java/sg/edu/rp/soi/knowyourfacts/MyFragmentPagerAdapter.java | e214f6c71c4dea7978ea42bcb87d5a89c5cbb5cd | [] | no_license | ishwarya1/KnowYourFacts | 13b857426d65270436fd319abca9cbcdb25c4764 | 12e6eef9191425406a95c3f9ff4ec786da7ece8d | refs/heads/master | 2022-11-18T04:14:59.542879 | 2020-07-24T10:20:15 | 2020-07-24T10:20:15 | 282,188,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package sg.edu.rp.soi.knowyourfacts;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import android.os.Bundle;
import java.util.ArrayList;
public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
ArrayList<Fragment> fragments;
public MyFragmentPagerAdapter(FragmentManager fm, ArrayList<Fragment> al) {
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
fragments = al;
}
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Override
public int getCount() {
return fragments.size();
}
}
| [
"18016638@myrp.edu.sg"
] | 18016638@myrp.edu.sg |
a2e5d504b180bd8aea4a895197df5a23a2e242d8 | 32f983fa4e76014f569b6938bb62107e493fccd0 | /westos_security_web/src/main/java/org/westos/service/SysRoleService.java | 45e3be0d695c6854eff67e81f2640b50a50341ef | [] | no_license | shenpeiqing168/spring_security_parent | ad466b7b3d1260d41568924b8f272fe041c9626d | 5346f618f984385946244ce2be5100f8418aeed9 | refs/heads/master | 2023-02-27T07:14:07.287077 | 2021-01-29T06:03:31 | 2021-01-29T06:03:31 | 325,194,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 838 | java | package org.westos.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.westos.bean.SysRole;
/**
* @Author: ShenMouMou
* @Company: 西部开源教育科技有限公司
* @Description: 简简单单,只为教育。
* @Date: 2021/1/7 9:20
*/
public interface SysRoleService extends IService<SysRole> {
//分页查询所有角色
IPage<SysRole> selectPage(Page<SysRole> page, SysRole sysRole);
//根据角色id查询该角色,以及该角色所对应的权限信息
SysRole getSysRoleAndPermissionsById(Long id);
//根据id删除该角色,以及该角色对应的权限信息(也就是删除中间表的对应关系)
boolean deleteRoleById(Long id);
}
| [
"shenpeiqing168@163.com"
] | shenpeiqing168@163.com |
37641b4a988fc1877b4d5f8144d23696e6ce1f7b | 8d3fce2ee99704ff5e4e582f36e12e89cf1e7465 | /app/src/main/java/com/makeus/groopl/config/GlobalApplication.java | b63cc191df04edf0c3b15e0f82c8dbbfd61a6fad | [] | no_license | LEE-JAEHAK/Groopl | a1af62d5fc1daa8825ec5de65187a49e417fd82b | 59a478b412b7d7e888cfebc216e186fb53bd1747 | refs/heads/master | 2023-01-09T07:22:48.154270 | 2020-10-11T13:54:37 | 2020-10-11T13:54:37 | 298,756,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,273 | java | package com.makeus.groopl.config;
import android.app.Application;
import android.content.Context;
import com.kakao.auth.ApprovalType;
import com.kakao.auth.AuthType;
import com.kakao.auth.IApplicationConfig;
import com.kakao.auth.ISessionConfig;
import com.kakao.auth.KakaoAdapter;
import com.kakao.auth.KakaoSDK;
public class GlobalApplication extends Application {
private static GlobalApplication instance;
public static GlobalApplication getGlobalApplicationContext() {
if (instance == null) {
throw new IllegalStateException("This Application does not inherit com.kakao.GlobalApplication");
}
return instance;
}
@Override
public void onCreate() {
super.onCreate();
instance = this;
// Kakao Sdk 초기화
KakaoSDK.init(new KakaoSDKAdapter());
}
@Override
public void onTerminate() {
super.onTerminate();
instance = null;
}
public class KakaoSDKAdapter extends KakaoAdapter {
@Override
public ISessionConfig getSessionConfig() {
return new ISessionConfig() {
@Override
public AuthType[] getAuthTypes() {
return new AuthType[] {AuthType.KAKAO_LOGIN_ALL};
}
@Override
public boolean isUsingWebviewTimer() {
return false;
}
@Override
public boolean isSecureMode() {
return false;
}
@Override
public ApprovalType getApprovalType() {
return ApprovalType.INDIVIDUAL;
}
@Override
public boolean isSaveFormData() {
return true;
}
};
}
// Application이 가지고 있는 정보를 얻기 위한 인터페이스
@Override
public IApplicationConfig getApplicationConfig() {
return new IApplicationConfig() {
@Override
public Context getApplicationContext() {
return GlobalApplication.getGlobalApplicationContext();
}
};
}
}
} | [
"wogkr101@gmail.com"
] | wogkr101@gmail.com |
7456c17230a843031305ff20069d7544814b15e2 | 93aa731ad4520b33cb1291c578794e65b13dd883 | /src/clasesbase/Matematica.java | cd55932678767c180fddac4e8a9b891b3b683567 | [] | no_license | alexHokuto/ClasesBase | 3312e7eb4122076668ad99e6232e482e8f1d12cb | f49c08b52f56b67984862f6df12723ecd75fae98 | refs/heads/master | 2021-01-25T00:46:34.780428 | 2014-01-27T01:30:09 | 2014-01-27T01:30:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,952 | 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 clasesbase;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import java.util.Random;
/**
*
* @author usuario
*/
public class Matematica {
static double generarRandomDouble(int num){
Random rndNumbers = new Random(num);
double rndNumber = rndNumbers.nextGaussian() * 1000;
String pattern = "######.##";
DecimalFormat f = new DecimalFormat(pattern, new DecimalFormatSymbols(Locale.US));
String cadena= f.format(rndNumber);
double montoFinal=Double.valueOf(cadena);
return montoFinal;
}
static int generarRandomInteger(int num){
Random rndNumbers = new Random(num);
double rndNumber = rndNumbers.nextGaussian() * 1000;
int numeroFinal= (int) rndNumber;
return numeroFinal;
}
static String customFormat(String pattern, double value) {
DecimalFormat myFormatter = new DecimalFormat(pattern, new DecimalFormatSymbols(Locale.US));
String output = myFormatter.format(value);
return output;
}
static String customFormat(String pattern, int value) {
DecimalFormat myFormatter = new DecimalFormat(pattern, new DecimalFormatSymbols(Locale.US));
String output = myFormatter.format(value);
return output;
}
public void mostrarRandonDouble(String pattern){
for (int i = 0; i < 3; i++) {
double randomDouble= generarRandomDouble(i+999);
System.out.println("randomDouble: " + randomDouble + " Formato:" + customFormat(pattern, randomDouble));
}
}
public void mostrarRandonInteger(String pattern){
for (int i = 0; i < 3; i++) {
int randomInteger= this.generarRandomInteger(i+999);
System.out.println("randomInteger: " + randomInteger + " Formato:" + customFormat(pattern, randomInteger) );
}
}
static BigDecimal sumarBigDecimal(double num1, double num2, int precisionDecimal){
// create MathContext object with 4 precision
// MathContext mc = new MathContext(4);
BigDecimal numUno= new BigDecimal(num1);
BigDecimal sumar;
sumar= numUno.add(new BigDecimal(num2));
return sumar.setScale(precisionDecimal, RoundingMode.HALF_UP);
}
static BigDecimal restarBigDecimal(double num1, double num2, int precisionDecimal){
BigDecimal numUno= new BigDecimal(num1);
BigDecimal restar;
restar= numUno.subtract(new BigDecimal(num2));
return restar.setScale(precisionDecimal, RoundingMode.HALF_UP);
}
static BigDecimal multiplicarBigDecimal(double num1, double num2, int precisionDecimal){
BigDecimal numUno= new BigDecimal(num1);
BigDecimal multiplicar;
multiplicar= numUno.multiply(new BigDecimal(num2));
return multiplicar.setScale(precisionDecimal, RoundingMode.HALF_UP);
}
static BigDecimal dividirBigDecimal(double num1, double num2, int precisionDecimal){
BigDecimal numUno= new BigDecimal(num1);
BigDecimal dividir;
dividir= numUno.divide(new BigDecimal(num2), precisionDecimal, RoundingMode.HALF_UP);
return dividir;
}
public static void main(String[] args) {
Matematica matematica= new Matematica();
String patternUno= "###,###.####";
String patternDos= "000000.00000";
matematica.mostrarRandonDouble(patternUno);
matematica.mostrarRandonInteger(patternDos);
String sumarBigDecimal= Matematica.sumarBigDecimal(1040.739, 30.12, 5).toString();
System.out.println("Sumar BigDecimal: " + sumarBigDecimal);
double sumar= Matematica.sumarBigDecimal(1040.739, 30.12, 5).doubleValue();
System.out.println(patternUno + " " + Matematica.customFormat(patternUno, sumar));
System.out.println(patternDos + " " + Matematica.customFormat(patternDos, sumar));
String restarBigDecimal= Matematica.restarBigDecimal(40.75, 30.121, 4).toString();
System.out.println("Sumar BigDecimal: " + restarBigDecimal);
double multiplicar= Matematica.multiplicarBigDecimal(140.739, 30.12, 5).doubleValue();
System.out.println("Multiplicar " + patternUno + " " + Matematica.customFormat(patternUno, multiplicar));
double dividir= Matematica.dividirBigDecimal(1540.739, 3.12, 5).doubleValue();
System.out.println(dividir);
System.out.println("Dividir " + patternUno + " " + Matematica.customFormat(patternUno, dividir));
}
}
| [
"usuario@usuario-PC"
] | usuario@usuario-PC |
86d6715ada89067a1aa4ab9cdf782185b01be3d8 | 1703000266136750fee681ee261483f42afc22d5 | /src/main/java/org/jhipster/lic/domain/Font.java | ea97e26ea04d5e2df676e681206912f05e47a98e | [] | no_license | madalinolteanu/cloudstore | c7e8dafbb4516320a6deb34c524de2e00b728a51 | 4a7b1c9738f515c2cf639caf709d6c799eafaffd | refs/heads/master | 2020-03-28T06:09:23.718369 | 2018-10-06T08:08:00 | 2018-10-06T08:08:00 | 147,817,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,967 | java | package org.jhipster.lic.domain;
import javax.persistence.*;
import java.io.Serializable;
/**
* Created by Madalin on 9/3/2018.
*/
@Entity
@Table(name = "STORE_FONT_TABLE", schema = "LICENCE")
public class Font implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "FONT_ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long fontId;
@Column(name = "FONT_NAME")
private String fontName;
@Column(name = "FONT_CODE")
private String fontCode;
public Long getFontId() {
return fontId;
}
public void setFontId(Long fontId) {
this.fontId = fontId;
}
public String getFontName() {
return fontName;
}
public void setFontName(String fontName) {
this.fontName = fontName;
}
public String getFontCode() {
return fontCode;
}
public void setFontCode(String fontCode) {
this.fontCode = fontCode;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Font font = (Font) o;
if (fontId != null ? !fontId.equals(font.fontId) : font.fontId != null) return false;
if (fontName != null ? !fontName.equals(font.fontName) : font.fontName != null) return false;
return fontCode != null ? fontCode.equals(font.fontCode) : font.fontCode == null;
}
@Override
public int hashCode() {
int result = fontId != null ? fontId.hashCode() : 0;
result = 31 * result + (fontName != null ? fontName.hashCode() : 0);
result = 31 * result + (fontCode != null ? fontCode.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Font{" +
"fontId=" + fontId +
", fontName='" + fontName + '\'' +
", fontCode=" + fontCode +
'}';
}
}
| [
"madalin.olteanu@thermofisher.com"
] | madalin.olteanu@thermofisher.com |
3e9aeda26aea2d046c4366423fec135caa58f603 | c42531b0f0e976dd2b11528504e349d5501249ae | /York GC Members App/MHSystems/app/src/main/java/com/mh/systems/york/web/models/HCapCertificate.java | 3ca9ddcceefc8e5dcadef6d899a9f9d2a686fb44 | [
"MIT"
] | permissive | Karan-nassa/MHSystems | 4267cc6939de7a0ff5577c22b88081595446e09e | a0e20f40864137fff91784687eaf68e5ec3f842c | refs/heads/master | 2021-08-20T05:59:06.864788 | 2017-11-28T08:02:39 | 2017-11-28T08:02:39 | 112,189,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,904 | java |
package com.mh.systems.york.web.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class HCapCertificate {
@SerializedName("ClubName")
@Expose
private String ClubName;
@SerializedName("IssueDate")
@Expose
private String IssueDate;
@SerializedName("PlayerName")
@Expose
private String PlayerName;
@SerializedName("CDHID")
@Expose
private String CDHID;
@SerializedName("HisOrHer")
@Expose
private String HisOrHer;
@SerializedName("ExactHCap")
@Expose
private String ExactHCap;
@SerializedName("PlayHCap")
@Expose
private String PlayHCap;
@SerializedName("SignedBy")
@Expose
private String SignedBy;
@SerializedName("MHSBanner")
@Expose
private String MHSBanner;
@SerializedName("SignatureImageUri")
@Expose
private String SignatureImageUri;
/**
*
* @return
* The ClubName
*/
public String getClubName() {
return ClubName;
}
/**
*
* @param ClubName
* The ClubName
*/
public void setClubName(String ClubName) {
this.ClubName = ClubName;
}
/**
*
* @return
* The IssueDate
*/
public String getIssueDate() {
return IssueDate;
}
/**
*
* @param IssueDate
* The IssueDate
*/
public void setIssueDate(String IssueDate) {
this.IssueDate = IssueDate;
}
/**
*
* @return
* The PlayerName
*/
public String getPlayerName() {
return PlayerName;
}
/**
*
* @param PlayerName
* The PlayerName
*/
public void setPlayerName(String PlayerName) {
this.PlayerName = PlayerName;
}
/**
*
* @return
* The CDHID
*/
public String getCDHID() {
return CDHID;
}
/**
*
* @param CDHID
* The CDHID
*/
public void setCDHID(String CDHID) {
this.CDHID = CDHID;
}
/**
*
* @return
* The HisOrHer
*/
public String getHisOrHer() {
return HisOrHer;
}
/**
*
* @param HisOrHer
* The HisOrHer
*/
public void setHisOrHer(String HisOrHer) {
this.HisOrHer = HisOrHer;
}
/**
*
* @return
* The ExactHCap
*/
public String getExactHCap() {
return ExactHCap;
}
/**
*
* @param ExactHCap
* The ExactHCap
*/
public void setExactHCap(String ExactHCap) {
this.ExactHCap = ExactHCap;
}
/**
*
* @return
* The PlayHCap
*/
public String getPlayHCap() {
return PlayHCap;
}
/**
*
* @param PlayHCap
* The PlayHCap
*/
public void setPlayHCap(String PlayHCap) {
this.PlayHCap = PlayHCap;
}
/**
*
* @return
* The SignedBy
*/
public String getSignedBy() {
return SignedBy;
}
/**
*
* @param SignedBy
* The SignedBy
*/
public void setSignedBy(String SignedBy) {
this.SignedBy = SignedBy;
}
/**
*
* @return
* The MHSBanner
*/
public String getMHSBanner() {
return MHSBanner;
}
/**
*
* @param MHSBanner
* The MHSBanner
*/
public void setMHSBanner(String MHSBanner) {
this.MHSBanner = MHSBanner;
}
/**
*
* @return
* The SignatureImageUri
*/
public String getSignatureImageUri() {
return SignatureImageUri;
}
/**
*
* @param SignatureImageUri
* The SignatureImageUri
*/
public void setSignatureImageUri(String SignatureImageUri) {
this.SignatureImageUri = SignatureImageUri;
}
}
| [
"karan@ucreate.co.in"
] | karan@ucreate.co.in |
ad1e3fefd6358c900fdc9aa7a941ea535e864d58 | c518fc455ff6906f40400c08b091528ec0b59991 | /org/omg/CORBA/WStringSeqHelper.java | 322b40dac05f47d61157beedf4dbaab5ca35b1b1 | [] | no_license | TianMaoJingLingX1/jdk1.8_source_code | 81db762b45d92f0e67c7246e99c770a2a9c233e5 | 17fa49216d3990db4a61d8c5716483858455e505 | refs/heads/master | 2023-03-23T17:53:37.632065 | 2021-03-14T15:03:42 | 2021-03-14T15:03:42 | 271,318,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,840 | java | package org.omg.CORBA;
/**
* org/omg/CORBA/WStringSeqHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/re/workspace/8-2-build-windows-i586-cygwin/jdk8u51/3951/corba/src/share/classes/org/omg/PortableInterceptor/CORBAX.idl
* Monday, June 8, 2015 6:01:16 PM PDT
*/
/** An array of WStrings */
abstract public class WStringSeqHelper
{
private static String _id = "IDL:omg.org/CORBA/WStringSeq:1.0";
public static void insert (org.omg.CORBA.Any a, String[] that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static String[] extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_wstring_tc (0);
__typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
__typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.WStringSeqHelper.id (), "WStringSeq", __typeCode);
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static String[] read (org.omg.CORBA.portable.InputStream istream)
{
String value[] = null;
int _len0 = istream.read_long ();
value = new String[_len0];
for (int _o1 = 0;_o1 < value.length; ++_o1)
value[_o1] = istream.read_wstring ();
return value;
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value)
{
ostream.write_long (value.length);
for (int _i0 = 0;_i0 < value.length; ++_i0)
ostream.write_wstring (value[_i0]);
}
}
| [
"2710393@qq.com"
] | 2710393@qq.com |
5b73e9bab476e435f61a9eea0ceef152bae04e5d | 249d4b50b2a6100e4dc8197a78f71c4282f98e84 | /hapi-examples/src/main/java/ca/uhn/hl7v2/examples/custommodel/v25/segment/ZPI.java | 5a181b9e8822eff8e10235368178b9232d87e58c | [] | no_license | sordahl-ga/hapi-hl7overhttp-azurefuncs | 6c607eaafd8bc7dbbe3c55387e5b86565bd6065a | 62cf6c8c161b306fe300d75dfc580e7817fa7d95 | refs/heads/master | 2020-05-14T08:07:13.020536 | 2019-04-16T15:28:52 | 2019-04-16T15:28:52 | 181,715,932 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,322 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ca.uhn.hl7v2.examples.custommodel.v25.segment;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.model.AbstractSegment;
import ca.uhn.hl7v2.model.Group;
import ca.uhn.hl7v2.model.Type;
import ca.uhn.hl7v2.model.v25.datatype.NM;
import ca.uhn.hl7v2.model.v25.datatype.ST;
import ca.uhn.hl7v2.parser.ModelClassFactory;
/**
* ZPI custom segment example
*
* Note that custom segments extend from {@link AbstractSegment}
*/
public class ZPI extends AbstractSegment {
/**
* Adding a serial UID is always a good idea, but optional
*/
private static final long serialVersionUID = 1;
public ZPI(Group parent, ModelClassFactory factory) {
super(parent, factory);
// By convention, an init() method is created which adds
// the specific fields to this segment class
init(factory);
}
private void init(ModelClassFactory factory) {
try {
/*
* For each field in the custom segment, the add() method is
* called once. In this example, there are two fields in
* the ZPI segment.
*
* See here for information on the arguments to this method:
* http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/model/AbstractSegment.html#add%28java.lang.Class,%20boolean,%20int,%20int,%20java.lang.Object[],%20java.lang.String%29
*/
add(ST.class, true, 0, 100, new Object[]{ getMessage() }, "Pet Name(s)");
add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Shoe Size");
} catch (HL7Exception e) {
log.error("Unexpected error creating ZPI - this is probably a bug in the source code generator.", e);
}
}
/**
* This method must be overridden. The easiest way is just to return null.
*/
@Override
protected Type createNewTypeWithoutReflection(int field) {
return null;
}
/**
* Create an accessor for each field
*/
public ST[] getPetName() throws HL7Exception {
return getTypedField(1, new ST[0]);
}
/**
* Create an accessor for each field
*/
public NM getShoeSize() throws HL7Exception {
return getTypedField(2, 0);
}
}
| [
"sordahl@bellsouth.net"
] | sordahl@bellsouth.net |
d93933a63cb323968bada3a662f78e9d650d4db2 | 22a8c41442174cf317878be4c9b191d6f86c8ec4 | /src/main/java/model/beans/PersonBasicInformation.java | 0819814762885b2d1cac36a7ece65e07efa82195 | [] | no_license | skuarch/admin | 0e15e1eb7ff223c988c8e5d84c2ed5515ce550fc | a27b5939eba0765825a0b9c359302a8e0cafb69f | refs/heads/master | 2021-01-13T01:30:15.953994 | 2015-08-16T15:14:04 | 2015-08-16T15:14:04 | 35,173,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,707 | java | package model.beans;
import java.io.Serializable;
/**
*
* @author skuarch
*/
public class PersonBasicInformation implements Serializable {
private long id;
private String name;
private String lastName;
private String email;
private String phone;
private int zipCode;
private String lastLogin;
private String country;
private String addressAll;
private String gender;
private String city;
private String type;
private String registrationDate;
private String state;
private String key;
private long personId;
private long personType;
private boolean isPartner;
private boolean isAffiliate;
private boolean isCompany;
public PersonBasicInformation() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getZipCode() {
return zipCode;
}
public void setZipCode(int zipCode) {
this.zipCode = zipCode;
}
public String getLastLogin() {
return lastLogin;
}
public void setLastLogin(String lastLogin) {
this.lastLogin = lastLogin;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getAddressAll() {
return addressAll;
}
public void setAddressAll(String addressAll) {
this.addressAll = addressAll;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getRegistrationDate() {
return registrationDate;
}
public void setRegistrationDate(String registrationDate) {
this.registrationDate = registrationDate;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public long getPersonId() {
return personId;
}
public void setPersonId(long personId) {
this.personId = personId;
}
public boolean isIsPartner() {
return isPartner;
}
public void setIsPartner(boolean isPartner) {
this.isPartner = isPartner;
}
public boolean isIsAffiliate() {
return isAffiliate;
}
public void setIsAffiliate(boolean isAffiliate) {
this.isAffiliate = isAffiliate;
}
public long getPersonType() {
return personType;
}
public void setPersonType(long personType) {
this.personType = personType;
}
public boolean isIsCompany() {
return isCompany;
}
public void setIsCompany(boolean isCompany) {
this.isCompany = isCompany;
}
}
| [
"skuarch@yahoo.com.mx"
] | skuarch@yahoo.com.mx |
6350ffb55be8388ec96d8898febdf85f8c6dc235 | 5bd45e6c96d32e8d8454e0c688ad9ccbe7a90030 | /sample/src/com/fasterxml/jackson/core/type/TypeReference.java | 0ea23c94cd1c4e8b086ee1a3e00eb55fe8c455db | [] | no_license | GnaneshwariGIT/CodingTest | 897dc21cbd268765b88001f79fe6e9c0c99f86f9 | 4e912a4168bda55c1840965f46091ed4fd7279af | refs/heads/master | 2020-12-25T11:04:59.900040 | 2016-08-11T04:39:27 | 2016-08-11T04:39:27 | 65,428,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 79 | java | package com.fasterxml.jackson.core.type;
public class TypeReference {
}
| [
"nishanth home@Nishanth"
] | nishanth home@Nishanth |
baa6a1c5f42b4fcb7d051e455dd7da2e3d1124e3 | 829c506a4a2ed40b885342080c528fdf2fced758 | /CancerDrug/Code/java/BioInfo/src/main/java/bioinfo/simulation/ode/DifferentialEquationsClassCreator.java | 5cedc5afed7fe169123fdea83df7499d5c3eab45 | [] | no_license | steven-wang70/bio-research | 2f2e9fb19719c67c91fd9c85860febe6eb21196e | e10350a4ea331caf5d77468709d1b161800f4f48 | refs/heads/master | 2021-06-25T18:32:40.338731 | 2019-10-30T20:15:11 | 2019-10-30T20:15:11 | 218,613,212 | 0 | 0 | null | 2020-10-13T17:06:34 | 2019-10-30T20:01:18 | Java | UTF-8 | Java | false | false | 6,754 | java | package bioinfo.simulation.ode;
import java.io.BufferedWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import bioinfo.simulation.ConcentrationLoader;
import bioinfo.regulation.GeneRegulation;
import bioinfo.regulation.GeneRegulationLoader;
import bioinfo.utils.Settings;
import bioinfo.utils.Utils;
public class DifferentialEquationsClassCreator {
public DifferentialEquationsClassCreator(List<GeneRegulation> regulations) {
_regulations = regulations;
}
private List<GeneRegulation> _regulations;
private static String createSubExpr(List<String> regulators, HashMap<String, Integer> allGenes) {
StringBuilder sb = new StringBuilder();
boolean firstOne = true;
for (String s : regulators) {
if (!firstOne) {
sb.append(" + ");
}
firstOne = false;
sb.append("Math.pow(applyNoise(y[").append(allGenes.get(s)).append("], t, ").append(allGenes.get(s)).append("), n)");
}
return sb.toString();
}
private void generateDifferentialEquationsClass(BufferedWriter writer, boolean includeInputNode, String packageName, String className) {
Hashtable<String, List<GeneRegulation>> regulatedGenes = new Hashtable<String, List<GeneRegulation>>();
HashMap<String, Integer> allGenes = new HashMap<String, Integer>();
for (GeneRegulation gr : _regulations) {
if (!regulatedGenes.containsKey(gr.getBindingGene())){
regulatedGenes.put(gr.getBindingGene(), new ArrayList<GeneRegulation>());
}
regulatedGenes.get(gr.getBindingGene()).add(gr);
allGenes.put(gr.getFactorGene(), 0);
allGenes.put(gr.getBindingGene(), 0);
}
// Assign each gene a unique index
int geneIndex = 0;
for (String key : allGenes.keySet()) {
allGenes.put(key, geneIndex++);
}
Utils.println("// Auto-generated", writer);
Utils.println("package " + packageName + ";", writer);
Utils.println("", writer);
Utils.println("import java.util.HashMap;", writer);
Utils.println("import java.util.Map;", writer);
Utils.println("", writer);
Utils.println("public class " + className + " extends CellSimulationBase {", writer);
Utils.println("\tpublic static final int GENE_COUNT = " + Integer.toString(geneIndex++) + ";", writer);
Utils.println("", writer);
// Generate index to name mapping
Utils.println("\tpublic static final String[] index2name = new String[] {", writer);
geneIndex = 0;
for (String geneName : allGenes.keySet()) {
if (geneIndex == allGenes.size() - 1) {
Utils.println("\t\t\"" + geneName + "\" \t// " + Integer.toString(geneIndex++), writer);
} else {
Utils.println("\t\t\"" + geneName + "\", \t// " + Integer.toString(geneIndex++), writer);
}
}
Utils.println("\t};", writer);
Utils.println("", writer);
// Generate name to index mapping
Utils.println("\tpublic static final Map<String, Integer> name2index;", writer);
Utils.println("\tstatic {", writer);
Utils.println("\t\tname2index = new HashMap<String, Integer>();", writer);
for (String geneName : allGenes.keySet()) {
// name2index.put("a", 0);
Utils.println("\t\tname2index.put(\"" + geneName + "\", " + Integer.toString(allGenes.get(geneName)) + ");", writer);
}
Utils.println("\t}", writer);
Utils.println("", writer);
// @Override
// public int getDimension() {
// return 2;
// }
Utils.println("\t@Override", writer);
Utils.println("\tpublic final int getDimension() {", writer);
Utils.println("\t\treturn GENE_COUNT;", writer);
Utils.println("\t}", writer);
Utils.println("", writer);
// @Override
// public void computeDerivatives(double t, double[] y, double[] yDot) {
// yDot[0] = omega * (c[1] - y[1]);
// yDot[1] = omega * (y[0] - c[0]);
// }
Utils.println("\t@Override", writer);
Utils.println("\tpublic final void computeDerivatives(double t, double[] y, double[] yDot) {", writer);
Utils.println("\t\tdouble activators;", writer);
Utils.println("\t\tdouble inhibitors;", writer);
for (String geneName : allGenes.keySet()) {
List<String> activators = new ArrayList<String>();
List<String> inhibitors = new ArrayList<String>();
if (regulatedGenes.keySet().contains(geneName)) {
List<GeneRegulation> factors = regulatedGenes.get(geneName);
for (GeneRegulation gr : factors) {
if (gr.getRelation() == GeneRegulation.RelationActivation) {
activators.add(gr.getFactorGene());
} else {
inhibitors.add(gr.getFactorGene());
}
}
}
Utils.println("", writer);
Utils.println("\t\t// " + geneName, writer);
String geneIndexString = Integer.toString(allGenes.get(geneName));
Utils.println("\t\tif(isOverrideDerivative(t, " + geneIndexString + ")) {", writer);
Utils.println("\t\t\tyDot[" + geneIndexString + "] = overrideDerivative(t, " + geneIndexString + ");", writer);
Utils.println("\t\t} else { ", writer);
if (activators.size() > 0) {
Utils.println("\t\t\t// activators : " + String.join(", ", activators), writer);
Utils.println("\t\t\tactivators = " + createSubExpr(activators, allGenes) + ";", writer);
} else {
Utils.println("\t\t\tactivators = 0;", writer);
}
if (inhibitors.size() > 0) {
Utils.println("\t\t\t// inhibitors : " + String.join(", ", inhibitors), writer);
Utils.println("\t\t\tinhibitors = " + createSubExpr(inhibitors, allGenes) + ";", writer);
} else {
Utils.println("\t\t\tinhibitors = 0;", writer);
}
Utils.println("\t\t\tyDot[" + geneIndexString + "] = (a * activators / (1 + a * activators)) * (1 / (1 + a * inhibitors)) - " + "y[" + Integer.toString(allGenes.get(geneName)) + "];", writer);
Utils.println("\t\t}", writer);
}
Utils.println("\t}", writer);
Utils.println("", writer);
Utils.println("}", writer);
}
public static void main(String[] args) {
Settings.loadSettings(args[0]);
String regulationFile = Settings.instance().getSetting("ODESimulation", "RegulationFile");
String packageName = Settings.instance().getSetting("ODESimulation", "ODEClassPackage");
String className = Settings.instance().getSetting("ODESimulation", "ODEClassName");
String classFile = Settings.instance().getSetting("ODESimulation", "ODEClassFile");
GeneRegulationLoader regLoader = new GeneRegulationLoader();
List<GeneRegulation> regulations = regLoader.loadFromFile(regulationFile);
DifferentialEquationsClassCreator creator = new DifferentialEquationsClassCreator(regulations);
BufferedWriter scriptWriter = Utils.openFileToWrite(classFile);
creator.generateDifferentialEquationsClass(scriptWriter, false, packageName, className);
Utils.close(scriptWriter);
}
}
| [
"steven_wang70@hotmail.com"
] | steven_wang70@hotmail.com |
621e4622b4eb388e9504b0ebd2b4c5d9b38cfb40 | e94f532fcb9695ba922808f79a4e83469c52d312 | /PluginSource/src/plugin/confignow/BuildCommand.java | 0bcd59cdda586faac402bf1fc55579ebaab1fc89 | [] | no_license | Integral-Technology-Solutions/FlexConfigNow | 210d8f96333a302a10e783b55b8dc56c6a06ae42 | 25dec671b9147b4774dd0272177c7000e8d8ce0e | refs/heads/master | 2021-09-15T09:34:09.460659 | 2018-05-30T00:13:44 | 2018-05-30T00:13:44 | 99,286,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,403 | java | package plugin.confignow;
import flexagon.fd.core.workflow.WorkflowExecutionContext;
import flexagon.ff.common.core.exceptions.FlexExternalProcessFailedException;
import flexagon.ff.common.core.exceptions.FlexInvalidArgumentException;
import flexagon.ff.common.core.externalprocess.ExternalProcess;
import flexagon.ff.common.core.logging.FlexLogger;
import java.io.File;
import java.util.Arrays;
/**
* Created by Matt Spencer on 3/08/2017.
*/
public class BuildCommand
{
private static final String CLZ_NAM = BuildCommand.class.getName();
private static final FlexLogger LOG = FlexLogger.getLogger(CLZ_NAM);
private String[] mBuildCommand;
private String mConfigNowHome;
public BuildCommand(WorkflowExecutionContext workflowExecutionContext) {
String version = configNowProperties.Plugin_Version;
String projectName = workflowExecutionContext.getProject().getName();
mConfigNowHome = workflowExecutionContext.getInstallPluginsDirectory("IntegralConfigNOWPlugin", version) + File.separator + "configNOW" + File.separator + projectName;
}
public void setBuildCommand(String[] commands){
this.mBuildCommand = commands;
}
public String[] getBuildCommand(){
return this.mBuildCommand;
}
public boolean runBuildCommand() throws FlexExternalProcessFailedException {
String method = "runBuildCommand";
LOG.logInfoEntering(method);
if(!validateBuildCommands()){
LOG.logSevere(method, "Build command validation failed!");
LOG.logInfoExiting(method);
throw new FlexInvalidArgumentException("Build Commands");
}
LOG.logInfo(method, "Creating new external process with working directory of: " + mConfigNowHome + " and command arguments of: " + getBuildCommand());
ExternalProcess externalProcess = new ExternalProcess(new File(mConfigNowHome));
configureExecution();
externalProcess.setCommands(Arrays.asList(getBuildCommand()));
LOG.logInfo(method, "Executing external process");
externalProcess.execute();
LOG.logInfoExiting(method, "Execution complete");
if (externalProcess.getProcessError().contains("BUILD FAILED")){
return false;
}
return true;
}
private boolean validateBuildCommands(){
String method = "validateBuildCommads";
if (this.mBuildCommand == null){
LOG.logSevere(method, "No build commands parsed");
return false;
}else if (!mBuildCommand[0].equals("ConfigNOW")){
LOG.logSevere(method, "First build argument needs to be 'confignow'");
return false;
}else{
LOG.logInfo(method, "Build Commands verified");
return true;
}
}
/* This helper function edits the first build command argument
* It is responsible for determining the OS type and applying
* the correct extension to ConfigNOW (.sh or .cmd) and also
* applying the correct path to the file */
private void configureExecution(){
String OS = System.getProperty("os.name").toLowerCase();
String fileExt;
if(OS.indexOf("win") >= 0){
fileExt = ".cmd";
}else{
fileExt = ".sh";
}
this.mBuildCommand[0] = mConfigNowHome + File.separator + mBuildCommand[0] + fileExt;
}
}
| [
"matthew_spencer_1994@hotmail.com"
] | matthew_spencer_1994@hotmail.com |
9aebd2b3300d65a4f9ce31e29720c6f40ef9d0ec | bef3b1ff9f8a2328bf12ac1709b7f59ff68a8ce6 | /src/testees/Persoon.java | 2bc2db18b339d7f6f8c288ac827c74d5194aa721 | [] | no_license | H35am/BookLaunch | 3e3e2c66edb9de135f24371ab39a2957298d3fe2 | 0759e90001544d202ae5d01364236c407d1a5d1e | refs/heads/master | 2021-01-10T17:44:11.776479 | 2015-12-05T15:29:38 | 2015-12-05T15:29:38 | 47,461,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 146 | java |
package testees;
/**
* * Tools | Templates and open the template in the editor
* @author 0775768 <Hesam.Zarza>
*/
public class Persoon {
}
| [
"heszar@gmail.com"
] | heszar@gmail.com |
944d7ae9fa756b421f426a1920b15f2bba6a0ac3 | 97a7f67667d2a2841206d8fac4e1ab3b12efbb96 | /src/main/java/com/elena/habitTracker/areas/users/services/UserService.java | 724a0c05f25c505fc2a8b0e9ec8330437bb43d3e | [
"MIT"
] | permissive | mitkovaelena/H-Tracker | bc2f03652173ce6aebc6f6e6b74391ec8b8fb939 | c9f91ca1820d3ac5fbd97eff2a92f4fe673a905c | refs/heads/master | 2021-04-09T10:42:22.791562 | 2018-04-23T07:42:27 | 2018-04-23T07:42:27 | 125,503,417 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 910 | java | package com.elena.habitTracker.areas.users.services;
import com.elena.habitTracker.areas.users.entities.User;
import com.elena.habitTracker.areas.users.models.binding.UserEditBindingModel;
import com.elena.habitTracker.areas.users.models.binding.UserRegisterBindingModel;
import com.elena.habitTracker.areas.users.models.view.UsersPageViewModel;
import org.springframework.data.domain.Pageable;
import org.springframework.security.core.userdetails.UserDetailsService;
public interface UserService extends UserDetailsService {
User getByUsername(String username);
User saveUser(UserRegisterBindingModel userDTO);
UsersPageViewModel getAllUsers(Pageable pageable);
UserEditBindingModel getUserEditDtoById(Long id);
User getUserById(Long id);
User editUser(Long id, UserEditBindingModel userEditBindingModel);
void deleteUser(Long id);
String getUsernameById(Long id);
}
| [
"mitkova_elena@yahoo.com"
] | mitkova_elena@yahoo.com |
475ba59d5d5d2bee46b24423e36250c50b8e923c | 834184ae7fb5fc951ec4ca76d0ab4d74224817a0 | /src/main/java/com/nswt/platform/pub/NoUtil.java | ea39c0c997dbace97f9b075370f16d3168f5eabe | [] | no_license | mipcdn/NswtOldPF | 3bf9974be6ffbc32b2d52ef2e39adbe495185c7e | fe7be46f12b3874a7f19967c0808870d8e465f5a | refs/heads/master | 2020-08-09T16:44:47.585700 | 2017-01-11T13:26:37 | 2017-01-11T13:26:37 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 8,103 | java | /**
* 作者:NSWT<br>
* 日期:2016-7-5<br>
* 邮件:nswt@nswt.com.cn<br>
*/
package com.nswt.platform.pub;
import java.sql.SQLException;
import com.nswt.framework.Config;
import com.nswt.framework.data.DBConn;
import com.nswt.framework.data.DBConnPool;
import com.nswt.framework.data.DataAccess;
import com.nswt.framework.data.DataTable;
import com.nswt.framework.data.QueryBuilder;
import com.nswt.framework.utility.StringUtil;
import com.nswt.schema.ZDMaxNoSchema;
import com.nswt.schema.ZDMaxNoSet;
public class NoUtil {
private static ZDMaxNoSet MaxNoSet;
private static Object mutex = new Object();
public static String getMaxNo(String noType) {
return getMaxNo(noType, "SN");
}
public static String getMaxNoLoal(String noType) {
return getMaxNoLocal(noType, "SN");
}
public static long getMaxID(String noType, String subType) {
// 注释掉本段逻辑,统一使用lock方式。在本地模式下,如果有多个应用同时部署在生产环境中,会导致主键冲突
// if (Config.isDebugMode()) {
return getMaxIDUseLock(noType, subType);
// }
// return getMaxIDLocal(noType, subType);
}
public synchronized static long getMaxIDUseLock(String noType, String subType) {
DBConn conn = DBConnPool.getConnection("Default", false, false);// 不能使用阻塞型事务中的连接
DataAccess da = new DataAccess(conn);
try {
da.setAutoCommit(false);
QueryBuilder qb = new QueryBuilder("select MxValue from ZDMaxNo where NoType=? and NoSubType=?", noType,
subType);
if (Config.isOracle()) {
qb.append(" for update");
}
Object mxValue = da.executeOneValue(qb);
if (mxValue != null) {
long t = Long.parseLong(mxValue.toString()) + 1;
qb = new QueryBuilder("update ZDMaxNo set MxValue=? where NoType=? and NoSubType=?", t, noType);
qb.add(subType);
da.executeNoQuery(qb);
da.commit();
return t;
} else {
ZDMaxNoSchema maxno = new ZDMaxNoSchema();
maxno.setNoType(noType);
maxno.setNoSubType(subType);
maxno.setMxValue(1);
maxno.setLength(10);
maxno.setDataAccess(da);
if (maxno.insert()) {
da.commit();
return 1;
} else {
throw new RuntimeException("获取最大号时发生错误!");
}
}
} catch (Exception e) {
try {
da.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
}
throw new RuntimeException("获取最大号时发生错误:" + e.getMessage());
} finally {
try {
da.setAutoCommit(true);
da.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
/**
* 得到类型为noType位长为length的编码
*/
public static String getMaxNo(String noType, int length) {
long t = getMaxID(noType, "SN");
String no = String.valueOf(t);
if (no.length() > length) {
return no.substring(0, length);
}
return StringUtil.leftPad(no, '0', length);
}
/**
* 得到类型为noType位长为length且前缀为prefix的编码
*/
public static String getMaxNo(String noType, String prefix, int length) {
long t = getMaxID(noType, prefix);
String no = String.valueOf(t);
if (no.length() > length) {
return no.substring(0, length);
}
return prefix + StringUtil.leftPad(no, '0', length);
}
public synchronized static String getMaxNoUseLock(String noType, String subType) {
DataAccess da = new DataAccess();
try {
da.setAutoCommit(false);
QueryBuilder qb = new QueryBuilder("select MxValue,Length from ZDMaxNo where NoType=? and NoSubType=?",
noType, subType);
if (Config.isOracle()) {
qb.append(" for update");
}
DataTable dt = qb.executeDataTable();
if (dt.getRowCount() > 0) {
long t = Long.parseLong(dt.getString(0, "MxValue")) + 1;
int length = Integer.parseInt(dt.getString(0, "Length"));
String no = String.valueOf(t);
if (length > 0) {
no = StringUtil.leftPad(no, '0', length);
}
qb = new QueryBuilder("update ZDMaxNo set MxValue=? where NoType=? and NoSubType=?", t, noType);
qb.add(subType);
da.executeNoQuery(qb);
da.commit();
return no;
} else {
ZDMaxNoSchema maxno = new ZDMaxNoSchema();
maxno.setNoType(noType);
maxno.setNoSubType(subType);
maxno.setMxValue(1);
maxno.setLength(10);
maxno.setDataAccess(da);
if (maxno.insert()) {
da.commit();
return "0000000001";
} else {
throw new RuntimeException("获取最大号时发生错误!");
}
}
} catch (Exception e) {
try {
da.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
}
throw new RuntimeException("获取最大号时发生错误:" + e.getMessage());
} finally {
try {
da.setAutoCommit(true);
da.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public synchronized static long getMaxIDLocal(String noType, String subType) {
if (MaxNoSet == null) {
init();
}
ZDMaxNoSchema maxno = null;
if (MaxNoSet != null) {
for (int i = 0; i < MaxNoSet.size(); i++) {
maxno = MaxNoSet.get(i);
if (maxno.getNoType().equals(noType) && maxno.getNoSubType().equals(subType)) {
synchronized (mutex) {
maxno.setMxValue(maxno.getMxValue() + 1);
if (!maxno.update()) {
throw new RuntimeException("生成最大号错误,MaxNoType=" + noType + ",MaxSubType=" + subType);
}
return maxno.getMxValue();
}
}
}
} else {
synchronized (mutex) {
MaxNoSet = new ZDMaxNoSet();
maxno = new ZDMaxNoSchema();
maxno.setNoType(noType);
maxno.setNoSubType(subType);
maxno.setLength(0);
maxno.setMxValue(1);
maxno.insert();
MaxNoSet.add(maxno);
return 1;
}
}
// 运行到此处是因为这是新加的MaxNoType
synchronized (mutex) {
maxno = new ZDMaxNoSchema();
maxno.setNoType(noType);
maxno.setNoSubType(subType);
maxno.setLength(10);
maxno.setMxValue(1);
maxno.insert();
MaxNoSet.add(maxno);
return 1;
}
}
public static long getMaxID(String noType) {
return getMaxID(noType, "ID");
}
public static long getMaxIDLocal(String noType) {
return getMaxIDLocal(noType, "ID");
}
public static String getMaxNo(String noType, String subType) {
if (Config.isDebugMode()) {
return getMaxNoUseLock(noType, subType);
}
return getMaxNoLocal(noType, subType);
}
public synchronized static String getMaxNoLocal(String noType, String subType) {
if (MaxNoSet == null) {
init();
}
ZDMaxNoSchema maxno = null;
if (MaxNoSet != null) {
for (int i = 0; i < MaxNoSet.size(); i++) {
maxno = MaxNoSet.get(i);
if (maxno.getNoType().equals(noType) && maxno.getNoSubType().equals(subType)) {
synchronized (mutex) {
maxno.setMxValue(maxno.getMxValue() + 1);
if (!maxno.update()) {
throw new RuntimeException("生成最大号错误,NoType=" + noType + ",MaxSubType=" + subType);
}
if (maxno.getLength() <= 0) {
return String.valueOf(maxno.getMxValue());
}
return StringUtil.leftPad(String.valueOf(maxno.getMxValue()), '0', (int) maxno.getLength());
}
}
}
} else {
synchronized (mutex) {
MaxNoSet = new ZDMaxNoSet();
maxno = new ZDMaxNoSchema();
maxno.setNoType(noType);
maxno.setNoSubType(subType);
maxno.setLength(10);
maxno.setMxValue(1);
maxno.insert();
MaxNoSet.add(maxno);
return "0000000001";
}
}
// 运行到此处是因为这是新加的NoType
synchronized (mutex) {
maxno = new ZDMaxNoSchema();
maxno.setNoType(noType);
maxno.setNoSubType(subType);
maxno.setLength(10);
maxno.setMxValue(1);
maxno.insert();
MaxNoSet.add(maxno);
return "0000000001";
}
}
private static synchronized void init() {
if (MaxNoSet != null) {
return;
}
ZDMaxNoSchema maxno = new ZDMaxNoSchema();
MaxNoSet = maxno.query();
}
}
| [
"18611949252@163.como"
] | 18611949252@163.como |
d1cb6013d57bda75425838ddb33fae223ed4275e | b94237861fc53a74b0ae67917354d81f1acf567b | /projects/empmgmt/EmployeeManagement_WebApp/WEB-INF/classes/com/empmang/model/DepartmentTO.java | 9b3636542763e4061089e5d30a7fe677c5e94a00 | [] | no_license | Raushan64/fn-june-20 | acbb04162a0c8784792060dca80238f8027948da | 369f435ab49ccc62ae319f959948d901da9b0732 | refs/heads/master | 2022-10-09T22:34:17.280676 | 2020-06-11T09:49:44 | 2020-06-11T09:49:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package com.empmang.model;
import java.io.Serializable;
// TODO: Auto-generated Javadoc
/**
* The Class EmployeeTO.
*/
public class DepartmentTO implements Serializable{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The userid. */
private int departId;
/** The first name. */
private String departName;
/**
* Gets the depart id.
*
* @return the depart id
*/
public int getDepartId() {
return departId;
}
/**
* Sets the depart id.
*
* @param departId the new depart id
*/
public void setDepartId(int departId) {
this.departId = departId;
}
/**
* Gets the depart name.
*
* @return the depart name
*/
public String getDepartName() {
return departName;
}
/**
* Sets the depart name.
*
* @param departName the new depart name
*/
public void setDepartName(String departName) {
this.departName = departName;
}
}
| [
"23210008@mkc.org"
] | 23210008@mkc.org |
7a2892cab818adf477ba84474c45cdaeba4f29f3 | e7c17c322cd5382f64b9eaf499186edcf9b99075 | /src/com/softsimples/ui/base/actions/ExcluirAction.java | 22338d1d560f3993d0ea48b27819889563fcd373 | [] | no_license | robson-alecio/ssbaseui | 2c815b638f50527de0c78f2bbba9cd5b3faf5994 | ce19e6151e96810b16e7ce937b9faa815a8376b0 | refs/heads/master | 2021-05-26T14:06:22.590680 | 2009-02-16T17:44:13 | 2009-02-16T17:44:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 926 | java | package com.softsimples.ui.base.actions;
import com.softsimples.ui.base.BasicFormPanel;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;
public class ExcluirAction extends AbstractAction {
private static final long serialVersionUID = 1L;
private BasicFormPanel basicPanel;
public ExcluirAction(BasicFormPanel basicPanel) {
super("Excluir",new ImageIcon(ExcluirAction.class.getResource("/icons/disk_blue_error.png")));
this.putValue(SHORT_DESCRIPTION, "Exclui cadastro");
this.putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.ALT_MASK));
this.putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_E));
this.basicPanel = basicPanel;
}
public void actionPerformed(ActionEvent event) {
this.basicPanel.excluir();
}
}
| [
"agnaldo@AGNALDO.WORKGROUP"
] | agnaldo@AGNALDO.WORKGROUP |
26176fbe5040dde90e74db7183f66d910b5434a9 | 4d6f449339b36b8d4c25d8772212bf6cd339f087 | /netreflected/src/Core/PresentationCore,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35/system/windows/media/animation/ByteAnimationBase.java | 6aeff0193cd05f360d3cac7a0557552b4a92acc4 | [
"MIT"
] | permissive | lvyitian/JCOReflector | 299a64550394db3e663567efc6e1996754f6946e | 7e420dca504090b817c2fe208e4649804df1c3e1 | refs/heads/master | 2022-12-07T21:13:06.208025 | 2020-08-28T09:49:29 | 2020-08-28T09:49:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,671 | java | /*
* MIT License
*
* Copyright (c) 2020 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
* <auto-generated>
* This code was generated from a template using JCOReflector
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
* </auto-generated>
*************************************************************************************/
package system.windows.media.animation;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.windows.media.animation.AnimationTimeline;
import system.windows.media.animation.AnimationClock;
import system.windows.media.animation.ByteAnimationBase;
/**
* The base .NET class managing System.Windows.Media.Animation.ByteAnimationBase, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. Extends {@link NetObject}.
* <p>
*
* See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Windows.Media.Animation.ByteAnimationBase" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Windows.Media.Animation.ByteAnimationBase</a>
*/
public class ByteAnimationBase extends AnimationTimeline {
/**
* Fully assembly qualified name: PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
*/
public static final String assemblyFullName = "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35";
/**
* Assembly name: PresentationCore
*/
public static final String assemblyShortName = "PresentationCore";
/**
* Qualified class name: System.Windows.Media.Animation.ByteAnimationBase
*/
public static final String className = "System.Windows.Media.Animation.ByteAnimationBase";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName));
} catch (JCException e) {
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public ByteAnimationBase(Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public Object getJCOInstance() {
return classInstance;
}
public void setJCOInstance(JCObject instance) {
classInstance = instance;
super.setJCOInstance(classInstance);
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link ByteAnimationBase}, a cast assert is made to check if types are compatible.
*/
public static ByteAnimationBase cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new ByteAnimationBase(from.getJCOInstance());
}
// Constructors section
public ByteAnimationBase() throws Throwable {
}
// Methods section
public byte GetCurrentValue(byte defaultOriginValue, byte defaultDestinationValue, AnimationClock animationClock) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.globalization.CultureNotFoundException, system.PlatformNotSupportedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (byte)classInstance.Invoke("GetCurrentValue", defaultOriginValue, defaultDestinationValue, animationClock == null ? null : animationClock.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetObject GetCurrentValue(NetObject defaultOriginValue, NetObject defaultDestinationValue, AnimationClock animationClock) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.NotSupportedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetCurrentValue = (JCObject)classInstance.Invoke("GetCurrentValue", defaultOriginValue == null ? null : defaultOriginValue.getJCOInstance(), defaultDestinationValue == null ? null : defaultDestinationValue.getJCOInstance(), animationClock == null ? null : animationClock.getJCOInstance());
return new NetObject(objGetCurrentValue);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public ByteAnimationBase CloneNewByteAnimationBase() throws Throwable, system.InvalidOperationException, system.ArgumentNullException, system.FormatException, system.ArgumentOutOfRangeException, system.ArgumentException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objClone = (JCObject)classInstance.Invoke("Clone");
return new ByteAnimationBase(objClone);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Properties section
// Instance Events section
} | [
"mario.mastrodicasa@masesgroup.com"
] | mario.mastrodicasa@masesgroup.com |
5be60e75a29eb166bbd6acd7808058b97c0a5d97 | 4fecde4635dcef6185bac75b79d86aca8567ead8 | /subprojects/griffon-core/src/main/java/org/codehaus/griffon/runtime/core/AbstractContext.java | 66a8d1e6ef306aa7711fdd6c879b52e13b651327 | [
"Apache-2.0"
] | permissive | manoliou/griffon | a9d884f770cbad69f682e94c03b9b125c4f277bc | b1a1120f1de285ddb2fc29d9cc1de4f4205820c9 | refs/heads/master | 2021-01-22T17:22:38.121249 | 2015-11-13T00:55:17 | 2015-11-13T00:55:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,184 | java | /*
* Copyright 2008-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.griffon.runtime.core;
import griffon.core.Context;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* @author Andres Almiray
* @since 2.2.0
*/
public abstract class AbstractContext implements Context {
protected Context parentContext;
public AbstractContext(@Nullable Context parentContext) {
this.parentContext = parentContext;
}
@Nullable
@Override
@SuppressWarnings("unchecked")
public <T> T get(@Nonnull String key, @Nullable T defaultValue) {
T value = (T) get(key);
return value != null ? value : defaultValue;
}
@Nullable
@Override
public Object getAt(@Nonnull String key) {
return get(key);
}
@Nullable
@Override
public <T> T getAt(@Nonnull String key, @Nullable T defaultValue) {
return get(key, defaultValue);
}
@Nullable
@Override
public Object get(@Nonnull String key) {
if (hasKey(key)) {
return doGet(key);
} else if (parentContext != null) {
return parentContext.get(key);
} else {
return null;
}
}
@Override
public void destroy() {
parentContext = null;
}
@Override
public boolean containsKey(@Nonnull String key) {
if (hasKey(key)) {
return true;
} else if (parentContext != null) {
return parentContext.containsKey(key);
}
return false;
}
@Nullable
protected abstract Object doGet(@Nonnull String key);
}
| [
"aalmiray@gmail.com"
] | aalmiray@gmail.com |
bb45573f998e86d7521e66e2a6455e2340749cfa | ace322a5ecedca360a8a7271cd84cc13e5b01197 | /forge-gui-mobile/src/forge/assets/FImageComplex.java | 0940104554a45af7a71e6cee195d571fcc928b7b | [] | no_license | diab0l/mtg-forge | 32d4739f99d201b04b81c1b9bfe3a09260f98143 | 3277a0c2e02dabca5b03f365c593e6ce8091e317 | refs/heads/master | 2021-01-17T06:09:49.780171 | 2016-01-26T17:51:32 | 2016-01-26T17:51:32 | 50,458,943 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package forge.assets;
import com.badlogic.gdx.graphics.Texture;
public abstract class FImageComplex implements FImage {
public abstract Texture getTexture();
public abstract int getRegionX();
public abstract int getRegionY();
}
| [
"drdev@269b9781-a132-4a9b-9d4e-f004f1b56b58"
] | drdev@269b9781-a132-4a9b-9d4e-f004f1b56b58 |
76c7573d51127e00293ac3625ed331f0b40b22a9 | 0395727b8993dd033b36badb6ba1b66f186cb261 | /app/src/main/java/com/example/aldiros/myassistant/login.java | 017ef1339504db75a0c2f58aeb2721f73479c463 | [] | no_license | aldiros/myassistantv1 | f62e37e351e6d11b4279ef03a8ef9e9eddb9b349 | 492564c7b8c5f0314c15b9ec3b4a7662af427e22 | refs/heads/master | 2020-03-13T06:04:00.860125 | 2018-04-25T11:33:15 | 2018-04-25T11:33:15 | 130,996,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,061 | java | package com.example.aldiros.myassistant;
import android.app.ProgressDialog;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
public class login extends AppCompatActivity implements View.OnClickListener {
private TextView buttonLogin;
private EditText editTextEmail;
private EditText editTextPassword;
private TextView textViewRegister;
private FirebaseAuth firebaseAuth;
private ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
editTextPassword = (EditText) findViewById(R.id.editTextPassword);
editTextEmail = (EditText) findViewById(R.id.editTextEmail);
buttonLogin = (TextView) findViewById(R.id.buttonLogin);
textViewRegister = (TextView) findViewById(R.id.textViewRegister);
firebaseAuth = FirebaseAuth.getInstance();
if(firebaseAuth.getCurrentUser() != null){
finish();
startActivity(new Intent(getApplicationContext(),home.class));
}
progressDialog= new ProgressDialog(this);
buttonLogin.setOnClickListener(this);
textViewRegister.setOnClickListener(this);
}
private void userLogin(){
String email = editTextEmail.getText().toString().trim();
String password = editTextPassword.getText().toString().trim();
if (TextUtils.isEmpty(email)) {
Toast.makeText(this, "Please enter your email", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(password)) {
Toast.makeText(this, "Please enter your password", Toast.LENGTH_SHORT).show();
return;
}
progressDialog.setMessage("Logging in... ");
progressDialog.show();
firebaseAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
progressDialog.dismiss();
if(task.isSuccessful()){
finish();
startActivity(new Intent(getApplicationContext(),home.class));
}
}
});
}
@Override
public void onClick(View view) {
if(view==buttonLogin){
userLogin();
}
if(view==textViewRegister){
startActivity(new Intent(this, register.class));
}
}
}
| [
"alrostiawan@gmail.com"
] | alrostiawan@gmail.com |
358b50482f4440431304e77d30394ae8a027a253 | e942b0ce544cfcb55897cff1dce1c2ab22ca9f85 | /src/JAC444/src/ca/jay/jac444/week10/sample/observer/Observable.java | 4d2c586f4bbc67c9120bf9154c1049fe4023feb4 | [] | no_license | JongkukLee/JAC444 | e5e5f96fcdf95cf912ed3565cd3cc0e0d22e53ff | ab6feeba90a6c334f5c7fb3756741e7f099ddd27 | refs/heads/master | 2021-08-30T16:29:11.183954 | 2017-12-18T16:43:51 | 2017-12-18T16:43:51 | 105,537,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package ca.jay.jac444.week10.sample.observer;
/************************************************************************
* Compilation: javac Observable.java
*
* The Observable contract of the Observer Design Pattern
*
************************************************************************/
public interface Observable<T> {
/**
* add new observer to the collection of observers
*/
public void registerObserver(Observer<T> o);
/**
* remove an observer from the collection of observers
*/
public void unregisterObserver(Observer<T> o);
/**
* method to inform Observer about its new state
*/
public void notifyObserver();
}
| [
"reevekrjoon2006@gmail.com"
] | reevekrjoon2006@gmail.com |
6e727df8997aff4ab81ff1af84a684a213e0b2b8 | cddfa397136f747f6670508c06d5e33285b6159b | /dictionary-informer/src/main/java/ru/ezhov/dictionary/ApplicationTray.java | d1b359d4931e067442ce7ce68fc67cb31633c7d7 | [
"MIT"
] | permissive | ezhov-da/dictionary | 31c162c11b399ff554ba93a632b2b85747016a55 | 400ef68f0aac9f5cf37b574d3120225a908619c6 | refs/heads/master | 2021-06-23T17:26:30.974514 | 2020-12-12T11:10:42 | 2020-12-12T11:10:42 | 124,290,742 | 0 | 0 | MIT | 2020-12-11T23:08:43 | 2018-03-07T20:29:42 | Java | UTF-8 | Java | false | false | 1,141 | java | package ru.ezhov.dictionary;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
public class ApplicationTray {
private final JFrame frame;
public ApplicationTray(JFrame frame) {
this.frame = frame;
}
public void init() throws AWTException, IOException {
if (SystemTray.isSupported()) {
SystemTray systemTray = SystemTray.getSystemTray();
TrayIcon trayIcon = new TrayIcon(ImageIO.read(getClass().getResource("/dictionary_16x16.png")));
trayIcon.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
// frame.setVisible(!frame.isVisible());
} else if (e.getButton() == MouseEvent.BUTTON3) {
System.exit(0);
}
}
});
systemTray.add(trayIcon);
}
}
}
| [
"ezhdenis@yandex.ru"
] | ezhdenis@yandex.ru |
9265856ea1368375bb61713145f52f243288c87a | ec7ec2a3b91f4688054c9e6b76a0e59c5df5441b | /MyPlaceOrderMS/src/main/java/com/coursecube/dto/OrderItemDTO.java | e68ade8bdd297e38ff861c08499157cc5ab97340 | [] | no_license | lekhrajprasad/mybookstore-v1.1 | b13852cb3bc2d44a1680f44440d3d8b874190fa7 | 41601a08a1758bc93867f6d47c7ef310cd91e63a | refs/heads/main | 2023-02-15T06:00:30.186347 | 2021-01-08T10:37:23 | 2021-01-08T10:37:23 | 310,351,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package com.coursecube.dto;
import java.io.Serializable;
public class OrderItemDTO implements Serializable{
private static final long serialVersionUID = -3659874692302061790L;
private Integer orderItemId;
private Integer orderId;
private Integer bookId;
private int qty;
private double cost;
public OrderItemDTO() {
}
public OrderItemDTO(Integer orderItemId, Integer bookId, int qty, double cost) {
super();
this.orderItemId = orderItemId;
this.bookId = bookId;
this.qty = qty;
this.cost = cost;
}
public Integer getOrderItemId() {
return orderItemId;
}
public void setOrderItemId(Integer orderItemId) {
this.orderItemId = orderItemId;
}
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public Integer getBookId() {
return bookId;
}
public void setBookId(Integer bookId) {
this.bookId = bookId;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
@Override
public String toString() {
return "OrderItem{" +
"orderItemId=" + orderItemId +
", orderId=" + orderId +
", bookId=" + bookId +
", qty=" + qty +
", cost=" + cost +
'}';
}
}
| [
"lekhraj.prasad@gmail.com"
] | lekhraj.prasad@gmail.com |
b1451e4e848e4ef3d808196049b1f44ff0cf8c50 | 99cde8caacfc24c09cf79b459c3c048b317c9ba8 | /Jedi/src/main/java/com/br/jedi/domain/Movie.java | ab34aee9d801e49327897ab4eee39ffbb816b6d8 | [] | no_license | EduardoNofre/BlockJedi | 7f6cf28c1bb0d183cc20ded6f58001db54aadb3f | d500bc30b7ca00b4157f05c4263cb9fa94a71ef2 | refs/heads/master | 2020-04-02T16:26:47.046368 | 2018-10-25T05:03:56 | 2018-10-25T05:03:56 | 154,601,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | java | /*
* Copyright 2009-2014 PrimeTek.
*
* 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.br.jedi.domain;
public class Movie {
private String movie;
private String directedBy;
private String genres;
private int runTime;
public Movie() {}
public Movie(String movie, String directedBy, String genres, int runTime) {
this.movie = movie;
this.directedBy = directedBy;
this.genres = genres;
this.runTime = runTime;
}
public String getMovie() {
return movie;
}
public void setMovie(String movie) {
this.movie = movie;
}
public String getDirectedBy() {
return directedBy;
}
public void setDirectedBy(String directedBy) {
this.directedBy = directedBy;
}
public String getGenres() {
return genres;
}
public void setGenres(String genres) {
this.genres = genres;
}
public int getRunTime() {
return runTime;
}
public void setRunTime(int runTime) {
this.runTime = runTime;
}
}
| [
"nofrereis@gmail.com"
] | nofrereis@gmail.com |
9b3ca464c8b9fbd013fadab4c414d797061ecaeb | e05a290f18b0ae8089709f4fbe92f3f49042daee | /authentication/authentication-core/src/test/java/io/mosip/authentication/core/util/MaskUtilTest.java | 8ba172fa83cd633b257cc8bf40caae2c7c2bf076 | [] | no_license | Aswin-MN/personal | 25e6d6bf306e61a236d0ea886d33ea621bb7dc56 | d096fa6ab16e13a66a82be0325cf4d117d3669f3 | refs/heads/master | 2021-10-11T16:24:08.604019 | 2019-01-28T12:52:41 | 2019-01-28T12:52:41 | 166,238,628 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package io.mosip.authentication.core.util;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* The Class MaskUtilTest.
*
* @author Manoj SP
*
*/
public class MaskUtilTest {
/**
* Test mask email.
*/
@Test
public void testMaskEmail() {
assertEquals("XXaXXhXXh@mail.com", MaskUtil.maskEmail("umamahesh@mail.com"));
}
/**
* Test mask mobile number.
*/
@Test
public void testMaskMobileNumber() {
assertEquals("XXXXXX7890", MaskUtil.maskMobile("1234567890"));
}
@Test
public void testGenerateMaskValue() {
assertEquals("XXXX34654512324", MaskUtil.generateMaskValue("123234654512324", 4));
}
@Test
public void testGenerateMaskValue2() {
assertNotEquals("XXXX34654512324", MaskUtil.generateMaskValue("123234654512324", 8));
}
}
| [
"info@mosip.io"
] | info@mosip.io |
88d141031d5cf739ec14f56aa5be6ca329d0d033 | 764c94d4cf116b0e4d98a38e842e4e6a0468a666 | /ebaysdkcore/src/main/java/com/ebay/soap/eBLBaseComponents/ItemRatingDetailsType.java | a1788d86f614a442c6e6fa4cdd65d6556f87a0f1 | [] | no_license | linus87/ebaysdk | 26dde361dbb75e03fca137eaf6a61c5e892f1303 | 2fb2cbade57ae654fa83ae1b7c5f3e4f741b1fc1 | refs/heads/master | 2023-07-19T10:34:02.644641 | 2021-06-01T13:30:36 | 2021-06-01T13:30:36 | 150,661,586 | 1 | 0 | null | 2023-07-18T06:53:34 | 2018-09-28T00:06:01 | Java | UTF-8 | Java | false | false | 4,807 | java |
package com.ebay.soap.eBLBaseComponents;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.w3c.dom.Element;
/**
*
* Applicable to sites that support the Detailed Seller Ratings feature.
* The <b>ItemRatingDetailsType</b> contains detailed seller ratings for an order line item in one area. When buyers leave an overall Feedback rating (positive, neutral, or negative) for a seller, they also can leave ratings in four areas: item as described, communication, shipping time, and charges for shipping and handling. Users retrieve detailed ratings as averages of the ratings left by buyers.
*
*
* <p>Java class for ItemRatingDetailsType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ItemRatingDetailsType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="RatingDetail" type="{urn:ebay:apis:eBLBaseComponents}FeedbackRatingDetailCodeType" minOccurs="0"/>
* <element name="Rating" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* <any/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ItemRatingDetailsType", propOrder = {
"ratingDetail",
"rating",
"any"
})
public class ItemRatingDetailsType
implements Serializable
{
private final static long serialVersionUID = 12343L;
@XmlElement(name = "RatingDetail")
protected FeedbackRatingDetailCodeType ratingDetail;
@XmlElement(name = "Rating")
protected Integer rating;
@XmlAnyElement(lax = true)
protected List<Object> any;
/**
* Gets the value of the ratingDetail property.
*
* @return
* possible object is
* {@link FeedbackRatingDetailCodeType }
*
*/
public FeedbackRatingDetailCodeType getRatingDetail() {
return ratingDetail;
}
/**
* Sets the value of the ratingDetail property.
*
* @param value
* allowed object is
* {@link FeedbackRatingDetailCodeType }
*
*/
public void setRatingDetail(FeedbackRatingDetailCodeType value) {
this.ratingDetail = value;
}
/**
* Gets the value of the rating property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getRating() {
return rating;
}
/**
* Sets the value of the rating property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setRating(Integer value) {
this.rating = value;
}
/**
*
*
* @return
* array of
* {@link Object }
* {@link Element }
*
*/
public Object[] getAny() {
if (this.any == null) {
return new Object[ 0 ] ;
}
return ((Object[]) this.any.toArray(new Object[this.any.size()] ));
}
/**
*
*
* @return
* one of
* {@link Object }
* {@link Element }
*
*/
public Object getAny(int idx) {
if (this.any == null) {
throw new IndexOutOfBoundsException();
}
return this.any.get(idx);
}
public int getAnyLength() {
if (this.any == null) {
return 0;
}
return this.any.size();
}
/**
*
*
* @param values
* allowed objects are
* {@link Object }
* {@link Element }
*
*/
public void setAny(Object[] values) {
this._getAny().clear();
int len = values.length;
for (int i = 0; (i<len); i ++) {
this.any.add(values[i]);
}
}
protected List<Object> _getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return any;
}
/**
*
*
* @param value
* allowed object is
* {@link Object }
* {@link Element }
*
*/
public Object setAny(int idx, Object value) {
return this.any.set(idx, value);
}
}
| [
"lyan2@ebay.com"
] | lyan2@ebay.com |
2778d40237ae139ca62d5ec28116e69cf19a16fd | 4fe3fae28227272ddbe18009f8a0b08436bc8308 | /ProblemSolving/MiniMaxSum/Solution.java | 32756a414278db10e52351bb02df8419c8e1ecdc | [] | no_license | alexhong2020/HackerRank | 4ec4ce82b6e72efce2fb206cb14f27b712773946 | e900f204703388e87f0816cb1dfb88dc4bdc69a4 | refs/heads/main | 2023-05-12T21:34:37.209476 | 2021-05-28T20:59:01 | 2021-05-28T20:59:01 | 364,686,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,611 | java | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
class Result {
/*
* Complete the 'miniMaxSum' function below.
*
* The function accepts INTEGER_ARRAY arr as parameter.
*/
public static void miniMaxSum(List<Integer> arr) {
// Write your code here
int min = 1000000000;
int max = 1;
long totsum = 0;
long minsum = 0;
long maxsum = 0;
for(int k = 0; k < arr.size(); k++){
if (arr.get(k) < min){
min = arr.get(k);
}
if (arr.get(k) > max){
max = arr.get(k);
}
totsum += arr.get(k);
}
//Tester
//System.out.println(min + " " + max);
minsum = totsum - max;
maxsum = totsum - min;
System.out.println(minsum + " " + maxsum);
}
}
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
List<Integer> arr = Stream.of(bufferedReader.readLine().replaceAll("\\s+$", "").split(" "))
.map(Integer::parseInt)
.collect(toList());
Result.miniMaxSum(arr);
bufferedReader.close();
}
}
| [
"alexhong2020@gmail.com"
] | alexhong2020@gmail.com |
ea59ba3a0f4ba421594e41897dad7d04f8a6edbd | ed396821e6ec86d16eee78adf2b78dd42e12daab | /gwt-d3/gwt-d3-demo/src/main/java/org/gwtd3/demo/client/testcases/selection/TestSelectionAttr.java | 9fbf9935df02d621b1945dc6f2d09ea702f50207 | [] | no_license | anthonime/gwt-d3 | 1c9710c6d7ec66b2bd57a158f19463d6bef3b680 | e0c1901c9cea4bdaf387be313a3fd713699ca242 | refs/heads/master | 2020-05-30T08:06:17.918090 | 2013-06-19T16:59:39 | 2013-06-19T16:59:39 | 9,844,001 | 0 | 1 | null | 2013-05-31T09:32:48 | 2013-05-03T20:27:12 | Java | UTF-8 | Java | false | false | 5,929 | java | package org.gwtd3.demo.client.testcases.selection;
import org.gwtd3.api.D3;
import org.gwtd3.api.core.Datum;
import org.gwtd3.api.core.Selection;
import org.gwtd3.api.functions.DatumFunction;
import org.gwtd3.api.svg.Arc;
import org.gwtd3.api.svg.PathDataGenerator;
import org.gwtd3.demo.client.test.AbstractTestCase;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
public class TestSelectionAttr extends AbstractSelectionTest {
private static final String ATTRIBUTE = "myattr";
@Override
public void doTest(final ComplexPanel sandbox) {
testGetter();
testSetterConstantBoolean();
testSetterConstantDouble();
testSetterConstantString();
testSetterPathDataGenerator();
testSetterFunction();
}
protected void testSetterFunction() {
// works with single selection
Selection selection = givenASimpleSelection(new Label());
final String value = "1";
selection.attr(TestSelectionAttr.ATTRIBUTE, new DatumFunction<String>() {
@Override
public String apply(final Element context, final Datum datum, final int index) {
return value;
}
});
assertEquals(value, getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
// works with multiple selection
Selection selection2 = givenAMultipleSelection(new Label(), new Label(), new Label());
selection2.attr(TestSelectionAttr.ATTRIBUTE, new DatumFunction<String>() {
@Override
public String apply(final Element context, final Datum datum, final int index) {
return value;
}
});
assertEquals(value, getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
assertEquals(value, getElementAttribute(1, TestSelectionAttr.ATTRIBUTE));
assertEquals(value, getElementAttribute(2, TestSelectionAttr.ATTRIBUTE));
}
protected void testSetterConstantString() {
// works with single selection
Selection selection = givenASimpleSelection(new Label());
String value = "1";
selection.attr(TestSelectionAttr.ATTRIBUTE, value);
assertEquals(value, getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
// works with multiple selection
Selection selection2 = givenAMultipleSelection(new Label(), new Label(), new Label());
selection2.attr(TestSelectionAttr.ATTRIBUTE, value);
assertEquals(value, getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
assertEquals(value, getElementAttribute(1, TestSelectionAttr.ATTRIBUTE));
assertEquals(value, getElementAttribute(2, TestSelectionAttr.ATTRIBUTE));
}
protected void testSetterConstantDouble() {
// works with single selection
Selection selection = givenASimpleSelection(new Label());
double value = 3.56;
selection.attr(TestSelectionAttr.ATTRIBUTE, value);
assertEquals("3.56", getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
// works with multiple selection
Selection selection2 = givenAMultipleSelection(new Label(), new Label(), new Label());
selection2.attr(TestSelectionAttr.ATTRIBUTE, value);
assertEquals("3.56", getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
assertEquals("3.56", getElementAttribute(1, TestSelectionAttr.ATTRIBUTE));
assertEquals("3.56", getElementAttribute(2, TestSelectionAttr.ATTRIBUTE));
}
protected void testSetterConstantBoolean() {
boolean value = true;
String expectedValue = "true";
// works with single selection
Selection selection = givenASimpleSelection(new Label());
selection.attr(TestSelectionAttr.ATTRIBUTE, value);
assertEquals(expectedValue, getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
// works with multiple selection
Selection selection2 = givenAMultipleSelection(new Label(), new Label(), new Label());
selection2.attr(TestSelectionAttr.ATTRIBUTE, value);
assertEquals(expectedValue, getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
assertEquals(expectedValue, getElementAttribute(1, TestSelectionAttr.ATTRIBUTE));
assertEquals(expectedValue, getElementAttribute(2, TestSelectionAttr.ATTRIBUTE));
}
protected void testSetterPathDataGenerator() {
PathDataGenerator generator = D3.svg().arc().innerRadius(1).outerRadius(2).startAngle(0).endAngle(2);
// works with single selection
Selection selection = givenASimpleSelection(new Label());
selection.attr(TestSelectionAttr.ATTRIBUTE, generator);
String expectedValue = generator.generate(JavaScriptObject.createArray());
assertEquals(expectedValue, getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
// works with multiple selection
Selection selection2 = givenAMultipleSelection(new Label(), new Label(), new Label());
selection2.attr(TestSelectionAttr.ATTRIBUTE, generator);
assertEquals(expectedValue, getElementAttribute(0, TestSelectionAttr.ATTRIBUTE));
assertEquals(expectedValue, getElementAttribute(1, TestSelectionAttr.ATTRIBUTE));
assertEquals(expectedValue, getElementAttribute(2, TestSelectionAttr.ATTRIBUTE));
}
protected void testGetter() {
// with single selection
Label label = new Label();
label.getElement().setAttribute(TestSelectionAttr.ATTRIBUTE, "foo");
Selection selection = givenASimpleSelection(label);
assertEquals("foo", selection.attr(TestSelectionAttr.ATTRIBUTE));
// with multiple selection, should return the first element
Selection selection2 = givenAMultipleSelection(createLabel(TestSelectionAttr.ATTRIBUTE, "1"), createLabel(TestSelectionAttr.ATTRIBUTE, "2"),
createLabel(TestSelectionAttr.ATTRIBUTE, "3"));
assertEquals("1", selection2.attr(TestSelectionAttr.ATTRIBUTE));
}
private Widget createLabel(final String attr, final String value) {
Label l = new Label();
l.getElement().setAttribute(attr, value);
return l;
}
}
| [
"schiochetanthoni@gmail.com"
] | schiochetanthoni@gmail.com |
710b06e906f5836c538fb09e6928a13e7c825fb0 | fdd2314a49d6bc6487bb958992f283be71f86527 | /project/src/fr/eni/ENIEnchere/ArticleEtat.java | ab4f9b1269a49c6331817e20c057eb5fe8ff9689 | [] | no_license | nathaliejouet/encheres | 2a8442879f6ee4ae3a6f151797aaa177ca649ff5 | 6ff1a3d73bab0f5b4a41a15d3b8308b15c6aec42 | refs/heads/master | 2023-01-31T17:09:14.232909 | 2020-12-16T17:24:48 | 2020-12-16T17:24:48 | 321,672,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package fr.eni.ENIEnchere;
import java.time.format.DateTimeFormatter;
public class ArticleEtat {
public static final String CR = "CR";
public static final String EC = "EC";
public static final String VD = "VD";
public static final String RT = "RT";
public static final String NonOuver = "NO";
public static final String Ouvert = "OV";
public static final String ALL = "";
public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
}
| [
"nathalie.jouet@orange.fr"
] | nathalie.jouet@orange.fr |
90ae2ded991557a7fc0a279de898c22eb70ca2bb | 2cce8f5abc6965a1e664846fbafadaf6d86283bc | /Parrot/src/main/java/com/sajad/parrot/MainActivity.java | dc5bfbd9e584e8277a9f16dc5013cfe472880fae | [] | no_license | sajadbanooie/Parrot | 3e3d8a2770a97e29fea3507786ce828729263ec9 | 2d724af784a25225ff4760512d915a7bf9af72e7 | refs/heads/master | 2020-06-16T18:43:47.825140 | 2015-10-12T17:05:55 | 2015-10-12T17:05:55 | 44,121,604 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package com.sajad.parrot;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"sajadbanooie@gmail.com"
] | sajadbanooie@gmail.com |
239825cc83ee7a0e52c2831cdd377984d50babc9 | ad2fb4630861734f87ceb9cc29d250e6d0ace08f | /Traffic_SI_Project_Webapp/src/main/java/SI_ESEI/Traffic/webapp/VehiclesVM.java | 01470acb67c0cf726e7cf9d63451ae6111042e85 | [] | no_license | hrosalgado/Traffic-JPA | 60412d1389bc9da53ff6ba55553e7eb6663d030a | dcace658cb92627e52c8a99a514acf9b60ab62e9 | refs/heads/master | 2020-07-03T03:13:38.539670 | 2017-01-11T16:56:53 | 2017-01-11T16:56:53 | 74,201,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,759 | java | package SI_ESEI.Traffic.webapp;
import java.util.List;
import javax.persistence.EntityManager;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;
import SI_ESEI.Traffic.Driver;
import SI_ESEI.Traffic.TransactionUtils;
import SI_ESEI.Traffic.Vehicle;
import SI_ESEI.Traffic.webapp.util.DesktopEntityManagerManager;
public class VehiclesVM{
private Vehicle currentVehicle = null;
public Vehicle getCurrentVehicle(){
return currentVehicle;
}
public List<Driver> getDrivers(){
EntityManager em = DesktopEntityManagerManager.getDesktopEntityManager();
return em.createQuery("SELECT d FROM Driver d", Driver.class).getResultList();
}
public List<Vehicle> getVehicles(){
EntityManager em = DesktopEntityManagerManager.getDesktopEntityManager();
return em.createQuery("SELECT v FROM Vehicle v", Vehicle.class).getResultList();
}
@Command
@NotifyChange("vehicles")
public void delete(@BindingParam("v") Vehicle vehicle){
EntityManager em = DesktopEntityManagerManager.getDesktopEntityManager();
TransactionUtils.doTransaction(em, __ -> {
em.remove(vehicle);
});
}
@Command
@NotifyChange("currentVehicle")
public void newVehicle(){
this.currentVehicle = new Vehicle();
}
@Command
@NotifyChange({"vehicles", "currentVehicle", "typeError", "brandError",
"carSpacesError", "passengersError", "antiquityError",
"drivePermissionError", "electricError"})
public void save(){
boolean flag;
int cont = 0;
// Car spaces
if(this.currentVehicle.getCarSpaces() < 1){
this.carSpacesError = "Incorrect value. It must be more than 0.";
cont++;
}else{
this.carSpacesError = "-";
}
// Passengers
if(this.currentVehicle.getPassengers() < 1){
this.passengersError = "Incorrect value. It must be more than 0.";
cont++;
}else if(this.currentVehicle.getPassengers() > this.currentVehicle.getCarSpaces()){
this.passengersError = "Incorrect value. It must be equal or less than vehicle spaces.";
cont++;
}else{
this.passengersError = "-";
}
// Antiquity
if(this.currentVehicle.getAntiquity() < 0){
this.antiquityError = "Incorrect value. It must be equal or more than 0.";
cont++;
}else{
this.antiquityError = "-";
}
// Drive permission
if(!this.currentVehicle.getDrivePermission().toLowerCase().equals("yes")
&& !this.currentVehicle.getDrivePermission().toLowerCase().equals("no")){
this.drivePermissionError = "Incorrect format! Choose between Yes or No";
cont++;
}else{
this.drivePermissionError = "-";
}
// Electric
if(!this.currentVehicle.getElectric().toLowerCase().equals("yes")
&& !this.currentVehicle.getElectric().toLowerCase().equals("no")){
this.electricError = "Incorrect format! Choose between Yes or No";
cont++;
}else{
this.electricError = "-";
}
if(cont == 0){
flag = true;
}else{
flag = false;
}
if(flag){
EntityManager em = DesktopEntityManagerManager.getDesktopEntityManager();
TransactionUtils.doTransaction(em, __ -> {
em.persist(this.currentVehicle);
});
this.currentVehicle = null;
this.typeError = "-";
this.brandError = "-";
this.carSpacesError = "-";
this.passengersError = "-";
this.antiquityError = "-";
this.drivePermissionError = "-";
this.electricError = "-";
}
}
@Command
@NotifyChange({"currentVehicle", "typeError", "brandError",
"carSpacesError", "passengersError", "antiquityError",
"drivePermissionError", "electricError"})
public void cancel(){
this.currentVehicle = null;
this.typeError = "-";
this.brandError = "-";
this.carSpacesError = "-";
this.passengersError = "-";
this.antiquityError = "-";
this.drivePermissionError = "-";
this.electricError = "-";
}
@Command
@NotifyChange("currentVehicle")
public void edit(@BindingParam("v") Vehicle vehicle){
this.currentVehicle = vehicle;
}
// Error messages
private String typeError = "-";
private String brandError = "-";
private String carSpacesError = "-";
private String passengersError = "-";
private String antiquityError = "-";
private String drivePermissionError = "-";
private String electricError = "-";
public String getTypeError(){
return this.typeError;
}
public String getBrandError(){
return this.brandError;
}
public String getCarSpacesError(){
return this.carSpacesError;
}
public String getPassengersError(){
return this.passengersError;
}
public String getAntiquityError(){
return this.antiquityError;
}
public String getDrivePermissionError(){
return this.drivePermissionError;
}
public String getElectricError(){
return this.electricError;
}
} | [
"Héctor Rodríguez Salgado"
] | Héctor Rodríguez Salgado |
c07c65123b3e47afca424e6f7b4da19147be30f5 | 1149bed48c31af06e70ce824b86871fdf9c6b3f5 | /src/main/java/be/ansur/chat/gwt/sample/client/sampleServiceAsync.java | b1a8e35df58722235f2e53762f2bb3295a9b9c54 | [] | no_license | jdmc562/chat | 1c5cb3ecb755524cde4564618b7d724b227bdaf8 | 21fce43da8e3e3415d578fb94d5e87f540c2d7c7 | refs/heads/master | 2020-06-03T00:08:36.548648 | 2011-12-10T15:16:32 | 2011-12-10T15:16:32 | 2,928,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package be.ansur.chat.gwt.sample.client;
import be.ansur.chat.gwt.sample.data.Message;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface sampleServiceAsync {
void getMessage(String msg, AsyncCallback<String> async);
void addMessage(String msg, String user, AsyncCallback<Message[]> async);
void getMessages(String text, AsyncCallback<Message[]> async);
}
| [
"jo@jos-MacBook-Pro.local"
] | jo@jos-MacBook-Pro.local |
738d8cd5c5919502760a140160e3b90a41299882 | 955be2904a17b5818f7127a171b687688e05fdb8 | /src/main/java/org/apache/beam/sdk/io/deltalake/example/delta/DsrDemo01.java | 0d595b4fef58f43743cff141389f0b6a0c31ebca | [
"Apache-2.0"
] | permissive | mbenenso/beam-deltalake-example | 89752bb0fd6c3dab7ff68829fac430834b428ecd | d4234cc6eda1a891e1c158d1c66158d873cfffb4 | refs/heads/main | 2023-07-29T16:52:38.026637 | 2021-09-10T06:45:59 | 2021-09-10T06:45:59 | 400,692,990 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,506 | java | package org.apache.beam.sdk.io.deltalake.example.delta;
import io.delta.standalone.DeltaLog;
import io.delta.standalone.Snapshot;
import io.delta.standalone.data.CloseableIterator;
import io.delta.standalone.data.RowRecord;
import org.apache.hadoop.conf.Configuration;
public class DsrDemo01
{
static final String TABLE_PATH =
"data/delta-lake-stream-03"
;
public static void main(String[] args)
{
Configuration hadoopConfiguration = new Configuration();
/* ------- if reading from aws
hadoopConfiguration.set("fs.s3a.aws.credentials.provider",
"com.amazonaws.auth.profile.ProfileCredentialsProvider");
// ------*/
DeltaLog log = DeltaLog.forTable(hadoopConfiguration, TABLE_PATH);
Snapshot snapshot = log
// .snapshot()
.getSnapshotForVersionAsOf(1)
;
printSnapshotDetails("current snapshot", snapshot);
printRecords(snapshot, 1_000);
System.out.println("----------- completed -------------");
}
public static void printSnapshotDetails(String title, Snapshot snapshot) {
System.out.println("===== " + title + " =====");
System.out.println("version: " + snapshot.getVersion());
System.out.println("number of data files: " + snapshot.getAllFiles().size());
System.out.println("data files:");
snapshot.getAllFiles().forEach(file -> System.out.println(" " + file.getPath()));
}
public static void printRecords(Snapshot snapshot, int printCnt)
{
CloseableIterator<RowRecord> iter = snapshot.open();
System.out.println("\ndata rows:");
RowRecord row = null;
int numRows = 0;
while (iter.hasNext()) {
row = iter.next();
numRows++;
Long id = row.isNullAt("id") ? null : row.getLong("id");
String key = row.getString("key");
String name = row.getString("name");
String data = row.getString("data");
if (numRows < printCnt) {
System.out.println("id=" + id + ", key=" + key + ", name=" + name + ", data: " + data);
} else {
System.out.println("Not all data have been read");
break;
}
}
System.out.println("\nnumber of rows: " + numRows);
System.out.println("data schema:");
System.out.println(row.getSchema().getTreeString());
System.out.println("\n");
}
}
| [
"Mikhail_Benenson@intuit.com"
] | Mikhail_Benenson@intuit.com |
2edaa28b4eaa0f4a5bc72f2f05138a03ee82ff68 | 4e8d52f594b89fa356e8278265b5c17f22db1210 | /WebServiceArtifacts/XigniteHistorical/com/xignite/services/QueryByTypes.java | 74b19b01e9c70fb41f25f26d74605ec7cfe00037 | [] | no_license | ouniali/WSantipatterns | dc2e5b653d943199872ea0e34bcc3be6ed74c82e | d406c67efd0baa95990d5ee6a6a9d48ef93c7d32 | refs/heads/master | 2021-01-10T05:22:19.631231 | 2015-05-26T06:27:52 | 2015-05-26T06:27:52 | 36,153,404 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java |
package com.xignite.services;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for QueryByTypes.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="QueryByTypes">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="ExDate"/>
* <enumeration value="RecordDate"/>
* <enumeration value="PaymentDate"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "QueryByTypes")
@XmlEnum
public enum QueryByTypes {
@XmlEnumValue("ExDate")
EX_DATE("ExDate"),
@XmlEnumValue("RecordDate")
RECORD_DATE("RecordDate"),
@XmlEnumValue("PaymentDate")
PAYMENT_DATE("PaymentDate");
private final String value;
QueryByTypes(String v) {
value = v;
}
public String value() {
return value;
}
public static QueryByTypes fromValue(String v) {
for (QueryByTypes c: QueryByTypes.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"ouni_ali@yahoo.fr"
] | ouni_ali@yahoo.fr |
14a08b3fa1abe32353ce11ba9a814a7c539c4363 | 16d1ebb6f1aba6ce5bdad50dcade96a36c550ec6 | /src/main/java/blog/com/domain/persistence/HibernateBlogDao.java | 54f537d1bbde5145c92c5edf7ac391f1016fd11d | [] | no_license | DolgOverflow/webapp | 3888a94685cb93df414422b56ab6bf87cc539dd8 | bfe09d86ae079c31e46fe0fc344c2c7a24de7323 | refs/heads/master | 2022-01-25T00:01:12.980272 | 2019-10-28T18:19:17 | 2019-10-28T18:19:17 | 216,424,450 | 0 | 0 | null | 2022-01-21T23:32:53 | 2019-10-20T20:39:37 | Java | UTF-8 | Java | false | false | 1,890 | java | package blog.com.domain.persistence;
import blog.com.domain.domain.Author;
import blog.com.domain.domain.Message;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class HibernateBlogDao implements BlogDAO {
private SessionFactory sessionFactory;
@Autowired
public HibernateBlogDao(SessionFactory sessionFactory) {//<co id="co_injectSessionFactory"/>
this.sessionFactory = sessionFactory;
}
private Session currentSession() {
return sessionFactory.getCurrentSession();
}
@Override
public void addAuthor(Author author) {
currentSession().save(author);
}
@Override
public void saveAuthor(Author author) {
currentSession().update(author);
}
@Override
public Author getAuthorById(long id) {
return (Author) currentSession().get(Author.class, id);
}
@Override
public List<Message> getRecentMessage() {
return null;
}
@Override
public void saveMessage(Message message) {
currentSession().save(message);
}
@Override
public List<Message> getMessageForAuthor(Author author) {
return null;
}
@Override
public Author getAuthorByUsername(String username) {
return null;
}
@Override
public void deleteMessage(long id) {
currentSession().delete(getMessageById(id));
}
@Override
public Message getMessageById(long id) {
return currentSession().get(Message.class, id);
}
@Override
public List<Author> findAllAuthors() {
return null;
}
} | [
"aaadolgov@gmail.com"
] | aaadolgov@gmail.com |
e1567695633eb1e4dfd6063d9c647aca93d97dc2 | 988bb999799fec52f194d8f589b3f2745846bb48 | /Yaroslav_Halindzovskiy/src/main/java/spring/homework14/dao/LaptopDAOimp.java | 0bc0d5c17ba8fbc4bcbf26e6ff9ad79f414f33d3 | [] | no_license | Aleks1696/Pro_007 | 91bf83cfda07ad20e2a1b714770649df04e0eb00 | 80af6e5484051315a24170ef7623c39705714514 | refs/heads/master | 2020-04-11T19:08:18.542778 | 2019-01-11T22:13:09 | 2019-01-11T22:13:09 | 162,023,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package spring.homework14.dao;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import spring.homework14.entity.Laptop;
import javax.transaction.Transactional;
import java.util.List;
@Repository
@Transactional
public class LaptopDAOimp implements LaptopDAO {
private SessionFactory factory;
@Autowired
public LaptopDAOimp(SessionFactory factory) {
this.factory = factory;
}
@Override
public Long create(Laptop laptop) {
return (Long) factory.getCurrentSession().save(laptop);
}
@Override
public Laptop read(Long id) {
return factory.getCurrentSession().get(Laptop.class,id);
}
@Override
public void update(Laptop laptop) {
factory.getCurrentSession().update(laptop);
}
@Override
public void delete(Laptop laptop) {
factory.getCurrentSession().delete(laptop);
}
@Override
public List<Laptop> findAll() {
return factory.getCurrentSession().createCriteria(Laptop.class).list();
}
}
| [
"kaon1999@gmail.com"
] | kaon1999@gmail.com |
85d529ee2985835717309dd6786a047e084e512d | 9e0e371eb72e3908ce3ffe994402df5852c6416e | /desktop/src/np/info/sagardevkota/dice/desktop/DesktopLauncher.java | b2747742878b452c1a795323c00bc3dea85d8a0a | [
"Apache-2.0"
] | permissive | duchien85/Dice-LibGDX | fc8a85b76e63910cdc72037e00f78b348c593337 | 683c3573979e0a80b2d634db9a7f90536b2d10e7 | refs/heads/master | 2021-02-27T05:02:57.466774 | 2019-01-10T10:59:47 | 2019-01-10T10:59:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package np.info.sagardevkota.dice.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import np.info.sagardevkota.dice.Dice;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new Dice(), config);
}
}
| [
"info@devkotasagar.com.np"
] | info@devkotasagar.com.np |
d2f233eccc17a9f7cca90a1a9a09177c3c4c39ba | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/validation/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGeneratorMetaTest.java | 74211872d2842d2368c160b042acbc1f84044de1 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 1,790 | java | /**
* ! ******************************************************************************
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.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 org.pentaho.di.trans.steps.symmetriccrypto.secretkeygenerator;
import org.junit.ClassRule;
import org.junit.Test;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment;
import org.pentaho.di.trans.step.StepMetaInterface;
import org.pentaho.di.trans.steps.loadsave.LoadSaveTester;
import org.pentaho.di.trans.steps.loadsave.initializer.InitializerInterface;
public class SecretKeyGeneratorMetaTest implements InitializerInterface<StepMetaInterface> {
LoadSaveTester loadSaveTester;
Class<SecretKeyGeneratorMeta> testMetaClass = SecretKeyGeneratorMeta.class;
@ClassRule
public static RestorePDIEngineEnvironment env = new RestorePDIEngineEnvironment();
@Test
public void testSerialization() throws KettleException {
loadSaveTester.testSerialization();
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
bc4953891f96b3b0546589d8010fc93501d69d0f | 0277f8e6c0c5b5f2a6ad894e9cfac4618da89b1a | /users/src/main/java/com/artventory/distinktiv/service/ProfileService.java | c9fc1af028b97e631efa1121555fa877650534aa | [] | no_license | distinktiv/artventory | 17d1922c49600d92b8403db4130e89f78f831f12 | 91309ee14e5663d86cf85b35674818ab3897764c | refs/heads/master | 2021-01-09T05:57:20.158828 | 2017-04-26T11:30:15 | 2017-04-26T11:30:15 | 80,873,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.artventory.distinktiv.service;
import com.artventory.distinktiv.domaine.Profile;
import java.util.Collection;
public interface ProfileService {
Profile getProfileByName(String name);
Collection<Profile> getAllProfile();
Profile createProfile(Profile profile);
}
| [
"spierre@cta8.net"
] | spierre@cta8.net |
171c092fa0db0709d51ff832b57eb5d63b4b1ee9 | dbaa141029a9faa7db0b5ee3da7ac52af81ab47c | /app/src/main/java/com/innova/care4u/Login.java | 2850d301c95d9325045170d8c8202f4c55e42060 | [] | no_license | rafay-ah/Care4U | bcb13fdda470b32f748929a438d924b997e1e2ff | 5495016ec10f187ca9eff9e9c7d45879ca05cf40 | refs/heads/master | 2023-05-30T11:26:35.568462 | 2021-06-09T17:20:21 | 2021-06-09T17:20:21 | 373,941,548 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 871 | java | package com.innova.care4u;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import com.innova.care4u.fingerPrintDeals.FingerPrintActivity;
public class Login extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// make it full screen first screen after splash
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.login_activity);
}
public void authenticate(View view) {
startActivity(new Intent(Login.this, FingerPrintActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
}
} | [
"54492363+rafay-ah@users.noreply.github.com"
] | 54492363+rafay-ah@users.noreply.github.com |
5018feeccb4cb9c9c056051a14e62799f089ad07 | 5be8d7b961b0da14bdd6386c568340b499565713 | /src/main/java/com/himanshu/practice/oct/oct24/B.java | d849a550d9894805ca3f67ae5557004975fcf671 | [] | no_license | HimanshuBhardwaj/AdvancePractice | a5ae3b0a19a9a473fa738e61edd00ca33214a258 | 33a1448e70360ba12b96e2a0eb254549b1ef535a | refs/heads/master | 2022-06-06T10:16:28.448206 | 2020-02-11T08:57:13 | 2020-02-11T08:57:13 | 197,032,196 | 0 | 0 | null | 2022-05-20T21:18:39 | 2019-07-15T16:10:16 | Java | UTF-8 | Java | false | false | 3,463 | java | package com.himanshu.practice.oct.oct24;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
/**
* Created by himanshubhardwaj on 24/10/19.
*/
public class B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
PrintWriter pw = new PrintWriter(System.out);
Comparator<Integer> comparator = new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o1 % 2 - o2 % 2;
}
};
while (t-- > 0) {
int n = Integer.parseInt(br.readLine());
Integer[] charfreq = new Integer[2];
charfreq[0] = 0;
charfreq[1] = 0;
int a = 0;
int b = 0;
Integer[] size = new Integer[n];
int oddCount = 0;
for (int i = 0; i < n; i++) {
String str = br.readLine();
for (char c : str.toCharArray()) {
charfreq[c - '0']++;
}
if ((str.length() % 2) == 0) {
a++;
} else {
b++;
oddCount++;
}
}
charfreq[0] = charfreq[0] % 2;
charfreq[1] = charfreq[1] % 2;
a = a % 2;
b = b % 2;
if (charfreq[0] == 0) {
if (charfreq[1] == 0) {
pw.append(n + "\n");
} else {
if (b % 2 == 1) {
pw.append(n + "\n");
} else {
pw.append((n - 1) + "\n");
}
}
} else {
if (charfreq[1] == 0) {
if (b % 2 == 1) {
pw.append(n + "\n");
} else {
pw.append((n - 1) + "\n");
}
} else {
if (oddCount == 1) {
pw.append((n - 1) + "\n");
} else if (oddCount == 0) {
pw.append((n - 1) + "\n");
} else {
charfreq[0] = 0;
charfreq[1] = 0;
pw.append(n + "\n");
}
}
}
}
pw.flush();
pw.close();
}
private static String maximumPalindrome(Integer[] charfreq, Integer[] size) {
for (int x : size) {
System.out.print(x + " ");
}
System.out.println();
int count = 0;
for (int i = 0; i < size.length; i++) {
Arrays.sort(charfreq, Collections.reverseOrder());
if (size[i] <= charfreq[0]) {
charfreq[0] -= size[i];
count++;
} else if (size[i] <= charfreq[1]) {
charfreq[1] -= size[i];
count++;
} else {
if ((((charfreq[0] % 2) + (charfreq[1] % 2))) == (size[i] % 2)) {
count++;
}
}
}
return count + "\n";
}
}
| [
"himanshubhardwaj169@gmail.com"
] | himanshubhardwaj169@gmail.com |
f8a1ea8569d484dc8dc63e0dc57702ef5c1a8a4e | 1d48ada95138ac2944c50c7263560b28468a0938 | /demo-core/src/main/java/com/spatome/demo/core/util/SUtil.java | 5ed01501dd5d13a4dc42c4018c08ca876ac146fc | [] | no_license | spatome/springcloud-demo | 3f40eed7dbd3758d62cfb4bd7ffb7ae3c221dcca | 4e0473c40be7759dfbe27e8d1a437c87a297e9db | refs/heads/master | 2020-04-02T13:17:55.758506 | 2018-11-29T10:38:09 | 2018-11-29T10:38:09 | 153,415,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | package com.spatome.demo.core.util;
import java.math.BigDecimal;
import java.util.UUID;
import java.util.regex.Pattern;
/**
* @ClassName: SUtil
* @Description: TODO
* @author: zhangwei
* @date: 2017年9月27日 下午5:30:27
*/
public class SUtil {
/**
* @Description: 生成流水号
*/
public static String createNumberNo() {
String result = "";
int machineId = 1;// 最大支持1-9个集群机器部署
int hashCodeV = UUID.randomUUID().toString().hashCode();
if (hashCodeV < 0) {// 有可能是负数
hashCodeV = -hashCodeV;
}
// 0 代表前面补充0
// 4 代表长度为4
// d 代表参数为正数型
result = machineId + String.format("%015d", hashCodeV);
return result;
}
public static boolean isInteger(String str){
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
return pattern.matcher(str).matches();
}
public static boolean isAmount(String str){
try {
new BigDecimal(str);
return true;
} catch (Exception e) {
return false;
}
}
public static String NTS(String s){
return s==null?"":s;
}
public static String NTS(Integer s){
return s==null?"":String.valueOf(s);
}
public static String NTS(Long s){
return s==null?"":String.valueOf(s);
}
public static void main(String[] args) {
}
} | [
"spatome@126.com"
] | spatome@126.com |
526cff0d728b5ddad152afefc43c8b0ef3aa974d | e8b30e8d11fa6d94f4c2f8ffbbdf5477067b7608 | /src/core/scene/Component.java | fed36ae4cbdf9c2bd016940b12132c01113d796f | [] | no_license | proton2/Simple-java-dual-contouring | 17eb8914fc8196196fc7e5c16630cd904c46bb6a | a29f5bbd82029ba5a6d2ef7467543af19f400e9c | refs/heads/master | 2023-07-08T19:12:10.408812 | 2021-08-19T10:54:08 | 2021-08-19T10:54:08 | 280,702,311 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package core.scene;
import core.math.Transform;
public abstract class Component{
private GameObject parent;
public void update(){};
public void input(){};
public void render(){};
public GameObject getParent() {
return parent;
}
public void setParent(GameObject parent) {
this.parent = parent;
}
public Transform getTransform()
{
return getParent().getTransform();
}
} | [
"proton2@mail.ru"
] | proton2@mail.ru |
6f66d3eefbdb1e247fb60576a288cfbfdbf07e7e | 5e6b4b24532f9614b5198af1c8f883cf548de5e7 | /corridoorGraph_java/Graph.java | da0eba20dffc66a81cd3d3a28716c0e38841dbe6 | [] | no_license | cc9431/Robotics_and_Perception | ca5da8d3899e80d6c80642e57f2e116c3cd7a389 | c08974dcab5508b086117660c403fbfd64f6d9a3 | refs/heads/master | 2020-05-21T08:35:07.299938 | 2017-09-15T20:44:31 | 2017-09-15T20:44:31 | 84,605,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,825 | java | /*Originally from http://algs4.cs.princeton.edu/code/ by Sedgewick and Wane,
modified by Elias Posen and Charles Calder*/
class Graph {
private final String NEWLINE = System.getProperty("line.separator");
private final int V;
private int E;
private Bag<Integer>[] adj;
private int[][] xy;
private int[][] pxy;
private String [] cluster_c;
private int [][] neighbor;
private int node_width;
private int node_height;
public Graph(int V, int h, int w) {
if (V < 0) throw new IllegalArgumentException("Number of vertices must be non-negative!!!");
this.V = V;
this.E = 0;
node_width = w;
node_height = h;
adj = (Bag<Integer>[]) new Bag[V];
cluster_c = new String [V];
xy = new int[V][2]; //Physical xy coordinate field of graph
pxy = new int[V][2]; //Pixel coordinate field of graph
neighbor = new int [V][4];
for (int v = 0; v < V; v++) {
adj[v] = new Bag<Integer>();
}
}
public void makeNeighbor(int node, boolean above, boolean below, boolean right, boolean left) {
if (above) neighbor[node][0] = node - 1;
else neighbor[node][0] = -1;
if (below) neighbor[node][1] = node + 1;
else neighbor[node][1] = -1;
if (right) neighbor[node][2] = node + node_height;
else neighbor[node][2] = -1;
if (left) neighbor[node][3] = node - node_height;
else neighbor[node][3] = -1;
}
public int[] getNeighbor(int node) {
return neighbor[node];
}
public void setPixelPos(int node, int x, int y) {
pxy[node][0]=x;
pxy[node][1]=y;
}
public int[] getPPos(int node) {
return pxy[node];
}
public void setPos(int node, int x, int y) {
xy[node][0]=x;
xy[node][1]=y;
}
public int[] getPos(int node) {
return xy[node];
}
public void setColor(int node, String c) {
cluster_c[node] = c;
}
public String getColor(int node) {
return cluster_c[node];
}
public int V() {
return V;
}
public int E() {
return E;
}
private void validateVertex(int v) {
if (v < 0 || v >= V)
throw new IndexOutOfBoundsException("vertex " + v + " is not between 0 and " + (V-1));
}
public void addEdge(int v, int w) {
validateVertex(v);
validateVertex(w);
E++;
adj[v].add(w);
//adj[w].add(v);
}
//public void removeEdges(int v)
public Iterable<Integer> adj(int v) {
validateVertex(v);
return adj[v];
}
public int degree(int v) {
validateVertex(v);
return adj[v].size();
}
public String toString() {
StringBuilder s = new StringBuilder();
s.append(V + " vertices, " + E + " edges " + NEWLINE);
for (int v = 0; v < V; v++) {
s.append(v + ": ");
for (int w : adj[v]) {
s.append(w + " ");
}
s.append(NEWLINE);
}
return s.toString();
}
} | [
"cc9431@bard.edu"
] | cc9431@bard.edu |
85f989bbd20c92c349e5b9c206b07eab64b5083b | 022115152e021c24bb376418327e5c50d30a11ff | /src/main/java/com/jt/baimo/pw/util/DesUtil.java | 15c2f7e3a7a32aac40d6d1ce8cd1d313974642fc | [] | no_license | whx123github/bmpw | 5becddc944b7f234ac1192490063796f39fccb48 | 8ef9d00eb3260032c8069ebe719c66280985e156 | refs/heads/master | 2023-08-09T14:49:50.693522 | 2019-10-23T05:22:25 | 2019-10-23T05:22:25 | 215,945,908 | 0 | 0 | null | 2023-07-22T19:06:19 | 2019-10-18T05:13:09 | Java | UTF-8 | Java | false | false | 2,438 | java | package com.jt.baimo.pw.util;
import com.google.common.html.HtmlEscapers;
import org.apache.commons.lang.StringEscapeUtils;
import org.junit.Test;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;
import java.security.Key;
import java.util.Base64;
public class DesUtil {
public final static String AIR_TICKET_SECRET_KEY = "baimoticket123456789baimo0"; // 密钥
private final static String IV = "01234567"; // 向量
private final static String ENCODING = "utf-8";// 加解密统一使用的编码方式
private final static String INSTANCE_VALUE = "desede";
private final static String CIPHER_INSTANCE_VALUE = "desede/CBC/PKCS5Padding";
public static String encode(String key, String plainText) {
Key deskey = null;
try {
DESedeKeySpec spec = new DESedeKeySpec(key.getBytes());
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance(INSTANCE_VALUE);
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance(CIPHER_INSTANCE_VALUE);
IvParameterSpec ips = new IvParameterSpec(IV.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, deskey, ips);
byte[] encryptData = cipher.doFinal(plainText.getBytes(ENCODING));
return Base64.getEncoder().encodeToString(encryptData);
} catch (Exception e) {
e.printStackTrace();
return plainText;
}
}
/**
* 3DES解密
*
* @param encryptText 加密文本
* @return
* @throws Exception
*/
public static String decode(String key, String encryptText) {
Key deskey = null;
try {
DESedeKeySpec spec = new DESedeKeySpec(key.getBytes());
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance(INSTANCE_VALUE);
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance(CIPHER_INSTANCE_VALUE);
IvParameterSpec ips = new IvParameterSpec(IV.getBytes());
cipher.init(Cipher.DECRYPT_MODE, deskey, ips);
byte[] decryptData = cipher.doFinal(Base64.getDecoder().decode(encryptText));
return new String(decryptData, ENCODING);
} catch (Exception e) {
e.printStackTrace();
return encryptText;
}
}
} | [
"wanghongxingwhx@126.com"
] | wanghongxingwhx@126.com |
834892862e49ab113ecdc07eea2139f81c6202a2 | 7b362df98712434fb25028a3439f852ec14871c0 | /sort/src/net/jcip/examples/ThreadPerTaskWebServer.java | 232461aeae8e5b173066ab44de2f771334892895 | [] | no_license | cdjjzz/sort | 02da0bec18c3817f6d53946d708532689b1e2276 | f905f242b62642e53139de34ace87afe95842eaa | refs/heads/master | 2021-01-02T15:35:05.536047 | 2018-05-10T06:11:25 | 2018-05-10T06:11:25 | 99,303,657 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,998 | java | package net.jcip.examples;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.Charset;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
/**
* ThreadPerTaskWebServer
* <p/>
* Web server that starts a new thread for each request
*
* @author Brian Goetz and Tim Peierls
*/
public class ThreadPerTaskWebServer {
private static AtomicInteger atomicInteger=new AtomicInteger(0);
private static ExecutorService executor=Executors.newFixedThreadPool(5);
private static Executor executor2=Executors.newFixedThreadPool(10);
public static void main(String[] args) throws IOException {
ServerSocket socket = new ServerSocket(80);
while (true) {
final Socket connection = socket.accept();
Runnable task = new Runnable() {
public void run() {
try {
handleRequest(connection);
} catch (IOException e) {
e.printStackTrace();
}
}
};
//一个请求启用一个线程
// new Thread(task).start();
//使用线程池 复用线程
// executor.execute(task);
executor.submit(task);
}
}
private static void handleRequest(Socket connection) throws IOException {
// request-handling logic here
System.out.println(connection.getLocalPort());
System.out.println(connection.getSoLinger());
BufferedOutputStream bufferedOutputStream=new BufferedOutputStream(connection.getOutputStream());
Writer writer=new OutputStreamWriter(bufferedOutputStream);
writer.write(Thread.currentThread().getName()+"我是罗盛丰:"+atomicInteger.getAndIncrement());
writer.close();
}
}
| [
"pet-lsf@LAPTOP-RKULFE8M"
] | pet-lsf@LAPTOP-RKULFE8M |
1b37c7f3c3344782f559f377ee899f58fc778d0f | a5d76b1d7f50cf7df642867c24b4a47075edbb06 | /Bryans Java Workspace/Assignment 5.2/src/King.java | 74f48b14ad61b4933ef082dc9e08e0fc8f6d4867 | [] | no_license | bryanjamesmiller/Classwork | f7b25e7a596e46131fecd50d53157492df3e7903 | ae8954097e703aa753de4854b9a6508d39b3df3c | refs/heads/master | 2016-08-11T19:36:35.245840 | 2014-12-23T19:00:18 | 2014-12-23T19:00:18 | 47,785,538 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | /**
* This class allows for a king's moves to be
* simulated on a chess board
*
* @author Bryan Miller and Dr. Leitner
* @version Last modified on 2/25/2014
**/
import java.lang.Math;
class King extends Piece
{
boolean attackingThisLocation (int indexRow, int indexColumn)
{
int columnDiff = pieceColumn - indexColumn;
int rowDiff = pieceRow - indexRow;
if((columnDiff==0 && Math.abs(rowDiff)==1
|| Math.abs(columnDiff)==1 && rowDiff==0))
return true;
if (((columnDiff + rowDiff == 0) || (columnDiff == rowDiff))
&& (Math.abs(columnDiff)<=1 && Math.abs(rowDiff)<=1))
return true;
return false;
}
} | [
"bryanjamesmiller@fas.harvard.edu"
] | bryanjamesmiller@fas.harvard.edu |
d86709a0e75c570049c12adc5ee0afec7879a193 | 37052cc5ff6a572592d0de5c9100df17f593e53a | /music/src/de/dnb/music/visitor/package-info.java | 6d5cc05a8a820f0b5bce70430dadbf6fc4619a1f | [] | no_license | cbdnb/cb-musi-proj | 7e773ec1e7980e3e8526fc5d541720d2ed45936c | 7a1e91181ea28f9f8ac8e25f0c1514249ecda4d9 | refs/heads/master | 2021-05-16T02:52:42.438294 | 2013-10-05T21:44:16 | 2013-10-05T21:44:16 | 42,174,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,086 | java | /**
*
* Leichte Modifikation des Visitor-Musters gegenüber GoF:
* - statt visitConcreteElementX(concreteElementX) wird nur
* visit(concreteElementX) gewählt.
* Das funktioniert, da visit für jede ConcreteElementX-Klasse
* überladen ist.
* - Visitor ist nicht Interface, sondern abstrakte Klasse. Daher ist es
* möglich, in Visitor jede dieser überladenen Methoden visit()
* rudimentär zu imlementieren.
* - Die Knoten und Blätter der MusicTitle-Struktur imlementieren
* TitleElement.
* - ConcreteElementX.accept(Visitor) entscheidet, in welcher Reihenfolge
* die Kindelemente des Knotens durchlaufen werden. Es gibt keinen
* Iterator.
* - Nachdem die Kindelemente besucht worden sind, wird leave(concreteElementX)
* aufgerufen. Das müssen aber nur innere Knoten machen.
* - Die Methode visit() liefert dann, wenn Kindelemente vorliegen, einen
* boolschen Wert zurück, der es accept() erlaubt, zu entscheiden,
* ob die Kindelemente überhaupt besucht werden müssen.
*
*/
package de.dnb.music.visitor;
| [
"k.c.baumann@t-online.de"
] | k.c.baumann@t-online.de |
0231d67c76d43cec0185b075ac966ba616801c8b | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project82/src/main/java/org/gradle/test/performance/largejavamultiproject/project82/p412/Production8243.java | efda249ebb3c534497bc742d3fa5d61f0e414e98 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,959 | java | package org.gradle.test.performance.largejavamultiproject.project82.p412;
public class Production8243 {
private Production8240 property0;
public Production8240 getProperty0() {
return property0;
}
public void setProperty0(Production8240 value) {
property0 = value;
}
private Production8241 property1;
public Production8241 getProperty1() {
return property1;
}
public void setProperty1(Production8241 value) {
property1 = value;
}
private Production8242 property2;
public Production8242 getProperty2() {
return property2;
}
public void setProperty2(Production8242 value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
e6c5c77f73e2cbb5366e76d72062dad0265e12da | 146a30bee123722b5b32c0022c280bbe7d9b6850 | /depsWorkSpace/bc-java-master/core/src/test/java/org/mightyfish/crypto/tls/test/MockTlsClient.java | 2f792d4a7fa1ecf4668a4a2ebd274bfc81cb7387 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | GLC-Project/java-experiment | 1d5aa7b9974c8ae572970ce6a8280e6a65417837 | b03b224b8d5028dd578ca0e7df85d7d09a26688e | refs/heads/master | 2020-12-23T23:47:57.341646 | 2016-02-13T16:20:45 | 2016-02-13T16:20:45 | 237,313,620 | 0 | 1 | null | 2020-01-30T21:56:54 | 2020-01-30T21:56:53 | null | UTF-8 | Java | false | false | 6,496 | java | package org.mightyfish.crypto.tls.test;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Hashtable;
import java.util.Vector;
import org.mightyfish.asn1.x509.Certificate;
import org.mightyfish.crypto.tls.AlertDescription;
import org.mightyfish.crypto.tls.AlertLevel;
import org.mightyfish.crypto.tls.CertificateRequest;
import org.mightyfish.crypto.tls.ClientCertificateType;
import org.mightyfish.crypto.tls.DefaultTlsClient;
import org.mightyfish.crypto.tls.MaxFragmentLength;
import org.mightyfish.crypto.tls.ProtocolVersion;
import org.mightyfish.crypto.tls.SignatureAlgorithm;
import org.mightyfish.crypto.tls.SignatureAndHashAlgorithm;
import org.mightyfish.crypto.tls.TlsAuthentication;
import org.mightyfish.crypto.tls.TlsCredentials;
import org.mightyfish.crypto.tls.TlsExtensionsUtils;
import org.mightyfish.crypto.tls.TlsSession;
import org.mightyfish.util.Arrays;
import org.mightyfish.util.encoders.Hex;
class MockTlsClient
extends DefaultTlsClient
{
TlsSession session;
MockTlsClient(TlsSession session)
{
this.session = session;
}
public TlsSession getSessionToResume()
{
return this.session;
}
public void notifyAlertRaised(short alertLevel, short alertDescription, String message, Throwable cause)
{
PrintStream out = (alertLevel == AlertLevel.fatal) ? System.err : System.out;
out.println("TLS client raised alert: " + AlertLevel.getText(alertLevel)
+ ", " + AlertDescription.getText(alertDescription));
if (message != null)
{
out.println("> " + message);
}
if (cause != null)
{
cause.printStackTrace(out);
}
}
public void notifyAlertReceived(short alertLevel, short alertDescription)
{
PrintStream out = (alertLevel == AlertLevel.fatal) ? System.err : System.out;
out.println("TLS client received alert: " + AlertLevel.getText(alertLevel)
+ ", " + AlertDescription.getText(alertDescription));
}
// public int[] getCipherSuites()
// {
// return Arrays.concatenate(super.getCipherSuites(),
// new int[]
// {
// CipherSuite.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
// CipherSuite.TLS_ECDHE_RSA_WITH_ESTREAM_SALSA20_SHA1,
// CipherSuite.TLS_ECDHE_RSA_WITH_SALSA20_SHA1,
// CipherSuite.TLS_RSA_WITH_ESTREAM_SALSA20_SHA1,
// CipherSuite.TLS_RSA_WITH_SALSA20_SHA1,
// });
// }
public Hashtable getClientExtensions() throws IOException
{
Hashtable clientExtensions = TlsExtensionsUtils.ensureExtensionsInitialised(super.getClientExtensions());
TlsExtensionsUtils.addEncryptThenMACExtension(clientExtensions);
// TODO[draft-ietf-tls-session-hash-01] Enable once code-point assigned (only for compatible server though)
// TlsExtensionsUtils.addExtendedMasterSecretExtension(clientExtensions);
TlsExtensionsUtils.addMaxFragmentLengthExtension(clientExtensions, MaxFragmentLength.pow2_9);
TlsExtensionsUtils.addTruncatedHMacExtension(clientExtensions);
return clientExtensions;
}
public void notifyServerVersion(ProtocolVersion serverVersion) throws IOException
{
super.notifyServerVersion(serverVersion);
System.out.println("TLS client negotiated " + serverVersion);
}
public TlsAuthentication getAuthentication()
throws IOException
{
return new TlsAuthentication()
{
public void notifyServerCertificate(org.mightyfish.crypto.tls.Certificate serverCertificate)
throws IOException
{
Certificate[] chain = serverCertificate.getCertificateList();
System.out.println("TLS client received server certificate chain of length " + chain.length);
for (int i = 0; i != chain.length; i++)
{
Certificate entry = chain[i];
// TODO Create fingerprint based on certificate signature algorithm digest
System.out.println(" fingerprint:SHA-256 " + TlsTestUtils.fingerprint(entry) + " ("
+ entry.getSubject() + ")");
}
}
public TlsCredentials getClientCredentials(CertificateRequest certificateRequest)
throws IOException
{
short[] certificateTypes = certificateRequest.getCertificateTypes();
if (certificateTypes == null || !Arrays.contains(certificateTypes, ClientCertificateType.rsa_sign))
{
return null;
}
SignatureAndHashAlgorithm signatureAndHashAlgorithm = null;
Vector sigAlgs = certificateRequest.getSupportedSignatureAlgorithms();
if (sigAlgs != null)
{
for (int i = 0; i < sigAlgs.size(); ++i)
{
SignatureAndHashAlgorithm sigAlg = (SignatureAndHashAlgorithm)
sigAlgs.elementAt(i);
if (sigAlg.getSignature() == SignatureAlgorithm.rsa)
{
signatureAndHashAlgorithm = sigAlg;
break;
}
}
if (signatureAndHashAlgorithm == null)
{
return null;
}
}
return TlsTestUtils.loadSignerCredentials(context, new String[] { "x509-client.pem", "x509-ca.pem" },
"x509-client-key.pem", signatureAndHashAlgorithm);
}
};
}
public void notifyHandshakeComplete() throws IOException
{
super.notifyHandshakeComplete();
TlsSession newSession = context.getResumableSession();
if (newSession != null)
{
byte[] newSessionID = newSession.getSessionID();
String hex = Hex.toHexString(newSessionID);
if (this.session != null && Arrays.areEqual(this.session.getSessionID(), newSessionID))
{
System.out.println("Resumed session: " + hex);
}
else
{
System.out.println("Established session: " + hex);
}
this.session = newSession;
}
}
}
| [
"a.eslampanah@live.com"
] | a.eslampanah@live.com |
c72f0ad6be4e69921ec2ae2c2cb5ee975ba74e70 | aad2c9811d31b01293fd8ed081f7a1b52e22fc83 | /modulePublic/z_lib_common/src/main/java/com/example/z_lib_common/widget/views/titleview/TitleViewViewModel.java | 77b7b1ccfe759cf7a3d4c54cf5c95ec099de2ca8 | [] | no_license | 1067899750/MVVMDataBinding | daabdc8f488fe6c21255a5342986abc3c2f6ef86 | cb4773fbd60fad589699d9b44448b4c2d0914c50 | refs/heads/master | 2022-06-11T13:17:09.497079 | 2020-05-11T01:43:47 | 2020-05-11T01:43:47 | 255,240,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | java | package com.example.z_lib_common.widget.views.titleview;
import android.app.Application;
import com.example.z_lib_base.base.view.BaseCustomViewModel;
import androidx.annotation.NonNull;
/**
* @author puyantao
* @description
* @date 2020/4/15 17:08
*/
public class TitleViewViewModel extends BaseCustomViewModel {
public String title;
public TitleViewViewModel(@NonNull Application application) {
super(application);
}
} | [
"puyantao123759"
] | puyantao123759 |
cbe85eb8766378ad26f14cd1ebb55345a4980d83 | e4a0ccfa1e154a731893a52868cb04ac7741a7c2 | /src/com/lxn/test/leetcode/TestStack2Queue.java | d604b41e591cb9f6385fa9ff5d6e24a64a601eec | [] | no_license | SmallLee/JavaStudy | e4e1375a4e053dae04cf4340f85e16034706a70f | 75d25112a3c5c0fe4328cfba32b286b64239f818 | refs/heads/master | 2020-04-19T11:38:07.542193 | 2020-02-22T05:20:26 | 2020-02-22T05:20:26 | 168,172,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | package com.lxn.test.leetcode;
import javax.xml.bind.SchemaOutputResolver;
public class TestStack2Queue {
public static void main(String[] args) {
Stack2Queue<Integer> queue = new Stack2Queue<>();
queue.add(1);
queue.add(2);
queue.add(3);
queue.add(4);
for (int i = 0; i < queue.size(); i++) {
System.out.println(queue.peek());
}
}
}
| [
"1615404043@qq.com"
] | 1615404043@qq.com |
7d762dfaec81f0815c382f173d2c2fc3b5992982 | 43422681c934d61505b6f16c34fe1c60d7de16d0 | /src/com/gyg/Main.java | 9ac71e96e819fb9cf0fa8d09950888f624cf556a | [] | no_license | 2671884528/2020_09_15_computer | 81e7a5524cccf1e9d0209938dadae691c2f93d86 | a000b844909cd3418eef0bb70a1e4973f4d65c07 | refs/heads/master | 2022-12-18T02:38:47.923082 | 2020-09-15T08:40:05 | 2020-09-15T08:40:05 | 295,666,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package com.gyg;
import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String[] args) {
// write your code here
Stack<String> stack = new Stack<>();
stack.push("+");
stack.push("-");
stack.push("*");
stack.push("/");
System.out.println(stack.peek()=="*"||stack.peek()=="/");
String x = "*";
System.out.println((x=="*"||x=="/"));
}
}
| [
"2671884528@qq.com"
] | 2671884528@qq.com |
2868ebb660f81a36e52e06033cf273b69d12cafe | b352573d3f15c627bfbcb490664733a853a9ae14 | /src/test/java/data/FoodEntryBuilder.java | 1bbbbb2a8e8a7fbaa1f5626c76962cc71e4d3e67 | [] | no_license | ajasuja/HomeFood | 48587ff01bd74d4de8f2b5dade6fd6d87bb17bce | c87f2af259848e94be58f8b8b30ee64ebaa5aac4 | refs/heads/master | 2021-01-20T01:03:29.196023 | 2013-07-09T10:21:18 | 2013-07-09T10:21:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,474 | java | package data;
import java.util.Date;
import bos.CurrencyType;
import bos.FoodEntry;
public enum FoodEntryBuilder {
SINGLETON;
public long FOOD_ID = 1L;
public long COOD_ID = 1001L;
public String FOOD_NAME = "Paalak Paneer";
public String FOOD_DESC = "Spinach with Paneer cooked in tomato/onion gravy " +
"along with indian spices";
public double PRICE_PER_PERSON = 170.00;
public int NUM_OF_PERSONS = 10;
public FoodEntry buildDefaultFoodEntryWithId() {
FoodEntry foodEntry = new FoodEntry();
foodEntry.setFoodId(FOOD_ID);
foodEntry.setCookId(COOD_ID);
foodEntry.setFoodName(FOOD_NAME);
foodEntry.setFoodDescription(FOOD_DESC);
foodEntry.setPricePerPerson(PRICE_PER_PERSON);
foodEntry.setNumOfPersons(NUM_OF_PERSONS);
foodEntry.setCurrencyType(CurrencyType.US_DOLLAR);
foodEntry.setEntryCreatedTime(new Date());
foodEntry.setOrderTimeDeadline(new Date());
foodEntry.setChangeTime(new Date());
return foodEntry;
}
public FoodEntry buildDefaultFoodEntryWithoutId() {
FoodEntry foodEntry = new FoodEntry();
foodEntry.setCookId(COOD_ID);
foodEntry.setFoodName(FOOD_NAME);
foodEntry.setFoodDescription(FOOD_DESC);
foodEntry.setPricePerPerson(PRICE_PER_PERSON);
foodEntry.setNumOfPersons(NUM_OF_PERSONS);
foodEntry.setCurrencyType(CurrencyType.US_DOLLAR);
foodEntry.setEntryCreatedTime(new Date());
foodEntry.setOrderTimeDeadline(new Date());
foodEntry.setChangeTime(new Date());
return foodEntry;
}
}
| [
"ajasuja@uci.edu"
] | ajasuja@uci.edu |
43625112519465a795bfb165a5f8e78e26fbfc32 | 742c86881221649229ce2ede103751010d6c0494 | /src/main/java/com/test/droptokengame/models/MovesType.java | 8689d096b0d12f2d2b76c8be121b81d8ad76780a | [] | no_license | van7b/drop-token-game | d726992af0f4ff518fe53944c1127ebcb797bb61 | 1a3439f1b146b887870ceaa38086575bd6f0293c | refs/heads/main | 2023-04-05T22:36:37.819442 | 2021-04-26T03:30:27 | 2021-04-26T03:30:27 | 359,750,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 79 | java | package com.test.droptokengame.models;
public enum MovesType {
MOVE,
QUIT
}
| [
"Vandana.Baidya@in.ey.com"
] | Vandana.Baidya@in.ey.com |
e3e130b577179e7cc8489668119d929dda952f8d | 08c17ec05b4ed865c2b9be53f19617be7562375d | /aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/transform/ListExperimentsResultJsonUnmarshaller.java | a03c1727ef61e9522b23c8ffa09ab2081ba86daa | [
"Apache-2.0"
] | permissive | shishir2510GitHub1/aws-sdk-java | c43161ac279af9d159edfe96dadb006ff74eefff | 9b656cfd626a6a2bfa5c7662f2c8ff85b7637f60 | refs/heads/master | 2020-11-26T18:13:34.317060 | 2019-12-19T22:41:44 | 2019-12-19T22:41:44 | 229,156,587 | 0 | 1 | Apache-2.0 | 2020-02-12T01:52:47 | 2019-12-19T23:45:32 | null | UTF-8 | Java | false | false | 3,177 | java | /*
* Copyright 2014-2019 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.sagemaker.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.sagemaker.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* ListExperimentsResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ListExperimentsResultJsonUnmarshaller implements Unmarshaller<ListExperimentsResult, JsonUnmarshallerContext> {
public ListExperimentsResult unmarshall(JsonUnmarshallerContext context) throws Exception {
ListExperimentsResult listExperimentsResult = new ListExperimentsResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return listExperimentsResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("ExperimentSummaries", targetDepth)) {
context.nextToken();
listExperimentsResult.setExperimentSummaries(new ListUnmarshaller<ExperimentSummary>(ExperimentSummaryJsonUnmarshaller.getInstance())
.unmarshall(context));
}
if (context.testExpression("NextToken", targetDepth)) {
context.nextToken();
listExperimentsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return listExperimentsResult;
}
private static ListExperimentsResultJsonUnmarshaller instance;
public static ListExperimentsResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new ListExperimentsResultJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
d99d0a5e318a3fa68eae0fdff2de066a5f3c7af1 | 8d61c4f430290a22485943a9131e370e53ee1323 | /src/com/company/Main.java | c359382b5424d2dccea37bb0caa9f0e992c58c5d | [] | no_license | alexandrakurek/exercise2 | af93e6055fe1572dda4503af0bd5c3b989743e5c | 9d7a2e21941658be1707e246108761f2eec7d748 | refs/heads/master | 2020-04-29T23:33:53.691537 | 2019-03-19T09:51:05 | 2019-03-19T09:51:05 | 176,479,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,791 | java | package com.company;
// ZADANIE Z TYPOW WYLICZENIOWYCH - BILETY
import java.util.Scanner;
public class Main {
public enum Bilet {
ULGOWY_GODZINNY(1.60d, 10),
ULGOWY_CALODNIOWY(10.20d, 76),
NORMALNY_GODZINNY(3.20d, 45),
NORMALNY_CALODNIOWY(16.20d, 120),
BRAK_BILETU(340, 65);
private double cena;
private int czasJazdy;
// konstruktor przyjmujacy 2 parametry
Bilet(double cena, int czasJazdy) {
this.cena = cena;
this.czasJazdy = czasJazdy;
}
// metoda pobierzCeneBiletu
public double pobierzCene() {
return this.cena;
}
// metoda pobierz czas jazdy
public int pobierzCzasJazdy() {
return this.czasJazdy;
}
// metoda wyswietl dane o bilecie
public void wyswietlDaneOBilecie() {
System.out.println("Cena biletu wynosi" + cena + "zł" + "czas jazdy:" + czasJazdy + "min");
}
}
public static void main(String[] args) {
Bilet mojBilet = Bilet.NORMALNY_CALODNIOWY;
System.out.println(mojBilet.pobierzCene());
System.out.println(mojBilet.pobierzCzasJazdy());
mojBilet.wyswietlDaneOBilecie();
Bilet biletKasi = Bilet.ULGOWY_GODZINNY;
biletKasi.wyswietlDaneOBilecie();
Bilet.NORMALNY_GODZINNY.wyswietlDaneOBilecie();
// ZADANIE 10 slajd 45 - TYPY WYLICZENIOWE
System.out.println("Czy chcesz kupić bilet ulgowy? tak/nie");
Scanner scanner = new Scanner(System.in);
String czyulgowy = scanner.nextLine();
System.out.println("Podaj czas przejazdu:");
int czasjazdy = scanner.nextInt();
switch (czyulgowy) {
case "tak" :
System.out.println("Podaj czas przejazdu w min:");
if(czasjazdy < 60){
System.out.println("Należy się bilet ulowy godzinny:" + Bilet.ULGOWY_GODZINNY.pobierzCene());
}else {
System.out.println("Należy się bilet ulgowy całodniowy. Koszt biletu:" + Bilet.ULGOWY_CALODNIOWY.pobierzCene()+ "zł");
}
break;
case "nie":
System.out.println("Podaj czas przejazdu w min:");
if (czasjazdy <60){
System.out.println("Należy się bilet normalny godzinny:"+ Bilet.NORMALNY_GODZINNY.pobierzCene());
} else {
System.out.println("Należy się bilet normalny całodniowy" + Bilet.NORMALNY_CALODNIOWY.pobierzCene());
}
break;
default:
System.out.println("Kara za brak biletu" + Bilet.BRAK_BILETU.pobierzCene());
break;
}
}
}
| [
"aleksandra.lazarek@gmail.com"
] | aleksandra.lazarek@gmail.com |
700a38ae33e42d6ded4fcf08a7b40282a1a4fa4f | 98cd05709ca4528e6955b8d090c9d3d588439f51 | /app/src/main/java/com/aanglearning/parentapp/gallery/GalleryInteractorImpl.java | 28034e3826f8d7e87c849112eea90184150d8316 | [] | no_license | vinkrish/parent-app | 6b2b3bb6f65438eea505014c289eb90d0e47ff3d | 21ca49b5619a2ca1748f8ced5beaa631e8081011 | refs/heads/master | 2021-03-30T17:45:40.148759 | 2018-04-22T10:24:53 | 2018-04-22T10:24:53 | 82,896,275 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,538 | java | package com.aanglearning.parentapp.gallery;
import com.aanglearning.parentapp.App;
import com.aanglearning.parentapp.R;
import com.aanglearning.parentapp.api.ApiClient;
import com.aanglearning.parentapp.api.GalleryApi;
import com.aanglearning.parentapp.model.Album;
import com.aanglearning.parentapp.model.ChildInfo;
import com.aanglearning.parentapp.model.DeletedAlbum;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* Created by Vinay on 30-10-2017.
*/
class GalleryInteractorImpl implements GalleryInteractor {
@Override
public void getAlbumsAboveId(ChildInfo childInfo, long id, final OnFinishedListener listener) {
GalleryApi api = ApiClient.getAuthorizedClient().create(GalleryApi.class);
Call<List<Album>> queue = api.getAlbumAboveId(childInfo.getSchoolId(), childInfo.getClassId(), childInfo.getSectionId(), id);
queue.enqueue(new Callback<List<Album>>() {
@Override
public void onResponse(Call<List<Album>> call, Response<List<Album>> response) {
if(response.isSuccessful()) {
listener.onRecentAlbumsReceived(response.body());
} else {
listener.onError(App.getInstance().getString(R.string.request_error));
}
}
@Override
public void onFailure(Call<List<Album>> call, Throwable t) {
listener.onError(App.getInstance().getString(R.string.network_error));
}
});
}
@Override
public void getAlbums(ChildInfo childInfo, final OnFinishedListener listener) {
GalleryApi api = ApiClient.getAuthorizedClient().create(GalleryApi.class);
Call<List<Album>> queue = api.getAlbums(childInfo.getSchoolId(), childInfo.getClassId(), childInfo.getSectionId());
queue.enqueue(new Callback<List<Album>>() {
@Override
public void onResponse(Call<List<Album>> call, Response<List<Album>> response) {
if(response.isSuccessful()) {
listener.onAlbumsReceived(response.body());
} else {
listener.onError(App.getInstance().getString(R.string.request_error));
}
}
@Override
public void onFailure(Call<List<Album>> call, Throwable t) {
listener.onError(App.getInstance().getString(R.string.network_error));
}
});
}
@Override
public void getRecentDeletedAlbums(ChildInfo childInfo, long id, final OnFinishedListener listener) {
GalleryApi api = ApiClient.getAuthorizedClient().create(GalleryApi.class);
Call<List<DeletedAlbum>> queue = api.getDeletedAlbumsAboveId(childInfo.getSchoolId(), childInfo.getClassId(), childInfo.getSectionId(), id);
queue.enqueue(new Callback<List<DeletedAlbum>>() {
@Override
public void onResponse(Call<List<DeletedAlbum>> call, Response<List<DeletedAlbum>> response) {
if(response.isSuccessful()) {
listener.onDeletedAlbumsReceived(response.body());
} else {
listener.onError(App.getInstance().getString(R.string.request_error));
}
}
@Override
public void onFailure(Call<List<DeletedAlbum>> call, Throwable t) {
listener.onError(App.getInstance().getString(R.string.network_error));
}
});
}
@Override
public void getDeletedAlbums(ChildInfo childInfo, final OnFinishedListener listener) {
GalleryApi api = ApiClient.getAuthorizedClient().create(GalleryApi.class);
Call<List<DeletedAlbum>> queue = api.getDeletedAlbums(childInfo.getSchoolId(), childInfo.getClassId(), childInfo.getSectionId());
queue.enqueue(new Callback<List<DeletedAlbum>>() {
@Override
public void onResponse(Call<List<DeletedAlbum>> call, Response<List<DeletedAlbum>> response) {
if(response.isSuccessful()) {
listener.onDeletedAlbumsReceived(response.body());
} else {
listener.onError(App.getInstance().getString(R.string.request_error));
}
}
@Override
public void onFailure(Call<List<DeletedAlbum>> call, Throwable t) {
listener.onError(App.getInstance().getString(R.string.network_error));
}
});
}
}
| [
"vinaykrishna1989@gmail.com"
] | vinaykrishna1989@gmail.com |
15af36a64cf28740da7e63ffc747faa91b84b770 | 0604080d710c48d11e075e34b16a64fdacb14559 | /app/src/main/java/com/stealthcotper/networktools/MainActivity.java | 00edbc08380f71f544f171ef178337a08c156560 | [
"Apache-2.0"
] | permissive | ivillaguer/AndroidNetworkTools | 558f03cdbf295a583f0737d96dc28d0cec04b265 | b7a64cdd252f8260785bad5339e520e4e1fdb103 | refs/heads/master | 2020-03-23T18:36:46.049124 | 2018-06-21T15:50:07 | 2018-06-21T15:50:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,016 | java | package com.stealthcotper.networktools;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.stealthcopter.networktools.ARPInfo;
import com.stealthcopter.networktools.IPTools;
import com.stealthcopter.networktools.Ping;
import com.stealthcopter.networktools.PortScan;
import com.stealthcopter.networktools.SubnetDevices;
import com.stealthcopter.networktools.WakeOnLan;
import com.stealthcopter.networktools.ping.PingResult;
import com.stealthcopter.networktools.ping.PingStats;
import com.stealthcopter.networktools.subnet.Device;
import java.io.IOException;
import java.net.InetAddress;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private TextView resultText;
private EditText editIpAddress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
resultText = findViewById(R.id.resultText);
editIpAddress = findViewById(R.id.editIpAddress);
InetAddress ipAddress = IPTools.getLocalIPv4Address();
if (ipAddress != null){
editIpAddress.setText(ipAddress.getHostAddress());
}
findViewById(R.id.pingButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
try {
doPing();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
});
findViewById(R.id.wolButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
try {
doWakeOnLan();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
});
findViewById(R.id.portScanButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
try {
doPortScan();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
});
findViewById(R.id.subnetDevicesButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
try {
findSubnetDevices();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
});
}
private void appendResultsText(final String text) {
runOnUiThread(new Runnable() {
@Override
public void run() {
resultText.append(text + "\n");
}
});
}
private void doPing() throws Exception {
String ipAddress = editIpAddress.getText().toString();
if (TextUtils.isEmpty(ipAddress)) {
appendResultsText("Invalid Ip Address");
return;
}
// Perform a single synchronous ping
PingResult pingResult = Ping.onAddress(ipAddress).setTimeOutMillis(1000).doPing();
appendResultsText("Pinging Address: " + pingResult.getAddress().getHostAddress());
appendResultsText("HostName: " + pingResult.getAddress().getHostName());
appendResultsText(String.format("%.2f ms", pingResult.getTimeTaken()));
// Perform an asynchronous ping
Ping.onAddress(ipAddress).setTimeOutMillis(1000).setTimes(5).doPing(new Ping.PingListener() {
@Override
public void onResult(PingResult pingResult) {
appendResultsText(String.format("%.2f ms", pingResult.getTimeTaken()));
}
@Override
public void onFinished(PingStats pingStats) {
appendResultsText(String.format("Pings: %d, Packets lost: %d",
pingStats.getNoPings(), pingStats.getPacketsLost()));
appendResultsText(String.format("Min/Avg/Max Time: %.2f/%.2f/%.2f ms",
pingStats.getMinTimeTaken(), pingStats.getAverageTimeTaken(), pingStats.getMaxTimeTaken()));
}
@Override
public void onError(Exception e) {
// TODO: STUB METHOD
}
});
}
private void doWakeOnLan() throws IllegalArgumentException {
String ipAddress = editIpAddress.getText().toString();
if (TextUtils.isEmpty(ipAddress)) {
appendResultsText("Invalid Ip Address");
return;
}
appendResultsText("IP address: " + ipAddress);
// Get mac address from IP (using arp cache)
String macAddress = ARPInfo.getMACFromIPAddress(ipAddress);
if (macAddress == null) {
appendResultsText("Could not fromIPAddress MAC address, cannot send WOL packet without it.");
return;
}
appendResultsText("MAC address: " + macAddress);
appendResultsText("IP address2: " + ARPInfo.getIPAddressFromMAC(macAddress));
// Send Wake on lan packed to ip/mac
try {
WakeOnLan.sendWakeOnLan(ipAddress, macAddress);
appendResultsText("WOL Packet sent");
} catch (IOException e) {
e.printStackTrace();
}
}
private void doPortScan() throws Exception {
String ipAddress = editIpAddress.getText().toString();
if (TextUtils.isEmpty(ipAddress)) {
appendResultsText("Invalid Ip Address");
return;
}
// Perform synchronous port scan
appendResultsText("PortScanning IP: " + ipAddress);
ArrayList<Integer> openPorts = PortScan.onAddress(ipAddress).setPort(21).setMethodTCP().doScan();
final long startTimeMillis = System.currentTimeMillis();
// Perform an asynchronous port scan
PortScan.onAddress(ipAddress).setPortsAll().setMethodTCP().doScan(new PortScan.PortListener() {
@Override
public void onResult(int portNo, boolean open) {
if (open) appendResultsText("Open: " + portNo);
}
@Override
public void onFinished(ArrayList<Integer> openPorts) {
appendResultsText("Open Ports: " + openPorts.size());
appendResultsText("Time Taken: " + ((System.currentTimeMillis() - startTimeMillis)/1000.0f));
}
});
}
private void findSubnetDevices() {
final long startTimeMillis = System.currentTimeMillis();
SubnetDevices.fromLocalAddress().findDevices(new SubnetDevices.OnSubnetDeviceFound() {
@Override
public void onDeviceFound(Device device) {
appendResultsText("Device: " + device.ip+" "+ device.hostname);
}
@Override
public void onFinished(ArrayList<Device> devicesFound) {
float timeTaken = (System.currentTimeMillis() - startTimeMillis)/1000.0f;
appendResultsText("Devices Found: " + devicesFound.size());
appendResultsText("Finished "+timeTaken+" s");
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_github) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(getString(R.string.github_url)));
startActivity(i);
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
}
| [
"matthewrollings@gmail.com"
] | matthewrollings@gmail.com |
6009288c8b6bd1006b4dc0bdd8470018d2d39eb5 | dbd54045c2bd3dfb822871fac35d36fd4fa33b3d | /src/test/java/org/springframework/samples/petclinic/ui/NegativeRegisterStudentUITest.java | 2e74b69987fa763e4000289df2ad22a24f138cf0 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | gii-is-DP2/DP2-1920-G1-06 | 4198da6fd4dbf7c36163645273fdf5b5e9d10204 | bea654d4e96b73e4479960c4295625648b2e06ba | refs/heads/develop | 2022-09-28T12:47:58.268321 | 2020-06-05T21:29:25 | 2020-06-05T21:29:25 | 243,241,017 | 0 | 1 | null | 2020-06-05T16:48:25 | 2020-02-26T10:58:05 | Java | UTF-8 | Java | false | false | 3,368 | java | package org.springframework.samples.petclinic.ui;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.samples.petclinic.util.Sleep;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class NegativeRegisterStudentUITest {
// Default
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
// Params
private final String username = "juan29";
private final String pass = "87";
@LocalServerPort
private int port;
@BeforeEach
public void setUp() throws Exception {
System.setProperty("webdriver.chrome.driver", System.getenv("webdriver.chrome.driver"));
driver = new ChromeDriver();
baseUrl = "https://www.google.com/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testRegisterStudentUI() throws Exception {
driver.get("http://localhost:"+port);
registerStudentUI();
}
public void registerStudentUI() throws Exception {
driver.findElement(By.xpath("//a[contains(@href, '/users/new')]")).click();
driver.findElement(By.xpath("//a[contains(@href, '/users/new/student')]")).click();
driver.findElement(By.id("firstName")).click();
driver.findElement(By.id("firstName")).clear();
driver.findElement(By.id("firstName")).sendKeys("Alberto");
driver.findElement(By.id("lastName")).clear();
driver.findElement(By.id("lastName")).sendKeys("Garcia");
driver.findElement(By.id("dni")).clear();
driver.findElement(By.id("dni")).sendKeys("77898780O");
driver.findElement(By.id("birthDate")).clear();
driver.findElement(By.id("birthDate")).sendKeys("02-10-1980");
driver.findElement(By.name("gender")).click();
driver.findElement(By.name("gender")).click();
driver.findElement(By.id("email")).click();
driver.findElement(By.id("email")).clear();
driver.findElement(By.id("email")).sendKeys("soymupro@gmail.com");
driver.findElement(By.id("telephone")).clear();
driver.findElement(By.id("telephone")).sendKeys("6666666166");
driver.findElement(By.id("user.username")).clear();
driver.findElement(By.id("user.username")).sendKeys(username);
driver.findElement(By.id("user.password")).clear();
driver.findElement(By.id("user.password")).sendKeys(pass);
driver.findElement(By.xpath("//button[@type='submit']")).click();
assertEquals("tiene que corresponder a la expresión regular \"^([0-9]{9})$\"" , driver.findElement(By.xpath("//form[@id='add-student-form']/div/div[7]/div/span[2]")).getText());
}
@AfterEach
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
}
| [
"55798786+enrjorarr@users.noreply.github.com"
] | 55798786+enrjorarr@users.noreply.github.com |
854f9d2e76ddcce1e498772aa77981360c484512 | c976a52d5ee3310b990b239cd6873ddb3a149e99 | /src/test/java/txt/TestFindWord.java | ef7837acafe590c6920ad5e56ed2848a8740bf99 | [] | no_license | acnagy/coffee-word-search | 2c33cf6eb8f708384a0e9acfd3f2b94875cf62dc | 1ca4a4001333a3dafcc4f170bf4a7ccea53e14a1 | refs/heads/master | 2020-05-09T01:25:49.528257 | 2019-05-02T22:31:43 | 2019-05-02T22:31:43 | 180,977,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,667 | java | package txt;
import org.junit.Test;
import org.junit.Assert;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class TestFindWord {
@Test
@SuppressWarnings("illegal-access")
public void test_normalizeLine(){
FindWord wordFinder = new FindWord();
String orig = "this string has punctuation. number5 and Caps!";
String expected = "this string has punctuation number5 and caps";
String out = wordFinder.normalizeLine(orig);
Assert.assertTrue(out.equals(expected));
}
@Test
public void test_cleanLine(){
FindWord wordFinder = new FindWord();
String orig = "this string has punctuation. number5 and Caps!";
String expected = "this string has punctuation number5 and Caps";
String out = wordFinder.cleanLine(orig);
Assert.assertTrue(out.equals(expected));
}
@Test
public void test_countOccurances_string(){
FindWord wordFinder = new FindWord();
String orig = "spider-man spiderman does whatever a spider can!";
String term = "spiderman";
Integer expected = 2;
Integer out = wordFinder.countOccurances(orig, term);
Assert.assertEquals(expected, out);
}
@Test
public void test_countOccurances_file() throws FileNotFoundException {
FindWord wordFinder = new FindWord();
InputStream fileSt = new FileInputStream("test-assets/test-file1.txt");
String term = "42";
Integer expected = 5;
Integer out = wordFinder.countOccurances(fileSt, term);
Assert.assertEquals(expected, out);
}
}
| [
"annacnagy@gmail.com"
] | annacnagy@gmail.com |
43d6cfca8271cd7c98fb1fd04f4fc0c50c069f61 | 46086f6b63de00e03200116ee9d8ddb62a3f919f | /src/main/java/com/xejarque/marsrover/message/repository/MessageRepository.java | 19a4c682161a7bb1f2927ea6ff42e2983a20174a | [
"MIT"
] | permissive | xejarque/mars-rover | 02571e7c857b20f043752b10e79bd738a830736f | f1ce3069fae9a5e5406a784940dd2a22d2866ec8 | refs/heads/master | 2021-08-16T20:32:24.525316 | 2017-11-20T09:38:12 | 2017-11-20T09:38:12 | 110,449,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.xejarque.marsrover.message.repository;
import com.xejarque.marsrover.commons.Message;
import java.util.List;
public interface MessageRepository {
void saveMessage(Message message);
List<Message> listMessages();
}
| [
"xejarque@gmail.com"
] | xejarque@gmail.com |
d26d13a76b70e85e5c77209b56e370a2b69b6978 | 43923842d97d016ac20f686aac0b8f121f56bfe9 | /android/app/src/main/java/com/modulo06/MainApplication.java | aaed3336c8a507d7e545440e3a0ff01b3171dda3 | [] | no_license | williammacedo/modulo06 | 5c4fac4bd9c9092f88bb0006bd91d3c7478401a7 | fc31058132f5c00908b2a2e5d8424bea8c3d9a26 | refs/heads/master | 2023-01-12T19:45:45.206907 | 2019-09-24T19:29:30 | 2019-09-24T19:29:30 | 210,425,247 | 0 | 0 | null | 2023-01-04T11:14:56 | 2019-09-23T18:30:26 | JavaScript | UTF-8 | Java | false | false | 1,468 | java | package com.modulo06;
import android.app.Application;
import android.util.Log;
import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.azendoo.reactnativesnackbar.SnackbarPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"macedo.franca@gmail.com"
] | macedo.franca@gmail.com |
5a7e1f0f7d387a197fbd6bd2a86f6f2e29c0152a | 96ce78493d2c72b652c5661c4d9732d1959c8cf9 | /minesweeper/src/main/java/ru/kami/minesweeper/model/security/AesCipher.java | 3ef46bb29c8de1dc491766e423fa9632554d02eb | [] | no_license | Kami-0/Minesweeper | a3cad6a218c92371977135ca35a622064055640e | 699cc91f50f709cc80cf6f2bee9c4f9241cccb77 | refs/heads/master | 2022-12-31T14:31:53.036731 | 2020-06-09T12:56:00 | 2020-06-09T12:56:00 | 270,991,048 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,466 | java | package ru.kami.minesweeper.model.security;
import lombok.extern.slf4j.Slf4j;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
@Slf4j
public final class AesCipher {
private static final String KEY = "Focus Start Best";
private final SecretKeySpec secretKeySpec;
private Cipher cipher;
public AesCipher() {
this.secretKeySpec = new SecretKeySpec(KEY.getBytes(), "AES");
String transformation = "AES/ECB/PKCS5Padding";
try {
this.cipher = Cipher.getInstance(transformation);
} catch (Exception e) {
log.error("Ошибка во время инициализации инстанса шифра ", e);
}
}
public byte[] encrypt(String text) {
try {
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
return cipher.doFinal(text.getBytes());
} catch (Exception e) {
log.error("Ошибка во время шифрования текста {}", text, e);
return new byte[]{};
}
}
public String decrypt(byte[] encrypted) {
try {
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
byte[] decrypted = cipher.doFinal(encrypted);
return new String(decrypted);
} catch (Exception e) {
log.error("Ошибка во время дешифрования текста {}", encrypted, e);
return "";
}
}
}
| [
"makarovdaniil2000@mail.ru"
] | makarovdaniil2000@mail.ru |
1eb7c6547d449087127f385fa298bfcbcceea0b7 | 4d6f449339b36b8d4c25d8772212bf6cd339f087 | /netreflected/src/Framework/System.ComponentModel.Composition,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089/system/componentmodel/composition/primitives/ComposablePartDefinition.java | ce3c1b2b5a478969b5acf78f9423cdf19f3da17d | [
"MIT"
] | permissive | lvyitian/JCOReflector | 299a64550394db3e663567efc6e1996754f6946e | 7e420dca504090b817c2fe208e4649804df1c3e1 | refs/heads/master | 2022-12-07T21:13:06.208025 | 2020-08-28T09:49:29 | 2020-08-28T09:49:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,787 | java | /*
* MIT License
*
* Copyright (c) 2020 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
* <auto-generated>
* This code was generated from a template using JCOReflector
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
* </auto-generated>
*************************************************************************************/
package system.componentmodel.composition.primitives;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.componentmodel.composition.primitives.ComposablePart;
/**
* The base .NET class managing System.ComponentModel.Composition.Primitives.ComposablePartDefinition, System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Extends {@link NetObject}.
* <p>
*
* See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.ComponentModel.Composition.Primitives.ComposablePartDefinition" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.ComponentModel.Composition.Primitives.ComposablePartDefinition</a>
*/
public class ComposablePartDefinition extends NetObject {
/**
* Fully assembly qualified name: System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
public static final String assemblyFullName = "System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
/**
* Assembly name: System.ComponentModel.Composition
*/
public static final String assemblyShortName = "System.ComponentModel.Composition";
/**
* Qualified class name: System.ComponentModel.Composition.Primitives.ComposablePartDefinition
*/
public static final String className = "System.ComponentModel.Composition.Primitives.ComposablePartDefinition";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName));
} catch (JCException e) {
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public ComposablePartDefinition(Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public Object getJCOInstance() {
return classInstance;
}
public void setJCOInstance(JCObject instance) {
classInstance = instance;
super.setJCOInstance(classInstance);
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link ComposablePartDefinition}, a cast assert is made to check if types are compatible.
*/
public static ComposablePartDefinition cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new ComposablePartDefinition(from.getJCOInstance());
}
// Constructors section
public ComposablePartDefinition() throws Throwable {
}
// Methods section
public ComposablePart CreatePart() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objCreatePart = (JCObject)classInstance.Invoke("CreatePart");
return new ComposablePart(objCreatePart);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Properties section
// Instance Events section
} | [
"mario.mastrodicasa@masesgroup.com"
] | mario.mastrodicasa@masesgroup.com |
777722d7b54dc12cbb54c8c3c32cbb823f4d2c3f | ef56aee4430405d795d1e5c631a9b759c2f5beaf | /src/main/java/org/fourthline/cling/model/types/UDADeviceType.java | 14f4d7bd2c13affd5ac16832a6ab7112e09b642c | [] | no_license | tangqipeng/Cling | 1bfc9aa72b685b27b26ad509140319dab3910784 | 7145d0282b9705b55e6eecbed3b571a1aa3da88a | refs/heads/master | 2021-01-11T05:00:59.577054 | 2017-06-22T10:52:46 | 2017-06-22T10:52:46 | 95,105,632 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,869 | java | /*
* Copyright (C) 2013 4th Line GmbH, Switzerland
*
* The contents of this file are subject to the terms of either the GNU
* Lesser General Public License Version 2 or later ("LGPL") or the
* Common Development and Distribution License Version 1 or later
* ("CDDL") (collectively, the "License"). You may not use this file
* except in compliance with the License. See LICENSE.txt for more
* information.
*
* 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.
*/
package org.fourthline.cling.model.types;
import org.fourthline.cling.model.Constants;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Device type with a fixed <code>schemas-upnp-org</code> namespace.
*
* @author Christian Bauer
*/
public class UDADeviceType extends DeviceType {
public static final String DEFAULT_NAMESPACE = "schemas-upnp-org";
// This pattern also accepts decimal versions, not only integers (as would be required by UDA), but cuts off fractions
public static final Pattern PATTERN =
Pattern.compile("urn:" + DEFAULT_NAMESPACE + ":device:(" + Constants.REGEX_TYPE + "):([0-9]+).*");
public UDADeviceType(String type) {
super(DEFAULT_NAMESPACE, type, 1);
}
public UDADeviceType(String type, int version) {
super(DEFAULT_NAMESPACE, type, version);
}
public static UDADeviceType valueOf(String s) throws InvalidValueException {
Matcher matcher = PATTERN.matcher(s);
if (matcher.matches()) {
return new UDADeviceType(matcher.group(1), Integer.valueOf(matcher.group(2)));
} else {
throw new InvalidValueException("Can't parse UDA device type string (namespace/type/version): " + s);
}
}
}
| [
"tangqipeng@vcinema.cn"
] | tangqipeng@vcinema.cn |
6704aa76cc50867568cfab41d56683311298328a | 31f4cab278d83a755f1e434f35273223b049d172 | /bugs/accumulo/5594b2e0/src/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java | 8bc2b4567fdfaf29955c75289a402f2924b39b2e | [
"BSD-3-Clause",
"Apache-2.0",
"MIT"
] | permissive | JenniferJohnson89/bugs_dot_jar_dissection | 2a017f5f77772ddb2b9a5e45423ae084fa1bd7a0 | 7012cccce9a3fdbfc97a0ca507420c24650f6bcf | refs/heads/main | 2022-12-28T16:38:18.039203 | 2020-10-20T09:45:47 | 2020-10-20T09:45:47 | 305,639,612 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,267 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.accumulo.core.client.mapreduce;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.mock.MockInstance;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.TaskAttemptID;
import org.junit.Test;
/**
*
*/
public class AccumuloOutputFormatTest {
static class TestMapper extends Mapper<Key,Value,Text,Mutation> {
Key key = null;
int count = 0;
@Override
protected void map(Key k, Value v, Context context) throws IOException, InterruptedException {
if (key != null)
assertEquals(key.getRow().toString(), new String(v.get()));
assertEquals(k.getRow(), new Text(String.format("%09x", count + 1)));
assertEquals(new String(v.get()), String.format("%09x", count));
key = new Key(k);
count++;
}
@Override
protected void cleanup(Context context) throws IOException, InterruptedException {
super.cleanup(context);
Mutation m = new Mutation("total");
m.put("", "", Integer.toString(count));
try {
context.write(new Text(), m);
} catch (NullPointerException e) {}
}
}
@Test
public void testMR() throws Exception {
MockInstance mockInstance = new MockInstance("testmrinstance");
Connector c = mockInstance.getConnector("root", new byte[] {});
c.tableOperations().create("testtable1");
c.tableOperations().create("testtable2");
BatchWriter bw = c.createBatchWriter("testtable1", 10000L, 1000L, 4);
for (int i = 0; i < 100; i++) {
Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
bw.addMutation(m);
}
bw.close();
Job job = new Job();
job.setInputFormatClass(AccumuloInputFormat.class);
job.setMapperClass(TestMapper.class);
job.setOutputFormatClass(AccumuloOutputFormat.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Mutation.class);
job.setNumReduceTasks(0);
Configuration conf = job.getConfiguration();
AccumuloInputFormat.setInputInfo(conf, "root", "".getBytes(), "testtable1", new Authorizations());
AccumuloInputFormat.setMockInstance(conf, "testmrinstance");
AccumuloOutputFormat.setOutputInfo(conf, "root", "".getBytes(), false, "testtable2");
AccumuloOutputFormat.setMockInstance(conf, "testmrinstance");
AccumuloInputFormat input = new AccumuloInputFormat();
List<InputSplit> splits = input.getSplits(job);
assertEquals(splits.size(), 1);
AccumuloOutputFormat output = new AccumuloOutputFormat();
TestMapper mapper = (TestMapper) job.getMapperClass().newInstance();
for (InputSplit split : splits) {
TaskAttemptID id = new TaskAttemptID();
TaskAttemptContext tac = new TaskAttemptContext(job.getConfiguration(), id);
RecordReader<Key,Value> reader = input.createRecordReader(split, tac);
RecordWriter<Text,Mutation> writer = output.getRecordWriter(tac);
Mapper<Key,Value,Text,Mutation>.Context context = mapper.new Context(job.getConfiguration(), id, reader, writer, null, null, split);
reader.initialize(split, context);
mapper.run(context);
writer.close(context);
}
Scanner scanner = c.createScanner("testtable2", new Authorizations());
Iterator<Entry<Key,Value>> iter = scanner.iterator();
assertTrue(iter.hasNext());
Entry<Key,Value> entry = iter.next();
assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
assertFalse(iter.hasNext());
}
}
| [
"JenniferJonhnson89@163.com"
] | JenniferJonhnson89@163.com |
e1befe58df7287cf8e7e33d5a5c1243e90714020 | c53e000ddb78d4954e04ea00f353c07f31178b6b | /src/main/java/com/zhaozhiguang/component/jwt/exceptions/JWTVerificationException.java | 0b2ea11bb53d0d0c944caa632ffa468ec830e82a | [] | no_license | zhaozhiguang/jwt | f51281542d895fb00d0cdd4230bb47a56d9ce1e2 | 6baed5b7d78b34b525571750afc6766a7ac14dae | refs/heads/master | 2021-09-05T15:25:43.090008 | 2018-01-29T08:27:00 | 2018-01-29T08:27:00 | 119,353,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package com.zhaozhiguang.component.jwt.exceptions;
public class JWTVerificationException extends RuntimeException {
public JWTVerificationException(String message) {
this(message, null);
}
public JWTVerificationException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"1422615221@qq.com"
] | 1422615221@qq.com |
4cf9b65c10e76183689f3ee39e9ab82702dbde47 | b1c0e7b90cdc5e6baea6c653171a158815cc62ca | /src/main/java/com/arrowgs/agsadmin/entities/Order.java | 4b9e96835b9e00f3b642e1564129d50c2d6e9168 | [] | no_license | HugoCamargoP/ags-admin | 50827633b69856ef2cf5891195a020739bc9f8aa | edb2d774b9a0187d7bd6495d0a0b461fb75f132b | refs/heads/master | 2020-03-31T14:56:04.424306 | 2018-10-10T15:14:42 | 2018-10-10T15:14:42 | 152,316,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,775 | java | package com.arrowgs.agsadmin.entities;
import java.util.Date;
import java.util.List;
public class Order {
private Integer id;
private Integer user;
private Integer address;
private Integer state;
private Date creation;
private String comment;
private Integer enable;
private Integer facturacion;
private Double dollar;
private Double totalAmount;
/***************Extra Data****************/
private List<OrderDetail> orderDetail;
private List<OrderRecord> orderRecord;
private List<OrderAmount> orderAmount;
private List<GuideNumber> guidesNumbers;
private String userText;
private String statusText;
private Date statusDate;
private String observations;
/***************Filter Data****************/
private String sku;
private Integer product;
private Integer sizeProduct;
private Integer client;
private Integer status;
private Date since;
private Date upTo;
private Integer historic;
private Integer lastBoundQuery;
/***********Getter and Setter id**********/
public Integer getId(){
return this.id;
}
public void setId(Integer id){
this.id = id;
}
/***********Getter and Setter user********/
public Integer getUser(){
return this.user;
}
public void setUser(Integer user){
this.user = user;
}
/***********Getter and Setter state*******/
public Integer getState(){
return this.state;
}
public void setState(Integer state){
this.state = state;
}
/***********Getter and Setter creation*****/
public Date getCreation(){
return this.creation;
}
public void setCreation(Date creation){
this.creation = creation;
}
/***********Getter and Setter orderDetail**********/
public List<OrderDetail> getOrderDetail() {
return orderDetail;
}
public void setOrderDetail(List<OrderDetail> orderDetail) {
this.orderDetail = orderDetail;
}
/***********Getter and Setter orderRecord**********/
public List<OrderRecord> getOrderRecord() {
return orderRecord;
}
public void setOrderRecord(List<OrderRecord> orderRecord) {
this.orderRecord = orderRecord;
}
/***********Getter and Setter orderAmount**********/
public List<OrderAmount> getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(List<OrderAmount> orderAmount) {
this.orderAmount = orderAmount;
}
public List<GuideNumber> getGuidesNumbers() {
return guidesNumbers;
}
public void setGuidesNumbers(List<GuideNumber> guidesNumbers) {
this.guidesNumbers = guidesNumbers;
}
/***********Getter and Setter Address**********/
public Integer getAddress() {
return address;
}
public void setAddress(Integer address) {
this.address = address;
}
/***********Getter and Setter comment**********/
public void setComment(String comment) {
this.comment = comment;
}
public String getComment() {
return comment;
}
public Integer getEnable() {
return enable;
}
public void setEnable(Integer status) {
this.enable = status;
}
public Integer getFacturacion() {
return facturacion;
}
public void setFacturacion(Integer facturacion) {
this.facturacion = facturacion;
}
public Double getDollar() {
return dollar;
}
public void setDollar(Double dollar) {
this.dollar = dollar;
}
/***********Getter and Setter totalAmount**********/
public Double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
}
/***********Getter and Setter userText********/
public String getUserText() {
return userText;
}
public void setUserText(String userText) {
this.userText = userText;
}
/***********Getter and Setter creation*****/
public String getStatusText() {
return statusText;
}
public void setStatusText(String statusText) {
this.statusText = statusText;
}
/***********Getter and Setter sku FILTER********/
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku;
}
/***********Getter and Setter product FILTER********/
public Integer getProduct() {
return product;
}
public void setProduct(Integer product) {
this.product = product;
}
/***********Getter and Setter sizeProduct FILTER********/
public Integer getSizeProduct() {
return sizeProduct;
}
public void setSizeProduct(Integer sizeProduct) {
this.sizeProduct = sizeProduct;
}
/***********Getter and Setter client FILTER********/
public Integer getClient() {
return client;
}
public void setClient(Integer client) {
this.client = client;
}
/***********Getter and Setter status FILTER********/
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
/***********Getter and Setter since FILTER**********/
public Date getSince() {
return since;
}
public void setSince(Date since) {
this.since = since;
}
/***********Getter and Setter upTo FILTER**********/
public Date getUpTo() {
return upTo;
}
public void setUpTo(Date upTo) {
this.upTo = upTo;
}
/***********Getter and Setter historic**********/
public Integer getHistoric() {
return historic;
}
public void setHistoric(Integer historic) {
this.historic = historic;
}
/***********Getter and Setter lastBoundQuery**********/
public Integer getLastBoundQuery() {
return lastBoundQuery;
}
public void setLastBoundQuery(Integer lastBoundQuery) {
this.lastBoundQuery = lastBoundQuery;
}
/***********Getter and Setter StatusDate**********/
public Date getStatusDate() {
return statusDate;
}
public void setStatusDate(Date statusDate) {
this.statusDate = statusDate;
}
public String getObservations() {
return observations;
}
public void setObservations(String observations) {
this.observations = observations;
}
}
| [
"giusseppe.bustamante@arrow-gs.com"
] | giusseppe.bustamante@arrow-gs.com |
e061f5fcbe89cccde45c1c01cff70abb054ab7c5 | bb22f69896352c6df4dc7e36649d113e6ffbfc35 | /src/main/java/org/t246osslab/easybuggy/DefaultLoginServlet.java | 2539856645f534a82149cf5c537bb788b009992b | [
"Apache-2.0"
] | permissive | hatimiti/easybuggy | cc36926ad08e8d957f884312fa5322bcd933af80 | 70f8ee7576176773cfb7c967808d88dccbae6de4 | refs/heads/master | 2021-01-18T22:16:12.102437 | 2017-03-08T13:57:11 | 2017-03-08T13:57:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,073 | java | package org.t246osslab.easybuggy;
import java.io.IOException;
import java.util.Date;
import java.util.Enumeration;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.FilterParser;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.t246osslab.easybuggy.utils.Administrator;
import org.t246osslab.easybuggy.utils.ApplicationUtils;
import org.t246osslab.easybuggy.utils.EmbeddedADS;
import org.t246osslab.easybuggy.utils.HTTPResponseCreator;
import org.t246osslab.easybuggy.utils.LDAPUtils;
import org.t246osslab.easybuggy.utils.MessageUtils;
@SuppressWarnings("serial")
@WebServlet(urlPatterns = { "/login" })
public class DefaultLoginServlet extends HttpServlet {
// User's login history using in-memory account locking
protected ConcurrentHashMap<String, Administrator> userLoginHistory = new ConcurrentHashMap<String, Administrator>();
private static Logger log = LoggerFactory.getLogger(DefaultLoginServlet.class);
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
Locale locale = req.getLocale();
StringBuilder bodyHtml = new StringBuilder();
bodyHtml.append("<div id=\"legend\">");
bodyHtml.append("<legend class=\"\">" + MessageUtils.getMsg("label.login", locale) + "</legend>");
bodyHtml.append("</div>");
bodyHtml.append("<p>" + MessageUtils.getMsg("msg.need.admin.privilege", locale));
bodyHtml.append(MessageUtils.getMsg("msg.enter.id.and.password", locale) + "</p>");
bodyHtml.append(MessageUtils.getMsg("msg.example.name.and.passwd", locale) + "</p>");
bodyHtml.append("<form method=\"POST\" action=\"" + req.getRequestURI() + "\">");
bodyHtml.append("<table width=\"400px\" height=\"150px\">");
bodyHtml.append("<tr>");
bodyHtml.append("<td>" + MessageUtils.getMsg("label.user.id", locale) + " : </td>");
bodyHtml.append("<td><input type=\"text\" name=\"userid\" size=\"20\"></td>");
bodyHtml.append("</tr>");
bodyHtml.append("<tr>");
bodyHtml.append("<td>" + MessageUtils.getMsg("label.password", locale) + " : </td>");
bodyHtml.append("<td><input type=\"password\" name=\"password\" size=\"20\"></td>");
bodyHtml.append("</tr>");
bodyHtml.append("<tr>");
bodyHtml.append("<td></td>");
bodyHtml.append("<td><input type=\"submit\" value=\"" + MessageUtils.getMsg("label.login", locale) + "\"></td>");
bodyHtml.append("</tr>");
bodyHtml.append("</table>");
if (req.getAttribute("login.page.note") != null) {
bodyHtml.append("<br><p>" + MessageUtils.getMsg((String) req.getAttribute("login.page.note"), locale) + "<p>");
}
String queryString = req.getQueryString();
if (queryString != null) {
bodyHtml.append("<input type=\"hidden\" name=\"loginquerystring\" value=\"" + queryString + "\">");
}
Enumeration<?> paramNames = req.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = req.getParameterValues(paramName);
for (int i = 0; i < paramValues.length; i++) {
bodyHtml.append("<input type=\"hidden\" name=\"" + paramName + "\" value=\"" + paramValues[i] + "\">");
}
}
bodyHtml.append("</form>");
HttpSession session = req.getSession(true);
if ("authNFailed".equals(session.getAttribute("authNResult"))) {
bodyHtml.append("<p>" + MessageUtils.getMsg("msg.authentication.fail", locale) + "</p>");
session.setAttribute("authNResult", null);
}else if ("accountLocked".equals(session.getAttribute("authNResult"))) {
bodyHtml.append("<p>" + MessageUtils.getMsg("msg.account.locked", locale) + "</p>");
session.setAttribute("authNResult", null);
}
HTTPResponseCreator.createSimpleResponse(res, MessageUtils.getMsg("title.login.page", locale),
bodyHtml.toString());
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String userid = request.getParameter("userid");
String password = request.getParameter("password");
HttpSession session = request.getSession(true);
if (isAccountLocked(userid)) {
session.setAttribute("authNResult", "accountLocked");
response.sendRedirect("/login");
} else if (authUser(userid, password)) {
/* Reset account lock */
Administrator admin = userLoginHistory.get(userid);
if (admin == null) {
admin = new Administrator();
admin.setUserId(userid);
userLoginHistory.put(userid, admin);
}
admin.setLoginFailedCount(0);
admin.setLastLoginFailedTime(null);
session.setAttribute("authNResult", "authenticated");
session.setAttribute("userid", userid);
String target = (String) session.getAttribute("target");
if (target == null) {
response.sendRedirect("/admins/main");
} else {
session.removeAttribute("target");
response.sendRedirect(target);
}
} else {
/* account lock count +1 */
Administrator admin = userLoginHistory.get(userid);
if (admin == null) {
admin = new Administrator();
admin.setUserId(userid);
userLoginHistory.put(userid, admin);
}
admin.setLoginFailedCount(admin.getLoginFailedCount() + 1);
admin.setLastLoginFailedTime(new Date());
session.setAttribute("authNResult", "authNFailed");
response.sendRedirect("/login");
}
}
protected boolean isAccountLocked(String userid) {
Administrator admin = userLoginHistory.get(userid);
if (admin != null
&& admin.getLoginFailedCount() == ApplicationUtils.getAccountLockCount()
&& (new Date().getTime() - admin.getLastLoginFailedTime().getTime() < ApplicationUtils
.getAccountLockTime())) {
return true;
}
return false;
}
protected boolean authUser(String username, String password) {
ExprNode filter = null;
EntryFilteringCursor cursor = null;
try {
filter = FilterParser.parse("(&(uid=" + LDAPUtils.escapeLDAPSearchFilter(username.trim())
+ ")(userPassword=" + LDAPUtils.escapeLDAPSearchFilter(password.trim()) + "))");
cursor = EmbeddedADS.service.getAdminSession().search(new LdapDN("ou=people,dc=t246osslab,dc=org"),
SearchScope.SUBTREE, filter, AliasDerefMode.NEVER_DEREF_ALIASES, null);
if (cursor.available()) {
return true;
}
} catch (Exception e) {
log.error("Exception occurs: ", e);
} finally {
if (cursor != null) {
try {
cursor.close();
} catch (Exception e) {
log.error("Exception occurs: ", e);
}
}
}
return false;
}
}
| [
"ktamura.biz.80@gmail.com"
] | ktamura.biz.80@gmail.com |
6c09acd541a99763f96162425d19bfe2b7dc8de2 | dff3f25ac422b19019ef0b743f59d67fb7dc2c11 | /src/cad_empresa/EmpresaDao.java | 43b206970c23e1223e18b5b58a94070693c1b45c | [] | no_license | nerysoftware/pontovenda | 07db2f0005ba11c50bfe05773ea409e20785e8ad | be5c342d7a93fa12320ab5273243f872165c0beb | refs/heads/master | 2023-05-02T22:34:37.972058 | 2021-05-12T08:56:05 | 2021-05-12T08:56:05 | 366,017,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | 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 cad_empresa;
/**
*
* @author nerysoftware
*/
public class EmpresaDao {
}
| [
"nerysoftware@nerysoftware-PC"
] | nerysoftware@nerysoftware-PC |
72ec070a5949c79f523a74149fa6f5bb5f11db68 | 2486dcc367230b7a1084f864368583683dae6fce | /Task5/src/main/java/ru/itmo/wp/web/exception/RedirectException.java | eec3a781710523c31985991840cb749a0c9d476d | [] | no_license | Shashulovskiy/web-homeworks | d3107746e1aa3f5a702bcad803518e828b9f8700 | db0dddcf557ecddc57118bf7e0453738bd87619e | refs/heads/master | 2023-02-03T13:38:40.318976 | 2020-12-18T11:58:14 | 2020-12-18T11:58:14 | 306,690,460 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package ru.itmo.wp.web.exception;
public class RedirectException extends RuntimeException {
private final String target;
public RedirectException(String target) {
this.target = target;
}
public String getTarget() {
return target;
}
}
| [
"stratosphere665@gmail.com"
] | stratosphere665@gmail.com |
913de78b49a70a3d02c241dacf40fc47aa2faa40 | b00f1244cb13975c664b79c6bae69061a2a07b45 | /WS-KingdeeOnlyCode - 副本/app/src/main/java/com/fangzuo/assist/Dao/PDMain.java | 8971f450c7796c8f4e67355fd6cab07a5d5abed3 | [] | no_license | huohehuo/KingdeePDA-OnlyCode-GZ-WS | ff61676747f2ea455ebd062fab51bd1609367046 | 4ebde5e96e0ccdcdef30172ac439619a82509fe4 | refs/heads/master | 2020-09-05T03:18:47.412409 | 2020-05-07T09:29:10 | 2020-05-07T09:29:10 | 219,965,547 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,704 | java | package com.fangzuo.assist.Dao;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
/**
* Created by NB on 2017/8/18.
*/
@Entity
public class PDMain {
@Id(autoincrement = true)
public Long id;
public String FID;
public String FProcessId;
public String FRemark;
public String FDate;
public String FUserName;
public String getFUserName() {
return this.FUserName;
}
public void setFUserName(String FUserName) {
this.FUserName = FUserName;
}
public String getFDate() {
return this.FDate;
}
public void setFDate(String FDate) {
this.FDate = FDate;
}
public String getFRemark() {
return this.FRemark;
}
public void setFRemark(String FRemark) {
this.FRemark = FRemark;
}
public String getFProcessId() {
return this.FProcessId;
}
public void setFProcessId(String FProcessId) {
this.FProcessId = FProcessId;
}
public String getFID() {
return this.FID;
}
public void setFID(String FID) {
this.FID = FID;
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@Generated(hash = 563415013)
public PDMain(Long id, String FID, String FProcessId, String FRemark,
String FDate, String FUserName) {
this.id = id;
this.FID = FID;
this.FProcessId = FProcessId;
this.FRemark = FRemark;
this.FDate = FDate;
this.FUserName = FUserName;
}
@Generated(hash = 172423400)
public PDMain() {
}
}
| [
"753392431@qq.com"
] | 753392431@qq.com |
97e40bfd837e5b88164f113421ae56bee3ecdf0f | f70163dcde66044f6ea3c48fccc4fd1cb622c504 | /code/src/sneer/foundation/lang/CacheMap.java | 95b4a8a5c39a3b1cd5b934a28bcb8e3bf59afdbf | [] | no_license | andreronquetti/sneer | 1f8b3f50909f918b0facdf8393ee04bdb6e7914d | 22a9ecdc7225ebb84d296928c93b556e72381978 | refs/heads/master | 2021-05-26T16:32:31.707480 | 2010-12-03T23:43:23 | 2010-12-03T23:43:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,003 | java | package sneer.foundation.lang;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class CacheMap<K, V> extends ConcurrentHashMap<K, V> {
static public <K, V> CacheMap<K, V> newInstance() {
return new CacheMap<K, V>();
}
private CacheMap() {}
Map<K, Thread> _resolversByKey = new HashMap<K, Thread>();
public <X extends Throwable> V get(K key, final ProducerX<V, X> producerToUseIfAbsent) throws X {
return get(key, new FunctorX<K, V, X>() { @Override public V evaluate(K ignored) throws X {
return producerToUseIfAbsent.produce();
}});
}
public <X extends Throwable> V get(K key, FunctorX<K, V, X> functorToUseIfAbsent) throws X {
return get(key, functorToUseIfAbsent, true);
}
/** Returns null instead of blocking if another thread is running the functor to resolve this same key. */
public <X extends Throwable> V getWithoutBlocking(K key, FunctorX<K, V, X> functorToUseIfAbsent) throws X {
return get(key, functorToUseIfAbsent, false);
}
private <X extends Throwable> V get(K key, FunctorX<K, V, X> functorToUseIfAbsent, boolean blocking) throws X {
boolean thisThreadMustResolve = false;
synchronized (_resolversByKey) {
V found = get(key);
if (found != null) return found;
thisThreadMustResolve = volunteerToResolve(key);
}
if (thisThreadMustResolve) {
V resolved = functorToUseIfAbsent.evaluate(key); //Fix: throw the exception in the other threads waiting too.
synchronized (_resolversByKey) {
put(key, resolved);
_resolversByKey.remove(key);
_resolversByKey.notifyAll();
};
return resolved;
}
if (!blocking) return null;
synchronized (_resolversByKey) {
while (_resolversByKey.containsKey(key))
waitWithoutInterruptions(key);
}
return get(key);
}
private boolean volunteerToResolve(K key) {
Thread resolver = _resolversByKey.get(key);
if (resolver == null) {
_resolversByKey.put(key, Thread.currentThread());
return true;
}
if (resolver == Thread.currentThread())
throw new IllegalStateException("The resolution (loading) of " + key + " is being triggered recursively.");
return false;
}
private void waitWithoutInterruptions(K key) {
try {
_resolversByKey.wait();
} catch (InterruptedException e) {
String stack = stackGiven(_resolversByKey.get(key));
throw new IllegalStateException("This thread was interrupted while waiting for another thread to resolve: " + key + "\n>>>>>>Start of other thread's stack:\n" + stack + "\n<<<<<<End of other thread's stack");
}
}
private String stackGiven(Thread thread) {
String result = "";
for (StackTraceElement element : thread.getStackTrace())
result += "\n\tat " + element.getClassName() + "."
+ element.getMethodName() + "(" + element.getFileName()
+ ":" + element.getLineNumber() + ")";
return result;
}
}
| [
"klauswuestefeld@gmail.com"
] | klauswuestefeld@gmail.com |
9ec8413743f66225bc549c90006b8a5a69ca565d | dac00104c90bd5b7e6c0c5e1f65e4ee32bf07b94 | /useCase/ntut/csie/sprintService/useCase/history/get/GetHistoriesByBacklogItemIdOutput.java | 6e5552c158181aec0fbcf446009b25f9c5d4dfd7 | [] | no_license | JackCake/Sprint-Service | 379c9ce924cfa7a21e3c80c5e643bc337d27f4ad | 57d77fa913e1d11a7dacf8a7603dbdb84fffeafc | refs/heads/master | 2022-06-28T00:19:12.369642 | 2020-02-03T19:07:39 | 2020-02-03T19:07:39 | 203,175,139 | 0 | 0 | null | 2022-06-21T01:42:04 | 2019-08-19T13:09:03 | Java | UTF-8 | Java | false | false | 364 | java | package ntut.csie.sprintService.useCase.history.get;
import java.util.List;
import ntut.csie.sprintService.useCase.Output;
import ntut.csie.sprintService.useCase.history.HistoryModel;
public interface GetHistoriesByBacklogItemIdOutput extends Output{
public List<HistoryModel> getHistoryList();
public void setHistoryList(List<HistoryModel> historyList);
}
| [
"ezKanbanTeam@gmail.com"
] | ezKanbanTeam@gmail.com |
3d5c769c563e4e36ce35f8c638e1aa0df8598e51 | 10bd573ea6cdeb6a0474f037b11788f4d17df492 | /Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/sdk/rest/azure/datalake/analytics/job/models/CreateJobParameters.java | a81a1010091504dce86851d9f7cdc904c79f5367 | [
"MIT"
] | permissive | MBMthethwa/azure-tools-for-java | b98be1cd671abc295c76c1a003c2a3a5c2e34c46 | f51de416e6fa45d4e3627d3725cac7ece266c8f8 | refs/heads/master | 2020-03-21T22:27:08.308245 | 2018-06-19T10:35:41 | 2018-06-20T02:38:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,916 | java | /**
* Copyright (c) Microsoft Corporation
*
* All rights reserved.
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package com.microsoft.azure.hdinsight.sdk.rest.azure.datalake.analytics.job.models;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The parameters used to submit a new Data Lake Analytics job.
*/
public class CreateJobParameters extends BaseJobParameters {
/**
* the friendly name of the job to submit.
*/
@JsonProperty(value = "name", required = true)
private String name;
/**
* the degree of parallelism to use for this job. This must be greater than 0, if set to less than 0 it will
* default to 1.
*/
@JsonProperty(value = "degreeOfParallelism")
private Integer degreeOfParallelism;
/**
* the priority value to use for the current job. Lower numbers have a higher priority. By default, a job has a
* priority of 1000. This must be greater than 0.
*/
@JsonProperty(value = "priority")
private Integer priority;
/**
* the list of log file name patterns to find in the logFolder. '*' is the only matching character allowed. Example
* format: jobExecution*.log or *mylog*.txt.
*/
@JsonProperty(value = "logFilePatterns")
private List<String> logFilePatterns;
/**
* the recurring job relationship information properties.
*/
@JsonProperty(value = "related")
private JobRelationshipProperties related;
/**
* Get the name value.
*
* @return the name value
*/
public String name() {
return this.name;
}
/**
* Set the name value.
*
* @param name the name value to set
* @return the CreateJobParameters object itself.
*/
public CreateJobParameters withName(String name) {
this.name = name;
return this;
}
/**
* Get the degreeOfParallelism value.
*
* @return the degreeOfParallelism value
*/
public Integer degreeOfParallelism() {
return this.degreeOfParallelism;
}
/**
* Set the degreeOfParallelism value.
*
* @param degreeOfParallelism the degreeOfParallelism value to set
* @return the CreateJobParameters object itself.
*/
public CreateJobParameters withDegreeOfParallelism(Integer degreeOfParallelism) {
this.degreeOfParallelism = degreeOfParallelism;
return this;
}
/**
* Get the priority value.
*
* @return the priority value
*/
public Integer priority() {
return this.priority;
}
/**
* Set the priority value.
*
* @param priority the priority value to set
* @return the CreateJobParameters object itself.
*/
public CreateJobParameters withPriority(Integer priority) {
this.priority = priority;
return this;
}
/**
* Get the logFilePatterns value.
*
* @return the logFilePatterns value
*/
public List<String> logFilePatterns() {
return this.logFilePatterns;
}
/**
* Set the logFilePatterns value.
*
* @param logFilePatterns the logFilePatterns value to set
* @return the CreateJobParameters object itself.
*/
public CreateJobParameters withLogFilePatterns(List<String> logFilePatterns) {
this.logFilePatterns = logFilePatterns;
return this;
}
/**
* Get the related value.
*
* @return the related value
*/
public JobRelationshipProperties related() {
return this.related;
}
/**
* Set the related value.
*
* @param related the related value to set
* @return the CreateJobParameters object itself.
*/
public CreateJobParameters withRelated(JobRelationshipProperties related) {
this.related = related;
return this;
}
}
| [
"rufan@microsoft.com"
] | rufan@microsoft.com |
ed8a2233835648125a8f3819c22c79149c011d6a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_34b3bb86801ca323f797af7d7aceb1defa0a7562/ExternalSheetListenerTest/17_34b3bb86801ca323f797af7d7aceb1defa0a7562_ExternalSheetListenerTest_s.java | e74d78b6ab42f0262d51b5f3fae6ef1b66634614 | [] | 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 | 8,768 | java | package org.drools.decisiontable.parser;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
import org.drools.Agenda;
import org.drools.FactException;
import org.drools.FactHandle;
import org.drools.NoSuchFactHandleException;
import org.drools.NoSuchFactObjectException;
import org.drools.ObjectFilter;
import org.drools.QueryResults;
import org.drools.RuleBase;
import org.drools.StatefulSession;
import org.drools.StatelessSession;
import org.drools.WorkingMemory;
import org.drools.concurrent.Future;
import org.drools.event.AgendaEventListener;
import org.drools.event.WorkingMemoryEventListener;
import org.drools.ruleflow.common.instance.IProcessInstance;
import org.drools.spi.AgendaFilter;
import org.drools.spi.AgendaGroup;
import org.drools.spi.AsyncExceptionHandler;
import org.drools.spi.GlobalResolver;
public class ExternalSheetListenerTest extends TestCase {
private ExternalSheetListener esl;
private Map assertedRows = new HashMap();
private List currentRow = new ArrayList();
protected void setUp() throws Exception {
esl = new ExternalSheetListener(2, 2, new TestTemplateContainer(),
new TestTemplateRuleBase(), new TestGenerator());
}
public void testRenderDrl() {
String drl = esl.renderDRL();
assertEquals("Test Template Header\nTest Generated DRL\n", drl);
}
public void testRowHandling() {
esl.newRow(0, 3);
esl.newCell(0, 0, "row0col0", 0);
esl.newCell(0, 1, "row0col1", 0);
esl.newCell(0, 2, "row0col2", 0);
esl.newRow(1, 3);
esl.newCell(1, 0, "row1col0", 0);
esl.newCell(1, 1, "row1col1", 0);
esl.newCell(1, 2, "row1col2", 0);
esl.newRow(2, 3);
esl.newCell(2, 0, "row2col0", 0);
esl.newCell(2, 1, "row2col1", 0);
esl.newCell(2, 2, "row2col2", 0);
esl.finishSheet();
assertEquals(2, assertedRows.size());
for (Iterator it = assertedRows.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
Row row = (Row)entry.getKey();
List cells = (List) entry.getValue();
// first column is not part of the decision table
int i = 1;
for (Iterator it2 = cells.iterator(); it2.hasNext(); i++) {
Cell cell = (Cell) it2.next();
assertEquals("row" + row.getRowNumber() + "col" + i, cell.getValue());
assertEquals("Pattern " + i, cell.getColumn());
}
}
}
public void testRowHandlingBlankRows() {
esl.newRow(0, 3);
esl.newCell(0, 0, "row0col0", 0);
esl.newCell(0, 1, "row0col1", 0);
esl.newCell(0, 2, "row0col2", 0);
esl.newRow(1, 3);
esl.newCell(1, 0, "row1col0", 0);
esl.newCell(1, 1, "row1col1", 0);
esl.newCell(1, 2, "row1col2", 0);
esl.newRow(2, 3);
esl.newCell(2, 0, "row2col0", 0);
esl.newCell(2, 1, "row2col1", 0);
esl.newCell(2, 2, "row2col2", 0);
esl.newRow(3, 3);
esl.newCell(3, 0, "", 0);
esl.newCell(3, 1, "", 0);
esl.newCell(3, 2, "", 0);
esl.newRow(4, 3);
esl.newCell(4, 0, "", 0);
esl.newCell(4, 1, "", 0);
esl.newCell(4, 2, "", 0);
esl.finishSheet();
assertEquals(2, assertedRows.size());
}
private class TestTemplateRuleBase implements TemplateRuleBase {
public StatefulSession newStatefulSession() {
return new StatefulSession() {
public void addEventListener(WorkingMemoryEventListener arg0) {
}
public void addEventListener(AgendaEventListener arg0) {
}
public FactHandle assertObject(Object fact)
throws FactException {
if (fact instanceof Row) {
assertedRows.put(fact, currentRow);
currentRow = new ArrayList();
} else {
currentRow.add(fact);
}
return null;
}
public FactHandle assertObject(Object arg0, boolean arg1)
throws FactException {
return null;
}
public void clearAgenda() {
}
public void clearAgendaGroup(String arg0) {
}
public void dispose() {
}
public void fireAllRules() throws FactException {
}
public void fireAllRules(AgendaFilter arg0)
throws FactException {
}
public Agenda getAgenda() {
return null;
}
public List getAgendaEventListeners() {
return null;
}
public FactHandle getFactHandle(Object arg0)
throws NoSuchFactHandleException {
return null;
}
public List getFactHandles() {
return null;
}
public AgendaGroup getFocus() {
return null;
}
public Object getGlobal(String arg0) {
return null;
}
public Object getObject(FactHandle arg0)
throws NoSuchFactObjectException {
return null;
}
public QueryResults getQueryResults(String arg0) {
return null;
}
public RuleBase getRuleBase() {
return null;
}
public List getWorkingMemoryEventListeners() {
return null;
}
public void modifyObject(FactHandle arg0, Object arg1)
throws FactException {
}
public void removeEventListener(WorkingMemoryEventListener arg0) {
}
public void removeEventListener(AgendaEventListener arg0) {
}
public void retractObject(FactHandle arg0) throws FactException {
}
public void setAsyncExceptionHandler(AsyncExceptionHandler arg0) {
}
public void setFocus(String arg0) {
}
public void setFocus(AgendaGroup arg0) {
}
public void setGlobal(String arg0, Object arg1) {
}
public void setGlobalResolver(GlobalResolver globalResolver) {
}
public IProcessInstance startProcess(String processId) {
return null;
}
public Map getGlobals() {
return null;
}
public Iterator iterateFactHandles() {
return null;
}
public Iterator iterateFactHandles(ObjectFilter filter) {
return null;
}
public Iterator iterateObjects() {
return null;
}
public Iterator iterateObjects(ObjectFilter filter) {
return null;
}
public Future asyncAssertObject(Object object) {
// TODO Auto-generated method stub
return null;
}
public Future asyncAssertObjects(Object[] list) {
// TODO Auto-generated method stub
return null;
}
public Future asyncAssertObjects(List list) {
// TODO Auto-generated method stub
return null;
}
public Future asyncFireAllRules() {
// TODO Auto-generated method stub
return null;
}
public Future asyncFireAllRules(AgendaFilter agendaFilter) {
// TODO Auto-generated method stub
return null;
}
public Future asyncModifyObject(FactHandle factHandle,
Object object) {
// TODO Auto-generated method stub
return null;
}
public Future asyncRetractObject(FactHandle factHandle) {
// TODO Auto-generated method stub
return null;
}
};
}
}
private class TestGenerator implements Generator {
public void generate(String templateName, Row row) {
}
public String getDrl() {
return "Test Generated DRL";
}
}
private class TestTemplateContainer implements TemplateContainer {
public void addColumn(Column c) {
}
public void addTemplate(RuleTemplate template) {
}
public Column[] getColumns() {
return new Column[] { new Column("Pattern 1"),
new Column("Pattern 2"), new Column("Pattern 3") };
}
public String getHeader() {
return "Test Template Header";
}
public Map getTemplates() {
return null;
}
public void setHeader(String head) {
}
public void setTemplates(Map templates) {
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
86229c00cb720f0967e5f625e16198da5d7518cf | 4991d7ae028e848e4bc06edef0a7e2adca379771 | /src/main/java/com/gb/ir/IRClient.java | ec50e748c7f63178971446e03ffdfd604314ddb7 | [
"Apache-2.0"
] | permissive | w-g-b/IRS | 8d589a0da1458d88e0e0ca88c80fee807c7105b5 | 876dadead7382ed22d70c869ba0d44c2eb27ab91 | refs/heads/master | 2020-05-05T13:00:38.410965 | 2019-04-13T04:05:18 | 2019-04-13T04:05:18 | 180,055,182 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,802 | java | package com.gb.ir;
import com.gb.ir.util.PathUtils;
import java.io.*;
import java.net.Socket;
//客户端,可任意,根据协议,根据协议发送指定的数据到远程服务器,由远程服务器转给客户端,客户端的实现可以任意选择
public class IRClient {
public static void main(String[] args) throws IOException {
IRClient irClient = new IRClient();
irClient.sendMsg("139.199.88.206", 4567);
// irClient.sendMsg("127.0.0.1", 4567);
}
public void sendMsg(String ip, int port) throws IOException {
File file = new File(PathUtils.getRootPath() + "input/ThePalaceMuseum.jpg");
BufferedInputStream bfis = new BufferedInputStream(new FileInputStream(file));
Socket client = new Socket(ip, port);
BufferedOutputStream bos = new BufferedOutputStream(client.getOutputStream());
bos.write("printer".getBytes());
bos.flush();
//写入开始表示
//写入文件
bos.write(Constant.MESSAGE_HEAD_BYTES);
// 文件操作
int len;
byte[] bytes = new byte[Constant.BUFFER_BYTE_SIZE];
while ((len = bfis.read(bytes)) > 0) {
bos.write(bytes, 0, len);
}
bos.flush();
//
// 其他操作
// bos.write("This is the really Message!".getBytes());
// bos.write("This is the really Message!".getBytes());
// bos.write("This is the really Message!".getBytes());
// bos.write("notepad".getBytes());
// bos.write("calc".getBytes());
// bos.write("java HelloWorld".getBytes());
// bos.flush();
bfis.close();
bos.write(Constant.MESSAGE_END_BYTES);
bos.flush();
client.close();
System.out.println("客户端已经关闭!");
}
}
| [
"1251191746@qq.com"
] | 1251191746@qq.com |
a7f380150d0078e2968516d71761c49d2c9607b7 | 557d67121ffb550aa3472c2ae07fcac6eb6568a1 | /project/app/src/main/java/dgarcia/msse655/regis/project/mainActivityFragment.java | 8849a6ae8de3b79015175957c55c14e67d892680 | [] | no_license | dgghun/AndroidDev | 30018ae076762c7028249504555b698e526e50dd | 116ba2526bf0c48bf065a9a19628b870596c7dbc | refs/heads/master | 2020-12-31T00:53:25.960635 | 2017-06-01T23:46:30 | 2017-06-01T23:46:30 | 80,576,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,267 | java | package dgarcia.msse655.regis.project;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.view.View.OnClickListener;
import android.widget.Toast;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import dgarcia.msse655.regis.project.adapters.ReviewAdapter;
import dgarcia.msse655.regis.project.domain.Review;
import dgarcia.msse655.regis.project.services.ReviewSvcSQLiteImpl;
import static android.widget.Toast.LENGTH_SHORT;
public class mainActivityFragment extends Fragment{
private List<Review> reviewList = null;
ReviewAdapter reviewsAdapter;
ReviewSvcSQLiteImpl reviewSvcSQLite;
final int CODE_ADD_REVIEW = 1;
public mainActivityFragment() {
// Required empty public constructor
}
//Add review to reviewsAdapter
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (resultCode){
case CODE_ADD_REVIEW:
Review review = (Review)data.getSerializableExtra("Review");
if(review.getReviewId() != -1) reviewsAdapter.add(review); //review was save successfully, add to view
break;
}
}// END OF onActivityResult()
@Override //Setup Context Menu for long press
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Select Action");
menu.add(0,v.getId(), 0, "Delete");
menu.add(0,v.getId(), 0, "Share");
menu.add(0,v.getId(), 0, "Exit");
}
@Override //Handles Context Menu for long press
public boolean onContextItemSelected(MenuItem item) {
super.onContextItemSelected(item);
String message = item.getTitle().toString();
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
if(message.equals("Delete")){ //delete review from adapter & db
int rowsBefore, rowsAfter;
reviewList = reviewSvcSQLite.retrieveAllReviews(); //Get reviews in db
rowsBefore = reviewList.size(); //Get row count before delete
reviewSvcSQLite.delete(reviewsAdapter.getItem(info.position)); //Delete review from db
reviewsAdapter.remove(reviewsAdapter.getItem(info.position)); //Remove from AdapterListView
reviewList = reviewSvcSQLite.retrieveAllReviews(); //Get new row count
rowsAfter = reviewList.size();
if(rowsAfter < rowsBefore) Toast.makeText(getContext(), "Review Deleted", Toast.LENGTH_SHORT).show();
else Toast.makeText(getContext(), "Error deleting review.", LENGTH_SHORT).show();
}
else if(message.equals("Share"))
Toast.makeText(getContext(), message + " coming soon!", LENGTH_SHORT).show();
else return false;
return true;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Store inflated view
View rootView = inflater.inflate(R.layout.fragment_main_activity, container, false);
reviewSvcSQLite = new ReviewSvcSQLiteImpl(this.getContext()); // start SQLite database, final is used for onClick()
//TODO-TESTING ITEMS
//reviewSvcSQLite.deleteAll(); //REMOVE THIS, DELETES DATABASE ON START!!!!!!!!!!!!!!!!!!!
// Review review = new Review();
// review.setReviewTitle("Test Review Title");
// review.setReviewParagraph("This is a test paragraph about stuff and things, blah blah blah blah blah blah blah blah blah blah ");
// reviewSvcSQLite.create(review); // add review to db
reviewList = new ArrayList<>(reviewSvcSQLite.retrieveAllReviews()); //Initialize review ArrayList with SQLite database.
final ListView reviewListView = (ListView) rootView.findViewById(R.id.ListView_list_of_reviews); //get listView in fragMainActivity
reviewsAdapter = new ReviewAdapter(rootView.getContext(), R.layout.review_list_item); //Custom Review list adapter
reviewListView.setAdapter(reviewsAdapter); //Set adapter on the ListView
// for(final Review r : getReviewEntries()) reviewsAdapter.add(r); //populate list to adapter w/ test method getReviewEntries()
for(final Review r : reviewList) reviewsAdapter.add(r); //populate reviewList to adapter
//ListView onClick handler
reviewListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Review review = (Review) reviewListView.getItemAtPosition(i); //Get i from list, i is the position
Intent intent = new Intent(view.getContext(), reviewDetailActivity.class); //New intent on reviewDetailActivity
intent.putExtra("Review", review); //Put Review extra in, i.e. clicked Review from listView.
getActivity().startActivity(intent);
}
});
// Add Review Button onClickListener
Button addReviewButton = (Button) rootView.findViewById(R.id.button_addReview);
addReviewButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Review review = new Review();
Intent intent = new Intent(view.getContext(), reviewDetailActivity.class);
intent.putExtra("Review", review); // put the string extra in, i.e. the "item" clicked name.
startActivityForResult(intent,CODE_ADD_REVIEW); // starts activity with my code of 1. Could use to check return.
}
});
registerForContextMenu(reviewListView);
// Inflate the layout for this fragment
return rootView;
}// END OF onCreate()
/**
* Test review list
* @return a list of reviews
*/
private List<Review> getReviewEntries() {
// Let's setup some test data.
// Normally this would come from some asynchronous fetch into a data source
// such as a sqlite database, or an HTTP request
final List<Review> reviews = new ArrayList<Review>();
for(int i = 1; i < 50; i++) {
reviews.add(new Review( i, "Review Title # " + i,
"This review is about something and I think it is important because of stuff and things, blah blah blah blah blah blah blah" +
"blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah"));
}
return reviews;
}
}
| [
"gabriel3052000@yahoo.com"
] | gabriel3052000@yahoo.com |
3073959351ec851de1bcc6c0faf0abeb0f3b73e8 | 2fbf5b13311d64f598fc8f044a9e45adc6f490d6 | /Algorithms/src/programmingInJava/Quadratic.java | 780519c2487ebf0d4170dd720f1827d9ce34706f | [] | no_license | iMaruf/JavaBasicLearnning | 10ce13bdd3f820f8a30ad44c2f894fc61cade1bc | 62960f9c253295c35e0a12beafe5d4c462bea990 | refs/heads/master | 2020-09-20T21:03:14.708680 | 2016-10-31T16:34:45 | 2016-10-31T16:34:45 | 66,731,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package programmingInJava;
public class Quadratic {
public static void main(String[] args) {
double b = Double.parseDouble(args[0]);
double c = Double.parseDouble(args[1]);
double discriminant = b*b - 4.0*c;
double sqroot = Math.sqrt(discriminant);
double root1 = (-b + sqroot)/2.0;
double root2 = (-b - sqroot)/2.0;
System.out.println(root1);
System.out.println(root2);
}
}
| [
"kamruzzamanmaruf@gmail.com"
] | kamruzzamanmaruf@gmail.com |
f8c7267d41411b800de9790e7a2b5e00a7278d20 | d85f01f69f29036424d752b92d0160215f75d88a | /src/main/java/com/ofi/rotamanager/web/rest/errors/FieldErrorDTO.java | 3b2007894a94ce39616384398e4403011495b8b6 | [] | no_license | BulkSecurityGeneratorProject/rotamanager | 86470a7caac4fe11ac8fb081aa019c116fff49af | 55ca5099d70c973af6b7bbc72eadd98119c72f9b | refs/heads/master | 2022-12-13T18:56:58.022864 | 2016-04-20T20:39:10 | 2016-04-20T20:39:10 | 296,593,966 | 0 | 0 | null | 2020-09-18T10:51:53 | 2020-09-18T10:51:52 | null | UTF-8 | Java | false | false | 653 | java | package com.ofi.rotamanager.web.rest.errors;
import java.io.Serializable;
public class FieldErrorDTO implements Serializable {
private static final long serialVersionUID = 1L;
private final String objectName;
private final String field;
private final String message;
public FieldErrorDTO(String dto, String field, String message) {
this.objectName = dto;
this.field = field;
this.message = message;
}
public String getObjectName() {
return objectName;
}
public String getField() {
return field;
}
public String getMessage() {
return message;
}
}
| [
"omar1490@gmail.com"
] | omar1490@gmail.com |
c3e6ccd12b9938a65c55d8d8ceaa111fa06556cb | 6c9731a0f5df905eb2e41070b99817b7c89a9c1a | /tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/reliable/DropCommandStrategy.java | 176016e6e30223e01760d6c5596337051e62ef98 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | rh-messaging/jboss-activemq-artemis | 83d8b6f7268add185d0fcbd8a7e4b2855a246ffd | 4e0575a744d6f5698b701fd34460f5d2607a64a0 | refs/heads/jboss-1.5.5-x | 2021-01-18T05:16:45.569770 | 2018-12-10T19:53:15 | 2018-12-10T19:53:15 | 43,129,336 | 8 | 40 | Apache-2.0 | 2021-12-21T16:02:19 | 2015-09-25T09:49:20 | Java | UTF-8 | Java | false | false | 1,134 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.transport.reliable;
import java.net.SocketAddress;
/**
*
*
*/
public interface DropCommandStrategy {
/**
* Returns true if the command should be dropped for
* the given command ID and address
*/
boolean shouldDropCommand(int commandId, SocketAddress address, boolean redelivery);
}
| [
"clebertsuconic@apache.org"
] | clebertsuconic@apache.org |
91694d9bcddbe56878239581fb933f50802feedd | 6aad51fe2551c8bb8b0e32ea3ad6fd8142dc9237 | /src/main/java/co/simplon/web/TacheRestController.java | 0667a9f0a50e5526f645f04680a04ff3da54e722 | [] | no_license | mbajoumbe/huroku | d7993c03af2d499a92f479b0b60b157ad1c939a0 | ce8f0386fc27f3b16915201990d4e9fee4bd63d6 | refs/heads/master | 2020-11-27T03:14:50.019942 | 2019-12-20T15:01:05 | 2019-12-20T15:01:05 | 229,284,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package co.simplon.web;
import co.simplon.dao.TacheRepository;
import co.simplon.entities.Tache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
@RestController
public class TacheRestController {
@Autowired
private TacheRepository tacheRepository;
@GetMapping("/tasks")
public List<Tache> tasks(){
return tacheRepository.findAll();
}
@PostMapping("/tasks")
public void postTache(@RequestBody Tache t) {
tacheRepository.save(new Tache(null , t.getName()));
}
}
| [
"sohankenji97441@gmail.com"
] | sohankenji97441@gmail.com |
c1f799a294239721cc86a434984aacdf895ef7a0 | 77892cd0d069740bf66824100b356b19cf7af6e7 | /src/main/java/com/dbs/uaa/web/rest/errors/FieldErrorVM.java | 68a4759b0f69de6281cfa8284f4df71bc1b35bcc | [] | no_license | rajeevjha2k4/dbsweb-uaa-application | 8bde3fb0a87b67d172575138eedf96c6c1241bb6 | 3e4ddab4d77e1c2ba10eab7ab9093b7017379e06 | refs/heads/master | 2020-04-15T16:02:53.342200 | 2019-01-09T08:02:59 | 2019-01-09T08:02:59 | 164,816,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.dbs.uaa.web.rest.errors;
import java.io.Serializable;
public class FieldErrorVM implements Serializable {
private static final long serialVersionUID = 1L;
private final String objectName;
private final String field;
private final String message;
public FieldErrorVM(String dto, String field, String message) {
this.objectName = dto;
this.field = field;
this.message = message;
}
public String getObjectName() {
return objectName;
}
public String getField() {
return field;
}
public String getMessage() {
return message;
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
1ccf013f306159e4f6cecf4eee9ed933918bf613 | 2aa40b1a252aa5668f32d5fa679b9175b5556fc5 | /lessonUnitTest/src/main/java/testing/SettingsLoader.java | 0861925dd32cf034379ebf44fcc3e13d6e719d85 | [] | no_license | VPodkhomutov/JavaSchool2020 | 2dd176ce2f031aa75ada77a26f6913d14dfec41e | aec43568936f9b792ca8e091cb3edc6d2193db5e | refs/heads/master | 2023-02-20T20:52:33.307647 | 2021-01-19T18:29:01 | 2021-01-19T18:29:01 | 311,671,003 | 0 | 0 | null | 2021-02-01T16:32:30 | 2020-11-10T13:43:39 | Java | UTF-8 | Java | false | false | 325 | java | package testing;
import java.util.Collections;
import java.util.Map;
public class SettingsLoader {
public Map<String, String> loadSettings() {
System.out.println("Если вы видите этот лог, то тест написан неправильно5");
return Collections.emptyMap();
}
}
| [
"tanzors@mail.ru"
] | tanzors@mail.ru |
7d0c2fb994755b2b66ad501b5c632f3475e79cc4 | 473b61613f54747a12d511d9352f3d5101cc4be4 | /selectCourse/src/excel_MySQL/DbToExcel.java | 0b961b9e3fc32f9ef76bbb089d3375b2f48560dc | [] | no_license | vipyxf/selectCourse | a91d7e8f39096c90d922e184f73d68766ad7bc91 | 559f4439847607dc0c6718292a8a70cc976caab5 | refs/heads/master | 2020-03-11T17:44:36.398701 | 2018-04-19T08:40:46 | 2018-04-19T08:40:46 | 130,155,977 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,336 | java | package excel_MySQL;
import java.io.File;
import java.io.IOException;
import java.util.List;
import model.Student;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
public class DbToExcel {
public static void main(String args[]) throws IOException,
RowsExceededException, WriteException {
WritableWorkbook wwb = null;
// 创建可写入的工作簿
String fileName = "E://tt2.xls";
File file = new File(fileName);
if (!file.exists()) {
file.createNewFile();
}
// 以fileName为文件名创建一个WorkBook
wwb = Workbook.createWorkbook(file);
// 创建工作表
WritableSheet ws = wwb.createSheet("Test Shee 1", 0);
// 查询数据库中的所有数据
List<Student> list = StuService.getAllData();
// 要插入到的Excel表格的行号,默认从0开始
Label lid = new Label(0, 0, "学号(ID)");
Label lname = new Label(1, 0, "姓名(name)");
Label lpwd = new Label(2, 0, "密码(pwd)");
Label lbj = new Label(3, 0, "班级");
Label lhome = new Label(4, 0, "籍贯");
Label lphone = new Label(5, 0, "电话");
Label lemail = new Label(6, 0, "邮箱");
ws.addCell(lid);
ws.addCell(lname);
ws.addCell(lpwd);
ws.addCell(lbj);
ws.addCell(lhome);
ws.addCell(lphone);
ws.addCell(lemail);
for (int i = 0; i < list.size(); i++) {
/*Java中int转换为String型的方法
* 1》String.valueOf(i)
* 2》Integer.toString(i)
* 3》i+""
*
* */
Label lid1 = new Label(0, i + 1, list.get(i).getSid() + "");
Label lname1 = new Label(1, i + 1, list.get(i).getSname());
Label lpwd1 = new Label(2, i + 1, list.get(i).getSpwd());
Label lbj1 = new Label(3, i + 1, list.get(i).getBanji());
Label lhome1 = new Label(4, i + 1, list.get(i).getHome());
Label lphone1 = new Label(5, i + 1, list.get(i).getPhone() + "");
Label lemail1 = new Label(6, i + 1, list.get(i).getEmail());
ws.addCell(lid1);
ws.addCell(lname1);
ws.addCell(lpwd1);
ws.addCell(lbj1);
ws.addCell(lhome1);
ws.addCell(lphone1);
ws.addCell(lemail1);
}
// 写进文档
wwb.write();
// 关闭Excel工作簿
wwb.close();
}
}
| [
"635187100@qq.com"
] | 635187100@qq.com |
14dbbee1d3b34199c8a1dd2074199f83fad941ee | 9d32980f5989cd4c55cea498af5d6a413e08b7a2 | /A92s_10_0_0/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java | 29bdad34ae2d9d200bac9cb220cb9d4c798321e4 | [] | no_license | liuhaosource/OppoFramework | e7cc3bcd16958f809eec624b9921043cde30c831 | ebe39acabf5eae49f5f991c5ce677d62b683f1b6 | refs/heads/master | 2023-06-03T23:06:17.572407 | 2020-11-30T08:40:07 | 2020-11-30T08:40:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package org.apache.http.impl.conn.tsccm;
import java.lang.ref.ReferenceQueue;
import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.OperatedClientConnection;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.impl.conn.AbstractPoolEntry;
@Deprecated
public class BasicPoolEntry extends AbstractPoolEntry {
private final BasicPoolEntryRef reference;
public BasicPoolEntry(ClientConnectionOperator op, HttpRoute route, ReferenceQueue<Object> queue) {
super(op, route);
if (route != null) {
this.reference = new BasicPoolEntryRef(this, queue);
return;
}
throw new IllegalArgumentException("HTTP route may not be null");
}
/* access modifiers changed from: protected */
public final OperatedClientConnection getConnection() {
return ((AbstractPoolEntry) this).connection;
}
/* access modifiers changed from: protected */
public final HttpRoute getPlannedRoute() {
return ((AbstractPoolEntry) this).route;
}
/* access modifiers changed from: protected */
public final BasicPoolEntryRef getWeakRef() {
return this.reference;
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
624c5ffc86a5d6b594144f3f1e181e9ba027e2d7 | 1b0f79c5fad3f7973cd6de24cceb4190b573a3d3 | /TanksServer/src/main/java/tanks/server/Server.java | 597f432476ad646dbc5cc5a8350f73f06107648d | [] | no_license | ltammie/Tank-Game | d1042cac570176ce7f77f905ea5824020be9afbb | f6f05560285104de5349bf0cbc8a89d217d84f25 | refs/heads/main | 2023-01-02T10:58:20.701117 | 2020-10-25T17:57:34 | 2020-10-25T17:57:34 | 307,044,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,224 | java | package tanks.server;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.LinkedList;
public class Server {
private static Socket clientSocket;
private static ServerSocket server;
public static LinkedList<ServerThread> serverList = new LinkedList<>();
public static void start(Integer port) throws IOException, InterruptedException {
try {
server = new ServerSocket(port);
System.out.println("Server running!");
for (int i = 1; i <= 2; i++) {
System.out.println("Waiting for player " + i);
clientSocket = server.accept();
try {
serverList.add(new ServerThread(clientSocket, i));
System.out.println("Added player " + i);
} catch (IOException ignored) {
clientSocket.close();
}
}
for (ServerThread t : serverList) {
t.out.writeBoolean(true);
t.start();
}
while (true);
} finally {
server.close();
System.out.println("Server stopped working");
}
}
}
| [
"ltammie@vo-g3.msk.21-school.ru"
] | ltammie@vo-g3.msk.21-school.ru |
7ca9a540ba996c3ec4905e9a1c733932c52d9364 | 2757e82fb638366503d827fbee95f4cb81181c50 | /app/src/androidTest/java/com/sepidehmiller/alumniconnector/ExampleInstrumentedTest.java | 0cae8459efa4995b072489ca4a6b99b6ad29c05e | [] | no_license | baghaii/Capstone-Project | dbac8df63813124cb18358dc17a05c94ecb3cb81 | 8ea2fe78ad257b8dd89f280856c2d0d209815173 | refs/heads/master | 2020-03-28T02:16:42.424960 | 2019-04-03T23:17:00 | 2019-04-03T23:17:00 | 147,559,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package com.sepidehmiller.alumniconnector;
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.*;
/**
* 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.getTargetContext();
assertEquals("com.sepidehmiller.alumniconnector", appContext.getPackageName());
}
}
| [
"baghaii@gmail.com"
] | baghaii@gmail.com |
dc2520dfe3578b8b8c63004b60fd096630358871 | fad3bd68db6b3833fb97fbd5ba7af206b2390fc4 | /src/main/java/com/marioot/hnbapp/security/UserNotActivatedException.java | 6d6978d51a69a978cbb6ee277d435194b5ce2361 | [] | no_license | marioot/hnbapp | a414772aeae76ccee8366a97fe804cb2cd6af166 | d6031d0f8e3f0d9b65492456b3107a9120100d21 | refs/heads/master | 2020-08-25T06:06:47.370651 | 2015-09-08T06:57:43 | 2015-09-08T06:57:43 | 41,910,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java | package com.marioot.hnbapp.security;
import org.springframework.security.core.AuthenticationException;
/**
* This exception is throw in case of a not activated user trying to authenticate.
*/
public class UserNotActivatedException extends AuthenticationException {
public UserNotActivatedException(String message) {
super(message);
}
public UserNotActivatedException(String message, Throwable t) {
super(message, t);
}
}
| [
"mario.ogrizektomas@gmail.com"
] | mario.ogrizektomas@gmail.com |
5a121cecd0ccc6054ae100e8cd2603b791085819 | 0310c2f62f5e400a899eee4c6153f576a55ab5fb | /src/net/socialgamer/cah/data/GameManager.java | 2539b5bd0d7e10ca7f2569532999a01ddf277c25 | [] | no_license | BaconRevolution/PretendYoureXyzzy-master | 22bc3b706f472697331dd305ddb292c0c0adeeb3 | 35457af4b2ba66b7ace48b654f726f2f52c830d2 | refs/heads/master | 2016-09-05T16:29:49.507869 | 2013-02-21T23:52:29 | 2013-02-21T23:52:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,464 | java | /**
* Copyright (c) 2012, Andy Janata
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.socialgamer.cah.data;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import net.socialgamer.cah.Constants.LongPollEvent;
import net.socialgamer.cah.Constants.LongPollResponse;
import net.socialgamer.cah.Constants.ReturnableData;
import net.socialgamer.cah.data.Game.TooManyPlayersException;
import net.socialgamer.cah.data.GameManager.GameId;
import net.socialgamer.cah.data.QueuedMessage.MessageType;
import com.google.inject.BindingAnnotation;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
/**
* Manage games for the server.
*
* This is also a Guice provider for game ids.
*
* @author Andy Janata (ajanata@socialgamer.net)
*/
@Singleton
@GameId
public class GameManager implements Provider<Integer> {
private final int maxGames;
private final Map<Integer, Game> games = new TreeMap<Integer, Game>();
private final Provider<Game> gameProvider;
private final ConnectedUsers users;
/**
* Potential next game id.
*/
private int nextId = 0;
/**
* Create a new game manager.
*
* @param gameProvider
* Provider for new {@code Game} instances.
* @param maxGames
* Maximum number of games allowed on the server.
* @param users
* Connected user manager.
*/
@Inject
public GameManager(final Provider<Game> gameProvider, @MaxGames final Integer maxGames,
final ConnectedUsers users) {
this.gameProvider = gameProvider;
this.maxGames = maxGames;
this.users = users;
}
/**
* Creates a new game, if there are free game slots. Returns {@code null} if there are already the
* maximum number of games in progress.
*
* @return Newly created game, or {@code null} if the maximum number of games are in progress.
*/
private Game createGame() {
synchronized (games) {
if (games.size() >= maxGames) {
return null;
}
final Game game = gameProvider.get();
if (game.getId() < 0) {
return null;
}
games.put(game.getId(), game);
return game;
}
}
/**
* Creates a new game and puts the specified user into the game, if there are free game slots.
* Returns {@code null} if there are already the maximum number of games in progress.
*
* Creating the game and adding the user are done atomically with respect to another game getting
* created, or even getting the list of active games. It is impossible for another user to join
* the game before the requesting user.
*
* @param user
* User to place into the game.
* @return Newly created game, or {@code null} if the maximum number of games are in progress.
* @throws IllegalStateException
* If the user is already in a game and cannot join another.
*/
public Game createGameWithPlayer(final User user) throws IllegalStateException {
synchronized (games) {
final Game game = createGame();
if (game == null) {
return null;
}
try {
game.addPlayer(user);
} catch (final IllegalStateException ise) {
destroyGame(game.getId());
throw ise;
} catch (final TooManyPlayersException tmpe) {
// this should never happen -- we just made the game
throw new Error("Impossible exception: Too many players in new game.", tmpe);
}
broadcastGameListRefresh();
return game;
}
}
/**
* This probably will not be used very often in the server: Games should normally be deleted when
* all players leave it. I'm putting this in if only to help with testing.
*
* Destroys a game immediately. This will almost certainly cause errors on the client for any
* players left in the game. If {@code gameId} isn't valid, this method silently returns.
*
* @param gameId
* ID of game to destroy.
*/
public void destroyGame(final int gameId) {
synchronized (games) {
final Game game = games.remove(gameId);
if (game == null) {
return;
}
// if the prospective next id isn't valid, set it to the id we just removed
if (nextId == -1 || games.containsKey(nextId)) {
nextId = gameId;
}
// remove the players from the game
final List<User> usersToRemove = game.getUsers();
for (final User user : usersToRemove) {
game.removePlayer(user);
}
broadcastGameListRefresh();
}
}
/**
* Broadcast an event to all users that they should refresh the game list.
*/
public void broadcastGameListRefresh() {
final HashMap<ReturnableData, Object> broadcastData = new HashMap<ReturnableData, Object>();
broadcastData.put(LongPollResponse.EVENT, LongPollEvent.GAME_LIST_REFRESH.toString());
users.broadcastToAll(MessageType.GAME_EVENT, broadcastData);
}
/**
* Get an unused game ID, or -1 if the maximum number of games are in progress. This should not be
* called in such a case, though!
*
* TODO: make this not suck
*
* @return Next game id, or {@code -1} if the maximum number of games are in progress.
*/
@Override
public Integer get() {
synchronized (games) {
if (games.size() >= maxGames) {
return -1;
}
if (!games.containsKey(nextId) && nextId >= 0) {
final int ret = nextId;
nextId = candidateGameId(ret);
return ret;
} else {
final int ret = candidateGameId();
nextId = candidateGameId(ret);
return ret;
}
}
}
private int candidateGameId() {
return candidateGameId(-1);
}
/**
* Try to guess a good candidate for the next game id.
*
* @param skip
* An id to skip over.
* @return A guess for the next game id.
*/
private int candidateGameId(final int skip) {
synchronized (games) {
if (games.size() >= maxGames) {
return -1;
}
for (int i = 0; i < maxGames; i++) {
if (i == skip) {
continue;
}
if (!games.containsKey(i)) {
return i;
}
}
return -1;
}
}
/**
* @return A copy of the list of all current games.
*/
public Collection<Game> getGameList() {
synchronized (games) {
// return a copy
return new ArrayList<Game>(games.values());
}
}
/**
* Gets the game with the specified id, or {@code null} if there is no game with that id.
*
* @param id
* Id of game to retrieve.
* @return The Game, or {@code null} if there is no game with that id.
*/
public Game getGame(final int id) {
synchronized (games) {
return games.get(id);
}
}
Map<Integer, Game> getGames() {
return games;
}
@BindingAnnotation
@Retention(RetentionPolicy.RUNTIME)
public @interface GameId {
}
@BindingAnnotation
@Retention(RetentionPolicy.RUNTIME)
public @interface MaxGames {
}
}
| [
"darksage97@yahoo.com"
] | darksage97@yahoo.com |
80e1273147d597bedec1ecfb2e311188abb3c7d4 | ef704c22962fbcc019676a0a6c8360865b615462 | /src/test/java/com/liyg/test_springboot/ControllerTest.java | d2f4fc7f52c878d7b99327369a6f8a799c15b285 | [] | no_license | liyonggang0475/gitLearn | 2fdaca1c6b65d4c4a30afd61130bb32b918f1ffc | 0bb1af4d12546e225284dc35adc9689afdc5d65f | refs/heads/master | 2022-06-30T21:28:09.058902 | 2020-11-05T03:08:17 | 2020-11-05T03:08:17 | 245,056,669 | 1 | 0 | null | 2022-06-21T03:06:11 | 2020-03-05T03:08:13 | Java | UTF-8 | Java | false | false | 1,471 | java | package com.liyg.test_springboot;
import com.liyg.test_springboot.web.TestController;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
@SpringBootTest
public class ControllerTest {
private MockMvc mockMvc;
@Test
public void getUser() throws Exception {
mockMvc = MockMvcBuilders.standaloneSetup(new TestController()).build();
mockMvc.perform(MockMvcRequestBuilders.post("/getUser")).andDo((MockMvcResultHandlers.print()));
}
@Test
public void hello() throws Exception {
mockMvc = MockMvcBuilders.standaloneSetup(new TestController()).build();
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get("/hello?name=liyg")).andReturn();
System.out.println(result.getHandler().toString());
}
@Test
public void saveUser() throws Exception {
mockMvc = MockMvcBuilders.standaloneSetup(new TestController()).build();
mockMvc.perform(MockMvcRequestBuilders.post("/saveUser").param("name", "li")
.param("age", "199").param("password", "125"));
}
}
| [
"liyg@glodon.com"
] | liyg@glodon.com |
da7b08dfdf1ea0b31e9addf005050e496cf7393d | 20fb46971b4f3107bf898b22aeb5ba3502f603bd | /app/src/main/java/com/example/nce23/moviereviewapplication/ProfilePageActivity.java | 9d065635983132e207f0df8e5bcc4e13c8deb1db | [] | no_license | WorstYasuoSG/MovieFn | c226691c1a0086aaea832fca497cfe54717f1ea0 | 0572dba5e2a2c3923f834c9c816037c3152a5ac1 | refs/heads/master | 2020-03-25T11:49:58.345544 | 2018-08-06T16:18:20 | 2018-08-06T16:18:20 | 143,750,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,119 | java | package com.example.nce23.moviereviewapplication;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.theartofdev.edmodo.cropper.CropImage;
import com.theartofdev.edmodo.cropper.CropImageView;
public class ProfilePageActivity extends AppCompatActivity {
private FirebaseAuth firebaseAuth;
private TextView textViewUserEmail;
private TextView textViewUsername;
private Button buttonLogout;
private StorageReference storageReference;
private FirebaseFirestore firebaseFirestore;
private ImageView imageViewDp;
private String user_id;
private FirebaseUser firebaseUser;
private FirebaseAuth.AuthStateListener mAuthListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile_page);
firebaseAuth = FirebaseAuth.getInstance();
final FirebaseUser user = firebaseAuth.getCurrentUser();
user_id = firebaseAuth.getCurrentUser().getUid();
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottomNavView_Bar);
textViewUsername = (TextView) findViewById(R.id.textViewUsername);
textViewUserEmail = (TextView) findViewById(R.id.textViewUserEmail);
textViewUserEmail.setText(user.getEmail());
imageViewDp = findViewById(R.id.imageViewDp);
System.out.println(user_id);
firebaseFirestore = FirebaseFirestore.getInstance();
firebaseFirestore.collection("Users").document(user_id).get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
if (task.getResult().exists()) {
String image = task.getResult().getString("image");
String user_name = task.getResult().getString("Username");
textViewUsername.setText(user_name);
RequestOptions placeholder = new RequestOptions();
placeholder.placeholder(R.drawable.ic_account_circle_black_24dp);
Glide.with(ProfilePageActivity.this).setDefaultRequestOptions(placeholder).load(image).into(imageViewDp);
}
} else {
Toast.makeText(ProfilePageActivity.this, "Firestore Retrieve Error: " + task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
bottomNavigationView.setOnNavigationItemReselectedListener(new BottomNavigationView.OnNavigationItemReselectedListener() {
@Override
public void onNavigationItemReselected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_home:
Intent HomePageIntent = new Intent (ProfilePageActivity.this,HomePageActivity.class);
startActivity(HomePageIntent);
break;
case R.id.nav_favourites:
Intent FavoritePageIntent = new Intent (ProfilePageActivity.this,FavoritePageActivity.class);
startActivity(FavoritePageIntent);
break;
case R.id.nav_account:
Intent ProfilePageIntent = new Intent (ProfilePageActivity.this,ProfilePageActivity.class);
startActivity(ProfilePageIntent);
break;
}
}
});
}
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
if(firebaseAuth.getCurrentUser() == null) {
startActivity(new Intent(ProfilePageActivity.this, HomePageActivity.class));
}
}
public void onClickLogOut (View v)
{
firebaseAuth.signOut();
finish();
startActivity(new Intent(this,LoginActivity.class));
finish();
}
}
| [
"dum@joebloggs.com"
] | dum@joebloggs.com |
1591d73bc784650c38fd19c9157b366fe07624a1 | 08b98657a91f28ec97f3dc42cbef44e7c71f4cb8 | /prueba2/src/prueba2/ApiId.java | 022c4cd7b31f8d2f7a0f8961e52248e75ee4a88e | [] | no_license | guillentu/biobot-GUI | 4501fee0d381ce55655d42ea2f79678aea7239be | 33a4348030ba09165e5ef7ce89a19ebb6ab300cd | refs/heads/master | 2016-09-05T22:15:29.388695 | 2014-12-10T21:11:42 | 2014-12-10T21:11:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,766 | java | /**
* Copyright (c) 2008 Andrew Rapp. All rights reserved.
*
* This file is part of XBee-API.
*
* XBee-API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XBee-API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBee-API. If not, see <http://www.gnu.org/licenses/>.
*/
package prueba2;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
public enum ApiId {
/**
* API ID: 0x0
*/
TX_REQUEST_64 (0x0),
/**
* API ID: 0x1
*/
TX_REQUEST_16 (0x1),
/**
* API ID: 0x08
*/
AT_COMMAND (0x08),
/**
* API ID: 0x09
*/
AT_COMMAND_QUEUE (0x09),
/**
* API ID: 0x17
*/
REMOTE_AT_REQUEST (0x17),
/**
* API ID: 0x10
*/
ZNET_TX_REQUEST (0x10),
/**
* API ID: 0x11
*/
ZNET_EXPLICIT_TX_REQUEST (0x11),
/**
* API ID: 0x80
*/
RX_64_RESPONSE (0x80),
/**
* API ID: 0x81
*/
RX_16_RESPONSE (0x81),
/**
* API ID: 0x82
*/
RX_64_IO_RESPONSE (0x82),
/**
* API ID: 0x83
*/
RX_16_IO_RESPONSE (0x83),
/**
* API ID: 0x88
*/
AT_RESPONSE (0x88),
/**
* API ID: 0x89
*/
TX_STATUS_RESPONSE (0x89),
/**
* API ID: 0x8a
*/
MODEM_STATUS_RESPONSE (0x8a),
/**
* API ID: 0x90
*/
ZNET_RX_RESPONSE (0x90),
/**
* API ID: 0x91
*/
ZNET_EXPLICIT_RX_RESPONSE (0x91),
/**
* API ID: 0x8b
*/
ZNET_TX_STATUS_RESPONSE (0x8b),
/**
* API ID: 0x97
*/
REMOTE_AT_RESPONSE (0x97),
/**
* API ID: 0x92
*/
ZNET_IO_SAMPLE_RESPONSE (0x92),
/**
* API ID: 0x95
*/
ZNET_IO_NODE_IDENTIFIER_RESPONSE (0x95),
/**
* Indicates that we've parsed a packet for which we didn't know how to handle the API type. This will be parsed into a GenericResponse
*/
UNKNOWN (0xff),
/**
* This is returned if an error occurs during packet parsing and does not correspond to a XBee API ID.
*/
ERROR_RESPONSE (-1);
private static final Map<Integer,ApiId> lookup = new HashMap<Integer,ApiId>();
static {
for(ApiId s : EnumSet.allOf(ApiId.class)) {
lookup.put(s.getValue(), s);
}
}
public static ApiId get(int value) {
return lookup.get(value);
}
private final int value;
ApiId(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public String toString() {
return this.name() + " (" + ByteUtils.toBase16(this.getValue()) + ")";
}
}
| [
"guille@iibm"
] | guille@iibm |
bdcc684ed36748869d44f7b1eed3e9a99f13df38 | a65191b9372b1b3c70867f45998a3ee74bdb4214 | /src/test/java/com/pack/home/TestExecution/TestRun.java | 7fdac1a1b143f23a2c9464bdf5e907b8b0641270 | [] | no_license | anand-prodevans/novtest | 2232d71b4f9dfa73ddabe2d3a7b8b108c5a11f7b | 1efabe0e6b4d2262ba76f8a92545776c60262a33 | refs/heads/master | 2020-04-07T02:04:30.947193 | 2018-11-17T08:10:46 | 2018-11-17T08:10:46 | 157,962,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,526 | java | package com.pack.home.TestExecution;
import java.io.IOException;
import org.openqa.selenium.*;
import org.testng.Assert;
import org.testng.annotations.*;
import com.pack.home.Libraries.DriverLaunch;
import com.pack.home.Libraries.LibraryForGenericFunction;
public class TestRun {
DriverLaunch Dlib = new DriverLaunch();
public static WebDriver driver;
LibraryForGenericFunction lib = null;
@BeforeTest
public void executing() throws InterruptedException, IOException {
driver = Dlib.openBrowser("chrome");
lib = new LibraryForGenericFunction(driver);
// Application link will be opened
driver.get("http://13.233.43.95:8080/Anand/");
}
@Test(priority = 1, description="Performs an button and checks the dashboard url (passes)")
public void login() throws InterruptedException, IOException {
//lib.jsSendKeysForID("username", "anand", "login", "ID");
//lib.jsSendKeysForID("password", "1234", "login", "ID");
//Assert.assertTrue(lib.waitAndClickForID("sinup", "login", "ID"));
lib.waitAndClickForID("sinup", "login", "ID");
//Thread.sleep(2000);
}
@Test(priority = 2, description="Logs out (passes)")
public void logout() throws InterruptedException, IOException {
lib.waitAndClickForID("sinup1", "login", "ID");
}
@Test(priority = 3, description="Logs out (passes)")
public void logout1() throws InterruptedException, IOException {
lib.waitAndClickForID("sinup", "login", "ID");
}
@AfterTest()
public void afterMethod() throws IOException {
driver.quit();
}
}
| [
"anand.prodevans@gmail.com"
] | anand.prodevans@gmail.com |
1c3811e274046276b818a15f4c97f4dbcce09f11 | 25a8800d24add506f14980a86eb6c9e5014f92b9 | /RetrofitDemo/src/retrofit2/GsonRequestBodyConverter.java | 1d3d6e75ae978d65aba7d0025d9bb85020b00cbc | [] | no_license | xunleji/BGARefreshLayout | 6acbf435ca70ca3612fe6b1fd7b59d599392d695 | a7254df15b2eca836bdbe6768081873cfab1b582 | refs/heads/master | 2021-01-10T01:20:50.303850 | 2016-03-17T06:16:46 | 2016-03-17T06:16:46 | 54,093,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,864 | java | /*
* Copyright (C) 2015 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package retrofit2;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonWriter;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.RequestBody;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import okio.Buffer;
final class GsonRequestBodyConverter<T> implements Converter<T, RequestBody> {
private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
private static final Charset UTF_8 = Charset.forName("UTF-8");
private final Gson gson;
private final TypeAdapter<T> adapter;
GsonRequestBodyConverter(Gson gson, TypeAdapter<T> adapter) {
this.gson = gson;
this.adapter = adapter;
}
@Override public RequestBody convert(T value) throws IOException {
Buffer buffer = new Buffer();
Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
JsonWriter jsonWriter = gson.newJsonWriter(writer);
try {
adapter.write(jsonWriter, value);
jsonWriter.flush();
} catch (IOException e) {
throw new AssertionError(e); // Writing to Buffer does no I/O.
}
return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
}
}
| [
"you@example.com"
] | you@example.com |
dc12a026bc95ea090eec613ed87cf0aa40ef46c5 | 76e4a65234e1ef18166802db3d4c256e25a509a1 | /Sources projet Spring MVC REST/src/fr/formation/dao/package-info.java | 3e2cd8dc385188460735885309ebdb552a26ce7e | [] | no_license | Bruno31770/PremierRepoSpring | 99e87ec9491f9cc8cc7e0d11880f94aad34b2bb2 | 03e98a435d279ee59e1c4c01bea43d4f18751722 | refs/heads/master | 2020-03-21T18:20:00.299198 | 2018-06-27T14:08:13 | 2018-06-27T14:08:13 | 138,885,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89 | java | /**
* This package contains Data Access Object classes.
*/
package fr.formation.dao; | [
"blasne@ausy-group.com"
] | blasne@ausy-group.com |
2fc4c35c34a3ea1ef0507499935594cccb98c0f8 | a87b1d3a60507a6fe8a32841a66f3fd806599d30 | /plugins/org.springframework.ide.eclipse.beans.core.tests/src/org/springframework/ide/core/classreading/tests/JdtAnnotationMetadataTest.java | ad2b62c608002ec9fb9914b7dcbccccd446a6192 | [] | no_license | VRDate/spring-ide | 5ad4add03c3bf573270836cc5c60d8f4b5745757 | fad7b5abe3f454a5b20171f175b7687d15aa8930 | refs/heads/master | 2021-01-17T22:05:10.457040 | 2013-02-06T01:14:52 | 2013-02-06T01:14:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,138 | java | /*******************************************************************************
* Copyright (c) 2012, 2013 Spring IDE Developers
* 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:
* Spring IDE Developers - initial API and implementation
*******************************************************************************/
package org.springframework.ide.core.classreading.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.Role;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.MethodMetadata;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.ide.eclipse.core.java.JdtUtils;
import org.springframework.ide.eclipse.core.java.classreading.IJdtMethodMetadata;
import org.springframework.ide.eclipse.core.java.classreading.JdtMetadataReaderFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springsource.ide.eclipse.commons.tests.util.StsTestUtil;
/**
* @author Martin Lippert
* @since 3.2.0
*/
public class JdtAnnotationMetadataTest {
private IProject project;
private IJavaProject javaProject;
@Before
public void createProject() throws Exception {
project = StsTestUtil.createPredefinedProject("jdt-annotation-tests", "org.springframework.ide.eclipse.beans.core.tests");
javaProject = JdtUtils.getJavaProject(project);
}
@After
public void deleteProject() throws Exception {
project.delete(true, null);
}
@Test
public void testNoAnnotations() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.NoAnnotations");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertEquals(0, annotationMetadata.getAnnotationTypes().size());
assertFalse(annotationMetadata.isAnnotated(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotatedMethods(Bean.class.getName()));
assertNull(annotationMetadata.getAnnotationAttributes(Configuration.class.getName()));
assertEquals(0, annotationMetadata.getAnnotatedMethods(Bean.class.getName()).size());
assertEquals(0, annotationMetadata.getMemberClassNames().length);
}
@Test
public void testSimpleConfigurationClass() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.SimpleConfigurationClass");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertTrue(annotationMetadata.isAnnotated(Configuration.class.getName()));
assertTrue(annotationMetadata.hasAnnotation(Configuration.class.getName()));
Set<String> types = annotationMetadata.getAnnotationTypes();
assertEquals(1, types.size());
assertEquals(Configuration.class.getName(), types.iterator().next());
assertFalse(annotationMetadata.isAnnotated(Bean.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Bean.class.getName()));
assertFalse(annotationMetadata.hasAnnotatedMethods(Bean.class.getName()));
assertEquals(0, annotationMetadata.getAnnotatedMethods(Bean.class.getName()).size());
assertEquals(0, annotationMetadata.getMemberClassNames().length);
Map<String, Object> attributes = annotationMetadata.getAnnotationAttributes(Configuration.class.getName());
assertEquals(1, attributes.size());
assertEquals("", attributes.get("value"));
}
@Test
public void testSimpleBeanClass() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.SimpleBeanClass");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertFalse(annotationMetadata.isAnnotated(Bean.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Bean.class.getName()));
assertEquals(0, annotationMetadata.getAnnotationTypes().size());
assertFalse(annotationMetadata.isAnnotated(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotatedMethods(Configuration.class.getName()));
assertTrue(annotationMetadata.hasAnnotatedMethods(Bean.class.getName()));
Set<MethodMetadata> methods = annotationMetadata.getAnnotatedMethods(Bean.class.getName());
assertEquals(1, methods.size());
MethodMetadata methodMetadata = methods.iterator().next();
assertTrue(methodMetadata.isAnnotated(Bean.class.getName()));
assertEquals("getInstanceOfBean", methodMetadata.getMethodName());
assertEquals("org.test.spring.SimpleBeanClass", methodMetadata.getDeclaringClassName());
Map<String, Object> annotationAttributes = methodMetadata.getAnnotationAttributes(Bean.class.getName());
assertEquals(4, annotationAttributes.size());
assertEquals("", annotationAttributes.get("initMethod"));
assertEquals("(inferred)", annotationAttributes.get("destroyMethod"));
Object nameArray = annotationAttributes.get("name");
assertNotNull(nameArray);
assertTrue(nameArray instanceof Object[]);
assertEquals(0, ((Object[]) nameArray).length);
assertEquals(Autowire.class, annotationAttributes.get("autowire").getClass());
assertEquals(Autowire.NO, annotationAttributes.get("autowire"));
assertTrue(methodMetadata instanceof IJdtMethodMetadata);
IType type = JdtUtils.getJavaType(project, "org.test.spring.SimpleBeanClass");
IMethod method = type.getMethods()[0];
assertEquals(method, ((IJdtMethodMetadata) methodMetadata).getMethod());
assertNull(methodMetadata.getAnnotationAttributes(Role.class.getName()));
assertEquals(0, annotationMetadata.getMemberClassNames().length);
}
@Test
public void testSimpleBeanClassWithAutowireAttribute() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.SimpleBeanClassWithAttribute");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertTrue(annotationMetadata.hasAnnotatedMethods(Bean.class.getName()));
Set<MethodMetadata> methods = annotationMetadata.getAnnotatedMethods(Bean.class.getName());
assertEquals(1, methods.size());
MethodMetadata methodMetadata = methods.iterator().next();
assertTrue(methodMetadata.isAnnotated(Bean.class.getName()));
Map<String, Object> annotationAttributes = methodMetadata.getAnnotationAttributes(Bean.class.getName());
assertEquals(4, annotationAttributes.size());
assertEquals("", annotationAttributes.get("initMethod"));
assertEquals("(inferred)", annotationAttributes.get("destroyMethod"));
Object nameArray = annotationAttributes.get("name");
assertNotNull(nameArray);
assertTrue(nameArray instanceof Object[]);
assertEquals(0, ((Object[]) nameArray).length);
assertEquals(Autowire.class, annotationAttributes.get("autowire").getClass());
assertEquals(Autowire.BY_NAME, annotationAttributes.get("autowire"));
assertTrue(methodMetadata instanceof IJdtMethodMetadata);
IType type = JdtUtils.getJavaType(project, "org.test.spring.SimpleBeanClassWithAttribute");
IMethod method = type.getMethods()[0];
assertEquals(method, ((IJdtMethodMetadata) methodMetadata).getMethod());
}
@Test
public void testSimpleFieldAnnotation() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.SimpleFieldAnnotation");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertFalse(annotationMetadata.isAnnotated(Autowired.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Autowired.class.getName()));
assertEquals(0, annotationMetadata.getAnnotationTypes().size());
assertEquals(0, annotationMetadata.getAnnotatedMethods(Autowired.class.getName()).size());
assertEquals(0, annotationMetadata.getMemberClassNames().length);
}
@Test
public void testImportResourceSpecialCase() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.ImportResourceClass");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertFalse(annotationMetadata.isAnnotated(ImportResource.class.getName()));
assertTrue(annotationMetadata.hasAnnotation(ImportResource.class.getName()));
assertTrue(annotationMetadata.isAnnotated(Configuration.class.getName()));
assertTrue(annotationMetadata.hasAnnotation(Configuration.class.getName()));
assertTrue(annotationMetadata.isAnnotated(Import.class.getName()));
assertTrue(annotationMetadata.hasAnnotation(Import.class.getName()));
Set<String> types = annotationMetadata.getAnnotationTypes();
assertEquals(3, types.size());
assertTrue(types.contains(Configuration.class.getName()));
assertTrue(types.contains(ImportResource.class.getName()));
assertTrue(types.contains(Import.class.getName()));
Map<String, Object> configAttributes = annotationMetadata.getAnnotationAttributes(Configuration.class.getName());
assertEquals(1, configAttributes.size());
assertEquals("", configAttributes.get("value"));
Map<String, Object> importResourceAttributesAsStrings = annotationMetadata.getAnnotationAttributes(ImportResource.class.getName(), true);
assertEquals(2, importResourceAttributesAsStrings.size());
assertEquals("org.springframework.beans.factory.xml.XmlBeanDefinitionReader", importResourceAttributesAsStrings.get("reader"));
assertEquals("classpath:/com/acme/database-config.xml", ((String[])importResourceAttributesAsStrings.get("value"))[0]);
Map<String, Object> importResourceAttributesAsObjects = annotationMetadata.getAnnotationAttributes(ImportResource.class.getName(), false);
assertEquals(2, importResourceAttributesAsObjects.size());
assertTrue(importResourceAttributesAsObjects.get("reader") instanceof Class);
assertEquals("org.springframework.beans.factory.xml.XmlBeanDefinitionReader", ((Class<?>)importResourceAttributesAsObjects.get("reader")).getName());
assertEquals("classpath:/com/acme/database-config.xml", ((String[])importResourceAttributesAsObjects.get("value"))[0]);
Map<String, Object> importAttributesAsStrings = annotationMetadata.getAnnotationAttributes(Import.class.getName(), true);
assertEquals(1, importAttributesAsStrings.size());
assertEquals("org.test.spring.SimpleConfigurationClass", ((String[])importAttributesAsStrings.get("value"))[0]);
Map<String, Object> importAttributesAsObjects = annotationMetadata.getAnnotationAttributes(Import.class.getName(), false);
assertEquals(1, importAttributesAsObjects.size());
assertEquals("org.test.spring.SimpleConfigurationClass", ((Class[])importAttributesAsObjects.get("value"))[0].getName());
}
@Test
public void testSubClassWithoutAnnotation() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.SubClassWithoutAnnotation");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertFalse(annotationMetadata.isAnnotated(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Configuration.class.getName()));
assertEquals(0, annotationMetadata.getAnnotationTypes().size());
assertEquals(0, annotationMetadata.getAnnotatedMethods(Configuration.class.getName()).size());
assertEquals(0, annotationMetadata.getMemberClassNames().length);
assertNull(annotationMetadata.getAnnotationAttributes(Configuration.class.getName()));
}
@Test
public void testOverriddenMethodWithoutAnnotation() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.OverriddenMethodWithoutAnnotation");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertFalse(annotationMetadata.isAnnotated(Bean.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Bean.class.getName()));
assertEquals(0, annotationMetadata.getAnnotationTypes().size());
assertFalse(annotationMetadata.isAnnotated(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotatedMethods(Configuration.class.getName()));
assertEquals(0, annotationMetadata.getAnnotatedMethods(Bean.class.getName()).size());
assertEquals(0, annotationMetadata.getMemberClassNames().length);
}
@Test
public void testSuperclassWithMethodAnnotation() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.SimpleBeanClassSubclass");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertFalse(annotationMetadata.isAnnotated(Bean.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Bean.class.getName()));
assertEquals(0, annotationMetadata.getAnnotationTypes().size());
assertFalse(annotationMetadata.isAnnotated(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotation(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotatedMethods(Configuration.class.getName()));
assertFalse(annotationMetadata.hasAnnotatedMethods(Bean.class.getName()));
assertEquals(0, annotationMetadata.getAnnotatedMethods(Bean.class.getName()).size());
assertEquals(0, annotationMetadata.getMemberClassNames().length);
}
@Test
public void testAdvancedControllerCases() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.ControllerAdvancedRequestMapping");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertFalse(annotationMetadata.isAnnotated(Bean.class.getName()));
assertFalse(annotationMetadata.isAnnotated(Configuration.class.getName()));
assertTrue(annotationMetadata.isAnnotated(Controller.class.getName()));
assertTrue(annotationMetadata.isAnnotated(RequestMapping.class.getName()));
assertEquals(2, annotationMetadata.getAnnotationTypes().size());
Map<String, Object> controllerAttributes = annotationMetadata.getAnnotationAttributes(Controller.class.getName());
assertEquals(1, controllerAttributes.size());
assertEquals("", controllerAttributes.get("value"));
Map<String, Object> mappingAttributes = annotationMetadata.getAnnotationAttributes(RequestMapping.class.getName());
assertEquals(6, mappingAttributes.size());
assertEquals(0, ((String[])mappingAttributes.get("headers")).length);
assertEquals(2, ((String[])mappingAttributes.get("value")).length);
assertEquals("/index1.htm", ((String[])mappingAttributes.get("value"))[0]);
assertEquals("/index2.htm", ((String[])mappingAttributes.get("value"))[1]);
assertEquals(0, ((String[])mappingAttributes.get("produces")).length);
assertEquals(0, ((Object[])mappingAttributes.get("method")).length);
assertEquals(0, ((String[])mappingAttributes.get("params")).length);
assertEquals(0, ((String[])mappingAttributes.get("consumes")).length);
assertTrue(annotationMetadata.hasAnnotatedMethods(RequestMapping.class.getName()));
Set<MethodMetadata> methods = annotationMetadata.getAnnotatedMethods(RequestMapping.class.getName());
assertEquals(1, methods.size());
MethodMetadata methodMetadata = methods.iterator().next();
assertFalse(methodMetadata.isAnnotated(Controller.class.getName()));
assertTrue(methodMetadata.isAnnotated(RequestMapping.class.getName()));
Map<String, Object> methodAttributes = methodMetadata.getAnnotationAttributes(RequestMapping.class.getName());
assertEquals(6, methodAttributes.size());
assertEquals(0, ((String[])methodAttributes.get("headers")).length);
assertEquals(0, ((String[])methodAttributes.get("value")).length);
assertEquals(0, ((String[])methodAttributes.get("produces")).length);
assertEquals(2, ((Object[])methodAttributes.get("method")).length);
assertEquals("RequestMethod.GET", ((Object[])methodAttributes.get("method"))[0]);
assertEquals("RequestMethod.POST", ((Object[])methodAttributes.get("method"))[1]);
assertEquals(0, ((String[])methodAttributes.get("params")).length);
assertEquals(0, ((String[])methodAttributes.get("consumes")).length);
}
@Test
public void testMethodIdentification() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.MethodIdentificationSupertype");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertTrue(annotationMetadata.hasAnnotatedMethods(Bean.class.getName()));
Set<MethodMetadata> methods = annotationMetadata.getAnnotatedMethods(Bean.class.getName());
assertEquals(8, methods.size());
IType type = JdtUtils.getJavaType(project, "org.test.spring.MethodIdentificationSupertype");
IMethod getInstanceNoArg = type.getMethod("getInstance", new String[0]);
IMethod getInstanceObject = type.getMethod("getInstance", new String[] {"QObject;"});
IMethod getInstanceString = type.getMethod("getInstance", new String[] {"QString;"});
IMethod getInstanceObjectObject = type.getMethod("getInstance", new String[] {"QObject;", "QObject;"});
IMethod getInstanceObjectString = type.getMethod("getInstance", new String[] {"QObject;", "QString;"});
IMethod getInstanceStringObject = type.getMethod("getInstance", new String[] {"QString;", "QObject;"});
IMethod getInstanceStringString = type.getMethod("getInstance", new String[] {"QString;", "QString;"});
IMethod getInstanceStringStringString = type.getMethod("getInstance", new String[] {"QString;", "QString;", "QString;"});
assertTrue(containsMethodReference(methods, getInstanceNoArg));
assertTrue(containsMethodReference(methods, getInstanceObject));
assertTrue(containsMethodReference(methods, getInstanceString));
assertTrue(containsMethodReference(methods, getInstanceObjectObject));
assertTrue(containsMethodReference(methods, getInstanceObjectString));
assertTrue(containsMethodReference(methods, getInstanceStringObject));
assertTrue(containsMethodReference(methods, getInstanceStringString));
assertTrue(containsMethodReference(methods, getInstanceStringStringString));
}
@Test
public void testAutowiredConstructor() throws Exception {
JdtMetadataReaderFactory factory = new JdtMetadataReaderFactory(javaProject);
MetadataReader metadataReader = factory.getMetadataReader("org.test.spring.AutowiredConstructorClass");
AnnotationMetadata annotationMetadata = metadataReader.getAnnotationMetadata();
assertTrue(annotationMetadata.hasAnnotatedMethods(Autowired.class.getName()));
Set<MethodMetadata> methods = annotationMetadata.getAnnotatedMethods(Autowired.class.getName());
assertEquals(1, methods.size());
MethodMetadata methodMetadata = methods.iterator().next();
assertEquals("org.test.spring.AutowiredConstructorClass", methodMetadata.getDeclaringClassName());
IType type = JdtUtils.getJavaType(project, "org.test.spring.AutowiredConstructorClass");
IMethod constructor = type.getMethod("AutowiredConstructorClass", new String[] {"QString;"});
assertEquals(constructor, ((IJdtMethodMetadata)methodMetadata).getMethod());
}
private boolean containsMethodReference(Set<MethodMetadata> methods, IMethod method) {
for (MethodMetadata methodMetadata : methods) {
if (((IJdtMethodMetadata)methodMetadata).getMethod().equals(method)) {
return true;
}
}
return false;
}
}
| [
"mlippert@vmware.com"
] | mlippert@vmware.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.