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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
94b17e8e4ecfc6942b4e479d2c81ff886879c27d | 33695f41eaa5e504c9563bd8a596e8ffcc12a0e0 | /Desarrollo/SDD/Implementacion/api/src/main/java/pe/edu/unmsm/sisdisdoc/service/IntervaloHorasService.java | 3489b594cdf5ce5cdabac3b284d074c4ec40d16f | [] | no_license | gdc-sw/CLP | 8b7930ab6277dc3fd94db9afc89d30da4820fec4 | f108c89dbb984de2f7b91b63c8820b57daca0854 | refs/heads/master | 2021-01-19T16:59:58.927514 | 2017-07-08T20:18:49 | 2017-07-08T20:18:49 | 88,296,449 | 0 | 0 | null | 2017-07-08T20:18:49 | 2017-04-14T19:26:41 | Java | UTF-8 | Java | false | false | 233 | java | package pe.edu.unmsm.sisdisdoc.service;
import pe.edu.unmsm.sisdisdoc.models.IntervaloHoras;
public class IntervaloHorasService extends BaseService<IntervaloHoras>{
public IntervaloHorasService(){
super("IntervaloHoras");
}
}
| [
"kevincz_1@hotmail.com"
] | kevincz_1@hotmail.com |
ff45bbaeb23bef94002fa444cab7a469df980662 | d245fbd9704c42903a1081ca78b0560dd89a0be4 | /src/main/java/org/fh/service/fhim/FgroupService.java | b5151836d61541d235b8f24b068084ca7c59e628 | [] | no_license | admincjy/rtworkio | 7bbc16acc3b89af2c03419c042f01b7f44031418 | 6ecabc24ad071bfa312cacf3b6cffbd6ceabff71 | refs/heads/master | 2022-10-26T02:36:43.379323 | 2019-08-14T01:36:59 | 2019-08-14T01:36:59 | 193,999,168 | 1 | 0 | null | 2022-10-12T20:28:31 | 2019-06-27T01:09:08 | JavaScript | UTF-8 | Java | false | false | 1,058 | java | package org.fh.service.fhim;
import java.util.List;
import org.fh.entity.Page;
import org.fh.entity.PageData;
/**
* 说明:好友分组服务接口
* 作者:FH Admin Q313596790
* :www.fhadmin.org
*/
public interface FgroupService {
/**新增
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**删除
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**修改
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**列表
* @param page
* @throws Exception
*/
public List<PageData> datalistPage(Page page)throws Exception;
/**列表(全部)
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**通过id获取数据
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**批量删除
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
}
| [
"284339822@qq.com"
] | 284339822@qq.com |
55a9789a9d2a36d87fbc186b8a774213aebedc32 | 4e7ed35ba7e190cd448074ce626cb0f11b0952a1 | /src/my/concrete/SalariedEmployee.java | 220c20feb6f146b225c80f62300ef31a63a5c982 | [] | no_license | JStillman2/InheritancePractice | d40f4e2c5dea8a5ce460024ece45efafd7ca6c85 | b0f8839014188ee82aa4ff213c713dbc64f2b15e | refs/heads/master | 2021-01-22T02:53:03.749083 | 2014-02-04T03:34:34 | 2014-02-04T03:34:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,049 | 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 my.concrete;
/**
*
* @author Nicole
*/
public class SalariedEmployee extends Employee {
private double monthlySalary;
private double annualBonus;
@Override
public double getAnnualWages() {
return monthlySalary * 12 + annualBonus;
}
public double getMonthlySalary() {
return monthlySalary;
}
public void setMonthlySalary(double monthlySalary) {
this.monthlySalary = monthlySalary;
}
public double getAnnualBonus() {
return annualBonus;
}
public void setAnnualBonus(double annualBonus) {
this.annualBonus = annualBonus;
}
@Override
public String toString() {
return "SalariedEmployee{" + "monthlySalary=" + monthlySalary + ", annualBonus=" + annualBonus + '}';
}
}
| [
"Nicole@Nicole-Laptop.att.net"
] | Nicole@Nicole-Laptop.att.net |
612f6469edcb10b40dea51f61ac8c01bd7345529 | f822374f627eafa4d6a89cd54ca62226bb54eed2 | /src/main/java/com/rusl215/package-info.java | c79ce68649e07e990be5443609416d49b0341be3 | [] | no_license | rus215/practic | b63ef5a8c594398d5339a38f1d0b6ca4e59cc039 | 65085a8018339dafc1e52f20937932908e2c04f0 | refs/heads/master | 2020-07-28T23:42:29.087531 | 2019-10-25T01:59:37 | 2019-10-25T01:59:37 | 209,582,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | /**
* Пакет содержит классы RESTfull api
*
* @author ruslan
*/
package com.rusl215; | [
"Rusl.215k58@gmail.com"
] | Rusl.215k58@gmail.com |
6c3b40dc849258f02d00fd9e93cec29df84e2b80 | 85a3c5b02b6d4af6b2fac77d64ccd5f890939d50 | /app/src/main/java/com/system/model/s02/simple1/Client.java | e87b28c6c99abd95d6e477faec443d5a5eb4e04e | [] | no_license | VinVon/DiyView | 35675bef5b1dbb2a1d495232e937d321514c73d1 | d2451316a37e2728fd90e317856dd3e11a7b7a2a | refs/heads/master | 2021-01-01T04:39:03.578233 | 2017-11-04T07:43:24 | 2017-11-04T07:43:24 | 97,219,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package com.system.model.s02.simple1;
/**
* Created by raytine on 2017/10/16.
*/
public class Client {
public static void main(String[] args){
PushObserverable pushObserverable = new PushObserverable();
pushObserverable.register(new Person());
pushObserverable.Update();
}
}
| [
"642751580@qq.com"
] | 642751580@qq.com |
7f589c58c54e23ea9f59ad3f36d4ab5e1fa83a5b | e7e54283cab106a3ea61f12b324dee70b92c8177 | /maven-plugin/src/main/java/org/raml/jaxrs/codegen/model/BasicModel.java | f13b57c451ba30a02c3ae5c7c625ab5cfca8509a | [
"Apache-2.0"
] | permissive | boyley/raml | b5ecf8d4a23919dcab554186e298894a6c82055d | 41d5e1c3eacfaf2bdb6b57455c99ece57a32a504 | refs/heads/master | 2021-01-16T17:09:57.363062 | 2016-04-28T07:53:44 | 2016-04-28T07:53:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,309 | java | /*
* Copyright 2013 (c) MuleSoft, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.raml.jaxrs.codegen.model;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import com.mulesoft.jaxrs.raml.annotation.model.IAnnotationModel;
import com.mulesoft.jaxrs.raml.annotation.model.IBasicModel;
import com.mulesoft.jaxrs.raml.annotation.model.ITypeModel;
import com.mulesoft.jaxrs.raml.annotation.model.reflection.ReflectionType;
import org.raml.jaxrs.codegen.maven.MetadataModelRegistry;
/**
* <p>Abstract BasicModel class.</p>
*
* @author kor
* @version $Id: $Id
*/
public abstract class BasicModel implements IBasicModel{
private static final String VALUE_METHOD_ID = "value"; //$NON-NLS-1$
private LinkedHashMap<String,IAnnotationModel> annotations
= new LinkedHashMap<String, IAnnotationModel>();
private LinkedHashMap<String,IAnnotationModel> annotationsByCanonicalName
= new LinkedHashMap<String, IAnnotationModel>();
private String simpleName;
private String documentation;
private boolean publicM;
private boolean staticM;
private Class<?> actualClass;
private ITypeModel type;
private List<ITypeModel> jaxbTypes;
/**
* <p>getJAXBType.</p>
*
* @return a {@link com.mulesoft.jaxrs.raml.annotation.model.ITypeModel} object.
*/
public List<ITypeModel> getJAXBTypes() {
return this.jaxbTypes;
}
/**
* <p>getJavaType.</p>
*
* @return a {@link java.lang.Class} object.
*/
public Class<?> getJavaType() {
return actualClass;
}
/**
* <p>setJavaClass.</p>
*
* @param actualClass a {@link java.lang.Class} object.
*/
public void setJavaClass(Class<?> actualClass) {
this.actualClass=actualClass;
}
public ITypeModel getType() {
return type;
}
public void setType(ITypeModel type) {
this.type = type;
}
/**
* <p>isStatic.</p>
*
* @return a boolean.
*/
public boolean isStatic() {
return staticM;
}
/**
* <p>isPublic.</p>
*
* @return a boolean.
*/
public boolean isPublic() {
return publicM;
}
/**
* <p>getName.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getName() {
return simpleName;
}
/**
* <p>setName.</p>
*
* @param simpleName a {@link java.lang.String} object.
*/
public void setName(String simpleName) {
this.simpleName = simpleName;
}
/**
* <p>Getter for the field <code>documentation</code>.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getDocumentation() {
return documentation;
}
/**
* <p>Setter for the field <code>documentation</code>.</p>
*
* @param documentation a {@link java.lang.String} object.
*/
public void setDocumentation(String documentation) {
this.documentation = documentation;
}
/**
* <p>Getter for the field <code>annotations</code>.</p>
*
* @return an array of {@link com.mulesoft.jaxrs.raml.annotation.model.IAnnotationModel} objects.
*/
public IAnnotationModel[] getAnnotations() {
return annotations.values().toArray(new IAnnotationModel[annotations.size()]);
}
/**
* <p>addAnnotation.</p>
*
* @param annotation a {@link com.mulesoft.jaxrs.raml.annotation.model.IAnnotationModel} object.
*/
public void addAnnotation(IAnnotationModel annotation){
annotations.put(annotation.getName(), annotation);
annotationsByCanonicalName.put(annotation.getCanonicalName(), annotation);
}
/** {@inheritDoc} */
public String getAnnotationValue(String annotation) {
IAnnotationModel annotationModel = annotations.get(annotation);
if(annotationModel==null){
return null;
}
return annotationModel.getValue(VALUE_METHOD_ID);
}
/** {@inheritDoc} */
public String[] getAnnotationValues(String annotation) {
IAnnotationModel annotationModel = annotations.get(annotation);
if(annotationModel==null){
return null;
}
return annotationModel.getValues(VALUE_METHOD_ID);
}
/** {@inheritDoc} */
public boolean hasAnnotation(String annotationName) {
return annotations.containsKey(annotationName);
}
/** {@inheritDoc} */
public IAnnotationModel getAnnotation(String name) {
return annotations.get(name);
}
/** {@inheritDoc} */
public boolean hasAnnotationWithCanonicalName(String annotationName) {
return annotationsByCanonicalName.containsKey(annotationName);
}
/** {@inheritDoc} */
public IAnnotationModel getAnnotationByCanonicalName(String name) {
return annotationsByCanonicalName.get(name);
}
/** {@inheritDoc} */
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((annotations == null) ? 0 : annotations.hashCode());
result = prime * result
+ ((documentation == null) ? 0 : documentation.hashCode());
result = prime * result
+ ((simpleName == null) ? 0 : simpleName.hashCode());
return result;
}
/** {@inheritDoc} */
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BasicModel other = (BasicModel) obj;
if (annotations == null) {
if (other.annotations != null)
return false;
} else if (!annotations.equals(other.annotations))
return false;
if (documentation == null) {
if (other.documentation != null)
return false;
} else if (!documentation.equals(other.documentation))
return false;
if (simpleName == null) {
if (other.simpleName != null)
return false;
} else if (!simpleName.equals(other.simpleName))
return false;
return true;
}
/**
* <p>setStatic.</p>
*
* @param b a boolean.
*/
public void setStatic(boolean b) {
this.staticM=b;
}
/**
* <p>setPublic.</p>
*
* @param b a boolean.
*/
public void setPublic(boolean b) {
this.publicM=b;
}
}
| [
"279184665@qq.com"
] | 279184665@qq.com |
09da19b0392a1b21ae810e671685d6a89f25fa6a | d448371eb4234216f2f8773c621da2a92f5812a3 | /src/main/java/br/com/viasoft/NativeQueryMethodInterceptor.java | 44a1f9329625a546f20e32db9749653e3e7d9fc9 | [] | no_license | rafaeldalbosco/spring-native-query | 077d90a03144d0c58504253dde6283e75c3cbf45 | 6039eae88d3c3e82717923d9d4590e01310a568b | refs/heads/master | 2020-04-09T18:41:56.561044 | 2019-03-13T18:31:16 | 2019-03-13T18:31:16 | 160,520,783 | 0 | 0 | null | 2019-03-13T13:46:44 | 2018-12-05T13:15:54 | Java | UTF-8 | Java | false | false | 124 | java | package br.com.viasoft;
public interface NativeQueryMethodInterceptor {
Object executeQuery(NativeQueryInfo info);
}
| [
"g45p4r19121987"
] | g45p4r19121987 |
59a0f8e6bc2b618efa249996e22e386c300e295f | a3f55d343fc8ec74ded48d995556e5ede731ae74 | /Test.java | 9743ae538b02b128d78d091883a0ad7a207f0dd0 | [] | no_license | izardasa/Leetcode | 08752a60fed85df49a292de5a6a83552aa37a15d | f4618a6686c0d68a478bd8bc2c63dcea0e6ec93b | refs/heads/master | 2022-04-14T10:10:20.320488 | 2020-02-20T07:10:29 | 2020-02-20T07:10:29 | 241,817,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package Leetcode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
public class Test
{
public static void main( String[] args )
{
int n = 0;
System.out.println( isPowerOfTwo( n ) );
}
public static boolean isPowerOfTwo( int n )
{
int count = 0;
while( n > 0 )
{
if( ( n & 1 ) == 1 )
count++;
n >>= 1;
if( count > 1 )
return false;
}
if( count == 1 )
return true;
return false;
}
}
| [
"sanjayizardar1@gmail.com"
] | sanjayizardar1@gmail.com |
a87bfbe62bb23b0eb15d213b7c842e6bca92e784 | 954857dbd5bb01bc56f1bfa31a3894b0e36dab78 | /flatbufferreader/src/com/tune/flatbufferreader/InterfaceTest.java | 954ef1770b7c64c86a1868d3be99eb5b911cd6be | [] | no_license | hasDevang/fileparser | 5e3ad1b25a04718bfca1e0126babd06850b495a3 | 48687871ee6c14820867bc0ab60d23a7d530ad57 | refs/heads/master | 2021-01-16T18:06:47.193636 | 2015-07-20T22:16:23 | 2015-07-20T22:16:23 | 38,772,140 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,031 | java | package com.tune.flatbufferreader;
import java.io.DataInput;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.avro.hadoop.io.AvroDatumConverterFactory.BytesWritableConverter;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.ql.exec.RecordReader;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.Writable;
import org.apache.tools.ant.types.selectors.WritableSelector;
public class InterfaceTest implements RecordReader {
private java.io.InputStream fileInputStream;
private BytesWritable bytes;
//private int maxRecordLength;
@Override
public void close() throws IOException {
if( fileInputStream != null)
{
fileInputStream.close();
}
}
@Override
public Writable createRow() throws IOException {
bytes = new BytesWritable();
//bytes.setCapacity(maxRecordLength);
return bytes;
}
@Override
public void initialize(InputStream arg0, Configuration arg1, Properties arg2)
throws IOException {
this.fileInputStream = arg0;
}
@Override
public int next(Writable r) throws IOException {
byte[] blobSize = new byte[4];
Integer readBytes = 0;
while (4 - readBytes > 0)
{
readBytes += fileInputStream.read(blobSize, readBytes, 4 - readBytes);
}
//ByteBuffer bsize = ByteBuffer.wrap(blobSize);
int size = ByteBuffer.wrap(blobSize).getInt();
byte[] binaryBlob = new byte[size];
Integer readByte = 0;
while ( size - readByte > 0)
{
readByte += fileInputStream.read(binaryBlob, readByte , size- readByte);
}
bytes = new BytesWritable(binaryBlob);
//r = new BytesWritable(binaryBlob);
//r = (Writable) bytes;
System.out.println("inside the interface: "+((BytesWritable) r).getSize());
return bytes.getSize();
}
public java.io.InputStream getFileInputStream() {
return fileInputStream;
}
public BytesWritable getBytes() {
return bytes;
}
public static List<Object> getObjectBuffer(BytesWritable blob) throws IOException
{
System.out.println("in the getobjectbuffer :"+ blob.getSize());
ByteBuffer byte_buffer = ByteBuffer.wrap(blob.getBytes());
Rawlog raw_log= Rawlog.getRootAsrawLog(byte_buffer);
return createList(raw_log);
}
/*
* @ parameter Rawlog: Rawlog object created from the flatbuffer binary blob.
* @return List<0bject>: List of objects of all the values for the Rawlog object.
*
* Method takes in the Rawlog object and then returns the list of all the values in sequence in object format.
*/
private static List<Object> createList(Rawlog rl) {
List<Object> value_obj = new ArrayList<Object>();
value_obj.add(rl.adNetworkId());
value_obj.add(rl.adId());
value_obj.add(rl.created());
value_obj.add(rl.advertiserFileId());
value_obj.add(rl.advertiserRefId());
value_obj.add(rl.advertiserSubAdgroup());
value_obj.add(rl.advertiserSubAd());
return value_obj;
}
}
| [
"devang@tune.com"
] | devang@tune.com |
d8a0efa00bd04759a393e49557f7e8f11e1c55a6 | e8f424f3c33c31cf7c67e3d3942f1752e6165d70 | /src/main/java/com/avinashkumarprajapati/datastructure/challenges/CodeGrd1.java | f01264b5e98264aff88ae08eb6ceca9dbf13db86 | [] | no_license | avinashkumarprajapati/datastructures-part2 | fa14a654e2a822b7d2334f395baa38263bdc1883 | 6633cc320698c01fbd1b26b20f4d6e398dd5af43 | refs/heads/master | 2020-06-28T01:20:32.992889 | 2019-08-09T17:21:59 | 2019-08-09T17:21:59 | 200,103,768 | 0 | 0 | null | 2019-08-06T09:16:14 | 2019-08-01T18:52:23 | Java | UTF-8 | Java | false | false | 2,116 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.avinashkumarprajapati.datastructure.challenges;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author AVINASH KUMAR
* Program LazyBartender
*/
public class CodeGrd1 {
public static void main(String [] args)
{
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N1=Integer.parseInt(br.readLine());
int N2=Integer.parseInt(br.readLine());
ArrayList <String> alc= new ArrayList <String>();
ArrayList <StringTokenizer> altk = new ArrayList <StringTokenizer>();
ArrayList <Integer> alhs= new ArrayList <Integer>();
ArrayList [] al =new ArrayList[N2];
al[0].add("a0afafa");
for(int i=0;i<N2;i++)
{
alc.add(br.readLine());
}
for(int i=0;i<N2;i++)
{
altk.add(new StringTokenizer(alc.get(i)));
}
for(int i=0;i<N2;i++)
{
while(altk.get(i).hasMoreTokens())
{
int x;
x=Integer.parseInt(altk.get(i).nextToken());
alhs.add(x);
}
}
Collections.sort(alhs);
//
// for(int i=0;i<N2;i++)
// {
// al.add(alhs.get(i));
// }
// Collections.sort(al);
System.out.println(""+alhs.get(0));
} catch (IOException ex) {
Logger.getLogger(CodeGrd1.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| [
"avinashkumarprajapati@gmail.com"
] | avinashkumarprajapati@gmail.com |
96c745e6a03297a0f1dd5de255e63577b5b59112 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-workmail/src/main/java/com/amazonaws/services/workmail/model/DeregisterMailDomainRequest.java | 4fd179623bee2a5f302c709db40b9c592a3133ff | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 5,434 | java | /*
* Copyright 2017-2022 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.workmail.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/workmail-2017-10-01/DeregisterMailDomain" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DeregisterMailDomainRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The WorkMail organization for which the domain will be deregistered.
* </p>
*/
private String organizationId;
/**
* <p>
* The domain to deregister in WorkMail and SES.
* </p>
*/
private String domainName;
/**
* <p>
* The WorkMail organization for which the domain will be deregistered.
* </p>
*
* @param organizationId
* The WorkMail organization for which the domain will be deregistered.
*/
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
/**
* <p>
* The WorkMail organization for which the domain will be deregistered.
* </p>
*
* @return The WorkMail organization for which the domain will be deregistered.
*/
public String getOrganizationId() {
return this.organizationId;
}
/**
* <p>
* The WorkMail organization for which the domain will be deregistered.
* </p>
*
* @param organizationId
* The WorkMail organization for which the domain will be deregistered.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DeregisterMailDomainRequest withOrganizationId(String organizationId) {
setOrganizationId(organizationId);
return this;
}
/**
* <p>
* The domain to deregister in WorkMail and SES.
* </p>
*
* @param domainName
* The domain to deregister in WorkMail and SES.
*/
public void setDomainName(String domainName) {
this.domainName = domainName;
}
/**
* <p>
* The domain to deregister in WorkMail and SES.
* </p>
*
* @return The domain to deregister in WorkMail and SES.
*/
public String getDomainName() {
return this.domainName;
}
/**
* <p>
* The domain to deregister in WorkMail and SES.
* </p>
*
* @param domainName
* The domain to deregister in WorkMail and SES.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DeregisterMailDomainRequest withDomainName(String domainName) {
setDomainName(domainName);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getOrganizationId() != null)
sb.append("OrganizationId: ").append(getOrganizationId()).append(",");
if (getDomainName() != null)
sb.append("DomainName: ").append(getDomainName());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DeregisterMailDomainRequest == false)
return false;
DeregisterMailDomainRequest other = (DeregisterMailDomainRequest) obj;
if (other.getOrganizationId() == null ^ this.getOrganizationId() == null)
return false;
if (other.getOrganizationId() != null && other.getOrganizationId().equals(this.getOrganizationId()) == false)
return false;
if (other.getDomainName() == null ^ this.getDomainName() == null)
return false;
if (other.getDomainName() != null && other.getDomainName().equals(this.getDomainName()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getOrganizationId() == null) ? 0 : getOrganizationId().hashCode());
hashCode = prime * hashCode + ((getDomainName() == null) ? 0 : getDomainName().hashCode());
return hashCode;
}
@Override
public DeregisterMailDomainRequest clone() {
return (DeregisterMailDomainRequest) super.clone();
}
}
| [
""
] | |
0b3b69cc97f3e4227b637962383573779d7c11d5 | f59335dd85725dcab546863eb4ffd1c097cc6220 | /src/main/java/com/aptech/dao/AdminDao.java | 1af8ed000829219afb85f54015edebdc2a3b44ff | [] | no_license | Aerolar/Ecommerce-1 | 192defc1f45a727690fbd81f5adc98971e06ccc7 | 145bf41c17ea7249aae1eb813bd63637192e1217 | refs/heads/master | 2020-11-29T20:55:07.842311 | 2019-12-25T11:31:27 | 2019-12-25T11:31:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,753 | java | package com.aptech.dao;
import com.aptech.dbhelper.ConnectDB;
import com.aptech.models.Admin;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class AdminDao {
//admin login
public static int login(String email, String password){
int count=0;
Connection cn= ConnectDB.connect();
String sql="SELECT * FROM admin WHERE email=? AND password=?";
try {
PreparedStatement ps=cn.prepareStatement(sql);
ps.setString(1,email);
ps.setString(2,password);
ResultSet rs= ps.executeQuery();
while (rs.next()){
count++;
}
} catch (SQLException e) {
e.printStackTrace();
}
return count;
}
//create admin user
public static int saveAdmin(String firstname, String lastname, String password, String email,String contact){
int status=0;
Connection cn=ConnectDB.connect();
String sql="INSERT INTO admin (firstname,lastname,password,email,contact) VALUES(?,?,?,?,?)";
try {
PreparedStatement ps=cn.prepareStatement(sql);
ps.setString(1,firstname);
ps.setString(2,lastname);
ps.setString(3,password);
ps.setString(4,email);
ps.setString(5,contact);
status=ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return status;
}
//get all admin users
public static ArrayList<Admin> getAllAdmins(){
ArrayList<Admin> all_admins=new ArrayList<>();
Connection cn=ConnectDB.connect();
String sql="SELECT * FROM admin";
try {
PreparedStatement ps=cn.prepareStatement(sql);
ResultSet rs=ps.executeQuery();
while (rs.next()){
int id=Integer.parseInt(rs.getString("id"));
String fname=rs.getString("firstname");
String lname=rs.getString("lastname");
String email=rs.getString("email");
String date=rs.getString("created_at");
Admin admin=new Admin();
admin.setId(id);
admin.setFirstname(fname);
admin.setLastname(lname);
admin.setEmail(email);
admin.setCreatedAt(date);
all_admins.add(admin);
}
} catch (SQLException e) {
e.printStackTrace();
}
return all_admins;
}
//get single admin user
public static ArrayList<Admin> getSingleAdminUser(int id){
ArrayList<Admin> single_admin=new ArrayList<>();
Connection cn=ConnectDB.connect();
String sql="SELECT * FROM admin WHERE id=?";
try {
PreparedStatement ps=cn.prepareStatement(sql);
ps.setInt(1,id);
ResultSet rs=ps.executeQuery();
while (rs.next()){
int admin_id=Integer.parseInt(rs.getString("id"));
String fname=rs.getString("firstname");
String lname=rs.getString("lastname");
String password=rs.getString("password");
String email=rs.getString("email");
String contact=rs.getString("contact");
Admin admin=new Admin();
admin.setId(admin_id);
admin.setFirstname(fname);
admin.setLastname(lname);
admin.setPassword(password);
admin.setEmail(email);
admin.setContact(contact);
single_admin.add(admin);
}
} catch (SQLException e) {
e.printStackTrace();
}
return single_admin;
}
//update admin user
public static boolean updateAdmin(Admin admin) {
boolean bool = false;
Connection cn = ConnectDB.connect();
String sql = "UPDATE admin SET firstname=?,lastname=?,email=?,contact=?,password=?,updated_at=? WHERE id=?";
try {
PreparedStatement ps = cn.prepareStatement(sql);
ps.setString(1, admin.getFirstname());
ps.setString(2, admin.getLastname());
ps.setString(3, admin.getEmail());
ps.setString(4, admin.getContact());
ps.setString(5, admin.getPassword());
ps.setString(6, admin.getUpdatedAt());
ps.setInt(7, admin.getId());
int status = ps.executeUpdate();
if (status == 1) {
bool = true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return bool;
}
}
| [
"krishnayamphu@gmail.,com"
] | krishnayamphu@gmail.,com |
b03bc594be4c5c24e4cab111ba593a3dbe68a159 | 89109dcbbc32a3c95071c80afe73e53900a96fdd | /PM-BE/pm-user-service/src/main/java/com/company/pm/userservice/web/AccountController.java | 020b3fe59fc584321616076bfcb9cd5f6ccbc48f | [] | no_license | hieuvubk/CNW_20202 | cff56ffa1440f6f29e970ccb1e822ab0d32de2d0 | 7c9a7b5293b1918afe111764717d2a05736553ed | refs/heads/master | 2023-06-15T12:48:05.047156 | 2021-05-30T21:40:06 | 2021-05-30T21:40:06 | 385,541,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,499 | java | package com.company.pm.userservice.web;
import com.company.pm.userservice.domain.services.dto.AdminUserDTO;
import com.company.pm.userservice.domain.services.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import springfox.documentation.annotations.ApiIgnore;
@RestController
@RequestMapping(
path = "/api/v1/account",
produces = MediaType.APPLICATION_JSON_VALUE
)
@RequiredArgsConstructor
public class AccountController {
private final UserService userService;
@GetMapping
public Mono<AdminUserDTO> getAccount(@ApiIgnore ServerWebExchange exchange) {
return exchange.getPrincipal()
.flatMap(principal -> {
if (principal instanceof AbstractAuthenticationToken) {
return userService.getUserFromAuthentication((AbstractAuthenticationToken) principal);
} else {
return Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND));
}
});
}
}
| [
"wizard201366@gmail.com"
] | wizard201366@gmail.com |
930580b8ff38fd1ddaa1144fd33a9d16fa5b9504 | eeefed02d3ca582621e2cbafe82610f78bd7b485 | /src/three/Test.java | 0b092e4b54ece4eef247f01175c7638ee09da9e3 | [] | no_license | raghavendra09/Task09mar18 | 99ead018ff094e9d27fc0d1dbd8464f0bd43c798 | 3f52c41fe2a8133c953a3a991319c1bccd568530 | refs/heads/master | 2021-04-15T10:51:39.648421 | 2018-03-22T07:30:22 | 2018-03-22T07:30:22 | 126,296,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 123 | java | package three;
public class Test {
public static void main(String[] args) {
Sample s=new Sample();
s.m(18);
}
} | [
"sys-52@sys-35-PC"
] | sys-52@sys-35-PC |
d3a60fd3ffbe7fe56a63696b717c3946f9b35019 | de8299def77d61b49e9971d3a6a6d8ada609e0a7 | /src/main/java/org/optaplanner/examples/cloudmy/domain/Balance.java | 9fff97328bbb3b012093653ea0dbc1a3dfad26bd | [] | no_license | yueze-zhang/MyOpta | daacbd1c791ac084935ca0e78cdd4254af8811f1 | 2e20939ddee06497d9a51fcf6e466e376d86125b | refs/heads/master | 2020-04-08T04:07:41.425262 | 2019-10-12T12:26:21 | 2019-10-12T12:26:21 | 159,004,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package org.optaplanner.examples.cloudmy.domain;
import org.optaplanner.core.api.domain.solution.PlanningEntityCollectionProperty;
import org.optaplanner.core.api.domain.solution.PlanningScore;
import org.optaplanner.core.api.domain.solution.PlanningSolution;
import org.optaplanner.core.api.domain.solution.drools.ProblemFactCollectionProperty;
import org.optaplanner.core.api.domain.valuerange.ValueRangeProvider;
import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore;
import org.optaplanner.examples.common.domain.AbstractPersistable;
import java.util.List;
/**
* @program: optaplanner-examples
* @description:
* @author: Zhang
* @create: 2019-09-27 14:08
*/
@PlanningSolution
public class Balance extends AbstractPersistable {
private List<Computer> computerList;
private List<Process> processList;
private HardSoftScore score;
public void setComputerList(List<Computer> computerList) {
this.computerList = computerList;
}
public void setProcessList(List<Process> processList) {
this.processList = processList;
}
@ValueRangeProvider(id = "computerRange")
@ProblemFactCollectionProperty
public List<Computer> getComputerList() {
return computerList;
}
@PlanningEntityCollectionProperty
public List<Process> getProcessList() {
return processList;
}
@PlanningScore
public HardSoftScore getScore() {
return score;
}
public void setScore(HardSoftScore score) {
this.score = score;
}
}
| [
"734762673@qq.com"
] | 734762673@qq.com |
86a6eb67598b2af4de6fe4d24393464b5de95195 | 48862d97ed9e6982b3a2f92d3133a2a9d6e7acf1 | /DHK/src/main/java/com/kym/ui/activity/fee_kf/DemoChatActivity.java | 2d6e10cba0da2c35fec0cda02831a0194ec65138 | [] | no_license | Yamy-2020/dhk_newJDY | 19cd76390a3425517610ced060ed6d0ddbbe9ce5 | 2fe9fac8af2f03ca85f74fc1b9fef4e55248ea86 | refs/heads/master | 2022-12-24T19:59:44.756894 | 2020-08-26T14:27:32 | 2020-08-26T14:27:32 | 296,294,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,529 | java | package com.kym.ui.activity.fee_kf;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.paradigm.botkit.BotKitClient;
import com.paradigm.botlib.BotLibClient;
import com.kym.ui.R;
/**
* Created by wuyifan on 2018/2/1.
*/
public class DemoChatActivity extends com.kym.ui.activity.fee_kf.ChatActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_chat, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menuSetting:
// Intent intent = new Intent();
// intent.setClass(this, SettingActivity.class);
// startActivity(intent);
// return true;
case R.id.menuClear:
BotKitClient.getInstance().removeAllMessages();
this.reloadMessageList();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onConnectionStateChanged(int state) {
super.onConnectionStateChanged(state);
if (state == BotLibClient.ConnectionConnectedRobot) {
BotKitClient botClient = BotKitClient.getInstance();
HistoryDataManager.getInstance().addHistory(this, botClient.getAccessKey(), "ddd");
}
}
}
| [
"hanyuge@vivancloud.com"
] | hanyuge@vivancloud.com |
9fd691021e9b3eda241d2f54c148c811477de462 | 952ea540d309b902850762ce122c9965fe417089 | /echo-client/src/main/java/com/ahuazhu/test/EchoClientApplication.java | 99ff8ec4d633c320cc7df1c70324b53919b2f4bf | [] | no_license | henghengha/spring-cloud-demo | 73cda977e98cff2d415022361faefca30fcc2e06 | f30795306db0a5fde397376d8bb71ee571fefd1c | refs/heads/master | 2023-03-23T05:06:09.916933 | 2017-03-22T06:46:16 | 2017-03-22T06:46:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package com.ahuazhu.test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
/**
* Created by zhengwenzhu on 2017/3/22.
*/
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
public class EchoClientApplication {
public static void main(String[] args) {
SpringApplication.run(EchoClientApplication.class, args);
}
}
| [
"ahuazhu@gmail.com"
] | ahuazhu@gmail.com |
e47194f579355464d3f891f94b9b8425a9d793f5 | 097df92ce1bfc8a354680725c7d10f0d109b5b7d | /com/amazonaws/services/sqs/buffered/QueueBufferFuture.java | 4fb44061cd714ef2920f635e345162da8463a494 | [] | no_license | cozos/emrfs-hadoop | 7a1a1221ffc3aa8c25b1067cf07d3b46e39ab47f | ba5dfa631029cb5baac2f2972d2fdaca18dac422 | refs/heads/master | 2022-10-14T15:03:51.500050 | 2022-10-06T05:38:49 | 2022-10-06T05:38:49 | 233,979,996 | 2 | 2 | null | 2022-10-06T05:41:46 | 2020-01-15T02:24:16 | Java | UTF-8 | Java | false | false | 3,070 | java | package com.amazonaws.services.sqs.buffered;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.AmazonWebServiceRequest;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
class QueueBufferFuture<Req extends AmazonWebServiceRequest, Res>
implements Future<Res>
{
private Res result = null;
private Exception e = null;
private boolean done = false;
private final QueueBufferCallback<Req, Res> callback;
private QueueBuffer issuingBuffer = null;
public QueueBufferFuture()
{
this(null);
}
public QueueBufferFuture(QueueBufferCallback<Req, Res> cb)
{
callback = cb;
}
public synchronized void setSuccess(Res paramResult)
{
if (done) {
return;
}
result = paramResult;
done = true;
notifyAll();
if (callback != null) {
QueueBuffer.executor.submit(new Callable()
{
public Void call()
throws Exception
{
callback.onSuccess(result);
return null;
}
});
}
}
public synchronized void setFailure(Exception paramE)
{
if (done) {
return;
}
e = paramE;
done = true;
notifyAll();
if (callback != null) {
QueueBuffer.executor.submit(new Callable()
{
public Void call()
throws Exception
{
callback.onError(e);
return null;
}
});
}
}
public boolean cancel(boolean arg0)
{
return false;
}
public synchronized void setBuffer(QueueBuffer paramBuffer)
{
issuingBuffer = paramBuffer;
}
public Res get()
throws InterruptedException, ExecutionException
{
for (;;)
{
try
{
return (Res)get(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
catch (TimeoutException localTimeoutException) {}
}
}
public synchronized Res get(long timeout, TimeUnit tu)
throws InterruptedException, ExecutionException, TimeoutException
{
long waitStartMs = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
long timeoutMs = TimeUnit.MILLISECONDS.convert(timeout, tu);
long timeToWaitMs = timeoutMs;
while (!done)
{
if (timeToWaitMs <= 0L) {
throw new TimeoutException("Timed out waiting for results after " + timeout + " " + tu);
}
wait(timeToWaitMs);
long nowMs = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
timeToWaitMs = timeoutMs - (nowMs - waitStartMs);
}
if (e != null) {
throw new ExecutionException(e);
}
return (Res)result;
}
public boolean isCancelled()
{
return false;
}
public synchronized boolean isDone()
{
return done;
}
}
/* Location:
* Qualified Name: com.amazonaws.services.sqs.buffered.QueueBufferFuture
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"Arwin.tio@adroll.com"
] | Arwin.tio@adroll.com |
9f46a2834e41eacb592d1b8b0dbfab84fa12810d | c1e403bcbc9aa7b385f0861cfa68ae9befbfda8e | /Source/CameraMapsApplication/app/src/main/java/com/example/rohithkumar/cameramapsapplication/MainActivity.java | 753c4859a745cd7bc34a351c12167c5980dfdaef | [] | no_license | Schmidty88/ICP11003 | 6270d4695cb845ded3f30a814e552d69f9064ce0 | 31a8f5ab009852e0495b31dc9263547278c68f26 | refs/heads/master | 2020-03-22T22:50:37.073252 | 2018-07-12T23:31:16 | 2018-07-12T23:31:16 | 140,773,609 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,112 | java | package com.example.rohithkumar.cameramapsapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button button_map, button_photo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onPhotoClick(View v) {
//This code redirects the from main page to the maps page.
Intent redirect = new Intent(MainActivity.this, CameraActivity.class);
startActivity(redirect);
}
public void onLocationClick(View v) {
//This code redirects to the photo activity.
Intent redirect = new Intent(MainActivity.this, MyMapsActivity.class);
startActivity(redirect);
}
public void onVideoClick(View v) {
Intent intent = new Intent(MainActivity.this, playVideo.class);
startActivity(intent);
}
}
| [
"tjschmidt5@gmail.com"
] | tjschmidt5@gmail.com |
bb03fc2c83b50f033be2424f4cf40b1b7af31ece | 85986e4d862e6fd257eb1c3db6f6b9c82bc6c4d5 | /prjClienteSIC/src/main/java/ec/com/smx/sic/cliente/mdl/dto/ArticuloProveedorDTO.java | 189ce549707b40172b89ac8a8d7167af6b9ec10b | [] | no_license | SebasBenalcazarS/RepoAngularJS | 1d60d0dec454fe4f1b1a8c434b656d55166f066f | 5c3e1d5bb4a624e30cba0d518ff0b0cda14aa92c | refs/heads/master | 2016-08-03T23:21:26.639859 | 2015-08-19T16:05:00 | 2015-08-19T16:05:00 | 40,517,374 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,543 | java | package ec.com.smx.sic.cliente.mdl.dto;
import static javax.persistence.FetchType.LAZY;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.CollectionTypeInfo;
import ec.com.kruger.utilitario.dao.commons.annotations.ComparatorTypeField;
import ec.com.kruger.utilitario.dao.commons.annotations.LastModificationDateField;
import ec.com.kruger.utilitario.dao.commons.annotations.LastModifierUserIdField;
import ec.com.kruger.utilitario.dao.commons.annotations.RegisterDateField;
import ec.com.kruger.utilitario.dao.commons.annotations.RegisterUserIdField;
import ec.com.kruger.utilitario.dao.commons.dto.SimpleAuditDTO;
import ec.com.smx.sic.cliente.common.SICConstantes;
import ec.com.smx.sic.cliente.common.articulo.SICArticuloCalculo;
import ec.com.smx.sic.cliente.common.articulo.TipoCatalogoArticulo;
import ec.com.smx.sic.cliente.common.cambioprecios.beans.DatosOrdenCompra;
import ec.com.smx.sic.cliente.common.factory.SICFactory;
import ec.com.smx.sic.cliente.mdl.dto.interfaces.IntegrableMQ;
import ec.com.smx.sic.cliente.mdl.dto.sispe.ArticuloTemporadaDTO;
/**
* Entidad que almacena los datos de referencia de un articulo vs proveedor-clasificacion
*
* @author fmunoz
*/
@SuppressWarnings("serial")
@Entity
@Table(name="SCSADTARTPRO")
public class ArticuloProveedorDTO extends SimpleAuditDTO implements IntegrableMQ, Cloneable{
@EmbeddedId
private ec.com.smx.sic.cliente.mdl.dto.id.ArticuloProveedorID id = new ec.com.smx.sic.cliente.mdl.dto.id.ArticuloProveedorID();
/**
* Codigo de referencia del proveedor para el articulo.
*
*/
private String codigoReferenciaProveedor;
/**
* C�digo de referencia del interna para el art�culo.
*
*/
private String codigoReferenciaInterna;
/**
* Estado del proveedor vs art�culo, los valores permitidos son: [0] INACTIVO, [1] ACTIVO
*/
@ComparatorTypeField
private String estadoArticuloProveedor;
/**
* Es el costo bruto del art�culo que da el proveedor
*
*/
private Double costoBruto;
/**
* Es el costo bruto del art�culo antes de la fecha de cambio
*
*/
private Double costoBrutoAnterior;
/**
* Fecha en la que cambi� el costo bruto
*/
private Date fechaCambioCosto;
/**
* Indica el porcentaje adicional que se le puede recibir a un proveedor cuando trae mercadería
*
*/
private Double porcentajeExesoRecepcion;
/**
* Usuario que cre� el registro
*
*/
@RegisterUserIdField
@Column(updatable=false)
private String idUsuarioRegistro;
/**
* Fecha en la cual se cre� el registro
*
*/
@RegisterDateField
@Column(updatable=false)
private java.sql.Timestamp fechaRegistro;
/**
* Usuario que realiza la �ltima actualizaci�n del registro
*
*/
@LastModifierUserIdField
@Column(insertable=false)
private String idUsuarioModificacion;
/**
* Fecha en la cual se realiz� la ultima actualizaci�n del registro
*
*/
@LastModificationDateField
@Column(insertable=false)
private java.sql.Timestamp fechaModificacion;
@ComparatorTypeField
@Column(name="VALORPLAZOPAGO")
private String valorPlazoPago;
@Column(name="CODIGOPLAZOPAGO")
private Integer codigoPlazoPago;
/**
* Indica si el artículo del proveedor tiene o no registro sanitario
*/
@Column(name="CONFIRMAREGISTROSANITARIO")
private Boolean esConfirmadoRegistroSanitario;
/**
* Observaci�n sobre el registro sanitario del artículo
*/
private String observacionRegistroSanitario;
@Column(name = "CANTIDADMAXIMAOFERTADA")
private Integer cantidadMaximaOfertada;
@Column(name = "PESOMAXIMOOFERTADO")
private BigDecimal pesoMaximoOfertado;
@ManyToOne(fetch = LAZY)
@JoinColumns({@JoinColumn(name="CODIGOCOMPANIA", insertable=false, updatable=false, referencedColumnName="CODIGOCOMPANIA"),@JoinColumn(name="CODIGOARTICULO", referencedColumnName="CODIGOARTICULO", insertable=false, updatable=false)})
private ec.com.smx.sic.cliente.mdl.dto.ArticuloDTO articulo;
@ManyToOne(fetch = LAZY)
@JoinColumns({@JoinColumn(name="CODIGOCOMPANIA", insertable=false, updatable=false, referencedColumnName="CODIGOCOMPANIA"),
@JoinColumn(name="CODIGOARTICULO", referencedColumnName="CODIGOARTICULO", insertable=false, updatable=false),
@JoinColumn(name="CODIGOPROVEEDOR", referencedColumnName="CODIGOPROVEEDOR", insertable=false, updatable=false)})
private ec.com.smx.sic.cliente.mdl.dto.ArticuloImportacionDTO articuloImportacion;
@OneToMany(mappedBy = "articuloProveedorDTO")
@CollectionTypeInfo(name= SICConstantes.USERTYPE_COLLECTION)
private Collection<ArticuloProveedorImpuestoDTO> articuloProveedorImpuestoCol;
@OneToMany(mappedBy = "articuloProveedorDTO")
@CollectionTypeInfo(name= SICConstantes.USERTYPE_COLLECTION)
private Collection<ArticuloTemporadaDTO> articuloTemporadaCol;
@OneToMany(mappedBy = "articuloProveedor")
@CollectionTypeInfo(name = SICConstantes.USERTYPE_COLLECTION)
private Collection<BitacoraArticuloProveedorDTO> bitacoraArticuloProveedorCol;
@OneToMany(mappedBy = "articuloProveedor")
@CollectionTypeInfo(name = SICConstantes.USERTYPE_COLLECTION)
private Collection<DescuentoProveedorArticuloDTO> descuentoProveedorArticuloCol;
@OneToMany(mappedBy = "articuloProveedor")
@CollectionTypeInfo(name= SICConstantes.USERTYPE_COLLECTION)
private Collection<ArticuloProveedorNovedadDTO> novedades;
@OneToMany(mappedBy = "articuloProveedor")
@CollectionTypeInfo(name = SICConstantes.USERTYPE_COLLECTION)
private Collection<ArticuloProveedorCostoDTO> articuloProveedorCostoCol;
@ManyToOne(fetch = LAZY)
@JoinColumns({@JoinColumn(name="CODIGOCOMPANIA", insertable=false, updatable=false, referencedColumnName="CODIGOCOMPANIA"),@JoinColumn(name="CODIGOPROVEEDOR", referencedColumnName="CODIGOPROVEEDOR", insertable=false, updatable=false)})
private ec.com.smx.sic.cliente.mdl.dto.ProveedorDTO proveedor;
@ManyToOne(fetch = LAZY)
@JoinColumns({
@JoinColumn(name="VALORPLAZOPAGO", referencedColumnName="CODIGOCATALOGOVALOR", insertable=false, updatable=false),
@JoinColumn(name="CODIGOPLAZOPAGO", insertable=false, updatable=false, referencedColumnName="CODIGOCATALOGOTIPO")}
)
private ec.com.smx.corpv2.dto.CatalogoValorDTO tipoPlazoPago;
@OneToMany(mappedBy = "articuloProveedor")
@CollectionTypeInfo(name = SICConstantes.USERTYPE_COLLECTION)
private Collection<ArticuloUnidadManejoProveedorDTO> unidadesManejo;
@ManyToOne(fetch = LAZY)
@JoinColumns({@JoinColumn(name="CODIGOCOMPANIA", insertable=false, updatable=false, referencedColumnName="CODIGOCOMPANIA"),@JoinColumn(name="CODIGOPROVEEDOR", referencedColumnName="CODIGOPROVEEDOR", insertable=false, updatable=false)})
private ec.com.smx.sic.cliente.mdl.dto.VistaProveedorDTO vistaProveedor;
@OneToMany(mappedBy = "articuloProveedor")
@CollectionTypeInfo(name= SICConstantes.USERTYPE_COLLECTION)
private Collection<ArticuloOfertaProveedorDTO> articuloOfertaProveedorDTO;
@Transient
private Double costoNeto;
@Transient
private Double costoNetoProyectado1;
@Transient
private Double costoNetoProyectado2;
@Transient
private Double costoNetoImportacion;
@Transient
private Double costoNetoImportacionComision;
@Transient
private Double costoNetoNC;
@Transient
private Integer plazoPago=0;
@Transient
private Boolean transferirDatosSIC=Boolean.TRUE;
@Transient
private Boolean selected;
//coleccion de ordenes de compra en conflicto(se consulta cuando se quiera dar de baja el articulo proveedor)
@Transient
private Collection<DatosOrdenCompra> datosOrdenCompra;
@Transient
@Column(name="NOVEDADRECEPCION")
private String novedadRecepcion;
/**
* Retorna valor de propiedad <code>id</code>
*
* @return Retorna valor de propiedad <code>id</code>
*/
public ec.com.smx.sic.cliente.mdl.dto.id.ArticuloProveedorID getId() {
return this.id;
}
/**
* Establece un nuevo valor para la propiedad <code>id</code>.
*
* @param id1
* El valor a establecer para la propiedad <code>id</code>.
*/
public void setId(ec.com.smx.sic.cliente.mdl.dto.id.ArticuloProveedorID id1) {
this.id = id1;
}
/**
* Retorna valor de propiedad <code>codigoReferenciaProveedor</code>
*
* @return Retorna valor de propiedad <code>codigoReferenciaProveedor</code>
*/
public String getCodigoReferenciaProveedor() {
return this.codigoReferenciaProveedor;
}
/**
* Establece un nuevo valor para la propiedad <code>codigoReferenciaProveedor</code>.
*
* @param codigoReferenciaProveedor1
* El valor a establecer para la propiedad <code>codigoReferenciaProveedor</code>.
*/
public void setCodigoReferenciaProveedor(String codigoReferenciaProveedor1) {
this.codigoReferenciaProveedor = codigoReferenciaProveedor1;
}
/**
* Retorna valor de propiedad <code>estadoArticuloProveedor</code>
*
* @return Retorna valor de propiedad <code>estadoArticuloProveedor</code>
*/
public String getEstadoArticuloProveedor() {
return this.estadoArticuloProveedor;
}
/**
* Establece un nuevo valor para la propiedad <code>estadoArticuloProveedor</code>.
*
* @param estadoArticuloProveedor1
* El valor a establecer para la propiedad <code>estadoArticuloProveedor</code>.
*/
public void setEstadoArticuloProveedor(String estadoArticuloProveedor1) {
this.estadoArticuloProveedor = estadoArticuloProveedor1;
if (estadoArticuloProveedor != null && estadoArticuloProveedor.length() > 1) {
estadoArticuloProveedor = estadoArticuloProveedor.substring(0, 1);
}
}
/**
* Retorna valor de propiedad <code>idUsuarioRegistro</code>
*
* @return Retorna valor de propiedad <code>idUsuarioRegistro</code>
*/
public String getIdUsuarioRegistro() {
return this.idUsuarioRegistro;
}
/**
* Establece un nuevo valor para la propiedad <code>idUsuarioRegistro</code>.
*
* @param idUsuarioRegistro1
* El valor a establecer para la propiedad <code>idUsuarioRegistro</code>.
*/
public void setIdUsuarioRegistro(String idUsuarioRegistro1) {
this.idUsuarioRegistro = idUsuarioRegistro1;
if (idUsuarioRegistro != null && idUsuarioRegistro.length() > 32) {
idUsuarioRegistro = idUsuarioRegistro.substring(0, 32);
}
}
/**
* Retorna valor de propiedad <code>fechaRegistro</code>
*
* @return Retorna valor de propiedad <code>fechaRegistro</code>
*/
public java.sql.Timestamp getFechaRegistro() {
return this.fechaRegistro;
}
/**
* Establece un nuevo valor para la propiedad <code>fechaRegistro</code>.
*
* @param fechaRegistro1
* El valor a establecer para la propiedad <code>fechaRegistro</code>.
*/
public void setFechaRegistro(java.sql.Timestamp fechaRegistro1) {
this.fechaRegistro = fechaRegistro1;
}
/**
* Retorna valor de propiedad <code>idUsuarioModificacion</code>
*
* @return Retorna valor de propiedad <code>idUsuarioModificacion</code>
*/
public String getIdUsuarioModificacion() {
return this.idUsuarioModificacion;
}
/**
* Establece un nuevo valor para la propiedad <code>idUsuarioModificacion</code>.
*
* @param idUsuarioModificacion1
* El valor a establecer para la propiedad <code>idUsuarioModificacion</code>.
*/
public void setIdUsuarioModificacion(String idUsuarioModificacion1) {
this.idUsuarioModificacion = idUsuarioModificacion1;
if (idUsuarioModificacion != null && idUsuarioModificacion.length() > 32) {
idUsuarioModificacion = idUsuarioModificacion.substring(0, 32);
}
}
/**
* Retorna valor de propiedad <code>fechaModificacion</code>
*
* @return Retorna valor de propiedad <code>fechaModificacion</code>
*/
public java.sql.Timestamp getFechaModificacion() {
return this.fechaModificacion;
}
/**
* Establece un nuevo valor para la propiedad <code>fechaModificacion</code>.
*
* @param fechaModificacion1
* El valor a establecer para la propiedad <code>fechaModificacion</code>.
*/
public void setFechaModificacion(java.sql.Timestamp fechaModificacion1) {
this.fechaModificacion = fechaModificacion1;
}
/**
* Retorna valor de propiedad <code>articulo</code>
*
* @return Retorna valor de propiedad <code>articulo</code>
*/
public ec.com.smx.sic.cliente.mdl.dto.ArticuloDTO getArticulo() {
return this.articulo;
}
/**
* Establece un nuevo valor para la propiedad <code>articulo</code>.
*
* @param articulo1
* El valor a establecer para la propiedad <code>articulo</code>.
*/
public void setArticulo(ec.com.smx.sic.cliente.mdl.dto.ArticuloDTO articulo1) {
this.articulo = articulo1;
}
/**
* Retorna valor de propiedad <code>proveedor</code>
*
* @return Retorna valor de propiedad <code>proveedor</code>
*/
public ec.com.smx.sic.cliente.mdl.dto.ProveedorDTO getProveedor() {
return this.proveedor;
}
/**
* Establece un nuevo valor para la propiedad <code>proveedor</code>.
*
* @param proveedor1
* El valor a establecer para la propiedad <code>proveedor</code>.
*/
public void setProveedor(ec.com.smx.sic.cliente.mdl.dto.ProveedorDTO proveedor1) {
this.proveedor = proveedor1;
}
/**
* @return the costoBruto
*/
public Double getCostoBruto() {
return costoBruto;
}
/**
* @param costoBruto the costoBruto to set
*/
public void setCostoBruto(Double costoBruto) {
this.costoBruto = costoBruto;
}
/**
* @return the porcentajeExesoRecepcion
*/
public Double getPorcentajeExesoRecepcion() {
return porcentajeExesoRecepcion;
}
/**
* @param porcentajeExesoRecepcion the porcentajeExesoRecepcion to set
*/
public void setPorcentajeExesoRecepcion(Double porcentajeExesoRecepcion) {
this.porcentajeExesoRecepcion = porcentajeExesoRecepcion;
}
/**
* @return the articuloImportacion
*/
public ec.com.smx.sic.cliente.mdl.dto.ArticuloImportacionDTO getArticuloImportacion() {
return articuloImportacion;
}
/**
* @param articuloImportacion the articuloImportacion to set
*/
public void setArticuloImportacion(ec.com.smx.sic.cliente.mdl.dto.ArticuloImportacionDTO articuloImportacion) {
this.articuloImportacion = articuloImportacion;
}
/**
* @return the descuentoProveedorArticuloCol
*/
public Collection<DescuentoProveedorArticuloDTO> getDescuentoProveedorArticuloCol() {
return descuentoProveedorArticuloCol;
}
/**
* @param descuentoProveedorArticuloCol the descuentoProveedorArticuloCol to set
*/
public void setDescuentoProveedorArticuloCol(Collection<DescuentoProveedorArticuloDTO> descuentoProveedorArticuloCol) {
this.descuentoProveedorArticuloCol = descuentoProveedorArticuloCol;
}
/**
* @return the costoNeto
*/
public Double getCostoNeto() {
if(costoNeto == null){
SICFactory.getInstancia().articulo.getArticuloCalculoService().calcularCostoNeto(this);
}
return costoNeto;
}
/**
* Costo proyectado para el dia siguiente de la fecha actual consultada
* @return the costoNetoProyectado1
*/
public Double getCostoNetoProyectado1() {
if(costoNetoProyectado1 == null){
costoNetoProyectado1 = SICFactory.getInstancia().articulo.getArticuloCalculoService().calcularCostoNeto(this,TipoCatalogoArticulo.VALOR_TIPO_COSTO_PROYECTADO1);
if(costoNetoProyectado1 == null || costoNetoProyectado1 == 0){
costoNetoProyectado1 = getCostoNeto();
setCostoNetoProyectado1(costoNetoProyectado1);
}else{
setCostoNetoProyectado1(costoNetoProyectado1);
}
}
return costoNetoProyectado1;
}
/**
* Costo proyectado para el segundo dia despues de la fecha actual consultada
* @return the costoNetoProyectado2
*/
public Double getCostoNetoProyectado2() {
if(costoNetoProyectado2 == null){
costoNetoProyectado2 = SICFactory.getInstancia().articulo.getArticuloCalculoService().calcularCostoNeto(this,TipoCatalogoArticulo.VALOR_TIPO_COSTO_PROYECTADO2);
if(costoNetoProyectado2 == null || costoNetoProyectado2 == 0){
costoNetoProyectado2 = getCostoNeto();
setCostoNetoProyectado2(costoNetoProyectado2);
}else{
setCostoNetoProyectado2(costoNetoProyectado2);
}
}
return costoNetoProyectado2;
}
/**
*
* @param ap
*/
public void obtenerCostosNetosProyeccion(){
SICFactory.getInstancia().articulo.getArticuloCalculoService().calcularCostoNetoProyectado(this);
}
/**
* @return the costoNeto
*/
public Double getCostoNetoNC() {
if(costoNetoNC == null){
costoNetoNC = SICFactory.getInstancia().articulo.getArticuloCalculoService().calcularCostoNetoNotaCredito(this);
}
return costoNetoNC;
}
/**
* @return the costoNeto
*/
public Double getCostoBrutoImp() {
Map<String, Double> valoresImpuestos = obtenerImpuestos();
if(costoBruto != null && valoresImpuestos !=null)
return SICArticuloCalculo.getInstancia().calcularValorConImpuestos(costoBruto, valoresImpuestos, Boolean.FALSE);
return costoBruto;
}
/**
* @return the costoNeto
*/
public Double getCostoNetoImp() {
Double costoNetoImp = getCostoNeto();
Map<String, Double> valoresImpuestos = obtenerImpuestos();
if(costoNetoImp != null && valoresImpuestos != null){
return SICArticuloCalculo.getInstancia().calcularValorConImpuestos(costoNetoImp, valoresImpuestos, Boolean.FALSE);
}
return costoNetoImp;
}
private Map<String, Double> obtenerImpuestos(){
if(this.getTieneArticulo()){
return SICArticuloCalculo.getInstancia().obtenerValoresImpuesto(articulo, Boolean.FALSE);
}
return null;
}
/**
* @param costoNeto the costoNetoNC to set
*/
public void setCostoNetoNC(Double costoNeto) {
this.costoNetoNC = costoNeto;
}
/**
* @param costoNeto the costoNeto to set
*/
public void setCostoNeto(Double costoNeto) {
this.costoNeto = costoNeto;
}
/**
* @param costoNetoProyectado1 the costoNetoProyectado1 to set
*/
public void setCostoNetoProyectado1(Double costoNetoProyectado1) {
this.costoNetoProyectado1 = costoNetoProyectado1;
}
/**
* @param costoNetoProyectado2 the costoNetoProyectado2 to set
*/
public void setCostoNetoProyectado2(Double costoNetoProyectado2) {
this.costoNetoProyectado2 = costoNetoProyectado2;
}
public Boolean getTieneDescuentoProveedorArticuloCol(){
return isLoaded(descuentoProveedorArticuloCol) && !descuentoProveedorArticuloCol.isEmpty();
}
public Boolean getTieneArticuloProveedorImpuestos(){
return isLoaded(articuloProveedorImpuestoCol) && CollectionUtils.isNotEmpty(articuloProveedorImpuestoCol);
}
public Boolean getTieneUnidadesManejo(){
return isLoaded(unidadesManejo);
}
/**
* Valida si existe la relación con los costos
* @return
*/
public Boolean getTieneArticuloProveedorCosto() {
return isLoaded(this.articuloProveedorCostoCol) && !this.articuloProveedorCostoCol.isEmpty();
}
/**
* @return the plazoPago
*/
public Integer getPlazoPago() {
return plazoPago;
}
/**
* @param plazoPago the plazoPago to set
*/
public void setPlazoPago(Integer plazoPago) {
this.plazoPago = plazoPago;
}
public ec.com.smx.sic.cliente.mdl.dto.VistaProveedorDTO getVistaProveedor() {
return vistaProveedor;
}
public void setVistaProveedor(
ec.com.smx.sic.cliente.mdl.dto.VistaProveedorDTO vistaProveedor) {
this.vistaProveedor = vistaProveedor;
}
/**
* @return the fechaCambioCosto
*/
public Date getFechaCambioCosto() {
return fechaCambioCosto;
}
/**
* @param fechaCambioCosto the fechaCambioCosto to set
*/
public void setFechaCambioCosto(Date fechaCambioCosto) {
this.fechaCambioCosto = fechaCambioCosto;
}
/**
* @return the costoBrutoAnterior
*/
public Double getCostoBrutoAnterior() {
return costoBrutoAnterior;
}
/**
* @param costoBrutoAnterior the costoBrutoAnterior to set
*/
public void setCostoBrutoAnterior(Double costoBrutoAnterior) {
this.costoBrutoAnterior = costoBrutoAnterior;
}
public Boolean getTieneVistaProveedor(){
return isLoaded(vistaProveedor);
}
public Boolean getTieneProveedor(){
return isLoaded(proveedor);
}
public Boolean getTieneArticuloImportacion(){
return isLoaded(articuloImportacion);
}
public Boolean getTieneArticulo(){
return isLoaded(articulo);
}
/**
* Valida si está cargada la relación con clasificaciones
* @return
*/
public Boolean getTieneNovedades() {
return isLoaded(this.novedades);
}
/**
* @return the transferirDatosSIC
*/
public Boolean getTransferirDatosSIC() {
return transferirDatosSIC;
}
/**
* @param transferirDatosSIC the transferirDatosSIC to set
*/
public void setTransferirDatosSIC(Boolean transferirDatosSIC) {
this.transferirDatosSIC = transferirDatosSIC;
}
public String getCodigoReferenciaInterna() {
return codigoReferenciaInterna;
}
public void setCodigoReferenciaInterna(String codigoReferenciaInternaAux) {
String codigoReferenciaInterna = codigoReferenciaInternaAux;
if((StringUtils.isNotEmpty(codigoReferenciaInterna)) && (codigoReferenciaInterna.length() > 20)){
codigoReferenciaInterna = StringUtils.substring(codigoReferenciaInterna, 0, 20);
}
this.codigoReferenciaInterna = codigoReferenciaInterna;
}
/**
* @return the costoNetoImportacion
*/
public Double getCostoNetoImportacion() {
if(costoNetoImportacion == null){
SICFactory.getInstancia().articulo.getArticuloCalculoService().calcularCostoNeto(this, Boolean.TRUE, Boolean.FALSE);
}
return costoNetoImportacion;
}
/**
* @param costoNetoImportacion the costoNetoImportacion to set
*/
public void setCostoNetoImportacion(Double costoNetoImportacion) {
this.costoNetoImportacion = costoNetoImportacion;
}
/**
* @return the costoNetoImportacionComision
*/
public Double getCostoNetoImportacionComision() {
if(costoNetoImportacionComision == null){
SICFactory.getInstancia().articulo.getArticuloCalculoService().calcularCostoNeto(this, Boolean.TRUE, Boolean.TRUE);
}
return costoNetoImportacionComision;
}
/**
* @param costoNetoImportacionComision the costoNetoImportacionComision to set
*/
public void setCostoNetoImportacionComision(Double costoNetoImportacionComision) {
this.costoNetoImportacionComision = costoNetoImportacionComision;
}
/**
* @return the articuloTemporadaCol
*/
public Collection<ArticuloTemporadaDTO> getArticuloTemporadaCol() {
return articuloTemporadaCol;
}
/**
* @param articuloTemporadaCol the articuloTemporadaCol to set
*/
public void setArticuloTemporadaCol(Collection<ArticuloTemporadaDTO> articuloTemporadaCol) {
this.articuloTemporadaCol = articuloTemporadaCol;
}
public Collection<BitacoraArticuloProveedorDTO> getBitacoraArticuloProveedorCol() {
return bitacoraArticuloProveedorCol;
}
public void setBitacoraArticuloProveedorCol(Collection<BitacoraArticuloProveedorDTO> bitacoraArticuloProveedorCol) {
this.bitacoraArticuloProveedorCol = bitacoraArticuloProveedorCol;
}
/**
* @return the tipoPlazoPago
*/
public ec.com.smx.corpv2.dto.CatalogoValorDTO getTipoPlazoPago() {
return tipoPlazoPago;
}
/**
* @param tipoPlazoPago the tipoPlazoPago to set
*/
public void setTipoPlazoPago(ec.com.smx.corpv2.dto.CatalogoValorDTO tipoPlazoPago) {
this.tipoPlazoPago = tipoPlazoPago;
}
/**
* @return the valorPlazoPago
*/
public String getValorPlazoPago() {
return valorPlazoPago;
}
/**
* @param valorPlazoPago the valorPlazoPago to set
*/
public void setValorPlazoPago(String valorPlazoPago) {
this.valorPlazoPago = valorPlazoPago;
}
/**
* @return the codigoPlazoPago
*/
public Integer getCodigoPlazoPago() {
return codigoPlazoPago;
}
/**
* @param codigoPlazoPago the codigoPlazoPago to set
*/
public void setCodigoPlazoPago(Integer codigoPlazoPago) {
this.codigoPlazoPago = codigoPlazoPago;
}
public Boolean getTienePlazoPago(){
return isLoaded(tipoPlazoPago);
}
/**
* @return the novedades
*/
public Collection<ArticuloProveedorNovedadDTO> getNovedades() {
return novedades;
}
/**
* @param novedades the novedades to set
*/
public void setNovedades(Collection<ArticuloProveedorNovedadDTO> novedades) {
this.novedades = novedades;
}
public Collection<ArticuloUnidadManejoProveedorDTO> getUnidadesManejo() {
return unidadesManejo;
}
public void setUnidadesManejo(Collection<ArticuloUnidadManejoProveedorDTO> unidadesManejo) {
this.unidadesManejo = unidadesManejo;
}
public Boolean getEsConfirmadoRegistroSanitario() {
return esConfirmadoRegistroSanitario;
}
public void setEsConfirmadoRegistroSanitario(Boolean esConfirmadoRegistroSanitario) {
this.esConfirmadoRegistroSanitario = esConfirmadoRegistroSanitario;
}
public String getObservacionRegistroSanitario() {
return observacionRegistroSanitario;
}
public void setObservacionRegistroSanitario(String observacionRegistroSanitario) {
this.observacionRegistroSanitario = observacionRegistroSanitario;
}
public Boolean getSelected() {
return selected;
}
public void setSelected(Boolean selected) {
this.selected = selected;
}
public ArticuloProveedorDTO clone() throws CloneNotSupportedException{
ArticuloProveedorDTO apClone = (ArticuloProveedorDTO)super.clone();
apClone.setId(id.clone());
return apClone;
}
/**
* @return the articuloProveedorImpuestoCol
*/
public Collection<ArticuloProveedorImpuestoDTO> getArticuloProveedorImpuestoCol() {
return articuloProveedorImpuestoCol;
}
/**
* @param articuloProveedorImpuestoCol the articuloProveedorImpuestoCol to set
*/
public void setArticuloProveedorImpuestoCol(Collection<ArticuloProveedorImpuestoDTO> articuloProveedorImpuestoCol) {
this.articuloProveedorImpuestoCol = articuloProveedorImpuestoCol;
}
public Collection<ArticuloProveedorCostoDTO> getArticuloProveedorCostoCol() {
return articuloProveedorCostoCol;
}
public void setArticuloProveedorCostoCol(Collection<ArticuloProveedorCostoDTO> articuloProveedorCostoCol) {
this.articuloProveedorCostoCol = articuloProveedorCostoCol;
}
public Collection<DatosOrdenCompra> getDatosOrdenCompra() {
return datosOrdenCompra;
}
public void setDatosOrdenCompra(Collection<DatosOrdenCompra> datosOrdenCompra) {
this.datosOrdenCompra = datosOrdenCompra;
}
/**
* @return the novedadRecepcion
*/
public String getNovedadRecepcion() {
return novedadRecepcion;
}
/**
* @param novedadRecepcion the novedadRecepcion to set
*/
public void setNovedadRecepcion(String novedadRecepcion) {
this.novedadRecepcion = novedadRecepcion;
}
public Collection<ArticuloOfertaProveedorDTO> getArticuloOfertaProveedorDTO() {
return articuloOfertaProveedorDTO;
}
public void setArticuloOfertaProveedorDTO(Collection<ArticuloOfertaProveedorDTO> articuloOfertaProveedorDTO) {
this.articuloOfertaProveedorDTO = articuloOfertaProveedorDTO;
}
public Integer getCantidadMaximaOfertada() {
return cantidadMaximaOfertada;
}
public void setCantidadMaximaOfertada(Integer cantidadMaximaOfertada) {
this.cantidadMaximaOfertada = cantidadMaximaOfertada;
}
public BigDecimal getPesoMaximoOfertado() {
return pesoMaximoOfertado;
}
public void setPesoMaximoOfertado(BigDecimal pesoMaximoOfertado) {
this.pesoMaximoOfertado = pesoMaximoOfertado;
}
}
| [
"nbenalcazar@kruger.com.ec"
] | nbenalcazar@kruger.com.ec |
a7caf6c89911a3d0fcf0975d0fe3572020e1452b | 37634bbfe35182f5e76a720bcf0ee05134d71803 | /src/main/java/com/zking/springboot01/controller/ControllerStudent.java | ee63268454fb18498596a586bade6a40404ba393 | [] | no_license | dong957/SpringBoot- | d77480504ffa26aeea55235fc800292945913729 | adc83ad89af1cda3ebbc4c6c077f8172d0a661ae | refs/heads/master | 2022-06-22T04:04:38.632742 | 2020-01-05T01:07:32 | 2020-01-05T01:07:32 | 231,849,932 | 0 | 0 | null | 2022-06-21T02:34:24 | 2020-01-05T00:59:21 | Java | UTF-8 | Java | false | false | 1,266 | java | package com.zking.springboot01.controller;
import com.zking.springboot01.model.Student;
import com.zking.springboot01.service.IStudentService;
import com.zking.springboot01.util.PageBean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author dong
* @create 2020-01-0214:52
*/
@RestController
public class ControllerStudent {
@Resource
private IStudentService studentService;
@RequestMapping("/getSBySID")
public Object getStudentBySID(int sid) {
Student student = studentService.getStudentBySID(sid);
Map<Object,Object> map=new HashMap<>();
map.put("Date",student);
map.put("code",1);
map.put("success","查询成功");
return map;
}
@RequestMapping("/getSPaging")
public Object getStudentsPaging(Student student,PageBean pageBean){
List<Student> myl= studentService.getStudentsPaging(student,pageBean);
Map<Object,Object> map=new HashMap<>();
map.put("Date",myl);
map.put("code",1);
map.put("success","查询成功");
return map;
}
}
| [
"2854997357@qq.com"
] | 2854997357@qq.com |
72495d0e51fc58b31ae2331b8f2364027872d347 | 4d1045263e291a1884c95de891e381f57667c78c | /src/main/java/com/leif/ffDataServer/config/WebAuthenticationConfiguration.java | b2dfd8f98c2e357a65c5c60dada349a914cb1e3a | [] | no_license | t08094a/ffwDataServer | a966cd18cc4a77b27d3df01e44c3656c15fd968f | 8204b9f43f1ebaa2517293cdc31d176a43f50b4b | refs/heads/master | 2020-12-05T08:22:53.901992 | 2016-11-15T09:31:33 | 2016-11-15T09:31:33 | 67,932,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,905 | java | package com.leif.ffDataServer.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.authentication.configurers.GlobalAuthenticationConfigurerAdapter;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import com.leif.ffDataServer.domain.Account;
import com.leif.ffDataServer.domain.Role;
import com.leif.ffDataServer.repositories.AccountRepository;
import com.leif.ffDataServer.services.MongoDBAuthenticationProvider;
@Configuration
public class WebAuthenticationConfiguration extends GlobalAuthenticationConfigurerAdapter
{
@Autowired
private AccountRepository accountRepository;
@Autowired
private MongoDBAuthenticationProvider authenticationProvider;
@Override
public void init(AuthenticationManagerBuilder auth) throws Exception
{
CreateAdminIfNotPresent();
auth.userDetailsService(userDetailsService());
}
@Bean
UserDetailsService userDetailsService()
{
return new UserDetailsService()
{
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
{
Account account = accountRepository.findByUsername(username);
if (account != null)
{
return new User(account.getUsername(), account.getPassword(), true, true, true, true, account.getRoles());
}
else
{
throw new UsernameNotFoundException("could not find the user '" + username + "'");
}
}
};
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth)
throws Exception
{
auth.authenticationProvider(authenticationProvider);
}
private void CreateAdminIfNotPresent()
{
// TODO: parameter in application.properties auslagern
String username = "admin";
String password = authenticationProvider.getPasswordEncoder().encode("password");
if(accountRepository.findByUsername(username) == null)
{
Account root = new Account(username, password);
root.getRoles().addAll(AuthorityUtils.createAuthorityList(Role.ADMIN, Role.USER));
accountRepository.insert(root);
}
username = "user";
password = authenticationProvider.getPasswordEncoder().encode("password");
if(accountRepository.findByUsername(username) == null)
{
Account root = new Account(username, password);
root.getRoles().addAll(AuthorityUtils.createAuthorityList(Role.USER));
accountRepository.insert(root);
}
}
}
| [
"jochen.faehnlein@ff-ipsheim.de"
] | jochen.faehnlein@ff-ipsheim.de |
68f7638a9f86e97f9d0bf19f690b5fb1150636e5 | 3354516e7b97ffa763db80aa7095f86c9ac57358 | /api/src/main/java/cn/hangzhou/fans/exception/ResultException.java | 89df5eccf854c89073d92663fc72f226debd8c7e | [] | no_license | xiefans/vote | 75d1233433912fab2e78ae277caf8d7070469c5b | 237c3e104382a352530a0c725ad1344a991b4857 | refs/heads/master | 2022-12-21T09:58:45.089894 | 2020-03-29T13:49:54 | 2020-03-29T13:49:54 | 242,519,621 | 0 | 0 | null | 2022-12-16T04:54:50 | 2020-02-23T13:13:14 | Java | UTF-8 | Java | false | false | 289 | java | package cn.hangzhou.fans.exception;
public class ResultException extends Exception {
private Integer code;
public ResultException(Integer code, String message) {
super(message);
this.code = code;
}
public Integer getCode() {
return code;
}
}
| [
"fansooxx@163.com"
] | fansooxx@163.com |
e9fd7f49f8624abfe1343cd89137d4abd7414c3f | 9f994170cc741e72f9f551dee248da7fc7ef8596 | /bundles/org.nader.sennet.model/src-gen/org/nader/sennet/sensors/util/SensorsResourceImpl.java | 54a60ce05f156fe4b590558887d982e36a98a758 | [] | no_license | EmadNader/GitHubRepo | b55c029dea6507c40ad1e71219aa828a7af765dd | 9a75f1c981f435d20276abd0e86b530c29298136 | refs/heads/master | 2021-01-17T12:49:35.151373 | 2016-06-21T22:58:44 | 2016-06-21T22:58:44 | 58,553,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 641 | java | /**
*/
package org.nader.sennet.sensors.util;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
/**
* <!-- begin-user-doc -->
* The <b>Resource </b> associated with the package.
* <!-- end-user-doc -->
* @see org.nader.sennet.sensors.util.SensorsResourceFactoryImpl
* @generated
*/
public class SensorsResourceImpl extends XMIResourceImpl {
/**
* Creates an instance of the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param uri the URI of the new resource.
* @generated
*/
public SensorsResourceImpl(URI uri) {
super(uri);
}
} //SensorsResourceImpl
| [
"aak@opensynergy.com"
] | aak@opensynergy.com |
bb6d69ee5fb79abcccb08cf5b167dbdd3366234a | d766620b41ff17635e74c51708e146ab973347b6 | /app/src/main/java/com/hydbest/baseandroid/util/SkinLayoutInflater.java | d7f1c968ebb557eb84a470ea654e9f8fc1c6d7e2 | [] | no_license | zsgfrtttt/BaseAndroid | 65b5054714d00bc42ca082d5589bf15f1b90c254 | a7bc33b74cf327ab726f56aaaa8db833ab999b20 | refs/heads/master | 2021-07-23T21:00:52.702045 | 2021-06-28T08:03:51 | 2021-06-28T08:03:51 | 136,885,326 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,733 | java | package com.hydbest.baseandroid.util;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
/**
* @author csz
*/
public class SkinLayoutInflater extends LayoutInflater {
private static final String[] sClassPrefixList = {"android.widget.", "android.webkit.", "android.app.", "android.view."};
private static SkinLayoutInflater skinLayoutInflater;
private SkinLayoutInflater(Context context) {
super(context);
}
private SkinLayoutInflater(SkinLayoutInflater skinLayoutInflater, Context context) {
super(skinLayoutInflater, context);
}
public static SkinLayoutInflater from(Context context) {
if (skinLayoutInflater == null) {
synchronized (SkinLayoutInflater.class) {
if (skinLayoutInflater == null) {
skinLayoutInflater = new SkinLayoutInflater(context);
}
}
}
return skinLayoutInflater;
}
//
@Override
public View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
if (-1 == name.indexOf('.')) {
for (String prefix : sClassPrefixList) {
try {
View view = createView(name, prefix, attrs);
if (view != null) {
return view;
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
return super.createView(name,"",attrs);
}
public LayoutInflater cloneInContext(Context newContext) {
return new SkinLayoutInflater(this, newContext);
}
}
| [
"1058079995@qq.com"
] | 1058079995@qq.com |
f53d388115f2c53e3c8ff64f6ac5e005acb747fd | ac90795804ed2c4d3ac6999fee0ddda154f08be8 | /Server/src/main/java/com/itechart/courses/exception/DatabaseException.java | b112e115f28308ecfa460f61c875878215122628 | [] | no_license | PavlovaMargarita/OrderFlowers | fec2d04fb038e21439e007413181b9b9b432b1b8 | 5ecef39e1cecb05dec3c27b7757b6708e2192b8a | refs/heads/master | 2021-01-20T11:41:03.315791 | 2014-09-29T07:35:29 | 2014-09-29T07:35:29 | 22,922,437 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package com.itechart.courses.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.FORBIDDEN, reason = "The database does not respond")
public class DatabaseException extends RuntimeException {}
| [
"harlex23@gmail.com"
] | harlex23@gmail.com |
84ac724f5e2eda6f2dd43aba0ac35a7a7ba7a584 | b641e481b07346d4b7504ff8a313fb3826e1be8b | /myfirst/src/myfirst/strings.java | 0d3ddcc90af3ff111935c113d246e87c9587d5b0 | [] | no_license | pranavi111/pranavi | 0293088ed55d484b6d2752ffe0edbffee9e7e2a7 | 66ef187a0b33156750365ad4557e37219552936a | refs/heads/master | 2020-11-25T00:18:29.556210 | 2019-12-16T18:46:02 | 2019-12-16T18:46:02 | 228,404,046 | 0 | 0 | null | 2020-10-13T18:15:31 | 2019-12-16T14:22:33 | Java | UTF-8 | Java | false | false | 181 | java | package myfirst;
public class strings {
public static void main(String[] args) {
String s1=new String("hello pranavi how r u");
System.out.print(s1);
}
}
| [
"pranavi060493@gmail.com"
] | pranavi060493@gmail.com |
d75bd47cc6419aaaae89b874c2b4b41ba1a7eb49 | a5468b2a7e0dad53f1d1bb21ab822b9b0a05c3d9 | /src/main/java/io/github/cbartosiak/bson/codecs/jsr310/zoneoffset/ZoneOffsetAsStringCodec.java | 26025abca7a09c6a5edc1352b6c295c3c1528604 | [
"Apache-2.0"
] | permissive | cbartosiak/bson-codecs-jsr310 | ef2a0dd2379f09514010bd43314a0a661eece55e | 77e93441d009f194c7803765482dd4943754f0fd | refs/heads/master | 2022-03-13T22:16:30.131273 | 2019-09-02T22:37:44 | 2019-09-02T22:37:44 | 108,441,902 | 20 | 2 | Apache-2.0 | 2019-08-28T11:10:17 | 2017-10-26T17:12:59 | Java | UTF-8 | Java | false | false | 2,029 | java | /*
* Copyright 2018 Cezary Bartosiak
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.cbartosiak.bson.codecs.jsr310.zoneoffset;
import static io.github.cbartosiak.bson.codecs.jsr310.internal.CodecsUtil.translateDecodeExceptions;
import static java.util.Objects.requireNonNull;
import java.time.ZoneOffset;
import org.bson.BsonReader;
import org.bson.BsonWriter;
import org.bson.codecs.Codec;
import org.bson.codecs.DecoderContext;
import org.bson.codecs.EncoderContext;
/**
* <p>
* Encodes and decodes {@code ZoneOffset} values to and from
* {@code BSON String}, such as {@code +01:00}.
* <p>
* The values are stored as normalized IDs
* (see {@link ZoneOffset#getId()}).
* <p>
* This type is <b>immutable</b>.
*/
public final class ZoneOffsetAsStringCodec implements Codec<ZoneOffset> {
@Override
public void encode(
BsonWriter writer,
ZoneOffset value,
EncoderContext encoderContext) {
requireNonNull(writer, "writer is null");
requireNonNull(value, "value is null");
writer.writeString(value.getId());
}
@Override
public ZoneOffset decode(
BsonReader reader,
DecoderContext decoderContext) {
requireNonNull(reader, "reader is null");
return translateDecodeExceptions(
reader::readString,
ZoneOffset::of
);
}
@Override
public Class<ZoneOffset> getEncoderClass() {
return ZoneOffset.class;
}
}
| [
"1280052+cbartosiak@users.noreply.github.com"
] | 1280052+cbartosiak@users.noreply.github.com |
664c044bad1542bc9c836bd752c2994c70164dff | 216dae16396c7646006ce9b5cca80c56ce50fb37 | /DiagnosaPenyakitGigidanMulut/app/src/main/java/com/kelompok/sistempakar/models/Kelas_Penyakit.java | 7f9af0b3d08f0bf442851826e6a18dd59d25aa1f | [] | no_license | ilhammariq/Aplikasi-Diagnosa-Gigi-dan-Mulut-berbasis-Android | 7192caa4d2c021420865423ab49c0700b0bb288b | 6fb3cc4e262cf5a1ffaca5fdc38ae1945df17f01 | refs/heads/master | 2022-07-10T03:13:32.333912 | 2020-05-12T14:17:31 | 2020-05-12T14:17:31 | 263,081,267 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package com.kelompok.sistempakar.models;
public class Kelas_Penyakit {
String pid,nama,penyebab,solusi;
public Kelas_Penyakit() {
}
public Kelas_Penyakit(String pid, String nama, String penyebab, String solusi) {
this.pid = pid;
this.nama = nama;
this.penyebab = penyebab;
this.solusi = solusi;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getNama() {
return nama;
}
public void setNama(String nama) {
this.nama = nama;
}
public String getPenyebab() { return penyebab; }
public void setPenyebab(String penyebab) { this.penyebab = penyebab; }
public String getSolusi() {
return solusi;
}
public void setSolusi(String solusi) {
this.solusi = solusi;
}
}
| [
"ilhammuhammadariq1@gmail.com"
] | ilhammuhammadariq1@gmail.com |
2db889d09e44a4aee4e397fccdfbadce774e28e9 | e342854bf6f5b9b79a2aee63c0162b0a37eb82a7 | /dc3-center/dc3-data/src/main/java/com/pnoker/center/data/service/impl/PointValueServiceImpl.java | 7fd32fe6d688c19e57effaec7b2f8f3108469d5d | [
"Apache-2.0"
] | permissive | wuyahui/iot-dc3 | 173d91c3d4e7500d5d9560dd7e517f428e2e22da | a0d573cfb483d0af65564f61a3f98754b2868b2e | refs/heads/master | 2021-02-16T01:02:46.252376 | 2020-03-02T13:38:31 | 2020-03-02T13:38:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,439 | java | package com.pnoker.center.data.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pnoker.center.data.service.PointValueService;
import com.pnoker.center.data.service.pool.ThreadPool;
import com.pnoker.common.bean.Pages;
import com.pnoker.common.bean.driver.PointValue;
import com.pnoker.common.bean.driver.PointValueDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.CriteriaDefinition;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;
/**
* @author pnoker
*/
@Slf4j
@Service
public class PointValueServiceImpl implements PointValueService {
@Resource
private ThreadPool threadPool;
@Resource
private MongoTemplate mongoTemplate;
@Override
public void add(PointValue pointValue) {
threadPool.executor.execute(() -> {
long createTime = System.currentTimeMillis();
long interval = createTime - pointValue.getOriginTime();
mongoTemplate.insert(pointValue.setCreateTime(createTime).setInterval(interval));
});
}
@Override
public Page<PointValue> list(PointValueDto pointValueDto) {
Criteria criteria = new Criteria();
Optional.ofNullable(pointValueDto).ifPresent(dto -> {
if (null != dto.getDeviceId()) {
criteria.and("deviceId").is(dto.getDeviceId());
}
if (null != dto.getPointId()) {
criteria.and("pointId").is(dto.getPointId());
}
if (dto.getPage().getStartTime() > 0 && dto.getPage().getEndTime() > 0 && dto.getPage().getStartTime() <= dto.getPage().getEndTime()) {
criteria.and("originTime").gte(dto.getPage().getStartTime()).lte(dto.getPage().getEndTime());
}
});
Page<PointValue> page = query(criteria, pointValueDto.getPage());
return page;
}
/**
* 分页&排序&查询
*
* @param criteriaDefinition
* @param pages
* @return
*/
private Page<PointValue> query(CriteriaDefinition criteriaDefinition, Pages pages) {
Query query = queryBySort(criteriaDefinition);
long count = mongoTemplate.count(query, PointValue.class);
List<PointValue> pointValues = mongoTemplate.find(queryByPage(query, pages), PointValue.class);
Page<PointValue> page = (new Page<PointValue>()).setCurrent(pages.getCurrent()).setSize(pages.getSize()).setTotal(count);
page.setRecords(pointValues);
return page;
}
/**
* 排序
*
* @param criteriaDefinition
* @return
*/
private Query queryBySort(CriteriaDefinition criteriaDefinition) {
Query query = new Query(criteriaDefinition);
query.with(Sort.by(Sort.Direction.DESC, "originTime"));
return query;
}
/**
* 分页
*
* @param query
* @param pages
* @return
*/
private Query queryByPage(Query query, Pages pages) {
int size = (int) pages.getSize();
long page = pages.getCurrent();
query.limit(size).skip(size * (page - 1));
return query;
}
}
| [
"pnokers@icloud.com"
] | pnokers@icloud.com |
986b64d98e501275cc4d1cec3c8984d5df6afd45 | 51fb23a75d45965685735961809165f60f32c7f6 | /code-generator-maven-plugin/src/main/java/com/wolfjc/code/generator/template/convert/Convert.java | c91023494f0917952a01e7c1636dfa61ad504452 | [] | no_license | WolfJC/code | 612b3908d1167d6890c6336e09976a76ec4ab292 | 57f5d47985a45a949bbb75b53bbbad16394165f3 | refs/heads/master | 2020-03-22T17:47:18.070538 | 2018-08-28T06:39:10 | 2018-08-28T06:39:10 | 140,415,769 | 0 | 1 | null | 2018-08-28T06:39:11 | 2018-07-10T10:27:25 | Java | UTF-8 | Java | false | false | 216 | java | package com.wolfjc.code.generator.template.convert;
/**
*
*
* @author xdd
* @date 2018/7/13.
*/
public interface Convert {
/**
*
*
* @return
*/
String convert(String columnName);
}
| [
"448280435@qq.com"
] | 448280435@qq.com |
2f13f7407960fe7429bf0e0f3e6d468017a08538 | c176a6013af49e8f5632d4b4e14b9080cea7aae4 | /perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/comparators/GeneralComparator.java | 8e715efe94cfea8dbb49874581f932f04184b188 | [
"Apache-2.0"
] | permissive | katarinaHrab/perun | 16306682b176d8c1d7d9630a56256359d0ca1f7e | 6e4b16063835b79776333dc20f3c481bf29cb4da | refs/heads/master | 2020-12-26T11:14:51.305569 | 2014-01-16T14:14:44 | 2014-01-16T14:14:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,045 | java | package cz.metacentrum.perun.webgui.json.comparators;
import com.google.gwt.core.client.JavaScriptObject;
import cz.metacentrum.perun.webgui.model.GeneralObject;
import java.util.Comparator;
/**
* Comparator for any Perun object - it makes a GeneralObject from them.
*
* @author Vaclav Mach <374430@mail.muni.cz>
* @version $Id$
*/
public class GeneralComparator<T extends JavaScriptObject> implements Comparator<T>{
static public enum Column {
ID, NAME, STATUS, DESCRIPTION;
}
private Column attr;
/**
* Creates a new Comparator with specified attribute to sort by
* @param attr
*/
public GeneralComparator(Column attr){
this.attr = attr;
}
/**
* Compares the two objects
*
* @param obj1 First object
* @param obj2 Second object
*/
public int compare(T obj1, T obj2) {
GeneralObject o1 = obj1.cast();
GeneralObject o2 = obj2.cast();
switch(this.attr)
{
case ID:
return this.compareById(o1, o2);
case NAME:
return this.compareByName(o1, o2);
case DESCRIPTION:
return this.compareByDescription(o1, o2);
case STATUS:
return this.compareByStatus(o1, o2);
}
return 0;
}
/**
* Compares GeneralObjects by ID.
* @param o1
* @param o2
* @return
*/
private int compareById(GeneralObject o1, GeneralObject o2)
{
return o1.getId() - o2.getId();
}
/**
* Compares GeneralObjects by the name
* @param o1
* @param o2
* @return
*/
private int compareByName(GeneralObject o1, GeneralObject o2)
{
return o1.getName().compareToIgnoreCase(o2.getName());
}
/**
* Compares GeneralObjects by the description
* @param o1
* @param o2
* @return
*/
private int compareByDescription(GeneralObject o1, GeneralObject o2)
{
return o1.getDescription().compareToIgnoreCase(o2.getDescription());
}
/**
* Compares GeneralObjects by the status
* @param o1
* @param o2
* @return
*/
private int compareByStatus(GeneralObject o1, GeneralObject o2)
{
return o1.getStatus().compareToIgnoreCase(o2.getStatus());
}
}
| [
"256627@mail.muni.cz"
] | 256627@mail.muni.cz |
bece3a7cf3df6f7f5e590304b21cb920bdfc0c21 | 4086f0ac0cc2f3dd2ecf06b1a5b5f7f71b36594b | /app/src/main/java/example/meter/sound/soundmeter/World.java | 4afde03fec335f9f85b2cc68fbfae1437f6bbdb6 | [] | no_license | GeorgyYakunin/SoundMater | a9eb915feb555dbf7cd2d8bb03670e6224bb87a3 | af2c2565382621dadeddf26cfa430df62f8e801b | refs/heads/master | 2021-01-07T02:52:06.758941 | 2020-02-19T07:21:59 | 2020-02-19T07:21:59 | 241,558,000 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,517 | java | package example.meter.sound.soundmeter;
public class World {
public static float avgDB = 0.0f;
public static float avgDB1 = 20.0f;
public static int calibration = 0;
public static float dbCount = 40.0f;
public static float lastDbCount = dbCount;
public static float maxDB = 0.0f;
public static float minDB = 200.0f;
public static float noOfRecordings;
public static double sumDB;
public static double sumDB1;
private static float min = 0.5f;
private static float value = 0.0f;
public static void setDbCount(float f) {
float f2 = lastDbCount;
if (f > f2) {
f -= f2;
f2 = min;
if (f <= f2) {
f = f2;
}
value = f;
} else {
f -= f2;
f2 = -min;
if (f >= f2) {
f = f2;
}
value = f;
}
dbCount = lastDbCount + (value * 0.2f);
f = dbCount;
lastDbCount = f;
noOfRecordings += 1.0f;
double d = 0.0d;
sumDB += f < 0.0f ? 0.0d : (double) f;
double d2 = sumDB1;
if (f >= 20.0f) {
d = (double) f;
}
sumDB1 = d2 + d;
f = (float) sumDB;
f2 = noOfRecordings;
avgDB = f / f2;
avgDB1 = ((float) sumDB1) / f2;
f = dbCount;
if (f < minDB) {
minDB = f;
}
f = dbCount;
if (f > maxDB) {
maxDB = f;
}
}
}
| [
"jrayg95@gmail.com"
] | jrayg95@gmail.com |
1ad59aa0aa785474a1e65b283f664aad0e959742 | f5f9321aef91ac987ca9e21cbf3fb18905c650c7 | /JKIKMS/src/test/java/com/jkikms/JkikmsApplicationTests.java | fc007846d78ce55fb497cb148bf5690f051d2273 | [] | no_license | hjpark2020/JKIKMS | 7358a2998bf9661f19e55e4ec7e5dcbbbbd7633c | 14dede040095c1d6be2fb6eade5ba9d7f7d2ad10 | refs/heads/master | 2022-06-26T20:46:32.769747 | 2020-06-29T07:27:39 | 2020-06-29T07:27:39 | 233,340,645 | 0 | 0 | null | 2022-06-21T03:25:10 | 2020-01-12T04:59:28 | Java | UTF-8 | Java | false | false | 202 | java | package com.jkikms;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class JkikmsApplicationTests {
@Test
void contextLoads() {
}
}
| [
"HoJun@DESKTOP-1SKH8PM"
] | HoJun@DESKTOP-1SKH8PM |
7266a6ab3c868ecc5a4b5c5032bc7b46cac6ec1f | ea2291b79a8d4bb09e585f6ada68395bc0d1d1bd | /src/main/java/duke/parser/Parser.java | 7d5f93957139180bd5bc8e3961343419af4868ef | [
"Apache-2.0"
] | permissive | duynguyen24501/Duke-Task-Tracker | f540bb86b7e011a98bb215d66c37652b50c5f68e | 092bd85fe07254d66a8e8e82c541a0245f88bc59 | refs/heads/master | 2023-01-21T16:13:16.068857 | 2020-12-02T11:05:25 | 2020-12-02T11:05:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,347 | java | package duke.parser;
import java.io.FileNotFoundException;
import duke.Ui;
import duke.storage.Storage;
import duke.tasks.TaskList;
/**
* Parser deals with users' commands, differentiates each type of task.
*/
public class Parser {
/**
* Command enum lists out all the types of commands.
*/
public enum Command {
BYE("bye"), LIST("list"), DONE("done"), TODO("todo"), DEADLINE("deadline"),
EVENT("event"), DELETE("delete"), FILTER("filter"), FIND("find");
private String value;
Command(String value) {
this.value = value;
}
}
/**
* Executes user's commands.
*
* @param tasks list of current tasks.
* @param ui UI for client.
* @param storage save and display data from database.
* @param userInput user's command.
* @return boolean terminate when it returns true.
* @throws FileNotFoundException If the file path cannot be found.
*/
public static boolean execute(TaskList tasks, Ui ui, Storage storage, String userInput)
throws FileNotFoundException {
if (userInput.equals(Command.BYE.value)) {
System.out.println(ui.sayGoodbye());
return true;
} else if (userInput.equals(Command.LIST.value)) {
System.out.println(tasks.showTasksAsString());
} else if (userInput.startsWith(Command.DONE.value)) {
try {
int taskPosition = Integer.parseInt(userInput.substring(5));
System.out.println(tasks.setDoneAsString(taskPosition));
} catch (StringIndexOutOfBoundsException e) {
System.out.println(ui.showInvalidFormatCommandDescription());
} catch (NumberFormatException e) {
System.out.println(ui.showInvalidFormatCommandDescription());
}
} else if (userInput.startsWith(Command.TODO.value)) {
try {
String description = userInput.trim().substring(5);
System.out.println(tasks.addToDoAsString(description));
storage.saveTasks(tasks.getTasksList());
} catch (StringIndexOutOfBoundsException e) {
System.out.println(ui.showInvalidFormatCommandDescription());
}
} else if (userInput.startsWith(Command.DEADLINE.value)) {
try {
int spacePosition = userInput.indexOf(" ");
int keywordPosition = userInput.indexOf("/by");
String description = userInput.substring(spacePosition + 1, keywordPosition - 1);
String by = userInput.substring(keywordPosition + 4);
System.out.println(tasks.addDeadlineAsString(description, by));
storage.saveTasks(tasks.getTasksList());
} catch (StringIndexOutOfBoundsException e) {
System.out.println(ui.showInvalidFormatCommandDescription());
}
} else if (userInput.startsWith(Command.EVENT.value)) {
try {
int spacePosition = userInput.indexOf(" ");
int keywordPosition = userInput.indexOf("/at");
String description = userInput.substring(spacePosition + 1, keywordPosition - 1);
String at = userInput.substring(keywordPosition + 4);
System.out.println(tasks.addEventAsString(description, at));
storage.saveTasks(tasks.getTasksList());
} catch (StringIndexOutOfBoundsException e) {
System.out.println(ui.showInvalidFormatCommandDescription());
}
} else if (userInput.startsWith(Command.DELETE.value)) {
try {
int taskPosition = Integer.parseInt(userInput.substring(7));
System.out.println(tasks.deleteTaskAsString(taskPosition));
storage.saveTasks(tasks.getTasksList());
} catch (StringIndexOutOfBoundsException e) {
System.out.println(ui.showInvalidFormatCommandDescription());
}
} else if (userInput.startsWith(Command.FILTER.value)) {
String[] inputArray = userInput.split(" ");
System.out.println(tasks.filterTask(inputArray));
} else if (userInput.startsWith(Command.FIND.value)) {
try {
String keyword = userInput.substring(6);
System.out.println(tasks.findTasks(keyword.trim()));
} catch (StringIndexOutOfBoundsException e) {
System.out.println(ui.showInvalidFormatCommandDescription());
}
} else {
System.out.println(ui.showMeaninglessCommandDescription());
}
return false;
}
/**
* Displays reply to users' commands
*
* @param tasks list of current tasks
* @param ui UI for client.
* @param storage save and display data from database.
* @param userInput user's command.
* @return boolean terminate when it returns true.
* @throws FileNotFoundException If the file path cannot be found.
*/
public static String getUiReply(TaskList tasks, Ui ui, Storage storage, String userInput)
throws FileNotFoundException {
if (userInput.equals(Command.BYE.value)) {
return ui.sayGoodbye();
} else if (userInput.equals(Command.LIST.value)) {
return tasks.showTasksAsString();
} else if (userInput.startsWith(Command.DONE.value)) {
try {
int taskPosition = Integer.parseInt(userInput.substring(5));
String response = tasks.setDoneAsString(taskPosition);
assert response.length() > 0 : "Response should not be empty";
storage.saveTasks(tasks.getTasksList());
return response;
} catch (StringIndexOutOfBoundsException e) {
return ui.showInvalidFormatCommandDescription();
} catch (NumberFormatException e) {
return ui.showInvalidFormatCommandDescription();
}
} else if (userInput.startsWith(Command.TODO.value)) {
try {
String description = userInput.trim().substring(5);
String response = tasks.addToDoAsString(description);
storage.saveTasks(tasks.getTasksList());
assert response.length() > 0 : "Response should not be empty";
return response;
} catch (StringIndexOutOfBoundsException e) {
return ui.showInvalidFormatCommandDescription();
}
} else if (userInput.startsWith(Command.DEADLINE.value)) {
try {
int spacePosition = userInput.indexOf(" ");
int keywordPosition = userInput.indexOf("/by");
String description = userInput.substring(spacePosition + 1, keywordPosition - 1);
String by = userInput.substring(keywordPosition + 4);
String response = tasks.addDeadlineAsString(description, by);
storage.saveTasks(tasks.getTasksList());
assert response.length() > 0 : "Response should not be empty";
return response;
} catch (StringIndexOutOfBoundsException e) {
return ui.showInvalidFormatCommandDescription();
}
} else if (userInput.startsWith(Command.EVENT.value)) {
try {
int spacePosition = userInput.indexOf(" ");
int keywordPosition = userInput.indexOf("/at");
String description = userInput.substring(spacePosition + 1, keywordPosition - 1);
String at = userInput.substring(keywordPosition + 4);
String response = tasks.addEventAsString(description, at);
storage.saveTasks(tasks.getTasksList());
assert response.length() > 0 : "Response should not be empty";
return response;
} catch (StringIndexOutOfBoundsException e) {
return ui.showInvalidFormatCommandDescription();
}
} else if (userInput.startsWith(Command.DELETE.value)) {
try {
int taskPosition = Integer.parseInt(userInput.substring(7));
String response = tasks.deleteTaskAsString(taskPosition);
storage.saveTasks(tasks.getTasksList());
assert response.length() > 0 : "Response should not be empty";
return response;
} catch (StringIndexOutOfBoundsException e) {
return ui.showInvalidFormatCommandDescription();
}
} else if (userInput.startsWith(Command.FIND.value)) {
try {
String keyword = userInput.substring(6);
String response = tasks.findTasks(keyword.trim());
assert response.length() > 0 : "Response should not be empty";
return response;
} catch (StringIndexOutOfBoundsException e) {
return ui.showInvalidFormatCommandDescription();
}
} else if (userInput.startsWith(Command.FILTER.value)) {
String[] inputArray = userInput.split(" ");
return tasks.filterTask(inputArray);
}
return ui.showMeaninglessCommandDescription();
}
}
| [
"duynguyen24501@gmail.com"
] | duynguyen24501@gmail.com |
331ba0abaaeb8619fdcf1013eea8cf36155e86cb | 83991afbeeee0960075bca1ff0a94f354e3b8623 | /WEB_APP/OrderApp/src - Copy/main/java/com/sv/orderapp/user_control_panel/UserRepositoryImpl.java | 72b758a4e06266048ada8ed301a582d7db1d914f | [] | no_license | supervisiontec/order-app | 29655d19ee1083f0228a21ebfd60cae90dc98022 | 939088d3a6f76934fddd9896cf7087c8d631ab36 | refs/heads/master | 2021-06-30T18:27:56.942875 | 2017-09-18T05:44:48 | 2017-09-18T05:44:48 | 103,895,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,712 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sv.orderapp.user_control_panel;
import com.sv.orderapp.user_control_panel.model.MUser;
import java.io.Serializable;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
/**
*
* @author Mohan
*/
@Repository
public class UserRepositoryImpl implements UserRepository {
@Autowired
private SessionFactory sessionFactory;
@Override
public List<MUser> listUsers() {
Session session = sessionFactory.getCurrentSession();
return session.createCriteria(MUser.class).list();
}
@Override
public List listObjects(Class cls) {
Session session = sessionFactory.getCurrentSession();
return session.createCriteria(cls).list();
}
@Override
public Object getObject(Class cls, Serializable id) {
Session session = sessionFactory.getCurrentSession();
return session.get(cls, id);
}
@Override
public Serializable newObject(Object object) {
Session session = sessionFactory.getCurrentSession();
return session.save(object);
}
@Override
public void updateObject(Object object) {
Session session = sessionFactory.getCurrentSession();
session.update(object);
}
@Override
public void deleteObject(Object object) {
Session session = sessionFactory.getCurrentSession();
session.delete(object);
}
}
| [
"supervision.tec@gmail.com"
] | supervision.tec@gmail.com |
3d1085176751008a55c119552290955f5a2d1c55 | b9b5c6d60fdd46beefcaffa062758ab28d627c4f | /app/src/test/java/com/loopeer/codereader/ExampleUnitTest.java | 9d5e8ab8bbf1ea7c87edc17e2f8a6845584c166e | [
"Apache-2.0"
] | permissive | cwkcyd/code-reader | 01f1c27c4171c299a51a251a139b2cb2496fd125 | 8628100325229191bba678c76a0a953dc28f6e9b | refs/heads/master | 2021-01-20T23:09:18.796046 | 2017-08-29T02:54:31 | 2017-08-29T02:54:31 | 101,841,188 | 1 | 0 | null | 2017-08-30T05:26:03 | 2017-08-30T05:26:02 | null | UTF-8 | Java | false | false | 315 | java | package com.loopeer.codereader;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"yytodou123@gmail.com"
] | yytodou123@gmail.com |
91de44616c8cbdc468bd9d591486eb76840f8613 | 55bff93bd7984bc8926b0907dd35bd6c6c36c2ce | /Test/src/test/PrimeNumber.java | 4ce6a981969d5b666b2b8971934927b77c64719b | [] | no_license | nikhilbejagam/Test | 57ce0eb296a410e55ebd803c6e85a786ede3f213 | 60407da5f6e0199e047e6bdc911ba52e6673d70c | refs/heads/master | 2020-09-25T03:56:40.223276 | 2019-12-05T15:53:33 | 2019-12-05T15:53:33 | 225,912,357 | 0 | 0 | null | 2019-12-05T15:53:34 | 2019-12-04T16:39:50 | Java | UTF-8 | Java | false | false | 487 | java | package test;
import java.util.Scanner;
public class PrimeNumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
@SuppressWarnings("resource")
Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
boolean flag = true;
for (int i = 2; i<= num/2 ; i++){
if(num%i==0){
flag = false;
}
}
if(flag)
System.out.println("Prime number");
else
System.out.println("Not Prime number");
}
}
| [
"Boss@192.168.0.5"
] | Boss@192.168.0.5 |
e506afad92d3d2dc4095018e1102ab0d3824a270 | 1ba7889b181b20f3d205114f26510233aa6e2d4d | /src/test/java/com/learning/sample/testscripts/Sample_TC_S_01_Story_134_SignIn_Pass.java | 09b0c6c28be4698c4defa7b84a11671a2588545a | [] | no_license | saurabhdevle/Final_Framework_Selenium_TestNG | b87f88d73a77514265bedb9da96bb6e808fadc33 | 2e56274cd283fb10a056d99eb733866a49633491 | refs/heads/master | 2023-08-29T03:52:28.357774 | 2021-10-28T02:30:19 | 2021-10-28T02:30:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,632 | java | package com.learning.sample.testscripts;
import org.testng.annotations.Test;
import com.learning.data.Constants;
import com.learning.data.Constants_Element_Text;
import com.learning.data.Constants_Expected_Text;
import com.learning.pages.HomePage;
import com.learning.pages.MyAccountPage;
import com.learning.pages.SignInPage;
import com.learning.utilities.Custom_Utilties;
public class Sample_TC_S_01_Story_134_SignIn_Pass extends Custom_Utilties {
@Test
public void S_01_Story_134_SignIn() {
// navigateToURL("http://automationpractice.com/");
String email = properties.getProperty(Constants.Properties_Email);
String password = properties.getProperty(Constants.Properties_Password);
//String expected_Text_SignOut = properties.getProperty(Constants.Properties_Password);
HomePage homePage = new HomePage(getDriver());
clickOnElement(homePage.get_Header_Sign_In());
SignInPage signInPage = new SignInPage(getDriver());
fillTextField(signInPage.get_textBox_EMail(), Constants_Element_Text.Email, email);
fillTextField(signInPage.get_textBox_Password(), Constants_Element_Text.Password, password);
clickOnElement(signInPage.get_button_Sign_In());
//captureScreenshot("TC_S_01_Story_134_SignIn");
MyAccountPage myAccountPage = new MyAccountPage(getDriver());
webElementPresent(myAccountPage.get_Header_Sign_Out());
// webElementPresent(homePage.get_Header_Sign_In());
verifyElementText(myAccountPage.get_Header_Sign_Out(), Constants_Expected_Text.SignOut);
holdScript(4);
System.out.println("This is the last line of Test case");
log.info("This is the last line of Test case");
}
} | [
"rajatvermaa95@gmail.com"
] | rajatvermaa95@gmail.com |
f897e8db191ceb43cd660405557e8a7af7fd0d1e | 54ce0d4c5cd19bdafe7aaebf982060b3fc7f004b | /src/main/java/blog/model/SymbolTerm.java | b4fbd84646b5aa7c95d814c8b4763be4411f7ecf | [] | no_license | AliOC/blog | 7a4e99afb26a4940aefd9d71cb8691ad3ccfe00d | 5fcf674ce4ae940343ee30759e8c8cb73e0949c4 | refs/heads/master | 2020-12-25T09:08:04.652162 | 2014-07-13T06:54:15 | 2014-07-13T06:54:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,428 | java | /*
* Copyright (c) 2006, Regents of the University of California
* 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.
*
* * Neither the name of the University of California, Berkeley nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* 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 OWNER 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 blog.model;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import blog.bn.BayesNetVar;
import blog.bn.DerivedVar;
import blog.bn.RandFuncAppVar;
import blog.common.Util;
import blog.sample.EvalContext;
/**
* A term consisting of a single symbol. This may be either a zero-ary function
* application or a use of a logical variable. SymbolTerms occur in the abstract
* syntax tree for a model only before checkTypesAndScope is called on the
* expressions in the model. After that point, a SymbolTerm is replaced with a
* LogicalVar if its symbol is the name of a logical variable in the current
* scope; otherwise it's replaced with a zero-argument FuncAppTerm.
*
* <p>
* If you're creating a term or formula programmatically, you should not use
* SymbolTerm; you should use either LogicalVar or FuncAppTerm.
*/
public class SymbolTerm extends Term {
/**
* Creates a new SymbolTerm with the given symbol. The
* <code>checkTypesAndScope</code> method will determine if this is a zero-ary
* function or a logical variable.
*/
public SymbolTerm(String symbol) {
name = symbol;
}
/**
* Returns true if this SymbolTerm is an occurrence of a logical variable.
*/
public boolean isLogicalVar() {
checkCompiled();
return (var != null);
}
/**
* Returns the logical variable used in this SymbolTerm, or null if this is a
* zero-ary function application.
*/
public LogicalVar getLogicalVar() {
checkCompiled();
return var;
}
/**
* Returns the zero-ary function used in this SymbolTerm, or null if this is
* an occurrence of a logical variable.
*/
public Function getFunc() {
checkCompiled();
return func;
}
public boolean checkTypesAndScope(Model model, Map scope) {
if ((var == null) && (func == null)) {
var = (LogicalVar) scope.get(name);
if (var == null) {
func = model.getFunction(new FunctionSignature(name));
if (func == null) {
System.err.println(getLocation() + ": Symbol \"" + name
+ "\" is neither a variable in the current scope "
+ "nor a zero-ary function.");
return false;
}
}
} else if (var != null) {
if (var != scope.get(name)) {
System.err.println(getLocation() + ": LogicalVar " + var
+ " is not in scope.");
return false;
}
}
return true;
}
public Term getTermInScope(Model model, Map scope) {
Term result = null;
if (checkTypesAndScope(model, scope)) {
if (func != null) {
result = new FuncAppTerm(func);
} else {
result = var;
}
result.setLocation(getLocation());
}
return result;
}
public int compile(LinkedHashSet callStack) {
if (func != null) {
callStack.add(this);
int errors = func.compile(callStack);
callStack.remove(this);
return errors;
}
return 0; // no compilation necessary for logical variables
}
public Type getType() {
checkCompiled();
return ((var != null) ? var.getType() : func.getRetType());
}
public Object evaluate(EvalContext context) {
if (var != null) {
return context.getLogicalVarValue(var);
}
return func.getValueInContext(NO_ARGS, context, true);
}
/**
* Returns the random variable that this term corresponds to. If this
* SymbolTerm is a random function, then the variable returned is a BasicVar.
* Otherwise, it's a DerivedVar.
*/
public BayesNetVar getVariable() {
if (func instanceof RandomFunction) {
return new RandFuncAppVar((RandomFunction) func, NO_ARGS, true);
}
return new DerivedVar(this);
}
public boolean containsRandomSymbol() {
checkCompiled();
return isLogicalVar() || (func instanceof RandomFunction);
}
public Set getFreeVars() {
checkCompiled();
return ((var != null) ? Collections.singleton(var) : Collections.EMPTY_SET);
}
public ArgSpec getSubstResult(Substitution subst, Set<LogicalVar> boundVars) {
throw new UnsupportedOperationException(
"Can't apply substitution to SymbolTerm. Make sure "
+ "checkTypesAndScope is called to eliminate SymbolTerms "
+ "before a substitutions is applied.");
}
public boolean isConstantNull() {
checkCompiled();
return (func == BuiltInFunctions.NULL);
}
public boolean makeOverlapSubst(Term t, Substitution theta) {
// this shouldn't ever get called...
return false;
}
public Term getCanonicalVersion() {
throw new UnsupportedOperationException(
"Can't get canonical version of SymbolTerm. Make sure "
+ "checkTypesAndScope is called to eliminate SymbolTerms "
+ "before getCanonicalVersion is called.");
}
public boolean equals(Object o) {
checkCompiled();
if (o instanceof SymbolTerm) {
SymbolTerm other = (SymbolTerm) o;
if (var != null) {
return (var == other.getLogicalVar());
} else if (func != null) {
return (func.equals(other.getFunc()));
} else {
return (name.equals(other.getName()));
}
}
return false;
}
public int hashCode() {
checkCompiled();
//return ((var != null) ? var.hashCode() : func.hashCode());
return name.hashCode();
}
public String toString() {
return name;
}
public String getName() {
return name;
}
private void checkCompiled() {
/*
* Taking this out to handle terms like F(t), where t is time
* if ((func == null) && (var == null)) {
* throw new IllegalStateException("SymbolTerm \"" + this
* + "\" has not been succesfully " + "compiled.");
* }
*/
return;
}
public ArgSpec replace(Term t, ArgSpec another) {
Util.fatalError("replace not supported for SymbolTerm.");
return null;
}
private String name;
private Function func;
private LogicalVar var;
private static Object[] NO_ARGS = new Object[0];
}
| [
"lileicc@gmail.com"
] | lileicc@gmail.com |
8373cd1ecaf7a86a71ea86deb7b38e5539b0b558 | 6e4978da76071211117a8ecbde208553c26a1087 | /Portal/xmlprotocol/src/classes.jar/src/atg/portal/gear/xmlprotocol/XmlConversationAdaptor.java | 1b98e89d5c54af5554d5a23d9fce09ad22aab103 | [] | no_license | vkscorpio3/ATG_TASK | 3b41df29898447bb4409bf46bc735045ce7d8cc6 | 8751d555c35a968d4d73c9e22d7f56a6c82192e7 | refs/heads/master | 2020-03-08T16:56:40.463816 | 2014-12-12T10:55:01 | 2014-12-12T10:55:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,372 | java | /*<ATGCOPYRIGHT>
* Copyright (C) 2001-2011 Art Technology Group, Inc.
* All Rights Reserved. No use, copying or distribution of this
* work may be made except in accordance with a valid license
* agreement from Art Technology Group. This notice must be
* included on all copies, modifications and derivatives of this
* work.
*
* Art Technology Group (ATG) MAKES NO REPRESENTATIONS OR WARRANTIES
* ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. ATG SHALL NOT BE
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*
* Dynamo is a trademark of Art Technology Group, Inc.
</ATGCOPYRIGHT>*/
package atg.portal.gear.xmlprotocol;
import java.net.*;
import java.io.*;
import java.util.Hashtable;
import java.util.ArrayList;
import java.util.Enumeration;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import atg.xml.tools.XMLToolsFactory;
import atg.xml.XMLFileEntityResolver;
import atg.xml.tools.XMLToDOMParser;
import atg.nucleus.GenericContext;
import atg.nucleus.ServiceListener;
import atg.nucleus.ServiceEvent;
import java.net.URLConnection;
import atg.portal.gear.xmlprotocol.cache.*;
/**
* An abstract class to implement low-level services for retrieval of XML documents over HTTP
* This class performs HTTP communications and handles content caching using an LRU
* mechanism.
*
* These low-level services should be handled at the adaptor level since it should
* choose the optimal communications method for a particular provider.
*
* XmlConversationAdaptor should be subclassed to add protocol features including
* document parsing and semantics handling for the particular provider. It should also
* override the shouldCache() method to determine when to cache particular content.
* For example, received error messages should not be cached.
*
* @author J Marino
* @version $Id: //app/portal/version/10.0.3/xmlprotocol/classes.jar/src/atg/portal/gear/xmlprotocol/XmlConversationAdaptor.java#2 $$Change: 651448 $
* @updated $DateTime: 2011/06/07 13:55:45 $$Author: rbarbier $
*/
public abstract class XmlConversationAdaptor extends ConversationAdaptorBase {
//-------------------------------------
/** Class version string */
public static String CLASS_VERSION = "$Id: //app/portal/version/10.0.3/xmlprotocol/classes.jar/src/atg/portal/gear/xmlprotocol/XmlConversationAdaptor.java#2 $$Change: 651448 $";
public static String ADAPTOR_DESCRIPTION = "XmlConversation Adaptor";
public static String ADAPTOR_VERSION = "1.0";
public final static long NO_CACHE = -1;
public final static long CACHE_FOREVER = 0;
/**
* The JNDI location of the bootstrap adaptor config class set as a global bean in Nucleus
* We assume the name will be the adaptor class name with "Config" apended or, if not found,
* a default configuration file
**/
protected String ADAPTOR_CONFIG = "dynamo:/" + (this.getClass().getName()).replace('.','/') +"Config";
protected String ADAPTOR_DEFAULT_CONFIG = "dynamo:/atg/portal/gear/xmlprotocol/DefaultAdaptorConfig";
protected AdaptorConfig mAdaptorConfig = null;
protected CacheConfig mCacheConfig = null;
/**
* This is a placeholder for how long to cache content of a given request.
* We set this here so we do not have to parse a response document to find its
* type since we know what it is based on the request.
*/
protected long mRequestCacheExpiration = -1;
//The page context from the web application
protected PageContext mPageContext;
//JNDI location of XML processor in Nucleus we will be using for this adaptor
protected XMLToolsFactory mXMLToolsFactory;
protected XMLToDOMParser mXMLParser;
//The LRU cache for contents
protected LRUCache mTheCache;
//Number of times to retry a request in the event of an error
protected int mNumRetries;
public long mCacheArticles;
public void setCacheArticles(long pCacheTime){
mCacheArticles = pCacheTime;
}
public long getCacheArticles(){
return mCacheArticles;
}
public long mCacheCategories;
public void setCacheCategories(long pCacheTime){
mCacheCategories = pCacheTime;
}
public long getCacheCategories(){
return mCacheCategories;
}
public long mCacheHeadlines;
public void setCacheHeadlines(long pCacheTime){
mCacheHeadlines = pCacheTime;
}
public long getCacheHeadlines(){
return mCacheHeadlines;
}
/**
* Empty constructor to support dynamic class loading by the gear.
*/
public XmlConversationAdaptor() {}
/**
* Initializes the class including the HTTP connection pool and response cahce, if ncessary.
* This method must be called after constructing the object.
*
* @exception Exception if there is a problem initializing
*/
public void init(PageContext pPageContext) throws Exception{
// we need to store the web application page conxtex to we have access to
// session information
mPageContext = pPageContext;
String nucleusLocation;
javax.naming.Context ctx = new javax.naming.InitialContext();
//get the configuration object
mAdaptorConfig = (AdaptorConfig) ctx.lookup(ADAPTOR_CONFIG);
if (mAdaptorConfig == null){
if (this.isLoggingDebug()){
this.logDebug("XmlProtocol Gear: Adaptor configuration not found in Nucleus for " +
ADAPTOR_CONFIG +" \nUsing default configuration instead.");
}
mAdaptorConfig = (AdaptorConfig) ctx.lookup(ADAPTOR_DEFAULT_CONFIG);
if (mAdaptorConfig == null){
throw new ConversationException("Adaptor configruation not found in Nucleus: " + ADAPTOR_DEFAULT_CONFIG);
}
}
nucleusLocation = mAdaptorConfig.getXMLToolsContext();
if (nucleusLocation == null){
throw new ConversationException("No nucleus location specified for XMLTools");
}
mXMLToolsFactory = (XMLToolsFactory) ctx.lookup(nucleusLocation);
if (mXMLToolsFactory == null){
throw new ConversationException("XML parser factory not found in Nucleus: " + mAdaptorConfig.getXMLToolsContext());
}
mXMLParser = mXMLToolsFactory.createXMLToDOMParser();
//Bind to the response cache context for the gear in Nucleus
nucleusLocation = mAdaptorConfig.getCacheConfig();
if (nucleusLocation == null){
throw new ConversationException("No nucleus location specified for cache configuration");
}
mCacheConfig = (CacheConfig) ctx.lookup(nucleusLocation);
if (mCacheConfig == null){
throw new ConversationException("Could not find cache configuration in adaptor configuration object");
}
nucleusLocation = mCacheConfig.getCacheContext();
if (nucleusLocation == null){
throw new ConversationException("No nucleus location specified for cache context");
}
GenericContext cacheContext = (GenericContext) ctx.lookup(nucleusLocation);
if (cacheContext == null){
throw new ConversationException("Could not find cache context in adaptor configuration object");
}
//See if the cache has already been created. If not, create, configure, and start it
//Get the name of our cache for setting it up in Nucleus
String cacheName = mCacheConfig.getCacheName();
if (cacheName == null){
throw new ConversationException("Nucleus cache name not found in adaptor configuration object");
}
mTheCache = (LRUCache) cacheContext.getElement(cacheName);
if(mTheCache == null){ //There was no cache so set one up
//The cache will store its contents as byte[] so we point it to the class responsible for storing
//byte[] in the cache
mTheCache = new LRUCache("atg.portal.gear.xmlprotocol.cache.CacheByteArrayElement", mCacheConfig.getMaxCacheSize());
//put the cache in the Nucleus context
cacheContext.putElement(cacheName, mTheCache);
ServiceEvent theEvent = new ServiceEvent(cacheContext, mTheCache, cacheContext.getNucleus(), null);
((ServiceListener) mTheCache).startService (theEvent);
}
mNumRetries = mAdaptorConfig.getNumRetries();
if (mNumRetries < 1){
mNumRetries = 3;
if (this.isLoggingDebug()){
this.logDebug("XmlProtocol Gear: number of retries not properly specified in adaptor configuration setting. Resorting to default: " + mNumRetries);
}
}
if (this.isLoggingDebug()){
this.logDebug("XmlProtocol Gear: finished XmlConversationAdaptor init()");
}
}
/**
* Connects to a URL using HTTP and retrieves an XML Document without caching
*
* @param pUrl the URL to connect to
*
* @exception ConversationException if there was a problem communicating with
* the service provider
*
*/
protected Document connect(String pUrl)throws ConversationException{
return this.connect(pUrl,null);
}
/**
* Connects to a URL using HTTP and retrieves an XML Document.
* The subclass determines when caching is appropriate and what key to use.
*
* @param pUrl the URL to connect to
* @param pCacheKey the unique cache identifier for the returned contents
*
* @returns Document as a representation of the XML Document
*
* @exception ConversationException if there was a problem communicating with
* the service provider
*/
protected Document connect(String pUrl, String pCacheKey) throws ConversationException{
long startTime;
long totalTime;
int code;
Document theXMLResponse = null;
InputStream theStream = null;
ByteArrayElementContents theContents = null;
ByteArrayInputStream byteInputStream = null;
//We use an optimized HTTP connection since the one in the standard Java library
//is so slow
java.net.URLConnection theConnection=null;
try{
URL u = new URL(pUrl);
//System.out.println("The url is:" + pUrl);
startTime = System.currentTimeMillis();
if (pCacheKey != null){ // search in the cache if we have a key
StringKey cacheKey = new StringKey(pCacheKey);
// try and get the content out of the cache
CacheByteArrayElement byteElement = (CacheByteArrayElement) mTheCache.get(cacheKey);
if (byteElement != null){ // we found the contents in the cache
theContents = byteElement.getContents();
if (theContents != null){ // null should not happen
//parse the contents
theXMLResponse = mXMLParser.parse(theContents.getContentsAsStream(),false,null);
totalTime = System.currentTimeMillis () - startTime;
//System.out.println("XMLConversation: Total elapsed time retrieve from cache and parse contents: " + totalTime);
if (this.isLoggingDebug()){
totalTime = System.currentTimeMillis () - startTime;
this.logDebug("XMLConversation: Total elapsed time retrieve from cache and parse contents: " + totalTime);
//System.out.println("XMLConversation: Total elapsed time retrieve from cache and parse contents: " + totalTime);
}
}
}else{ // not found in cache so go fetch...
theConnection = u.openConnection();
theStream = new BufferedInputStream(theConnection.getInputStream());
byteInputStream = new ByteArrayInputStream(this.readStream(theStream));
//First get a new input stream of the contents since the parser will close it.
ByteArrayElementContents cacheContents = new ByteArrayElementContents(byteInputStream);
// Parse the contents first to avoid caching invalid responses or error messages
// We could have chosen to cache the parsed contents to avoid do this repeatedly but
// the trade-off in memory overhead of storing DOM objects versus the minimal performance
// improvement gained from avoiding re-parsing and stream copies did not seem worth it.
theXMLResponse = mXMLParser.parse(cacheContents.getContentsAsStream(),false,null);
totalTime = System.currentTimeMillis () - startTime;
//System.out.println("XMLConversation: Total elapsed time retrieve and parse contents from the service provider: " + totalTime);
if (this.isLoggingDebug()){
totalTime = System.currentTimeMillis () - startTime;
this.logDebug("XMLConversation: Total elapsed time retrieve and parse contents from the service provider: " + totalTime);
//System.out.println("XMLConversation: Total elapsed time retrieve and parse contents from the service provider: " + totalTime);
}
//now cache the contents if it is appropriate - e.g. do not cache error messages
// returned by the service provider
long expires = this.shouldCache(theXMLResponse);
//System.out.println("XMLConversation: caching contents with key: " + cacheKey + " and expiration: "+ expires);
if (this.isLoggingDebug()){
//System.out.println("XMLConversation: caching contents with key: " + cacheKey + " and expiration: "+ expires);
this.logDebug("XMLConversation: caching contents with key: " + cacheKey + " and expiration: "+ expires);
}
if (expires > 0){
mTheCache.put(cacheKey, cacheContents,System.currentTimeMillis() + expires);
}else if (expires == CACHE_FOREVER){ //we cache indefinitely
mTheCache.put(cacheKey, cacheContents,CACHE_FOREVER);
}
}
}else{ // cacheKey == null, i.e. we are not caching
theConnection = u.openConnection();
theXMLResponse = mXMLParser.parse(theConnection.getInputStream() ,false,null); //theStream,false,null);
totalTime = System.currentTimeMillis () - startTime;
//System.out.println("XMLConversation: Caching disabled: Total elapsed time retrieve and parse contents from the service provider without caching: " + totalTime);
if (this.isLoggingDebug()){
totalTime = System.currentTimeMillis () - startTime;
this.logDebug("XMLConversation: Total elapsed time retrieve and parse contents from the service provider without caching: " + totalTime);
//System.out.println("XMLConversation: Total elapsed time retrieve and parse contents from the service provider without caching: " + totalTime);
}
}
}catch (Exception e){ //we have to catch a generic exception since that is what XMLTools throws...
throw new ConversationException (this.getClass().getName()+ ": Error connecting to external URL: \n", e);
}finally{
if (theStream !=null){
try{
theStream.close();
}catch (IOException e){
}
}
}
return theXMLResponse;
}
/**
* Reads an input stream and returns it as a byte array.
* We use this for properly reading the HTTP response stream.
*
* @returns byte[] representing the contents of the response stream
*/
protected byte[] readStream(InputStream pInputStream) throws IOException{
int size=10000; //starting size of the buffer
int offset=0; // the offset position for reading
int byteRead;
byte [] byteArray = new byte [size];
while (true){
byteRead = pInputStream.read (byteArray, offset, size-offset);
if (byteRead==-1){ // End of stream
break;
}
offset+=byteRead;
if (offset==size){ // resize if we ran out of buffer space
size *= 2;
byte [] tmp = new byte [size];
System.arraycopy (byteArray, 0, tmp, 0, offset);
byteArray = tmp;
}
}
// the buffer is larger than we need so resize it
if (offset != size){
byte [] tmp = new byte [offset];
System.arraycopy (byteArray, 0, tmp, 0, offset);
byteArray = tmp;
}
return byteArray;
}
/**
* This method creates a paramter list for a URL query string - i.e. it returns
* a set of name-value pairs that can be appended to the query
* string of a URL. Values are assumed to be encoded already.
*
* @returns String The parameter list
*
*/
protected String makeUrlParams(ArrayList pParamList){
StringBuffer theUrlList = new StringBuffer();
int pSize = pParamList.size();
for (int i=0; i<pSize; i++){
theUrlList.append("&"+pParamList.get(i));
}
return theUrlList.toString();
}
/**
* This method should be overriden by subclasses in order to determine
* whether to cache a particular response or not. For example, we do
* not want to cache error messages.
*
* @returns long indicating whether the contents should be cached and, if so,
* the duration accoring to the following scheme:
*
* -1 - Contents should not be cached
* 0 - Contents should be cached permanently
* >0 - length of time in milliseconds that the content should be cached from
* current time
*/
protected long shouldCache(Document theResponse){
return NO_CACHE;
}
}
| [
"Andrii_Borovyk1@EPUAKHAW0679.kyiv.epam.com"
] | Andrii_Borovyk1@EPUAKHAW0679.kyiv.epam.com |
57357367f5b6fc86139026fe6948593fe3ec011c | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/test/org/springframework/cloud/netflix/zuul/filters/route/apache/HttpClientRibbonCommandIntegrationTests.java | 2ae3c5ad4a3eaaa5fca787fedf7c7cde6faded63 | [] | 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 | 9,711 | java | /**
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.netflix.zuul.filters.route.apache;
import HttpMethod.DELETE;
import HttpMethod.GET;
import HttpMethod.PATCH;
import HttpMethod.POST;
import HttpStatus.OK;
import com.netflix.client.RetryHandler;
import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.ILoadBalancer;
import com.netflix.loadbalancer.Server;
import com.netflix.loadbalancer.ServerList;
import java.util.Collections;
import java.util.Set;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.cloud.netflix.ribbon.DefaultServerIntrospector;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import org.springframework.cloud.netflix.ribbon.apache.RibbonLoadBalancingHttpClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.cloud.netflix.zuul.filters.route.FallbackProvider;
import org.springframework.cloud.netflix.zuul.filters.route.RibbonCommandFactory;
import org.springframework.cloud.netflix.zuul.filters.route.support.ZuulProxyTestBase;
import org.springframework.cloud.netflix.zuul.test.NoSecurityConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.ResponseEntity;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.WebUtils;
/**
*
*
* @author Spencer Gibb
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = HttpClientRibbonCommandIntegrationTests.TestConfig.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { "zuul.routes.other: /test/**=http://localhost:7777/local", "zuul.routes.another: /another/twolevel/**", "zuul.routes.simple: /simple/**", "zuul.routes.singleton.id: singleton", "zuul.routes.singleton.path: /singleton/**", "zuul.routes.singleton.sensitiveHeaders: " })
@DirtiesContext
public class HttpClientRibbonCommandIntegrationTests extends ZuulProxyTestBase {
@Test
public void patchOnSelfViaRibbonRoutingFilter() {
ResponseEntity<String> result = new TestRestTemplate().exchange((("http://localhost:" + (this.port)) + "/simple/local/1"), PATCH, new org.springframework.http.HttpEntity("TestPatch"), String.class);
assertThat(result.getStatusCode()).isEqualTo(OK);
assertThat(result.getBody()).isEqualTo("Patched 1!");
}
@Test
public void postOnSelfViaRibbonRoutingFilter() {
ResponseEntity<String> result = new TestRestTemplate().exchange((("http://localhost:" + (this.port)) + "/simple/local/1"), POST, new org.springframework.http.HttpEntity("TestPost"), String.class);
assertThat(result.getStatusCode()).isEqualTo(OK);
assertThat(result.getBody()).isEqualTo("Posted 1!");
}
@Test
public void deleteOnSelfViaRibbonRoutingFilter() {
ResponseEntity<String> result = new TestRestTemplate().exchange((("http://localhost:" + (this.port)) + "/simple/local/1"), DELETE, new org.springframework.http.HttpEntity(((Void) (null))), String.class);
assertThat(result.getStatusCode()).isEqualTo(OK);
assertThat(result.getBody()).isEqualTo("Deleted 1!");
}
@Test
public void ribbonLoadBalancingHttpClientCookiePolicy() {
ResponseEntity<String> result = new TestRestTemplate().exchange((("http://localhost:" + (this.port)) + "/simple/downstream_cookie"), POST, new org.springframework.http.HttpEntity(((Void) (null))), String.class);
assertThat(result.getStatusCode()).isEqualTo(OK);
assertThat(result.getBody()).isEqualTo("Cookie 434354454!");
assertThat(result.getHeaders().getFirst(SET_COOKIE)).isNull();
// if new instance of RibbonLoadBalancingHttpClient is getting created every time
// and HttpClient is not reused then there are no concerns for the shared cookie
// storage
// but since https://github.com/spring-cloud/spring-cloud-netflix/issues/1150 is
// on the way a
result = new TestRestTemplate().exchange((("http://localhost:" + (this.port)) + "/singleton/downstream_cookie"), POST, new org.springframework.http.HttpEntity(((Void) (null))), String.class);
assertThat(result.getStatusCode()).isEqualTo(OK);
assertThat(result.getBody()).isEqualTo("Cookie 434354454!");
assertThat(result.getHeaders().getFirst(SET_COOKIE)).isEqualTo("jsessionid=434354454");
result = new TestRestTemplate().exchange((("http://localhost:" + (this.port)) + "/singleton/downstream_cookie"), GET, new org.springframework.http.HttpEntity(((Void) (null))), String.class);
assertThat(result.getStatusCode()).isEqualTo(OK);
assertThat(result.getBody()).isEqualTo("Cookie null!");
}
@Test
public void ribbonCommandFactoryOverridden() {
assertThat(((this.ribbonCommandFactory) instanceof HttpClientRibbonCommandFactory)).as("ribbonCommandFactory not a HttpClientRibbonCommandFactory").isTrue();
}
// Don't use @SpringBootApplication because we don't want to component scan
@Configuration
@EnableAutoConfiguration
@RestController
@EnableZuulProxy
@RibbonClients({ @RibbonClient(name = "simple", configuration = ZuulProxyTestBase.SimpleRibbonClientConfiguration.class), @RibbonClient(name = "another", configuration = ZuulProxyTestBase.AnotherRibbonClientConfiguration.class), @RibbonClient(name = "singleton", configuration = HttpClientRibbonCommandIntegrationTests.SingletonRibbonClientConfiguration.class) })
@Import(NoSecurityConfiguration.class)
static class TestConfig extends ZuulProxyTestBase.AbstractZuulProxyApplication {
@Autowired(required = false)
private Set<FallbackProvider> zuulFallbackProviders = Collections.emptySet();
@RequestMapping(value = "/local/{id}", method = RequestMethod.PATCH)
public String patch(@PathVariable
final String id, @RequestBody
final String body) {
return ("Patched " + id) + "!";
}
@RequestMapping(value = "/downstream_cookie", method = RequestMethod.POST)
public String setDownstreamCookie(HttpServletResponse response) {
response.addCookie(new Cookie("jsessionid", "434354454"));
return "Cookie 434354454!";
}
@RequestMapping(value = "/downstream_cookie", method = RequestMethod.GET)
public String readDownstreamCookie(HttpServletRequest request) {
final Cookie cookie = WebUtils.getCookie(request, "jsessionid");
return ("Cookie " + cookie) + "!";
}
@Bean
public RibbonCommandFactory<?> ribbonCommandFactory(final SpringClientFactory clientFactory) {
return new HttpClientRibbonCommandFactory(clientFactory, new ZuulProperties(), zuulFallbackProviders);
}
@Bean
public ZuulProxyTestBase.MyErrorController myErrorController(ErrorAttributes errorAttributes) {
return new ZuulProxyTestBase.MyErrorController(errorAttributes);
}
}
// Load balancer with fixed server list and defined ribbon rest client
@Configuration
public static class SingletonRibbonClientConfiguration {
@Value("${local.server.port}")
private int port;
@Bean
public ServerList<Server> ribbonServerList() {
return new org.springframework.cloud.netflix.ribbon.StaticServerList(new Server("localhost", this.port));
}
@Bean
public RibbonLoadBalancingHttpClient ribbonClient(IClientConfig config, ILoadBalancer loadBalancer, RetryHandler retryHandler) {
final RibbonLoadBalancingHttpClient client = new RibbonLoadBalancingHttpClient(config, new DefaultServerIntrospector());
client.setLoadBalancer(loadBalancer);
client.setRetryHandler(retryHandler);
return client;
}
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
5475bce9ad47faf9bae65e51b6f079602912c5c4 | 3cb0aa569e1db2fa123d5ff9ae94da84fedd58d5 | /prog/Homework1-model/src/HashMapLetterInventory.java | e096249ce5c292985dda4db2016e7fbd26771842 | [] | no_license | invisible-college/model | cd810d14e06d11a033f84d6fc6a77766e97f4767 | d6027a0f9df0792632752e881c71cd8c52953370 | refs/heads/master | 2016-08-04T21:19:22.144014 | 2014-06-17T21:49:32 | 2014-06-17T21:49:32 | 16,304,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | import java.util.Arrays;
public class HashMapLetterInventory implements LetterInventory {
int[] count;
char[] chars;
int size;
HashMapLetterInventory(String data) {
throw new RuntimeException("Not yet implemented");
}
public int getCount(int index) {
throw new RuntimeException("Not yet implemented");
}
public int get(char letter) {
throw new RuntimeException("Not yet implemented");
}
public void set(char letter, int value) {
throw new RuntimeException("Not yet implemented");
}
public int size() {
throw new RuntimeException("Not yet implemented");
}
public boolean isEmpty() {
throw new RuntimeException("Not yet implemented");
}
public String toString() {
throw new RuntimeException("Not yet implemented");
}
public LetterInventory add(LetterInventory other) {
throw new RuntimeException("Not yet implemented");
}
public LetterInventory subtract(LetterInventory other) {
throw new RuntimeException("Not yet implemented");
}
}
| [
"ppham@local-box.org"
] | ppham@local-box.org |
6a9f0cde0bea2d97a606fd7183064c4e2228511a | 2d212ec3d9739d629f701f95d9bdfb0f5da1602f | /1.utils/core/src/main/java/com/octopus/utils/cls/javassist/compiler/ast/NewExpr.java | 8906f8ae2b7b76f386f745b6778adc7ed7512f04 | [
"Apache-2.0"
] | permissive | pacoolin/octopus | a42bdfb551df2b567760c4cf2e3a23dcb70942ec | 5439561133af00de089d6d30b3527542a434057f | refs/heads/master | 2023-05-11T08:26:02.210724 | 2021-05-05T02:14:02 | 2021-05-05T02:14:02 | 281,041,828 | 0 | 0 | Apache-2.0 | 2020-07-20T07:10:12 | 2020-07-20T07:10:11 | null | UTF-8 | Java | false | false | 3,147 | java | /*
* Javassist, a Java-bytecode translator toolkit.
* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. Alternatively, the contents of this file may be used under
* the terms of the GNU Lesser General Public License Version 2.1 or later,
* or the Apache License Version 2.0.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*/
package com.octopus.utils.cls.javassist.compiler.ast;
import com.octopus.utils.cls.javassist.compiler.CompileError;
import com.octopus.utils.cls.javassist.compiler.TokenId;
/**
* New Expression.
*/
public class NewExpr extends com.octopus.utils.cls.javassist.compiler.ast.ASTList implements TokenId {
protected boolean newArray;
protected int arrayType;
public NewExpr(com.octopus.utils.cls.javassist.compiler.ast.ASTList className, com.octopus.utils.cls.javassist.compiler.ast.ASTList args) {
super(className, new com.octopus.utils.cls.javassist.compiler.ast.ASTList(args));
newArray = false;
arrayType = CLASS;
}
public NewExpr(int type, com.octopus.utils.cls.javassist.compiler.ast.ASTList arraySize, com.octopus.utils.cls.javassist.compiler.ast.ArrayInit init) {
super(null, new com.octopus.utils.cls.javassist.compiler.ast.ASTList(arraySize));
newArray = true;
arrayType = type;
if (init != null)
append(this, init);
}
public static NewExpr makeObjectArray(com.octopus.utils.cls.javassist.compiler.ast.ASTList className,
com.octopus.utils.cls.javassist.compiler.ast.ASTList arraySize, com.octopus.utils.cls.javassist.compiler.ast.ArrayInit init) {
NewExpr e = new NewExpr(className, arraySize);
e.newArray = true;
if (init != null)
append(e, init);
return e;
}
public boolean isArray() { return newArray; }
/* TokenId.CLASS, TokenId.INT, ...
*/
public int getArrayType() { return arrayType; }
public com.octopus.utils.cls.javassist.compiler.ast.ASTList getClassName() { return (com.octopus.utils.cls.javassist.compiler.ast.ASTList)getLeft(); }
public com.octopus.utils.cls.javassist.compiler.ast.ASTList getArguments() { return (com.octopus.utils.cls.javassist.compiler.ast.ASTList)getRight().getLeft(); }
public com.octopus.utils.cls.javassist.compiler.ast.ASTList getArraySize() { return getArguments(); }
public com.octopus.utils.cls.javassist.compiler.ast.ArrayInit getInitializer() {
ASTree t = getRight().getRight();
if (t == null)
return null;
else
return (ArrayInit)t.getLeft();
}
public void accept(Visitor v) throws CompileError { v.atNewExpr(this); }
protected String getTag() {
return newArray ? "new[]" : "new";
}
}
| [
"kodw38@126.com"
] | kodw38@126.com |
d35319d32dbe4db74319e2c2ba75a9fd711e85ae | c5a2333f59892ed08b01343a0da063b3a7193e4e | /server/WEB-INF/src/WindowMeServer.java | 317852d9d59bea60e445eba7f84d9b8aa5c11003 | [
"Apache-2.0"
] | permissive | bradley35/WindowMe | 8c9a5be454bbe530da7c647812a0734a8241c040 | 6cedcc3db90468ba0880189e95cdc89aab98d18a | refs/heads/master | 2022-12-13T13:01:40.165179 | 2020-09-10T20:54:41 | 2020-09-10T20:54:41 | 294,309,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 133 | java | class WindowMeServer{
public String code1="";
public String code2="";
public WindowMeServer(String code1, String code2){
}
}
| [
"Bradley21890543@users.noreply.github.com"
] | Bradley21890543@users.noreply.github.com |
aee96ebcf414cd47c1c1c5420c662eeeebd09b8c | 8f8d2950fb073544e45b853a6822caf9d0968dac | /amil-a5/src/main/java/br/com/amil/a5/model/NickName.java | cea660639be8b018bfa97cb3e3a374ad7ac4707f | [] | no_license | kgsaran/pre-dojo | 4041a5738b106a81bb1602473d1d552b59c4e423 | 046547ffe469500c02b1450d52dc6f87bf84928d | refs/heads/master | 2021-01-24T08:34:16.140657 | 2016-09-23T12:32:41 | 2016-09-23T12:32:41 | 69,017,960 | 0 | 0 | null | 2016-09-23T11:14:53 | 2016-09-23T11:14:53 | null | UTF-8 | Java | false | false | 385 | java | package br.com.amil.a5.model;
public class NickName extends Message {
private String nickName;
private String weapon;
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getWeapon() {
return weapon;
}
public void setWeapon(String weapon) {
this.weapon = weapon;
}
}
| [
"kgsar@10.246.238.3"
] | kgsar@10.246.238.3 |
2e701a8060102b2173d82e8081838e1908ecba6e | 6552244c7ef44150ea74cef7ec801d5a9f7171e9 | /app/src/main/java/com/google/android/gms/wearable/internal/zzad.java | 8a8b2094e01a7f5aa831181a4ce42d724d08e778 | [] | no_license | amithbm/cbskeep | c9469156efd307fb474d817760a0b426af8f7c5c | a800f00ab617cba49d1a1bea1f0282c0cde525e7 | refs/heads/master | 2016-09-06T12:42:33.824977 | 2015-08-24T15:33:50 | 2015-08-24T15:33:50 | 41,311,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,494 | java | package com.google.android.gms.wearable.internal;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.zza;
import com.google.android.gms.common.internal.safeparcel.zza.zza;
import com.google.android.gms.common.internal.safeparcel.zzb;
public class zzad
implements Parcelable.Creator<DeleteDataItemsResponse>
{
static void zza(DeleteDataItemsResponse paramDeleteDataItemsResponse, Parcel paramParcel, int paramInt)
{
paramInt = zzb.zzcR(paramParcel);
zzb.zzc(paramParcel, 1, versionCode);
zzb.zzc(paramParcel, 2, statusCode);
zzb.zzc(paramParcel, 3, zzbHV);
zzb.zzJ(paramParcel, paramInt);
}
public DeleteDataItemsResponse zznq(Parcel paramParcel)
{
int k = 0;
int m = zza.zzcQ(paramParcel);
int j = 0;
int i = 0;
while (paramParcel.dataPosition() < m)
{
int n = zza.zzcP(paramParcel);
switch (zza.zzeS(n))
{
default:
zza.zzb(paramParcel, n);
break;
case 1:
i = zza.zzg(paramParcel, n);
break;
case 2:
j = zza.zzg(paramParcel, n);
break;
case 3:
k = zza.zzg(paramParcel, n);
}
}
if (paramParcel.dataPosition() != m)
throw new zza.zza("Overread allowed size end=" + m, paramParcel);
return new DeleteDataItemsResponse(i, j, k);
}
public DeleteDataItemsResponse[] zzrv(int paramInt)
{
return new DeleteDataItemsResponse[paramInt];
}
} | [
"amithbm@gmail.com"
] | amithbm@gmail.com |
d87f622c80d7589b597de7c00c1691f64c380c88 | 89dc1b23d21aa1952c0dfb415be5fed144cbbd84 | /FrameWork_Util/src/framework/ressource/xalan/xpath/functions/FuncLast.java | f2427cf58dc9f88418f1dd20ee7717fe4d5e38b1 | [] | no_license | M6C/framework-util | c1bdf33f08e2ae0a3964424d7ff8737e34434253 | e91c725f67a81ccae84a8410f2795abb990a1c99 | refs/heads/master | 2021-01-10T17:00:31.444538 | 2017-02-07T13:33:51 | 2017-02-07T13:33:51 | 52,559,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,740 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: FuncLast.java
package framework.ressource.xalan.xpath.functions;
import java.util.Vector;
import javax.xml.transform.TransformerException;
import org.apache.xml.dtm.DTMIterator;
import framework.ressource.xalan.xpath.XPathContext;
import framework.ressource.xalan.xpath.axes.SubContextList;
import framework.ressource.xalan.xpath.compiler.Compiler;
import framework.ressource.xalan.xpath.objects.XNumber;
import framework.ressource.xalan.xpath.objects.XObject;
// Referenced classes of package framework.ressource.xalan.xpath.functions:
// Function
public class FuncLast extends Function
{
public FuncLast()
{
}
public void postCompileStep(Compiler compiler)
{
m_isTopLevel = compiler.getLocationPathDepth() == -1;
}
public int getCountOfContextNodeList(XPathContext xctxt)
throws TransformerException
{
SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();
if(null != iter)
return iter.getLastPos(xctxt);
DTMIterator cnl = xctxt.getContextNodeList();
int count;
if(null != cnl)
count = cnl.getLength();
else
count = 0;
return count;
}
public XObject execute(XPathContext xctxt)
throws TransformerException
{
XNumber xnum = new XNumber(getCountOfContextNodeList(xctxt));
return xnum;
}
public void fixupVariables(Vector vector, int i)
{
}
static final long serialVersionUID = 0x7fc19d9b2acad86fL;
private boolean m_isTopLevel;
}
| [
"david.roca@free.fr"
] | david.roca@free.fr |
fb96fec0043f873c3f36d4b110f9dbfa18d24e4d | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/appbrand/widget/f/d.java | 489d54f1c7fc0a7b91bbd1f754ff5ff6bfda2433 | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,239 | java | package com.tencent.mm.plugin.appbrand.widget.f;
import a.l;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.lang.ref.WeakReference;
@l(dWo={1, 1, 13}, dWp={""}, dWq={"Lcom/tencent/mm/plugin/appbrand/widget/prompt/AutoDismissRunner;", "Ljava/lang/Runnable;", "toast", "Lcom/tencent/mm/plugin/appbrand/widget/prompt/AppBrandPopupToast;", "(Lcom/tencent/mm/plugin/appbrand/widget/prompt/AppBrandPopupToast;)V", "ref", "Ljava/lang/ref/WeakReference;", "run", "", "plugin-appbrand-integration_release"})
final class d
implements Runnable
{
private final WeakReference<c> iuM;
public d(c paramc)
{
AppMethodBeat.i(135267);
this.iuM = new WeakReference(paramc);
AppMethodBeat.o(135267);
}
public final void run()
{
AppMethodBeat.i(135266);
c localc = (c)this.iuM.get();
if (localc != null)
{
localc.dismiss();
AppMethodBeat.o(135266);
}
while (true)
{
return;
AppMethodBeat.o(135266);
}
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes4-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.appbrand.widget.f.d
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
2943c2c7d08dba7fcf51c98ddace5305eee05acb | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_a5043b8f87c4d7113b374520bce8f74275c836e6/XSModelGroupImpl/2_a5043b8f87c4d7113b374520bce8f74275c836e6_XSModelGroupImpl_t.java | 480a59fa6fadc0894f6cbcb47acfbd4d95a84bc1 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 7,279 | java | /*
* Copyright 2002,2003-2004 The Apache Software Foundation.
*
* 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.apache.xerces.impl.xs;
import org.apache.xerces.xs.*;
import org.apache.xerces.impl.xs.util.XSObjectListImpl;
/**
* Store schema model group declaration.
*
* @author Sandy Gao, IBM
*
* @version $Id$
*/
public class XSModelGroupImpl implements XSModelGroup {
// types of model groups
// REVISIT: can't use same constants as those for particles, because
// there are place where the constants are used together. For example,
// to check whether the content is an element or a sequence.
public static final short MODELGROUP_CHOICE = 101;
public static final short MODELGROUP_SEQUENCE = 102;
public static final short MODELGROUP_ALL = 103;
// compositor of the model group
public short fCompositor;
// particles
public XSParticleDecl[] fParticles = null;
public int fParticleCount = 0;
// this particle's optional annotation
public XSAnnotationImpl fAnnotation;
// whether this model group contains nothing
public boolean isEmpty() {
for (int i = 0; i < fParticleCount; i++) {
if (!fParticles[i].isEmpty())
return false;
}
return true;
}
/**
* 3.8.6 Effective Total Range (all and sequence) and
* Effective Total Range (choice)
* The following methods are used to return min/max range for a particle.
* They are not exactly the same as it's described in the spec, but all the
* values from the spec are retrievable by these methods.
*/
public int minEffectiveTotalRange() {
if (fCompositor == MODELGROUP_CHOICE)
return minEffectiveTotalRangeChoice();
else
return minEffectiveTotalRangeAllSeq();
}
// return the sum of all min values of the particles
private int minEffectiveTotalRangeAllSeq() {
int total = 0;
for (int i = 0; i < fParticleCount; i++)
total += fParticles[i].minEffectiveTotalRange();
return total;
}
// return the min of all min values of the particles
private int minEffectiveTotalRangeChoice() {
int min = 0, one;
if (fParticleCount > 0)
min = fParticles[0].minEffectiveTotalRange();
for (int i = 1; i < fParticleCount; i++) {
one = fParticles[i].minEffectiveTotalRange();
if (one < min)
min = one;
}
return min;
}
public int maxEffectiveTotalRange() {
if (fCompositor == MODELGROUP_CHOICE)
return maxEffectiveTotalRangeChoice();
else
return maxEffectiveTotalRangeAllSeq();
}
// if one of the max value of the particles is unbounded, return unbounded;
// otherwise return the sum of all max values
private int maxEffectiveTotalRangeAllSeq() {
int total = 0, one;
for (int i = 0; i < fParticleCount; i++) {
one = fParticles[i].maxEffectiveTotalRange();
if (one == SchemaSymbols.OCCURRENCE_UNBOUNDED)
return SchemaSymbols.OCCURRENCE_UNBOUNDED;
total += one;
}
return total;
}
// if one of the max value of the particles is unbounded, return unbounded;
// otherwise return the max of all max values
private int maxEffectiveTotalRangeChoice() {
int max = 0, one;
if (fParticleCount > 0) {
max = fParticles[0].maxEffectiveTotalRange();
if (max == SchemaSymbols.OCCURRENCE_UNBOUNDED)
return SchemaSymbols.OCCURRENCE_UNBOUNDED;
}
for (int i = 1; i < fParticleCount; i++) {
one = fParticles[i].maxEffectiveTotalRange();
if (one == SchemaSymbols.OCCURRENCE_UNBOUNDED)
return SchemaSymbols.OCCURRENCE_UNBOUNDED;
if (one > max)
max = one;
}
return max;
}
/**
* get the string description of this particle
*/
private String fDescription = null;
public String toString() {
if (fDescription == null) {
StringBuffer buffer = new StringBuffer();
if (fCompositor == MODELGROUP_ALL)
buffer.append("all(");
else
buffer.append('(');
if (fParticleCount > 0)
buffer.append(fParticles[0].toString());
for (int i = 1; i < fParticleCount; i++) {
if (fCompositor == MODELGROUP_CHOICE)
buffer.append('|');
else
buffer.append(',');
buffer.append(fParticles[i].toString());
}
buffer.append(')');
fDescription = buffer.toString();
}
return fDescription;
}
public void reset(){
fCompositor = MODELGROUP_SEQUENCE;
fParticles = null;
fParticleCount = 0;
fDescription = null;
fAnnotation = null;
}
/**
* Get the type of the object, i.e ELEMENT_DECLARATION.
*/
public short getType() {
return XSConstants.MODEL_GROUP;
}
/**
* The <code>name</code> of this <code>XSObject</code> depending on the
* <code>XSObject</code> type.
*/
public String getName() {
return null;
}
/**
* The namespace URI of this node, or <code>null</code> if it is
* unspecified. defines how a namespace URI is attached to schema
* components.
*/
public String getNamespace() {
return null;
}
/**
* {compositor} One of all, choice or sequence. The valid constants values
* are: ALL, CHOICE, SEQUENCE.
*/
public short getCompositor() {
if (fCompositor == MODELGROUP_CHOICE)
return XSModelGroup.COMPOSITOR_CHOICE;
else if (fCompositor == MODELGROUP_SEQUENCE)
return XSModelGroup.COMPOSITOR_SEQUENCE;
else
return XSModelGroup.COMPOSITOR_ALL;
}
/**
* {particles} A list of particles
*/
public XSObjectList getParticles() {
return new XSObjectListImpl(fParticles, fParticleCount);
}
/**
* Optional. Annotation.
*/
public XSAnnotation getAnnotation() {
return fAnnotation;
}
/**
* @see org.apache.xerces.xs.XSObject#getNamespaceItem()
*/
public XSNamespaceItem getNamespaceItem() {
return null;
}
} // class XSModelGroupImpl
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
1562d24588cc0164dd0878340875babdc315997e | bb3623a0d8cb416b7cc57cf97a07e9a67afe961b | /src/fr/papyfinance/com/tests/RoleTest.java | 909d7aa35ee0fbba4ceda321a3fb0d155581ee35 | [
"MIT"
] | permissive | CedricBm/papyfinance | 3a5c116e4f185f892bcb934621419f5db153f1a3 | f77d85f459e12777724d9b215745729b097b703c | refs/heads/master | 2020-04-14T20:07:56.776047 | 2016-03-25T16:13:49 | 2016-03-25T16:13:49 | 50,675,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,556 | java | package fr.papyfinance.com.tests;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.List;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import fr.papyfinance.com.beans.Role;
import fr.papyfinance.com.dao.RoleDao;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class RoleTest {
private static RoleDao roleDao;
@BeforeClass
public static void runBeforeClass() {
Configuration configuration = new Configuration().configure("hibernate-test.cfg.xml");
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
SessionFactory sessionFactory = configuration.buildSessionFactory(builder.build());
roleDao = new RoleDao(sessionFactory);
}
@Test
public void test1Create() {
Role s = new Role();
s.setName("Admin");
roleDao.create(s);
assertNotNull(s.getId());
}
@Test
public void test2Get() {
Role s = roleDao.getByName("Admin");
assertNotNull(s);
}
@Test
public void test3GetAll() {
List<Role> roles = roleDao.getAll();
assertTrue(roles.size() > 0);
}
@Test
public void test4UniqName() {
Role s = new Role();
s.setName("Admin");
assertFalse(roleDao.create(s));
}
} | [
"beaumont.cedric@gmail.com"
] | beaumont.cedric@gmail.com |
eceeebc3402bcfb9d592f74947ed34660154f24c | 21c2f55b571a4a43da0bb56396fce4202bce3306 | /src/generated/java/Murmur/Callback_Server_getState.java | 2728382b7876058bbbb35f2427a95f5fbd1b7ae9 | [] | no_license | Tiim/telegram_mumble_bot | 33c4729158db89aadf98dfbcc4bf6a14c9141ee3 | fb4d373595fbdafd7eda2668ab703a70157fa6b7 | refs/heads/master | 2021-01-10T19:50:51.597343 | 2016-01-04T06:48:43 | 2016-01-04T06:48:43 | 39,690,708 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,249 | java | // **********************************************************************
//
// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
//
// Ice version 3.4.2
//
// <auto-generated>
//
// Generated from file `Callback_Server_getState.java'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
package Murmur;
/**
* Get state of a single connected user.
**/
public abstract class Callback_Server_getState extends Ice.TwowayCallback
{
public abstract void response(User __ret);
public abstract void exception(Ice.UserException __ex);
public final void __completed(Ice.AsyncResult __result)
{
ServerPrx __proxy = (ServerPrx)__result.getProxy();
User __ret = null;
try
{
__ret = __proxy.end_getState(__result);
}
catch(Ice.UserException __ex)
{
exception(__ex);
return;
}
catch(Ice.LocalException __ex)
{
exception(__ex);
return;
}
response(__ret);
}
}
| [
"tim.bachmann@cad.ch"
] | tim.bachmann@cad.ch |
edb86909d80a5421ff02211c280c156a322e7f2e | 8e551e61759362849188a248ceb4d59cdbf9e633 | /src/main/java/stacksandqueues/Q3_02_Stack_Min/MinStack.java | 57ce75510332702365c9e1ad53eb036151ec4c83 | [] | no_license | rishugupta87/CrackingTheCodingInterview | 77b863c7b12e8bed98d7739d28033452de971713 | 783320886d2c49928d2087ff298f598fc1505890 | refs/heads/master | 2020-05-23T21:17:09.945760 | 2017-07-04T02:23:11 | 2017-07-04T02:23:11 | 84,791,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,135 | java | package stacksandqueues.Q3_02_Stack_Min;
import java.util.Stack;
/**
* How would you design a stack which, in addition to push and pop, has a function min which returns the
* minimum element? Push, pop and min should all operate in 0(1) time.
*/
public class MinStack extends Stack<Integer>{
/**
* Maintain a second stack that just keeps track of min
*
* when pushing, push on org stack, push on minStack only if currElem < minStack.peek
* when popping, pop from orgStack, pop from minStack only if currElem = minStack.peek
*
*/
Stack<Integer> minStack;
public MinStack() {
minStack = new Stack<Integer>();
}
public void push(int value){
if (value <= min()) {
minStack.push(value);
}
super.push(value);
}
public Integer pop() {
int value = super.pop();
if (value == min()) {
minStack.pop();
}
return value;
}
public int min() {
if (minStack.isEmpty()) {
return Integer.MAX_VALUE;
} else {
return minStack.peek();
}
}
}
| [
"rishu.gupta@cerner.com"
] | rishu.gupta@cerner.com |
42eb72ed899381330172ea4564b71c1775662611 | 24b596e64e943ef87465a61ebcc7c50b20355376 | /Android/FindSenetor/src/com/swapp/findsenetor/MainActivity.java | 397c14d3d632bae6fd615dc8f8d583d2bf28bb04 | [] | no_license | swapp1990/Programming | 50780ff493561dc48534e2cc3d566c8be7772c69 | b3c87e5824dc0853fbb0856c09e19f3e4844854b | refs/heads/master | 2020-06-09T05:53:12.160718 | 2015-07-22T03:05:49 | 2015-07-22T03:05:49 | 39,481,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 983 | java | package com.swapp.findsenetor;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
//Scene for GPS Location Profiles
public void GoProfileSlides(View view)
{
Intent intent = new Intent(this, Profile_Slides.class);
startActivity(intent);
}
//Scene for Search Feature
public void GoSearchMenu(View view)
{
Intent intent = new Intent(this, SearchPage.class);
startActivity(intent);
}
}
| [
"swapp1990@yahoo.com"
] | swapp1990@yahoo.com |
5d98e6ec1e5c0d58f33656a0e76ea4d5ace95c63 | fa35abcb740bf2ca556522c488222cfd7d6ec036 | /app/build/generated/source/buildConfig/androidTest/debug/com/murach/ch10_ex5/test/BuildConfig.java | 77751d4712441401d111dd52eb74836cd07b9c58 | [] | no_license | D3ADL3PR3CHAUN/Project5_TestTimer | 5223a6bf6670999e0062a4b7db3e3f0ad3b3ff9c | f392896d36cb9432e576195da183e4b205cc7d2e | refs/heads/master | 2021-08-22T17:16:23.400318 | 2017-11-30T19:26:45 | 2017-11-30T19:26:45 | 112,649,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.murach.ch10_ex5.test;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.murach.ch10_ex5.test";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = -1;
public static final String VERSION_NAME = "";
}
| [
"mcgee8621@gmail.com"
] | mcgee8621@gmail.com |
67495aaad54b30cb04c163bf9c3e9b48f1b6fb12 | ec774d4164ac43de7409148a3192b01aefd7ddad | /src/br/com/cde/view/TelaCadastroProdutos.java | 450b03d482955fab4d880b218aa3289f71fb7895 | [] | no_license | AlexsandroFaria/controle_estoque | 2ecc1a163f70f872127d01a96556f9ce9e31acff | e6e0901f34c4a06636e95727b2438e3f7637587f | refs/heads/master | 2022-06-03T18:49:29.821584 | 2020-05-01T21:44:44 | 2020-05-01T21:44:44 | 258,241,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37,413 | 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 br.com.cde.view;
import br.com.cde.dao.CategoriaDAO;
import br.com.cde.dao.LoteDAO;
import br.com.cde.dao.ProdutoDAO;
import br.com.cde.dao.TamanhoDAO;
import br.com.cde.dao.TipoDAO;
import br.com.cde.model.Categoria;
import br.com.cde.model.Lote;
import br.com.cde.model.Produtos;
import br.com.cde.model.Tamanho;
import br.com.cde.model.Tipo;
import br.com.cde.tableModel.TabelaModeloProduto;
import br.com.cde.utilitarios.Utilitarios;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.swing.JOptionPane;
/**
*
* @author alafaria
*/
public class TelaCadastroProdutos extends javax.swing.JFrame {
Utilitarios utilitarios = new Utilitarios();
Produtos produto = new Produtos();
ProdutoDAO dao = new ProdutoDAO();
/**
* Creates new form TelaCadastroProdutos
*/
public TelaCadastroProdutos() {
initComponents();
setIconImage(getToolkit().createImage(getClass().getResource("/icones/stock.png")));
tabelaProdutos.setModel(new TabelaModeloProduto(new ProdutoDAO().listarProdutos()));
btExcluir.setEnabled(false);
btAlterar.setEnabled(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jTabbedProduto = new javax.swing.JTabbedPane();
jPanel2 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
txtCodigo = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
txtNome = new javax.swing.JTextField();
txtDescricao = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
txtValor = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
comboLote = new javax.swing.JComboBox<>();
jLabel8 = new javax.swing.JLabel();
comboTipo = new javax.swing.JComboBox<>();
jLabel9 = new javax.swing.JLabel();
comboCategoria = new javax.swing.JComboBox<>();
jLabel10 = new javax.swing.JLabel();
txtQuantidade = new javax.swing.JTextField();
comboTamanho = new javax.swing.JComboBox<>();
jLabel12 = new javax.swing.JLabel();
txtDataInclusao = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tabelaProdutos = new javax.swing.JTable();
jLabel11 = new javax.swing.JLabel();
txtPesquisa = new javax.swing.JTextField();
btNovo = new javax.swing.JButton();
btCadastrar = new javax.swing.JButton();
btSair = new javax.swing.JButton();
btAlterar = new javax.swing.JButton();
btExcluir = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Cadastro de Produtos");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);
}
});
jPanel1.setBackground(new java.awt.Color(0, 204, 204));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(102, 102, 102));
jLabel1.setText("Cadastro de Produtos");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel2.setText("Código:");
txtCodigo.setEditable(false);
txtCodigo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel3.setText("Produto:");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setText("Descrição:");
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel5.setText("Tamanho:");
txtNome.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
txtDescricao.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel6.setText("Valor:");
txtValor.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel7.setText("Lote:");
comboLote.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
comboLote.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
comboLoteAncestorAdded(evt);
}
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
});
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel8.setText("Tipo:");
comboTipo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
comboTipo.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
comboTipoAncestorAdded(evt);
}
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
});
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel9.setText("Categoria:");
comboCategoria.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
comboCategoria.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
comboCategoriaAncestorAdded(evt);
}
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
});
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel10.setText("Quantidade:");
txtQuantidade.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
comboTamanho.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
comboTamanho.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
comboTamanhoAncestorAdded(evt);
}
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
});
jLabel12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel12.setText("Data Inclusão:");
txtDataInclusao.setEditable(false);
txtDataInclusao.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/prod.png"))); // NOI18N
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel2)
.addContainerGap(1150, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, 365, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(18, 18, 18)
.addComponent(comboTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtDescricao, javax.swing.GroupLayout.PREFERRED_SIZE, 364, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(comboTamanho, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(29, 29, 29)
.addComponent(comboLote, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel6)
.addGap(29, 29, 29)
.addComponent(txtValor, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jLabel9)
.addGap(18, 18, 18)
.addComponent(comboCategoria, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel12)
.addGap(18, 18, 18)
.addComponent(txtDataInclusao, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel13)
.addGap(104, 104, 104))))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(12, 12, 12)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6)
.addComponent(txtValor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtDescricao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(comboLote, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comboTamanho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(comboTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9)
.addComponent(comboCategoria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(29, 29, 29)
.addComponent(jLabel4)))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(txtQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12)
.addComponent(txtDataInclusao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel13))
.addContainerGap(44, Short.MAX_VALUE))
);
jTabbedProduto.addTab("Cadastro de Produtos", jPanel2);
tabelaProdutos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
tabelaProdutos.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tabelaProdutosMouseClicked(evt);
}
});
jScrollPane1.setViewportView(tabelaProdutos);
jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/pesquisar.png"))); // NOI18N
jLabel11.setText("Pesquisa por produto:");
txtPesquisa.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
txtPesquisa.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txtPesquisaKeyPressed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel11)
.addGap(18, 18, 18)
.addComponent(txtPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1180, Short.MAX_VALUE))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(txtPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)
.addContainerGap())
);
jTabbedProduto.addTab("Consulta de Produtos", jPanel3);
btNovo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/novo.png"))); // NOI18N
btNovo.setText("Novo");
btNovo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btNovoActionPerformed(evt);
}
});
btCadastrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/cadastrar.png"))); // NOI18N
btCadastrar.setText("Cadastrar");
btCadastrar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btCadastrarActionPerformed(evt);
}
});
btSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/sair.png"))); // NOI18N
btSair.setText("Sair");
btSair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btSairActionPerformed(evt);
}
});
btAlterar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/alterar.png"))); // NOI18N
btAlterar.setText("Alterar");
btAlterar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btAlterarActionPerformed(evt);
}
});
btExcluir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones/excluir.png"))); // NOI18N
btExcluir.setText("Excluir");
btExcluir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btExcluirActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 1213, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(264, 264, 264)
.addComponent(btNovo)
.addGap(18, 18, 18)
.addComponent(btCadastrar)
.addGap(18, 18, 18)
.addComponent(btExcluir)
.addGap(18, 18, 18)
.addComponent(btAlterar)
.addGap(18, 18, 18)
.addComponent(btSair)))
.addContainerGap(27, Short.MAX_VALUE))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btCadastrar, btExcluir, btNovo, btSair});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTabbedProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btNovo)
.addComponent(btCadastrar)
.addComponent(btSair)
.addComponent(btAlterar)
.addComponent(btExcluir))
.addGap(35, 35, 35))
);
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btCadastrar, btExcluir, btNovo, btSair});
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void btNovoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btNovoActionPerformed
// TODO add your handling code here:
utilitarios.limpaTela(jPanel2);
btCadastrar.setEnabled(true);
btExcluir.setEnabled(false);
}//GEN-LAST:event_btNovoActionPerformed
private void btCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCadastrarActionPerformed
// TODO add your handling code here:
if (txtNome.getText().isEmpty() || txtDescricao.getText().isEmpty() || txtQuantidade.getText().isEmpty() || txtValor.getText().isEmpty() || comboCategoria.getSelectedItem().equals("") || comboLote.getSelectedItem().equals("") || comboTamanho.getSelectedItem().equals("") || comboTipo.getSelectedItem().equals(evt)) {
JOptionPane.showMessageDialog(null, "Não podem Existir campos em branco!");
} else {
produto.setNome(txtNome.getText());
produto.setDescricao(txtDescricao.getText());
produto.setTamanho(comboTamanho.getSelectedItem().toString());
produto.setValor(Double.parseDouble(txtValor.getText().replace(",", ".")));
produto.setLote(comboLote.getSelectedItem().toString());
produto.setTipo(comboTipo.getSelectedItem().toString());
produto.setCategoria(comboCategoria.getSelectedItem().toString());
produto.setQuantidade(Integer.parseInt(txtQuantidade.getText()));
Date agora = new Date();
SimpleDateFormat dataEua = new SimpleDateFormat("yyyy-MM-dd");
String dataMySql = dataEua.format(agora);
produto.setDataAlteracao(dataMySql);
dao.cadastrarProduto(produto);
tabelaProdutos.setModel(new TabelaModeloProduto(new ProdutoDAO().listarProdutos()));
}
utilitarios.limpaTela(jPanel2);
}//GEN-LAST:event_btCadastrarActionPerformed
private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed
// TODO add your handling code here:
produto.setCodigoProduto(Integer.parseInt(txtCodigo.getText()));
dao.excluirProduto(produto);
utilitarios.limpaTela(jPanel2);
btExcluir.setEnabled(false);
btCadastrar.setEnabled(true);
btAlterar.setEnabled(false);
tabelaProdutos.setModel(new TabelaModeloProduto(new ProdutoDAO().listarProdutos()));
}//GEN-LAST:event_btExcluirActionPerformed
private void btSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSairActionPerformed
// TODO add your handling code here:
dispose();
}//GEN-LAST:event_btSairActionPerformed
private void btAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAlterarActionPerformed
// TODO add your handling code here:
if (txtNome.getText().isEmpty() || txtDescricao.getText().isEmpty() || txtQuantidade.getText().isEmpty() || txtValor.getText().isEmpty() || comboCategoria.getSelectedItem().equals("") || comboLote.getSelectedItem().equals("") || comboTamanho.getSelectedItem().equals("") || comboTipo.getSelectedItem().equals(evt)) {
JOptionPane.showMessageDialog(null, "Não podem Existir campos em branco!");
} else {
produto.setNome(txtNome.getText());
produto.setDescricao(txtDescricao.getText());
produto.setTamanho(comboTamanho.getSelectedItem().toString());
produto.setValor(Double.parseDouble(txtValor.getText().replace(",", ".")));
produto.setLote(comboLote.getSelectedItem().toString());
produto.setTipo(comboTipo.getSelectedItem().toString());
produto.setCategoria(comboCategoria.getSelectedItem().toString());
produto.setQuantidade(Integer.parseInt(txtQuantidade.getText()));
produto.setCodigoProduto(Integer.parseInt(txtCodigo.getText()));
dao.alterarProduto(produto);
tabelaProdutos.setModel(new TabelaModeloProduto(new ProdutoDAO().listarProdutos()));
btCadastrar.setEnabled(true);
btExcluir.setEnabled(false);
btAlterar.setEnabled(false);
}
utilitarios.limpaTela(jPanel2);
}//GEN-LAST:event_btAlterarActionPerformed
private void tabelaProdutosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaProdutosMouseClicked
// TODO add your handling code here:
jTabbedProduto.setSelectedIndex(0);
txtCodigo.setText(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_CODIGO_PRODUTO).toString());
txtNome.setText(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_NOME_PRODUTO).toString());
txtValor.setText(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_VALOR_PRODUTO).toString());
txtDescricao.setText(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_DESCRICAO_PRODUTO).toString());
comboLote.setSelectedItem(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_LOTE_PRODUTO).toString());
comboTamanho.setSelectedItem(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_TAMANHO_PRODUTO).toString());
comboTipo.setSelectedItem(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_TIPO_PRODUTO).toString());
comboCategoria.setSelectedItem(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_CATEGORIA_PRODUTO).toString());
txtQuantidade.setText(tabelaProdutos.getValueAt(tabelaProdutos.getSelectedRow(), TabelaModeloProduto.COLUNA_QUANTIDADE_PRODUTO).toString());
btAlterar.setEnabled(true);
btCadastrar.setEnabled(false);
btExcluir.setEnabled(true);
}//GEN-LAST:event_tabelaProdutosMouseClicked
private void comboTipoAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_comboTipoAncestorAdded
// TODO add your handling code here:
comboTipo.removeAllItems();
TipoDAO tipoDAO = new TipoDAO();
List<Tipo> listaDeTipo = tipoDAO.listarTipo();
for (Tipo t : listaDeTipo) {
comboTipo.addItem(String.valueOf(t));
}
}//GEN-LAST:event_comboTipoAncestorAdded
private void comboCategoriaAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_comboCategoriaAncestorAdded
// TODO add your handling code here:
comboCategoria.removeAllItems();
CategoriaDAO categoriaDAO = new CategoriaDAO();
List<Categoria> listaDeCategoria = categoriaDAO.listarCategoria();
for (Categoria c : listaDeCategoria) {
comboCategoria.addItem(String.valueOf(c));
}
}//GEN-LAST:event_comboCategoriaAncestorAdded
private void comboLoteAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_comboLoteAncestorAdded
// TODO add your handling code here:
comboLote.removeAllItems();
LoteDAO loteDAO = new LoteDAO();
List<Lote> listaDeLote = loteDAO.listarLote();
for (Lote l : listaDeLote) {
comboLote.addItem(String.valueOf(l));
}
}//GEN-LAST:event_comboLoteAncestorAdded
private void txtPesquisaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPesquisaKeyPressed
// TODO add your handling code here:
String pesquisar = txtPesquisa.getText();
tabelaProdutos.setModel(new TabelaModeloProduto(new ProdutoDAO().listarProdutoPorNome(pesquisar)));
}//GEN-LAST:event_txtPesquisaKeyPressed
private void comboTamanhoAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_comboTamanhoAncestorAdded
// TODO add your handling code here:
comboTamanho.removeAllItems();
TamanhoDAO tamanhoDAO = new TamanhoDAO();
List<Tamanho> listaDeTamanho = tamanhoDAO.listarTamanho();
for (Tamanho tam : listaDeTamanho) {
comboTamanho.addItem(String.valueOf(tam));
}
}//GEN-LAST:event_comboTamanhoAncestorAdded
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
// TODO add your handling code here:
Date agora = new Date();
SimpleDateFormat dataBr = new SimpleDateFormat("dd/MM/yyyy");
String dataFormatada = dataBr.format(agora);
txtDataInclusao.setText(dataFormatada);
}//GEN-LAST:event_formWindowActivated
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TelaCadastroProdutos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TelaCadastroProdutos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TelaCadastroProdutos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TelaCadastroProdutos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TelaCadastroProdutos().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btAlterar;
private javax.swing.JButton btCadastrar;
private javax.swing.JButton btExcluir;
private javax.swing.JButton btNovo;
private javax.swing.JButton btSair;
private javax.swing.JComboBox<String> comboCategoria;
private javax.swing.JComboBox<String> comboLote;
private javax.swing.JComboBox<String> comboTamanho;
private javax.swing.JComboBox<String> comboTipo;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
public javax.swing.JTabbedPane jTabbedProduto;
private javax.swing.JTable tabelaProdutos;
private javax.swing.JTextField txtCodigo;
private javax.swing.JTextField txtDataInclusao;
private javax.swing.JTextField txtDescricao;
private javax.swing.JTextField txtNome;
private javax.swing.JTextField txtPesquisa;
private javax.swing.JTextField txtQuantidade;
private javax.swing.JTextField txtValor;
// End of variables declaration//GEN-END:variables
}
| [
"alexsandro.lfaria@gmail.com"
] | alexsandro.lfaria@gmail.com |
d7f325cbc9158d5ab7a3e371b04fb728e618d5b3 | b6ba3c55c4f1bc0544b9d132d2c288906525ff01 | /src/main/java/om/springframework5/recipeapp/converters/CategoryToCategoryCommand.java | e9987fbc9353da96e2da82fef45d69594f7da790 | [] | no_license | OrbenMichele/spring5-recipe-app | 4af3439ae7c25105847cde45dcf80c00d0856082 | 979154921321529a43b35728d7acd96a9d474481 | refs/heads/master | 2022-01-13T23:12:19.373343 | 2019-05-06T19:45:45 | 2019-05-06T19:45:45 | 181,966,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package om.springframework5.recipeapp.converters;
import lombok.Synchronized;
import om.springframework5.recipeapp.commands.CategoryCommand;
import om.springframework5.recipeapp.domain.Category;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
@Component
public class CategoryToCategoryCommand implements Converter<Category, CategoryCommand> {
@Synchronized
@Nullable
@Override
public CategoryCommand convert(Category source) {
if (source == null) {
return null;
}
final CategoryCommand categoryCommand = new CategoryCommand();
categoryCommand.setId(source.getId());
categoryCommand.setDescription(source.getDescription());
return categoryCommand;
}
}
| [
"micheleorben@gmail.com"
] | micheleorben@gmail.com |
4167aef67aa8009cb7922b47be77bfabf921786b | 0a365271ed4d64de76afae8f7b1e44abc318d5d7 | /app/src/main/java/com/example/android/retrofittoppops/rest/ApiService.java | abfb5d0847e32bf8045ffa6b79335756c3abbb71 | [] | no_license | Srko87/TopPopsClover | a8a9ece42f99ddb8bc31dfa7e5cd578be458b954 | 4844cf5e891da6952aa08e7d21c25cc3472eeb54 | refs/heads/master | 2020-04-07T12:10:28.694352 | 2019-07-01T10:54:20 | 2019-07-01T10:54:20 | 158,357,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 514 | java | package com.example.android.retrofittoppops.rest;
import com.example.android.retrofittoppops.model.Album.AlbumAlbum;
import com.example.android.retrofittoppops.model.Chart.ChartTopPops;
import io.reactivex.Observable;
import io.reactivex.Single;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
public interface ApiService {
@GET("chart")
Single<ChartTopPops> getTopPops();
@GET("album/{album_id}")
Call<AlbumAlbum> getAlbum(@Path("album_id") String album_id);
} | [
"srdjan.vuckovic@clover.studio"
] | srdjan.vuckovic@clover.studio |
f2114baa3166e609036da23b401b9c9c00dba448 | 016b3fc1b668531532b0060692feb2913cdc49a7 | /springboot-study-shiro/src/main/java/com/ittao/shiro/util/ShiroUtils.java | 535d18dd66195534b431f5054dcd17e6971ec15d | [] | no_license | jiataoliu/quickboot | b15e6b4fdb71e9ae85ca153637625696de175cfd | bd64e3b4c7840f08638caf4c34db1be31bc4a270 | refs/heads/master | 2023-06-23T04:45:38.446952 | 2021-07-25T16:55:35 | 2021-07-25T16:55:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,773 | java | package com.ittao.shiro.util;
import com.ittao.shiro.constant.ShiroConstant;
import com.ittao.shiro.domain.TestShiroUser;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
/**
* @ClassName: ShiroUtils
* @Description: Shiro 工具类
* @Author: it-code-liu
* @CreateTime: 2021/7/25 4:14
* @Version : V1.0.0
*/
public class ShiroUtils {
public static String sha256(String password, String salt) {
return new SimpleHash(ShiroConstant.HASH_ALGORITHM_NAME, password, salt, ShiroConstant.HASH_ITERATORS).toString();
}
public static Session getSession() {
return SecurityUtils.getSubject().getSession();
}
public static Subject getSubject() {
return SecurityUtils.getSubject();
}
public static TestShiroUser getTestShiroUser() {
return (TestShiroUser) SecurityUtils.getSubject().getPrincipal();
}
public static Integer getUserId() {
return getTestShiroUser().getUserId();
}
public static void setSessionAttribute(Object key, Object value) {
getSession().setAttribute(key, value);
}
public static Object getSessionAttribute(Object key) {
return getSession().getAttribute(key);
}
public static boolean isLogin() {
return SecurityUtils.getSubject().getPrincipal() != null;
}
public static void logout() {
SecurityUtils.getSubject().logout();
}
public static void main(String[] args) {
// 生成随机盐
String salt = SaltUtils.getSalt(ShiroConstant.SALT_LENGTH);
salt = "salt";
System.out.println(salt);
System.out.println(sha256("666666", salt));
}
}
| [
"1956577971@qq.com"
] | 1956577971@qq.com |
e88781ae910079eecdf9975bf3aef820c535c795 | 72812d6aeeb445605ce01f4c8326764c70f89242 | /CampoEstrellasSerializado/src/ventana.java | d883b12a34c3ff89a45bfae0d1db1cf3e78c4f51 | [] | no_license | AlejandroSanchezQuesada/EjerciciciosJavaDaw | 6ca12a42ebd1f81d3e77916f3904218afd86649d | 246cb97109d5ebd427afb2efcb2d49e04bf6740c | refs/heads/master | 2022-04-19T14:05:09.466751 | 2020-04-21T11:03:48 | 2020-04-21T11:03:48 | 257,566,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,547 | java |
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.Timer;
/*
* 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.
*/
/**
*
* @author jose
*/
public class ventana extends javax.swing.JApplet {
ArrayList<Estrella> listaEstrellas;
static int ancho;
static int alto;
@Override
public void init() {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ventana.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ventana.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ventana.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ventana.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the applet */
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
listaEstrellas=new ArrayList();
leerEstrellasDeFichero();
Timer timer = new Timer (100, new ActionListener ()
{
public void actionPerformed(ActionEvent e){
if (ancho==0){
ancho=panel.getWidth();
alto=panel.getHeight();
}
panel.getGraphics().clearRect(0, 0, panel.getWidth(), panel.getHeight());
for (Estrella es:listaEstrellas){
es.mover();
panel.getGraphics().drawOval(es.getX(), es.getY(), 5, 5);
}
}
});
timer.start();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
/**
* This method is called from within the init() method to initialize the
* form. WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panel = new javax.swing.JPanel();
masVelocidad = new javax.swing.JButton();
menosVelocidad = new javax.swing.JButton();
masEstrellas = new javax.swing.JButton();
menosEstrellas = new javax.swing.JButton();
guardar = new javax.swing.JButton();
panel.setPreferredSize(new java.awt.Dimension(1000, 300));
javax.swing.GroupLayout panelLayout = new javax.swing.GroupLayout(panel);
panel.setLayout(panelLayout);
panelLayout.setHorizontalGroup(
panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
panelLayout.setVerticalGroup(
panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
masVelocidad.setText("+ Velocidad");
masVelocidad.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
masVelocidadMouseClicked(evt);
}
});
menosVelocidad.setText("- Velocidad");
menosVelocidad.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
menosVelocidadMouseClicked(evt);
}
});
masEstrellas.setText("+ Estrellas");
masEstrellas.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
masEstrellasMouseClicked(evt);
}
});
menosEstrellas.setText("- Estrellas");
menosEstrellas.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
menosEstrellasMouseClicked(evt);
}
});
guardar.setText("Guardar");
guardar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
guardarMouseClicked(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 651, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(42, 42, 42)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(masVelocidad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(menosVelocidad, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(64, 64, 64)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(masEstrellas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(menosEstrellas, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 279, Short.MAX_VALUE)
.addComponent(guardar)
.addGap(23, 23, 23))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(masVelocidad)
.addComponent(masEstrellas))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(menosVelocidad)
.addComponent(menosEstrellas)))
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(guardar)))
.addGap(0, 0, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void masEstrellasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_masEstrellasMouseClicked
// TODO add your handling code here:
Estrella e=new Estrella();
listaEstrellas.add(e);
}//GEN-LAST:event_masEstrellasMouseClicked
private void menosEstrellasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menosEstrellasMouseClicked
// TODO add your handling code here:
if (listaEstrellas.size()>0)
listaEstrellas.remove(0);
}//GEN-LAST:event_menosEstrellasMouseClicked
private void masVelocidadMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_masVelocidadMouseClicked
// TODO add your handling code here:
for (Estrella es:listaEstrellas)
es.masVelocidad();
}//GEN-LAST:event_masVelocidadMouseClicked
private void menosVelocidadMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menosVelocidadMouseClicked
// TODO add your handling code here:
for (Estrella es:listaEstrellas)
es.menosVelocidad();
}//GEN-LAST:event_menosVelocidadMouseClicked
private void leerEstrellasDeFichero(){
File archivo;
FileReader fr=null;
BufferedReader br;
try {
archivo = new File ("estrellas.txt");
if (archivo.exists()){
fr = new FileReader (archivo);
br = new BufferedReader(fr);
// Lectura del fichero
String linea1,linea2,linea3,linea4;
while((linea1=br.readLine())!=null){
linea2=br.readLine();
linea3=br.readLine();
linea4=br.readLine();
Estrella es=new Estrella(Integer.valueOf(linea1),Integer.valueOf(linea2),Integer.valueOf(linea3),Integer.valueOf(linea4));
listaEstrellas.add(es);
}
}
} catch (Exception e){
System.out.println("Error al leer el archivo");
} finally {
try {
fr.close();
} catch (Exception e){
System.out.println("Error al cerrar el archivo");
}
}
}
private void guardarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_guardarMouseClicked
// TODO add your handling code here:
FileWriter fichero = null;
BufferedWriter bw = null;
try
{
fichero = new FileWriter("estrellas.txt");
bw = new BufferedWriter(fichero);
for (Estrella es:listaEstrellas){
bw.write(String.valueOf(es.getX()));
bw.newLine();
bw.write(es.getY()+"");
bw.newLine();
bw.write(es.getVelocidadX()+"");
bw.newLine();
bw.write(es.getVelocidadY()+"");
bw.newLine();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// Nuevamente aprovechamos el finally para
// asegurarnos que se cierra el fichero.
if (null != fichero)
bw.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
}//GEN-LAST:event_guardarMouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton guardar;
private javax.swing.JButton masEstrellas;
private javax.swing.JButton masVelocidad;
private javax.swing.JButton menosEstrellas;
private javax.swing.JButton menosVelocidad;
private javax.swing.JPanel panel;
// End of variables declaration//GEN-END:variables
}
| [
"48472291+7963289@users.noreply.github.com"
] | 48472291+7963289@users.noreply.github.com |
3f1f1fbf16c6d371b52d4f41759413e1c742aacb | 6c6f2428b4247b7aa9f4711931b9f913ba8cd7ee | /src/test/Main5.java | 94882c365ddafc26fb1730f1a524d9f67598bbf9 | [] | no_license | SDIJJ/demo | 5b07811bb2c09734d530100c81f1e47b2507c8ff | 8f9950ac9d5fd6320c8dc50924d92ca7499bafe6 | refs/heads/master | 2020-05-07T09:14:56.686034 | 2019-04-15T11:34:16 | 2019-04-15T11:34:16 | 180,369,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package test;
import java.util.Scanner;
/**
* @Description:
* @author: Arnold
* @since: 2019/3/23 19:47
* @version: v1.0.0
*/
public class Main5 {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int a=in.nextInt();
int b=in.nextInt();
int c=in.nextInt();
if(b>6)
a++;
else {
if(b==6&&c>=6)
a++;
}
int d=in.nextInt();
int count=17;
}
}
| [
"13763799346@163.com"
] | 13763799346@163.com |
083730ca62760af33f51af7c37df6ffc1e4a56d9 | 87938577ff6d801f3577dd88d25cc5e775b9477d | /service/service_vod/src/main/java/com/atguigu/guli/service/vod/util/VodProperties.java | b6eaf49d06561893d4d195e9b6d2eed53b19f246 | [] | no_license | aa209905676/jihu_parent | 427645f69963b2c45fc3cc8e9d410b40dba61298 | 63b9d6a560ca3429cbc4f9c85157d57eebed6d0d | refs/heads/master | 2023-01-03T07:29:34.868043 | 2020-10-28T02:22:54 | 2020-10-28T02:22:54 | 307,370,150 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.atguigu.guli.service.vod.util;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix="aliyun.vod")
public class VodProperties {
private String keyid;
private String keysecret;
private String templateGroupId;
private String workflowId;
} | [
"209905676@qq.com"
] | 209905676@qq.com |
6214ed6988eb8c2b6d5db0a8d22c31cfe0c15135 | c5e24eff0bae0e91767baf88d6563a6ccd91da38 | /src/sumRecursion/sumRecursion.java | d44db2076bf7d9b2763890f97abf5f809bb8d34e | [] | no_license | JosephLashine/sumRecursion | 23304475d0e6ee7fcc4b7666480fbc127ce8f675 | d045206e0a17b0bb3e185275f34c7377981813bf | refs/heads/master | 2021-09-09T03:50:36.515327 | 2018-03-13T16:17:08 | 2018-03-13T16:17:08 | 125,090,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package sumRecursion;
import java.util.*;
public class sumRecursion {
public static int toNumber(String s) {
if (s == null || s.length() == 0) {
return 0;
}
char next = s.charAt(0);
if (Character.isDigit(next)) {
return Character.digit(next, 10) + toNumber(s.substring(1));
} else {
return toNumber(s.substring(1));
}
}
public static void main(String[] args){
Scanner console = new Scanner(System.in);
String toNumber = console.next();
System.out.println(toNumber(toNumber));
}
} | [
"37319619+JosephLashine@users.noreply.github.com"
] | 37319619+JosephLashine@users.noreply.github.com |
1b2fd215288f191153cdab83cd4ba68fd024981c | c7ee65e0eb1fec6f459aa0c16e93208845facfc5 | /UF4/P01/Animal.java | 8d07e1667e81fe311c1c60e7f378adf7ab6dd51a | [] | no_license | harambeisnotdead/M03 | 2ecd46428d019a6efc2f524409212b19e8812f9b | e02d5fcd5c3f2dd3eb991be4a53e8f9f97bb34b8 | refs/heads/master | 2021-09-07T02:00:52.004391 | 2018-02-15T12:47:54 | 2018-02-15T12:47:54 | 108,040,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 104 | java | public abstract class Animal {
int hambre;
public int comer() {
return hambre;
}
}
| [
"harambeisnotdead@users.noreply.github.com"
] | harambeisnotdead@users.noreply.github.com |
290bcdc44e0cdcaa7b0c41ff147459172d2e9437 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/neo4j/2018/4/NetworkRadius.java | ff408c0d1126216699cb046bd3c2bde1a0ceff1b | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 3,381 | java | /*
* Copyright (c) 2002-2018 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.graphalgo.impl.centrality;
import java.util.Comparator;
import java.util.Set;
import org.neo4j.graphalgo.impl.shortestpath.SingleSourceShortestPath;
import org.neo4j.graphdb.Node;
/**
* This can be used to calculate the radius of a network, which is defined as
* the smallest eccentricity of all the nodes in the network.
* @complexity Identical to {@link NetworkDiameter}.
* @author Patrik Larsson
*/
public class NetworkRadius<ShortestPathCostType> extends
ShortestPathBasedCentrality<ShortestPathCostType,ShortestPathCostType>
{
Comparator<ShortestPathCostType> distanceComparator;
// Underlying eccentricity computation
protected Eccentricity<ShortestPathCostType> eccentricity;
protected ShortestPathCostType radius;
/**
* Default constructor.
* @param singleSourceShortestPath
* Underlying singleSourceShortestPath.
* @param zeroValue
* Default value.
* @param nodeSet
* A set containing the nodes for which centrality values should
* be computed.
* @param distanceComparator
* Object being able to compare eccentricity values (path
* distances), in order to sort out the smallest.
*/
public NetworkRadius(
SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath,
ShortestPathCostType zeroValue, Set<Node> nodeSet,
Comparator<ShortestPathCostType> distanceComparator )
{
super( singleSourceShortestPath, null, zeroValue, nodeSet );
this.distanceComparator = distanceComparator;
eccentricity = new Eccentricity<>( singleSourceShortestPath, zeroValue, nodeSet, distanceComparator );
}
@Override
public void processShortestPaths( Node node,
SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath )
{
eccentricity.processShortestPaths( node, singleSourceShortestPath );
ShortestPathCostType centrality = eccentricity.getCentrality( node );
if ( radius == null
|| distanceComparator.compare( centrality, radius ) < 0 )
{
radius = centrality;
}
}
@Override
public ShortestPathCostType getCentrality( Node node )
{
// This might be a bit ugly, but good for warnings
if ( node != null )
{
throw new RuntimeException(
"Getting network radius with a specific node as argument, which means nonsense." );
}
calculate();
return radius;
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
b66c9ade9d8757f02d26e113925618bbb5514a6b | 0adcb787c2d7b3bbf81f066526b49653f9c8db40 | /src/main/java/com/alipay/api/request/AlipayDataIotdataBusinessPointQueryRequest.java | 6dd838fc27e11174ade2230a6214918e9f1a1bb7 | [
"Apache-2.0"
] | permissive | yikey/alipay-sdk-java-all | 1cdca570c1184778c6f3cad16fe0bcb6e02d2484 | 91d84898512c5a4b29c707b0d8d0cd972610b79b | refs/heads/master | 2020-05-22T13:40:11.064476 | 2019-04-11T14:11:02 | 2019-04-11T14:11:02 | 186,365,665 | 1 | 0 | null | 2019-05-13T07:16:09 | 2019-05-13T07:16:08 | null | UTF-8 | Java | false | false | 3,179 | java | package com.alipay.api.request;
import com.alipay.api.domain.AlipayDataIotdataBusinessPointQueryModel;
import java.util.Map;
import com.alipay.api.AlipayRequest;
import com.alipay.api.internal.util.AlipayHashMap;
import com.alipay.api.response.AlipayDataIotdataBusinessPointQueryResponse;
import com.alipay.api.AlipayObject;
/**
* ALIPAY API: alipay.data.iotdata.business.point.query request
*
* @author auto create
* @since 1.0, 2019-02-25 09:30:01
*/
public class AlipayDataIotdataBusinessPointQueryRequest implements AlipayRequest<AlipayDataIotdataBusinessPointQueryResponse> {
private AlipayHashMap udfParams; // add user-defined text parameters
private String apiVersion="1.0";
/**
* 业务点位查询
*/
private String bizContent;
public void setBizContent(String bizContent) {
this.bizContent = bizContent;
}
public String getBizContent() {
return this.bizContent;
}
private String terminalType;
private String terminalInfo;
private String prodCode;
private String notifyUrl;
private String returnUrl;
private boolean needEncrypt=false;
private AlipayObject bizModel=null;
public String getNotifyUrl() {
return this.notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}
public String getReturnUrl() {
return this.returnUrl;
}
public void setReturnUrl(String returnUrl) {
this.returnUrl = returnUrl;
}
public String getApiVersion() {
return this.apiVersion;
}
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
public void setTerminalType(String terminalType){
this.terminalType=terminalType;
}
public String getTerminalType(){
return this.terminalType;
}
public void setTerminalInfo(String terminalInfo){
this.terminalInfo=terminalInfo;
}
public String getTerminalInfo(){
return this.terminalInfo;
}
public void setProdCode(String prodCode) {
this.prodCode=prodCode;
}
public String getProdCode() {
return this.prodCode;
}
public String getApiMethodName() {
return "alipay.data.iotdata.business.point.query";
}
public Map<String, String> getTextParams() {
AlipayHashMap txtParams = new AlipayHashMap();
txtParams.put("biz_content", this.bizContent);
if(udfParams != null) {
txtParams.putAll(this.udfParams);
}
return txtParams;
}
public void putOtherTextParam(String key, String value) {
if(this.udfParams == null) {
this.udfParams = new AlipayHashMap();
}
this.udfParams.put(key, value);
}
public Class<AlipayDataIotdataBusinessPointQueryResponse> getResponseClass() {
return AlipayDataIotdataBusinessPointQueryResponse.class;
}
public boolean isNeedEncrypt() {
return this.needEncrypt;
}
public void setNeedEncrypt(boolean needEncrypt) {
this.needEncrypt=needEncrypt;
}
public AlipayObject getBizModel() {
return this.bizModel;
}
public void setBizModel(AlipayObject bizModel) {
this.bizModel=bizModel;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
a9f5ed4ac67fffe49767eeb9b913d3532310758b | d58445bd08e4dbba9f5629e6801d2ba637171a9a | /rabbitmq/src/test/java/com/mzw/rabbitmq/TopicTest.java | b9cd2bde9a88340915e2d068eb1c852cc6dd378c | [
"Apache-2.0"
] | permissive | blfjvkwfn/mzw | c4db0f1a6364b1a15094681599599980ad6b7590 | ecc4b7ab8c32979fe584c40b48247a00b93bb3d8 | refs/heads/master | 2021-05-04T17:34:27.076703 | 2020-04-29T07:30:50 | 2020-04-29T07:30:50 | 120,274,834 | 0 | 0 | Apache-2.0 | 2020-04-04T13:09:13 | 2018-02-05T08:17:38 | Java | UTF-8 | Java | false | false | 773 | java | package com.mzw.rabbitmq;
import com.mzw.rabbitmq.config.TopicProducer;
import com.mzw.rabbitmq.config.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @author Jonathan Meng
* @date 07/05/2019
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class TopicTest {
@Autowired
private TopicProducer topicProducer;
@Test
public void send() throws InterruptedException {
topicProducer.send(new User("1",1,"Jonathan"));
topicProducer.send(new User("2",2,"Jonathan1"));
topicProducer.send(new User("3",3,"Jonathan3"));
}
}
| [
"blfjvkwfn@126.com"
] | blfjvkwfn@126.com |
c39cbae47088c5ec3346ea7b3eeb12578741bacc | 5e31b34aa05dac142a00d4c9c10e13688b4f7f44 | /AndroidWeatherApp/app/src/main/java/com/inducesmile/weatherapp/ListLocationActivity.java | 41e53217b009089404d04c21059ae84fc812dbd8 | [] | no_license | aghagor/VacheTasks | e2789f5d63519fd78c4cc2b4dc033ef509ce7dde | 702dc0bea1baf1e5d22b28fd8c4ba430a4dd4528 | refs/heads/master | 2021-04-29T14:12:49.633615 | 2018-02-22T19:06:31 | 2018-02-22T19:06:31 | 121,768,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,953 | java | package com.inducesmile.weatherapp;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.inducesmile.weatherapp.adapters.LocationAdapter;
import com.inducesmile.weatherapp.database.DatabaseQuery;
import com.inducesmile.weatherapp.entity.DatabaseLocationObject;
import com.inducesmile.weatherapp.entity.LocationObject;
import com.inducesmile.weatherapp.helpers.Helper;
import com.inducesmile.weatherapp.json.LocationMapObject;
import java.util.ArrayList;
import java.util.List;
public class ListLocationActivity extends AppCompatActivity {
private static final String TAG = ListLocationActivity.class.getSimpleName();
private DatabaseQuery query;
private List<DatabaseLocationObject> allLocations;
private LocationObject locationObject;
private LocationMapObject locationMapObject;
private RequestQueue queue;
private List<LocationObject> allData;
private LocationAdapter locationAdapter;
private RecyclerView locationRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_location);
setTitle(Helper.LOCATION_LIST);
queue = Volley.newRequestQueue(ListLocationActivity.this);
allData = new ArrayList<LocationObject>();
query = new DatabaseQuery(ListLocationActivity.this);
allLocations = query.getStoredDataLocations();
if(null != allLocations){
for(int i = 0; i < allLocations.size(); i++){
// make volley network call here
System.out.println("Response printing " + allLocations.get(i).getLocation());
requestJsonObject(allLocations.get(i));
}
}
Toast.makeText(ListLocationActivity.this, "Count number of locations " + allLocations.size(), Toast.LENGTH_LONG).show();
ImageButton addLocation = (ImageButton) findViewById(R.id.add_location);
addLocation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent addLocationIntent = new Intent(ListLocationActivity.this, AddLocationActivity.class);
startActivity(addLocationIntent);
}
});
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(ListLocationActivity.this);
locationRecyclerView = (RecyclerView) findViewById(R.id.location_list);
locationRecyclerView.setLayoutManager(linearLayoutManager);
}
private void requestJsonObject(final DatabaseLocationObject paramValue){
String url ="http://api.openweathermap.org/data/2.5/weather?q="+paramValue.getLocation()+"&APPID=62f6de3f7c0803216a3a13bbe4ea9914&units=metric";
StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d(TAG, "Response " + response);
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
locationMapObject = gson.fromJson(response, LocationMapObject.class);
if (null == locationMapObject) {
Toast.makeText(getApplicationContext(), "Nothing was returned", Toast.LENGTH_LONG).show();
} else {
int rowId = paramValue.getId();
Long tempVal = Math.round(Math.floor(Double.parseDouble(locationMapObject.getMain().getTemp())));
String city = locationMapObject.getName() + ", " + locationMapObject.getSys().getCountry();
String weatherInfo = String.valueOf(tempVal) + "<sup>o</sup>, " + Helper.capitalizeFirstLetter(locationMapObject.getWeather().get(0).getDescription());
allData.add(new LocationObject(rowId, city, weatherInfo));
locationAdapter = new LocationAdapter(ListLocationActivity.this, allData);
locationRecyclerView.setAdapter(locationAdapter);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d(TAG, "Error " + error.getMessage());
}
});
queue.add(stringRequest);
}
}
| [
"aghagor@gmail.com"
] | aghagor@gmail.com |
f5c12e01c42f53c90511c29b1e0cff6b0d7e76f9 | 0cfd8bae63efd85d02422acc7b9b0257472160d6 | /app/src/main/java/com/example/nemol/googlephotokiller/Controller/DBAlbumController.java | 72bae6d7af5bf248e5d4e7fc4fa53e1afd928126 | [] | no_license | AndreyNemolot/PhotoStorageApp | fe8ed4258d73933e7df83cd7d2efe78e5d13bacb | d63ee00e1a76b16a766da670be5b19aeb8556dea | refs/heads/master | 2021-09-11T00:02:20.256065 | 2018-04-04T15:44:16 | 2018-04-04T15:44:16 | 113,165,061 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,319 | java | package com.example.nemol.googlephotokiller.Controller;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.support.annotation.IntegerRes;
import com.example.nemol.googlephotokiller.Model.ActiveUser;
import com.example.nemol.googlephotokiller.Model.Album;
import com.example.nemol.googlephotokiller.PhotoStoreDBHelper;
public class DBAlbumController implements IDBAlbumController {
private Context context;
private SQLiteOpenHelper DBHelper;
public DBAlbumController(Context context) {
this.context = context;
this.DBHelper = new PhotoStoreDBHelper(context);
}
@Override
public void addAlbum(Album album) {
ContentValues albumValues = new ContentValues();
albumValues.put("_id", album.getAlbumId());
albumValues.put("ALBUM_TITLE", album.getAlbumTitle());
albumValues.put("USER_ID", album.getUserId());
SQLiteDatabase db = DBHelper.getWritableDatabase();
db.insert("ALBUMS", null, albumValues);
db.close();
}
@Override
public void deleteAlbum(int albumId) {
SQLiteDatabase db = DBHelper.getWritableDatabase();
Cursor cursor = db.query("AlBUMS", new String[]{"_id"},
null, null, null, null, null);
if (cursor.moveToFirst()) {
db.delete("ALBUMS", "_id = ?",
new String[]{Integer.toString(albumId)});
}
cursor.close();
db.close();
}
@Override
public boolean albumExist(Album album) {
SQLiteDatabase db = DBHelper.getWritableDatabase();
Cursor cursor = db.query("AlBUMS", new String[]{"_id"},
"_id = ?", new String[]{Integer.toString(album.getAlbumId())},
null, null, null);
return cursor.moveToFirst();
}
@Override
public Cursor getAllAlbums(int userId) {
SQLiteOpenHelper DBHelper = new PhotoStoreDBHelper(context);
SQLiteDatabase db = DBHelper.getReadableDatabase();
return db.query("ALBUMS", new String[]{"_id", "ALBUM_TITLE"},
"USER_ID = ?", new String[]{Integer.toString(userId)},
null, null, null);
}
}
| [
"Nemolota@gmmail.com"
] | Nemolota@gmmail.com |
00f1da296a00207935b1140d153f0ed3865d7e07 | 5e8f8c8b9c0d17efce9ba29728add130da3f0cd2 | /src/test/java/org/assertj/core/internal/files/Files_assertHasDigest_AlgorithmString_Test.java | 75735715e17dd91716583be4fd695d9c8caf0b03 | [
"Apache-2.0"
] | permissive | eddumelendez/assertj-core | 06de99fb647563ca0908ceab012a08beeda9729a | 38b6e47c0114dc0e11d3753421e17db57f6b42b0 | refs/heads/master | 2020-05-25T01:45:57.248642 | 2019-05-19T21:29:36 | 2019-05-19T21:29:36 | 187,563,364 | 0 | 0 | NOASSERTION | 2019-05-20T03:43:08 | 2019-05-20T03:43:08 | null | UTF-8 | Java | false | false | 6,476 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2012-2019 the original author or authors.
*/
package org.assertj.core.internal.files;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatNullPointerException;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.assertj.core.error.ShouldBeFile.shouldBeFile;
import static org.assertj.core.error.ShouldBeReadable.shouldBeReadable;
import static org.assertj.core.error.ShouldExist.shouldExist;
import static org.assertj.core.error.ShouldHaveDigest.shouldHaveDigest;
import static org.assertj.core.test.TestData.someInfo;
import static org.assertj.core.util.FailureMessages.actualIsNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.assertj.core.api.AssertionInfo;
import org.assertj.core.internal.DigestDiff;
import org.assertj.core.internal.Digests;
import org.assertj.core.internal.Files;
import org.assertj.core.internal.FilesBaseTest;
import org.junit.jupiter.api.Test;
/**
* Tests for <code>{@link Files#assertHasDigest(AssertionInfo, File, MessageDigest, String)}</code>
*
* @author Valeriy Vyrva
*/
public class Files_assertHasDigest_AlgorithmString_Test extends FilesBaseTest {
private final String algorithm = "MD5";
private final String expected = "";
private final String real = "3AC1AFA2A89B7E4F1866502877BF1DC5";
@Test
public void should_fail_if_actual_is_null() {
AssertionInfo info = someInfo();
assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> files.assertHasDigest(info, null, algorithm, expected))
.withMessage(actualIsNull());
}
@Test
public void should_fail_with_should_exist_error_if_actual_does_not_exist() {
// GIVEN
given(actual.exists()).willReturn(false);
// WHEN
catchThrowable(() -> files.assertHasDigest(INFO, actual, algorithm, expected));
// THEN
verify(failures).failure(INFO, shouldExist(actual));
}
@Test
public void should_fail_if_actual_exists_but_is_not_file() {
// GIVEN
given(actual.exists()).willReturn(true);
given(actual.isFile()).willReturn(false);
// WHEN
catchThrowable(() -> files.assertHasDigest(INFO, actual, algorithm, expected));
// THEN
verify(failures).failure(INFO, shouldBeFile(actual));
}
@Test
public void should_fail_if_actual_exists_but_is_not_readable() {
// GIVEN
given(actual.exists()).willReturn(true);
given(actual.isFile()).willReturn(true);
given(actual.canRead()).willReturn(false);
// WHEN
catchThrowable(() -> files.assertHasDigest(INFO, actual, algorithm, expected));
// THEN
verify(failures).failure(INFO, shouldBeReadable(actual));
}
@Test
public void should_throw_error_if_digest_is_null() {
assertThatNullPointerException().isThrownBy(() -> files.assertHasDigest(INFO, null, (MessageDigest) null, expected))
.withMessage("The message digest algorithm should not be null");
}
@Test
public void should_throw_error_if_expected_is_null() {
assertThatNullPointerException().isThrownBy(() -> files.assertHasDigest(INFO, null, algorithm, (byte[]) null))
.withMessage("The binary representation of digest to compare to should not be null");
}
@Test
public void should_throw_error_wrapping_catched_IOException() throws IOException {
// GIVEN
IOException cause = new IOException();
given(actual.exists()).willReturn(true);
given(actual.isFile()).willReturn(true);
given(actual.canRead()).willReturn(true);
given(nioFilesWrapper.newInputStream(any())).willThrow(cause);
// WHEN
Throwable error = catchThrowable(() -> files.assertHasDigest(INFO, actual, algorithm, expected));
// THEN
assertThat(error).isInstanceOf(UncheckedIOException.class)
.hasCause(cause);
}
@Test
public void should_throw_error_wrapping_catched_NoSuchAlgorithmException() {
// GIVEN
String unknownDigestAlgorithm = "UnknownDigestAlgorithm";
// WHEN
Throwable error = catchThrowable(() -> files.assertHasDigest(INFO, actual, unknownDigestAlgorithm, expected));
// THEN
assertThat(error).isInstanceOf(IllegalStateException.class)
.hasMessage("Unable to find digest implementation for: <UnknownDigestAlgorithm>");
}
@Test
public void should_fail_if_actual_does_not_have_expected_digest() throws IOException, NoSuchAlgorithmException {
// GIVEN
InputStream stream = getClass().getResourceAsStream("/red.png");
given(actual.exists()).willReturn(true);
given(actual.isFile()).willReturn(true);
given(actual.canRead()).willReturn(true);
given(nioFilesWrapper.newInputStream(any())).willReturn(stream);
// WHEN
catchThrowable(() -> files.assertHasDigest(INFO, actual, algorithm, expected));
// THEN
verify(failures).failure(INFO, shouldHaveDigest(actual, new DigestDiff(real, "", MessageDigest.getInstance(algorithm))));
failIfStreamIsOpen(stream);
}
@Test
public void should_pass_if_actual_has_expected_digest() throws IOException {
// GIVEN
InputStream stream = getClass().getResourceAsStream("/red.png");
given(actual.exists()).willReturn(true);
given(actual.isFile()).willReturn(true);
given(actual.canRead()).willReturn(true);
given(nioFilesWrapper.newInputStream(any())).willReturn(stream);
// WHEN
files.assertHasDigest(INFO, actual, algorithm, Digests.fromHex(real));
// THEN
failIfStreamIsOpen(stream);
}
}
| [
"joel.costigliola@gmail.com"
] | joel.costigliola@gmail.com |
146fbfc2c25bf8d92d4d880cc3ede431d68d2b1f | f54fd89e8c6c6d9035872a05c8a30e6acc697844 | /Zajecia_1/src/mod13/ex02/NoSuchTripException.java | 8a5aa6d1edd445df7044daefff76f519bce15cee | [] | no_license | szczeprez/Altkom_Szkolenie | 86a8a293ec0b5b93654c5b3ae283ac8c7a0fcd38 | 924b4dfd6555ff2aa96bb3d336f5b2df4f061c5d | refs/heads/master | 2020-12-31T05:09:50.544973 | 2016-05-23T12:43:19 | 2016-05-23T12:43:19 | 59,481,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package mod13.ex02;
public class NoSuchTripException extends Exception {
private static final long serialVersionUID = 1L;
public NoSuchTripException() {
}
public NoSuchTripException(String message) {
super(message);
}
public NoSuchTripException(Throwable cause) {
super(cause);
}
public NoSuchTripException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"Altkom@ml9"
] | Altkom@ml9 |
e84644d8258ede93a68d88bf67ac8370f3aa49ea | 420dfa79bdf76beb18c4d33700fa48d184bc6827 | /app/src/main/java/fragment/FindFragment.java | 5a7056e8208f063a600eb616350d464a0fd0ba38 | [] | no_license | JaniceLibra/WeEnjoyTheWorld | dfb868bfff32ab170a84cf92131337f1a66d5920 | 0fcd23348ce3579839c82eb64e8a62328e9b37b8 | refs/heads/master | 2021-01-20T17:54:55.198505 | 2016-07-25T14:08:47 | 2016-07-25T14:08:47 | 64,118,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.three.enjoytheworld.R;
/**
* A simple {@link Fragment} subclass.
*/
public class FindFragment extends Fragment {
public FindFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_find, container, false);
}
}
| [
"janice_sunshine@163.com"
] | janice_sunshine@163.com |
04ff4d137d2867bf29291428913d4aec822d436d | 3b20ee5b97ba398cff5c4de31d3e9432ff7802a4 | /STABLEProjectv4_Latest/src/main/java/org/stable/sdk/model/measurement/sugar/glucoselevel/GlucoseLevel_Method_Type.java | e1100495d93aeddee871e714012d711666911152 | [] | no_license | abhijeetkushe/Advance-Application-Engineering | 4015677ef74ad0e9368c68279c91f314bc57bef3 | 3bab6e512b050a8f0889030e472f9e3a000743ee | refs/heads/master | 2020-06-02T19:47:03.324200 | 2014-11-28T22:40:37 | 2014-11-28T22:40:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package org.stable.sdk.model.measurement.sugar.glucoselevel;
import org.stable.sdk.model.measurement.IMethodType;
public enum GlucoseLevel_Method_Type implements IMethodType {
Serum, BedSide;
private GlucoseLevel_Method_Type() {
// TODO Auto-generated constructor stub
}
public String methodDescription() {
return "GlucoseLevel Screening AT " + this.name();
}
public int getId() {
// TODO Auto-generated method stub
return this.ordinal();
}
}
| [
"abhijeet.kushe@gmail.com"
] | abhijeet.kushe@gmail.com |
a046072fbf79cbaaa6673ef75d6d4b1789b8107b | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-eks/src/main/java/com/amazonaws/services/eks/model/transform/CreateAddonResultJsonUnmarshaller.java | 42d27446bda17f432cf46dc707fed6141a816a96 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 2,757 | java | /*
* Copyright 2017-2022 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.eks.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.eks.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* CreateAddonResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateAddonResultJsonUnmarshaller implements Unmarshaller<CreateAddonResult, JsonUnmarshallerContext> {
public CreateAddonResult unmarshall(JsonUnmarshallerContext context) throws Exception {
CreateAddonResult createAddonResult = new CreateAddonResult();
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 createAddonResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("addon", targetDepth)) {
context.nextToken();
createAddonResult.setAddon(AddonJsonUnmarshaller.getInstance().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 createAddonResult;
}
private static CreateAddonResultJsonUnmarshaller instance;
public static CreateAddonResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new CreateAddonResultJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
90c7af6cd3407b64a1d73a61e6dc3501dbe6b6d7 | 83ca076aae91b6934c94f9092812b6cff31c89ff | /src/main/java/org/openjfx/App.java | 44812ae9dc4dc0c81b5f4d3305473cb571e17dad | [] | no_license | AnastasiaShubaeva/BankApplication | ca830da577844e8bbefa09fb81f366636bad8649 | ddf30ae347bf63546632ec39cec5874d896be0eb | refs/heads/master | 2023-02-05T21:48:14.167638 | 2020-12-23T09:47:07 | 2020-12-23T09:47:07 | 323,845,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,339 | java | package org.openjfx;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* JavaFX App
*/
public class App extends Application {
private Bank bank; //Основной класс приложения
private final String FILENAME = "bank.dat"; //Файл для хранения текущего состояния
private HBox holders = new HBox(20); //Список клиентов
private VBox holdersColumn1 = new VBox(); //Колонка "ИМЯ"
private VBox holdersColumn2 = new VBox(); //Колонка "ФАМИЛИЯ"
private VBox holdersColumn3 = new VBox(); //Колонка "ДАТА РОЖДЕНИЯ"
private VBox holdersColumn4 = new VBox(); //Колонка "СПИСОК СЧЕТОВ"
private HBox accounts = new HBox(20); //Список счетов
private VBox accountsColumn1 = new VBox(); //Колонка "НОМЕР СЧЁТА"
private VBox accountsColumn2 = new VBox(); //Колонка "ВЛАДЕЛЕЦ СЧЁТА"
private VBox accountsColumn3 = new VBox(); //Колонка "БАЛАНС"
private VBox accountsColumn4 = new VBox(); //Колонка "ОТКРЫТ(TRUE)/ЗАКРЫТ(FALSE)"
@Override
public void start(Stage primaryStage) {
Alert alert = new Alert(Alert.AlertType.INFORMATION,
"Восстановить предыдущее состояние?", ButtonType.YES, ButtonType.NO);
alert.setTitle("Требуется подтверждение");
alert.setHeaderText("Запрос к пользователю");
String response = alert.showAndWait().get().getText();
if (response.equals("Yes")) {
try {
bank = new Bank(FILENAME);
listHolders();
listAccounts();
showInfo("Информация загружена");
} catch (Exception e) {
showError("Ошибка при открытии файла");
System.exit(1); //Выход из программы с ошибкой
}
} else {
try {
bank = new Bank();
} catch (BankException ae) {
showError(ae.getMessage());
System.exit(1); //Выход из программы с ошибкой
} catch (Exception e) {
showError(e.getMessage());
System.exit(1); //Выход из программы с ошибкой
}
}
VBox root = initGUI();
primaryStage.setTitle("БАНК");
primaryStage.setScene(new Scene(root, 1000, 700));
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.show();
}
public static void main(String[] args) {
launch();
}
private VBox initGUI() {
VBox root = new VBox();
TabPane tabPane = new TabPane();
Tab tab1 = new Tab("Управление банковскими счетами");
Tab tab2 = new Tab("Клиенты");
Tab tab3 = new Tab("Банковские счета");
tabPane.getTabs().addAll(tab1, tab2, tab3);
MenuBar bar = new MenuBar();
bar.setMinHeight(25);
Menu item = new Menu("Файл");
Menu saveAndContinueOption = new Menu("Сохранить и продолжить");
Menu saveAndExitOption = new Menu("Сохранить и выйти");
Menu exitWithoutSavingOption = new Menu("Выйти без сохранения");
item.getItems().addAll(saveAndContinueOption, saveAndExitOption, exitWithoutSavingOption);
bar.getMenus().add(item);
try {
saveAndContinueOption.setOnAction(e -> save(FILENAME));
saveAndExitOption.setOnAction(e -> {
save(FILENAME);
Platform.exit();
});
exitWithoutSavingOption.setOnAction(e -> exitWithoutSaving());
} catch (Exception e) {
showError("Некорректная операция");
}
tab1.setContent(initManageBox());
holders.setPadding(new Insets(10));
holders.getChildren().addAll(holdersColumn1, holdersColumn2, holdersColumn3, holdersColumn4);
tab2.setContent(holders);
accounts.setPadding(new Insets(10));
accounts.getChildren().addAll(accountsColumn1, accountsColumn2, accountsColumn3, accountsColumn4);
tab3.setContent(accounts);
root.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID,
new CornerRadii(0), new BorderWidths(2))));
root.getChildren().addAll(bar, tabPane);
return root;
}
/**
* Создание вкладки с управлением
* @return Вкладка с управлением системой
*/
private VBox initManageBox() {
VBox box = new VBox();
box.setMinHeight(400);
box.setAlignment(Pos.BOTTOM_LEFT);
Label label = new Label("Выберите действие:");
HBox controls = new HBox(10);
Button button1 = new Button("Регистрация клиента");
button1.setTooltip(new Tooltip("Регистрация клиента в банке"));
Button button2 = new Button("Открытие счёта");
button2.setTooltip(new Tooltip("Открытие банковского счёта"));
Button button3 = new Button("Закрытие счёта");
button3.setTooltip(new Tooltip("Закрытие банковского счёта"));
Button button4 = new Button("История операций");
button4.setTooltip(new Tooltip("История операций по счёту"));
Button button5 = new Button("Пополнение счёта");
button5.setTooltip(new Tooltip("Пополнение банковского счёта"));
Button button6 = new Button("Снятие средств");
button6.setTooltip(new Tooltip("Снятие средств с банковского счета"));
Button button7 = new Button("Перевод между счетами");
button7.setTooltip(new Tooltip("Перевед между банковскими счетами"));
Button button8 = new Button("Баланс");
button8.setTooltip(new Tooltip("Пулучение информации о балансе банковского счёта"));
controls.getChildren().addAll(button1, button2, button3, button4, button5, button6, button7, button8);
box.getChildren().addAll(label, controls);
try {
button1.setOnAction(e -> registerHolder());
button2.setOnAction(e -> openAcc());
button3.setOnAction(e -> closeAcc());
button4.setOnAction(e -> getHistoryOperation());
button5.setOnAction(e -> deposit());
button6.setOnAction(e -> withdrawal());
button7.setOnAction(e -> transition());
button8.setOnAction(e -> getBalance());
} catch (Exception e) {
showError("Некорректная операция");
}
return box;
}
/**
* Получение баланса счёта
*
*/
private void getBalance(){
String numberIn;
try {
numberIn = getAccountNo("Получение баланса счёта");
try {
int accNum = Integer.parseInt(numberIn.trim());
showInfo("Баланс стёта №"+accNum + ": " + bank.getAccBalance(accNum));
}catch (NumberFormatException nfe){
showError(nfe.getMessage());
}
}catch (BankException be) {
showError(be.getMessage());
}
listAccounts();
}
/**
* Перевод средств между счетами
*/
private void transition(){
String numberIn, numberTo, money;
try {
numberIn = getAccountNo("Счёт отправитель");
numberTo = getAccountNo("Счёт получатель");
TextInputDialog dialog = new TextInputDialog();
dialog.setHeaderText("Введите сумму перевода");
dialog.setTitle("Форма ввода суммы перевода");
money = dialog.showAndWait().get();
checkIfEmpty(money, "Не введена сумма перевода");
try {
int accNumFrom = Integer.parseInt(numberIn.trim());
int accNumTo = Integer.parseInt(numberTo.trim());
int summa = Integer.parseInt(money.trim());
bank.transferBetweenAccounts(accNumFrom, accNumTo, summa);
showInfo("Средства между счетами успешно переведены");
}catch (NumberFormatException nfe){
showError(nfe.getMessage());
}
}catch (BankException be) {
showError(be.getMessage());
}
listAccounts();
}
/**
* Снятие средств со счёта
*/
private void withdrawal(){
String numberIn, money;
try {
numberIn = getAccountNo("Форма снятия средств со счёта");
TextInputDialog dialog = new TextInputDialog();
dialog.setHeaderText("Введите сумму снятия");
dialog.setTitle("Форма ввода суммы снятия");
money = dialog.showAndWait().get();
checkIfEmpty(money, "Не введена сумма снятия");
try {
int accNum = Integer.parseInt(numberIn.trim());
int summa = Integer.parseInt(money.trim());
bank.withdrawalFromAnAccount(accNum, summa);
showInfo("Средства со счёта успешно сняты");
}catch (NumberFormatException nfe){
showError(nfe.getMessage());
}
}catch (BankException be) {
showError(be.getMessage());
}
listAccounts();
}
/**
* Пополнение счёта
*/
private void deposit(){
String numberIn, money;
try {
numberIn = getAccountNo("Форма пополнения счёта");
TextInputDialog dialog = new TextInputDialog();
dialog.setHeaderText("Введите сумму пополнения");
dialog.setTitle("Форма ввода суммы пополнения");
money = dialog.showAndWait().get();
checkIfEmpty(money, "Не введена сумма пополнения");
try {
int accNum = Integer.parseInt(numberIn.trim());
int summa = Integer.parseInt(money.trim());
bank.depositIntoAccount(accNum, summa);
showInfo("Счёт успешно пополнен");
}catch (NumberFormatException nfe){
showError(nfe.getMessage());
}
}catch (BankException be) {
showError(be.getMessage());
}
listAccounts();
}
/**
* Регистрация нового клиента в банке
*/
private void registerHolder() {
String name, surname, dateOfBirth;
try {
TextInputDialog dialog = new TextInputDialog();
dialog.setHeaderText("Введите свое имя");
dialog.setTitle("Форма открытия счёта");
name = dialog.showAndWait().get();
checkIfEmpty(name, "Не указано имя");
dialog.getEditor().clear();
dialog.setHeaderText("Введите свою фамилию");
surname = dialog.showAndWait().get();
checkIfEmpty(surname, "Не указана фамилия");
dialog.getEditor().clear();
dialog.setHeaderText("Введите дату рождения в формате дд.мм.гггг");
dateOfBirth = dialog.showAndWait().get();
checkIfEmpty(dateOfBirth, "Не указана дата рождения");
try{
SimpleDateFormat curFormater = new SimpleDateFormat("dd.MM.yyyy");
Date dateObj = curFormater.parse(dateOfBirth);
Calendar calendar = Calendar.getInstance();
calendar.setTime(dateObj);
bank.registrationHolder(name, surname, calendar);
showInfo("Регистрация прошла успешно");
}catch (ParseException pe){
showError(pe.getMessage());
}
}catch (BankException be) {
showError(be.getMessage());
}
listHolders();
}
/**
* Открытие счёта в банке
*/
private void openAcc(){
String name, surname, dateOfBirth, number;
try {
TextInputDialog dialog = new TextInputDialog();
dialog.setHeaderText("Введите свое имя");
dialog.setTitle("Форма открытия счёта");
name = dialog.showAndWait().get();
checkIfEmpty(name, "Не указано имя");
dialog.getEditor().clear();
dialog.setHeaderText("Введите свою фамилию");
surname = dialog.showAndWait().get();
checkIfEmpty(surname, "Не указана фамилия");
dialog.getEditor().clear();
dialog.setHeaderText("Введите дату рождения в формате дд.мм.гггг");
dateOfBirth = dialog.showAndWait().get();
checkIfEmpty(dateOfBirth, "Не указана дата рождения");
number = getAccountNo("Форма открытия счёта");
try{
SimpleDateFormat curFormater = new SimpleDateFormat("dd.MM.yyyy");
Date dateObj = curFormater.parse(dateOfBirth);
Calendar calendar = Calendar.getInstance();
calendar.setTime(dateObj);
int num = Integer.parseInt(number.trim());
if (bank.alreadyRegistered(name, surname, calendar)){
AccountHolder holder = bank.getHolders().stream().filter(i-> i.getName().equals(name)).filter(i-> i.getSurname().equals(surname))
.filter(i-> i.getDateOfBirth().equals(calendar)).findFirst().get();
bank.openingAccount(holder, num);
}else {
bank.registrationHolder(name, surname, calendar);
AccountHolder holder = bank.getHolders().stream().filter(i-> i.getName().equals(name)).filter(i-> i.getSurname().equals(surname))
.filter(i-> i.getDateOfBirth().equals(calendar)).findFirst().get();
bank.openingAccount(holder, num);
showInfo("Счёт успешно открыт");
}
}catch (ParseException pe){
showError(pe.getMessage());
}
} catch (BankException be) {
showError(be.getMessage());
}
listHolders();
listAccounts();
}
/**
* Закрытие счёта в банке
*/
private void closeAcc(){
String number;
try {
number = getAccountNo("Форма закрытия счёта");
try {
int accNum = Integer.parseInt(number.trim());
bank.closingAccount(accNum);
showInfo("Счёт успешно закрыт");
}catch (NumberFormatException nfe){
showError(nfe.getMessage());
}
}catch (BankException be) {
showError(be.getMessage());
}
listAccounts();
listHolders();
}
/**
* Получение истории операций по счёту
*/
private void getHistoryOperation(){
String number;
HashMap<Calendar, String> historyMap;
VBox root = new VBox(10);
HBox historyOperations = new HBox(20);
HBox name = new HBox();
VBox dates = new VBox();
VBox messages = new VBox();
Stage historyStage = new Stage();
try {
number = getAccountNo("Форма получения истории операций по счёту");
try {
int accNum = Integer.parseInt(number.trim());
historyMap = bank.history(accNum);
name.getChildren().add(new Text("СЧЁТ №" + number));
Map<Calendar, String> treeMap = new TreeMap<>(
(Comparator<Calendar>) (o1, o2) -> o2.compareTo(o1)*(-1)
);
treeMap.putAll(historyMap);
SimpleDateFormat formattedDate = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");
for (Calendar key : treeMap.keySet()) {
dates.getChildren().add(new Text(formattedDate.format(key.getTime())));
messages.getChildren().add(new Text(historyMap.get(key)));
}
historyOperations.getChildren().addAll( dates, messages);
root.getChildren().addAll(name, historyOperations);
historyStage.setTitle("ИСТОРИЯ ОПЕРАЦИЙ");
historyStage.setScene(new Scene(root, 600, 600));
historyStage.initStyle(StageStyle.UTILITY);
historyStage.show();
}catch (NumberFormatException nfe){
showError(nfe.getMessage());
}
}catch (BankException be) {
showError(be.getMessage());
}
}
/**
* Получение номера счета от пользователя
* @param title Текст заголовка
* @return Номер счета
* @throws BankException Ошибка при получении номера рейса
*/
private String getAccountNo(String title) throws BankException {
TextInputDialog dialog = new TextInputDialog();
dialog.setHeaderText("Введите номер счета");
dialog.setTitle(title);
String accountNo = dialog.showAndWait().get();
checkIfEmpty(accountNo, "Не указан номер счета");
return accountNo;
}
/**
* Выход без сохранения
*/
private void exitWithoutSaving() {
Alert alert = new Alert(Alert.AlertType.WARNING, "Вы уверены? Все данные будут потеряны",
ButtonType.YES, ButtonType.CANCEL);
alert.setTitle("Требуется подтверждение");
alert.setHeaderText("Предупреждение");
String response = alert.showAndWait().get().getText();
if (response.equals("Yes"))
Platform.exit();
}
/**
* Список клиентов
*/
private void listHolders() {
List<AccountHolder> holdersList = bank.getHolders();
holdersColumn1.getChildren().clear();
holdersColumn2.getChildren().clear();
holdersColumn3.getChildren().clear();
holdersColumn4.getChildren().clear();
holdersColumn1.getChildren().add(new Text("ИМЯ"));
holdersColumn2.getChildren().add(new Text("ФАМИЛИЯ"));
holdersColumn3.getChildren().add(new Text("ДАТА РОЖДЕНИЯ"));
holdersColumn4.getChildren().add(new Text("СПИСОК СЧЕТОВ"));
for (AccountHolder holder : holdersList) {
holdersColumn1.getChildren().add(new Text(holder.getName()));
holdersColumn2.getChildren().add(new Text(holder.getSurname()));
try {
SimpleDateFormat formattedDate = new SimpleDateFormat("dd.MM.yyyy");
holdersColumn3.getChildren().add(new Text(formattedDate.format(holder.getDateOfBirth().getTime())));
} catch (Exception e) {
holdersColumn3.getChildren().add(new Text(""));
}
holdersColumn4.getChildren().add(new Text(holder.getAccountList().stream().map(BankAccount::getNumber).collect(Collectors.toList()).toString()));
}
}
/**
* Список банковских счетов
*/
private void listAccounts() {
List<BankAccount> accountsList = bank.getBankAccounts();
accountsColumn1.getChildren().clear();
accountsColumn2.getChildren().clear();
accountsColumn3.getChildren().clear();
accountsColumn4.getChildren().clear();
accountsColumn1.getChildren().add(new Text("НОМЕР СЧЁТА"));
accountsColumn2.getChildren().add(new Text("ВЛАДЕЛЕЦ СЧЁТА"));
accountsColumn3.getChildren().add(new Text("БАЛАНС"));
accountsColumn4.getChildren().add(new Text("ОТКРЫТ(TRUE)/ЗАКРЫТ(FALSE)"));
for (BankAccount account : accountsList) {
accountsColumn1.getChildren().add(new Text(""+account.getNumber()));
accountsColumn2.getChildren().add(new Text(account.getHolder().getName() + " " + account.getHolder().getSurname()));
accountsColumn3.getChildren().add(new Text(""+account.getBalance()));
accountsColumn4.getChildren().add(new Text(""+account.isOpen()));
}
}
/**
* Сохранение данных
* @param fileName Имя файла
*/
private void save(String fileName) {
try {
bank.save(fileName);
showInfo("Данные сохранены");
} catch (Exception e) {
showError("Ошибка при сохранении файла");
}
}
/**
* Отображение информации
* @param msg Сообщение
*/
private void showInfo(String msg) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setHeaderText("Информация о системе");
alert.setContentText(msg);
alert.showAndWait();
}
/**
* Отображение ошибки
* @param msg Сообщение
*/
private void showError(String msg) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setHeaderText("Ошибка в системе");
alert.setContentText(msg);
alert.showAndWait();
}
private void checkIfEmpty(String s, String errorMsg) {
if (s.equals(""))
throw new BankException(errorMsg);
}
} | [
"nastya.shubaeva@gmail.com"
] | nastya.shubaeva@gmail.com |
fe9f45a777b9675d115e3b9726984fcbcb675721 | bbd75268565b13f06638f962ceb74e912bb2fa76 | /gerenciador_back/src/br/com/alura/gerenciador/acao/ListaEmpresas.java | f2744c3b6f2e95ddfc3a4ba58c4ccefaa0743d37 | [] | no_license | gustavobhm/Curso-de-Java-Servlet-parte-2-Autentica-o-autoriza-o-e-o-padr-o-MVC | ff225292c5aecbb28131d3ca6588d0afb69f8547 | caa40f15a28743d8701ed940e7b2e2439ee6b42b | refs/heads/master | 2020-04-30T16:07:59.459984 | 2019-04-02T12:26:36 | 2019-04-02T12:26:36 | 176,939,861 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 704 | java | package br.com.alura.gerenciador.acao;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import br.com.alura.gerenciador.modelo.Banco;
import br.com.alura.gerenciador.modelo.Empresa;
public class ListaEmpresas implements Acao{
public String executa(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("Ação listando empresas");
Banco banco = new Banco();
List<Empresa> lista = banco.getEmpresas();
request.setAttribute("empresas", lista);
return "forward:listaEmpresas.jsp";
}
}
| [
"gustavobhm@bol.com.br"
] | gustavobhm@bol.com.br |
b7c2a8f6407a08b9c58f4e701ed822c13516809b | dcc5095344e2fcdeb585934fcf2b4adf90377141 | /MutuaSMSAppEngineHangmanTests/src/instantvas/nativewebserver/NativeHTTPServerBehavioralTests.java | f203d3bf4d8760fb69e03cf85661f1c8bafdd45d | [] | no_license | zertyz/InstantVAS-backend-java-opensource | 344577e33652e433b13ad12b340ebd5310560b14 | 61f74836a0ea88c8a8098a13394b4fd191d373a9 | refs/heads/master | 2020-04-15T07:52:55.066041 | 2018-10-05T23:14:09 | 2018-10-05T23:14:09 | 164,505,447 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,360 | java | package instantvas.nativewebserver;
import static org.junit.Assert.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import org.junit.Test;
import com.sun.net.httpserver.HttpExchange;
/** <pre>
* NativeHTTPServerBehavioralTests.java
* ====================================
* (created by luiz, Jan 7, 2016)
*
* Tests both the common aspects of the native http server, as well as application specific behavior,
* through configuration & log files
*
* @see RelatedClass(es)
* @version $Id$
* @author luiz
*/
public class NativeHTTPServerBehavioralTests {
@Test
public void testRetrieveGetParameters() throws UnsupportedEncodingException {
HashMap<String, String> parameters = NativeHTTPServer.retrieveGetParameters("a=b&c=d&e=&");
assertEquals("parameter 'a' was wrongly parsed", "b", parameters.get("a"));
assertEquals("parameter 'c' was wrongly parsed", "d", parameters.get("c"));
assertEquals("parameter 'e' was wrongly parsed", "", parameters.get("e"));
assertNull("non existing parameter should have a null value", parameters.get("nonexistingparametername"));
parameters = NativeHTTPServer.retrieveGetParameters("a=bcde&");
assertEquals("parameter 'a' was wrongly parsed", "bcde", parameters.get("a"));
parameters = NativeHTTPServer.retrieveGetParameters("abcde");
assertEquals("parameter 'abcde' was wrongly parsed", "", parameters.get("abcde"));
parameters = NativeHTTPServer.retrieveGetParameters("=abcde");
assertEquals("parameter '' was wrongly parsed", "abcde", parameters.get(""));
parameters = NativeHTTPServer.retrieveGetParameters("sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8&q=this+is+just+an+UTF-8+URLEncoded+test+which+may+contain+several+characters%2C+such+as+%C3%87%C2%A7%3D%26%3F%25+and%2C+possibly%2C+others...&es_th=1");
assertEquals("parameter 'q' was wrongly parsed", "this is just an UTF-8 URLEncoded test which may contain several characters, such as ǧ=&?% and, possibly, others...", parameters.get("q"));
}
@Test
public void testRetrieveStrictGetParameters() throws UnsupportedEncodingException {
String[] parameterNames = {"a", "c", "e", "nonexistingparametername"};
String[] parameterValues = NativeHTTPServer.retrieveStrictGetParameters(parameterNames, "a=b&c=d&e=&");
assertEquals("parameter 'a' was wrongly parsed", "b", parameterValues[0]);
assertEquals("parameter 'c' was wrongly parsed", "d", parameterValues[1]);
assertEquals("parameter 'e' was wrongly parsed", "", parameterValues[2]);
assertNull("non existing parameter should have a null value", parameterValues[3]);
parameterValues = NativeHTTPServer.retrieveStrictGetParameters(parameterNames, "a=bcde&");
assertEquals("parameter 'a' was wrongly parsed", "bcde", parameterValues[0]);
parameterValues = NativeHTTPServer.retrieveStrictGetParameters(parameterNames, "abcde");
assertNull("non existing parameter should have a null value", parameterValues[0]);
assertNull("non existing parameter should have a null value", parameterValues[1]);
assertNull("non existing parameter should have a null value", parameterValues[2]);
assertNull("non existing parameter should have a null value", parameterValues[3]);
parameterValues = NativeHTTPServer.retrieveStrictGetParameters(parameterNames, "=abcde");
assertNull("non existing parameter should have a null value", parameterValues[0]);
assertNull("non existing parameter should have a null value", parameterValues[1]);
assertNull("non existing parameter should have a null value", parameterValues[2]);
assertNull("non existing parameter should have a null value", parameterValues[3]);
parameterValues = NativeHTTPServer.retrieveStrictGetParameters(parameterNames, "sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8&q=this+is+just+an+UTF-8+URLEncoded+test+which+may+contain+several+characters%2C+such+as+%C3%87%C2%A7%3D%26%3F%25+and%2C+possibly%2C+others...&a=0&c=1&e=2&es_th=1");
assertEquals("parameter 'a' was wrongly parsed", "0", parameterValues[0]);
assertEquals("parameter 'c' was wrongly parsed", "1", parameterValues[1]);
assertEquals("parameter 'e' was wrongly parsed", "2", parameterValues[2]);
}
@Test
public void testUTF8() throws UnsupportedEncodingException {
// query string as defined on a default (unconfigured) tomcat instance
String queryString = new String("game=forca&cirillic=%D0%9A%D0%BE%D0%B1%D0%B8".getBytes(), "ISO-8859-1");
HashMap<String, String> parameters = NativeHTTPServer.retrieveGetParameters(queryString);
assertEquals("parameter 'game' was wrongly decoded", "forca", parameters.get("game"));
assertEquals("parameter 'cirillic' was wrongly decoded", "Коби", parameters.get("cirillic"));
}
@Test
public void performanceTests() throws UnsupportedEncodingException {
int count = 1000000;
String[] parameterNames = {"a", "c", "e", "nonexistingparametername"};
long start;
long elapsed;
start = System.currentTimeMillis();
for (int i=0; i<count; i++) {
String[] parameterValues = NativeHTTPServer.retrieveStrictGetParameters(parameterNames, "sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8&q=this+is+just+an+UTF-8+URLEncoded+test+which+may+contain+several+characters%2C+such+as+%C3%87%C2%A7%3D%26%3F%25+and%2C+possibly%2C+others...&a=0&c=1&e=2&es_th=1");
String a = parameterValues[0];
String c = parameterValues[1];
String e = parameterValues[2];
if ((!"0".equals(a) || (!"1".equals(c)) || (!"2".equals(e)))) {
fail("strict parsing failed at i="+i);
}
}
elapsed = System.currentTimeMillis() - start;
System.out.println("Strict Parsing Time ms: "+elapsed);
start = System.currentTimeMillis();
for (int i=0; i<count; i++) {
HashMap<String, String> parameters = NativeHTTPServer.retrieveGetParameters("sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8&q=this+is+just+an+UTF-8+URLEncoded+test+which+may+contain+several+characters%2C+such+as+%C3%87%C2%A7%3D%26%3F%25+and%2C+possibly%2C+others...&a=0&c=1&e=2&es_th=1");
String a = parameters.get("a");
String c = parameters.get("c");
String e = parameters.get("e");
if ((!"0".equals(a) || (!"1".equals(c)) || (!"2".equals(e)))) {
fail("normal parsing failed at i="+i);
}
}
elapsed = System.currentTimeMillis() - start;
System.out.println("Normal Parsing Time ms: "+elapsed);
}
@Test
public void testTheirsAndMine() throws IOException, InterruptedException {
NativeHTTPServer.startServer(8080, 9999, NativeHTTPServer.InstantVASSMSWebHandlers.values(), TestHandlers.values());
System.out.println("The server was started on 8080. Please, use it within 1 minute.");
Thread.sleep(60*1000);
}
public enum TestHandlers implements INativeHTTPServerHandler {
krusty("/Krusty") {
@Override
public void handle(HttpExchange he) throws IOException {
String queryString = he.getRequestURI().getRawQuery();
byte[] response = "hey hey!! I just work, baby!!".getBytes();
he.sendResponseHeaders(200, response.length);
he.getResponseBody().write(response);
he.close();
}
}
;
private String contextPath;
private TestHandlers(String contextPath) {
this.contextPath = contextPath;
}
public String getContextPath() {
return contextPath;
}
}
}
| [
"luiz@e8318a20-2124-4f52-a82c-d3615043beb2"
] | luiz@e8318a20-2124-4f52-a82c-d3615043beb2 |
9ba5dcee2be331b73582445381595f7ddd74e7d7 | 4084db21ffd407b23ff34b32b7ca7fb9fdfdd394 | /src/main/java/marcink/barberVisitApp/model/Visit.java | 5147aec947f89c3789546dc712430b23391558c0 | [] | no_license | ondskan/BarberVisit | 323cfeb617abbdcb90d69b49b2756c36b6e71b4c | f9c52002540872bf9b21b23fab164fdde34f4133 | refs/heads/master | 2021-01-10T20:32:20.688157 | 2015-03-26T17:21:12 | 2015-03-26T17:21:12 | 32,941,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,337 | java | package marcink.barberVisitApp.model;
/**
* Created by Marcin on 2015-02-22.
*/
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
/**
*
* @author Marcin
*/
@Entity
@Table(name = "VISIT")
public class Visit implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@NotNull
@Column(name = "ID_VISIT")
private BigDecimal idVisit;
@NotNull
@Column(name = "TERM")
@Temporal(TemporalType.TIMESTAMP)
private Date term;
@JoinColumn(name = "BARBERSERVICE_ID_SERVICE", referencedColumnName = "ID_SERVICE")
@ManyToOne(optional = false)
private Barberservice barberserviceIdService;
@JoinColumn(name = "CLIENT_ID_CLIENT", referencedColumnName = "ID_CLIENT")
@ManyToOne(optional = false)
private Client clientIdClient;
public Visit() {
}
public Visit(BigDecimal idVisit) {
this.idVisit = idVisit;
}
public Visit(BigDecimal idVisit, Date term) {
this.idVisit = idVisit;
this.term = term;
}
public BigDecimal getIdVisit() {
return idVisit;
}
public void setIdVisit(BigDecimal idVisit) {
this.idVisit = idVisit;
}
public Date getTerm() {
return term;
}
public void setTerm(Date term) {
this.term = term;
}
public Barberservice getBarberserviceIdService() {
return barberserviceIdService;
}
public void setBarberserviceIdService(Barberservice barberserviceIdService) {
this.barberserviceIdService = barberserviceIdService;
}
public Client getClientIdClient() {
return clientIdClient;
}
public void setClientIdClient(Client clientIdClient) {
this.clientIdClient = clientIdClient;
}
@Override
public String toString() {
return "marcink.barberVisitApp.model.Visit[ idVisit=" + idVisit + " ]";
}
}
| [
"marcin.kozun@gmail.com"
] | marcin.kozun@gmail.com |
f5ed56c689c754800621793121bed105bdf2aea7 | 5d5a66b5b7c81166510db8a7bb085f8cd253d215 | /HHeinle_IDM_UNO_DSL/org.xtexthheinle.uno.ui/src/org/xtexthheinle/uno/ui/MyUnoUiModule.java | f0768f4fe7633c3f954f986bed2aa1ee79f2375d | [] | no_license | hheinle/HHeinle_IDM_Uno | eda9c89da9741ea9c85122bde43dc3af14de27ad | 08e3a6fef7a936283a16554e96b24722db3c5d89 | refs/heads/master | 2023-01-28T05:25:56.997164 | 2020-12-12T12:53:10 | 2020-12-12T12:53:10 | 320,579,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | /*
* generated by Xtext 2.23.0
*/
package org.xtexthheinle.uno.ui;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* Use this class to register components to be used within the Eclipse IDE.
*/
public class MyUnoUiModule extends AbstractMyUnoUiModule {
public MyUnoUiModule(AbstractUIPlugin plugin) {
super(plugin);
}
}
| [
"hheinle789@gmail.com"
] | hheinle789@gmail.com |
bf7e5c8044ebcde028a621df43c44a2b1dc085c5 | 4aa90348abcb2119011728dc067afd501f275374 | /app/src/main/java/org/xwalk/core/XWalkGeolocationPermissionsCallbackHandler.java | f10243a32affb76cb2dc749e8747fa9fbcfcefc3 | [] | no_license | jambestwick/HackWechat | 0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6 | 6a34899c8bfd50d19e5a5ec36a58218598172a6b | refs/heads/master | 2022-01-27T12:48:43.446804 | 2021-12-29T10:36:30 | 2021-12-29T10:36:30 | 249,366,791 | 0 | 0 | null | 2020-03-23T07:48:32 | 2020-03-23T07:48:32 | null | UTF-8 | Java | false | false | 1,527 | java | package org.xwalk.core;
import java.util.ArrayList;
public class XWalkGeolocationPermissionsCallbackHandler implements XWalkGeolocationPermissionsCallback {
private Object bridge;
private ArrayList<Object> constructorParams;
private ArrayList<Object> constructorTypes;
private XWalkCoreWrapper coreWrapper;
private ReflectMethod invokeStringbooleanbooleanMethod = new ReflectMethod(null, "invoke", new Class[0]);
private ReflectMethod postWrapperMethod;
protected Object getBridge() {
return this.bridge;
}
public XWalkGeolocationPermissionsCallbackHandler(Object obj) {
this.bridge = obj;
reflectionInit();
}
public void invoke(String str, boolean z, boolean z2) {
try {
this.invokeStringbooleanbooleanMethod.invoke(new Object[]{str, Boolean.valueOf(z), Boolean.valueOf(z2)});
} catch (RuntimeException e) {
if (this.coreWrapper == null) {
throw new RuntimeException("Crosswalk's APIs are not ready yet");
}
XWalkCoreWrapper.handleRuntimeError(e);
}
}
void reflectionInit() {
XWalkCoreWrapper.initEmbeddedMode();
this.coreWrapper = XWalkCoreWrapper.getInstance();
if (this.coreWrapper == null) {
XWalkCoreWrapper.reserveReflectObject(this);
return;
}
this.invokeStringbooleanbooleanMethod.init(this.bridge, null, "invokeSuper", new Class[]{String.class, Boolean.TYPE, Boolean.TYPE});
}
}
| [
"malin.myemail@163.com"
] | malin.myemail@163.com |
3f6956ee9dc6e4d7534b09243f40c103e9d26693 | 6adbf03d8b783d7c6b4e31019008ef7f156de49f | /app/src/main/java/com/test/dmin/hellomoon/AudioPlayer.java | d5723a68d037c2bc6828b526c4e8f6126095e6cc | [
"Apache-2.0"
] | permissive | dmin0723/HelloMoonTest | 3ca0618dd1549c145cd06bbe0773287e3436a9c1 | 8e333cdc1764494057244250c79ad229a934fc06 | refs/heads/master | 2021-01-01T03:51:29.043140 | 2016-04-21T13:18:56 | 2016-04-21T13:18:56 | 56,363,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package com.test.dmin.hellomoon;
import android.content.Context;
import android.media.MediaPlayer;
/**
* Created by dmin on 2016/4/13.
*/
public class AudioPlayer {
private MediaPlayer mPlayer;
public void stop(){
if(mPlayer != null){
mPlayer.release();
mPlayer = null;
}
}
public void play(Context c){
stop();
mPlayer = MediaPlayer.create(c,R.raw.one_small_step);
mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
stop();
}
});
mPlayer.start();
}
}
| [
"gzdengmin@126.com"
] | gzdengmin@126.com |
552d9b26ee8d76cb026c4ea9c013d713424dae62 | 2ffb301d1f7226cab99170541e6506fa58885050 | /Day_06_02/src/AppStart.java | 20a15c20d988c373cf27f699b02a424a96e2c3eb | [] | no_license | jyoungl/juyoung | 1d0489bd3ee1924219f6aa860e91adbe78f0619f | 15cd482dd5f67f4bda60b83c49e0b480b713fad1 | refs/heads/master | 2020-05-17T22:29:42.452619 | 2019-07-31T08:56:52 | 2019-07-31T08:56:52 | 184,002,615 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 473 | java |
public class AppStart {
public static void main(String[] args) {
PizzaStore ps = new PizzaStore();
Pizza pizza = ps.order("어니언");
if(pizza instanceof Pizza) {
System.out.println("피자 인스턴스입니다.");
}
if(pizza instanceof OnionPizza) {
System.out.println("어니언피자 인스턴스.");
OnionPizza p = (OnionPizza)pizza;
}
if(pizza instanceof GarlicPizza) {
System.out.println("갈릭피자 인스턴스.");
}
}
} | [
"pmis118@naver.com"
] | pmis118@naver.com |
9ab1c750e06bcdc56f85243d3b0ca18153be0c96 | cec1602d23034a8f6372c019e5770773f893a5f0 | /sources/uk/co/senab/photoview/gestures/EclairGestureDetector.java | 3e5da0b4c156b6b4168c3a1b471215b030e568ef | [] | no_license | sengeiou/zeroner_app | 77fc7daa04c652a5cacaa0cb161edd338bfe2b52 | e95ae1d7cfbab5ca1606ec9913416dadf7d29250 | refs/heads/master | 2022-03-31T06:55:26.896963 | 2020-01-24T09:20:37 | 2020-01-24T09:20:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,150 | java | package uk.co.senab.photoview.gestures;
import android.annotation.TargetApi;
import android.content.Context;
import android.view.MotionEvent;
import uk.co.senab.photoview.Compat;
@TargetApi(5)
public class EclairGestureDetector extends CupcakeGestureDetector {
private static final int INVALID_POINTER_ID = -1;
private int mActivePointerId = -1;
private int mActivePointerIndex = 0;
public EclairGestureDetector(Context context) {
super(context);
}
/* access modifiers changed from: 0000 */
public float getActiveX(MotionEvent ev) {
try {
return ev.getX(this.mActivePointerIndex);
} catch (Exception e) {
return ev.getX();
}
}
/* access modifiers changed from: 0000 */
public float getActiveY(MotionEvent ev) {
try {
return ev.getY(this.mActivePointerIndex);
} catch (Exception e) {
return ev.getY();
}
}
public boolean onTouchEvent(MotionEvent ev) {
int newPointerIndex;
int i = 0;
switch (ev.getAction() & 255) {
case 0:
this.mActivePointerId = ev.getPointerId(0);
break;
case 1:
case 3:
this.mActivePointerId = -1;
break;
case 6:
int pointerIndex = Compat.getPointerIndex(ev.getAction());
if (ev.getPointerId(pointerIndex) == this.mActivePointerId) {
if (pointerIndex == 0) {
newPointerIndex = 1;
} else {
newPointerIndex = 0;
}
this.mActivePointerId = ev.getPointerId(newPointerIndex);
this.mLastTouchX = ev.getX(newPointerIndex);
this.mLastTouchY = ev.getY(newPointerIndex);
break;
}
break;
}
if (this.mActivePointerId != -1) {
i = this.mActivePointerId;
}
this.mActivePointerIndex = ev.findPointerIndex(i);
return super.onTouchEvent(ev);
}
}
| [
"johan@sellstrom.me"
] | johan@sellstrom.me |
cea8d62aadf687762d6dafd3b66bed91bb221c9d | 31e5c8c22924a02ba4d68930dd23836d1c17a303 | /app/src/main/java/com/vgene/zyxu/lexicohelper/IndexEntity.java | 07d979e7bb7d4f840457e9dd13342f7b80981ac5 | [
"MIT"
] | permissive | vgene/LexicoHelper | 6be2d81be5a26e6a1b83c9bfdfb517e05ac693ac | 79ac37863613d05f3830abf387f7e3356296577c | refs/heads/master | 2021-01-10T02:00:14.686408 | 2016-03-04T15:54:10 | 2016-03-04T15:54:10 | 53,145,967 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,742 | java | package com.vgene.zyxu.lexicohelper;
import android.util.JsonReader;
import android.util.Log;
import java.io.IOException;
/**
* Created by zyxu on 3/1/16.
*/
public class IndexEntity {
private boolean isValid=false;
private String name;
private int start;
private int end;
private boolean isSelected=false;
public IndexEntity(){
}
public IndexEntity(String name, int start, int end){
this.name = name;
this.start = start;
this.end = end;
}
public IndexEntity(JsonReader reader) throws IOException {
isValid=false;
name=null;
start=-1;
end=-1;
reader.beginObject();
while (reader.hasNext()) {
String name2 = reader.nextName();
if (name2.equals("name")) {
name = reader.nextString();
} else if (name2.equals("start")) {
start = reader.nextInt();
}else if (name2.equals("end")){
end = reader.nextInt();
}else{
reader.skipValue();
}
}
if (name!=null && !name.isEmpty() && start>0 && end>0){
isValid=true;
}
reader.endObject();
}
public String getName() {
return name;
}
public int getEnd() {
return end;
}
public int getStart() {
return start;
}
public boolean isValid() {
return isValid;
}
public boolean isSelected() {
return isSelected;
}
public void setIsSelected(boolean isSelected) {
this.isSelected = isSelected;
}
public void switchSelected(){
isSelected = !isSelected;
Log.d(name,isSelected+"");
}
}
| [
"xuziyang@pku.edu.cn"
] | xuziyang@pku.edu.cn |
3f3934c2545bf5671f4876a4dd7640cdcdd97860 | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/ExternalDependencyId.java | c09325e229c8e67dd747001f35faf0a34cb81bce | [
"Apache-2.0"
] | permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 985 | java | /*
* Copyright 2000-2015 JetBrains s.r.o.
*
* 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.jetbrains.plugins.gradle;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author Vladislav.Soroka
*/
public interface ExternalDependencyId {
String getGroup();
String getName();
String getVersion();
@NotNull
String getPackaging();
@Nullable
String getClassifier();
@NotNull
String getPresentableName();
}
| [
"Vladislav.Soroka@jetbrains.com"
] | Vladislav.Soroka@jetbrains.com |
0a239db7d65e61b461a28a99a5fb7a07cab1fca5 | 49cf8a4ed318ba5daac4a7ed5d24a53b2a227cbf | /final assignment/GUI Demos 2012/Choice Lists, Dialog Boxes and Frame Menus/File Dialog Box and Colour Chooser Demo/FileDialogColourChooser.java | fa85aa0377155ac83acbed7b4fe16cf1f6475907 | [] | no_license | hannahskim/YouVsSchool | ea63d15dbcd3ac56716c7dae51514003fca4dd20 | 981c89e3e7ac3fa8fb3159b49e59c491c5938794 | refs/heads/master | 2021-04-26T16:43:09.255804 | 2015-09-30T22:47:08 | 2015-09-30T22:47:08 | 43,463,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,362 | java | // The "FileDialogColourChooser" class. Programmed by: Ridout
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class FileDialogColourChooser extends JFrame implements ActionListener
{
// Variables for the frame
JMenuItem newOption, exitOption, aboutOption;
JMenuItem openOption, saveOption;
JMenuItem chooseBackGroundColour, chooseMessageColour;
Color messageColour;
String message;
DrawingPanel drawingArea;
public FileDialogColourChooser ()
{
super ("File Dialogs and Colour Choosers");
setSize (700, 200);
Container contentPane = getContentPane ();
drawingArea = new DrawingPanel ();
contentPane.add (drawingArea);
// Set up the Menu
// Set up the Game MenuItems with Short cuts
newOption = new JMenuItem ("New");
newOption.setAccelerator (
KeyStroke.getKeyStroke (KeyEvent.VK_N, InputEvent.CTRL_MASK));
newOption.addActionListener (this);
openOption = new JMenuItem ("Open");
openOption.setAccelerator (
KeyStroke.getKeyStroke (KeyEvent.VK_O, InputEvent.CTRL_MASK));
openOption.addActionListener (this);
saveOption = new JMenuItem ("Save");
saveOption.setAccelerator (
KeyStroke.getKeyStroke (KeyEvent.VK_S, InputEvent.CTRL_MASK));
saveOption.addActionListener (this);
exitOption = new JMenuItem ("Exit");
exitOption.setAccelerator (
KeyStroke.getKeyStroke (KeyEvent.VK_X, InputEvent.CTRL_MASK));
exitOption.addActionListener (this);
// Set up the Game Menu
JMenu gameMenu = new JMenu ("Game");
// Add each MenuItem to the Game Menu (with a separator)
gameMenu.add (newOption);
gameMenu.add (openOption);
gameMenu.add (saveOption);
gameMenu.addSeparator ();
gameMenu.add (exitOption);
// Create a colour menu
JMenu colourPreferences = new JMenu ("Colour");
chooseBackGroundColour = new JMenuItem ("Background");
chooseBackGroundColour.addActionListener (this);
chooseMessageColour = new JMenuItem ("Message Text");
chooseMessageColour.addActionListener (this);
messageColour = Color.black;
colourPreferences.add (chooseBackGroundColour);
colourPreferences.add (chooseMessageColour);
// Set up the Help Menu
aboutOption = new JMenuItem ("About...");
aboutOption.addActionListener (this);
JMenu helpMenu = new JMenu ("Help");
helpMenu.add (aboutOption);
helpMenu.addActionListener (this);
// Set up the Menu Bar and add the above Menus
JMenuBar mainMenu = new JMenuBar ();
mainMenu.add (gameMenu);
mainMenu.add (colourPreferences);
mainMenu.add (helpMenu);
// Set the menu bar for this frame to mainMenu
setJMenuBar (mainMenu);
message = "Welcome to the Menu Demo"; // initial message
} // Constructor
/** Method that deals with the menu options
* @param event the event that triggered this method
*/
public void actionPerformed (ActionEvent event)
{
if (event.getSource () == newOption)
{
newGame ();
}
else if (event.getSource () == openOption)
{
FileDialog openDialog = new FileDialog (this, "Open a new file", FileDialog.LOAD);
openDialog.setVisible (true);
String fileName = openDialog.getFile ();
String dir = openDialog.getDirectory ();
message = "Open file" + dir + fileName;
}
else if (event.getSource () == saveOption)
{
FileDialog saveDialog = new FileDialog (this, "Save a file", FileDialog.SAVE);
saveDialog.setVisible (true);
String fileName = saveDialog.getFile ();
String dir = saveDialog.getDirectory ();
message = "Save file" + dir + fileName;
}
else if (event.getSource () == chooseBackGroundColour)
{
Color newColour = JColorChooser.showDialog (this,
"Choose Background Color",
this.getBackground ());
if (newColour != null)
{
drawingArea.setBackground (newColour);
}
}
else if (event.getSource () == chooseMessageColour)
{
Color newColour = JColorChooser.showDialog (this,
"Choose Message Color",
messageColour);
if (newColour != null)
{
messageColour = newColour;
}
}
else if (event.getSource () == exitOption)
{
hide ();
System.exit (0);
}
else if (event.getSource () == aboutOption)
{
JOptionPane.showMessageDialog (this,
"File Dialogs and \nColour Choosers Demo", "About...",
JOptionPane.INFORMATION_MESSAGE);
}
repaint (); // Update screen with new message
}
void newGame ()
{
message = "New Game was selected";
}
// Inner class for the drawing area
private class DrawingPanel extends JPanel
{
/** Constructs a new DrawingPanel object
*/
public DrawingPanel ()
{
setFont (new Font ("Arial", Font.PLAIN, 12));
}
/** Repaint the drawing panel
* @param g The Graphics context
*/
public void paintComponent (Graphics g)
{
super.paintComponent (g);
g.setColor (messageColour);
g.drawString (message, 20, 100);
} // paint component method
}
public static void main (String[] args)
{
FileDialogColourChooser frame = new FileDialogColourChooser ();
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
frame.setVisible (true); // Show the frame
} // main method
} // FileDialogColourChooser class
| [
"kim.hannah524@gmail.com"
] | kim.hannah524@gmail.com |
e3df2de4853de5e7ceee7c848e25054442ffc880 | c307750062bb20269e84c6bb09abea7116b396ad | /contact7/src/main/java/cn/ucai/contact7/I.java | 6f7b46360f36250a08b43129ad80e4b69bbc279e | [] | no_license | BoomBone/Traning | 78cca64d17c07eff8bcf913b5115a1f924342e39 | a623507b1758d0685f552d0d5fecd456cc825707 | refs/heads/master | 2020-03-18T19:37:34.289015 | 2018-05-28T13:38:25 | 2018-05-28T13:38:25 | 135,165,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,400 | java | package cn.ucai.contact7;
public interface I {
String SERVER_URL = "http://139.196.185.33:8080/SuperQQ3Server/Server";
// String SERVER_URL = "http://10.0.2.2:8080/SuperQQ3Server/Server";
String PAGE_ID = "pageId";
String PAGE_SIZE = "pageSize";
interface User {
String TABLE_NAME = "user";
String ID = "id";
String USER_NAME = "userName";
String NICK = "nick";
String AVATAR = "avatar";
String HEADER = "header";
String PASSWORD = "password";
String LATITUDE = "latitude";
String LONGITUDE = "longitude";
String GROUPS = "groups";
String UN_READ_MSG_COUNT = "unreadMsgCount";
}
interface Contact extends User {
String TABLE_NAME = "contact";
String NAME = "name";
String MYUID = "myuid";
String CUID = "cuid";
String IS_GET_MY_LOCATION = "isGetMyLocation";
String IS_SHOW_MY_LOCATION = "isShowMyLocation";
}
interface Avatar {
String FILE_NAME = "fileName";
}
/** 上传图片的类型:user_avatar或group_icon */
String AVATAR_TYPE = "avatarType";
String KEY_REQUEST = "request";
/**
* 客户端上传头像的请求
*/
String REQUEST_UPLOAD_AVATAR = "upload_avatar";
/**
* 客户端发送的登陆请求
*/
String REQUEST_LOGIN = "login";
String REQUEST_DOWNLOAD_AVATAR_URL =I.SERVER_URL
+"?"+KEY_REQUEST+"=download_avatar"
+"&"+ User.USER_NAME+"=";
String REQUEST_DOWNLOAD_CONTACT_LIST = "download_contact_list";
}
| [
"ticccccc@163.com"
] | ticccccc@163.com |
81713a17a7318a1918364ea0e89cffc6995b399f | 7b2ebdaeba3b86265199dbbb0a05290fc8946ba9 | /deschartsLibrary/build/generated/source/r/androidTest/debug/it/bradipao/lib/descharts/R.java | ab403d4f53c7fade8813fd02eebd8df8bbf8d0e8 | [] | no_license | broderickwang/TestPile | 09e949c6bee83c572db27dbb1660b295f6e65ac3 | 670f40a43bcbcd6d3fbf9669fafdb2c62e5b1be7 | refs/heads/master | 2020-03-28T02:02:03.183039 | 2016-08-04T01:18:50 | 2016-08-04T01:18:50 | 64,890,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package it.bradipao.lib.descharts;
public final class R {
public static final class drawable {
public static final int ic_launcher = 0x7f020000;
}
public static final class string {
public static final int app_name = 0x7f040000;
}
public static final class style {
public static final int AppBaseTheme = 0x7f030000;
public static final int AppTheme = 0x7f030001;
}
}
| [
"Broderick@ttbdeMacBook-Air.local"
] | Broderick@ttbdeMacBook-Air.local |
3ff35d6f22b16d67a24a58bef3805938596295df | 4244f72d1ccbcce150bb8f535c4cd26c13f04fca | /PcProject/app/src/main/java/dongduk/com/pcproject/NetworkManager.java | 988a0643f9d1148fcf3c27655fd925819efa6683 | [] | no_license | haena-j/hyApp | cc23173ab98d58c051b3d8b189d4562004c3e7f6 | fb2cab76b7d670501cf8049748b6a1e17da50227 | refs/heads/master | 2023-02-15T05:19:07.849549 | 2017-02-27T04:31:02 | 2017-02-27T04:31:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,208 | java | package dongduk.com.pcproject;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
/**
* Created by Yeeun Jung on 2016-08-09.
*/
public class NetworkManager extends Thread {
private Context mContext;
private String mServerUrl;
private String mResult;
private Handler mHandler;
public NetworkManager(Context context, Handler handler, String serverUrl) {
mContext = context;
mHandler = handler;
mServerUrl = serverUrl;
mResult = null;
}
public void run() {
StringBuilder receivedData = new StringBuilder();
try {
URL url = new URL(mServerUrl);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
if (conn != null) {
conn.setConnectTimeout(3000);
conn.setUseCaches(false);
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while(true) {
String line = br.readLine();
if (line == null) break;
receivedData.append(line + '\n');
}
br.close();
mResult = receivedData.toString();
}
conn.disconnect();
}
} catch (SocketTimeoutException e) {
// server 연결 시간(10000)을 초과하였을 경우
Toast.makeText(mContext, "서버 연결 시간 초과", Toast.LENGTH_SHORT).show();
e.printStackTrace();
} catch (ConnectException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
Message msg = mHandler.obtainMessage();
msg.obj = mResult;
mHandler.sendMessage(msg);
}
} | [
"jhy83088@gmail.com"
] | jhy83088@gmail.com |
fcda39d77065faa3571d7348d21d508254b3970d | 7f53ff59587c1feea58fb71f7eff5608a5846798 | /temp/ffout/client/net/minecraft/src/SorterStatsBlock.java | bcb38f30ce474801426b903d0fe56c9088a8a275 | [] | no_license | Orazur66/Minecraft-Client | 45c918d488f2f9fca7d2df3b1a27733813d957a5 | 70a0b63a6a347fd87a7dbe28c7de588f87df97d3 | refs/heads/master | 2021-01-15T17:08:18.072298 | 2012-02-14T21:29:14 | 2012-02-14T21:29:14 | 3,423,624 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,211 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst
package net.minecraft.src;
import java.util.Comparator;
// Referenced classes of package net.minecraft.src:
// StatCrafting, GuiSlotStatsBlock, StatList, GuiStats,
// StatFileWriter
class SorterStatsBlock
implements Comparator
{
final GuiStats field_27299_a; /* synthetic field */
final GuiSlotStatsBlock field_27298_b; /* synthetic field */
SorterStatsBlock(GuiSlotStatsBlock guislotstatsblock, GuiStats guistats)
{
field_27298_b = guislotstatsblock;
field_27299_a = guistats;
super();
}
public int func_27297_a(StatCrafting statcrafting, StatCrafting statcrafting1)
{
int i = statcrafting.func_25072_b();
int j = statcrafting1.func_25072_b();
StatBase statbase = null;
StatBase statbase1 = null;
if(field_27298_b.field_27271_e == 2)
{
statbase = StatList.field_25159_y[i];
statbase1 = StatList.field_25159_y[j];
} else
if(field_27298_b.field_27271_e == 0)
{
statbase = StatList.field_25158_z[i];
statbase1 = StatList.field_25158_z[j];
} else
if(field_27298_b.field_27271_e == 1)
{
statbase = StatList.field_25172_A[i];
statbase1 = StatList.field_25172_A[j];
}
if(statbase != null || statbase1 != null)
{
if(statbase == null)
{
return 1;
}
if(statbase1 == null)
{
return -1;
}
int k = GuiStats.func_27142_c(field_27298_b.field_27274_a).func_27184_a(statbase);
int l = GuiStats.func_27142_c(field_27298_b.field_27274_a).func_27184_a(statbase1);
if(k != l)
{
return (k - l) * field_27298_b.field_27270_f;
}
}
return i - j;
}
public int compare(Object obj, Object obj1)
{
return func_27297_a((StatCrafting)obj, (StatCrafting)obj1);
}
}
| [
"Ninja_Buta@hotmail.fr"
] | Ninja_Buta@hotmail.fr |
c20dc983a02940c2e18ab66d6d4f44981de3d1ad | 1f529e3ea6e6204c14fc118ef47e37235d50bab7 | /example/joda-time/mutants/CDL_12/org/joda/time/field/FieldUtils.java | 8a08e6e4437e76c75428d600abed41855857cec1 | [] | no_license | leofernandesmo/safira-impact-analysis | 9405730b581feff4a3ae5c2b31d5a320cb6e489c | daa577d267ed54822658f22dfc51291a69d5c450 | refs/heads/master | 2020-04-24T12:00:32.976812 | 2019-03-12T19:50:35 | 2019-03-12T19:50:35 | 171,943,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,466 | java | // This is a mutant program.
// Author : ysma
package org.joda.time.field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import org.joda.time.DateTimeField;
import org.joda.time.DateTimeFieldType;
import org.joda.time.IllegalFieldValueException;
public class FieldUtils
{
private FieldUtils()
{
super();
}
public static int safeNegate( int value )
{
if (value == Integer.MIN_VALUE) {
throw new java.lang.ArithmeticException( "Integer.MIN_VALUE cannot be negated" );
}
return -value;
}
public static int safeAdd( int val1, int val2 )
{
int sum = val1 + val2;
if ((val1 ^ sum) < 0 && (val1 ^ val2) >= 0) {
throw new java.lang.ArithmeticException( "The calculation caused an overflow: " + val1 + " + " + val2 );
}
return sum;
}
public static long safeAdd( long val1, long val2 )
{
long sum = val1 + val2;
if ((val1 ^ sum) < 0 && (val1 ^ val2) >= 0) {
throw new java.lang.ArithmeticException( "The calculation caused an overflow: " + val1 + " + " + val2 );
}
return sum;
}
public static long safeSubtract( long val1, long val2 )
{
long diff = val1 - val2;
if ((val1 ^ diff) < 0 && (val1 ^ val2) < 0) {
throw new java.lang.ArithmeticException( "The calculation caused an overflow: " + val1 + val2 );
}
return diff;
}
public static int safeMultiply( int val1, int val2 )
{
long total = (long) val1 * (long) val2;
if (total < Integer.MIN_VALUE || total > Integer.MAX_VALUE) {
throw new java.lang.ArithmeticException( "Multiplication overflows an int: " + val1 + " * " + val2 );
}
return (int) total;
}
public static long safeMultiply( long val1, int val2 )
{
switch (val2) {
case -1 :
if (val1 == Long.MIN_VALUE) {
throw new java.lang.ArithmeticException( "Multiplication overflows a long: " + val1 + " * " + val2 );
}
return -val1;
case 0 :
return 0L;
case 1 :
return val1;
}
long total = val1 * val2;
if (total / val2 != val1) {
throw new java.lang.ArithmeticException( "Multiplication overflows a long: " + val1 + " * " + val2 );
}
return total;
}
public static long safeMultiply( long val1, long val2 )
{
if (val2 == 1) {
return val1;
}
if (val1 == 1) {
return val2;
}
if (val1 == 0 || val2 == 0) {
return 0;
}
long total = val1 * val2;
if (total / val2 != val1 || val1 == Long.MIN_VALUE && val2 == -1 || val2 == Long.MIN_VALUE && val1 == -1) {
throw new java.lang.ArithmeticException( "Multiplication overflows a long: " + val1 + " * " + val2 );
}
return total;
}
public static long safeDivide( long dividend, long divisor )
{
if (dividend == Long.MIN_VALUE && divisor == -1L) {
throw new java.lang.ArithmeticException( "Multiplication overflows a long: " + dividend + " / " + divisor );
}
return dividend / divisor;
}
public static long safeDivide( long dividend, long divisor, java.math.RoundingMode roundingMode )
{
if (dividend == Long.MIN_VALUE && divisor == -1L) {
throw new java.lang.ArithmeticException( "Multiplication overflows a long: " + dividend + " / " + divisor );
}
java.math.BigDecimal dividendBigDecimal = new java.math.BigDecimal( dividend );
java.math.BigDecimal divisorBigDecimal = new java.math.BigDecimal( divisor );
return dividendBigDecimal.divide( divisorBigDecimal, roundingMode ).longValue();
}
public static int safeToInt( long value )
{
if (Integer.MIN_VALUE <= value && value <= Integer.MAX_VALUE) {
return (int) value;
}
throw new java.lang.ArithmeticException( "Value cannot fit in an int: " + value );
}
public static int safeMultiplyToInt( long val1, long val2 )
{
long val = FieldUtils.safeMultiply( val1, val2 );
return FieldUtils.safeToInt( val );
}
public static void verifyValueBounds( org.joda.time.DateTimeField field, int value, int lowerBound, int upperBound )
{
if (value < lowerBound || value > upperBound) {
throw new org.joda.time.IllegalFieldValueException( field.getType(), Integer.valueOf( value ), Integer.valueOf( lowerBound ), Integer.valueOf( upperBound ) );
}
}
public static void verifyValueBounds( org.joda.time.DateTimeFieldType fieldType, int value, int lowerBound, int upperBound )
{
if (value < lowerBound || value > upperBound) {
throw new org.joda.time.IllegalFieldValueException( fieldType, Integer.valueOf( value ), Integer.valueOf( lowerBound ), Integer.valueOf( upperBound ) );
}
}
public static void verifyValueBounds( java.lang.String fieldName, int value, int lowerBound, int upperBound )
{
if (value < lowerBound || value > upperBound) {
throw new org.joda.time.IllegalFieldValueException( fieldName, Integer.valueOf( value ), Integer.valueOf( lowerBound ), Integer.valueOf( upperBound ) );
}
}
public static int getWrappedValue( int currentValue, int wrapValue, int minValue, int maxValue )
{
return getWrappedValue( currentValue + wrapValue, minValue, maxValue );
}
public static int getWrappedValue( int value, int minValue, int maxValue )
{
if (minValue >= maxValue) {
throw new java.lang.IllegalArgumentException( "MIN > MAX" );
}
int wrapRange = maxValue - minValue + 1;
value -= minValue;
if (value >= 0) {
return value % wrapRange + minValue;
}
int remByRange = -value % wrapRange;
if (remByRange == 0) {
return 0 + minValue;
}
return wrapRange - remByRange + minValue;
}
public static boolean equals( java.lang.Object object1, java.lang.Object object2 )
{
if (object1 == object2) {
return true;
}
if (object1 == null || object2 == null) {
return false;
}
return object1.equals( object2 );
}
}
| [
"leofernandesmo@gmail.com"
] | leofernandesmo@gmail.com |
ccb475066f472c026fa816ac8ec79f9fc629a0e4 | 12b25df4afe21358744406c1b75a70f288e54ed0 | /android/app/src/main/java/com/estudoreactnative/MainApplication.java | 8743eae611f687b653f25a3eeeb9ab2e14aa4cc7 | [] | no_license | RafaelSKaturabara/EstudoReactNative | 0334ce714293651f272f5604ab2a0521dddbff20 | 715e5be4d6959d41e7889e268362207d77bcf4f0 | refs/heads/master | 2020-04-11T18:26:21.102633 | 2019-01-05T19:58:40 | 2019-01-05T19:58:40 | 161,998,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,224 | java | package com.estudoreactnative;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import org.reactnative.camera.RNCameraPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
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() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage(),
new RNCameraPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"rafael.katurabara@fatec.sp.gov.br"
] | rafael.katurabara@fatec.sp.gov.br |
f6c8aa5e0abbd7db775e301fab80d83e9626f81b | 31b9475532df38409a1f9719fd4a341ec23be80b | /src/test/java/com/codewars/MountTheBowlingPinsTest.java | 4d79699ba0b703e12d32de7c96478eecfb39aa45 | [] | no_license | VanessaSchenkel/codewars | 772b925db699d9ac72ba79516faa01aded47becd | 8b0a494536c9c2c11d835e475067496f886c152e | refs/heads/master | 2023-07-30T07:48:45.629146 | 2021-09-15T21:30:26 | 2021-09-15T21:30:26 | 263,184,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package com.codewars;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class MountTheBowlingPinsTest {
@Test
public void exampleTests()
{
MountTheBowlingPins bowling = new MountTheBowlingPins();
int[] testArray = new int[]{1,2,3};
assertEquals("I I I I\n I I I \n \n ", bowling.bowlingPins(testArray));
testArray = new int[]{3,5,9};
assertEquals("I I I\n I I \n I \n I ", bowling.bowlingPins(testArray));
}
}
| [
"v.s.schenkel@gmail.com"
] | v.s.schenkel@gmail.com |
22475c086e8b629a645d0d16604839aa8d9ffeef | 9711d1ec0bd86fdae6141fbfb609fac464d07694 | /software/homecontrol/branches/plugin_system/src/org/isysbus/tools/ControllerType.java | 17a978a62ac0fdc60055b9ad7eb24461287a5375 | [] | no_license | adlerweb/iSysBus | 70a23617bfc87ff8826e044a3a74022ad35b3b82 | e879de563a7b27b1098a0cecdae598ebb730ec79 | refs/heads/master | 2020-04-08T05:13:08.827003 | 2018-11-25T16:08:38 | 2018-11-25T16:08:38 | 159,051,532 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package org.isysbus.tools;
public enum ControllerType {
ATMEGA8, ATMEGA16, ATMEGA168, ATMEGA32, ATMEGA128, AT90CAN128
}
| [
"svn.isysbus.org"
] | svn.isysbus.org |
dc0364cd3418d9ee9e9d7b029e12b92483c9c4ea | 62b901a7e427ce5ae2238fd6f6c89744eb27c0f5 | /src/org/spacebits/exceptions/IncorrectUnitException.java | fac69584d98676b964ef0fe0de6282049849043c | [
"MIT"
] | permissive | snclucas/spacebits | 0fd73024adad1fc2fba76b56255df42b6b45ffbe | 24ff351226064c9084667a7d2a09082cc000214e | refs/heads/master | 2021-01-17T22:50:43.035673 | 2017-06-06T00:34:39 | 2017-06-06T00:34:39 | 64,038,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package org.spacebits.exceptions;
public class IncorrectUnitException extends RuntimeException {
private static final long serialVersionUID = 1L;
public IncorrectUnitException(String message) {
super(message);
}
}
| [
"snclucas@gmail.com"
] | snclucas@gmail.com |
921f8e4f93561d6d4cd8bc79fdc6e8dd338278a4 | cf257429c6dd4c62ad8f9e5b20bcc82686a180c0 | /plugins/fr.obeo.dsl.designer.sample.flow.routerdsl/fr.obeo.dsl.designer.sample.flow.routerdsl/src-gen/fr/obeo/dsl/designer/sample/flow/routerdsl/routerDsl/impl/ThroughtputImpl.java | 09d4c55a7b5b6bc246a734a9df030222e5d03c36 | [] | no_license | kiankang80/Flow-Designer | 1adbeace9a38451c426ea29bc2e797dbf44cfdbe | 0d5fcff5fc4229f52fef1c49a7e44ce32353de03 | refs/heads/master | 2023-03-13T04:21:41.041320 | 2020-12-14T15:06:01 | 2020-12-14T15:06:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,349 | java | /**
* generated by Xtext 2.12.0
*/
package fr.obeo.dsl.designer.sample.flow.routerdsl.routerDsl.impl;
import fr.obeo.dsl.designer.sample.flow.routerdsl.routerDsl.RouterDslPackage;
import fr.obeo.dsl.designer.sample.flow.routerdsl.routerDsl.Throughtput;
import fr.obeo.dsl.designer.sample.flow.routerdsl.routerDsl.TimeUnit;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Throughtput</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link fr.obeo.dsl.designer.sample.flow.routerdsl.routerDsl.impl.ThroughtputImpl#getValue <em>Value</em>}</li>
* <li>{@link fr.obeo.dsl.designer.sample.flow.routerdsl.routerDsl.impl.ThroughtputImpl#getUnit <em>Unit</em>}</li>
* </ul>
*
* @generated
*/
public class ThroughtputImpl extends ObjectAccessOrValueImpl implements Throughtput
{
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected static final int VALUE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected int value = VALUE_EDEFAULT;
/**
* The default value of the '{@link #getUnit() <em>Unit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnit()
* @generated
* @ordered
*/
protected static final TimeUnit UNIT_EDEFAULT = TimeUnit.SECONDS;
/**
* The cached value of the '{@link #getUnit() <em>Unit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnit()
* @generated
* @ordered
*/
protected TimeUnit unit = UNIT_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ThroughtputImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return RouterDslPackage.Literals.THROUGHTPUT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getValue()
{
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(int newValue)
{
int oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RouterDslPackage.THROUGHTPUT__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TimeUnit getUnit()
{
return unit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUnit(TimeUnit newUnit)
{
TimeUnit oldUnit = unit;
unit = newUnit == null ? UNIT_EDEFAULT : newUnit;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RouterDslPackage.THROUGHTPUT__UNIT, oldUnit, unit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case RouterDslPackage.THROUGHTPUT__VALUE:
return getValue();
case RouterDslPackage.THROUGHTPUT__UNIT:
return getUnit();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case RouterDslPackage.THROUGHTPUT__VALUE:
setValue((Integer)newValue);
return;
case RouterDslPackage.THROUGHTPUT__UNIT:
setUnit((TimeUnit)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case RouterDslPackage.THROUGHTPUT__VALUE:
setValue(VALUE_EDEFAULT);
return;
case RouterDslPackage.THROUGHTPUT__UNIT:
setUnit(UNIT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case RouterDslPackage.THROUGHTPUT__VALUE:
return value != VALUE_EDEFAULT;
case RouterDslPackage.THROUGHTPUT__UNIT:
return unit != UNIT_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (value: ");
result.append(value);
result.append(", unit: ");
result.append(unit);
result.append(')');
return result.toString();
}
} //ThroughtputImpl
| [
"cedric.brun@obeo.fr"
] | cedric.brun@obeo.fr |
b28d4df8d358fd16bdfa30d38ea812f8ae4272ae | b9b0b523db6fd02b1e9c5523d1fa58da2c4173f0 | /java/src/Interface/AdapterDesignPattern.java | 8747ec1546d8d20924067e898449e584d23ba87d | [] | no_license | bhupeshdhaundiyal/java | 1f5adb86c497333362bfb69be6548694ca59a372 | 497bb5029fd81ccd0ba3657c4e54fb5ed9738501 | refs/heads/master | 2022-12-06T02:18:53.562176 | 2019-06-03T04:29:18 | 2019-06-03T04:29:18 | 181,281,271 | 0 | 0 | null | 2022-11-24T08:16:47 | 2019-04-14T08:38:01 | Java | UTF-8 | Java | false | false | 946 | java | package Interface;
interface IA{
void IA1();
void IA2();
void IA5();
void IA3();
void IA4();
}
//if simply implement interface in the class then we need to implement each single method
abstract class IAUsing implements IA{
@Override
public void IA1() {
// TODO Auto-generated method stub
System.out.println("definition of ai in abstract method ");
}
public void IA2(){
}
public abstract void IA3();
//must need to make this methods public as by default in interface they are public
//so scope must always increase
}
public class AdapterDesignPattern extends IAUsing{
@Override
public void IA5() {
// TODO Auto-generated method stub
}
@Override
public void IA4() {
// TODO Auto-generated method stub
}
@Override
public void IA3() {
// TODO Auto-generated method stub
}
// we need to override the methods or implement those which are not define in the abstract class....
}
| [
"bhupeshdhaundiyal@gmail.com"
] | bhupeshdhaundiyal@gmail.com |
95278f88638996b154a19cba8a3e44308e812d9c | c5053f921b02fbbece8005a9d91d602f32293a6e | /wattion/src/main/java/com/conceptberria/wattion/client/ConceptberriaCoreClient.java | ee97ede05d7475d0d0b7d5df7d0dffc0abe81332 | [
"Apache-2.0"
] | permissive | ConceptBerria/wattion | 8c4a235dfa073de41cf4917a19f18f8ebebb9572 | 8d7bee2335ce125adcc46fe987e34cbea92f618b | refs/heads/master | 2021-01-10T17:39:57.391551 | 2016-04-06T19:45:13 | 2016-04-06T19:45:13 | 55,008,692 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,155 | java | /*
* Copyright 2016 ConceptBerria
* 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.conceptberria.wattion.client;
import com.conceptberria.wattion.dto.EnergyPriceDayDto;
import com.conceptberria.wattion.exception.ConceptberriaCoreConnectFailException;
import com.conceptberria.wattion.exception.ConceptberriaCoreNoDataException;
import java.util.Date;
/**
* Created by Conceptberria on 01/04/2014.
* Interface del cliente del core ConceptBerria
*/
public interface ConceptberriaCoreClient {
EnergyPriceDayDto getEnergyPriceCore(final Date fecha)throws ConceptberriaCoreConnectFailException,ConceptberriaCoreNoDataException;
}
| [
"conceptberria@gmail.com"
] | conceptberria@gmail.com |
23faa2abe32aba4c8a3b9b0cdb60d5ed9440810f | ba975d6b16865e87f790702422940efaf2cbb8dc | /sdkey/src/com/example/sdkey/FileMgrActivity.java | d8372cb6681fc227d9f681c029b4e56837a8250c | [] | no_license | ShenDezhou/android | 5e19d86ca24cf6cae3f585aec973298fb20d37e6 | 71bdc46b3004d8eb532fa2b4c5c1f300b366320b | refs/heads/master | 2021-01-11T05:33:54.091506 | 2016-10-29T03:34:03 | 2016-10-29T03:34:03 | 71,799,376 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 14,624 | java | package com.example.sdkey;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Map;
import Sumavision.Library.ApduBaseCommand;
import Sumavision.Library.ConversionTools;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class FileMgrActivity extends Activity{
private int id=3;
private final static int REQUEST_CODE=3;
//打开文件 输入文件名
private EditText openFileNameText;
private EditText encKeyText;
private EditText encFileNameText;
private EditText decKeyText;
private EditText decFileNameText;
private EditText fileContentText;
//打开文件 按钮
private Button selectFileBtn;
private Button openFileBtn;
private Button editFileBtn;
private Button saveFileBtn;
private Button encyptFileBtn;
private Button decryptFileBtn;
String inputFileName = "";
//此处可以按照SD卡目录修改!
final static String ROOTPATH = "/storage/sdcard0/aa/";
File openedFile;
String encKeyStr;
String decKeyStr;
String encSavedFile;
String decSavedFile;
static String outdata;
String encSourceText;
String decSourceText;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
setContentView(R.layout.filemgr);
openFileNameText = (EditText) this.findViewById(R.id.fileNameText);
encKeyText = (EditText) this.findViewById(R.id.inputEncKeyText);
encFileNameText = (EditText) this.findViewById(R.id.encOutFileText);
decKeyText = (EditText) this.findViewById(R.id.inputDecKeyText);
decFileNameText = (EditText) this.findViewById(R.id.decOutFileText);
fileContentText = (EditText) this.findViewById(R.id.fileContentText);
selectFileBtn = (Button) this.findViewById(R.id.selectFileBtn);
openFileBtn = (Button) this.findViewById(R.id.openFileBtn);
editFileBtn = (Button) this.findViewById(R.id.editFileBtn);
saveFileBtn = (Button) this.findViewById(R.id.saveFileBtn);
encyptFileBtn = (Button) this.findViewById(R.id.encryptFileBtn);
decryptFileBtn = (Button) this.findViewById(R.id.decryptFileBtn);
selectFileBtn.setOnClickListener(new selectFileBtnListener());
openFileBtn.setOnClickListener(new openFileBtnListener());
editFileBtn.setOnClickListener(new editFileBtnListener());
saveFileBtn.setOnClickListener(new saveFileBtnListener());
encyptFileBtn.setOnClickListener(new encyptFileBtnListener());
decryptFileBtn.setOnClickListener(new decryptFileBtnListener());
}
class selectFileBtnListener implements OnClickListener{
public void onClick(View v) {
//将选择的文件名和path传到"请输入文件名"位置
Intent intent=new Intent(FileMgrActivity.this,OpenFileActivity.class);
Bundle b=new Bundle();
b.putString("SELECTEDFILENAME", "1.txt");
intent.putExtra("SELECTEDFILENAME", b);
startActivityForResult(intent,id);
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE) {
if (resultCode == OpenFileActivity.RESULT_CODE) {
Bundle bundle = data.getExtras();
String str = bundle.getString("SELECTEDFILENAME");
openFileNameText.setText(str);
}
}
}
class openFileBtnListener implements OnClickListener{
public void onClick(View v) {
inputFileName = openFileNameText.getText().toString();
if(inputFileName.equals("")){
showText("文件名不能为空");
return;
}
if(!inputFileName.startsWith(ROOTPATH)){
if(inputFileName.startsWith("/")){
showText("不支持此路径下的文件!");
return;
}
inputFileName = ROOTPATH + inputFileName;
}
openedFile = new java.io.File(inputFileName);
if(!openedFile.exists()){
showText("文件名不存在");
return;
}else{
showText("文件已打开!");
return;
}
}
}
class editFileBtnListener implements OnClickListener{
public void onClick(View v){
// inputFileName = openFileNameText.getText().toString();
// if(inputFileName.equals("")){
// showText("文件名不能为空");
// return;
// }
//
// if(!inputFileName.startsWith(ROOTPATH)){
//
// if(inputFileName.startsWith("/")){
// showText("不支持此路径下的文件!");
// return;
// }
//
// inputFileName = ROOTPATH + inputFileName;
// }
if(inputFileName.equals("")){
showText("文件还未打开!");
return;
}
openedFile = new java.io.File(inputFileName);
if(!openedFile.exists()){
showText("文件名不存在");
return;
}else{
String fileContent = readString(inputFileName);
fileContentText.setText(fileContent);
fileContentText.requestFocus();
}
}
}
class saveFileBtnListener implements OnClickListener{
public void onClick(View v){
inputFileName = openFileNameText.getText().toString();
if(inputFileName.equals("")){
showText("文件名不能为空");
return;
}
if(!inputFileName.startsWith(ROOTPATH)){
if(inputFileName.startsWith("/")){
showText("不支持此路径下的文件!");
return;
}
inputFileName = ROOTPATH + inputFileName;
}
String writestr = fileContentText.getText().toString();
if(writeString(inputFileName, writestr, 1) != 0){
showText("文件写入错误!");
return;
}
showText("文件保存成功");
}
}
class encyptFileBtnListener implements OnClickListener{
public void onClick(View v){
//获得key数据
encKeyStr = encKeyText.getText().toString();
if(encKeyStr.equals("")){
showText("加密密钥不能为空!");
return;
}
if(encKeyStr.length() > 32){
showText("加密密钥长度不能大于16");
return;
}
//check key format
for(int i = 0; i < encKeyStr.length(); i++){
char c = encKeyStr.charAt(i);
//if (c > 'F' || c < '0'){
if(!(((c >= '0') && (c <= '9') ) ||
((c >= 'a') && (c <= 'f') ) ||
((c >= 'A') && (c <= 'F')))){
showText("加密密钥格式不对,只能输入0-F的十六进制数");
return;
}
}
//将key数据转成bytes数组,并填充成16字节
//获得原文
// inputFileName = openFileNameText.getText().toString();
// if(inputFileName.equals("")){
// showText("文件名不能为空");
// return;
// }
//
// inputFileName = ROOTPATH + inputFileName;
//encSourceText = fileContentText.getText().toString();
if(inputFileName.equals("")){
showText("文件还未打开!");
return;
}
encSourceText = readString(inputFileName);
if (selectCipherApp() != 0){
showText("应用选择失败!");
return;
}
if (doEncyptFile(encKeyStr, encSourceText) != 0){
showText("文件加密错误!");
return;
}
//将原文转成bytes数组
//将key和原文拼接成数组,发送APDU给SD卡
//获得返回值,转成String,存入目标文件
encSavedFile = encFileNameText.getText().toString();
if(encSavedFile.equals("")){
showText("输出文件名不能为空!");
return;
}
if(!encSavedFile.startsWith(ROOTPATH)){
if(encSavedFile.startsWith("/")){
showText("不支持此路径下的文件!");
return;
}
encSavedFile = ROOTPATH + encSavedFile;
}
if(writeString(encSavedFile, outdata, 1) != 0){
showText("文件写入错误!");
return;
}
showText("文件加密成功");
}
}
class decryptFileBtnListener implements OnClickListener{
public void onClick(View v){
//获得key数据
decKeyStr = decKeyText.getText().toString();
if(decKeyStr.equals("")){
showText("解密密钥不能为空!");
return;
}
if(decKeyStr.length() > 32){
showText("解密密钥长度不能大于16");
return;
}
//check key format
for(int i = 0; i < decKeyStr.length(); i++){
char c = decKeyStr.charAt(i);
// if (c > 'F' || c < '0'){
if(!(((c >= '0') && (c <= '9') ) ||
((c >= 'a') && (c <= 'f') ) ||
((c >= 'A') && (c <= 'F')))){
showText("解密密钥格式不对,只能输入0-F的十六进制数");
return;
}
}
//将key数据转成bytes数组,并填充成16字节
//获得原文
// inputFileName = openFileNameText.getText().toString();
// if(inputFileName.equals("")){
// showText("文件名不能为空");
// return;
// }
//
// inputFileName = ROOTPATH + inputFileName;
//decSourceText = fileContentText.getText().toString();
if(inputFileName.equals("")){
showText("文件还未打开!");
return;
}
decSourceText = readString(inputFileName);
if (selectCipherApp() != 0){
showText("应用选择失败!");
return;
}
if (doDecryptFile(decKeyStr, decSourceText) != 0){
showText("文件解密错误!");
return;
}
//将文件内容转成unicode码再转成string,因为文件内容可能有汉字
byte[] outBytes = ConversionTools.stringToByteArr(outdata);
outdata = new String(outBytes);
//将原文转成bytes数组
//将key和原文拼接成数组,发送APDU给SD卡
//获得返回值,转成String,存入目标文件
decSavedFile = decFileNameText.getText().toString();
if(decSavedFile.equals("")){
showText("输出文件名不能为空!");
return;
}
if(!decSavedFile.startsWith(ROOTPATH)){
if(decSavedFile.startsWith("/")){
showText("不支持此路径下的文件!");
return;
}
decSavedFile = ROOTPATH + decSavedFile;
}
if(writeString(decSavedFile, outdata, 1) != 0){
showText("文件写入错误!");
return;
}
showText("文件解密密成功");
}
}
private void showText(String str){
Toast toast = Toast.makeText(getApplicationContext(), str, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
public static int writeString(String file, String str, int mode){
//mode:0:create
//1:overwrite
java.io.File outputFile=new java.io.File(file);
// if(outputFile.exists() && mode==0){
// return -1;
// }
java.io.PrintWriter output;
try {
output = new java.io.PrintWriter(outputFile);
//out = new PrintWriter(new OutputStreamWriter(new FileOutputStream("d:/text.txt"), "utf-8"))
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
return -2;
}
output.print(str);
output.close();
return 0;
}
public static String readString(String file){
String inputStr="";
java.io.File inputFile=new java.io.File(file);
java.util.Scanner input;
try {
input=new java.util.Scanner(inputFile);
while(input.hasNext()){
inputStr += input.next();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
input.close();
return inputStr;
}
/**
* 选择加密应用的AID
*
* @return 0: 成功 1: 通讯失败 2: 指令执行失败 3: 其他错误
*/
public static int selectCipherApp() {
Map<String, String> resultMap = ApduBaseCommand
.exchangeApdu("00A40400080102030405060708");
String retString = resultMap.get("ret");
String sw = resultMap.get("sw");
String outdata = resultMap.get("outdata");
if (retString.equals("0") == false) {
return 1;
}
if (sw.equals("9000") == false) {
return 2;
}
return 0;
}
/**
* 使用加密应用对文件内容进行加密
*
* @return 0: 成功 1: 通讯失败 2: 指令执行失败 3: 其他错误
*/
public static int doEncyptFile(String keyContent, String srcContent) {
String encAPDU = "10130702";
//补齐key为16长度
short keyLen = (short)keyContent.length();
String keyPadValue = "";
if(keyLen < 32){
short keyPadLen = (short)(32 - keyLen);
for(short i = 0; i < keyPadLen; i++){
keyPadValue += "0";
}
}
//将文件内容转成unicode码再转成string,因为文件内容可能有汉字
byte[] inSrc = srcContent.getBytes();
srcContent = ConversionTools.ByteArrayToString(inSrc, inSrc.length);
String content = keyContent + keyPadValue + srcContent;
encAPDU += Integer.toHexString(content.length() / 2) + content;
Map<String, String> resultMap = ApduBaseCommand
.exchangeApdu(encAPDU);
String retString = resultMap.get("ret");
String sw = resultMap.get("sw");
outdata = resultMap.get("outdata");
if (retString.equals("0") == false) {
return 1;
}
if (sw.equals("9000") == false) {
return 2;
}
return 0;
}
/**
* 使用解密应用对文件内容进行解密
*
* @return 0: 成功 1: 通讯失败 2: 指令执行失败 3: 其他错误
*/
public int doDecryptFile(String keyContent, String srcContent) {
String encAPDU = "10130701";
//补齐key为16长度
short keyLen = (short)keyContent.length();
String keyPadValue = "";
if(keyLen < 32){
short keyPadLen = (short)(32 - keyLen);
for(short i = 0; i < keyPadLen; i++){
keyPadValue += "0";
}
}
if(srcContent.length() % 8 != 0){
showText("解密文件长度不对");
return -4;
}
String content = keyContent + keyPadValue + srcContent;
encAPDU += Integer.toHexString(content.length() / 2) + content;
Map<String, String> resultMap = ApduBaseCommand
.exchangeApdu(encAPDU);
String retString = resultMap.get("ret");
String sw = resultMap.get("sw");
outdata = resultMap.get("outdata");
if (retString.equals("0") == false) {
return 1;
}
if (sw.equals("9000") == false) {
return 2;
}
return 0;
}
}
| [
"dezhou.shen@tsingdata.com"
] | dezhou.shen@tsingdata.com |
6dc0b3c2c51c9936ccd1966dd7dff464259c717a | c8d72a4543b0531ffd0cbadc0252b2157f4b076c | /Assignment 3/src/main/java/client/HealthGrpcClientStartup.java | d21221052de8bfc7dddb73ca629134e5c584fbde | [] | no_license | BlagaCristi/OnlineMedicalPlatform | 8818c48e4184ed52f5ed674156cd30672b6d7ed5 | a37411ed163abdc04c1dbaa0952f6885a3f7ab90 | refs/heads/master | 2023-02-24T10:54:53.867344 | 2021-01-30T17:53:45 | 2021-01-30T17:53:45 | 334,472,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package client;
public class HealthGrpcClientStartup {
public static void main(String[] args) throws InterruptedException {
// HealthGrpcClient client = new HealthGrpcClient("localhost", 23970);
// client.receiveMessage("Hello!");
// client.streamMedicationPlans(55);
Thread thread = new Thread(() -> {
UserInterface userInterface = new UserInterface();
});
thread.start();
thread.join();
}
}
| [
"blaga.cristi23@gmail.com"
] | blaga.cristi23@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.