blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
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
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
98150fe01883f4a57b099a264b2ee3f7caa3c7de
d2272ac2907fe558b4d54cd8c86844836fccb58d
/modules/dfp_axis/src/main/java/com/google/api/ads/dfp/axis/v201802/ProspectiveLineItem.java
f0296ece9897e16e95e3a37abfb8a11cec851994
[ "Apache-2.0" ]
permissive
nugit/googleads-java-lib
6ec8f8ae7a94956c565541e5da74b3c51a33d690
5dd466fa93bae6ad8ab8c40f7f3cbd0e6afcf549
refs/heads/master
2023-03-04T15:50:41.230299
2018-07-05T03:49:25
2018-07-05T03:49:25
139,403,917
0
0
Apache-2.0
2023-02-21T15:01:10
2018-07-02T07:02:46
Java
UTF-8
Java
false
false
8,469
java
// Copyright 2018 Google Inc. 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. // 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. /** * ProspectiveLineItem.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter. */ package com.google.api.ads.dfp.axis.v201802; /** * Represents a prospective line item to be forecasted. */ public class ProspectiveLineItem implements java.io.Serializable { /* The target of the forecast. If {@link LineItem#id} is null * or no line item exists with that ID, * then a forecast is computed for the subject, predicting * what would happen if it were added * to the network. If a line item already exists with * {@link LineItem#id}, the forecast is * computed for the subject, predicting what would happen * if the existing line item's settings * were modified to match the subject. */ private com.google.api.ads.dfp.axis.v201802.LineItem lineItem; /* When set, the line item is assumed to be from this advertiser, * and unified blocking rules will * apply accordingly. If absent, line items without an * existing order won't be subject to unified * blocking rules. */ private java.lang.Long advertiserId; public ProspectiveLineItem() { } public ProspectiveLineItem( com.google.api.ads.dfp.axis.v201802.LineItem lineItem, java.lang.Long advertiserId) { this.lineItem = lineItem; this.advertiserId = advertiserId; } @Override public String toString() { return com.google.common.base.MoreObjects.toStringHelper(this.getClass()) .omitNullValues() .add("advertiserId", getAdvertiserId()) .add("lineItem", getLineItem()) .toString(); } /** * Gets the lineItem value for this ProspectiveLineItem. * * @return lineItem * The target of the forecast. If {@link LineItem#id} is null * or no line item exists with that ID, * then a forecast is computed for the subject, predicting * what would happen if it were added * to the network. If a line item already exists with * {@link LineItem#id}, the forecast is * computed for the subject, predicting what would happen * if the existing line item's settings * were modified to match the subject. */ public com.google.api.ads.dfp.axis.v201802.LineItem getLineItem() { return lineItem; } /** * Sets the lineItem value for this ProspectiveLineItem. * * @param lineItem * The target of the forecast. If {@link LineItem#id} is null * or no line item exists with that ID, * then a forecast is computed for the subject, predicting * what would happen if it were added * to the network. If a line item already exists with * {@link LineItem#id}, the forecast is * computed for the subject, predicting what would happen * if the existing line item's settings * were modified to match the subject. */ public void setLineItem(com.google.api.ads.dfp.axis.v201802.LineItem lineItem) { this.lineItem = lineItem; } /** * Gets the advertiserId value for this ProspectiveLineItem. * * @return advertiserId * When set, the line item is assumed to be from this advertiser, * and unified blocking rules will * apply accordingly. If absent, line items without an * existing order won't be subject to unified * blocking rules. */ public java.lang.Long getAdvertiserId() { return advertiserId; } /** * Sets the advertiserId value for this ProspectiveLineItem. * * @param advertiserId * When set, the line item is assumed to be from this advertiser, * and unified blocking rules will * apply accordingly. If absent, line items without an * existing order won't be subject to unified * blocking rules. */ public void setAdvertiserId(java.lang.Long advertiserId) { this.advertiserId = advertiserId; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof ProspectiveLineItem)) return false; ProspectiveLineItem other = (ProspectiveLineItem) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.lineItem==null && other.getLineItem()==null) || (this.lineItem!=null && this.lineItem.equals(other.getLineItem()))) && ((this.advertiserId==null && other.getAdvertiserId()==null) || (this.advertiserId!=null && this.advertiserId.equals(other.getAdvertiserId()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getLineItem() != null) { _hashCode += getLineItem().hashCode(); } if (getAdvertiserId() != null) { _hashCode += getAdvertiserId().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(ProspectiveLineItem.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201802", "ProspectiveLineItem")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("lineItem"); elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201802", "lineItem")); elemField.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201802", "LineItem")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("advertiserId"); elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201802", "advertiserId")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
b6ae7bcd9c25ca53a9551d8241bb5714a1a99302
9ac0644063b369f3492ab0f7e466fd75a24ad812
/users-web/src/main/java/br/com/oigarcom/api/users/web/configuration/EmbeddedContainerConfiguration.java
73d019eb5ab92ed44ac2e6e5c4dff2ff9a04d565
[ "MIT" ]
permissive
tomasouza/java-functional-reactive-rest-api-with-dynamodb
694647085ed3a523b45ca8af624d0b8d72936da1
c41bb6c787fb993d0cdfe66ee456a6dbeb70e37a
refs/heads/master
2023-03-04T06:12:16.551247
2021-02-17T14:52:04
2021-02-17T14:52:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
516
java
package br.com.oigarcom.api.users.web.configuration; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class EmbeddedContainerConfiguration { @Bean public ReactiveWebServerFactory servletContainer() { return new NettyReactiveWebServerFactory(); } }
df940c82e5c81b924613461fe35564388e637b37
3c6f4bb030a42d19ce8c25a931138641fb6fd495
/finance-payment/finance-payment-api/src/main/java/com/hongkun/finance/payment/service/FinPlatformPaywayService.java
f754d23c98abcd1edfe56db2fed8ce2202f4be0a
[]
no_license
happyjianguo/finance-hkjf
93195df26ebb81a8b951a191e25ab6267b73aaca
0389a6eac966ee2e4887b6db4f99183242ba2d4e
refs/heads/master
2020-07-28T13:42:40.924633
2019-08-03T00:22:19
2019-08-03T00:22:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,456
java
package com.hongkun.finance.payment.service; import java.util.List; import com.hongkun.finance.payment.model.FinPlatformPayway; import com.yirun.framework.core.enums.PlatformSourceEnums; import com.yirun.framework.core.enums.SystemTypeEnums; import com.yirun.framework.core.utils.pager.Pager; /** * @Project : finance * @Program Name : * com.hongkun.finance.payment.service.FinPlatformPaywayService.java * @Class Name : FinPlatformPaywayService.java * @Description : GENERATOR SERVICE类 * @Author : generator */ public interface FinPlatformPaywayService { /** * @Described : 单条插入 * @param finPlatformPayway * 持久化的数据对象 * @return : void */ void insertFinPlatformPayway(FinPlatformPayway finPlatformPayway); /** * @Described : 批量插入 * @param List<FinPlatformPayway> * 批量插入的数据 * @return : void */ void insertFinPlatformPaywayBatch(List<FinPlatformPayway> list); /** * @Described : 批量插入 * @param List<FinPlatformPayway> * 批量插入的数据 * @param count * 多少条数提交一次 * @return : void */ void insertFinPlatformPaywayBatch(List<FinPlatformPayway> list, int count); /** * @Described : 更新数据 * @param finPlatformPayway * 要更新的数据 * @return : void */ void updateFinPlatformPayway(FinPlatformPayway finPlatformPayway); /** * @Described : 批量更新数据 * @param finPlatformPayway * 要更新的数据 * @param count * 多少条数提交一次 * @return : void */ void updateFinPlatformPaywayBatch(List<FinPlatformPayway> list, int count); /** * @Described : 通过id查询数据 * @param id * id值 * @return FinPlatformPayway */ FinPlatformPayway findFinPlatformPaywayById(int id); /** * @Described : 条件检索数据 * @param finPlatformPayway * 检索条件 * @return List<FinPlatformPayway> */ List<FinPlatformPayway> findFinPlatformPaywayList(FinPlatformPayway finPlatformPayway); /** * @Described : 条件检索数据 * @param finPlatformPayway * 检索条件 * @param start * 起始页 * @param limit * 检索条数 * @return List<FinPlatformPayway> */ List<FinPlatformPayway> findFinPlatformPaywayList(FinPlatformPayway finPlatformPayway, int start, int limit); /** * @Described : 条件检索数据 * @param finPlatformPayway * 检索条件 * @param pager * 分页数据 * @return List<FinPlatformPayway> */ Pager findFinPlatformPaywayList(FinPlatformPayway finPlatformPayway, Pager pager); /** * @Described : 统计条数 * @param finPlatformPayway * 检索条件 * @param pager * 分页数据 * @return int */ int findFinPlatformPaywayCount(FinPlatformPayway finPlatformPayway); /** * @Description : 查询某个系统的某个平台下有哪几种支付渠道 * @Method_Name : findPayChannelInfo; * @param systemTypeEnums * 系统枚举类 * @param platformSourceEnums * 平台枚举类 * @return * @return : List<FinPlatformPayway>; * @Creation Date : 2017年12月6日 下午1:43:14; * @Author : [email protected] 黄艳兵; */ List<FinPlatformPayway> findPayChannelInfo(SystemTypeEnums systemTypeEnums, PlatformSourceEnums platformSourceEnums); }
f4e1f42632b68df1ec94b87e82dff615c6122b74
2fd9d77d529e9b90fd077d0aa5ed2889525129e3
/DecompiledViberSrc/app/src/main/java/org/simpleframework/xml/core/OverrideValue.java
e8815b4190accced6178d01f0f3f9ee74243d5d5
[]
no_license
cga2351/code
703f5d49dc3be45eafc4521e931f8d9d270e8a92
4e35fb567d359c252c2feca1e21b3a2a386f2bdb
refs/heads/master
2021-07-08T15:11:06.299852
2021-05-06T13:22:21
2021-05-06T13:22:21
60,314,071
1
3
null
null
null
null
UTF-8
Java
false
false
912
java
package org.simpleframework.xml.core; import org.simpleframework.xml.strategy.Value; class OverrideValue implements Value { private final Class type; private final Value value; public OverrideValue(Value paramValue, Class paramClass) { this.value = paramValue; this.type = paramClass; } public int getLength() { return this.value.getLength(); } public Class getType() { return this.type; } public Object getValue() { return this.value.getValue(); } public boolean isReference() { return this.value.isReference(); } public void setValue(Object paramObject) { this.value.setValue(paramObject); } } /* Location: E:\Study\Tools\apktool2_2\dex2jar-0.0.9.15\classes_viber_4_dex2jar.jar * Qualified Name: org.simpleframework.xml.core.OverrideValue * JD-Core Version: 0.6.2 */
fa7f14b97b8e685132425a1adac96213fdad9f9d
83ee5f5fa65219797d2b3413f8e30865230a29a0
/code/2-Spring-boot/3-todos-service/src/main/java/com/example/api/ResponseError.java
64b6869cfba6f8f37bbd163faca9fef8632f57ea
[]
no_license
nagcloudlab/tavant-batch2
fb39812aa143d4c36b4b7d6b287ab4b69621e97a
b5ca9b9257742663d03d4056bd55a66d8f46f2eb
refs/heads/main
2023-08-10T16:14:51.327217
2021-09-21T02:25:40
2021-09-21T02:25:40
405,832,877
3
5
null
null
null
null
UTF-8
Java
false
false
104
java
package com.example.api; import lombok.Data; @Data public class ResponseError { String message; }
ccaf80ac96ae1eafbb1f4f2b77116535ed17bde0
b6b0cc2a90cc4a007aeff50cd2fbcb287299fa8c
/fr/src/main/java/com/udemy/fr/entities/User.java
bfd42ecc0c97c130a39648ca53c2a25545f907f7
[]
no_license
JohnQ1981/flightreservation
4abc1a838c4ab4ec2617ed466e33d7738ed739c5
a439720566f1c76c71421a91d7890a01d3503730
refs/heads/master
2023-04-11T00:54:35.167461
2021-04-18T23:01:01
2021-04-18T23:01:01
359,270,385
0
0
null
null
null
null
UTF-8
Java
false
false
1,175
java
package com.udemy.fr.entities; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class User { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } private String firstName; private String lastName; private String email; private String password; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { return "User [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", email=" + email + ", password=" + password + "]"; } }
8558b8ca56969f407a15137b13256b306b2f6838
113134a5b6abb7f3096753305290e19799d2b0d8
/app/src/main/java/com/histudent/jwsoft/histudent/model/entity/ShowImgEvent.java
f18e7dc16ffd2c56e5511c616b8bb1ba3e77cc54
[]
no_license
dengjiaping/trunk
5047c99d25125b75451142fdb260d81be85f28b8
bd24e8a6fdc7f2ca003e95ec45c723c17bf50684
refs/heads/master
2021-08-26T07:05:59.113508
2017-11-22T01:42:11
2017-11-22T01:42:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
package com.histudent.jwsoft.histudent.model.entity; /** * Created by huyg on 2017/11/8. */ public class ShowImgEvent { public int position; public ShowImgEvent(int position) { this.position = position; } }
cf30891c026479aa25ab1cd83c5625b67c818285
f2a71306af3a4d28a6bad214b554d62c0eab8c4b
/test/System/IPrintArrStub.java
f1a4b42c6449159d278340e7ccf893d7f50eb628
[]
no_license
guys79/QA_Ass3Final
d2c52f93e3cc4c5549b4df4f2fd334cfece2b601
427ef550ca182856e29e8414b72d386af5dddd2f
refs/heads/master
2020-12-19T05:34:27.285250
2020-01-22T19:22:41
2020-01-22T19:22:41
235,634,951
0
0
null
null
null
null
UTF-8
Java
false
false
1,695
java
package System; /** * This interface represents a stub for printArr */ public interface IPrintArrStub { /** * In case the function simulates a null array */ default void nullPrintCase() { return; } /** * This function prints the numbers from 1 to 4 */ default void oneToSixPrintCase() { for(int i=1;i<=6;i++) { System.out.print(i+" "); } System.out.println(); } default void regularArraySize6() { System.out.print(2+" "); System.out.print(3+" "); System.out.print(4+" "); System.out.print(5+" "); System.out.print(6+" "); System.out.print(1+" "); System.out.println(); } /** * This function prints the numbers from 1 to 4 */ default void emptyPrintCase() { System.out.println(); } /** * The simulated result of printArr */ default void printArr(int [] array) { if(this instanceof PrintSortedStubSortArrayPrintArrayWhenEmpty) emptyPrintCase(); if(this instanceof PrintSortedStubSortArrayPrintArrayWhenValid && realIsSortedPrintArr(array)) oneToSixPrintCase(); if(this instanceof PrintSortedStubSortArrayPrintArrayWhenValid && !realIsSortedPrintArr(array)) regularArraySize6(); if(this instanceof PrintSortedStubSortArrayPrintArrayWhenNull) nullPrintCase(); } default boolean realIsSortedPrintArr(int [] arr) { for(int i=0;i<arr.length-1;i++) { if(arr[i] >arr[i+1]) return false; } return true; } }
08de6bddc1c794da07de96464017d99243693273
03c5312f7cebf29db06072978c86e76ab6865aa4
/gmall-cms/src/main/java/com/zhang/gmall/cms/mapper/TopicCommentMapper.java
cab10dd1bbd6245051016e2976a6fe30d7b59f91
[]
no_license
zhangjingwei8390120/gmall-111
904927407fbc6200041d8a0b87d463a758ffbca1
710371d27adab91f9f3106695286aa7e79d8b762
refs/heads/master
2022-07-17T11:14:10.609551
2020-02-04T23:45:14
2020-02-04T23:45:17
238,329,579
0
0
null
2022-06-21T02:44:32
2020-02-04T23:39:42
Java
UTF-8
Java
false
false
311
java
package com.zhang.gmall.cms.mapper; import com.zhang.gmall.cms.entity.TopicComment; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> * 专题评论表 Mapper 接口 * </p> * * @author Lfy * @since 2020-02-05 */ public interface TopicCommentMapper extends BaseMapper<TopicComment> { }
3b169879413cdbddf11dfdb29477c13c1ed1d69e
54c36c8a0a798edb0ec5c55def09d8e1ca366af3
/ProjetoPraticoJava/Java/src/main/java/aulas/orientacaoobjetos/part02/construtores/exemplo001/ExemploInstanciaObjeto.java
7718a80a44a638b4de5a4a2f57e61c165120ebd7
[]
no_license
diegosena7/BootcampInterJavaDeveloperDIO
bdd3379ed61d203b9959b1be1bb1f97b6959e724
5952c924d70c8eca41c2be8b22d965c014b539ea
refs/heads/main
2023-05-31T04:52:36.303660
2021-07-07T01:03:23
2021-07-07T01:03:23
351,292,392
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
package aulas.orientacaoobjetos.part02.construtores.exemplo001; public class ExemploInstanciaObjeto { public static void main(String[] args) { Pessoa pessoa = new Pessoa(); System.out.println(pessoa.getNome()); } }
0009bb58e04225d4cf9bc9cf302684bd413c1162
9e5acee61b1700e92f8b93a76d706c63a13370d7
/MreznoProgramiranje/src/demo/Server.java
bc22195018c7df92de0af991410e419a65fa2a68
[]
no_license
DjordjeRasic/Vezbe3
934a784a1b7ac656fe34c49961dd2d06f54f5683
e50564c4c4cc8e66dece4eb03244eedb71f6520c
refs/heads/main
2023-03-18T02:36:13.256207
2021-03-22T16:27:06
2021-03-22T16:27:06
350,380,491
0
0
null
null
null
null
UTF-8
Java
false
false
689
java
package demo; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class Server { public static void main(String[] args) throws IOException, InterruptedException { int port = 9000; ServerSocket ss = null; try { ss = new ServerSocket(port); System.out.println("Server slusa"); while(true) { Socket sock = ss.accept(); ServerThread thread = new ServerThread(sock); thread.start(); } } catch (IOException e) { e.printStackTrace(); } finally { ss.close(); } } }
3b643c77007aac22c4ed2448283ea5cd11986cb5
53e38f2e49945c4e8dc8c18999232a2e40a2e14f
/CS449Projects/UmpireBuddy/app/src/main/java/com/example/osiri_000/umpirebuddy/SettingsActivity.java
a574a2d81ecaeb551e971dc2d6102db64eccd9b6
[]
no_license
mlh758/School-Projects
c5fed88817dd480e789324124534d102ed8cd1be
caea9fd70feb926b4dbdd37e6dfef8acf9084f53
refs/heads/master
2021-01-10T19:04:35.637733
2014-11-11T23:35:26
2014-11-11T23:35:26
22,628,010
0
0
null
null
null
null
UTF-8
Java
false
false
4,471
java
package com.example.osiri_000.umpirebuddy; import android.annotation.TargetApi; import android.content.Context; import android.content.res.Configuration; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceCategory; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.RingtonePreference; import android.text.TextUtils; import java.util.List; /** * A {@link PreferenceActivity} that presents a set of application settings. On * handset devices, settings are presented as a single list. On tablets, * settings are split by category, with category headers shown to the left of * the list of settings. * <p> * See <a href="http://developer.android.com/design/patterns/settings.html"> * Android Design: Settings</a> for design guidelines and the <a * href="http://developer.android.com/guide/topics/ui/settings.html">Settings * API Guide</a> for more information on developing a Settings UI. */ public class SettingsActivity extends PreferenceActivity { /** * Determines whether to always show the simplified settings UI, where * settings are presented in a single list. When false, settings are shown * as a master/detail two-pane view on tablets. When true, a single pane is * shown on tablets. */ private static final boolean ALWAYS_SIMPLE_PREFS = false; @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); setupSimplePreferencesScreen(); } /** * Shows the simplified settings UI if the device configuration if the * device configuration dictates that a simplified, single-pane UI should be * shown. */ private void setupSimplePreferencesScreen() { if (!isSimplePreferences(this)) { return; } // In the simplified UI, fragments are not used at all and we instead // use the older PreferenceActivity APIs. // Add 'general' preferences. addPreferencesFromResource(R.xml.pref_general); } /** * {@inheritDoc} */ @Override public boolean onIsMultiPane() { return isXLargeTablet(this) && !isSimplePreferences(this); } /** * Helper method to determine if the device has an extra-large screen. For * example, 10" tablets are extra-large. */ private static boolean isXLargeTablet(Context context) { return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE; } /** * Determines whether the simplified settings UI should be shown. This is * true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device * doesn't have newer APIs like {@link PreferenceFragment}, or the device * doesn't have an extra-large screen. In these cases, a single-pane * "simplified" settings UI should be shown. */ private static boolean isSimplePreferences(Context context) { return ALWAYS_SIMPLE_PREFS || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB || !isXLargeTablet(context); } /** * {@inheritDoc} */ @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onBuildHeaders(List<Header> target) { if (!isSimplePreferences(this)) { loadHeadersFromResource(R.xml.pref_headers, target); } } /** * This fragment shows general preferences only. It is used when the * activity is showing a two-pane settings UI. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static class GeneralPreferenceFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_general); // Bind the summaries of EditText/List/Dialog/Ringtone preferences // to their values. When their values change, their summaries are // updated to reflect the new value, per the Android Design // guidelines. } } }
8fe0046f5f096606fabf73239ae793fabc33feff
b354d1c34ad3b18a36103068dfa8f974d0a3afb0
/Java/JavaProgrammingMasterclassForSoftwareDevelopers/LectureChallenges/115_AbstractClassChallenge/src/com/adamhosman/LinkedOrderedSetOfStrings.java
03d6589abb57ec345cf2b38d23051b85548bd342
[]
no_license
hosmanadam/practice-files
d5fa5067b6ca503dc0fb41f54f98922cec0d5de6
bcef330bc7f97b74c030e09a0779c825d6b968b0
refs/heads/master
2021-07-24T01:32:45.969189
2020-05-11T02:05:25
2020-05-11T02:05:25
165,664,287
1
1
null
null
null
null
UTF-8
Java
false
false
1,325
java
package com.adamhosman; import java.util.ArrayList; public class LinkedOrderedSetOfStrings implements NodeList { private StringListNode rootNode; public LinkedOrderedSetOfStrings() { this.rootNode = null; } public LinkedOrderedSetOfStrings(String[] initialItems) { this(); addAll(initialItems); } @Override public ListNode getRootNode() { return rootNode; } @Override public void setRootNode(ListNode listNode) { rootNode = (StringListNode) listNode; } @Override public String get(int requiredIndex) { ListNode node = getNode(requiredIndex); return (node != null ? (String) node.getValue() : null); } @Override public boolean add(Object string) { StringListNode newNode = new StringListNode((String) string); return addNode(newNode); } @Override public String toString() { String contents = " {\n " + String.join(",\n ", toArrayListOfStrings()) + "\n}"; return getClass().getSimpleName() + contents; } public ArrayList<String> toArrayListOfStrings() { ArrayList<String> arrayList = new ArrayList<>(); for (int i = 0; get(i) != null; i++) { arrayList.add(get(i)); } return arrayList; } }
d897fe62589c6bd90c1fabc26197dd3612ab5ea5
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/31/31_36a9b73f53b7251483c606f3a773fac50b8452d9/DOMSelector/31_36a9b73f53b7251483c606f3a773fac50b8452d9_DOMSelector_t.java
f7a5479332c36b5704d49d7473a3ddc56de8c164
[]
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
40,474
java
/* * ============================================================================= * * Copyright (c) 2011-2012, The THYMELEAF team (http://www.thymeleaf.org) * * 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.thymeleaf.dom; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.thymeleaf.exceptions.TemplateProcessingException; import org.thymeleaf.util.StringUtils; import org.thymeleaf.util.Validate; /** * <p> * DOM Selectors model selections of subtrees from Thymeleaf DOM trees. * </p> * <p> * A common use of these selectors is for including fragments of other templates * without the need of these other templates having any Thymeleaf code. * </p> * <p> * Note this class exists since 2.0.0, but its syntax has been greatly enhanced in 2.1.0. * </p> * <h3>Selection features</h3> * <p> * DOM Selector selection operations are based on: * </p> * <ul> * <li>The <i><b>type of node</b></i>: both tags (<i>elements</i>) and text nodes can be selected.</li> * <li>The <i><b>name of the element</b></i> (<i>element</i> = <i>tag</i>).</li> * <li>The <i><b>path and depth</b></i> of the node in the DOM tree.</li> * <li>The <i><b>attributes</b></i> of the element (if it is an element).</li> * <li>The <i><b>index</b></i> of the node: its position among its siblings (<i>brother nodes of the same kind</i>).</li> * <li>The <i><b>references</b></i> applied to the node. These references are resolved by means of the * specification of an object implementing {@link INodeReferenceChecker} at selector execution time, and * allow the selection of nodes by features other than the standard ones (name, attributes, etc.).</li> * </ul> * <h3>Syntax</h3> * <p> * DOM Selector syntax is similar to that of XPath or jQuery selectors: * </p> * <ul> * <li>Paths: * <ul> * <li><tt>/x</tt> means <i>direct children of the current node which either have name <tt>x</tt> or match * reference <tt>x</tt></i>. For example: <tt>/html/body/ul/li</tt>.</li> * <li><tt>//x</tt> means <i>children of the current node which either have name <tt>x</tt> or match * reference <tt>x</tt>, at any depth</i>. For example: <tt>//li</tt>.</li></li> * <li><tt>x</tt> is exactly equivalent to <tt>//x</tt>.</li> * <li><tt>text()</tt> means <i>Text nodes (at the specified level)</i>. For example: <tt>//li/text()</tt>.</li> * </ul> * </li> * <li>Attribute/index modifiers: * <ul> * <li><tt>x[@z='v']</tt> means <i>elements with name <tt>x</tt> and an attribute called z with * value <tt>v</tt></i>.</li> * <li><tt>[@z='v']</tt> means <i>elements with any name and an attribute called z with * value <tt>v</tt></i>.</li> * <li>Other operators are also valid, besides <tt>=</tt> (equal): <tt>!=</tt> (not equal), * <tt>^=</tt> (starts with) and <tt>$=</tt> (ends with). For example: * <tt>x[@class^='section']</tt> means <i>elements with name <tt>x</tt> and a value for * attribute <tt>class</tt> that starts with <tt>section</tt></i>.</li> * <li>Attributes can be specified both starting with <tt>@</tt> (XPath-style) and without * (jQuery-style). So <tt>x[@z='v']</tt> is actually equivalent to <tt>x[z='v']</tt>.</li> * <li><tt>x[@z1='v1' and @z2='v2']</tt> means <i>elements with name <tt>x</tt> and attributes * <tt>z1</tt> and <tt>z2</tt> with values <tt>v1</tt> and <tt>v2</tt>, respectively</i>.</li> * <li>Multiple-attribute modifiers can be joined with <tt>and</tt> (XPath-style) and also by chaining * multiple modifiers (jQuery-style). So <tt>x[@z1='v1' and @z2='v2']</tt> is actually equivalent * to <tt>x[@z1='v1'][@z2='v2']</tt> (and also to <tt>x[z1='v1'][z2='v2']</tt>)</li> * <li><tt>x[i]</tt> means <i>element with name <tt>x</tt> positioned in number <tt>i</tt> among * its siblings</i>. Note index modifiers must always come after all attribute modifiers.</li> * <li><tt>x[@z='v'][i]</tt> means <i>elements with name <tt>x</tt>, attribute <tt>z</tt> with * value <tt>v</tt> and positioned in number <tt>i</tt> among its siblings that also match this * condition</i>.</li> * </ul> * </li> * <li>Direct selectors: * <ul> * <li><tt>x.oneclass</tt> is equivalent to <tt>x[class='oneclass']</tt>.</li> * <li><tt>.oneclass</tt> is equivalent to <tt>[class='oneclass']</tt>.</li> * <li><tt>x#oneid</tt> is equivalent to <tt>x[id='oneid']</tt>.</li> * <li><tt>#oneid</tt> is equivalent to <tt>[id='oneid']</tt>.</li> * <li><tt>x%oneref</tt> means <i>nodes -not just elements- with name <tt>x</tt> that match reference <tt>oneref</tt> according to * the specified {@link INodeReferenceChecker} implementation.</i>.</li> * <li><tt>%oneref</tt> means <i>nodes -not just elements- with any name that match reference <tt>oneref</tt> according to * the specified {@link INodeReferenceChecker} implementation.</i>. Note this is actually equivalent * to simply <tt>oneref</tt> because references can be used instead of element names, as explained above.</li> * <li>Direct selectors and attribute selectors can be mixed: <tt>a.external[@href^='https']</tt>.</li> * </ul> * </li> * <li>Specific features: * <ul> * <li>DOM Selectors understand the <tt>class</tt> attribute to be multivalued, and therefore allow * the application of modifiers on this attribute even if the element has several class values. For example, * <tt>x[class='two']</tt> will match <tt>&lt;x class="one two three"/&gt;</tt>.</li> * </ul> * </li> * </ul> * <p> * Objects of this class are <b>thread-safe</b>. * </p> * * @author Daniel Fern&aacute;ndez * * @since 2.0.0 * */ public final class DOMSelector implements Serializable { private static final long serialVersionUID = -1680336779267140369L; private static final String TEXT_SELECTOR = "text()"; private static final String ID_MODIFIER_SEPARATOR = "#"; private static final String CLASS_MODIFIER_SEPARATOR = "."; private static final String REFERENCE_MODIFIER_SEPARATOR = "%"; private static final String ID_ATTRIBUTE_NAME = "id"; private static final String CLASS_ATTRIBUTE_NAME = "class"; private static final String selectorPatternStr = "^(/{1,2})([^/\\s]*?)(\\[(?:.*)\\])?$"; private static final Pattern selectorPattern = Pattern.compile(selectorPatternStr); private static final String modifiersPatternStr = "^(?:\\[(.*?)\\])(\\[(?:.*)\\])?$"; private static final Pattern modifiersPattern = Pattern.compile(modifiersPatternStr); private final String selectorExpression; private final boolean descendMoreThanOneLevel; private final String selectorPath; // This will not be normalized in case it is a reference private final String normalizedSelectorPath; // We keep a normalized version in case it refers to a tag name private final String selectorPathIdModifier; private final String selectorPathClassModifier; private final String selectorPathReferenceModifier; private final boolean text; private List<AttributeCondition> attributes = null; private Integer index = null; // will be -1 if last() private final DOMSelector next; /** * <p> * Creates a new DOM selector specified by the argument selector * expression. * </p> * * @param selectorExpression the expression specifying the selector to be used. */ public DOMSelector(final String selectorExpression) { this(selectorExpression, true); } private DOMSelector(final String selectorExpression, final boolean atRootLevel) { super(); /* * STRATEGY: We will divide the DOM Selector into several, one for each level, and chain them all using the * 'next' property. That way, a '/x//y[0]/z[@id='a']' selector will be divided into three chained selectors, * like: '/x' -(next)-> '//y[0]' -(next)-> '/z[@id='a']' */ this.selectorExpression = selectorExpression; String selectorSpecStr = selectorExpression.trim(); if (atRootLevel) { if (!selectorSpecStr.startsWith("/")) { // "x" is equivalent to "//x" selectorSpecStr = "//" + selectorSpecStr; } } // if we are not at root level, expression will always start with "/", and that's fine. final int selectorSpecStrLen = selectorSpecStr.length(); int firstNonSlash = 0; while (firstNonSlash < selectorSpecStrLen && selectorSpecStr.charAt(firstNonSlash) == '/') { firstNonSlash++; } if (firstNonSlash >= selectorSpecStrLen) { throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": '/' should be followed by " + "further selector specification"); } final int selEnd = selectorSpecStr.substring(firstNonSlash).indexOf('/'); if (selEnd != -1) { final String tail = selectorSpecStr.substring(firstNonSlash).substring(selEnd); selectorSpecStr = selectorSpecStr.substring(0, firstNonSlash + selEnd); this.next = new DOMSelector(tail, false); } else { this.next = null; } final Matcher matcher = selectorPattern.matcher(selectorSpecStr); if (!matcher.matches()) { throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": selector does not match selector syntax: " + "((/|//)?selector)?([@attrib=\"value\" (and @attrib2=\"value\")?])?([index])?"); } final String rootGroup = matcher.group(1); final String selectorNameGroup = matcher.group(2); final String modifiersGroup = matcher.group(3); if (rootGroup == null) { throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": selector does not match selector syntax: " + "((/|//)?selector)?([@attrib=\"value\" (and @attrib2=\"value\")?])?([index])?"); } if ("//".equals(rootGroup)) { this.descendMoreThanOneLevel = true; } else if ("/".equals(rootGroup)) { this.descendMoreThanOneLevel = false; } else { throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": selector does not match selector syntax: " + "((/|//)?selector)?([@attrib=\"value\" (and @attrib2=\"value\")?])?([index])?"); } if (selectorNameGroup == null) { throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": selector does not match selector syntax: " + "((/|//)?selector)?([@attrib=\"value\" (and @attrib2=\"value\")?])?([index])?"); } /* * Process path: extract id, class, reference modifiers... */ String path = selectorNameGroup; final int idModifierPos = path.indexOf(ID_MODIFIER_SEPARATOR); final int classModifierPos = path.indexOf(CLASS_MODIFIER_SEPARATOR); final int referenceModifierPos = path.indexOf(REFERENCE_MODIFIER_SEPARATOR); if (idModifierPos != -1) { if (classModifierPos != -1 || referenceModifierPos != -1) { throw new TemplateProcessingException( "More than one modifier (id, class, reference) have been specified at " + "DOM selector expression \"" + this.selectorExpression + "\", which is forbidden."); } this.selectorPathIdModifier = path.substring(idModifierPos + ID_MODIFIER_SEPARATOR.length()); path = path.substring(0, idModifierPos); if (StringUtils.isEmptyOrWhitespace(this.selectorPathIdModifier)) { throw new TemplateProcessingException( "Empty id modifier in DOM selector expression " + "\"" + this.selectorExpression + "\", which is forbidden."); } } else { this.selectorPathIdModifier = null; } if (classModifierPos != -1) { if (idModifierPos != -1 || referenceModifierPos != -1) { throw new TemplateProcessingException( "More than one modifier (id, class, reference) have been specified at " + "DOM selector expression \"" + this.selectorExpression + "\", which is forbidden."); } this.selectorPathClassModifier = path.substring(classModifierPos + CLASS_MODIFIER_SEPARATOR.length()); path = path.substring(0, classModifierPos); if (StringUtils.isEmptyOrWhitespace(this.selectorPathClassModifier)) { throw new TemplateProcessingException( "Empty id modifier in DOM selector expression " + "\"" + this.selectorExpression + "\", which is forbidden."); } } else { this.selectorPathClassModifier = null; } if (referenceModifierPos != -1) { if (idModifierPos != -1 || classModifierPos != -1) { throw new TemplateProcessingException( "More than one modifier (id, class, reference) have been specified at " + "DOM selector expression \"" + this.selectorExpression + "\", which is forbidden."); } this.selectorPathReferenceModifier = path.substring(referenceModifierPos + REFERENCE_MODIFIER_SEPARATOR.length()); path = path.substring(0, referenceModifierPos); if (StringUtils.isEmptyOrWhitespace(this.selectorPathReferenceModifier)) { throw new TemplateProcessingException( "Empty id modifier in DOM selector expression " + "\"" + this.selectorExpression + "\", which is forbidden."); } } else { this.selectorPathReferenceModifier = null; } this.selectorPath = path; this.normalizedSelectorPath = Node.normalizeName(this.selectorPath); this.text = TEXT_SELECTOR.equals(this.normalizedSelectorPath); /* * Process classifiers: attributes and index. */ if (modifiersGroup != null) { /* * A selector level can include two types of filters between [...], in this order: * * 1. Attribute based: [@a='X' and @b='Y'], any number of them: [@a='X'][@b='Y']... * * 2. Index based: [23] */ String remainingModifiers = modifiersGroup; while (remainingModifiers != null) { // This pattern is made to be recursive, acting group 2 as the recursion tail final Matcher modifiersMatcher = modifiersPattern.matcher(remainingModifiers); if (!modifiersMatcher.matches()) { throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": selector does not match selector syntax: " + "((/|//)?selector)?([@attrib=\"value\" (and @attrib2=\"value\")?])?([index])?"); } final String currentModifier = modifiersMatcher.group(1); remainingModifiers = modifiersMatcher.group(2); final Integer modifierAsIndex = parseIndex(currentModifier); if (modifierAsIndex != null) { this.index = modifierAsIndex; if (remainingModifiers != null) { // If this is an index, it must be the last modifier! throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": selector does not match selector syntax: " + "((/|//)?selector)?([@attrib=\"value\" (and @attrib2=\"value\")?])?([index])?"); } } else { // Modifier is not an index final List<AttributeCondition> attribs = parseAttributes(selectorExpression, currentModifier); if (attribs == null) { throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": selector does not match selector syntax: " + "(/|//)(selector)([@attrib=\"value\" (and @attrib2=\"value\")?])?([index])?"); } if (this.attributes == null) { // This is done to save an object. The method that creates the "attribs" list is completely // under our control, so there should be no problem. this.attributes = attribs; } else { this.attributes.addAll(attribs); } } } if (this.descendMoreThanOneLevel && this.index != null) { throw new TemplateProcessingException( "Invalid syntax in DOM selector \"" + selectorExpression + "\": index cannot be specified on a \"descend any levels\" selector (//)."); } } } /** * <p> * Returns the expression that specifies this DOM selector. * </p> * * @return the selector expression. * @since 2.0.12 */ public String getSelectorExpression() { return this.selectorExpression; } private static Integer parseIndex(final String indexGroup) { if ("last()".equals(indexGroup.toLowerCase())) { return Integer.valueOf(-1); } try { return Integer.valueOf(indexGroup); } catch (final Exception ignored) { return null; } } private static List<AttributeCondition> parseAttributes(final String selectorSpec, final String indexGroup) { final List<AttributeCondition> attributes = new ArrayList<AttributeCondition>(3); parseAttributes(selectorSpec, attributes, indexGroup); return attributes; } private static void parseAttributes(final String selectorSpec, final List<AttributeCondition> attributes, final String indexGroup) { String att = null; final int andPos = indexGroup.indexOf(" and "); if (andPos != -1) { att = indexGroup.substring(0,andPos); final String tail = indexGroup.substring(andPos + 5); parseAttributes(selectorSpec, attributes, tail); } else { att = indexGroup; } parseAttribute(selectorSpec, attributes, att); } private static void parseAttribute(final String selectorSpec, final List<AttributeCondition> attributes, final String attributeSpec) { // 0 = attribute name, 1 = operator, 2 = value final String[] fragments = AttributeCondition.Operator.extractOperator(attributeSpec); if (fragments[1] != null) { // There is an operator String attrName = fragments[0]; final AttributeCondition.Operator operator = AttributeCondition.Operator.parse(fragments[1]); final String attrValue = fragments[2]; if (attrName.startsWith("@")) { attrName = attrName.substring(1); } if (!(attrValue.startsWith("\"") && attrValue.endsWith("\"")) && !(attrValue.startsWith("'") && attrValue.endsWith("'"))) { throw new TemplateProcessingException( "Invalid syntax in DOM selector: \"" + selectorSpec + "\""); } attributes.add(new AttributeCondition(Node.normalizeName(attrName), operator, attrValue.substring(1, attrValue.length() - 1))); } else { // There is NO operator String attrName = fragments[0]; if (attrName.startsWith("@")) { attrName = attrName.substring(1); } attributes.add(new AttributeCondition(Node.normalizeName(attrName), null, null)); } } /** * <p> * Executes the DOM selector against the specified node, returning * the result of applying the selector expression. * </p> * * @param node the node on which the selector will be executed. * @return the result of executing the selector. */ public List<Node> select(final Node node) { Validate.notNull(node, "Node to be searched cannot be null"); return select(Collections.singletonList(node), null); } /** * <p> * Executes the DOM selector against the specified node and * using the specified reference checker (if references are used in the DOM selector * expression). * </p> * * @param node the node on which the selector will be executed. * @param referenceChecker the checker that will be used to compute whether a Node matches or not * a specified reference. Can be null. * @return the result of executing the selector. * @since 2.1.0 */ public List<Node> select(final Node node, final INodeReferenceChecker referenceChecker) { Validate.notNull(node, "Node to be searched cannot be null"); return select(Collections.singletonList(node), referenceChecker); } /** * <p> * Executes the DOM selector against the specified list of nodes, * returning the result of applying the selector expression. * </p> * * @param nodes the nodes on which the selector will be executed. * @return the result of executing the selector. */ public List<Node> select(final List<Node> nodes) { return select(nodes, null); } /** * <p> * Executes the DOM selector against the specified list of nodes and * using the specified reference checker (if references are used in the DOM selector * expression). * </p> * * @param nodes the nodes on which the selector will be executed. * @param referenceChecker the checker that will be used to compute whether a Node matches or not * a specified reference. Can be null. * @return the result of executing the selector. * @since 2.1.0 */ public List<Node> select(final List<Node> nodes, final INodeReferenceChecker referenceChecker) { Validate.notEmpty(nodes, "Nodes to be searched cannot be null or empty"); final List<Node> selected = new ArrayList<Node>(10); for (final Node node : nodes) { doCheckNodeSelection(selected, node, referenceChecker); } return selected; } private boolean checkChildrenSelection(final List<Node> selectedNodes, final Node node, final INodeReferenceChecker referenceChecker) { // will return true if any nodes are added to selectedNodes if (node instanceof NestableNode) { final List<List<Node>> selectedNodesForChildren = new ArrayList<List<Node>>(10); final NestableNode nestableNode = (NestableNode) node; if (nestableNode.hasChildren()) { for (final Node child : nestableNode.getChildren()) { final List<Node> childSelectedNodes = new ArrayList<Node>(10); if (doCheckNodeSelection(childSelectedNodes, child, referenceChecker)) { selectedNodesForChildren.add(childSelectedNodes); } } } if (selectedNodesForChildren.size() == 0) { return false; } if (this.index == null) { for (final List<Node> selectedNodesForChild : selectedNodesForChildren) { selectedNodes.addAll(selectedNodesForChild); } return true; } // There is an index if (this.index.intValue() == -1) { selectedNodes.addAll(selectedNodesForChildren.get(selectedNodesForChildren.size() - 1)); return true; } if (this.index.intValue() >= selectedNodesForChildren.size()) { return false; } selectedNodes.addAll(selectedNodesForChildren.get(this.index.intValue())); return true; } return false; } private boolean doCheckNodeSelection(final List<Node> selectedNodes, final Node node, final INodeReferenceChecker referenceChecker) { if (!doCheckSpecificNodeSelection(node, referenceChecker)) { if (this.descendMoreThanOneLevel || node instanceof Document || node instanceof GroupNode) { // This level doesn't match, but maybe next levels do... if (node instanceof NestableNode) { final NestableNode nestableNode = (NestableNode) node; if (nestableNode.hasChildren()) { return checkChildrenSelection(selectedNodes, node, referenceChecker); } } } return false; } if (this.next == null) { selectedNodes.add(node); return true; } if (node instanceof NestableNode) { final NestableNode nestableNode = (NestableNode) node; if (nestableNode.hasChildren()) { return this.next.checkChildrenSelection(selectedNodes, node, referenceChecker); } } return false; } private boolean doCheckSpecificNodeSelection(final Node node, final INodeReferenceChecker referenceChecker) { // This method checks all aspects except index (index can only // be applied from the superior level) if (node instanceof Element) { final Element element = (Element)node; if (this.selectorPathIdModifier != null) { if (!checkPathWithIdModifier(element)) { return false; } } else if (this.selectorPathClassModifier != null) { if (!checkPathWithClassModifier(element)) { return false; } } else if (this.selectorPathReferenceModifier != null) { if (!checkPathWithReferenceModifier(element, referenceChecker)) { return false; } } else { if (!checkPathWithoutModifiers(element, referenceChecker)) { return false; } } if (this.attributes == null || this.attributes.size() == 0) { return true; } for (final AttributeCondition attributeCondition : this.attributes) { final String selectedAttributeName = attributeCondition.getName(); final boolean selectedAttributeMultipe = CLASS_ATTRIBUTE_NAME.equals(selectedAttributeName); if (!checkAttributeValue(element, selectedAttributeName, attributeCondition.getOperator(), attributeCondition.getValue(), selectedAttributeMultipe)) { return false; } } return true; } else if (node instanceof AbstractTextNode) { if (referenceChecker != null) { return this.text && referenceChecker.checkReference(node, this.selectorPath); } return this.text; } else { if (referenceChecker != null) { return referenceChecker.checkReference(node, this.selectorPath); } } return false; } private static boolean checkAttributeValue(final NestableAttributeHolderNode node, final String attributeName, final AttributeCondition.Operator operator, final String attributeValue, final boolean multivalued) { if (!node.hasNormalizedAttribute(attributeName)) { if (attributeValue == null) { return operator == AttributeCondition.Operator.EQUALS; } return operator == AttributeCondition.Operator.NOT_EQUALS; } final String nodeAttributeValue = node.getAttributeValueFromNormalizedName(attributeName); if (nodeAttributeValue == null) { if (attributeValue == null) { return operator == AttributeCondition.Operator.EQUALS; } return operator == AttributeCondition.Operator.NOT_EQUALS; } else if (attributeValue == null) { return operator == AttributeCondition.Operator.NOT_EQUALS; } if (!multivalued) { switch (operator) { case EQUALS: return nodeAttributeValue.equals(attributeValue); case NOT_EQUALS: return !nodeAttributeValue.equals(attributeValue); case STARTS_WITH: return nodeAttributeValue.startsWith(attributeValue); case ENDS_WITH: return nodeAttributeValue.endsWith(attributeValue); } } // Attribute IS multivalued if ((operator.equals(AttributeCondition.Operator.EQUALS) || operator.equals(AttributeCondition.Operator.NOT_EQUALS)) && !nodeAttributeValue.contains(attributeValue)) { // If it is equals/not equals, value must appear as a whole (not a prefix, suffix). If not, we can return. return operator.equals(AttributeCondition.Operator.NOT_EQUALS); } final StringTokenizer nodeAttrValueTokenizer = new StringTokenizer(nodeAttributeValue, ", "); while (nodeAttrValueTokenizer.hasMoreTokens()) { final String nodeAttrValueToken = nodeAttrValueTokenizer.nextToken(); switch (operator) { case EQUALS: if (nodeAttrValueToken.equals(attributeValue)) { return true; } break; case NOT_EQUALS: if (!nodeAttrValueToken.equals(attributeValue)) { return true; } break; case STARTS_WITH: if (nodeAttrValueToken.startsWith(attributeValue)) { return true; } break; case ENDS_WITH: if (nodeAttrValueToken.endsWith(attributeValue)) { return true; } break; } } return false; } private boolean checkPathWithIdModifier(final Element element) { if (this.selectorPathIdModifier == null) { return false; } final String elementName = element.getNormalizedName(); if (!StringUtils.isEmptyOrWhitespace(this.normalizedSelectorPath)) { if (!this.normalizedSelectorPath.equals(elementName)) { return false; } } // Checking the element name went OK, so lets check the ID return checkAttributeValue(element, ID_ATTRIBUTE_NAME, AttributeCondition.Operator.EQUALS, this.selectorPathIdModifier, false); } private boolean checkPathWithClassModifier(final Element element) { if (this.selectorPathClassModifier == null) { return false; } final String elementName = element.getNormalizedName(); if (!StringUtils.isEmptyOrWhitespace(this.normalizedSelectorPath)) { if (!this.normalizedSelectorPath.equals(elementName)) { return false; } } // Checking the element name went OK, so lets check the class return checkAttributeValue(element, CLASS_ATTRIBUTE_NAME, AttributeCondition.Operator.EQUALS, this.selectorPathClassModifier, true); } private boolean checkPathWithReferenceModifier(final Element element, final INodeReferenceChecker referenceChecker) { if (this.selectorPathReferenceModifier == null || referenceChecker == null) { // First one being null never happen, as we should never call this method if modifier is null return false; } final String elementName = element.getNormalizedName(); if (!StringUtils.isEmptyOrWhitespace(this.normalizedSelectorPath)) { if (!this.normalizedSelectorPath.equals(elementName)) { return false; } } // Checking the element name went OK, so lets check the reference return referenceChecker.checkReference(element, this.selectorPathReferenceModifier); } private boolean checkPathWithoutModifiers(final Element element, final INodeReferenceChecker referenceChecker) { final String elementName = element.getNormalizedName(); if (!StringUtils.isEmptyOrWhitespace(this.selectorPath)) { if (!this.normalizedSelectorPath.equals(elementName)) { if (referenceChecker == null) { return false; } return referenceChecker.checkReference(element, this.selectorPath); // This is the NOT normalized one! } } // We don't have any reasons to deny it matches return true; } @Override public String toString() { return this.selectorExpression; } private static final class AttributeCondition { static enum Operator { EQUALS, NOT_EQUALS, STARTS_WITH, ENDS_WITH; static Operator parse(final String operatorStr) { if (operatorStr == null) { return null; } if (operatorStr.equals("=")) { return EQUALS; } if (operatorStr.equals("!=")) { return NOT_EQUALS; } if (operatorStr.equals("^=")) { return STARTS_WITH; } if (operatorStr.equals("$=")) { return ENDS_WITH; } return null; } static String[] extractOperator(final String specification) { final int equalsPos = specification.indexOf('='); if (equalsPos == -1) { return new String[] {specification.trim(), null, null}; } final char cprev = specification.charAt(equalsPos - 1); switch (cprev) { case '!': return new String[] { specification.substring(0, equalsPos - 1).trim(), "!=", specification.substring(equalsPos + 1).trim()}; case '^': return new String[] { specification.substring(0, equalsPos - 1).trim(), "^=", specification.substring(equalsPos + 1).trim()}; case '$': return new String[] { specification.substring(0, equalsPos - 1).trim(), "$=", specification.substring(equalsPos + 1).trim()}; default: return new String[] { specification.substring(0, equalsPos).trim(), "=", specification.substring(equalsPos + 1).trim()}; } } } private final String name; private final Operator operator; private final String value; AttributeCondition(final String name, final Operator operator, final String value) { super(); this.name = name; this.operator = operator; this.value = value; } private String getName() { return this.name; } private Operator getOperator() { return operator; } private String getValue() { return value; } } public static interface INodeReferenceChecker { public boolean checkReference(final Node node, final String referenceValue); } public static abstract class AbstractNodeReferenceChecker implements INodeReferenceChecker { protected AbstractNodeReferenceChecker() { super(); } } public static final class AggregatingNodeReferenceChecker extends AbstractNodeReferenceChecker { private final INodeReferenceChecker one; private final INodeReferenceChecker two; public AggregatingNodeReferenceChecker(final INodeReferenceChecker one, final INodeReferenceChecker two) { super(); Validate.notNull(one, "Reference checker one cannot be null"); Validate.notNull(two, "Reference checker two cannot be null"); this.one = one; this.two = two; } public boolean checkReference(final Node node, final String referenceValue) { if (this.one.checkReference(node, referenceValue)) { return true; } return this.two.checkReference(node, referenceValue); } } }
8188ebbfe9de0ac740ce6c911558ad2a5230462e
5acdac8e3d08b43f394ba32bd280211d9913e562
/client/app/src/main/java/com/example/asus/pad3/model/Book.java
41b150d4e8102409b4a07d87d7bd3db8b2072651
[]
no_license
PAD3/PAD
f28d1ca66c456f9e29a61d942b1b32b3cb92faaa
d5916e15956594854273484fd1915e4a81e8f952
refs/heads/master
2021-08-31T08:50:58.440713
2017-12-20T20:36:27
2017-12-20T20:36:27
109,436,170
0
2
null
2017-12-20T20:36:28
2017-11-03T19:41:29
Java
UTF-8
Java
false
false
315
java
package com.example.asus.pad3.model; /** * Created by ASUS on 22.11.2017. */ public class Book { String book; public Book(String book) { this.book = book; } public String getBook() { return book; } public void setBook(String book) { this.book = book; } }
578bbbc61703559b424b79af02d7ba12a735559f
34264196973d7d370fcbe00443c61da6bd9f6d8e
/bluetoothlibrary/src/main/java/com/example/bluetoothlibrary/bluetooth3/IBTManager.java
2e664dd5c17c85344de06133b4dee0616c554dbc
[]
no_license
xiaoqianyun/AndroidBluetoothLibrary
b167361a419758535c88063048ca6af2addd33be
b87f1231b85985181e4c4bbe0bb29cc03d122464
refs/heads/master
2020-05-25T12:59:35.306705
2019-05-21T10:24:48
2019-05-21T10:24:48
187,811,189
0
0
null
null
null
null
UTF-8
Java
false
false
1,773
java
package com.example.bluetoothlibrary.bluetooth3; import android.bluetooth.BluetoothDevice; import android.content.Context; import com.example.bluetoothlibrary.listener.OnBTConReceiverListener; import com.example.bluetoothlibrary.listener.OnBTConnectListener; import com.example.bluetoothlibrary.listener.OnBindStateChangeListener; import com.example.bluetoothlibrary.listener.OnBluetoothStateChangeListener; import com.example.bluetoothlibrary.listener.OnDeviceSearchListener; import java.util.List; public interface IBTManager { //初始化蓝牙 void initBluetooth(Context context); //打开蓝牙 void openBluetooth(Context context,boolean isFast); //注销蓝牙广播 void unRegisterBluetoothReceiver(Context context); void startDiscoveryDevice(OnDeviceSearchListener onDeviceSearchListener); void startDiscoveryDevice(OnDeviceSearchListener onDeviceSearchListener,long scanTime); void removeStopScanRunnable(); void stopDiscoveryDevice(); void startConnectDevice(BluetoothDevice bluetoothDevice, String uuid, long conOutTime, final OnBTConnectListener onBTConnectListener, OnBTConReceiverListener onBTConReceiverListener); void clearConnectedThread(); boolean sendData(String data,boolean isHex); boolean sendData(byte[] data); List<BluetoothDevice> getBoundDeviceList(); boolean boundDevice(BluetoothDevice bluetoothDevice); boolean disBoundDevice(BluetoothDevice bluetoothDevice); boolean getBluetoothState(); void setOnBluetoothStateChangeListener(OnBluetoothStateChangeListener onBluetoothStateChangeListener); void setOnBindStateChangeListener( OnBindStateChangeListener onBindStateChangeListener); BluetoothDevice getDeviceByAddress(String macAddress); }
02699ef52b771746bcdfbd12957722e2fab1a131
25e1fa3e7f58c8d0503030093888dc9c6540942e
/sap/src/java/com/sap/actions/EditarObjetivo.java
7ad05b41ac63b491713cc0e3d8ae7c5b89f35af6
[]
no_license
oscar7685/autoevaluacion-programas
20db4ad16db8eefd3042328549db023ae51706e3
087101cb15e7b5b2a854c2ea93c78c16b02a7bac
refs/heads/master
2016-09-05T15:09:05.349894
2015-02-19T19:16:22
2015-02-19T19:16:22
32,363,740
0
0
null
null
null
null
UTF-8
Java
false
false
1,584
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.sap.actions; import com.sap.ejb.ObjetivosFacade; import com.sap.entity.Objetivos; import com.sap.interfaz.Action; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; /** * * @author acreditacion */ public class EditarObjetivo implements Action { ObjetivosFacade objetivosFacade = lookupObjetivosFacadeBean(); @Override public String procesar(HttpServletRequest request) throws IOException, ServletException { HttpSession sesion = request.getSession(); String id = request.getParameter("id"); Objetivos o = objetivosFacade.find(Integer.parseInt(id)); sesion.setAttribute("objetivo", o); return "/WEB-INF/vista/comitePrograma/proceso/planMejoramiento/objetivos/editar.jsp"; } private ObjetivosFacade lookupObjetivosFacadeBean() { try { Context c = new InitialContext(); return (ObjetivosFacade) c.lookup("java:global/sap/ObjetivosFacade!com.sap.ejb.ObjetivosFacade"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } } }
[ "[email protected]@1f778d08-6a24-237e-7ea0-1be564a80ae2" ]
[email protected]@1f778d08-6a24-237e-7ea0-1be564a80ae2
1dc710ff8f34481d842bf32685419441ef1caefe
171d98f4b1b08f68439911162c1b1c4ebc903c37
/src/main/java/com/example/musicstoredemo/SwaggerConfig.java
40327ddbcdaeb3b2e44efe87162ffd0d1c67f3a2
[]
no_license
MariyaChuchalina/music-store-demo
287e493a8b0e0bb754381509bd37128314906b36
56abe8a1e31898c9c4ca4d99a43832c69503b492
refs/heads/master
2023-07-13T13:50:09.520158
2021-08-23T09:55:47
2021-08-23T11:42:29
397,134,673
0
0
null
null
null
null
UTF-8
Java
false
false
1,005
java
package com.example.musicstoredemo; import com.example.musicstoredemo.model.catalog.items.Accessory; import com.example.musicstoredemo.model.catalog.items.Guitar; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage("com.example.musicstoredemo.controller")) .paths(PathSelectors.any()) .build() .ignoredParameterTypes(Accessory.class, Guitar.class); } }
13662675c805185db9268d37cb616a27be948708
69011b4a6233db48e56db40bc8a140f0dd721d62
/src/com/jshx/fwgl/service/impl/SendInformationServiceImpl.java
abc0c88163fb135c855dcd21691f49c9ad96742f
[]
no_license
gechenrun/scysuper
bc5397e5220ee42dae5012a0efd23397c8c5cda0
e706d287700ff11d289c16f118ce7e47f7f9b154
refs/heads/master
2020-03-23T19:06:43.185061
2018-06-10T07:51:18
2018-06-10T07:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,006
java
package com.jshx.fwgl.service.impl; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.HashMap; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.jshx.core.base.service.impl.BaseServiceImpl; import com.jshx.core.base.vo.Pagination; import com.jshx.fwgl.dao.SendInformationDao; import com.jshx.fwgl.entity.SendInformation; import com.jshx.fwgl.service.SendInformationService; import com.jshx.module.admin.entity.User; import com.jshx.module.infomation.entity.Dept; import com.jshx.module.infomation.entity.NoticeCallback; @Service("sendInformationService") public class SendInformationServiceImpl extends BaseServiceImpl implements SendInformationService { /** * Dao类 */ @Autowired() @Qualifier("sendInformationDao") private SendInformationDao sendInformationDao; /** * 分页查询 * @param page 分页信息 * @param paraMap 查询条件信息 * @return 分页信息 */ public Pagination findByPage(Pagination page, Map<String, Object> paraMap) { return sendInformationDao.findByPage(page, paraMap); } /** * 根据主键ID查询信息 * @param id 主键ID * @return 主键ID对应的信息 */ public SendInformation getById(String id) { return sendInformationDao.getById(id); } /** * 保存信息 * @param model 信息 */ @Transactional public void save(SendInformation sendInformation) { sendInformationDao.save(sendInformation); } /** * 修改信息 * @param model 信息 */ @Transactional public void update(SendInformation sendInformation) { sendInformationDao.update(sendInformation); } /** * 物理删除信息 * @param ids 主键ID列表 */ @Transactional public void delete(String[] ids) { List list=Arrays.asList(ids); Map<String, Object> paraMap = new HashMap<String, Object>(); paraMap.put("ids", list); List objects=sendInformationDao.findSendInformation(paraMap); sendInformationDao.removeAll(objects); } /** * 逻辑删除信息 * @param ids 主键ID列表 */ @Transactional public void deleteWithFlag(String ids) { String[] idArray = ids.split("\\|"); if(null != idArray) { for(String id : idArray) { if(id!=null && !id.trim().equals("")) sendInformationDao.deleteWithFlag(id); } } } /** * 查询所有人员 */ public List<User> getAllUsersByMap(Map map) { return sendInformationDao.getAllUsersByMap(map); } /** * 查询所有部门 */ public List<Dept> getAllDepartByMap(Map map) { return sendInformationDao.getAllDepartByMap(map); } /** * 查询已阅读人员 */ public List<NoticeCallback> getUserReadedids(String id) { return sendInformationDao.getUserReadedids(id); } /** * 保存阅读记录 */ @Transactional public void saveNoticeBack(NoticeCallback noticeCallback) { sendInformationDao.saveNoticeBack(noticeCallback); } /** * 更新阅读记录 */ @Transactional public void updateNoticeBack(NoticeCallback noticeCallback) { sendInformationDao.updateNoticeBack(noticeCallback); } /** * 获取当前人员阅读记录 */ public List<NoticeCallback> geReadedUsersIds(String id,String userId) { return sendInformationDao.geReadedUsersIds(id, userId); } /** * 获取当前人员阅读记录 */ public List<NoticeCallback> geBackById(Map map) { return sendInformationDao.geBackById(map); } /** * 删除已有阅读记录 */ @Transactional public void deleteNoticeBackByMap(Map map) { sendInformationDao.deleteNoticeBackByMap(map); } //获取安监局领导角色的Id和name public List<Map<String,Object>> findAJJldListByMap(Map<String, Object> paraMap){//获取安监局领导角色的Id和name return sendInformationDao.findAJJldListByMap(paraMap); } }
3344b6f83417c1ac19ae3c2a97f6ad8aecbae347
a8ad7f8fcef4160c656a62a05a8ae48fb73217c6
/PokeMon.java
5a5d426b8625cf06a4c0f01d94506eb8caeb2e8d
[]
no_license
Naskich/Java-Fundamentals
c51448665224991cd7978d276067623f17747e5c
f678739d5e3a55a1a16cf3723777fb5efd1d1d8c
refs/heads/main
2023-03-30T18:11:26.757027
2020-12-08T10:49:36
2020-12-08T10:49:36
315,110,573
0
0
null
2021-03-23T04:10:03
2020-11-22T18:58:58
Java
ISO-8859-1
Java
false
false
3,323
java
/*10. *Poke Mon A Poke Mon is a special type of pokemon which likes to Poke others. But at the end of the day, the Poke Mon wants to keeps statistics, about how many pokes it has managed to make. The Poke Mon pokes his target, and then proceeds to poke another target. The distance between his targets reduces his poke power. You will be given the poke power the Poke Mon has, N – an integer. Then you will be given the distance between the poke targets, M – an integer. Then you will be given the exhaustionFactor Y – an integer. Your task is to start subtracting M from N until N becomes less than M, i.e. the Poke Mon does not have enough power to reach the next target. Every time you subtract M from N that means you’ve reached a target and poked it successfully. COUNT how many targets you’ve poked – you’ll need that count. The Poke Mon becomes gradually more exhausted. IF N becomes equal to EXACTLY 50 % of its original value, you must divide N by Y, if it is POSSIBLE. This DIVISION is between integers. If a division is not possible, you should NOT do it. Instead, you should continue subtracting. After dividing, you should continue subtracting from N, until it becomes less than M. When N becomes less than M, you must take what has remained of N and the count of targets you’ve poked, and print them as output. NOTE: When you are calculating percentages, you should be PRECISE at maximum. Example: 505 is NOT EXACTLY 50 % from 1000, its 50.5 %. Input • The input consists of 3 lines. • On the first line you will receive N – an integer. • On the second line you will receive M – an integer. • On the third line you will receive Y – an integer. Output • The output consists of 2 lines. • On the first line print what has remained of N, after subtracting from it. • On the second line print the count of targets, you’ve managed to poke. Constrains • The integer N will be in the range [1, 2.000.000.000]. • The integer M will be in the range [1, 1.000.000]. • The integer Y will be in the range [0, 9]. • Allowed time / memory: 16 MB / 100ms. Examples Input Output Comments 5 2 3 1 2 N = 5, M = 2, Y = 3. We start subtracting M from N. N – M = 3. 1 target poked. N – M = 1. 2 targets poked. N < M. We print what has remained of N, which is 1. We print the count of targets, which is 2. 10 5 2 2 1 N = 10, M = 5, Y = 2. We start subtracting M from N. N – M = 5. (N is still not less than M, they are equal). N became EXACTLY 50 % of its original value. 5 is 50 % from 10. So we divide N by Y. N / Y = 5 / 2 = 2. (INTEGER DIVISION). * */ import java.util.Scanner; public class PokeMon { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int pokeMonPower = Integer.parseInt(scanner.nextLine()); int pokeMonDistansTargets = Integer.parseInt(scanner.nextLine()); int thirdLineY = Integer.parseInt(scanner.nextLine()); int count = 0; int currentPower = pokeMonPower; while (currentPower>=pokeMonDistansTargets) { currentPower-=pokeMonDistansTargets; count++; if (currentPower==pokeMonPower*0.5 && thirdLineY!=0) { currentPower/=thirdLineY; } } System.out.println(currentPower); System.out.println(count); } }
68e16f4932ececd3d96f533539ee81faeedce20c
ee911e621f4367f813f8d24e248b9d0263f7aa1a
/app/src/main/java/com/tastes/content/Tag.java
016044d932026d0068241a1a53488d66169f04c3
[]
no_license
grep-services/tastes-android
a8f6540164f07e45bb8eda28236cb87f8e571a39
b3a05e5ebffda3f107254d59d1087deac3174091
refs/heads/master
2021-05-28T14:50:29.065027
2015-05-03T16:01:19
2015-05-03T16:01:19
26,577,820
0
0
null
null
null
null
UTF-8
Java
false
false
143
java
package com.tastes.content; /** * Created by marine1079 on 2015-02-06. */ public class Tag { public final static String HEADER = "#"; }
696e8afb485d840a884b9673ccc93e06e5cbc16f
d05a83617dad6f5b96927b7e57abf391f5fe2f2f
/SPOJ/ComputerAverage.java
80d7223e3dae996af1b10f21f8a66d91524a3310
[]
no_license
maharlikans/Practice
3790d8855c6df3cd5be6ef70d092555604a48951
c42ba984f2bc5faf643d9b463335cc1cc2600edd
refs/heads/master
2021-01-15T13:11:02.333435
2013-10-29T00:23:25
2013-10-29T00:23:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
634
java
import java.util.Scanner; // Scanner is in the java.util package public class ComputeAverage { public static void main(String[] args) { // Create a Scanner object Scanner input = new Scanner(System.in); // Prompt the user to enter three numbers System.out.print("Enter three numbers: "); double number1 = input.nextDouble(); double number2 = input.nextDouble(); double number3 = input.nextDouble(); // Compute average double average = (number1 + number2 + number3) / 3; // Display result System.out.println("The average of " + number1 + " " + number2 + " " + number3 + " is " +average); } }
1ffd4f66bbedc7606bbd5a902df6f91b6f879cbd
090bda653dee16b3432a50e5be4f58c2dc8bc31d
/whale-chapter02-go-forth/src/main/java/com/whale/excercises1/GoForth.java
d2161b7ad551162b7f59dfa27415466275c116f0
[]
no_license
Sophia-cabinet/Exercises-in-Programming-Style
87bbb848c043f62fd7be6be8a29d50a10f0d73d4
849f80208d96054ff007921d1419f84fb5269428
refs/heads/master
2020-04-05T17:39:26.002582
2019-04-09T14:33:51
2019-04-09T14:33:51
157,070,315
0
0
null
null
null
null
UTF-8
Java
false
false
4,235
java
package com.whale.excercises1; import org.apache.commons.io.FileUtils; import java.io.File; import java.util.*; import java.util.regex.Pattern; public class GoForth { private Stack stack; private Heap heap; public static void main(String[] args) { try { GoForth goForth = new GoForth(); goForth.start(args[0]); } catch (Exception e) { e.printStackTrace(); } } public GoForth() { this.stack = new Stack(); this.heap = new Heap(); } public void start(String filePath) throws Exception { this.stack.push(filePath); readFile(); filterChars(); scan(); removeStopWords(); frequencies(); sort(); this.stack.push(0); while (((Integer)this.stack.currentValue()<25) && this.stack.len()>1) { this.heap.put("i", this.stack.pop()); String wordFreq = (String)this.stack.pop(); System.out.println(wordFreq); this.stack.push(heap.get("i")); this.stack.push(1); this.stack.push((Integer)this.stack.pop() + (Integer)this.stack.pop()); } } public void readFile() throws Exception { String line = FileUtils.readFileToString(new File((String)this.stack.pop()), "UTF-8"); this.stack.push(line); } public void filterChars() throws Exception { this.stack.push(Pattern.compile("[\\W_]+")); this.stack.push(((Pattern)this.stack.pop()).matcher((String)this.stack.pop()).replaceAll(" ").toLowerCase()); } public void scan() throws Exception { this.stack.push(new ArrayList<>(Arrays.asList(((String)this.stack.pop()).split(" ")))); } public void removeStopWords() throws Exception { File stopWordFile = new File("../../../stop_words.txt"); this.stack.pushList(new ArrayList<>(Arrays.asList(FileUtils.readFileToString(stopWordFile, "UTF-8").split(",")))); this.stack.extend(asciiLowercase()); this.heap.put("stop_words", this.stack.pop()); this.heap.put("words", new ArrayList<String>()); while (this.stack.len()>0) { if (((List<String>)heap.get("stop_words")).contains((String)this.stack.currentValue())) { this.stack.pop(); } else { ((List<String>)heap.get("words")).add((String)this.stack.pop()); } } this.stack.push((List<String>)heap.get("words")); this.heap.del("stop_words"); this.heap.del("words"); } public List<String> asciiLowercase() { List<String> tmp = new ArrayList<String>(); for (char ch = 'a'; ch <= 'z'; ch++) tmp.add(String.valueOf(ch)); return tmp; } public void frequencies() throws Exception { this.heap.put("word_freqs", new HashMap<String, Integer>()); while (this.stack.len()>0) { if (((Map<String, Integer>)heap.get("word_freqs")).containsKey((String)this.stack.currentValue())) { // int this.stack.push(((Map<String, Integer>)heap.get("word_freqs")).get((String)this.stack.currentValue())); this.stack.push(1); this.stack.push((Integer)this.stack.pop() + (Integer)this.stack.pop()); } else { this.stack.push(1); } Integer value = (Integer)this.stack.pop(); String key = (String)this.stack.pop(); ((Map<String, Integer>)heap.get("word_freqs")).put(key, value); } this.stack.push(this.heap.get("word_freqs")); this.heap.del("word_freqs"); } public void sort() throws Exception { Map<String, Integer> map = (Map<String, Integer>)this.stack.pop(); List<Map.Entry<String, Integer>> list = new ArrayList<>(map.entrySet()); list.sort(Map.Entry.comparingByValue()); // Map<String, Integer> result = new LinkedHashMap<>(); List<String> result = new ArrayList<>(); for (Map.Entry<String, Integer> entry : list) { result.add(String.format("%s, %d",entry.getKey(), entry.getValue())); } this.stack.push(result); } }
41ab0b1868ff2cd001b5e3966d4c5fac99c67d35
24afd4676017ca0ee5de1e627fd4559869fc81f1
/src/main/java/com/liutaome/seki_mq/util/SpringContextInnerUtil.java
e581b04524469d496b01720199fde550f84ac4fb
[]
no_license
liutaome/seki-mq
1df70fb41e3ad1089b42cc6ca47c3f4c86cd0df9
f174c643919b4d0e59af3d933212d47ac778d74a
refs/heads/master
2020-03-19T01:05:59.425316
2018-05-31T02:46:10
2018-05-31T02:46:10
135,435,464
1
0
null
null
null
null
UTF-8
Java
false
false
3,096
java
package com.liutaome.seki_mq.util; import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; /** * Created by wuhui on 2016/1/8. */ @Component public class SpringContextInnerUtil implements ApplicationContextAware { private static ApplicationContext applicationContext; // Spring应用上下文环境 /** * 实现ApplicationContextAware接口的回调方法,设置上下文环境 * * @param applicationContext * @throws BeansException */ @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { SpringContextInnerUtil.applicationContext = applicationContext; } /** * @return ApplicationContext */ public static ApplicationContext getApplicationContext() { return applicationContext; } /** * 获取对象 * * @param name * @return Object 一个以所给名字注册的bean的实例 * @throws BeansException */ @SuppressWarnings("unchecked") public static <T> T getBean(String name) throws BeansException { return (T) applicationContext.getBean(name); } /** * 获取类型为requiredType的对象 * * @param clz * @return * @throws BeansException */ public static <T> T getBean(Class<T> clz) throws BeansException { T result = (T) applicationContext.getBean(clz); return result; } /** * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true * * @param name * @return boolean */ public static boolean containsBean(String name) { return applicationContext.containsBean(name); } /** * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) * * @param name * @return boolean * @throws NoSuchBeanDefinitionException */ public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException { return applicationContext.isSingleton(name); } /** * @param name * @return Class 注册对象的类型 * @throws NoSuchBeanDefinitionException */ public static Class<?> getType(String name) throws NoSuchBeanDefinitionException { return applicationContext.getType(name); } /** * 如果给定的bean名字在bean定义中有别名,则返回这些别名 * * @param name * @return * @throws NoSuchBeanDefinitionException */ public static String[] getAliases(String name) throws NoSuchBeanDefinitionException { return applicationContext.getAliases(name); } }
baa9f9cc1e959c770d20acc6a4e8b1ab1e8c7631
60e1f01d250cde0fdf48720271dc086534ad8307
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/components/ButtonPusher.java
7f620ebdd6419af0dba0ac1753d4405824efc26d
[ "BSD-3-Clause" ]
permissive
benorgera/4102-Robotics-Velocity-Vortex
0115374e568b012352c1ec6225e1009bcb3986e0
799cbd2060a179d4429e9b8315345212afcef1e3
refs/heads/master
2021-01-12T15:40:52.676673
2017-04-27T06:31:13
2017-04-27T06:31:13
71,848,112
0
1
null
2017-02-26T04:11:48
2016-10-25T01:38:22
Java
UTF-8
Java
false
false
1,020
java
package org.firstinspires.ftc.teamcode.components; import com.qualcomm.robotcore.hardware.Servo; import org.firstinspires.ftc.teamcode.utilities.Hardware; /** * Created by benorgera on 3/31/17. */ public class ButtonPusher { private Servo[] pushers; //left then right public ButtonPusher (Servo[] pushers) { this.pushers = pushers; if (Hardware.isAuton()) retract(); else semiextend(); } private void retract() { //retract for auton driving setPositions(1); } private void semiextend() { //semiextend for teleop pushing setPositions(0.4); } private void setPositions(double position) { for (Servo s : pushers) s.setPosition(position); } public void push(boolean isLeft) { pushers[isLeft ? 0 : 1].setPosition(0.0); Hardware.sleep(1000); retract(); } public void pushBoth() { setPositions(0.0); Hardware.sleep(1000); retract(); } }
a4b4a841c7adfb48739ac64df354a04cf35dab1a
241b529e62cf8a75f4ca5e61404e476e9ca2cbee
/Printing N numbers in the same line with comma for every 3 value/Main.java
54d99583cdf5f8e2ae7ab0ce019f9ac72280cc7e
[]
no_license
hemadhurjaty/Playground
cbadd5caf767b0e144b52f871d5687088ef56425
f98148629d7ddb2d4e58bd6eb7afb9902524e54b
refs/heads/master
2021-06-28T08:18:46.653140
2020-11-16T12:43:15
2020-11-16T12:43:15
178,905,628
0
0
null
null
null
null
UTF-8
Java
false
false
163
java
#include <stdio.h> int main() { int i,n; scanf("%d",&n); for(i=1;i<=n;i++) { printf("%d",i); if(i%3==0 && i!=n){ printf(","); } } return 0; }
3a07e057d72564b4991c906dfb951b8b893edc68
f940121f2d9d4480933bd66756cbfebc7ce262b9
/src/main/java/com/storedobject/ui/util/AbstractContentGenerator.java
9bd603ec41cb76bfc89caa767e231ecd981346ed
[]
no_license
syampillai/SODevelopment
d91bda60293164335ccc05e5b1cf1b13ac529d15
b6fae246399742218bc932e3ad095a336084dcb1
refs/heads/master
2023-08-19T18:31:58.308741
2023-08-04T03:39:20
2023-08-04T03:39:20
379,995,889
3
0
null
null
null
null
UTF-8
Java
false
false
4,385
java
package com.storedobject.ui.util; import com.storedobject.common.IO; import com.storedobject.core.ContentProducer; import com.storedobject.ui.Application; import java.io.File; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Objects; import java.util.function.Consumer; public abstract class AbstractContentGenerator extends Thread { long fileId; final ContentProducer producer; final Application application; private boolean generating = true; private final Consumer<AbstractContentGenerator> inform; private final Consumer<Long> timeTracker; private long startedAt = 0; private InputStream in; protected AbstractContentGenerator(Application application, ContentProducer producer, Consumer<AbstractContentGenerator> inform, Consumer<Long> timeTracker, Runnable preRun) { this.application = application; this.producer = producer; this.inform = inform; this.timeTracker = timeTracker; if(preRun != null) { preRun.run(); } } @Override public long getId() { return fileId; } String getContentType() { String ct = producer.getContentType(); int p = ct.indexOf(';'); if(p > 0) { ct = ct.substring(0, p).trim(); } return ct; } public String getExt() { String e = producer.getFileExtension(); return (e.startsWith(".") ? "" : ".") + e; } String getFile() { String fileName = producer.getFileName(); if(fileName != null && fileName.length() < 3) { fileName += "-so"; } fileName = fileName == null ? ("so" + fileId) : fileName; return fileName.replace('/', '_') .replace(':', '_') .replace('?', '_') .replace('*', '_') .replace(';', '_'); } public File createFile() { try { File file = File.createTempFile(getFile(), getExt()); file.deleteOnExit(); IO.copy(getContentStream(), IO.getOutput(file)); return file; } catch (Exception e) { application.log(e); application.showNotification(e); } return null; } public InputStream getContentStream() { startedAt = System.currentTimeMillis(); try { int time = 180; while ((in = producer.getContent()) == null && time-- > 0) { if(isAlive()) { try { sleep(1000); } catch (InterruptedException ignored) { } } } return new IS(in); } catch (Exception e) { application.access(() -> { application.log(e); application.showNotification(e); }); generated(); } return null; } private class IS extends FilterInputStream { protected IS(InputStream in) { super(in); } @Override public void close() throws IOException { super.close(); generated(); AbstractContentGenerator.this.in = null; } } public abstract DownloadStream getContent() throws Exception; void generated() { synchronized(producer) { if(!generating) { return; } generating = false; } if(inform != null) { application.access(() -> inform.accept(this)); } if(timeTracker != null) { timeTracker.accept(System.currentTimeMillis() - startedAt); } } public ContentProducer getProducer() { return producer; } public void abort(Throwable error) { if(producer != null) { producer.abort(error); } } @Override public boolean equals(Object o) { if(this == o) return true; if(o == null || getClass() != o.getClass()) return false; AbstractContentGenerator that = (AbstractContentGenerator) o; return fileId == that.fileId; } @Override public int hashCode() { return Objects.hash(fileId); } }
46568d1bd1994b1b0dee83bc66b21bf40e060364
37b2882464e9464159db01e7c33300181fa8b5d7
/components/org.wso2.carbon.identity.keyrotation/src/main/java/org.wso2.carbon.identity.keyrotation/model/TempOAuthScope.java
159ff41c27cc9d110d5e65360ba30d3f45d3a8f3
[ "Apache-2.0" ]
permissive
wso2/identity-tools
e9542e0465f2d0ecb4928aa8cceecdb30317ea13
5bb944af54fc8eb2cad68fd535ada7adb2e56ba1
refs/heads/master
2023-08-22T23:41:22.017869
2022-06-14T05:21:24
2022-06-14T05:21:24
189,541,681
33
18
Apache-2.0
2022-09-22T17:35:12
2019-05-31T06:40:05
Java
UTF-8
Java
false
false
3,877
java
/* * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.carbon.identity.keyrotation.model; /** * This class holds the data stored in IDN_OAUTH2_ACCESS_TOKEN_SCOPE_TEMP. */ public class TempOAuthScope { private String tokenId; private String tokenScope; private String tenantId; private int availability; private int syncId; private int synced; /** * TempOAuthScope class constructor. * * @param tokenId Token id field in IDN_OAUTH2_ACCESS_TOKEN_SCOPE_TEMP table. * @param tokenScope Token scope field in IDN_OAUTH2_ACCESS_TOKEN_SCOPE_TEMP table. * @param tenantId Tenant id field in IDN_OAUTH2_ACCESS_TOKEN_SCOPE_TEMP table. * @param availability Availability field in IDN_OAUTH2_ACCESS_TOKEN_SCOPE_TEMP table. * @param syncId Sync id field in IDN_OAUTH2_ACCESS_TOKEN_SCOPE_TEMP table. * @param synced Synced field in IDN_OAUTH2_ACCESS_TOKEN_SCOPE_TEMP table. */ public TempOAuthScope(String tokenId, String tokenScope, String tenantId, int availability, int syncId, int synced) { this.tokenId = tokenId; this.tokenScope = tokenScope; this.tenantId = tenantId; this.availability = availability; this.syncId = syncId; this.synced = synced; } /** * Get for the token id. * * @return Token id. */ public String getTokenId() { return tokenId; } /** * Set for the token id. * * @param tokenId Token id. */ public void setTokenId(String tokenId) { this.tokenId = tokenId; } /** * Get for the token scope. * * @return Token scope. */ public String getTokenScope() { return tokenScope; } /** * Set for the token scope. * * @param tokenScope Token scope. */ public void setTokenScope(String tokenScope) { this.tokenScope = tokenScope; } /** * Get for the tenant id. * * @return Tenant id. */ public String getTenantId() { return tenantId; } /** * Set for the tenant id. * * @param tenantId Tenant id. */ public void setTenantId(String tenantId) { this.tenantId = tenantId; } /** * Get for the availability. * * @return Availability. */ public int getAvailability() { return availability; } /** * Set for the availability. * * @param availability Availability. */ public void setAvailability(int availability) { this.availability = availability; } /** * Get for the sync id. * * @return Sync id. */ public int getSyncId() { return syncId; } /** * Set for the sync id. * * @param syncId Sync id. */ public void setSyncId(int syncId) { this.syncId = syncId; } /** * Get for the synced. * * @return Synced. */ public int getSynced() { return synced; } /** * Set for the synced. * * @param synced Synced. */ public void setSynced(int synced) { this.synced = synced; } }
3d43e928279f096a300615457434c83e4dcadb8b
6473f0f9918e8859e120c7d141fd4b45b5f25ced
/src/main/java/com/globant/stock/dao/StockRepository.java
068b1d948450a440ee89f79648bd8eaa6e3f6e24
[]
no_license
rkmaury007/stockapi
623cac08ee6ca644d4ecdbf10c5d28cb49d9bde8
cc62a207cc839f5816b09885ba1e634943ffafd6
refs/heads/master
2022-11-24T06:17:29.861425
2019-06-18T16:46:38
2019-06-18T16:46:38
192,578,981
0
0
null
2022-11-16T11:50:28
2019-06-18T16:47:11
Java
UTF-8
Java
false
false
278
java
package com.globant.stock.dao; //import org.springframework.data.mongodb.repository.MongoRepository; import com.globant.stock.entity.Stock; import org.springframework.data.repository.CrudRepository; public interface StockRepository extends CrudRepository<Stock, String> { }
c355d62c3f9f6c834a508497de1a0b6601d672b9
df1c7d8471e63309491b98e6d6f03c7523491d6a
/behavior/observer/BinaryObserver.java
f4dbad042db1f9e5837580a63756833b18c3d714
[]
no_license
pvnhat/DesignPatternJava
fb1ebfb88eb1f3f1196968013dd14c57b7d5b7ee
915860db4376796a543c1993026ce612f1b609b1
refs/heads/master
2020-04-03T14:04:27.294465
2018-10-30T03:50:15
2018-10-30T03:50:15
155,310,797
0
0
null
null
null
null
UTF-8
Java
false
false
289
java
package observer; public class BinaryObserver extends Observer { public BinaryObserver(Subject subject) { mSubject = subject; mSubject.attach(this); } @Override public void update() { System.out.println("Binary String: " + Integer.toBinaryString(mSubject.getState())); } }
adcea66910f96f5cf62df2554ab7a04960d984ce
549ad5cc3d71b77ad938a9eae074cb6536da7533
/WebsiteParser02/src/app/ListLinks.java
22b9f9ff923497be64a33f953a47c13294f0cbcb
[]
no_license
CvetanG/SampleWork
1fd751839f319dae460c8a5d7a63f7e91bf29989
44c42f236c9373b64996743f28d2ec2b7163efb2
refs/heads/master
2021-01-01T03:58:03.126796
2016-10-20T17:44:55
2016-10-20T17:44:55
57,224,276
0
0
null
null
null
null
UTF-8
Java
false
false
1,543
java
package app; import org.jsoup.Jsoup; import org.jsoup.helper.Validate; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.IOException; /** * Example program to list links from a URL. */ public class ListLinks { public static void main(String[] args) throws IOException { Validate.isTrue(args.length == 1, "usage: supply url to fetch"); String url = args[0]; print("Fetching %s...", url); Document doc = Jsoup.connect(url).get(); Elements links = doc.select("a[href]"); Elements media = doc.select("[src]"); Elements imports = doc.select("link[href]"); print("\nMedia: (%d)", media.size()); for (Element src : media) { if (src.tagName().equals("img")) print(" * %s: <%s> %sx%s (%s)", src.tagName(), src.attr("abs:src"), src.attr("width"), src.attr("height"), trim(src.attr("alt"), 20)); else print(" * %s: <%s>", src.tagName(), src.attr("abs:src")); } print("\nImports: (%d)", imports.size()); for (Element link : imports) { print(" * %s <%s> (%s)", link.tagName(),link.attr("abs:href"), link.attr("rel")); } print("\nLinks: (%d)", links.size()); for (Element link : links) { print(" * a: <%s> (%s)", link.attr("abs:href"), trim(link.text(), 35)); } } private static void print(String msg, Object... args) { System.out.println(String.format(msg, args)); } private static String trim(String s, int width) { if (s.length() > width) return s.substring(0, width-1) + "."; else return s; } }
4d1d15236b6b12ef607e097ba9bf49432d649f96
731858f90ab50adb6134d98d285b5a914ce33b39
/src/main/java/project/blacklist/model/Comment.java
9e754c662397b22d5701b0983495811b3bfc8293
[]
no_license
jovanhartono/blacklist
580b7da29efec0b02d65d4fa75ad473608597672
7bde2295244e076bd617f3068b304edbbf820abb
refs/heads/master
2023-08-15T16:42:02.509914
2021-10-18T10:36:09
2021-10-18T10:36:09
410,060,225
0
0
null
2021-09-30T14:37:47
2021-09-24T18:12:21
Java
UTF-8
Java
false
false
850
java
package project.blacklist.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.time.LocalDateTime; @Data @Builder @NoArgsConstructor @AllArgsConstructor @Entity public class Comment { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long commentID; @NotNull(message = "comment cannot be null or empty!") private String text; private LocalDateTime createdAt; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "postID", referencedColumnName = "postID", nullable = false) private Post postID; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "userID", referencedColumnName = "userID", nullable = false) private AppUser userID; }
e0129ea9bc7e505ed2fdecc28cf3f95e434b673a
098d725bd038b56ba40e2ca988e93c1b754fa7f3
/src/com/myrss/CategoryMgrAct.java
15c374811001e57a235bb6ccdcebac6fdb889f2c
[]
no_license
widerules/benmyrss
0a9ef156fb1ef7a24c046c1dba803ddf786bc368
00024ca3a39fad82d429d4e6c7cf75f105fc1128
refs/heads/master
2021-01-11T06:37:09.982890
2012-11-07T13:02:23
2012-11-07T13:02:23
41,127,838
0
0
null
null
null
null
UTF-8
Java
false
false
7,777
java
package com.myrss; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; import com.myrss.model.Category; import com.myrss.util.DBHelper; import com.myrss.util.MyAdapter; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.EditText; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import java.util.Map; public class CategoryMgrAct extends Activity { private ListView list = null; private List<Map<String, String>> data = new ArrayList<Map<String, String>>(); private MyAdapter adapter = null; private DBHelper dbhelper = DBHelper.GetInstance(CategoryMgrAct.this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.categorymgrui); list = (ListView) findViewById(R.id.categoryLv); // 配置适配器 adapter = new MyAdapter(this, getData()); list.setAdapter(adapter); // 点击列表事件 list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { Intent intent = new Intent(); Bundle value = new Bundle(); @SuppressWarnings("unchecked") HashMap<String, String> c = (HashMap<String, String>) list .getAdapter().getItem(pos); value.putString("categoryid", c.get("Id")); intent.putExtra("android.intent.extra.categoryid", value); intent.setClass(CategoryMgrAct.this, RssMgrAct.class); startActivity(intent); } }); // 长按事件 list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { @SuppressWarnings("unchecked") HashMap<String, String> c = (HashMap<String, String>) list .getAdapter().getItem(pos); buildEditDialog(CategoryMgrAct.this, c.get("Id"), c.get("Name")) .show(); return false; } }); } // 获取数据 private List<Map<String, String>> getData() { List<Category> lsCategories = dbhelper.GetCategoryList(dbhelper); data.clear(); for (Category c : lsCategories) { Map<String, String> map = new HashMap<String, String>(); map.put("Id", c.getId()); map.put("Name", c.getName()); data.add(map); } return data; } @Override // 设置菜单 public boolean onCreateOptionsMenu(Menu menu) { menu.add(Menu.NONE, Menu.FIRST + 1, 1, "添加分类").setIcon( android.R.drawable.ic_menu_add); menu.add(Menu.NONE, Menu.FIRST + 2, 2, "删除分类").setIcon( android.R.drawable.ic_menu_delete); return true; } @Override // 菜单按钮点击事件 public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case Menu.FIRST + 1: buildDialog(CategoryMgrAct.this).show(); break; case Menu.FIRST + 2: DeleteCategoryDialog(); break; } return false; } // 添加分类Dialog private Dialog buildDialog(Context context) { LayoutInflater inflater = LayoutInflater.from(this); final View textEntryView = inflater.inflate(R.layout.category, null); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.alert); builder.setTitle(R.string.addCategory_alert); builder.setView(textEntryView); builder.setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { EditText tvcname = (EditText) textEntryView .findViewById(R.id.categoryname_edit);// 获取分类名称 ContentValues initialValues = new ContentValues(); initialValues.put("Name", tvcname.getText().toString()); HashMap<String, String> item = new HashMap<String, String>(); item.put("Id", dbhelper.Add(dbhelper, "Category", initialValues)); item.put("Name", tvcname.getText().toString()); data.add(item); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(R.string.btn_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); } }); return builder.create(); } // 删除分类 private void DeleteCategoryDialog() { // 设置提示框 AlertDialog.Builder builder = new AlertDialog.Builder( CategoryMgrAct.this); builder.setIcon(R.drawable.alert); builder.setTitle(R.string.alert); builder.setMessage(R.string.del_alert); // 点击确定 builder.setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ListView categoryLv = (ListView) findViewById(R.id.categoryLv); // 获取所有选中项的ID MyAdapter myAdapter = (MyAdapter) categoryLv .getAdapter(); Map<Integer, Map<String, String>> selectMap = myAdapter.selectMap; Iterator<Entry<Integer, Map<String, String>>> select = selectMap .entrySet().iterator(); for (int i = 0; i < selectMap.size(); i++) { Map.Entry<Integer, Map<String, String>> entry = (Map.Entry<Integer, Map<String, String>>) select .next(); Map<String, String> value = (Map<String, String>) entry .getValue(); String id = value.get("Id"); dbhelper.Delete(dbhelper, "Category", id); dbhelper.ExeSQL(dbhelper, "DELETE FROM RssAddr WHERE CategoryId='" + id + "'");// 删除分类下的RSS data.remove(value); } adapter.notifyDataSetChanged();// 刷新数据 } }); // 点击取消 builder.setNegativeButton(R.string.btn_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } // 编辑分类Dialog private Dialog buildEditDialog(Context context, final String id, String name) { LayoutInflater inflater = LayoutInflater.from(this); final View textEntryView = inflater.inflate(R.layout.category, null); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.alert); builder.setTitle(R.string.editCategory_alert); builder.setView(textEntryView); final EditText tvcname = (EditText) textEntryView .findViewById(R.id.categoryname_edit); tvcname.setText(name);// 设置当前分类名称 builder.setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String sql = "UPDATE Category SET Name='" + tvcname.getText().toString() + "' WHERE Id='" + id + "'"; dbhelper.ExeSQL(dbhelper, sql); list = (ListView) findViewById(R.id.categoryLv); adapter = new MyAdapter(CategoryMgrAct.this, getData()); list.setAdapter(adapter); } }); builder.setNegativeButton(R.string.btn_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); } }); return builder.create(); } }
e7325f92535cf89ceaa684e5dffdea07541917a1
a1fe4ae073d6b51373a1a07f6e8cf057b851939d
/OnlineDating/src/online/dating/onlinedating/model/User.java
b6ce33d94dcb60cb3606413731124382e085184d
[]
no_license
rajatgupta0889/TomnJerry
e0ba3023b407597f051d50aa95588372e9cb1f83
3c13c24a5626dce9df109f0a15cf88853dd6598e
refs/heads/master
2018-11-07T16:12:18.123549
2015-01-30T19:15:15
2015-01-30T19:15:15
26,216,021
0
0
null
2018-08-28T06:28:48
2014-11-05T11:11:46
Java
UTF-8
Java
false
false
5,819
java
package online.dating.onlinedating.model; import java.util.ArrayList; import java.util.Arrays; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class User { String name; String email; String fbUserId; String gender; Double locationX, locationY; String userToken; String DeviceToken; String os; String age; ArrayList<String> imageList; ArrayList<String> passion; String profession; String orientation; String height; public static User tom; public User(String name, String email, String fbUserId, String gender, Double locationX, Double locationY, String userToken, String deviceToken, String os, String age, ArrayList<String> imageList) { super(); this.name = name; this.email = email; this.fbUserId = fbUserId; this.gender = gender; this.locationX = locationX; this.locationY = locationY; this.userToken = userToken; DeviceToken = deviceToken; this.os = os; this.age = age; this.imageList = imageList; } public User() { // TODO Auto-generated constructor stub } public String getAge() { return age; } public void setAge(String age) { this.age = age; } public String getDeviceToken() { return DeviceToken; } public void setDeviceToken(String deviceToken) { DeviceToken = deviceToken; } public String getOs() { return os; } public void setOs(String os) { this.os = os; } public String getUserToken() { return userToken; } public void setUserToken(String userToken) { this.userToken = userToken; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getFbUserId() { return fbUserId; } public void setFbUserId(String fbUserId) { this.fbUserId = fbUserId; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public Double getLocationX() { return locationX; } public void setLocationX(Double locationX) { this.locationX = locationX; } public Double getLocationY() { return locationY; } public void setLocationY(Double locationY) { this.locationY = locationY; } public ArrayList<String> getImageList() { return imageList; } public void setImageList(ArrayList<String> imageList) { this.imageList = imageList; } public ArrayList<String> getPassion() { return passion; } public void setPassion(ArrayList<String> passion) { this.passion = passion; } public String getProfession() { return profession; } public void setProfession(String profession) { this.profession = profession; } public String getOrientation() { return orientation; } public void setOrientation(String orientation) { this.orientation = orientation; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } @Override public String toString() { // TODO Auto-generated method stub return String.format(name + ";" + email + ";" + fbUserId + ";" + gender + ";" + age + ";" + userToken + ";" + locationX + ";" + locationY + ";" + DeviceToken + ";" + os + ";" + imageList + ";" + passion + ";" + profession + ";" + orientation + ";" + height); } public static User getUser(String user) { User userObj = null; if (user != null) { userObj = new User(); Log.d("User", user); String[] array = user.split(";"); userObj.setName(array[0]); userObj.setEmail(array[1]); userObj.setFbUserId(array[2]); userObj.setGender(array[3]); userObj.setAge(array[4]); userObj.setUserToken(array[5]); userObj.setLocationX(Double.parseDouble(array[6])); userObj.setLocationY(Double.parseDouble(array[7])); userObj.setDeviceToken(array[8]); userObj.setOs(array[9]); if (array[10].contains(",")) { userObj.setImageList(new ArrayList<String>(Arrays .asList(array[10].split(",")))); } if (array.length > 11) { if (array[11].contains(",")) { userObj.setPassion(new ArrayList<String>(Arrays .asList(array[10].split(",")))); } userObj.setProfession(array[12]); userObj.setOrientation(array[13]); userObj.setHeight(array[14]); } } return userObj; } public static User getUser(JSONObject user) { User userObj = null; if (user != null) { userObj = new User(); Log.d("User", " " + user); try { userObj.setName(user.getString("name")); userObj.setEmail(user.getString("name")); userObj.setFbUserId(user.getString("name")); userObj.setGender(user.getString("name")); userObj.setAge(user.getString("name")); userObj.setUserToken(user.getString("name")); userObj.setLocationX(Double.parseDouble(user.getString("name"))); userObj.setLocationY(Double.parseDouble(user.getString("name"))); userObj.setDeviceToken(user.getString("name")); userObj.setOs(user.getString("name")); JSONArray array = user.getJSONArray("images"); ArrayList<String> temp = new ArrayList<String>(); for (int i = 0; i < array.length(); i++) { temp.add(array.getString(i)); } userObj.setImageList(temp); JSONArray array1 = user.getJSONArray("passion"); if (array1.length() > 1) { ArrayList<String> temp1 = new ArrayList<String>(); for (int i = 0; i < array.length(); i++) { temp.add(array.getString(i)); } userObj.setPassion(temp1); userObj.setProfession(user.getString("profession")); userObj.setOrientation(user.getString("orientation")); userObj.setHeight(user.getString("height")); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return userObj; } }
2ab868459f2a46d897c9836fd41548d83dc1853f
11b4576a9167f83a91fd06c59d475347b5333567
/Matrix.java
47e51dd6235e02903dbef6e604b335ddec6f430f
[]
no_license
cbivo76/Matrix
b6ae3078c31106ba9e72066090dcb0ca943d4434
77f4bb15d3633cdeb8f960b0037bb8d49219add5
refs/heads/master
2020-09-03T16:43:29.460944
2019-11-04T13:51:01
2019-11-04T13:51:01
219,511,552
0
0
null
null
null
null
UTF-8
Java
false
false
9,745
java
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Matrix implements ActionListener { private static int col, row; //dimentions private static double myMatrix [][]; private static double tempMatrix [][]; private static JTextField inputField [][]; private static int result; private static JButton nMultiplyB, getValueB, showMatrix, newMatrix; private static JPanel choosePanel [] = new JPanel[8]; private static int lastCol , lastRow ; /* * Methods: * 1- private static void getDimension() * Um die Dimension anzugeben * 2- private static void setElements(double matrix [][], String title ) * Einfüllen der Matrix mit Werte. * 3- private static void checkTextField (JTextField field [][] ) * Leere Felder sind Nullfelder * 4- private void ChooseOperation () * Operation mit der Matrix * 5 - private void actionPerformed(ActionEvent e) * Ausgabemethode * 6 - Matrix () - constructor * Programmprozess * 7 - public void actionPerformed(ActionEvent e) * Button * 8 - private static void showMatrix(double [][] matrix, String title ) * Zeigen der Matrix * 9 - private static void guiMultliplyByScaler () * Multiplikation mit einen Skalar, der Stauchfaktor * 10 - private static double [][] multliplyByScaler (double [][] matrix , double x) * Multiplikation mit einen Skalar * 11 - private static void guiGetValue () * Bestimmung des Wertes mittels getValue method * 12 - private static void newMatrix () * Eingabe einer neuen Matrix * 13 - public static void main (String [] args) * Aufruf des Programms */ Matrix () { col = row = 0; myMatrix = new double [0][0]; ChooseOperation(); } private static void getDimension() { JTextField wField = new JTextField(5); //col field //design input line JPanel choosePanel [] = new JPanel [2]; choosePanel [0] = new JPanel(); choosePanel [1] = new JPanel(); choosePanel[0].add(new JLabel("Gebe Dimensionen ein:") ); choosePanel[1].add(Box.createHorizontalStrut(15)); // a spacer choosePanel[1].add(new JLabel("Anzahl Spalten:")); choosePanel[1].add(wField); result = JOptionPane.showConfirmDialog(null, choosePanel, null,JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); //Speichern der letzten Dimension lastCol = col; lastRow = row; //ok option if(result == 0) { if(wField.getText().equals("")) col = 0; else { if(isInt(wField.getText())) { col = Integer.parseInt(wField.getText()); } else { JOptionPane.showMessageDialog(null, "Falsche Dimension"); col = lastCol; row = lastRow; return; } row = 2; } if(col < 1 || row < 1) { JOptionPane.showConfirmDialog(null, "Du hast eine falsche Dimension eingegeben", "Error",JOptionPane.PLAIN_MESSAGE); col = lastCol; row = lastRow; } else { tempMatrix = myMatrix; myMatrix = new double [row][col]; if(!setElements(myMatrix, "Gib die neue Matrix ein")) //filling the new matrix { //backup myMatrix = tempMatrix; } } } else if(result == 1) { col = lastCol; row = lastRow; } }//end get Dimension //Matrix Elementen private static boolean setElements(double matrix [][], String title ) { int temp, temp1; //Temporäre Variable String tempString; JPanel choosePanel [] = new JPanel [row+2]; choosePanel[0] = new JPanel(); choosePanel[0].add(new Label(title )); choosePanel[choosePanel.length-1] = new JPanel(); choosePanel[choosePanel.length-1].add(new Label("Falls keine Eingabe nimmt das Feld als Null an")); inputField = new JTextField [matrix.length][matrix[0].length]; //Größe der loop for(temp = 1; temp <= matrix.length; temp++) { choosePanel[temp] = new JPanel(); for(temp1 = 0; temp1 < matrix[0].length; temp1++) { inputField [temp-1][temp1] = new JTextField(3); choosePanel[temp].add(inputField [temp-1][temp1]); if(temp1 < matrix[0].length -1) { choosePanel[temp].add(Box.createHorizontalStrut(15)); // a spacer } }//end Spalten loop }//end Zeilen loop result = JOptionPane.showConfirmDialog(null, choosePanel, null, JOptionPane.OK_OPTION, JOptionPane.PLAIN_MESSAGE); if(result == 0) { checkTextField(inputField); for(temp = 0; temp < matrix.length; temp++) { for(temp1 = 0; temp1 < matrix[0].length; temp1++) { tempString = inputField[temp][temp1].getText(); if(isDouble(tempString)) { matrix [temp][temp1] = Double.parseDouble(inputField[temp][temp1].getText()); } else { JOptionPane.showMessageDialog(null, "Du hast falsche Elemente eingegeben"); //backup col = lastCol; row = lastRow; return false; } } } return true; } else return false; }//end get Inputs //Leerfelder sind Nullfelder angenommen. private static void checkTextField (JTextField field [][] ) { for(int temp = 0; temp < field.length; temp++) { for(int temp1 = 0; temp1 < field[0].length; temp1++) { if(field[temp][temp1].getText().equals("")) field[temp][temp1].setText("0"); } } }//end reset private void ChooseOperation () { int temp; for(temp = 0; temp < choosePanel.length; temp++) { choosePanel [temp] = new JPanel (); } choosePanel[1].add(Box.createHorizontalStrut(15)); // a spacer choosePanel[6].add(Box.createHorizontalStrut(15)); // a spacer showMatrix = new JButton ("Alte Matrix"); showMatrix.setPreferredSize(new Dimension(175,35)); showMatrix.addActionListener(this); choosePanel[2].add(showMatrix); nMultiplyB = new JButton ("Stauchfaktor n"); nMultiplyB.setPreferredSize(new Dimension(175,35)); nMultiplyB.addActionListener(this); choosePanel[3].add(nMultiplyB); newMatrix = new JButton("Gib die Matrix ein"); newMatrix.setPreferredSize(new Dimension(175,35)); newMatrix.addActionListener(this); choosePanel[5].add(newMatrix); JOptionPane.showConfirmDialog(null, choosePanel, null, JOptionPane.CLOSED_OPTION , JOptionPane.PLAIN_MESSAGE); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == showMatrix) { showMatrix( myMatrix, "Deine Matrix"); } else if(e.getSource() == nMultiplyB) { guiMultliplyByScaler(); } else if(e.getSource() == getValueB) { guiGetValue(); } else if(e.getSource() == newMatrix) { newMatrix(); } }//end action performed private static void showMatrix(double [][] matrix, String title ) { int temp, temp1; //Temporäre Variable JPanel choosePanel [] = new JPanel [matrix.length+1]; choosePanel[0] = new JPanel (); choosePanel[0].add( new JLabel (title) ); for(temp = 1; temp <= matrix.length; temp++) { choosePanel[temp] = new JPanel(); for(temp1 = 0; temp1 < matrix[0].length; temp1++) { if(matrix[temp-1][temp1] == -0) { matrix[temp-1][temp1] = 0; } choosePanel[temp].add(new JLabel(String.format("%.2f", matrix[temp-1][temp1]))); if(temp1 < matrix[0].length -1) { choosePanel[temp].add(Box.createHorizontalStrut(15)); // a spacer } }//end Spalten loop }//end Zeilen loop if(col == 0 || row == 0) { JOptionPane.showMessageDialog(null, "Du hast keine Matrix eingegeben"); } else { JOptionPane.showMessageDialog(null, choosePanel, null, JOptionPane.PLAIN_MESSAGE, null); } }//end show Matrix private static void guiMultliplyByScaler () { double[][]results=new double [row][col]; double x; String tempString; if(myMatrix.length < 1) { JOptionPane.showMessageDialog(null, "Du hast keine Matrix eingegeben"); return; } tempString = JOptionPane.showInputDialog(null, "Gig den Faktor ein:"); if (tempString == null) //cancel option { return; } else if(!tempString.equals("")) x= Double.parseDouble(tempString); else { JOptionPane.showMessageDialog(null, "Du hast kein Faktor eingegeben"); return; } results = multliplyByScaler(myMatrix, x); showMatrix(results, "Multiplikationsergebnis"); }//end Multiplikation mit einem Skalar - Stauchfaktor private static double [][] multliplyByScaler (double [][] matrix , double x) { double[][]results=new double [row][col]; int i,j; for (i=0;i<matrix.length;i++) { for(j=0;j<matrix[0].length;j++) { results[i][j] = x*matrix[i][j]; } } return results; }//end Multiplikation mit einem Skalar - Stauchfaktor private static void guiGetValue () { if(myMatrix.length < 1) { JOptionPane.showMessageDialog(null, "Du hast keine Matrix eingegeben"); } else if(col != row) { JOptionPane.showMessageDialog(null, "Du must eine Quadratmatrix eingeben"); } }//end gui get Value private static boolean isInt (String str) { int temp; if (str.length() == '0') return false; for(temp = 0; temp < str.length();temp++) { if(str.charAt(temp) != '+' && str.charAt(temp) != '-' && !Character.isDigit(str.charAt(temp))) { return false; } } return true; } private static boolean isDouble (String str) { int temp; if (str.length() == '0') return false; for(temp = 0; temp < str.length();temp++) { if(str.charAt(temp) != '+' && str.charAt(temp) != '-' && str.charAt(temp) != '.' && !Character.isDigit(str.charAt(temp)) ) { return false; } } return true; } private static void newMatrix () { getDimension(); } public static void main (String [] args) { Matrix m1 = new Matrix (); } }//end class
fbedce48fe22e613817c597dc7a74a43ed1c6161
314f17f60baf9f2faa1720cb9e6e5dc1d733a97e
/.svn/pristine/4f/4ffc9278f232b7d0807b48fcfee403ae3440e99d.svn-base
4e7b2a3a6e6404e48093d33bd6ad341431a4fd58
[]
no_license
lc4t/payment
8a18d08cb65b778bff48a36e86c3412324159fc0
9cfd839ef92b74594259b1a6d3737e11ce4e441e
refs/heads/master
2020-03-31T07:15:31.731886
2017-05-23T05:15:15
2017-05-23T05:15:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
871
package noumena.payment.googleplay; import java.util.Vector; public class GooglePlayParams { public static final String SIGNATURE_ALGORITHM = "SHA1withRSA"; public static final String GOOGLEPLAY = "GooglePlay"; private Vector<GooglePlayParamApp> apps = new Vector<GooglePlayParamApp>(); public Vector<GooglePlayParamApp> getApps() { return apps; } public void addApp(GooglePlayParamApp app) { this.getApps().add(app); } public void addApp(String appname, String appid, String appkey) { GooglePlayParamApp app = new GooglePlayParamApp(); app.setAppname(appname); app.setAppid(appid); app.setAppkey(appkey); this.getApps().add(app); } public String getAppKeyById(String appid) { for (GooglePlayParamApp app : this.getApps()) { if (app.getAppid().equals(appid)) { return app.getAppkey(); } } return null; } }
9ecf7c03865ed7cc1e3239eeb2eb9c74425ff0d2
afbd7ca54dbe6640587979f2a1c8233d7fd503f1
/src/main/java/com/recklessmo/model/security/DefaultUserDetails.java
d4a619bb072ce69f49f24214ae37755a2b60e56f
[]
no_license
recklessMo/backend
bece811873f9c29312915dd88b243bbf31ab03f9
30bfc7899e681bf1bb49115443113e1fd1d0d820
refs/heads/master
2021-01-19T00:49:14.338076
2018-06-24T13:35:10
2018-06-24T13:35:10
73,255,609
0
0
null
null
null
null
UTF-8
Java
false
false
2,044
java
package com.recklessmo.model.security; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.Collection; import java.util.List; /** * Created by hpf on 6/12/16. */ public class DefaultUserDetails implements UserDetails{ private long id; private String userName; private String pwd; private boolean accountNonExpired; private boolean accountNonLocked; private boolean credentialNonExpired; private boolean enabled; private Collection<GrantedAuthority> authorityList; private List<String> roles; public DefaultUserDetails(long id, String userName, String pwd, boolean accountNonExpired, boolean accountNonLocked, boolean credentialNonExpired, boolean enabled, Collection<GrantedAuthority> authorityList, List<String> roles){ this.id = id; this.userName = userName; this.pwd = pwd; this.accountNonExpired = accountNonExpired; this.accountNonLocked = accountNonLocked; this.credentialNonExpired = credentialNonExpired; this.enabled = enabled; this.authorityList = authorityList; this.roles = roles; } public long getId() { return id; } public void setId(long id) { this.id = id; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorityList; } @Override public String getPassword() { return pwd; } @Override public String getUsername() { return userName; } @Override public boolean isAccountNonExpired() { return accountNonExpired; } @Override public boolean isAccountNonLocked() { return accountNonLocked; } @Override public boolean isCredentialsNonExpired() { return credentialNonExpired; } @Override public boolean isEnabled() { return enabled; } public List<String> getRoles() { return roles; } }
03f221f8da9f8c81247ff82d28bde3b29e994010
092064d0539cfd759cb5e81338b8101f8ce34f9b
/src/java/tan/jam/model/company/americaneagle/CredentialsForAmericanEagle.java
61776fa6bc716a8744c84d55c9b5457563ad1b9a
[]
no_license
Azizullah444/WGFINANCING
e4d6c5e5fddf053f0df91dd350f8dcaf5faaddbd
23b06814a0c3aa32d29ae1ed648ebeb9d67323cb
refs/heads/master
2021-01-20T20:56:29.439028
2015-09-17T22:52:04
2015-09-17T22:52:04
42,686,237
0
0
null
null
null
null
UTF-8
Java
false
false
3,144
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 tan.jam.model.company.americaneagle; import java.util.List; import tan.jam.company.utils.FileUtils; /** * * @author Lenovo */ public class CredentialsForAmericanEagle{ private String[] pages; private List<String> lines; private String companyName; private String accountNumber; private String date; private double totalDeposits; private double averageLedgerBalance; CredentialsForAmericanEagle(String[] page,List<String> lines) { this.pages = page; this.lines = lines; startExecution(); } private void startExecution() { this.companyName = "AmericanEagle"; this.accountNumber = captureAccountNumber(); this.date = captureDate(); this.totalDeposits = captureTotalDeposits(); } private double captureTotalDeposits() { String result = ""; double d = 0; for(String s: lines){ if(s.matches("^\\s*Total\\s+Deposits.+")){ result = s; } } if(result.length() > 1){ String[] temp = result.split("\\s+"); d = FileUtils.convertStringToDouble(FileUtils.getDollarSignRemovedValue(temp[2])); } return d; } private String captureDate() { String dd = ""; for (int a = 0; a < lines.size(); a++) { String d = FileUtils.getResultFromPattern("Statement\\s+Period.+", this.lines.get(a)); if (!d.startsWith("NoMatch")) { String[] tmp = d.split("\\s+"); dd = tmp[tmp.length-1]; } } return dd; } private String captureAccountNumber() { String result = FileUtils.getTargetByMatch(pages[0], "Account\\s+Number\\s+\\d+"); return FileUtils.getFourDigitAccountNumber(result); } public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public double getTotalDeposits() { return totalDeposits; } public void setTotalDeposits(double totalDeposits) { this.totalDeposits = totalDeposits; } public List<String> getLines() { return lines; } public void setLines(List<String> lines) { this.lines = lines; } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String[] getPages() { return pages; } public void setPages(String[] pages) { this.pages = pages; } }
6dd3c2c2546c88b619776377a4da41131666827a
2226ba2fa2d878810fb306f29ce4ffb794034843
/MyJavaProjects/MyParallelLessons/src/parallelOne/ExgrDemo.java
3004b25cc2cef97465970306d978d53cf145172b
[]
no_license
ManIsntFromSystem/MyJavaLessons
09006b30950cb2b67a9b561ba6da09a5acad61dc
a5fe90f961cf90a619c14c1f342881a3b707db06
refs/heads/master
2020-09-06T16:15:46.916995
2019-11-19T07:04:24
2019-11-19T07:04:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,723
java
package parallelOne; import java.util.concurrent.Exchanger; public class ExgrDemo { public static void main(String[] args) { Exchanger<String> exgr = new Exchanger<String>(); System.out.println("1"); new MakeString(exgr).run(); System.out.println("2"); new UseString(exgr).run(); } } class MakeString implements Runnable{ Exchanger<String> ex; String str; public MakeString(Exchanger<String> c) { ex = c; str = new String(); System.out.println("Make"); } @Override public void run() { char ch = 'A'; for (int i = 0; i < 3; i++) { for (int j = 0; j < 5; j++) { str += (char) ch++; System.out.println("for m"); try { System.out.println("ex m"); str = ex.exchange(str); System.out.println("Changed"); } catch (InterruptedException e) { System.out.println(e); } } } } } class UseString implements Runnable{ Exchanger<String> ex; String str; public UseString(Exchanger<String> c) { ex = c; } @Override public void run() { for (int i = 0; i < 3; i++) { try { str = ex.exchange(new String()); System.out.println("Received: " + str); } catch (InterruptedException e) { System.out.println(e); } } } }
9d5b6e7cf98808d02407ee6ee3183c83aa42787e
efa1fe6ad711b09427df277eddce191375ff7da4
/src/main/java/com/github/rhacoal/skylink/plug/defaultimpl/MySQLConnector.java
dcc913fb8cc94af8ef4831ab32643a54c11de9ea
[ "Apache-2.0" ]
permissive
Rhacoal/Skylink_Friendly
d42cc229e27162fd90825080036aec8165ec362a
65fcdc5d33cf793c2cc090440302dc57b074d9f7
refs/heads/master
2021-01-10T15:27:22.954941
2016-02-02T13:59:43
2016-02-02T13:59:43
50,512,277
0
1
null
null
null
null
UTF-8
Java
false
false
3,165
java
/* * Copyright 2016 Rhacoal. * * 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.github.rhacoal.skylink.plug.defaultimpl; import com.github.rhacoal.skylink.plug.SQLConnector; import com.github.rhacoal.skylink.plug.SQLWatchDog; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Rhacoal */ public class MySQLConnector extends SQLConnector { private SQLWatchDog wd; private String url,user,pass;private Properties info; private int login; public MySQLConnector(Connection conn) { super(conn); } public void reConnect(){ } //<editor-fold defaultstate="collapsed" desc="public static SQLConnector connect(...)"> public static SQLConnector connect(String url) throws SQLException { try { Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection(url); MySQLConnector mys=new MySQLConnector(conn); mys.url=url; mys.login=0; return mys; } catch (ClassNotFoundException ex) { Logger.getLogger(MySQLConnector.class.getName()).log(Level.SEVERE, null, ex); return null; } } public static SQLConnector connect(String url, Properties info) throws SQLException { try { Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection(url, info); MySQLConnector mys=new MySQLConnector(conn); mys.url=url; mys.info=info; mys.login=1; return mys; } catch (ClassNotFoundException ex) { Logger.getLogger(MySQLConnector.class.getName()).log(Level.SEVERE, null, ex); return null; } } public static SQLConnector connect(String url, String user, String password) throws SQLException { try { Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection(url, user, password); MySQLConnector mys=new MySQLConnector(conn); mys.url=url; mys.user=user; mys.pass=password; mys.login=2; return mys; } catch (ClassNotFoundException ex) { Logger.getLogger(MySQLConnector.class.getName()).log(Level.SEVERE, null, ex); return null; } } //</editor-fold> }
[ "" ]
215bd706887e81a70eade4634ab76f752d8c5f35
494e79b7e7f00e5a12212271f4b14a0c9c0b0a98
/src/test/java/it/unicam/ids/c3/personale/CorriereTest.java
ddde49e9af3b4c68b3141ffdb8b7d3548b0e84cc
[]
no_license
ADE-IngegneriaDelSotware/C3_Code
d97cd8f6e6aa0515a90c16a034487c98a7df5c5d
b5fb3aeb97392353e89f8f99eea848d22f5a7e33
refs/heads/main
2023-03-28T12:43:05.268250
2021-03-02T15:05:04
2021-03-02T15:05:04
353,084,178
0
0
null
null
null
null
UTF-8
Java
false
false
1,963
java
package it.unicam.ids.c3.personale; import it.unicam.ids.c3.merce.Categoria; import it.unicam.ids.c3.merce.Merce; import it.unicam.ids.c3.merce.MerceAlPubblico; import it.unicam.ids.c3.vendita.MerceVendita; import it.unicam.ids.c3.vendita.StatoConsegna; import it.unicam.ids.c3.vendita.Vendita; import it.unicam.ids.c3.vendita.VenditaSpedita; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; import static org.junit.jupiter.api.Assertions.*; public class CorriereTest { Corriere corriere = new Corriere(RuoloSistema.CORRIERE, "GLS", "Via Alberto", "4345435"); List<MerceVendita> lista = new ArrayList<>(); @BeforeEach void create(){ Merce merce = new Merce("iphone", Categoria.TECNOLOGIA, "256 gb di ram"); MerceAlPubblico merceAlPubblico = new MerceAlPubblico(32, merce); MerceVendita merceVendita = new MerceVendita(32, 1, merceAlPubblico); lista.add(merceVendita); VenditaSpedita vs = new VenditaSpedita(34, lista, "Via gls"); corriere.addMerceDaSpedire(vs); } @Test void addMerceDaSpedire() { assertEquals(corriere.getVendite().size(), 1); VenditaSpedita vs = new VenditaSpedita(56, lista, "Via piazza"); corriere.addMerceDaSpedire(vs); assertEquals(corriere.getVendite().size(), 2); } @Test void getVenditePerStato() { VenditaSpedita vs = new VenditaSpedita(79, lista, "Via qwerty"); assertEquals(vs.getStatoConsegna(), StatoConsegna.IN_ATTESA_DI_RITIRO); corriere.addMerceDaSpedire(vs); assertEquals(corriere.getVenditePerStato(StatoConsegna.IN_ATTESA_DI_RITIRO).size(), 2); vs.setStatoConsegna(StatoConsegna.RITIRATO); assertFalse(corriere.getVenditePerStato(StatoConsegna.IN_ATTESA_DI_RITIRO).size() == 2); assertEquals(corriere.getVenditePerStato(StatoConsegna.RITIRATO).size(), 1); } }
7cacaf1532df7cd7ee90747564448cf1ed45eaf4
92029ee3efee26a310d0265c21973af456fea6d1
/src/main/java/com/tele2test/dao/AppRoleDAO.java
20b774163339a5a92b7f46225716252185c127c7
[]
no_license
HappyRomio/chat2
dabc34e77e626a422dadb7f1e820bb1adf699147
faa1864e3a2ac1a3caaa3bd0c026d090760aae4e
refs/heads/master
2022-02-06T00:44:32.827065
2020-02-17T12:58:05
2020-02-17T12:58:05
241,236,831
0
0
null
2022-01-21T23:38:03
2020-02-18T00:25:10
Java
UTF-8
Java
false
false
241
java
package com.tele2test.dao; import com.tele2test.entity.AppRole; import org.springframework.data.repository.CrudRepository; public interface AppRoleDAO extends CrudRepository<AppRole, Long> { AppRole findByRoleName(String roleName); }
27ecc9bf59a18e3404bc1c1855949fe7dd867cc2
5d556bcc27b7ae314ca35303ddf8263f452aaf58
/fw-core/src/main/java/com/aicent/fw/common/service/BaseService.java
20702414635951d2227bd04d2c634ab7182c442d
[]
no_license
larry2722/fw
50c889da12d9ee168e223aa1b8cb8812255101c6
50dfb41ae26e6ab0f9872ef4e007dacb77849288
refs/heads/master
2021-01-18T21:28:49.566055
2014-02-18T05:31:57
2014-02-18T05:31:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
699
java
/** * Copyright: Copyright (c) 2014 * Company: LuckyStar Common Freamwork * @author: Larry.Li * @version: v1.0.0 * Create Date: 2014年1月23日 下午8:30:14 */ package com.aicent.fw.common.service; import java.io.Serializable; import java.util.List; import com.aicent.fw.common.entity.AbstractEntity; public interface BaseService<E extends AbstractEntity<ID>, ID extends Serializable> { E getById(Long primaryKey); List<E> getByIds(final List<Long> primaryKeys); boolean exists(Long primaryKey); E refresh(E entity); List<E> getAll(); Long getCount(); E save(E entity); void save(List<E> entities); E update(E entity); void remove(Long primaryKey); }
986e2e988572a272817ed46592d9f894a5a5afe1
b8e86f17b7409ceedb203f48f007634c7b8ee16d
/src/main/java/com/minchev/plantlab/interceptors/PageTitle.java
81b0ed218c1a4102ffb91aa4961678fdfa6cf85e
[ "MIT" ]
permissive
gminchev1982/PlantLab
5e0e2dd36e9c569f6f5dbdf07dc416c2b0c29ec7
9c94aa5d1ab8013ac83ea9d8a304f5b679ca2cc3
refs/heads/master
2020-05-09T22:04:10.076935
2019-08-18T19:55:54
2019-08-18T19:55:54
181,457,988
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package com.minchev.plantlab.interceptors; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface PageTitle { String value() default ""; }
bfcd4ad214006323604ecab1930d0f88a15a0145
a13a500da11148d2e5360e424c03bd7a721f3713
/src/main/java/ch/gry/myjavaee7project1/musicshelf/common/control/EntityNotFoundException.java
4f2d5b797229f5f04db3a30f6ea4b6a52361bf8b
[]
no_license
why-y/my-javaee7-rest-api
7be31f241ef352bae918634a8a65fd464b17c5e1
69cb6323948055282a4f03425b474e7d74fed9d1
refs/heads/master
2020-12-11T22:18:20.597741
2016-04-17T07:37:16
2016-04-17T07:37:16
43,366,228
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
/** * */ package ch.gry.myjavaee7project1.musicshelf.common.control; /** * @author gry * */ public class EntityNotFoundException extends Exception { private static final long serialVersionUID = 1L; public EntityNotFoundException(String message, Throwable cause) { super(message, cause); } public EntityNotFoundException(String message) { super(message); } }
a59c1b2df5c9f690d38a0e6b3da8479325305873
7f298c2bf9ff5a61eeb87e3929e072c9a04c8832
/spring-aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java
7dfaee8235555bafe6e81dd50d211d754d2c6778
[ "Apache-2.0" ]
permissive
stwen/my-spring5
1ca1e85786ba1b5fdb90a583444a9c030fe429dd
d44be68874b8152d32403fe87c39ae2a8bebac18
refs/heads/master
2023-02-17T19:51:32.686701
2021-01-15T05:39:14
2021-01-15T05:39:14
322,756,105
0
0
null
null
null
null
UTF-8
Java
false
false
8,256
java
/* * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.aop.framework; import org.springframework.aop.TargetSource; import org.springframework.aop.framework.adapter.AdvisorAdapterRegistry; import org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry; import org.springframework.aop.target.SingletonTargetSource; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.FactoryBeanNotInitializedException; import org.springframework.beans.factory.InitializingBean; import org.springframework.lang.Nullable; import org.springframework.util.ClassUtils; /** * Convenient superclass for {@link FactoryBean} types that produce singleton-scoped * proxy objects. * * <p>Manages pre- and post-interceptors (references, rather than * interceptor names, as in {@link ProxyFactoryBean}) and provides * consistent interface management. * * @author Juergen Hoeller * @since 2.0 */ @SuppressWarnings("serial") public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig implements FactoryBean<Object>, BeanClassLoaderAware, InitializingBean { @Nullable private Object target; @Nullable private Class<?>[] proxyInterfaces; @Nullable private Object[] preInterceptors; @Nullable private Object[] postInterceptors; /** * Default is global AdvisorAdapterRegistry */ private AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance(); @Nullable private transient ClassLoader proxyClassLoader; @Nullable private Object proxy; /** * Set the target object, that is, the bean to be wrapped with a transactional proxy. * <p>The target may be any object, in which case a SingletonTargetSource will * be created. If it is a TargetSource, no wrapper TargetSource is created: * This enables the use of a pooling or prototype TargetSource etc. * * @see org.springframework.aop.TargetSource * @see org.springframework.aop.target.SingletonTargetSource * @see org.springframework.aop.target.LazyInitTargetSource * @see org.springframework.aop.target.PrototypeTargetSource * @see org.springframework.aop.target.CommonsPool2TargetSource */ public void setTarget(Object target) { this.target = target; } /** * Specify the set of interfaces being proxied. * <p>If not specified (the default), the AOP infrastructure works * out which interfaces need proxying by analyzing the target, * proxying all the interfaces that the target object implements. */ public void setProxyInterfaces(Class<?>[] proxyInterfaces) { this.proxyInterfaces = proxyInterfaces; } /** * Set additional interceptors (or advisors) to be applied before the * implicit transaction interceptor, e.g. a PerformanceMonitorInterceptor. * <p>You may specify any AOP Alliance MethodInterceptors or other * Spring AOP Advices, as well as Spring AOP Advisors. * * @see org.springframework.aop.interceptor.PerformanceMonitorInterceptor */ public void setPreInterceptors(Object[] preInterceptors) { this.preInterceptors = preInterceptors; } /** * Set additional interceptors (or advisors) to be applied after the * implicit transaction interceptor. * <p>You may specify any AOP Alliance MethodInterceptors or other * Spring AOP Advices, as well as Spring AOP Advisors. */ public void setPostInterceptors(Object[] postInterceptors) { this.postInterceptors = postInterceptors; } /** * Specify the AdvisorAdapterRegistry to use. * Default is the global AdvisorAdapterRegistry. * * @see org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry */ public void setAdvisorAdapterRegistry(AdvisorAdapterRegistry advisorAdapterRegistry) { this.advisorAdapterRegistry = advisorAdapterRegistry; } /** * Set the ClassLoader to generate the proxy class in. * <p>Default is the bean ClassLoader, i.e. the ClassLoader used by the * containing BeanFactory for loading all bean classes. This can be * overridden here for specific proxies. */ public void setProxyClassLoader(ClassLoader classLoader) { this.proxyClassLoader = classLoader; } @Override public void setBeanClassLoader(ClassLoader classLoader) { if (this.proxyClassLoader == null) { this.proxyClassLoader = classLoader; } } @Override public void afterPropertiesSet() { if (this.target == null) { throw new IllegalArgumentException("Property 'target' is required"); } if (this.target instanceof String) { throw new IllegalArgumentException("'target' needs to be a bean reference, not a bean name as value"); } if (this.proxyClassLoader == null) { this.proxyClassLoader = ClassUtils.getDefaultClassLoader(); } ProxyFactory proxyFactory = new ProxyFactory(); if (this.preInterceptors != null) { for (Object interceptor : this.preInterceptors) { proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(interceptor)); } } // Add the main interceptor (typically an Advisor). proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(createMainInterceptor())); if (this.postInterceptors != null) { for (Object interceptor : this.postInterceptors) { proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(interceptor)); } } proxyFactory.copyFrom(this); TargetSource targetSource = createTargetSource(this.target); proxyFactory.setTargetSource(targetSource); if (this.proxyInterfaces != null) { proxyFactory.setInterfaces(this.proxyInterfaces); } else if (!isProxyTargetClass()) { // Rely on AOP infrastructure to tell us what interfaces to proxy. Class<?> targetClass = targetSource.getTargetClass(); if (targetClass != null) { proxyFactory.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, this.proxyClassLoader)); } } postProcessProxyFactory(proxyFactory); this.proxy = proxyFactory.getProxy(this.proxyClassLoader); } /** * Determine a TargetSource for the given target (or TargetSource). * * @param target target. If this is an implementation of TargetSource it is * used as our TargetSource; otherwise it is wrapped in a SingletonTargetSource. * @return a TargetSource for this object */ protected TargetSource createTargetSource(Object target) { if (target instanceof TargetSource) { return (TargetSource) target; } else { return new SingletonTargetSource(target); } } /** * A hook for subclasses to post-process the {@link ProxyFactory} * before creating the proxy instance with it. * * @param proxyFactory the AOP ProxyFactory about to be used * @since 4.2 */ protected void postProcessProxyFactory(ProxyFactory proxyFactory) { } @Override public Object getObject() { if (this.proxy == null) { throw new FactoryBeanNotInitializedException(); } return this.proxy; } @Override @Nullable public Class<?> getObjectType() { if (this.proxy != null) { return this.proxy.getClass(); } if (this.proxyInterfaces != null && this.proxyInterfaces.length == 1) { return this.proxyInterfaces[0]; } if (this.target instanceof TargetSource) { return ((TargetSource) this.target).getTargetClass(); } if (this.target != null) { return this.target.getClass(); } return null; } @Override public final boolean isSingleton() { return true; } /** * Create the "main" interceptor for this proxy factory bean. * Typically an Advisor, but can also be any type of Advice. * <p>Pre-interceptors will be applied before, post-interceptors * will be applied after this interceptor. */ protected abstract Object createMainInterceptor(); }
c938dec60f0159bf78b2f861fbdc2a0bdf3bd0c9
39bf0b411d94ecbd8be5370cc8f106782523463e
/aliyun-java-sdk-scsp/src/main/java/com/aliyuncs/scsp/model/v20200702/GetEntityRouteListResponse.java
2ff2014aebbba94cfa25bfc5ca483edce5f97701
[ "Apache-2.0" ]
permissive
15022515596/aliyun-openapi-java-sdk
cdde8fa03d414841187e0c2817e7694c80bab14e
cddaed401d41d15f30685891c173b861af4b6374
refs/heads/master
2023-03-23T10:01:06.951652
2021-03-21T08:34:12
2021-03-21T08:34:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,896
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.scsp.model.v20200702; import java.util.List; import com.aliyuncs.AcsResponse; import com.aliyuncs.scsp.transform.v20200702.GetEntityRouteListResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class GetEntityRouteListResponse extends AcsResponse { private String code; private String message; private String requestId; private Boolean success; private Data data; public String getCode() { return this.code; } public void setCode(String code) { this.code = code; } public String getMessage() { return this.message; } public void setMessage(String message) { this.message = message; } public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public Boolean getSuccess() { return this.success; } public void setSuccess(Boolean success) { this.success = success; } public Data getData() { return this.data; } public void setData(Data data) { this.data = data; } public static class Data { private Long total; private Integer pageSize; private Integer pageNo; private List<EntityRouteListItem> entityRouteList; public Long getTotal() { return this.total; } public void setTotal(Long total) { this.total = total; } public Integer getPageSize() { return this.pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } public Integer getPageNo() { return this.pageNo; } public void setPageNo(Integer pageNo) { this.pageNo = pageNo; } public List<EntityRouteListItem> getEntityRouteList() { return this.entityRouteList; } public void setEntityRouteList(List<EntityRouteListItem> entityRouteList) { this.entityRouteList = entityRouteList; } public static class EntityRouteListItem { private Long uniqueId; private String entityId; private String entityName; private String entityBizCode; private String entityBizCodeType; private String entityRelationNumber; private String departmentId; private String groupId; private String serviceId; private String extInfo; public Long getUniqueId() { return this.uniqueId; } public void setUniqueId(Long uniqueId) { this.uniqueId = uniqueId; } public String getEntityId() { return this.entityId; } public void setEntityId(String entityId) { this.entityId = entityId; } public String getEntityName() { return this.entityName; } public void setEntityName(String entityName) { this.entityName = entityName; } public String getEntityBizCode() { return this.entityBizCode; } public void setEntityBizCode(String entityBizCode) { this.entityBizCode = entityBizCode; } public String getEntityBizCodeType() { return this.entityBizCodeType; } public void setEntityBizCodeType(String entityBizCodeType) { this.entityBizCodeType = entityBizCodeType; } public String getEntityRelationNumber() { return this.entityRelationNumber; } public void setEntityRelationNumber(String entityRelationNumber) { this.entityRelationNumber = entityRelationNumber; } public String getDepartmentId() { return this.departmentId; } public void setDepartmentId(String departmentId) { this.departmentId = departmentId; } public String getGroupId() { return this.groupId; } public void setGroupId(String groupId) { this.groupId = groupId; } public String getServiceId() { return this.serviceId; } public void setServiceId(String serviceId) { this.serviceId = serviceId; } public String getExtInfo() { return this.extInfo; } public void setExtInfo(String extInfo) { this.extInfo = extInfo; } } } @Override public GetEntityRouteListResponse getInstance(UnmarshallerContext context) { return GetEntityRouteListResponseUnmarshaller.unmarshall(this, context); } @Override public boolean checkShowJsonItemName() { return false; } }
801c635715cc0daf4aea9fbacc99bf8f14c8017a
1767bfac7bc817080d6afa8b830ad20a3ad9b178
/exercicios/src/fundamentos/ConversaoNumeroString.java
eab10a09971c6beb9783dedde58470bde159c0db
[]
no_license
Marimonbert/Curso-Java-com-EclipseIDE
13938925956ad0d11e12cc67a25aae4f0403dfc4
bb3e6760b131d0cdb2545f57d7a78cc55a9ee86c
refs/heads/main
2023-06-12T10:53:03.477035
2021-05-16T21:59:58
2021-05-16T21:59:58
367,971,747
2
0
null
null
null
null
UTF-8
Java
false
false
262
java
package fundamentos; public class ConversaoNumeroString { public static void main(String[] args) { Integer num1 = 10000; System.out.println(num1.toString().length()); int num2 = 10000; System.out.println(Integer.toString(num2).length()); } }
efe6456d5f625143eae008da46c222b5b047973d
76c0f4efed41fcdfc727cdc4b6adf74e2b0302c8
/src/fr/ac_versailles/crdp/apiscol/RequestHandler.java
48ff3f2340b6649ead97329d1fbbf10912dd0115
[]
no_license
crdpacversailles/apiscol-commons
3d47a180ccf4599fcb0cb7a753375f2cf00bf096
703f353bf1c5242e7c719b666bf85e65372695cf
refs/heads/master
2021-01-21T21:39:41.500752
2013-07-08T13:56:51
2013-07-08T13:56:51
10,762,563
0
3
null
2016-05-05T04:50:28
2013-06-18T12:17:02
Java
UTF-8
Java
false
false
691
java
package fr.ac_versailles.crdp.apiscol; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; public class RequestHandler { public static String extractAcceptHeader(HttpServletRequest request) { return request.getHeader("accept").trim().toLowerCase(); } public static String convertFormatQueryParam(String format) { if (format.trim().toLowerCase().contains("json")) return MediaType.APPLICATION_JSON; else if (format.trim().toLowerCase().contains("javascript")) return CustomMediaType.JSONP.toString(); else if (format.trim().toLowerCase().contains("html")) return MediaType.APPLICATION_XHTML_XML; return MediaType.APPLICATION_XML; } }
227ef3ea2e2211acd17bbec16e9ca97b441042e6
3de3651ffd44ef42c47a84be57d891a18248ddeb
/Lesson7/Client/src/main/java/Client.java
3533c45bfddd4c22201fa0926611f59774a8f30f
[]
no_license
BaranovaElena/JavaCoreAdvanced
0494ce8fb203e2d08eb19176370193e48d94c988
e42179d36cbb5753919525fed42d9c3bf848853f
refs/heads/main
2023-03-08T22:41:39.073457
2021-03-14T09:47:32
2021-03-14T09:47:32
334,398,786
0
0
null
2021-03-14T09:47:34
2021-01-30T11:41:51
Java
UTF-8
Java
false
false
4,137
java
import java.io.*; import java.net.Socket; public class Client { private Socket socket; private DataInputStream in; private DataOutputStream out; private Callback<String> callOnMsgReceived; private Callback<String> callOnChangeClientList; private Callback<String> callOnAuth; private Callback<String> callOnError; Thread readerMessages; public void connect() { try { socket = new Socket("localhost",8180); in = new DataInputStream(socket.getInputStream()); out = new DataOutputStream(socket.getOutputStream()); readerMessages = new Thread(() -> { boolean goOn = true; try { //авторизация while (goOn) { String message = in.readUTF(); if (message.startsWith("/authok")) { callOnAuth.callback("/authok"); break; } else if (message.equalsIgnoreCase("/end")) { goOn = false; } else if (message.equalsIgnoreCase("/error timeout")){ goOn = false; callOnError.callback("Time to connect has expired"); } else { callOnError.callback("Your login or password is wrong"); } } while (goOn) { String message = in.readUTF(); //сообщение разрыва соединения if (message.equalsIgnoreCase("/end")) break; //сообщение изменения списка клиентов else if (message.startsWith("/clients")){ callOnChangeClientList.callback(message.substring(9)); } //сообщения об ошибках else if (message.startsWith("/error")){ } //не служебные сообщения (в чат) else { callOnMsgReceived.callback(message); } } } catch (IOException e) { e.printStackTrace(); } finally { disconnect(); } }); readerMessages.start(); } catch (IOException e) { e.printStackTrace(); } } /*private void sendMessages() { String outputMessage; try { do{ outputMessage = scanner.nextLine(); out.writeUTF(outputMessage); out.flush(); } while (!outputMessage.equals("/end")); readerMessages.join(); } catch (IOException | InterruptedException e) { e.printStackTrace(); } }*/ public void sendMessage(String message) { try { out.writeUTF(message); out.flush(); } catch (IOException | NullPointerException e) { e.printStackTrace(); } } private void disconnect() { try { in.close(); out.close(); socket.close(); } catch (IOException e) { e.printStackTrace(); } } public void setCallOnMsgReceived(Callback<String> callOnMsgReceived) { this.callOnMsgReceived = callOnMsgReceived; } public void setCallOnChangeClientList(Callback<String> callOnChangeClientList) { this.callOnChangeClientList = callOnChangeClientList; } public void setCallOnAuth(Callback<String> callOnAuth) { this.callOnAuth = callOnAuth; } public void setCallOnError(Callback<String> callOnError) { this.callOnError = callOnError; } }
cd9afed614f5410e8e0bb75587c0458fd405bd1f
2b40d55e06270926fcae044043ae5beb95d74f3c
/actividades/prog/files/java/mil-ejemplos/darwin/database/User.java
59d424fc652180b15e825f37693ba4196b18535d
[ "BSD-2-Clause", "CC0-1.0", "CC-BY-SA-3.0" ]
permissive
jsuabur/libro-de-actividades
15af2318407420b5cd81f4c4bc8a8371ee0c1eee
2941e34a5112962403d965e53435951981652503
refs/heads/master
2020-04-07T16:40:10.388462
2018-11-21T11:25:44
2018-11-21T11:25:44
158,537,991
0
0
CC0-1.0
2018-11-21T11:30:22
2018-11-21T11:30:22
null
UTF-8
Java
false
false
5,758
java
package database; // package jabadot; import java.util.Date; /** Represents one logged in user */ public class User implements java.io.Serializable { private static final long serialVersionUID = 5394392565088707959L; // #name:password:name:email:City:Prov:Country:privs /** The login name */ protected String name; protected String password; protected String firstName; protected String lastName; protected String fullName; // derived protected String email; // 5 protected String address; protected String address2; protected String company; protected String city; protected String prov; // 10 protected String country; protected Date creationDate; protected Date lastLoginDate; protected String jobDescr; protected String os; // 15 protected String unixGUI; protected String proglang; /** user preference */ protected String skin; // // privs is 19 protected boolean editPrivs = false; protected boolean adminPrivs = false; public static final int P_ADMIN = 01000; public static final int P_EDIT = 0100; /** Construct a user with no data -- must be a no-argument * constructor for use in jsp:useBean. */ public User() { creationDate = new Date(); } /** Construct a user with just the name */ public User(String n) { this(); // set credt name = n; } /** Construct a user with all text fields. */ public User(String nick, String pw, String fname, String lName, String emaddr, String comp, String addr1, String addr2, String cty, String pr, String cntry, String jd, String os, String gui, String lang, String skin) { this(); // set credt name = nick; password = pw; firstName = fname; lastName = lName; email = emaddr; address = addr1; address2 = addr2; company = comp; city = cty; prov = pr; country = cntry; this.skin = skin; jobDescr = jd; this.os = os; unixGUI = gui; proglang = lang; } /** Construct a user with common text fields. */ public User(String nick, String pw, String fname, String lName, String emaddr, String prov, String cntry, Date credt, Date lastlog, String skin, boolean e, boolean a) { this(); // set credt name = nick; password = pw; firstName = fname; lastName = lName; email = emaddr; this.prov = prov; this.country = cntry; this.skin = skin; creationDate = (Date) credt.clone(); lastLoginDate = (Date) lastlog.clone(); adminPrivs = a; editPrivs = e; } /** * @param nick * @param pass * @param full * @param email2 * @param city2 * @param prov2 * @param ctry */ public User(String nick, String pass, String full, String email2, String city2, String prov2, String ctry) { // TODO Auto-generated constructor stub } /** Return the nickname. */ public String getName() { return name; } /** The name should not be changeable, but we * want to be able to say <jsp:setProperty property="*"/> * and get it all... */ public void setName(String nick) { name = nick; } public String getPassword() { return password; } /** Validate a given password against the user's. */ public boolean checkPassword(String userInput) { return password.equals(userInput); } /** Set password */ public void setPassword(String password) { this.password = password; } /** Get email */ public String getEmail() { return email; } /** Set email */ public void setEmail(String email) { this.email = email; } /** Get fullName */ public String getFullName() { return firstName + ' ' + lastName; } /** Set firstName */ public void setFirstName(String firstName) { this.firstName = firstName; } /** Set lastName */ public void setlastName(String lastName) { this.lastName = lastName; } /** Get city */ public String getCity() { return city; } /** Set city */ public void setCity(String city) { this.city = city; } /** Get prov */ public String getProv() { return prov; } /** Set prov */ public void setProv(String prov) { this.prov = prov; } /** Get country */ public String getCountry() { return country; } /** Set country */ public void setCountry(String country) { this.country = country; } /** Get adminPrivs */ public boolean isAdminPrivileged() { return adminPrivs; } /** Set adminPrivs */ public void setAdminPrivileged(boolean adminPrivs) { this.adminPrivs = adminPrivs; } /** Get EditPrivs */ public boolean isEditPrivileged() { return editPrivs; } /** Set EditPrivs */ public void setEditPrivileged(boolean editPrivs) { this.editPrivs = editPrivs; } /** Get all privs, as an int, for use in the database */ public int getPrivs() { int i = 0; if (adminPrivs) i |= P_ADMIN; if (editPrivs) i |= P_EDIT; return i; } /** Get the Creation Date (read only field) */ public Date getCreationDate() { return (Date) creationDate.clone(); } /** Set the Creation Date (read only field) */ public void setCreationDate(Date date) { creationDate = (Date) date.clone(); } /** Get the LastLog Date (read only field) */ public Date getLastLoginDate() { return (Date) lastLoginDate.clone(); } /** Get the LastLog Date (read only field) */ public void setLastLoginDate(Date d) { lastLoginDate = (Date) d.clone(); } /** Return a String representation. */ public String toString() { return new StringBuffer("User[").append(name).append(','). append(firstName).append(' ').append(lastName). append(']').toString(); } /** Check if all required fields have been set */ public boolean isComplete() { if (name == null || name.length()==0 || firstName == null || firstName.length()==0 || lastName == null || lastName.length()==0 || email == null || email.length()==0) return false; return true; } }
ec2a60930511180c2826bfbe681131d7c9b2c233
501537e1c149760137d6b0db806098b5d436e874
/houserobbery.java
92033d0929145b243af59c8d708adf56d92d7ebc
[]
no_license
Arihant1467/DP-1
68bcba17f18a974562089367327b41b4858d18e9
1da99e42de749f272626b5515eefbe65d2f91443
refs/heads/master
2020-08-17T12:50:38.375716
2019-10-17T01:44:59
2019-10-17T01:44:59
215,669,416
0
0
null
2019-10-17T00:28:01
2019-10-17T00:28:00
null
UTF-8
Java
false
false
1,098
java
/* Did it run leetcode: Yes Time Complexity: 0(N) Space Complexity: 0(N) Problems faced: Yes Algorithm: The idea behind the algorithm is that, since we cannot rob two consecutive houses, we compare total money looted against previous house, two houses before+current house. 1. We create `value` array with size qual to nums 2. The first value of `value` array will be equal to fist value of nums array 3. Then at every positon we check max(value[i-1], value[i-2]+nums[i]) because we cannot rob two consecutive houses to avoid alarm. */ class Solution { public int rob(int[] nums) { if(nums==null){ return 0; }else if(nums.length==0){ return 0; } else if(nums.length==1){ return nums[0]; } int[] values = new int[nums.length]; values[0] = nums[0]; values[1] = Math.max(values[0],nums[1]); for(int i=2;i<nums.length;++i){ values[i] = Math.max(values[i-2]+nums[i],values[i-1]); } return values[nums.length-1]; } }
98ef60879f07b9962694bb8064d1be4cc5f966df
a70932bd4d4829b1a4c35d0103dd7f62e21c933b
/src/model/NodeInfo.java
dec25598607d7605bb2562f653a9ec9239ca4c1e
[]
no_license
njubatyrov/DIAS-visualization
b6f68f586f3ea739805ec63eb1630204dbafa5a4
b0ec73e3d8abfb4c55690e1cce46c93de8f61c7a
refs/heads/master
2021-01-23T10:34:25.686256
2018-03-29T21:02:20
2018-03-29T21:02:20
102,617,062
0
0
null
null
null
null
UTF-8
Java
false
false
3,576
java
package model; /** * Node information for a specific node in a specifing epoch; * * @author jubatyrn */ import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; public class NodeInfo { private int id; private int epoch; private double avg; private double sum; private double min; private double max; private double count; private double sumsqr; private double stdev; private double state; private ArrayList<Integer> push; private ArrayList<Integer> pull; private ArrayList<Integer> leave; private ArrayList<Integer> return_; private ArrayList<Integer> pss0; private ArrayList<Integer> pss1; private ArrayList<Integer> pss2; private ArrayList<Integer> pss3; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getEpoch() { return epoch; } public void setEpoch(int epoch) { this.epoch = epoch; } public double getAvg() { return avg; } public void setAvg(double avg) { this.avg = avg; } public double getSum() { return sum; } public void setSum(double sum) { this.sum = sum; } public double getMin() { return min; } public void setMin(double min) { this.min = min; } public double getMax() { return max; } public void setMax(double max) { this.max = max; } public double getCount() { return count; } public void setCount(double count) { this.count = count; } public double getSumsqr() { return sumsqr; } public void setSumsqr(double sumsqr) { this.sumsqr = sumsqr; } public double getStdev() { return stdev; } public void setStdev(double stdev) { this.stdev = stdev; } public double getState() { return state; } public void setState(double state) { this.state = state; } @JsonProperty("PUSH") public ArrayList<Integer> getPush() { return push; } @JsonProperty("PUSH") public void setPUSH(ArrayList<Integer> pUSH) { push = pUSH; } @JsonProperty("PULL") public ArrayList<Integer> getPull() { return pull; } @JsonProperty("PULL") public void setPULL(ArrayList<Integer> pULL) { pull = pULL; } @JsonProperty("LEAVE") public ArrayList<Integer> getLeave() { return leave; } @JsonProperty("LEAVE") public void setLEAVE(ArrayList<Integer> lEAVE) { leave = lEAVE; } @JsonProperty("RETURN") public ArrayList<Integer> getReturn() { return return_; } @JsonProperty("RETURN") public void setRETURN(ArrayList<Integer> rETURN) { return_ = rETURN; } public ArrayList<Integer> getPss0() { return pss0; } public void setPss0(ArrayList<Integer> pss0) { this.pss0 = pss0; } public ArrayList<Integer> getPss1() { return pss1; } public void setPss1(ArrayList<Integer> pss1) { this.pss1 = pss1; } public ArrayList<Integer> getPss2() { return pss2; } public void setPss2(ArrayList<Integer> pss2) { this.pss2 = pss2; } public ArrayList<Integer> getPss3() { return pss3; } public void setPss3(ArrayList<Integer> pss3) { this.pss3 = pss3; } public String toString() { return "Epoch:" + epoch + ", Node:" + id + "\n"; } }
fb238b421ff08daaac1cbdc820e1f3f600961a47
e4f38331fb4c3277a3c559156669a659f0afadea
/de/tud/kom/srr/tasks/NetworkEntity.java
cbf37737610f50e6d9e8ecaa881e5a70e1abc05b
[ "Apache-2.0" ]
permissive
rhaban/sdn-statistic-request-relay
8aaf5d874c0c5d28f981ae4ef5c459ac68f7b01f
0b3e60e8502f9aa890c9ad0ccf72a7cf40a228ef
refs/heads/master
2021-05-11T12:29:02.907156
2018-01-16T09:08:37
2018-01-16T09:08:37
117,659,810
0
0
null
null
null
null
UTF-8
Java
false
false
1,923
java
/** Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. @author Rhaban Hark **/ package de.tud.kom.srr.tasks; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONString; public class NetworkEntity implements JSONString { private long dpid; private int port; public NetworkEntity(long dpid, int port) { this.dpid = dpid; this.port = port; } public long getDpid() { return dpid; } public void setDpid(long dpid) { this.dpid = dpid; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public static NetworkEntity parse(JSONObject json) { try { return new NetworkEntity(json.getLong("dpid"), json.getInt("port")); } catch (JSONException e) { e.printStackTrace(); } return null; } @Override public String toJSONString() { try { return new JSONObject().put("dpid", dpid).put("port", port).toString(); } catch (JSONException e) { e.printStackTrace(); } return null; } @Override public boolean equals(Object o) { NetworkEntity e = (NetworkEntity)o; return e.port == this.port && e.dpid == this.dpid; } }
3dcaaa0eef4bbca66f48604d446cb81021ef09fe
3b3274f85abd162f7dbb1fe7a4c13ef48bec864b
/src/main/java/com/rest/itau/UserController.java
31f9f591f42063c143457cd7086fba7c19a45815
[]
no_license
dannielz/itau-rest-server
05bcbb0a589da9c9a2451b42efa8a27caef50ee3
7cc9917adbbef82110ff4bba46ac6180e992968a
refs/heads/master
2020-03-23T19:55:15.954853
2018-07-23T18:40:38
2018-07-23T18:40:38
141,939,120
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
package com.rest.itau; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api/user") public class UserController { @Autowired UserRepository userRepository; @GetMapping("/mostfollowed") public List<User> getMostFollowedUsers(){ return userRepository.findMostFollowedUsers(); } }
e60c719e0023ee648083707716678e0279eb2826
e7a6d8a81a045bb49565868cd587fd005cf21b64
/src/main/java/it/polimi/ingsw/ps16/server/model/message/infomessage/InfoMessage.java
62265c440c1f5e952cf852a25302f2a243b1c486
[]
no_license
GiovanniGianola/Aleph-CouncilOfFour
ea323b72bdaae977d6706a79e12251de3cae7237
55e04d759c5b64573a183ebc2f9f9ce8a10957ca
refs/heads/master
2022-12-28T16:11:05.541489
2020-05-07T16:52:58
2020-05-07T16:52:58
262,107,367
0
0
null
2020-10-13T21:48:46
2020-05-07T16:51:09
Java
UTF-8
Java
false
false
938
java
/***************************************** * * * Council Of Four * * * * Software Engineering Project * * * * Politecnico di Milano * * * * Academic Year: 2015 - 2016 * * * * Authors: Gianola Giovanni * * Leveni Filippo * * Ionata Valentina * * * ****************************************/ package it.polimi.ingsw.ps16.server.model.message.infomessage; import java.io.Serializable; /** * The Class InfoMessage. */ public abstract class InfoMessage implements Serializable { /** The Constant serialVersionUID. */ private static final long serialVersionUID = -1411394558712321744L; /** * Instantiates a new info message. */ public InfoMessage() { /* Empty Constructor */ } /** * Gets the current player ID. * * @return the current player ID */ public abstract int getCurrentPlayerID(); }
fcacbe46cb0ce7a6c238cacdf264a576ec6c33c2
f6688a80624042004f911464a67541c032c1e09a
/src/com/example/haodoucai/MainActivity.java
5c21d44791b20621675f672c38f9fee6f4076206
[]
no_license
hanmichael/-
b938d72fd060a957c1f5a086506d186e3f94004c
3416a1e400b4b4047000e93a7d0470e4d03fb15c
refs/heads/master
2021-01-10T11:05:01.516835
2015-10-07T09:31:12
2015-10-07T09:31:12
43,806,466
0
0
null
null
null
null
UTF-8
Java
false
false
513
java
package com.example.haodoucai; import android.os.Bundle; import android.app.Activity; import android.view.Menu; 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; } }
100088c97fd00a78f8519b4584477e9f5a1fed39
c24e883bba5235840239de3bd5640d92e0c8db66
/activite/src/main/java/com/smart/website/activite/SmsBasicGiftsEntityPK.java
22807c49e2474eab2bbeb7d82b9cc31ef88d2884
[]
no_license
hotHeart48156/mallwebsite
12fe2f7d4e108ceabe89b82eacca75898d479357
ba865c7ea22955009e2de7b688038ddd8bc9febf
refs/heads/master
2022-11-23T23:22:28.967449
2020-01-07T15:27:27
2020-01-07T15:27:27
231,905,626
0
0
null
2022-11-15T23:54:56
2020-01-05T11:14:43
Java
UTF-8
Java
false
false
1,103
java
package com.smart.website.activite; import javax.persistence.Column; import javax.persistence.Id; import java.io.Serializable; public class SmsBasicGiftsEntityPK implements Serializable { private int storeId; private long id; @Column(name = "store_id", nullable = false) @Id public int getStoreId() { return storeId; } public void setStoreId(int storeId) { this.storeId = storeId; } @Column(name = "id", nullable = false) @Id public long getId() { return id; } public void setId(long id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SmsBasicGiftsEntityPK that = (SmsBasicGiftsEntityPK) o; if (storeId != that.storeId) return false; if (id != that.id) return false; return true; } @Override public int hashCode() { int result = storeId; result = 31 * result + (int) (id ^ (id >>> 32)); return result; } }
8c966e55b13b1d58ef0be1485fd13f183f0634d8
edc96a89b24df2dbbca7d99fd156dc03e789f738
/app/src/main/java/com/example/user/gamearticlesmenu/DownloadTask.java
8bb10525935e0c5948f9e284a44758fe7899ab99
[]
no_license
kenta12357/android_GameSummary
a4125f6e7600e7b31d2f47ab6bcf45bfb5f9a512
8a8399607559e8dfa8c8bdf9b96f1c5b7f74b4ad
refs/heads/master
2020-11-23T23:16:08.812209
2019-12-13T14:41:58
2019-12-13T14:41:58
227,859,765
0
0
null
null
null
null
UTF-8
Java
false
false
4,770
java
package com.example.user.gamearticlesmenu; /** * Created by Kenta on 2018/02/13. */ import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.util.Log; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class DownloadTask extends AsyncTask<String, Void, String> { private Listener listener; // 非同期処理 @Override protected String doInBackground (String... params) { return downloadImage (params[0]); } // 途中経過をメインスレッドに返す /*@Override protected void onProgressUpdate (Void... progress) { // 途中経過をメインスレッドに返す処理 }*/ // 非同期処理が終了後、結果をメインスレッドに返す @Override protected void onPostExecute (String bmp) { if (listener != null) { listener.onSuccess (bmp); } } private String downloadImage(String address) { // Bitmap 宣言 String bmp = null; // final ? final StringBuilder result = new StringBuilder(); // 宣言 HttpURLConnection urlConnection = null; try { // URL型 url に address を格納 URL url = new URL (address); // HttpURLConnection インスタンス生成 urlConnection = (HttpURLConnection) url.openConnection(); // タイムアウト設定 urlConnection.setReadTimeout(10000); urlConnection.setConnectTimeout(20000); // リクエストメソッド urlConnection.setRequestMethod("GET"); // リダイレクトを自動で許可しない設定 urlConnection.setInstanceFollowRedirects(false); // ヘッダーの設定(複数設定可能) urlConnection.setRequestProperty("Accept-Language", "jp"); // 接続 urlConnection.connect(); // resp にレスポンスコードを入れる? int resp = urlConnection.getResponseCode(); // resp によってスイッチ switch (resp){ // HTTP_OK が返ってきたときは case HttpURLConnection.HTTP_OK: // InputStream を準備 InputStream is = null; try{ // is にネットからファイルをダウンロード is = urlConnection.getInputStream(); // bmp にファイルを変換して格納 bmp = convertInputStreamToString(is); // is をクローズ is.close(); // エラー処理 } catch(IOException e){ e.printStackTrace(); } finally{ if(is != null){ is.close(); } } break; // HTTP_UNAUTHORIZED だったら break case HttpURLConnection.HTTP_UNAUTHORIZED: break; default: break; } // エラー処理 } catch (Exception e) { Log.d("debug", "downloadImage error"); e.printStackTrace(); } finally { if (urlConnection != null) { urlConnection.disconnect(); } } // bmp を返す return bmp; } void setListener(Listener listener) { this.listener = listener; } interface Listener { void onSuccess(String bmp); } static String convertInputStreamToString (InputStream is) throws IOException { InputStreamReader reader = new InputStreamReader(is); StringBuilder builder= new StringBuilder(); char[] buffer = new char[512]; int read; while (0 <= (read = reader.read(buffer))) { builder.append(buffer, 0, read); } return builder.toString(); } public static boolean newtWorkCheck(Context context){ ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cm.getActiveNetworkInfo(); if(info != null){ return info.isConnected(); } else{ return false; } } }
87ed97bc690ebdb8d7942920f19efbc8300e7adc
a57d56231f382ffcccea17cd91a421090e26f2f6
/src/main/java/beer/hapibrew/beerxml2proto/proto/Style.java
1cec8df4f83e3601ef69b98d650f46c570b6e94f
[ "MIT" ]
permissive
zokipirlo/beerxml2proto
fcbceabb9087fc763e57c3449bb128b4c316c646
eb3b0d5918d5c142d6e60fcefb91e9fe8cde3960
refs/heads/master
2021-01-18T21:07:58.788711
2017-04-05T14:19:10
2017-04-05T14:19:10
87,010,259
0
0
null
null
null
null
UTF-8
Java
false
false
20,057
java
// Code generated by Wire protocol buffer compiler, do not edit. // Source file: beer.proto at 45:1 package beer.hapibrew.beerxml2proto.proto; import android.os.Parcelable; import android.support.annotation.Nullable; import com.squareup.wire.AndroidMessage; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.io.IOException; import java.lang.Double; import java.lang.Integer; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; public final class Style extends AndroidMessage<Style, Style.Builder> { public static final ProtoAdapter<Style> ADAPTER = new ProtoAdapter_Style(); public static final Parcelable.Creator<Style> CREATOR = AndroidMessage.newCreator(ADAPTER); private static final long serialVersionUID = 0L; public static final String DEFAULT_NAME = ""; public static final Integer DEFAULT_VERSION = 1; public static final String DEFAULT_CATEGORY = ""; public static final String DEFAULT_CATEGORY_NUMBER = ""; public static final String DEFAULT_STYLE_LETTER = ""; public static final String DEFAULT_STYLE_GUIDE = ""; public static final StyleType DEFAULT_TYPE = StyleType.LAGER; public static final Double DEFAULT_OG_MIN = 1.000d; public static final Double DEFAULT_OG_MAX = 1.160d; public static final Double DEFAULT_FG_MIN = 1.000d; public static final Double DEFAULT_FG_MAX = 1.160d; public static final Double DEFAULT_ABV_MIN = 0d; public static final Double DEFAULT_ABV_MAX = 15d; public static final Double DEFAULT_SRM_MIN = 0d; public static final Double DEFAULT_SRM_MAX = 40d; public static final Double DEFAULT_IBU_MIN = 0d; public static final Double DEFAULT_IBU_MAX = 120d; public static final String DEFAULT_NOTES = ""; @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) @Nullable public final String name; @WireField( tag = 2, adapter = "com.squareup.wire.ProtoAdapter#INT32" ) @Nullable public final Integer version; @WireField( tag = 3, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) @Nullable public final String category; @WireField( tag = 4, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) @Nullable public final String category_number; @WireField( tag = 5, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) @Nullable public final String style_letter; @WireField( tag = 6, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) @Nullable public final String style_guide; @WireField( tag = 7, adapter = "beer.hapibrew.beerxml2proto.proto.StyleType#ADAPTER" ) @Nullable public final StyleType type; @WireField( tag = 8, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double og_min; @WireField( tag = 9, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double og_max; @WireField( tag = 10, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double fg_min; @WireField( tag = 11, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double fg_max; @WireField( tag = 12, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double abv_min; @WireField( tag = 13, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double abv_max; @WireField( tag = 14, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double srm_min; @WireField( tag = 15, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double srm_max; @WireField( tag = 16, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double ibu_min; @WireField( tag = 17, adapter = "com.squareup.wire.ProtoAdapter#DOUBLE" ) @Nullable public final Double ibu_max; @WireField( tag = 18, adapter = "com.squareup.wire.ProtoAdapter#STRING" ) @Nullable public final String notes; public Style(@Nullable String name, @Nullable Integer version, @Nullable String category, @Nullable String category_number, @Nullable String style_letter, @Nullable String style_guide, @Nullable StyleType type, @Nullable Double og_min, @Nullable Double og_max, @Nullable Double fg_min, @Nullable Double fg_max, @Nullable Double abv_min, @Nullable Double abv_max, @Nullable Double srm_min, @Nullable Double srm_max, @Nullable Double ibu_min, @Nullable Double ibu_max, @Nullable String notes) { this(name, version, category, category_number, style_letter, style_guide, type, og_min, og_max, fg_min, fg_max, abv_min, abv_max, srm_min, srm_max, ibu_min, ibu_max, notes, ByteString.EMPTY); } public Style(@Nullable String name, @Nullable Integer version, @Nullable String category, @Nullable String category_number, @Nullable String style_letter, @Nullable String style_guide, @Nullable StyleType type, @Nullable Double og_min, @Nullable Double og_max, @Nullable Double fg_min, @Nullable Double fg_max, @Nullable Double abv_min, @Nullable Double abv_max, @Nullable Double srm_min, @Nullable Double srm_max, @Nullable Double ibu_min, @Nullable Double ibu_max, @Nullable String notes, ByteString unknownFields) { super(ADAPTER, unknownFields); this.name = name; this.version = version; this.category = category; this.category_number = category_number; this.style_letter = style_letter; this.style_guide = style_guide; this.type = type; this.og_min = og_min; this.og_max = og_max; this.fg_min = fg_min; this.fg_max = fg_max; this.abv_min = abv_min; this.abv_max = abv_max; this.srm_min = srm_min; this.srm_max = srm_max; this.ibu_min = ibu_min; this.ibu_max = ibu_max; this.notes = notes; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.name = name; builder.version = version; builder.category = category; builder.category_number = category_number; builder.style_letter = style_letter; builder.style_guide = style_guide; builder.type = type; builder.og_min = og_min; builder.og_max = og_max; builder.fg_min = fg_min; builder.fg_max = fg_max; builder.abv_min = abv_min; builder.abv_max = abv_max; builder.srm_min = srm_min; builder.srm_max = srm_max; builder.ibu_min = ibu_min; builder.ibu_max = ibu_max; builder.notes = notes; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Style)) return false; Style o = (Style) other; return unknownFields().equals(o.unknownFields()) && Internal.equals(name, o.name) && Internal.equals(version, o.version) && Internal.equals(category, o.category) && Internal.equals(category_number, o.category_number) && Internal.equals(style_letter, o.style_letter) && Internal.equals(style_guide, o.style_guide) && Internal.equals(type, o.type) && Internal.equals(og_min, o.og_min) && Internal.equals(og_max, o.og_max) && Internal.equals(fg_min, o.fg_min) && Internal.equals(fg_max, o.fg_max) && Internal.equals(abv_min, o.abv_min) && Internal.equals(abv_max, o.abv_max) && Internal.equals(srm_min, o.srm_min) && Internal.equals(srm_max, o.srm_max) && Internal.equals(ibu_min, o.ibu_min) && Internal.equals(ibu_max, o.ibu_max) && Internal.equals(notes, o.notes); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (name != null ? name.hashCode() : 0); result = result * 37 + (version != null ? version.hashCode() : 0); result = result * 37 + (category != null ? category.hashCode() : 0); result = result * 37 + (category_number != null ? category_number.hashCode() : 0); result = result * 37 + (style_letter != null ? style_letter.hashCode() : 0); result = result * 37 + (style_guide != null ? style_guide.hashCode() : 0); result = result * 37 + (type != null ? type.hashCode() : 0); result = result * 37 + (og_min != null ? og_min.hashCode() : 0); result = result * 37 + (og_max != null ? og_max.hashCode() : 0); result = result * 37 + (fg_min != null ? fg_min.hashCode() : 0); result = result * 37 + (fg_max != null ? fg_max.hashCode() : 0); result = result * 37 + (abv_min != null ? abv_min.hashCode() : 0); result = result * 37 + (abv_max != null ? abv_max.hashCode() : 0); result = result * 37 + (srm_min != null ? srm_min.hashCode() : 0); result = result * 37 + (srm_max != null ? srm_max.hashCode() : 0); result = result * 37 + (ibu_min != null ? ibu_min.hashCode() : 0); result = result * 37 + (ibu_max != null ? ibu_max.hashCode() : 0); result = result * 37 + (notes != null ? notes.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (name != null) builder.append(", name=").append(name); if (version != null) builder.append(", version=").append(version); if (category != null) builder.append(", category=").append(category); if (category_number != null) builder.append(", category_number=").append(category_number); if (style_letter != null) builder.append(", style_letter=").append(style_letter); if (style_guide != null) builder.append(", style_guide=").append(style_guide); if (type != null) builder.append(", type=").append(type); if (og_min != null) builder.append(", og_min=").append(og_min); if (og_max != null) builder.append(", og_max=").append(og_max); if (fg_min != null) builder.append(", fg_min=").append(fg_min); if (fg_max != null) builder.append(", fg_max=").append(fg_max); if (abv_min != null) builder.append(", abv_min=").append(abv_min); if (abv_max != null) builder.append(", abv_max=").append(abv_max); if (srm_min != null) builder.append(", srm_min=").append(srm_min); if (srm_max != null) builder.append(", srm_max=").append(srm_max); if (ibu_min != null) builder.append(", ibu_min=").append(ibu_min); if (ibu_max != null) builder.append(", ibu_max=").append(ibu_max); if (notes != null) builder.append(", notes=").append(notes); return builder.replace(0, 2, "Style{").append('}').toString(); } public static final class Builder extends Message.Builder<Style, Builder> { public String name; public Integer version; public String category; public String category_number; public String style_letter; public String style_guide; public StyleType type; public Double og_min; public Double og_max; public Double fg_min; public Double fg_max; public Double abv_min; public Double abv_max; public Double srm_min; public Double srm_max; public Double ibu_min; public Double ibu_max; public String notes; public Builder() { } public Builder name(String name) { this.name = name; return this; } public Builder version(Integer version) { this.version = version; return this; } public Builder category(String category) { this.category = category; return this; } public Builder category_number(String category_number) { this.category_number = category_number; return this; } public Builder style_letter(String style_letter) { this.style_letter = style_letter; return this; } public Builder style_guide(String style_guide) { this.style_guide = style_guide; return this; } public Builder type(StyleType type) { this.type = type; return this; } public Builder og_min(Double og_min) { this.og_min = og_min; return this; } public Builder og_max(Double og_max) { this.og_max = og_max; return this; } public Builder fg_min(Double fg_min) { this.fg_min = fg_min; return this; } public Builder fg_max(Double fg_max) { this.fg_max = fg_max; return this; } public Builder abv_min(Double abv_min) { this.abv_min = abv_min; return this; } public Builder abv_max(Double abv_max) { this.abv_max = abv_max; return this; } public Builder srm_min(Double srm_min) { this.srm_min = srm_min; return this; } public Builder srm_max(Double srm_max) { this.srm_max = srm_max; return this; } public Builder ibu_min(Double ibu_min) { this.ibu_min = ibu_min; return this; } public Builder ibu_max(Double ibu_max) { this.ibu_max = ibu_max; return this; } public Builder notes(String notes) { this.notes = notes; return this; } @Override public Style build() { return new Style(name, version, category, category_number, style_letter, style_guide, type, og_min, og_max, fg_min, fg_max, abv_min, abv_max, srm_min, srm_max, ibu_min, ibu_max, notes, super.buildUnknownFields()); } } private static final class ProtoAdapter_Style extends ProtoAdapter<Style> { ProtoAdapter_Style() { super(FieldEncoding.LENGTH_DELIMITED, Style.class); } @Override public int encodedSize(Style value) { return (value.name != null ? ProtoAdapter.STRING.encodedSizeWithTag(1, value.name) : 0) + (value.version != null ? ProtoAdapter.INT32.encodedSizeWithTag(2, value.version) : 0) + (value.category != null ? ProtoAdapter.STRING.encodedSizeWithTag(3, value.category) : 0) + (value.category_number != null ? ProtoAdapter.STRING.encodedSizeWithTag(4, value.category_number) : 0) + (value.style_letter != null ? ProtoAdapter.STRING.encodedSizeWithTag(5, value.style_letter) : 0) + (value.style_guide != null ? ProtoAdapter.STRING.encodedSizeWithTag(6, value.style_guide) : 0) + (value.type != null ? StyleType.ADAPTER.encodedSizeWithTag(7, value.type) : 0) + (value.og_min != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(8, value.og_min) : 0) + (value.og_max != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(9, value.og_max) : 0) + (value.fg_min != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(10, value.fg_min) : 0) + (value.fg_max != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(11, value.fg_max) : 0) + (value.abv_min != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(12, value.abv_min) : 0) + (value.abv_max != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(13, value.abv_max) : 0) + (value.srm_min != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(14, value.srm_min) : 0) + (value.srm_max != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(15, value.srm_max) : 0) + (value.ibu_min != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(16, value.ibu_min) : 0) + (value.ibu_max != null ? ProtoAdapter.DOUBLE.encodedSizeWithTag(17, value.ibu_max) : 0) + (value.notes != null ? ProtoAdapter.STRING.encodedSizeWithTag(18, value.notes) : 0) + value.unknownFields().size(); } @Override public void encode(ProtoWriter writer, Style value) throws IOException { if (value.name != null) ProtoAdapter.STRING.encodeWithTag(writer, 1, value.name); if (value.version != null) ProtoAdapter.INT32.encodeWithTag(writer, 2, value.version); if (value.category != null) ProtoAdapter.STRING.encodeWithTag(writer, 3, value.category); if (value.category_number != null) ProtoAdapter.STRING.encodeWithTag(writer, 4, value.category_number); if (value.style_letter != null) ProtoAdapter.STRING.encodeWithTag(writer, 5, value.style_letter); if (value.style_guide != null) ProtoAdapter.STRING.encodeWithTag(writer, 6, value.style_guide); if (value.type != null) StyleType.ADAPTER.encodeWithTag(writer, 7, value.type); if (value.og_min != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 8, value.og_min); if (value.og_max != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 9, value.og_max); if (value.fg_min != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 10, value.fg_min); if (value.fg_max != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 11, value.fg_max); if (value.abv_min != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 12, value.abv_min); if (value.abv_max != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 13, value.abv_max); if (value.srm_min != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 14, value.srm_min); if (value.srm_max != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 15, value.srm_max); if (value.ibu_min != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 16, value.ibu_min); if (value.ibu_max != null) ProtoAdapter.DOUBLE.encodeWithTag(writer, 17, value.ibu_max); if (value.notes != null) ProtoAdapter.STRING.encodeWithTag(writer, 18, value.notes); writer.writeBytes(value.unknownFields()); } @Override public Style decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: builder.name(ProtoAdapter.STRING.decode(reader)); break; case 2: builder.version(ProtoAdapter.INT32.decode(reader)); break; case 3: builder.category(ProtoAdapter.STRING.decode(reader)); break; case 4: builder.category_number(ProtoAdapter.STRING.decode(reader)); break; case 5: builder.style_letter(ProtoAdapter.STRING.decode(reader)); break; case 6: builder.style_guide(ProtoAdapter.STRING.decode(reader)); break; case 7: { try { builder.type(StyleType.ADAPTER.decode(reader)); } catch (ProtoAdapter.EnumConstantNotFoundException e) { builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value); } break; } case 8: builder.og_min(ProtoAdapter.DOUBLE.decode(reader)); break; case 9: builder.og_max(ProtoAdapter.DOUBLE.decode(reader)); break; case 10: builder.fg_min(ProtoAdapter.DOUBLE.decode(reader)); break; case 11: builder.fg_max(ProtoAdapter.DOUBLE.decode(reader)); break; case 12: builder.abv_min(ProtoAdapter.DOUBLE.decode(reader)); break; case 13: builder.abv_max(ProtoAdapter.DOUBLE.decode(reader)); break; case 14: builder.srm_min(ProtoAdapter.DOUBLE.decode(reader)); break; case 15: builder.srm_max(ProtoAdapter.DOUBLE.decode(reader)); break; case 16: builder.ibu_min(ProtoAdapter.DOUBLE.decode(reader)); break; case 17: builder.ibu_max(ProtoAdapter.DOUBLE.decode(reader)); break; case 18: builder.notes(ProtoAdapter.STRING.decode(reader)); break; default: { FieldEncoding fieldEncoding = reader.peekFieldEncoding(); Object value = fieldEncoding.rawProtoAdapter().decode(reader); builder.addUnknownField(tag, fieldEncoding, value); } } } reader.endMessage(token); return builder.build(); } @Override public Style redact(Style value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
b22d206af81dd8a84b7fb4b1601dab70f958837c
965ecacc15e05faf2cede20a40eff3967b7e7547
/src/main/java/com/zipdoc/hb/dao/MemberDAO.java
e939fb3ec9a07c662f8f7b9bed86ce7e90dd3d8b
[]
no_license
YoungWookCho/spring-zipdoc
5769b57aa27895f38845dedb058eaf8aa351bd81
bf131a7a5205dc7e4f5adcfb1b89b427ad951f77
refs/heads/master
2021-01-11T14:25:54.360214
2017-02-14T02:36:46
2017-02-14T02:36:46
81,412,831
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package com.zipdoc.hb.dao; import java.util.HashMap; import java.util.Map; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; @Repository public class MemberDAO { @Autowired private SqlSession sqlSession; public int insertMember(String uid, String userId, String userPw, String userName, String userPhone, String userNickname ) { Map param = new HashMap(); param.put("uid", uid); param.put("userId", userId); param.put("userPw", userPw); param.put("userName", userName); param.put("userPhone", userPhone); param.put("userNickname", userNickname); return sqlSession.insert("member.insertMember", param); } public String selectUserPw(String userId) { Map param = new HashMap(); param.put("userId", userId); return sqlSession.selectOne("member.selectUserPw", param); } public String selectUID(String userId) { Map param = new HashMap(); param.put("userId", userId); return sqlSession.selectOne("member.selectUID", param); } }
[ "young1596" ]
young1596
12d9cc491c3a0159d9be1bf133e5c2352fefef3e
271b9ff8781aa860b62b12bb58db7e567065d059
/Homework/src/task7/Animals.java
48f5439df554684bbaeafbaf9d36650a9fc71eee
[]
no_license
SlavikTymchyshyn/HomeWorkJavaCore
dda9a536e2d288b328e96c1e47f8896b18915eff
ee855d85339a213f4158ce83ad3001dc8ac18716
refs/heads/master
2021-01-10T15:42:31.959316
2016-03-04T23:24:43
2016-03-04T23:24:43
53,170,178
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package task7; public class Animals { private String kind; public Animals(String kind) { this.kind = kind; } public String getKind() { return kind; } public void setKind(String kind) { this.kind = kind; } @Override public String toString() { return "Animals [kind=" + kind + "]"; } }
109969e536d8fde3816162a9f62d1b7e0443e481
5378b41ed9e0d1ec7f003a9bee9885a5797ae243
/consensus/ibftlegacy/src/test/java/org/hyperledger/besu/consensus/ibftlegacy/IbftLegacyContextBuilder.java
fecbb4e80abcecb6319a0f1452cafff648e645a6
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
NicolasMassart/besu
2f39eeb4a486e83f5ba8a2f0cf0d5186c22fa377
ebfe8a6d4cbd3f54ba3ddd88296a1a80d609e156
refs/heads/master
2021-06-18T20:56:05.673154
2021-05-20T12:44:27
2021-05-20T13:04:14
208,740,034
1
0
Apache-2.0
2019-09-16T07:44:03
2019-09-16T07:44:03
null
UTF-8
Java
false
false
1,891
java
/* * Copyright ConsenSys AG. * * 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. * * SPDX-License-Identifier: Apache-2.0 */ package org.hyperledger.besu.consensus.ibftlegacy; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.mockito.Mockito.withSettings; import org.hyperledger.besu.consensus.common.VoteProposer; import org.hyperledger.besu.consensus.common.VoteTally; import org.hyperledger.besu.consensus.common.VoteTallyCache; import org.hyperledger.besu.consensus.ibft.IbftLegacyContext; import org.hyperledger.besu.ethereum.core.Address; import java.util.Collection; public class IbftLegacyContextBuilder { public static IbftLegacyContext setupContextWithValidators(final Collection<Address> validators) { final IbftLegacyContext bftContext = mock(IbftLegacyContext.class, withSettings().lenient()); final VoteTallyCache mockCache = mock(VoteTallyCache.class, withSettings().lenient()); final VoteTally mockVoteTally = mock(VoteTally.class, withSettings().lenient()); when(bftContext.getVoteTallyCache()).thenReturn(mockCache); when(mockCache.getVoteTallyAfterBlock(any())).thenReturn(mockVoteTally); when(mockVoteTally.getValidators()).thenReturn(validators); when(bftContext.getVoteProposer()).thenReturn(new VoteProposer()); return bftContext; } }
71120845bba1f70384161b5dc7f058586c35db37
88edc9fdc7227b0b1718d929eb2ef652802d08f4
/curso-java-basico/src/com/poli/cursojava/aula35/Calculadora.java
7df8791a73a046d55b8b289f866550462ab04865
[]
no_license
PolixeniaCorreia/JavaBasico
36040ba2da94497780dc2fba4b58e6fb877f60f1
0314e1f2c53fa2f2e9678afa69a653121afaad98
refs/heads/master
2020-08-30T10:38:33.988853
2019-12-03T18:16:04
2019-12-03T18:16:04
218,344,931
0
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.poli.cursojava.aula35; public class Calculadora { public static int fatorialNaoRecursivo(int num) { if(num == 0) { return 1; } int total = 1; for(int i = num; i > 1; i--) { total *= i; } return total; } public static int fatorial(int num) { if(num == 0) { return 1; } return num * fatorial(num-1); } }
88079b33713b0e5cb02ea0a1d439e5b6f2eed6cb
f1979f8a612b763f009baa509f304c2a19ffe739
/level3/src/main/java/com/alxgrk/level3/Level3Application.java
39ca94248276d1659520d926ed02d4889b9c3898
[ "Apache-2.0" ]
permissive
alxgrk/bachelorarbeit
4c16e61722af04e9bf4d0114fc210febb4a47687
6f967d1a3d4746bd5bf710d74805b46093176f54
refs/heads/master
2021-08-09T00:17:50.037545
2017-11-09T10:22:14
2017-11-09T10:22:14
104,808,536
0
0
null
null
null
null
UTF-8
Java
false
false
6,342
java
package com.alxgrk.level3; import java.io.IOException; import java.time.LocalDateTime; import java.time.Month; import java.util.Arrays; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Profile; import org.springframework.data.domain.Example; import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters; import org.springframework.http.HttpStatus; import com.alxgrk.level3.error.exceptions.timeslot.NoAvailableTimeslotsException; import com.alxgrk.level3.error.exceptions.timeslot.TimeslotsNotAvailableException; import com.alxgrk.level3.error.exceptions.timeslot.TimeslotsToBookClashException; import com.alxgrk.level3.models.Account; import com.alxgrk.level3.models.Organization; import com.alxgrk.level3.models.Resource; import com.alxgrk.level3.models.Timeslot; import com.alxgrk.level3.repos.AccountRepository; import com.alxgrk.level3.repos.OrganizationRepository; import com.alxgrk.level3.repos.ResourceRepository; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import lombok.extern.slf4j.Slf4j; @EntityScan(basePackageClasses = { Level3Application.class, Jsr310JpaConverters.class }) @SpringBootApplication @Slf4j public class Level3Application { public static void main(String[] args) { SpringApplication.run(Level3Application.class, args); } // CORS @Bean FilterRegistrationBean corsFilter( @Value("${tagit.origin:http://localhost:9000}") String origin) { return new FilterRegistrationBean(new Filter() { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; String method = request.getMethod(); // this origin value could just as easily have come from a // database response.setHeader("Access-Control-Allow-Origin", origin); response.setHeader("Access-Control-Allow-Methods", "POST,GET,OPTIONS,DELETE"); response.setHeader("Access-Control-Max-Age", Long.toString(60 * 60)); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Headers", "Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization"); if ("OPTIONS".equals(method)) { response.setStatus(HttpStatus.OK.value()); } else { chain.doFilter(req, res); } } public void init(FilterConfig filterConfig) { } public void destroy() { } }); } @Profile("!test") @Bean @Transactional CommandLineRunner init(AccountRepository accountRepository, OrganizationRepository orgRepository, ResourceRepository resourceRepository) { Organization organization = new Organization().setName("Spring"); if (orgRepository.exists(Example.of(organization))) { Organization savedOrg = orgRepository.findOne(Example.of(organization)); organization.setId(savedOrg.getId()); } orgRepository.save(organization); return (evt) -> Arrays.asList("jhoeller,dsyer,pwebb,ogierke,rwinch,mfisher,mpollack,jlong" .split(",")).forEach(a -> { Account account = new Account(a, "password") .setSurname(String.valueOf(a.charAt(0))) .setName(a.substring(1)); account.setOrganization(organization); if (accountRepository.exists(Example.of(account))) { Account savedAccount = accountRepository.findOne(Example.of(account)); account.setId(savedAccount.getId()); } accountRepository.save(account); Timeslot availableTimeslot = new Timeslot(LocalDateTime.now(), LocalDateTime.of( 2200, Month.JANUARY, 1, 12, 0)); Timeslot bookedTimeslot = new Timeslot(LocalDateTime.of(2100, Month.JANUARY, 1, 12, 0), LocalDateTime.of(2101, Month.JANUARY, 1, 12, 0)); Resource resource = new Resource(); try { resource.setName("garage") .setAdministrators(Sets.newHashSet(account)) .setAvailableTimeslots(Lists.newArrayList(availableTimeslot)) .setBookedTimeslots(Lists.newArrayList(bookedTimeslot)); } catch (NoAvailableTimeslotsException | TimeslotsNotAvailableException | TimeslotsToBookClashException e) { log.error("Could not create resource " + resource + "; " + e); } if (resourceRepository.exists(Example.of(resource))) { Resource savedResource = resourceRepository.findOne(Example.of(resource)); resource.setId(savedResource.getId()); } resourceRepository.save(resource); account.setConnectedResources(Sets.newHashSet(resource)); accountRepository.save(account); }); } }
c9ccfe92d7a035450e7e1e95255db2c4e4425951
1ada05b799d63ec42ea48dab40a45e966127fb82
/src/main/java/com/ds/backup/AddNumber.java
c133fe7d30a5450cd715d7a642e9a591a2724b60
[]
no_license
AdityaGaurav/DataStructureAndAlgorithms
2985dca2c6bf4b286bb5fcbe82257f247e8f997c
ceac2e0cf975d8f1dba6db3d0a813ecdf3a8f13d
refs/heads/master
2020-03-19T08:41:52.536186
2018-06-16T18:48:28
2018-06-16T18:48:28
136,227,988
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package com.ds.backup; public class AddNumber { //static int sum; static int getSumOfNumber(int[]nums, int length){ if(length== 1){ return nums[0]; } else { int sum; sum = nums[length-1]; return sum+ getSumOfNumber(nums, length-1); } } public static void main(String[] args) { int[] n = {1,2,3,-4,-5}; int result = getSumOfNumber(n,5); System.out.println(result); } }
f562e54f0f0f955f0bf5feca45463d20c6a5bcfd
2880d1197800f71a494e51695584b3766880af88
/src/main/java/br/com/tecnotads/tecnotads/repository/ItemVendaRepository.java
4f2afe382ab7ca0ba54eff41d9d347e0af2c52e4
[]
no_license
vssouzaa/tecnotads
d50f878dcd65da29b181e597e0984df04d8b7bf9
0604356aa25a3f00ef444eceef2e37250ae195ab
refs/heads/master
2023-05-06T08:32:18.105491
2021-05-25T03:07:55
2021-05-25T03:07:55
369,952,168
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package br.com.tecnotads.tecnotads.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import br.com.tecnotads.tecnotads.domain.entity.ItemVenda; @Repository public interface ItemVendaRepository extends JpaRepository<ItemVenda, Integer> { List<ItemVenda> findByVendaId(Integer vendaId); }
a39897813020953ecc406f5b7421ea3806d5ad85
e47be12dc8c779fd2027859fab008c4df2aa29c4
/SpringBoot/src/main/java/com/capstone/springboot/domain/BaseTimeEntity.java
7ca95feb1a0bf00766060be6858d5e60692e875e
[]
no_license
EarlyHail/Capstone
95d4017ea32df7051eca7072bc603a7b2241dc00
ffa4af788548d2e1287b6f33b2794080f3839510
refs/heads/master
2022-11-05T17:47:46.097040
2020-06-19T11:08:57
2020-06-19T11:08:57
268,109,989
0
4
null
2020-06-19T10:54:12
2020-05-30T15:43:46
HTML
UTF-8
Java
false
false
607
java
package com.capstone.springboot.domain; import lombok.Getter; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import javax.persistence.EntityListeners; import javax.persistence.MappedSuperclass; import java.time.LocalDateTime; @Getter @MappedSuperclass @EntityListeners(AuditingEntityListener.class) public abstract class BaseTimeEntity { @CreatedDate private LocalDateTime createdDate; @LastModifiedDate private LocalDateTime modifiedDate; }
605df0a60e2a1c8f4b5d8f781a987bdbf281c261
d88f642234e8f803e0329e2dd4a2443fae559c66
/src/main/java/main_package/Creators/PushCreator.java
c355a31b9c24c0a722acc91c56a52ccb5ca45e23
[]
no_license
ElegantCone/Stack-Calculator
10c2f9e3fdc3acb96a58398452c1549a72efcd05
36aac31b6714091096c89e8c39898713f0e49172
refs/heads/master
2022-10-18T10:27:55.410271
2020-03-26T13:26:25
2020-03-26T13:26:25
248,432,545
0
0
null
2022-10-05T19:45:13
2020-03-19T06:57:56
Java
UTF-8
Java
false
false
167
java
package main_package.Creators; import main_package.Operations.Pusher; public class PushCreator extends Creator { public Pusher create(){ return new Pusher(); } }
7c1a7a73b0d0bfa191615299263cf9e9662c1894
811fb8f15de7d83643c099e389dfaca1f2bc4bf4
/OneToOneSharedPrimaryKey/src/main/java/com/totemtec/repository/VehicleRepository.java
bd1d64421ba2bf9e896ea0f8c4cd016b557663e4
[]
no_license
totemtec/Hibernate-JPA
c1e4a9e70d50a6995b2bc59d4716a117fad8f57a
f9aab5e3aec9388d16982a203abbb23f1c68d84f
refs/heads/master
2022-11-11T20:09:19.620401
2020-06-30T15:27:09
2020-06-30T15:27:09
275,317,315
1
0
null
null
null
null
UTF-8
Java
false
false
464
java
package com.totemtec.repository; import com.totemtec.entity.Vehicle; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface VehicleRepository extends JpaRepository<Vehicle, Long> { @Override @Query(value = "SELECT v FROM Vehicle v LEFT JOIN FETCH v.driver") List<Vehicle> findAll(); }
3656506dc711e95c28fd29b88cc34151e8ea75ca
5f4e7b18c82bca2f3f8ff944a5b0ef31aaf5248e
/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/util/PatternMatcher.java
cf126c64ee782d7e172656b5be0c5ac8b376fc75
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
shayaanmunshi/hapi-fhir
1e080ac18393f43cbe069229b674a34dd42a6535
be07ebc4ef73feb776192cc7ce91d95fde466d8d
refs/heads/master
2021-06-30T18:53:51.655542
2017-09-21T12:33:20
2017-09-21T12:33:20
201,999,525
1
0
Apache-2.0
2019-08-12T19:55:49
2019-08-12T19:55:49
null
UTF-8
Java
false
false
1,927
java
package ca.uhn.fhir.util; import java.util.regex.Pattern; import org.hamcrest.Factory; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeMatcher; /** * Tests if the argument is a {@link CharSequence} that matches a regular expression. */ public class PatternMatcher extends TypeSafeMatcher<CharSequence> { /** * Creates a matcher that matches if the examined {@link CharSequence} matches the specified regular expression. * <p/> * For example: * * <pre> * assertThat(&quot;myStringOfNote&quot;, pattern(&quot;[0-9]+&quot;)) * </pre> * * @param regex * the regular expression that the returned matcher will use to match any examined {@link CharSequence} */ @Factory public static Matcher<CharSequence> pattern(String regex) { return pattern(Pattern.compile(regex)); } /** * Creates a matcher that matches if the examined {@link CharSequence} matches the specified {@link Pattern}. * <p/> * For example: * * <pre> * assertThat(&quot;myStringOfNote&quot;, Pattern.compile(&quot;[0-9]+&quot;)) * </pre> * * @param pattern * the pattern that the returned matcher will use to match any examined {@link CharSequence} */ @Factory public static Matcher<CharSequence> pattern(Pattern pattern) { return new PatternMatcher(pattern); } private final Pattern pattern; public PatternMatcher(Pattern pattern) { this.pattern = pattern; } @Override public boolean matchesSafely(CharSequence item) { return pattern.matcher(item).find(); } @Override public void describeMismatchSafely(CharSequence item, org.hamcrest.Description mismatchDescription) { mismatchDescription.appendText("was \"").appendText(String.valueOf(item)).appendText("\""); } @Override public void describeTo(org.hamcrest.Description description) { description.appendText("a string with pattern \"").appendText(String.valueOf(pattern)).appendText("\""); } }
847a36e89ba08cfc0526a0a83b6cc689c96ce0b8
4e66aaadb1f778d424ff7c6dbad180337eabca64
/src/main/java/com/edu/poli/proyecto/model/Rol.java
a4f117db634e87c480a4d7ae8a1c009dc6bcc72a
[]
no_license
odrugees/Proyecto_Web
604ba14d2c4cacdbac5183b18c5e3b2e28f252b6
1bf5ddc075dea79015a68a67603de58e3ca111ee
refs/heads/master
2023-05-25T12:27:58.834892
2021-05-28T23:07:46
2021-05-28T23:07:46
359,237,273
0
0
null
2021-05-28T23:07:46
2021-04-18T19:41:34
Java
UTF-8
Java
false
false
1,162
java
package com.edu.poli.proyecto.model; import java.util.Set; import javax.persistence.*; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Table(name = "rol" ) public class Rol { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer rolId; private String rolNombre; private String rolDescripcion; @ManyToMany(mappedBy = "usuarioRoles") @JsonIgnore public Set<Usuario> usuario; public Rol() { } public Integer getRolId() { return rolId; } public void setRolId(Integer rolId) { this.rolId = rolId; } public String getRolNombre() { return rolNombre; } public void setRolNombre(String rolNombre) { this.rolNombre = rolNombre; } public String getRolDescripcion() { return rolDescripcion; } public void setRolDescripcion(String rolDescripcion) { this.rolDescripcion = rolDescripcion; } public Set<Usuario> getUsuario() { return usuario; } public void setUsuario(Set<Usuario> usuario) { this.usuario = usuario; } @Override public String toString() { return "Rol [rolId=" + rolId + ", rolNombre=" + rolNombre + ", rolDescripcion=" + rolDescripcion + "]"; } }
1732a93ddd659802d7d7ee1093c29fbc3dcc326f
b70ef58c78a3867089d627b4eafed99647048998
/Java/src/main/java/annees/annee2019/jour10/Asteroid.java
662c41e3ac48b7db70dd0518b1de7217a14f2a2c
[]
no_license
Landalvic/advent-of-code
310cf9ffa705535f9a9ee0573670710ac0da84d4
c6611c4dc5d72364da16923d2efcc23e306ef1cf
refs/heads/master
2021-12-31T20:25:16.909555
2021-12-19T15:11:55
2021-12-19T15:11:55
162,293,267
0
0
null
2021-12-01T17:58:36
2018-12-18T13:34:36
Java
UTF-8
Java
false
false
1,537
java
package annees.annee2019.jour10; import java.util.List; import java.util.stream.Collectors; import commun.Position; public class Asteroid { private Position position; private Integer vision; public Asteroid(Position position) { super(); this.position = position; vision = null; } public int calculerVision(List<Asteroid> asteroids) { if (vision == null) { vision = asteroids.stream().map(asteroid -> asteroid.angle(this)).collect(Collectors.toSet()).size(); } return vision; } public List<Asteroid> listeVision(List<Asteroid> asteroids) { return asteroids.stream().filter(asteroid -> asteroid != this && !asteroid.vuBloquee(asteroids, this)).collect(Collectors.toList()); } private boolean vuBloquee(List<Asteroid> asteroids, Asteroid centre) { return asteroids.stream().anyMatch(asteroid -> asteroid != this && asteroid != centre && angle(centre) == asteroid.angle(centre) && asteroid.getPosition().distance(centre.getPosition()) < position.distance(centre.getPosition())); } public double angle(Asteroid centre) { var angle = Math.atan2(-(position.getY() - centre.position.getY()), position.getX() - centre.position.getX()) * (180 / Math.PI); angle = (angle + 270) % 360; if (angle == 0) { angle = 360; } return angle; } public Position getPosition() { return position; } public void setPosition(Position position) { this.position = position; } public Integer getVision() { return vision; } public void setVision(Integer vision) { this.vision = vision; } }
d0dfda8fe0bbc9657ad0105989cc332d30a6624f
4055e5e3da26ba9955d91a381938a70bc5aafa4b
/Stationery/src/com/wabacus/system/dataset/update/precondition/AbsExpressionBean.java
4d27ca204d7b0803a97d614dda3316972cfc6921
[]
no_license
xiciliu/Stationery
b2eb55bc5246e774e242db465c7a10b8b64aa349
738159fffb30a84c82a25975d3acd6c66225d5b3
refs/heads/master
2021-12-13T01:22:07.531961
2017-03-09T13:18:07
2017-03-09T13:18:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,493
java
/* * Copyright (C) 2010---2014 星星(wuweixing)<[email protected]> * * This file is part of Wabacus * * Wabacus is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.wabacus.system.dataset.update.precondition; import java.util.Map; import com.wabacus.system.ReportRequest; import com.wabacus.system.component.application.report.configbean.editablereport.AbsEditableReportEditDataBean; import com.wabacus.util.Tools; public abstract class AbsExpressionBean { protected String objectId; public AbsExpressionBean() { objectId=Tools.generateObjectId(this.getClass()); } public abstract boolean isTrue(ReportRequest rrequest,Map<String,String> mRowData,Map<String,String> mParamValues); public static AbsExpressionBean parsePreCondition(String reportTypeKey,AbsEditableReportEditDataBean editBean,String precondition, String datasource) { if(Tools.isEmpty(precondition)) return null; precondition=Tools.replaceCharacterInQuote(precondition,'(',"$_LEFTBRACKET_$",true); precondition=Tools.replaceCharacterInQuote(precondition,')',"$_RIGHTBRACKET_$",true); precondition=Tools.replaceCharacterInQuote(precondition,'[',"$_LEFTBRACKET2_$",true); precondition=Tools.replaceCharacterInQuote(precondition,']',"$_RIGHTBRACKET2_$",true); precondition=Tools.replaceCharacterInQuote(precondition,'{',"$_LEFTBRACKET3_$",true); precondition=Tools.replaceCharacterInQuote(precondition,'}',"$_RIGHTBRACKET3_$",true); precondition=Tools.replaceCharacterInQuote(precondition,',',"$_COMMA_$",true); CompositeExpressionBeanForLoad compositeExpBean=new CompositeExpressionBeanForLoad(); compositeExpBean.parsePreConditionExpressionsStart(reportTypeKey,editBean,precondition,datasource); return compositeExpBean.parsePreConditionExpressionsEnd(); } }
f68725c0b2aef935b2fd7eabccf7886af6976706
c60e95993bc087c4373cd58b55d9ff9b81a58fea
/Cadastro.java
b6599d50ad8ddeecfd9b8b4ee92e2557c42e5fea
[]
no_license
leeedd/Exercicio51
5e06df1f17b4308a6bfe7bdf53315339f7ec4250
4902e0a89c71359a4f37fbc2a140d489d7d3e51e
refs/heads/master
2021-01-17T12:08:27.998263
2016-06-13T21:25:50
2016-06-13T21:25:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,476
java
import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JTextField; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JButton; import javax.swing.table.DefaultTableModel; public class Edwin { static JPanel painel = new JPanel(); static JFrame tela_inicial = new JFrame("Tela Inicial"); static JFrame tela_cadastro = new JFrame("Cadastro de Cliente"); static JFrame tela_consultar = new JFrame("Consulta de Cliente"); static JLabel nome = new JLabel("NOME: "); static JLabel rg = new JLabel("RG :"); static JLabel cpf = new JLabel("CPF :"); static JLabel nascimento = new JLabel("NASCIMENTO :"); static JLabel endereco = new JLabel("ENDEREÇO :"); static JLabel email = new JLabel("E-MAIL :"); static JLabel telefone_residencial = new JLabel("TELEFONE RESIDENCIAL:"); static JLabel telefone_celular = new JLabel("TELEFONE CELULAR:"); static JLabel telefone_comercial = new JLabel("TELEFONE COMERCIAL:"); static JLabel telefone_de_contato = new JLabel("TELEFONE DE CONTATO:"); static JLabel mensagem = new JLabel(); static JTextField c_nome = new JTextField(); static JTextField c_rg = new JTextField(); static JTextField c_cpf = new JTextField(); static JTextField c_nascimento = new JTextField(); static JTextField c_endereco = new JTextField(); static JTextField c_email = new JTextField(); static JTextField c_telefone_residencial = new JTextField(); static JTextField c_telefone_celular = new JTextField(); static JTextField c_telefone_comercial = new JTextField(); static JTextField c_telefone_de_contato = new JTextField(); static JButton cadastrar = new JButton("CADASTRAR"); static JButton atualizar = new JButton("ATUALIZAR"); static JButton gravar = new JButton("GRAVAR"); static JButton consultar = new JButton("CONSULTAR"); static JButton voltar = new JButton("VOLTAR"); static JButton voltar2 = new JButton("VOLTAR"); static JButton limpar = new JButton("LIMPAR"); static JButton sair1 = new JButton("SAIR"); static JTable tabela; static JScrollPane rolagem2 = new JScrollPane(tabela); static int n = 0; static int id_cliente = 0; static String[][] introduzir = new String[100][10]; static String[] tabela1 = new String[] { "Nome", "RG", "CPF", "NASC", "ENDEREÇO", "EMAIL", "RESIDENCIAL", "CELULAR", "TEL COMERCIAL", "TEL DE CONTATO" }; static DefaultTableModel tabela2 = new DefaultTableModel(tabela1, 0); static JMenuBar menu = new JMenuBar(); static JMenu menu1 = new JMenu("MENU"); static JMenuItem excluir = new JMenuItem("EXCLUIR"); static JMenuItem cadastrar1 = new JMenuItem("CADASTRAR"); static JMenuItem ajuda = new JMenuItem("AJUDA"); static JMenuItem sair = new JMenuItem("SAIR"); public static void main(String[] args) { Tela_Inicial(); botoes(); } static void Tela_Inicial() { tela_inicial.setTitle("Tela Inicial"); tela_inicial.setSize(1365, 700); tela_inicial.setLayout(null); tela_inicial.setVisible(true); tela_inicial.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tela_inicial.setResizable(false); tela_inicial.add(cadastrar).setBounds(300, 300, 300, 100); tela_inicial.add(sair1).setBounds(700, 300, 300, 100); tela_inicial.getContentPane().setBackground(Color.BLACK); cadastrar.setForeground(Color.BLACK); sair.setForeground(Color.BLACK); } static void Tela_Cadastro() { tela_cadastro.setTitle("Cadastro de Cliente"); tela_cadastro.setSize(1365, 700); tela_cadastro.setLayout(null); tela_cadastro.setVisible(true); tela_cadastro.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tela_cadastro.setResizable(false); tela_cadastro.add(nome).setBounds(10, 70, 50, 20); tela_cadastro.add(c_nome).setBounds(60, 60, 650, 30); nome.setForeground(Color.RED); tela_cadastro.add(rg).setBounds(25, 120, 50, 20); tela_cadastro.add(c_rg).setBounds(60, 110, 150, 30); rg.setForeground(Color.RED); tela_cadastro.add(cpf).setBounds(230, 120, 50, 20); tela_cadastro.add(c_cpf).setBounds(270, 110, 150, 30); cpf.setForeground(Color.RED); tela_cadastro.add(nascimento).setBounds(430, 120, 100, 20); tela_cadastro.add(c_nascimento).setBounds(530, 110, 180, 30); nascimento.setForeground(Color.RED); tela_cadastro.add(endereco).setBounds(10, 170, 100, 20); tela_cadastro.add(c_endereco).setBounds(90, 160, 620, 30); endereco.setForeground(Color.RED); tela_cadastro.add(email).setBounds(5, 220, 50, 20); tela_cadastro.add(c_email).setBounds(60, 210, 357, 30); email.setForeground(Color.RED); tela_cadastro.add(telefone_residencial).setBounds(10, 270, 200, 20); tela_cadastro.add(c_telefone_residencial).setBounds(160, 260, 150, 30); telefone_residencial.setForeground(Color.RED); tela_cadastro.add(telefone_celular).setBounds(30, 320, 200, 20); tela_cadastro.add(c_telefone_celular).setBounds(160, 310, 150, 30); telefone_comercial.setForeground(Color.RED); tela_cadastro.add(telefone_comercial).setBounds(15, 370, 200, 20); tela_cadastro.add(c_telefone_comercial).setBounds(160, 360, 150, 30); telefone_celular.setForeground(Color.RED); tela_cadastro.add(telefone_de_contato).setBounds(10, 420, 200, 20); tela_cadastro.add(c_telefone_de_contato).setBounds(160, 410, 150, 30); telefone_de_contato.setForeground(Color.RED); tela_cadastro.add(consultar).setBounds(1000, 100, 200, 60); tela_cadastro.add(atualizar).setBounds(1000, 250, 200, 60); tela_cadastro.add(gravar).setBounds(1000, 400, 200, 60); tela_cadastro.add(limpar).setBounds(1000, 500, 200, 60); tela_cadastro.add(voltar).setBounds(1000, 600, 200, 60); tela_cadastro.add(mensagem).setBounds(30, 600, 500, 60); tela_cadastro.getContentPane().setBackground(Color.black); } static void Gravar() { introduzir[n][0] = c_nome.getText(); introduzir[n][1] = c_rg.getText(); introduzir[n][2] = c_cpf.getText(); introduzir[n][3] = c_nascimento.getText(); introduzir[n][4] = c_endereco.getText(); introduzir[n][5] = c_email.getText(); introduzir[n][6] = c_telefone_residencial.getText(); introduzir[n][7] = c_telefone_celular.getText(); introduzir[n][8] = c_telefone_comercial.getText(); introduzir[n][9] = c_telefone_de_contato.getText(); n++; } static void exibirRegistros() { String[] dados = new String[10]; for (int n = 0; n < id_cliente; n++) { for (int e = 0; e < 10; e++) { dados[e] = introduzir[n][e]; } tabela2.addRow(dados); } } static void botoes() { cadastrar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tela_inicial.setVisible(false); Tela_Cadastro(); } }); cadastrar1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tela_consultar.setVisible(false); Tela_Cadastro(); } }); excluir.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((DefaultTableModel) tabela.getModel()).removeRow(tabela.getSelectedRow()); } }); gravar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (id_cliente < 100) { Gravar(); c_nome.setEnabled(false); c_rg.setEnabled(false); c_cpf.setEnabled(false); c_nascimento.setEnabled(false); c_endereco.setEnabled(false); c_email.setEnabled(false); c_telefone_residencial.setEnabled(false); c_telefone_celular.setEnabled(false); c_telefone_comercial.setEnabled(false); c_telefone_de_contato.setEnabled(false); JOptionPane.showMessageDialog(null, "DADOS GRAVADOS COM SUCESSO, PARA EFETUAR A CONSULTA, É NECESSARIO LIMPAR OS CAMPOS CLICANDO NO BOTÃO LIMPAR!!!"); } } }); ajuda.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "PARA EXCLUIR O CADASTRO, SELECIONE O REGISTRO, CLIQUE EM MENU, E NO BOTÃO EXCLUIR!!!"); } }); atualizar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { c_nome.setEnabled(true); c_rg.setEnabled(true); c_cpf.setEnabled(true); c_nascimento.setEnabled(true); c_endereco.setEnabled(true); c_email.setEnabled(true); c_telefone_residencial.setEnabled(true); c_telefone_celular.setEnabled(true); c_telefone_comercial.setEnabled(true); c_telefone_de_contato.setEnabled(true); } }); limpar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { id_cliente++; mensagem.setText("Numero de Registros:" + id_cliente); c_nome.setEnabled(true); c_rg.setEnabled(true); c_cpf.setEnabled(true); c_nascimento.setEnabled(true); c_endereco.setEnabled(true); c_email.setEnabled(true); c_telefone_residencial.setEnabled(true); c_telefone_celular.setEnabled(true); c_telefone_comercial.setEnabled(true); c_telefone_de_contato.setEnabled(true); c_nome.setText(""); c_rg.setText(""); c_cpf.setText(""); c_nascimento.setText(""); c_endereco.setText(""); c_email.setText(""); c_telefone_residencial.setText(""); c_telefone_celular.setText(""); c_telefone_comercial.setText(""); c_telefone_de_contato.setText(""); JOptionPane.showMessageDialog(null, "CAMPOS LIMPOS!!! "); } }); consultar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tela_consultar.setTitle("TELA DE CADASTRO DE CLIENTES"); tela_consultar.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tela_consultar.setSize(1400, 700); tela_consultar.setLayout(null); tela_consultar.getContentPane().setBackground(Color.white); tela_consultar.setResizable(false); tela_consultar.setVisible(true); tela_consultar.add(painel); painel.setSize(1340, 650); painel.setLocation(10, 10); painel.setLayout(null); painel.setBackground(Color.WHITE); tabela = new JTable() { @Override public boolean isCellEditable(int row, int column) { return false; } }; painel.add(tabela); painel.add(rolagem2); painel.add(menu); menu.setSize(45, 30); menu.setLocation(0, 0); menu.add(menu1); menu1.add(excluir); menu1.add(cadastrar1); menu1.add(ajuda); menu1.add(sair); tabela.setModel(tabela2); tabela.getColumnModel().getColumn(0).setPreferredWidth(200); tabela.getColumnModel().getColumn(1).setPreferredWidth(120); tabela.getColumnModel().getColumn(2).setPreferredWidth(130); tabela.getColumnModel().getColumn(3).setPreferredWidth(100); tabela.getColumnModel().getColumn(4).setPreferredWidth(300); tabela.getColumnModel().getColumn(5).setPreferredWidth(250); tabela.getColumnModel().getColumn(6).setPreferredWidth(150); tabela.getColumnModel().getColumn(7).setPreferredWidth(50); rolagem2.setBounds(0, 30, 1340, 700); rolagem2.setViewportView(tabela); exibirRegistros(); JOptionPane.showMessageDialog(null, "PARA EXCLUIR O CADASTRO, SELECIONE O REGISTRO, CLIQUE EM MENU, E NO BOTÃO EXCLUIR!!!"); } }); voltar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tela_cadastro.setVisible(false); Tela_Inicial(); } }); voltar2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tela_consultar.setVisible(false); Tela_Cadastro(); } }); sair.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); sair1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); } }
7e4e80517bd6f79767e2ac5102050a68e4482415
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE190_Integer_Overflow/s01/CWE190_Integer_Overflow__byte_console_readLine_multiply_15.java
7e9333aea59cc1f24e9d33001ccf7c52f756be0b
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
12,955
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__byte_console_readLine_multiply_15.java Label Definition File: CWE190_Integer_Overflow.label.xml Template File: sources-sinks-15.tmpl.java */ /* * @description * CWE: 190 Integer Overflow * BadSource: console_readLine Read data from the console using readLine * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: multiply * GoodSink: Ensure there will not be an overflow before multiplying data by 2 * BadSink : If data is positive, multiply by 2, which can cause an overflow * Flow Variant: 15 Control flow: switch(6) and switch(7) * * */ package testcases.CWE190_Integer_Overflow.s01; import testcasesupport.*; import javax.servlet.http.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.logging.Level; public class CWE190_Integer_Overflow__byte_console_readLine_multiply_15 extends AbstractTestCase { public void bad() throws Throwable { byte data; switch (6) { case 6: /* init data */ data = -1; /* POTENTIAL FLAW: Read data from console with readLine*/ BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { readerInputStream = new InputStreamReader(System.in, "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); String stringNumber = readerBuffered.readLine(); if (stringNumber != null) { data = Byte.parseByte(stringNumber.trim()); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } catch (NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Error with number parsing", exceptNumberFormat); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } finally { try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } } } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; break; } switch (7) { case 7: if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Byte.MAX_VALUE, this will overflow */ byte result = (byte)(data * 2); IO.writeLine("result: " + result); } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ IO.writeLine("Benign, fixed string"); break; } } /* goodG2B1() - use goodsource and badsink by changing the first switch to switch(5) */ private void goodG2B1() throws Throwable { byte data; switch (5) { case 6: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; break; default: /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; break; } switch (7) { case 7: if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Byte.MAX_VALUE, this will overflow */ byte result = (byte)(data * 2); IO.writeLine("result: " + result); } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ IO.writeLine("Benign, fixed string"); break; } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the first switch */ private void goodG2B2() throws Throwable { byte data; switch (6) { case 6: /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; break; } switch (7) { case 7: if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Byte.MAX_VALUE, this will overflow */ byte result = (byte)(data * 2); IO.writeLine("result: " + result); } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ IO.writeLine("Benign, fixed string"); break; } } /* goodB2G1() - use badsource and goodsink by changing the second switch to switch(8) */ private void goodB2G1() throws Throwable { byte data; switch (6) { case 6: /* init data */ data = -1; /* POTENTIAL FLAW: Read data from console with readLine*/ BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { readerInputStream = new InputStreamReader(System.in, "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); String stringNumber = readerBuffered.readLine(); if (stringNumber != null) { data = Byte.parseByte(stringNumber.trim()); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } catch (NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Error with number parsing", exceptNumberFormat); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } finally { try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } } } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; break; } switch (8) { case 7: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ IO.writeLine("Benign, fixed string"); break; default: if(data > 0) /* ensure we won't have an underflow */ { /* FIX: Add a check to prevent an overflow from occurring */ if (data < (Byte.MAX_VALUE/2)) { byte result = (byte)(data * 2); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to perform multiplication."); } } break; } } /* goodB2G2() - use badsource and goodsink by reversing the blocks in the second switch */ private void goodB2G2() throws Throwable { byte data; switch (6) { case 6: /* init data */ data = -1; /* POTENTIAL FLAW: Read data from console with readLine*/ BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { readerInputStream = new InputStreamReader(System.in, "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); String stringNumber = readerBuffered.readLine(); if (stringNumber != null) { data = Byte.parseByte(stringNumber.trim()); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } catch (NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Error with number parsing", exceptNumberFormat); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } finally { try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } } } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; break; } switch (7) { case 7: if(data > 0) /* ensure we won't have an underflow */ { /* FIX: Add a check to prevent an overflow from occurring */ if (data < (Byte.MAX_VALUE/2)) { byte result = (byte)(data * 2); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to perform multiplication."); } } break; default: /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ IO.writeLine("Benign, fixed string"); break; } } public void good() throws Throwable { goodG2B1(); goodG2B2(); goodB2G1(); goodB2G2(); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
f607111d02134691fb99bf2de0e358c717bd1903
1d20595d53e55b67af3ca25bb71112688118b56b
/src/main/java/com/sdau/student/StudentSpringboot2Application.java
cbbdc73ab49ec0e478e8d18a7b13b079ecd3e173
[]
no_license
klsfct/student-springboot3
a686af647465ca35c1c6f2eb95d86539b1b66272
049cfe95aa3ac849072ed9e8e878a87ce02ea5a4
refs/heads/master
2022-07-05T15:16:59.318571
2019-12-11T01:55:29
2019-12-11T01:55:29
227,013,243
4
0
null
2022-06-21T02:25:04
2019-12-10T02:38:37
JavaScript
UTF-8
Java
false
false
332
java
package com.sdau.student; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class StudentSpringboot2Application { public static void main(String[] args) { SpringApplication.run(StudentSpringboot2Application.class, args); } }
740d5d9918081e31abe63c5a1faa71a9ef070b65
73b5d7002c436f26dd8dcba8193d58a74bfc1f2e
/linkedList/DeleteDuplicates.java
d701e6671062756882f9be023b1f1b49072b3538
[]
no_license
wljyes/leetcode_programing
8baeefab46e08754d8384e4adbfdf054a805b2be
43d01dee1109c43be9b8e03bd65fda3493e411e4
refs/heads/master
2022-11-12T05:38:17.297268
2020-07-07T04:56:56
2020-07-07T04:56:56
277,423,471
0
0
null
null
null
null
UTF-8
Java
false
false
868
java
package linkedList; public class DeleteDuplicates { public ListNode deleteDuplicates(ListNode head) { //哑节点 ListNode dummy = new ListNode(0); dummy.next = head; ListNode first = dummy; ListNode second; while (first.next != null) { boolean flag = false; second = first.next; while (second.next != null) { if (second.next.val == first.next.val) { second.next = second.next.next; flag = true; } else { second = second.next; } } if (flag == true) { first.next = first.next.next; } else { first = first.next; } } return dummy.next; } }
d59af710c9e99dabef21204720bb167d609bdb11
c90a5dc2fe138efd9fab3e2fd5a515d830092573
/solution/Countdown.java
92ec7ac608ddbe0ff8123e13679453b6424d74ea
[]
no_license
bastienapp/dojo-countdown
88c1418cd57c9426d3360a269ef7e9e92a819b33
8fed38826fead1fafc0c0f4f801d1b4979193195
refs/heads/master
2022-08-06T03:04:28.671916
2018-11-06T11:04:17
2018-11-06T11:04:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
147
java
class Countdown { public static void countdown(int x) { System.out.println(x); if (x > 0) { countdown(x - 1); } } }
ca782e637b4385df5df9bbd13e2600fa6a8ca668
7582dfa1ed4778eae70e888273d8c3e79b9f15b7
/src/avg/ScoreAvg.java
e0a344114bd58e54e576365a875488ef083baad9
[]
no_license
lvraikkonen/hadoop_onhands
a74551bfcfc414ddc28ce6f8a80592efb733efd4
ee867d0fb36a4f4051ba95ee9eb3103d80e21e1e
refs/heads/master
2021-09-12T15:44:29.604256
2018-04-18T08:18:33
2018-04-18T08:18:33
104,719,302
0
0
null
null
null
null
UTF-8
Java
false
false
3,578
java
/** * Copyright (C), 2015-2018, XXX有限公司 * FileName: ScoreAvg * Author: lvshuo * Date: 03/04/2018 2:58 PM * Description: * History: * <author> <time> <version> <desc> * 作者姓名 修改时间 版本号 描述 */ package avg; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.DoubleWritable; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; import java.io.IOException; import java.util.Iterator; import java.util.StringTokenizer; /** * 〈一句话功能简述〉<br> * 〈〉 * * @author lvshuo * @create 03/04/2018 * @since 1.0.0 */ public class ScoreAvg { public static class AvgMapper extends Mapper<LongWritable, Text, Text, DoubleWritable>{ @Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); StringTokenizer itr = new StringTokenizer(line, "\n"); while (itr.hasMoreElements()){ StringTokenizer tokenizerLine = new StringTokenizer(itr.nextToken()); String strName = tokenizerLine.nextToken(); String strScore = tokenizerLine.nextToken(); Text name = new Text(strName); double score = Double.parseDouble(strScore); context.write(name, new DoubleWritable(score)); } } } public static class AvgReducer extends Reducer<Text, DoubleWritable, Text, DoubleWritable>{ @Override protected void reduce(Text key, Iterable<DoubleWritable> values, Context context) throws IOException, InterruptedException { int sum = 0; int count = 0; Iterator<DoubleWritable> iterator = values.iterator(); while (iterator.hasNext()){ sum += iterator.next().get(); count ++; } double avg_scrore = (double) sum / count; context.write(key, new DoubleWritable(avg_scrore)); } } public static void main(String[] args) throws Exception{ if (args.length != 2){ System.err.println("Input: Output <input path> <output path>"); System.exit(-1); } FileUtil.deleteDir("output"); Configuration conf = new Configuration(); Job job = new Job(conf, "find average score"); job.setJarByClass(ScoreAvg.class); job.setMapperClass(ScoreAvg.AvgMapper.class); job.setReducerClass(ScoreAvg.AvgReducer.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(DoubleWritable.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); boolean success = job.waitForCompletion(true); System.exit(job.waitForCompletion(true) ? 0 : 1); } }
1603b555eac7cfb683f1844dc8582c0dab14e202
9254e7279570ac8ef687c416a79bb472146e9b35
/imp-20210630/src/main/java/com/aliyun/imp20210630/models/CreateAppTemplateRequest.java
f4ae3d336437dcb21cd157fa16b28b3862a0bdaa
[ "Apache-2.0" ]
permissive
lquterqtd/alibabacloud-java-sdk
3eaa17276dd28004dae6f87e763e13eb90c30032
3e5dca8c36398469e10cdaaa34c314ae0bb640b4
refs/heads/master
2023-08-12T13:56:26.379027
2021-10-19T07:22:15
2021-10-19T07:22:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,777
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.imp20210630.models; import com.aliyun.tea.*; public class CreateAppTemplateRequest extends TeaModel { // 应用模板名称 @NameInMap("AppTemplateName") public String appTemplateName; // 应用模板场景,电商business,课堂classroom @NameInMap("Scene") public String scene; // 集成方式(一体化SDK:paasSDK,样板间:standardRoom) @NameInMap("IntegrationMode") public String integrationMode; // 组件列表 @NameInMap("ComponentList") public java.util.List<String> componentList; public static CreateAppTemplateRequest build(java.util.Map<String, ?> map) throws Exception { CreateAppTemplateRequest self = new CreateAppTemplateRequest(); return TeaModel.build(map, self); } public CreateAppTemplateRequest setAppTemplateName(String appTemplateName) { this.appTemplateName = appTemplateName; return this; } public String getAppTemplateName() { return this.appTemplateName; } public CreateAppTemplateRequest setScene(String scene) { this.scene = scene; return this; } public String getScene() { return this.scene; } public CreateAppTemplateRequest setIntegrationMode(String integrationMode) { this.integrationMode = integrationMode; return this; } public String getIntegrationMode() { return this.integrationMode; } public CreateAppTemplateRequest setComponentList(java.util.List<String> componentList) { this.componentList = componentList; return this; } public java.util.List<String> getComponentList() { return this.componentList; } }
13d19fbb4b63680129b3aad34f939ad0b9f413f2
bfd603ce9ba02ac3cf5add83da705046bc7660a8
/src/java/Controller/SauverImage.java
b91c58300f2f078dcf2862ff63a3f15f01ee319d
[]
no_license
JudeSeide/Affinite-java-servlet
a9d8ebfc3cc8531d52f424b522467379d1528e71
13ce4d222a8cf2f59403485fdda507f38391531f
refs/heads/master
2021-01-01T05:32:54.095128
2015-01-09T14:40:55
2015-01-09T14:40:55
29,019,967
0
0
null
null
null
null
UTF-8
Java
false
false
3,643
java
package Controller; import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; /** * @author Emmanuel FANGUE FANE31078301 * @author Justin Fotue KAMGA FOTJ23097901 * @author Jude SEIDE SEIJ04019006 */ public class SauverImage extends HttpServlet { private static final int TAIL_MEMOIRE = 1024 * 1024 * 2; private static final int TAIL_OBJET = 1024 * 1024 * 2; private String nomFichier; public SauverImage(HttpServletRequest request, String foto, String url) throws ServletException, IOException { this.nomFichier = EnregistrementImage(request, foto, url); } private String EnregistrementImage(HttpServletRequest request, String foto, String url) throws ServletException, IOException { // Check that we have a file upload request boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (!isMultipart) { return null; } String photo = null; // Create a factory for disk-based file list DiskFileItemFactory factory = new DiskFileItemFactory(); // Sets the size threshold beyond which files are written directly to // disk. factory.setSizeThreshold(TAIL_MEMOIRE); // Sets the directory used to temporarily store files that are larger // than the configured size threshold. We use temporary directory for // java factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); // constructs the folder where uploaded file will be stored //String url = getServletContext().getRealPath("") // + File.separator + DATA_DIRECTORY; // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // Set overall request size constraint upload.setSizeMax(TAIL_OBJET); try { // Parse the request List list = upload.parseRequest(request); Iterator iter = list.iterator(); while (iter.hasNext()) { FileItem champ = (FileItem) iter.next(); System.out.println("nom du champ : " + champ.getFieldName()); //System.out.println("nom du champ : "+champ.getFieldName()); if (champ.getFieldName().equals("file")) { String fileName = new File(champ.getName()).getName(); String filePath = url + File.separator + fileName; File uploadedFile = new File(filePath); champ.write(uploadedFile); photo = fileName; System.out.println("chemin : " + filePath); } } System.out.println("debut de l'ecriture : " + photo); } catch (FileUploadException ex) { throw new ServletException(ex); } catch (Exception ex) { throw new ServletException(ex); } return photo; } /** * @return the nomFichier */ public String getNomFichier() { return nomFichier; } /** * @param nomFichier the nomFichier to set */ public void setNomFichier(String nomFichier) { this.nomFichier = nomFichier; } }
8d2e26c2c561e9f4398482cc7d5c1a4af64e662c
6a76cb61b05423b4ae47b22f4b8663a8bf6ba0d7
/src/main/java/com/lwm/smarthome/entity/SysUser.java
2b173db49e4878521c2323e594242ce58a5425ba
[]
no_license
linweiming1/SmartHome
8e349ba9588640303819657c0dd92c73e407fdb3
d15565e99c1f92ca89160318618866cb6c377880
refs/heads/master
2021-04-15T04:29:57.435727
2018-06-02T15:22:27
2018-06-02T15:22:27
126,143,555
0
0
null
null
null
null
UTF-8
Java
false
false
3,604
java
package com.lwm.smarthome.entity; import javax.persistence.*; import java.io.Serializable; import java.util.Date; import java.util.HashSet; import java.util.Set; /* *用户实体类 * author:linweiming * */ @Entity @Table(name = "sys_user") public class SysUser implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "user_name", unique = true) private String userName; @Column(name = "pass_word") private String passWord; @Column(name = "login_time") private Date loginTime; @Column(name = "authorizer") private String authorizer; @Column(name = "auth_level") private String authLevel; @Column(name = "family_name") private String familyName; @Column(name = "create_time") private Date createTime; @Column(name = "email") private String email; @Column(name = "vcode") private String vcode; @Column(name = "isBinding") private String isBinding; @Column(name = "area") private String area; @ManyToMany(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER) @JoinTable(name = "user_role", joinColumns = { @JoinColumn(name = "user_id", referencedColumnName = "id")}, inverseJoinColumns = { @JoinColumn(name = "role_id", referencedColumnName = "roleId")}) private Set<Role> roles; @OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.REMOVE}, mappedBy = "sysUser") private Set<Rooms> rooms = new HashSet<>(); public Set<Rooms> getRooms() { return rooms; } public void setRooms(Set<Rooms> rooms) { this.rooms = rooms; } public String getIsBinding() { return isBinding; } public void setIsBinding(String isBinding) { this.isBinding = isBinding; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassWord() { return passWord; } public void setPassWord(String passWord) { this.passWord = passWord; } public Date getLoginTime() { return loginTime; } public void setLoginTime(Date loginTime) { this.loginTime = loginTime; } public String getAuthorizer() { return authorizer; } public void setAuthorizer(String authorizer) { this.authorizer = authorizer; } public String getAuthLevel() { return authLevel; } public void setAuthLevel(String authLevel) { this.authLevel = authLevel; } public String getFamilyName() { return familyName; } public void setFamilyName(String familyName) { this.familyName = familyName; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getVcode() { return vcode; } public void setVcode(String vcode) { this.vcode = vcode; } public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } public String getArea() { return area; } public void setArea(String area) { this.area = area; } }
c7fd9ea8b87eb49cb8dd68e0cdd2b0ec440cd182
6b5a685d228b299cfb25eb75d020de34ed161653
/backend/src/main/java/at/ac/tuwien/sepm/groupphase/backend/endpoint/mapper/InvoiceItemMapper.java
65c2ea41a90c3e95b3471c81fe7c8b807cbb15a2
[]
no_license
buenaflor/ShopCorner
2ae9ec4b17f0794428a072c94ebc3b608af0457b
89bf116347baa79d8667628bf347584c82c8f8f4
refs/heads/master
2023-06-06T14:42:13.233176
2021-07-01T09:16:24
2021-07-01T09:16:24
381,975,359
0
1
null
null
null
null
UTF-8
Java
false
false
784
java
package at.ac.tuwien.sepm.groupphase.backend.endpoint.mapper; import at.ac.tuwien.sepm.groupphase.backend.endpoint.dto.InvoiceItemDto; import at.ac.tuwien.sepm.groupphase.backend.entity.InvoiceItem; import org.mapstruct.IterableMapping; import org.mapstruct.Mapper; import org.mapstruct.Named; import java.util.Set; @Mapper public interface InvoiceItemMapper { @Named("toEntity") InvoiceItem dtoToEntity(InvoiceItemDto invoiceItemDto); @IterableMapping(qualifiedByName = "toEntity") Set<InvoiceItem> dtoToEntity(Set<InvoiceItemDto> invoiceItemDtoSet); @Named("entityToDto") InvoiceItemDto entityToDto(InvoiceItem invoiceItem); @IterableMapping(qualifiedByName = "entityToDto") Set<InvoiceItemDto> entityToDto(Set<InvoiceItem> invoiceItemSet); }
59317786a92a8daf1d9f5cc80333f521eba81e80
c6a2e6809860d7272f3ef9e3cf6e1523f280cdac
/ShareMarket/src/com/cg/service/ServiceStockImpl.java
f11d593963022a7b1cb48f9163bead6cd0f50401
[]
no_license
codingislife104/module-4
aa6bb00b4ea52aa6a502c1d07b569b8f7c5e56a8
59d12a8cd21e21e22279d3a428d482f6f210bd0d
refs/heads/master
2021-05-02T17:37:08.589196
2018-02-09T01:57:25
2018-02-09T01:57:25
120,389,897
0
0
null
null
null
null
UTF-8
Java
false
false
660
java
package com.cg.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.cg.bean.StockBean; import com.cg.dao.IStockDao; import com.cg.exception.ShareException; @Service public class ServiceStockImpl implements IServiceStock { @Autowired private IStockDao stockDao; @Override public List<StockBean> retrieveAllStocks() throws ShareException { return stockDao.retrieveAllStocks(); } @Override public StockBean displayStock(String stockName) throws ShareException { return stockDao.displayStock(stockName); } }
f97d6f9b3c6a1a776594b95de782f4c0b9693271
3ecacacce830a8ef29389a3b75f7ba779ccbdc58
/app/src/main/java/com/example/feedback/LoadingScreenActivity.java
a21ee9c93aee52505344f2f863254e6936b78427
[]
no_license
trmehta/Feedback3
2578fb35e5e089a2b5de5d1b71afda428c3d1875
fb128fa7f7a1f78fb4a2fd7a07f101edcb9a13ca
refs/heads/master
2021-01-20T21:52:53.902011
2015-02-06T08:13:57
2015-02-06T08:13:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,702
java
package com.example.feedback; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; public class LoadingScreenActivity extends Activity { public static String Page = "com.example.feedback.MainActivity"; //Introduce an delay private final int WAIT_TIME = 2500; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); System.out.println("LoadingScreenActivity screen started"); setContentView(R.layout.activity_splash); findViewById(R.id.mainSpinner1).setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable(){ @Override public void run() { //Simulating a long running task try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Going to Profile Data"); Class<?> c = null; try { c = Class.forName(Page); } catch (ClassNotFoundException e) { Log.d("Not Found: ", "sjdhgf"); //e.printStackTrace(); } /* Create an Intent that will start the ProfileData-Activity. */ Intent mainIntent = new Intent(LoadingScreenActivity.this,c); LoadingScreenActivity.this.startActivity(mainIntent); LoadingScreenActivity.this.finish(); } }, WAIT_TIME); } }
2245c32f76c8809ec2a1cb7ed94fcaccd3a99b2b
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/35/35_ab704fdc79e2413016e0c4de9f7e1e979c652727/ServiceLevelAgreements/35_ab704fdc79e2413016e0c4de9f7e1e979c652727_ServiceLevelAgreements_t.java
07197a4a15153614b21fffa45c833c2ec06d0083
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,039
java
/* * Copyright to 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.rioproject.sla; import org.rioproject.deploy.SystemRequirements; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * The {@code ServiceLevelAgreements} class provides context on the attributes required to * meet and monitor service level agreements for a service. Included in this * class are the {@link org.rioproject.deploy.SystemRequirements} that * must be met in order for the service to be provisioned, and * {@link org.rioproject.sla.SLA} declarations that will monitor service behavior * and be managed by provided service level agreement manager. * * @author Dennis Reedy */ public class ServiceLevelAgreements implements Serializable { @SuppressWarnings("unused") static final long serialVersionUID = 1L; /** System requirements */ private SystemRequirements systemRequirements; /** Array of service SLAs */ private final List<SLA> serviceSLAs = new ArrayList<SLA>(); public void setServiceRequirements(SystemRequirements systemRequirements) { this.systemRequirements = systemRequirements; } public synchronized SystemRequirements getSystemRequirements() { if(systemRequirements==null) systemRequirements = new SystemRequirements(); return systemRequirements; } /** * Add a service specified SLAs * * @param sla An SLA specifying service specific operational criteria */ public void addServiceSLA(SLA sla) { if(sla == null) throw new IllegalArgumentException("sla is null"); synchronized(serviceSLAs) { serviceSLAs.add(sla); } } /** * Get the service specified SLAs * * @return Array of service SLAs. A new array is allocated each time. If * there are no service SLAs, a zero-length array is returned */ public SLA[] getServiceSLAs() { SLA[] slas; synchronized(serviceSLAs) { slas = serviceSLAs.toArray(new SLA[serviceSLAs.size()]); } return (slas); } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("ServiceLevelAgreements: ").append(systemRequirements); builder.append(", serviceSLAs=").append(serviceSLAs); return builder.toString(); } }
8e3a77acee541edaa70c6cef2a57069f010a6010
25fcf3b3d515f569bdeafc38a5cfaa835fcec3fc
/src/main/java/eu/verdelhan/bitraac/indicators/TrueRange.java
952b0cf6863a7e86eeb91c3e10ae5db3adefe1ae
[ "MIT" ]
permissive
talkvip/Bitraac
8835a0ea6df063fb66d1856df589bae5ac90dc28
5fddc0dd19b37ebe4db3bf937f683f81177a9f6f
refs/heads/master
2020-06-02T04:33:53.617905
2013-12-06T12:12:00
2013-12-06T12:12:00
15,041,395
3
6
null
2017-10-19T14:37:07
2013-12-09T07:56:58
Java
UTF-8
Java
false
false
1,981
java
package eu.verdelhan.bitraac.indicators; import eu.verdelhan.bitraac.data.Period; import java.math.BigDecimal; import org.apache.commons.lang3.Validate; /** * True range indicator. */ public class TrueRange implements Indicator<Double> { private Period previousPeriod; private Period currentPeriod; /** * @param period the period for which we want the true range */ public TrueRange(Period period) { this(null, period); } /** * @param previousPeriod the previous period * @param currentPeriod the current period for which we want the true range */ public TrueRange(Period previousPeriod, Period currentPeriod) { Validate.notNull(currentPeriod, "Current period can't be null"); this.previousPeriod = previousPeriod; this.currentPeriod = currentPeriod; } /** * @return the true range for the current period */ @Override public Double execute() { // Current extrema prices BigDecimal currentHighPrice = currentPeriod.getHigh().getPrice().getAmount(); BigDecimal currentLowPrice = currentPeriod.getLow().getPrice().getAmount(); double trueRange; if (previousPeriod == null) { // No previous period trueRange = currentHighPrice.subtract(currentLowPrice).doubleValue(); } else { // Using the previous close price BigDecimal previousClosePrice = previousPeriod.getLast().getPrice().getAmount(); BigDecimal trueRangeMethod1 = currentHighPrice.subtract(currentLowPrice); BigDecimal trueRangeMethod2 = currentHighPrice.subtract(previousClosePrice).abs(); BigDecimal trueRangeMethod3 = currentLowPrice.subtract(previousClosePrice).abs(); trueRange = trueRangeMethod1.max(trueRangeMethod2).max(trueRangeMethod3).doubleValue(); } return trueRange; } }
0253fe394fab4ea6bfa82bb5862a329b36172739
a54afc897f883165410a7361a1ff41d25435775b
/src/main/java/com/fengdai/qa/meta/CallbackInfo.java
b4474eb09113fa319966c58d6e5a398a15932c98
[]
no_license
shichaowei/qacms
8fa607c307e5ed505c3297f222fe23954d135ab1
31b33937d8df92d94dbfe5f2d2d8eb65d8547094
refs/heads/master
2020-12-02T16:18:35.835852
2018-05-03T09:25:11
2018-05-03T09:25:11
96,530,080
2
1
null
null
null
null
UTF-8
Java
false
false
646
java
package com.fengdai.qa.meta; public class CallbackInfo { int id; String requestip; String callbackinfo; String createtime; public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getRequestip() { return requestip; } public void setRequestip(String requestip) { this.requestip = requestip; } public String getCallbackinfo() { return callbackinfo; } public void setCallbackinfo(String callbackinfo) { this.callbackinfo = callbackinfo; } }
75339880f899c50623189e005c36aff43089c5f2
83dd6f92c880f51357a5a557437460f8b90dd847
/framework/src/main/java/com/example/framework/backend/service/IPushService.java
003c1b1d1c673920368b857c493774ea4190be37
[]
no_license
seasunny1229/Meet
462eeb8ebbb6ba72d11b73fd04479bf44ddf8229
0b239fbcf3faea88570d6a1e98bf67d900f4a6cb
refs/heads/master
2021-04-01T20:42:33.535298
2020-04-22T23:49:05
2020-04-22T23:49:05
248,214,118
3
0
null
null
null
null
UTF-8
Java
false
false
507
java
package com.example.framework.backend.service; import com.example.framework.backend.callback.BackendServiceCallback; import com.example.framework.backend.pushing.bean.PushInfo; import com.example.framework.backend.pushing.constant.PushType; import java.util.List; public interface IPushService { void push(PushType type, String text, String mediaUrl, BackendServiceCallback<Void> backendServiceCallback); void fetchPushedData(BackendServiceCallback<List<PushInfo>> backendServiceCallback); }
844ef9ddac63fbdb5d8811afafcf49e095d8a455
6b3f9501a1939677f8f47d8f640f3aef4da46f5b
/17/17_3/Server.java~
15b11bf905e7ba94fa367ae014f05da9d57076b6
[ "Apache-2.0" ]
permissive
giszhangke/CrazyJava
98e9170fd48aaf5d8ade69b0898339666e6f45de
f49a8062883d0962713ed8ce2de970ff9ba33b24
refs/heads/master
2021-01-22T05:54:30.135807
2017-06-17T17:28:32
2017-06-17T17:28:32
81,720,570
0
1
null
null
null
null
UTF-8
Java
false
false
523
import java.io.IOException; import java.io.PrintStream; import java.net.ServerSocket; import java.net.Socket; public class Server { public static void main(String[] args) throws IOException { ServerSocket ss = new ServerSocket(3000); System.out.println("===========服务器已经启动==========="); while (true) { Socket s = ss.accept(); PrintStream ps = new PrintStream(s.getOutputStream()); ps.println("您好!您收到了来自服务器的儿童节祝福!"); ps.close(); s.close(); } } }
b9b745948f5c8a066d99fbda4ac56e8166f5b3bd
7faa8436f14704a0b9c7d5ab119c7d717d25d0b1
/stratinit-master/stratinit-client-master/stratinit-client/src/main/java/com/kenstevens/stratinit/client/shell/TabControl.java
8971be6f8188b3d5d358b6013f6c928451b7c96f
[]
no_license
fil512/stratinit
262ed97236c39c261184685040d4da87e8ad683d
60e804dbd0359cecd914015b4aff45be0d458e9f
refs/heads/master
2022-12-23T05:46:53.076552
2021-06-05T15:05:44
2021-06-05T15:05:44
54,049,345
0
0
null
2022-12-16T05:10:20
2016-03-16T16:40:45
Java
UTF-8
Java
false
false
259
java
package com.kenstevens.stratinit.client.shell; public interface TabControl { boolean battleTabSelected(); void switchToSectorTab(); boolean playerTabSelected(); boolean cityTabSelected(); boolean supplyTabSelected(); boolean unitTabSelected(); }
51e3a9394c9b014aa02fe4085c989d02ac9cd640
43e51f51377f0cb2603f04db15132df437420eb3
/src/main/java/com/example/service/StudentService.java
3b0781202e4ff336eb64c15d3b30853e57024418
[]
no_license
apap-2017/tutorial6_1506757522
7212ca382f6ad965fc80ba6367fb7d619487cbfc
4a590547f1a03c8087e010f5d3bd1bcefc52bdb2
refs/heads/master
2021-07-17T19:52:57.195914
2017-10-19T14:36:47
2017-10-19T14:36:47
107,558,256
0
0
null
null
null
null
UTF-8
Java
false
false
440
java
package com.example.service; import java.util.List; import com.example.model.CourseModel; import com.example.model.StudentModel; public interface StudentService { StudentModel selectStudent (String npm); List<StudentModel> selectAllStudents (); void addStudent (StudentModel student); void updateStudent (StudentModel student); void deleteStudent (String npm); CourseModel selectCourse(String id_course); }
c6bf197c588e9a66a810e52f205b01b31d6249a1
af1ea57c3aa878b94dd2eb82371c5cc91b0fb266
/puzzleApp/app/src/main/java/com/example/eelco/puzzleApp/Tile.java
b2cee59719f0026bf844cf2af2c7af75b0630cd2
[]
no_license
Urgah/College
986d9ec7630090c01cbe542d9b3e40a41401fed6
8c2cb0ba41fc845482aaec4f20c6958e96d7a05c
refs/heads/master
2020-04-07T09:23:20.296180
2016-12-09T15:21:50
2016-12-09T15:21:50
41,091,038
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package com.example.eelco.puzzleApp; import android.graphics.Bitmap; /** * Created by Eelco on 23/03/15. */ public class Tile { int Position; Bitmap Image; public Tile(int position, Bitmap chunkedImage) { this.Position = position; this.Image = chunkedImage; } }
fff30063915205bde4fa75bb3d2f8332d4a0ee3c
3158f6eb9ed3ef4a40049b3543ea6ccb082d78a9
/src/main/java/pages/SearchResultsPage.java
786db0976e0de5b6def4fae63f6b20d9a03ba5f7
[]
no_license
DiGrinya/PageFactory
55ac69abcc3248ed2abdcb8f9a27ed1b351fb8a6
cbc7bf230985bea214a57e470258111ed028aeb8
refs/heads/master
2023-05-03T03:10:18.422972
2021-05-31T10:16:07
2021-05-31T10:16:07
372,464,793
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import static org.openqa.selenium.By.xpath; public class SearchResultsPage extends BasePage { @FindBy(xpath = "//a[contains(@href, 'band-6-yellow-item')]") private WebElement searchResultsProductInQuestion; @FindBy(xpath = "//div[contains(@data-ecomm, 'Band 6 Yellow')]//..//a[contains(@href,'availableProductNotification')]") private WebElement modelInQuestion; public SearchResultsPage(WebDriver driver) { super(driver); } public void selectTheModel() { searchResultsProductInQuestion.click(); } public String checkIfmodelIsAvailable() { return modelInQuestion.getAttribute("href"); } }
2d3247d01b83f30a70944324f6e47612447d095b
df8b70ac914d9ce0c3ab3dcb7a3fdfe26e8e68a7
/src/main/java/Application.java
2d3271c714da21eb53020485e9069fe4f72792a1
[]
no_license
Roylb/Second_study
15b1ad315d52811bf416d7e7cb5f2e71f010c6b0
5b42728a1f0eea520f8c79075eb91ed243d3fd91
refs/heads/master
2021-01-22T05:47:39.865930
2017-02-26T09:21:03
2017-02-26T09:21:03
81,708,864
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.web.bind.annotation.*; @RestController @EnableAutoConfiguration public class Application { @RequestMapping(path = "/test", method = RequestMethod.POST) public String test(@RequestBody Object o) { return "hello"; } public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
5942f194ea37d873f1730d013c4d25ea4d0cf529
e4366b6d81eeec54bc2a9955c32a7af29091daee
/valinor-shopcart/valinor-shopcart-provider/src/test/java/org/valinor/merchant/provider/DemoProvider.java
54bb5778a4e42f2a16ea7a03b3adcde13e4e5a47
[]
no_license
175272511/valinor-parent
da17d354487cec46b717f4435329bb706ae49fc1
185246d5600509cbfb75d32853a4ce8d76a5835a
refs/heads/master
2016-09-01T16:18:34.052980
2016-03-23T08:02:33
2016-03-23T08:02:33
54,541,171
0
1
null
null
null
null
UTF-8
Java
false
false
1,091
java
/* * Copyright 1999-2011 Alibaba Group. * * 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.valinor.merchant.provider; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class DemoProvider { public static void main(String[] args) { // com.alibaba.dubbo.container.Main.main(args); ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml"); System.out.println("Service started....."); while (true) { // running } } }
9b30ac592f3f2db13cede175b8ac3080f6b1ea7d
3a185b4af880f8a27eac75ad677257c7d4f65fb9
/src/main/java/ru/ntr/villagemarket/model/mapper/OrderHistoryMapper.java
cd275d5627b35af45b8d4e7671230c9411e53011
[]
no_license
morrislchg/villagemarket
060edd1fafcf7f40d2f063eb1d7eb2a9244f5bbe
004d90f5bd8d3fd921d49c9ccadecd4cd240721c
refs/heads/main
2023-07-16T00:13:18.537097
2021-08-25T06:15:30
2021-08-27T14:35:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,130
java
package ru.ntr.villagemarket.model.mapper; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import ru.ntr.villagemarket.model.dto.order.OrderHistoryItemDto; import ru.ntr.villagemarket.model.entity.OrderHistoryItem; import ru.ntr.villagemarket.model.repository.OrderRepository; import ru.ntr.villagemarket.model.repository.OrderStatusRepository; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @Component @RequiredArgsConstructor public class OrderHistoryMapper { private final OrderStatusRepository orderStatusRepository; private final OrderRepository orderRepository; public OrderHistoryItem toOrderHistoryItem(OrderHistoryItemDto orderHistoryItemDto) { return OrderHistoryItem.builder() .id(orderHistoryItemDto.getId()) .order(orderRepository.getById(orderHistoryItemDto.getOrderId())) .orderStatus(orderStatusRepository.findByStatus(orderHistoryItemDto.getStatus())) .date(orderHistoryItemDto.getDate()) .build(); } public OrderHistoryItemDto fromOrderHistoryItem(OrderHistoryItem orderHistoryItem) { return OrderHistoryItemDto.builder() .id(orderHistoryItem.getId()) .orderId(orderHistoryItem.getOrder().getId()) .status(orderHistoryItem.getOrderStatus().getStatus()) .date(orderHistoryItem.getDate()) .build(); } public List<OrderHistoryItem> toOrderHistory(List<OrderHistoryItemDto> orderHistoryItemDtoList) { return orderHistoryItemDtoList.stream() .map(this::toOrderHistoryItem) .sorted(Comparator.comparing(OrderHistoryItem::getId)) .collect(Collectors.toList()); } public List<OrderHistoryItemDto> fromOrderHistory(List<OrderHistoryItem> orderList) { return orderList.stream() .map(this::fromOrderHistoryItem) .sorted(Comparator.comparing(OrderHistoryItemDto::getId)) .collect(Collectors.toList()); } }
b32a2f12d512ae99bf0eea3085a9c9d81276f4df
485b4fb9cbf33082a51eb198e85aee92098a0d49
/src/main/java/com/molokotech/config/SecurityConfig.java
ea3db8b3b902d3a57df1c93fe4e12dc5fef89807
[]
no_license
berlot83/qr-factory
8f729e987fbd8b8fe435952fe312dae12f1bd4ae
174145f004adaaa69512be536d051e21a889f03a
refs/heads/master
2020-05-04T13:46:49.696265
2019-04-04T17:29:21
2019-04-04T17:29:21
179,172,948
0
0
null
null
null
null
UTF-8
Java
false
false
2,304
java
package com.molokotech.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { /* * Axel Berlot 2018 Saltea archivos varios de recursos */ // @Autowired // private UserDetailsService userDetailsService; @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/resources/**"); web.ignoring().antMatchers("/css/**"); web.ignoring().antMatchers("/img/**"); web.ignoring().antMatchers("/js/**"); } // @Bean // public UserDetailsService mongoUserDetails() { // return new CustomUserDetailsService(); // } // @Override // protected void configure(AuthenticationManagerBuilder auth) throws Exception { // auth.authenticationProvider(authProvider()); // } // @Bean // public DaoAuthenticationProvider authProvider() { // DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider(); // authProvider.setUserDetailsService(userDetailsService); // authProvider.setPasswordEncoder(passwordEncoder()); // return authProvider; // } @Override protected void configure(HttpSecurity http) throws Exception { /* Filtra quien ingresa y dónde, falta aplicar roles */ http .csrf().disable() .httpBasic() .and() .authorizeRequests() .antMatchers("/").permitAll() .antMatchers("/index").permitAll() .antMatchers("/login").permitAll() .antMatchers("/sign-up").permitAll() .antMatchers("/bulk-factory","/qr-factory").authenticated() .and() .formLogin().loginPage("/login") .and() .exceptionHandling().accessDeniedPage("/error"); } // @Bean // public PasswordEncoder passwordEncoder() { // return new BCryptPasswordEncoder(); // } }
e4e9f085d5ea2b5d2c79876307d70a4e43db5f7d
c1e4ba225e9b87480f7a73734770929fcb764738
/src/main/java/br/com/ctrlabs/apirestgrandle/config/SwaggerConfig.java
f445cca24db87ea9f980bece8c412f7a45bbe4e8
[]
no_license
alessdr/api-rest-java-grandle
3eb487efb2e2a1ade357ea211a2803d6078c0608
297c0afccd640fcdb08bb64950de59fa6f858a27
refs/heads/master
2022-12-04T05:51:17.427918
2020-08-23T13:27:02
2020-08-23T13:27:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,564
java
package br.com.ctrlabs.apirestgrandle.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.service.VendorExtension; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; import static springfox.documentation.builders.PathSelectors.regex; import java.util.ArrayList; @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket productApi() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage("br.com.ctrlabs.apirest")) .paths(regex("/api.*")) .build() .apiInfo(metaInfo()); } private ApiInfo metaInfo() { @SuppressWarnings("rawtypes") ApiInfo apiInfo = new ApiInfo( "Produtos API REST", "API REST de cadastro de produtos.", "1.0", "Terms of Service", new Contact("Alessandro Rocha", "http://ctrlabs.com.br", "[email protected]"), "Apache License Version 2.0", "https://www.apache.org/licesen.html", new ArrayList<VendorExtension>() ); return apiInfo; } }