blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
f1284371fdd1022bbf8935a637d10b00d040cee7
4c19b724f95682ed21a82ab09b05556b5beea63c
/XMSYGame/java2/server/web-manager/src/main/java/com/xmsy/server/zxyy/manager/modules/manager/sysconfig/entity/SysConfigPayParam.java
cf05f8fe4632ed3a63ea60938d0e50785ae32a24
[]
no_license
angel-like/angel
a66f8fda992fba01b81c128dd52b97c67f1ef027
3f7d79a61dc44a9c4547a60ab8648bc390c0f01e
refs/heads/master
2023-03-11T03:14:49.059036
2022-11-17T11:35:37
2022-11-17T11:35:37
222,582,930
3
5
null
2023-02-22T05:29:45
2019-11-19T01:41:25
JavaScript
UTF-8
Java
false
false
1,055
java
package com.xmsy.server.zxyy.manager.modules.manager.sysconfig.entity; import lombok.Data; /** * 支付服务SysConfig配置信息类 * @author Administrator * */ @Data public class SysConfigPayParam { private String name;//支付公司名称 private String aliasName;//支付渠道别名 private String alipay;//6个产品编码字段 private String weixin; private String unionpay; private String quickpay; private String qqpay; private String jindongpay; private String uid;//4个秘钥 private String secret; private String publicKey; private String privateKey; private String callbackUrl;//回调地址 private String payUrl;//支付地址 private Long alipayId;//6个产品编码字段Id private Long weixinId; private Long unionpayId; private Long quickpayId; private Long qqpayId; private Long jindongpayId; private Long uidId;//4个秘钥Id private Long secretId; private Long publicKeyId; private Long privateKeyId; private Long callbackUrlId;//回调地址Id private Long payUrlId;//支付地址Id }
07b0fb0449a80cbe75e78d4919acab6cee59b28f
1c6fe1c9ad917dc9dacaf03eade82d773ccf3c8a
/acm-module-sys/src/main/java/com/wisdom/acm/sys/po/SysI18nPo.java
4369fdc186b0de45a97cd14f7405e1ed01623596
[ "Apache-2.0" ]
permissive
daiqingsong2021/ord_project
332056532ee0d3f7232a79a22e051744e777dc47
a8167cee2fbdc79ea8457d706ec1ccd008f2ceca
refs/heads/master
2023-09-04T12:11:51.519578
2021-10-28T01:58:43
2021-10-28T01:58:43
406,659,566
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package com.wisdom.acm.sys.po; import com.wisdom.base.common.po.BasePo; import lombok.Data; import javax.persistence.Column; import javax.persistence.Table; @Table(name = "wsd_sys_i18n") @Data public class SysI18nPo extends BasePo { //所属模块 @Column(name = "menu_id") private Integer menuId; //简码 @Column(name = "short_code") private String shortCode; //代码 @Column(name = "code") private String code; }
a5408d04f79dfb0e7e4aa0635d6464d43686a980
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/RxJava/2016/12/ConnectableObservable.java
2702a440c7178daaa78a56a6517b0f47eb732db9
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
5,877
java
/** * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See * the License for the specific language governing permissions and limitations under the License. */ package io.reactivex.observables; import org.reactivestreams.Subscriber; import io.reactivex.*; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Consumer; import io.reactivex.internal.functions.Functions; import io.reactivex.internal.operators.observable.*; import io.reactivex.internal.util.ConnectConsumer; import io.reactivex.plugins.RxJavaPlugins; /** * A {@code ConnectableObservable} resembles an ordinary {@link Flowable}, except that it does not begin * emitting items when it is subscribed to, but only when its {@link #connect} method is called. In this way you * can wait for all intended {@link Subscriber}s to {@link Flowable#subscribe} to the {@code Observable} * before the {@code Observable} begins emitting items. * <p> * <img width="640" height="510" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/publishConnect.png" alt=""> * * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Connectable-Observable-Operators">RxJava Wiki: * Connectable Observable Operators</a> * @param <T> * the type of items emitted by the {@code ConnectableObservable} */ public abstract class ConnectableObservable<T> extends Observable<T> { /** * Instructs the {@code ConnectableObservable} to begin emitting the items from its underlying * {@link Flowable} to its {@link Subscriber}s. * * @param connection * the action that receives the connection subscription before the subscription to source happens * allowing the caller to synchronously disconnect a synchronous source * @see <a href="http://reactivex.io/documentation/operators/connect.html">ReactiveX documentation: Connect</a> */ public abstract void connect(Consumer<? super Disposable> connection); /** * Instructs the {@code ConnectableObservable} to begin emitting the items from its underlying * {@link Flowable} to its {@link Subscriber}s. * <p> * To disconnect from a synchronous source, use the {@link #connect(Consumer)} method. * * @return the subscription representing the connection * @see <a href="http://reactivex.io/documentation/operators/connect.html">ReactiveX documentation: Connect</a> */ public final Disposable connect() { ConnectConsumer cc = new ConnectConsumer(); connect(cc); return cc.disposable; } /** * Returns an {@code Observable} that stays connected to this {@code ConnectableObservable} as long as there * is at least one subscription to this {@code ConnectableObservable}. * * @return a {@link Flowable} * @see <a href="http://reactivex.io/documentation/operators/refcount.html">ReactiveX documentation: RefCount</a> */ public Observable<T> refCount() { return RxJavaPlugins.onAssembly(new ObservableRefCount<T>(this)); } /** * Returns an Observable that automatically connects to this ConnectableObservable * when the first Subscriber subscribes. * * @return an Observable that automatically connects to this ConnectableObservable * when the first Subscriber subscribes */ public Observable<T> autoConnect() { return autoConnect(1); } /** * Returns an Observable that automatically connects to this ConnectableObservable * when the specified number of Subscribers subscribe to it. * * @param numberOfSubscribers the number of subscribers to await before calling connect * on the ConnectableObservable. A non-positive value indicates * an immediate connection. * @return an Observable that automatically connects to this ConnectableObservable * when the specified number of Subscribers subscribe to it */ public Observable<T> autoConnect(int numberOfSubscribers) { return autoConnect(numberOfSubscribers, Functions.emptyConsumer()); } /** * Returns an Observable that automatically connects to this ConnectableObservable * when the specified number of Subscribers subscribe to it and calls the * specified callback with the Subscription associated with the established connection. * * @param numberOfSubscribers the number of subscribers to await before calling connect * on the ConnectableObservable. A non-positive value indicates * an immediate connection. * @param connection the callback Action1 that will receive the Subscription representing the * established connection * @return an Observable that automatically connects to this ConnectableObservable * when the specified number of Subscribers subscribe to it and calls the * specified callback with the Subscription associated with the established connection */ public Observable<T> autoConnect(int numberOfSubscribers, Consumer<? super Disposable> connection) { if (numberOfSubscribers <= 0) { this.connect(connection); return RxJavaPlugins.onAssembly(this); } return RxJavaPlugins.onAssembly(new ObservableAutoConnect<T>(this, numberOfSubscribers, connection)); } }
532a22af10f8560ccf62f4321d51f9524307d445
59f6f77ecf0ccfa6eefdabfd98d85d9e98aa396e
/src/main/java/com/atlp/jzfp/common/base/BaseRepository.java
ad3f76de0b58f7400c1bd1b2b0327c5a83196895
[]
no_license
caotch/jzfp
9b05f8d2a5a8c3b20b04e1999990ebd5e6032feb
41cdfa401ac3fad4980bd69782158c12742ba145
refs/heads/master
2020-03-31T04:36:41.479408
2018-10-07T06:38:10
2018-10-07T06:38:10
151,913,236
0
0
null
null
null
null
UTF-8
Java
false
false
1,109
java
package com.atlp.jzfp.common.base; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.NoRepositoryBean; import org.springframework.data.repository.PagingAndSortingRepository; import java.io.Serializable; import java.util.List; import java.util.Map; /** * repository 基类,封装自定义查询方法 * * @author 曹铁诚 * @date 2018年9月22日 20:50:43 */ @NoRepositoryBean //该注解表示 spring 容器不会创建该对象 public interface BaseRepository<T, ID extends Serializable> extends PagingAndSortingRepository<T, ID>, JpaRepository<T, ID> { /** * sql查询 * * @param sql * @param args * @return */ List<Map> findAllByParams(String sql, Object... args); /** * sql分页查询 * * @param sql * @param args * @return */ Page<Map> findPageByParams(String sql, Pageable pageable, Object... args); Page<Map> findPageBySql(String sql, Pageable pageable); }
50527456b85f59a2845f947d0c2b12fc151dea3a
ff75a5f0c0919cc543cc25c9ac76e5f2ca3d9626
/BFGApp/src/jtattoo/plaf/BaseTitleButton.java
63e6dcc46d8569942ec6599eea0f201fb246a348
[]
no_license
farajfarook/bruteforcegrid
47a6590bc76bb0edd43367363ecd5c4ac1100314
e52787f7be6f1c6d35541d298a52f61cd32ce61f
refs/heads/master
2016-08-06T09:26:56.938917
2015-03-21T16:03:05
2015-03-21T16:03:05
32,634,235
1
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
/* * Copyright 2005 MH-Software-Entwicklung. All rights reserved. * Use is subject to license terms. */ package jtattoo.plaf; import java.awt.AlphaComposite; import java.awt.Composite; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.*; /** * @author Michael Hagen */ public class BaseTitleButton extends NoFocusButton { private float alpha = 1.0f; public BaseTitleButton(Action action, String accessibleName, Icon icon, float alpha) { setContentAreaFilled(false); setBorderPainted(false); setAction(action); setText(null); setIcon(icon); putClientProperty("paintActive", Boolean.TRUE); getAccessibleContext().setAccessibleName(accessibleName); this.alpha = Math.max(0.2f, alpha); } public void paint(Graphics g) { if (JTattooUtilities.isActive(this) || (alpha >= 1.0)) { super.paint(g); } else { Graphics2D g2D = (Graphics2D) g; Composite composite = g2D.getComposite(); AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); g2D.setComposite(alphaComposite); super.paint(g); g2D.setComposite(composite); } } }
c119a1790e983e65013fe63592ceeaf62d1112f4
eb5f5353f49ee558e497e5caded1f60f32f536b5
/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java
61d3d2b718fd509d5ddc1a1397a188637923d06c
[]
no_license
mohitrajvardhan17/java1.8.0_151
6fc53e15354d88b53bd248c260c954807d612118
6eeab0c0fd20be34db653f4778f8828068c50c92
refs/heads/master
2020-03-18T09:44:14.769133
2018-05-23T14:28:24
2018-05-23T14:28:24
134,578,186
0
2
null
null
null
null
UTF-8
Java
false
false
751
java
package sun.reflect.generics.reflectiveObjects; import sun.reflect.generics.factory.GenericsFactory; import sun.reflect.generics.visitor.Reifier; public abstract class LazyReflectiveObjectGenerator { private final GenericsFactory factory; protected LazyReflectiveObjectGenerator(GenericsFactory paramGenericsFactory) { factory = paramGenericsFactory; } private GenericsFactory getFactory() { return factory; } protected Reifier getReifier() { return Reifier.make(getFactory()); } } /* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\sun\reflect\generics\reflectiveObjects\LazyReflectiveObjectGenerator.class * Java compiler version: 8 (52.0) * JD-Core Version: 0.7.1 */
846e4fc9613ecb0b8c06a81030bcbb451c9190fc
79111284106b2ef7290b5539da21a9778d818dd4
/Final/src/Negocio/EventosPrivados.java
d64ba413ba91c24dfb9b334261185d8521af4683
[]
no_license
egabrielnunes/EventsManager
164fc32838486c13b26b2c63480e1035cdaab88b
98970999e3f6e6cbeb9daea7b48df7a3cac9dc3f
refs/heads/master
2021-01-22T18:37:49.179612
2017-03-15T16:53:35
2017-03-15T16:53:35
85,097,957
0
0
null
null
null
null
UTF-8
Java
false
false
2,445
java
package Negocio; import java.util.Date; public class EventosPrivados { private String tituloEPri; private String descricaoEPri; private Date dataEPri; private String horaEPri; private String duracaoEPri; private Date dataAgendamento; private String horaAgendamento; private int id; public EventosPrivados(String tituloEPri, Date dataEPri, int id) { super(); this.tituloEPri = tituloEPri; this.dataEPri = dataEPri; this.id = id; } public EventosPrivados() { super(); } public EventosPrivados(String tituloEPri, String descricaoEPri, Date dataEPri, String horaEPri, String duracaoEPri) { super(); this.tituloEPri = tituloEPri; this.descricaoEPri = descricaoEPri; this.dataEPri = dataEPri; this.horaEPri = horaEPri; this.duracaoEPri = duracaoEPri; } public EventosPrivados(String tituloEPri, String descricaoEPri, Date dataEPri, String horaEPri, String duracaoEPri, Date dataAgendamento, String horaAgendamento) { super(); this.tituloEPri = tituloEPri; this.descricaoEPri = descricaoEPri; this.dataEPri = dataEPri; this.horaEPri = horaEPri; this.duracaoEPri = duracaoEPri; this.dataAgendamento = dataAgendamento; this.horaAgendamento = horaAgendamento; } public String getTituloEPri() { return tituloEPri; } public void setTituloEPri(String tituloEPri) { this.tituloEPri = tituloEPri; } public String getDescricaoEPri() { return descricaoEPri; } public void setDescricaoEPri(String descricaoEPri) { this.descricaoEPri = descricaoEPri; } public Date getDataEPri() { return dataEPri; } public void setDataEPri(Date dataEPri) { this.dataEPri = dataEPri; } public String getHoraEPri() { return horaEPri; } public void setHoraEPri(String horaEPri) { this.horaEPri = horaEPri; } public String getDuracaoEPri() { return duracaoEPri; } public void setDuracaoEPri(String duracaoEPri) { this.duracaoEPri = duracaoEPri; } public Date getDataAgendamento() { return dataAgendamento; } public void setDataAgendamento(Date dataAgendamento) { this.dataAgendamento = dataAgendamento; } public String getHoraAgendamento() { return horaAgendamento; } public void setHoraAgendamento(String horaAgendamento) { this.horaAgendamento = horaAgendamento; } public int getId() { return id; } public void setId(int id) { this.id = id; } }
6a89143f4cc807ebce16461cae9699a0851acbf8
90d4df6afa33b110b678f441035a26b637d206e3
/Solution86.java
72de69eee1baae0320505bd33a1373edefedcb22
[]
no_license
kiten46087/leetcode-practice
653511203bf8575e7ba446228bff4ba3a4facbaa
60ab9629011f0c30f375fc0cfb21b25ce2b3183b
refs/heads/master
2020-08-26T21:13:34.955946
2020-02-17T06:31:03
2020-02-17T06:31:03
217,150,265
1
0
null
null
null
null
UTF-8
Java
false
false
765
java
public class Solution86 { public class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } public ListNode partition(ListNode head, int x) { ListNode before_head = new ListNode(0); ListNode before = before_head; ListNode after_head = new ListNode(0); ListNode after = after_head; while (head != null) { if (head.val < x) { before.next = head; before = before.next; } else { after.next = head; after = after.next; } head = head.next; } after.next = null; before.next = after_head.next; return before_head.next; } }
2dbf95fb7fb29e8636eeaf8b84f888ed9380a27d
c056aac30b14e1cf5220672016e5e869e870b4a1
/test/webcachetest/WebCacheJUnitTest.java
9ba206e7f1cd78f51a71a4459e2e1eca1087db08
[]
no_license
barii/webcache
abcb72212d83fa82f7fce8f4529a6f4ab797fd53
3bd5717c238113840e63734154e69f60b3495a39
refs/heads/master
2021-05-13T23:11:40.834389
2018-01-06T19:03:01
2018-01-06T19:03:01
116,508,351
0
0
null
null
null
null
UTF-8
Java
false
false
925
java
package webcachetest; import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import webcache.Cache; import webcache.WebParser; public class WebCacheJUnitTest { Cache gocardlessCache; WebParser parser; public WebCacheJUnitTest() { gocardlessCache = new Cache(); parser = new WebParser(gocardlessCache, "https://gocardless.com"); } @Before public void setUp() { parser.scrape("/"); } @Test public void testAdd(){ assertTrue(gocardlessCache.search("Overview").contains("/faq/merchants/")); assertTrue(gocardlessCache.search("individuals").contains("/stories/")); assertTrue(gocardlessCache.search("increasingly").contains("/guides/posts/add-on-solutions-for-accountants/")); assertTrue(gocardlessCache.search("multinational").contains("/about/")); } }
fb32a8e2c2c887b39e87e3fbaf543586d5222f34
819998294c5cd607ad638e61f40aa3ddca8008d6
/servlets/src/com/MyServe.java
7c2e6884b8830095eb652f27950f335d0022ba3a
[]
no_license
oksir/java
8c80901b4216c761856781c5418aa2150e048399
6504eba6bcf3a4b7d312025fea651560cc95b32d
refs/heads/master
2020-04-06T21:56:22.988125
2018-11-16T10:38:29
2018-11-16T10:38:29
157,819,281
0
0
null
2018-11-16T10:38:31
2018-11-16T05:52:12
Java
UTF-8
Java
false
false
915
java
package com; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.Servlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; public class MyServe implements Servlet { @Override public void destroy() { // TODO Auto-generated method stub } @Override public ServletConfig getServletConfig() { // TODO Auto-generated method stub return null; } @Override public String getServletInfo() { // TODO Auto-generated method stub return null; } @Override public void init(ServletConfig arg0) throws ServletException { // TODO Auto-generated method stub } @Override public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException { PrintWriter out= arg1.getWriter(); out.println("Hello This is My First Servlet Prg"); } }
f0ff549fc29a2c5b9bce1387ca8bc11cdb6ffa41
444935479bf261364e3acf17d666448da57c38bb
/app/src/main/java/com/example/asus/projectcitra/Canny.java
c95bc894a5c6ac7ba3d41b6683c910c149f2aedc
[]
no_license
bayysp/Android-Mini-Photoshop-Using-OpenCV
7665acc8172fa3f1637e7e965a00d0d01e304933
64e7a8f055bd2613a49a7bb3736b9cb4b2f227a8
refs/heads/master
2020-04-05T20:15:50.273903
2018-12-08T05:04:18
2018-12-08T05:04:18
157,172,225
1
0
null
null
null
null
UTF-8
Java
false
false
1,311
java
package com.example.asus.projectcitra; import android.graphics.Bitmap; import android.util.Log; import android.widget.ImageView; import android.widget.Toast; import org.opencv.android.Utils; import org.opencv.core.Mat; import org.opencv.imgproc.Imgproc; public class Canny { Bitmap cannyBitmap; public Bitmap convertToCanny(int value,Bitmap imageBitmap){ try{ Mat rgba = new Mat(); Mat grayMat = new Mat(); Mat cannyMat = new Mat(); int width = imageBitmap .getWidth(); int height = imageBitmap.getHeight(); cannyBitmap = Bitmap.createBitmap(width,height,Bitmap.Config.RGB_565); //create an gray bitmap image Utils.bitmapToMat(imageBitmap,rgba); // convert bitmap into mat Imgproc.cvtColor(rgba,grayMat,Imgproc.COLOR_BGR2GRAY); //use Rgba to change grayMat into grayscale image Imgproc.Canny(grayMat,cannyMat,value,value-20); Utils.matToBitmap(cannyMat,cannyBitmap); // after that, convert a mat into bitmap return cannyBitmap; }catch (Exception ex){ // Toast.makeText(getApplicationContext(),"GAMBAR BELUM ADA",Toast.LENGTH_SHORT).show(); Log.d("Gaussian", ex.getMessage()); } return imageBitmap; } }
ecfbf3d8d1cefc6d59cdc20dda4f828a5c9a4e0c
ccf94dcb6b1500fcbbd56964ae8c4832a496b8b3
/java/baiduads-sdk-auto/src/test/java/com/baidu/dev2/api/sdk/wttrade/model/WtTradeRequestTest.java
26fa68a4d7b3ae2b55682590c9a64dc6e7234ab7
[ "Apache-2.0" ]
permissive
baidu/baiduads-sdk
24c36b5cf3da9362ec5c8ecd417ff280421198ff
176363de5e8a4e98aaca039e4300703c3964c1c7
refs/heads/main
2023-06-08T15:40:24.787863
2023-05-20T03:40:51
2023-05-20T03:40:51
446,718,177
16
11
Apache-2.0
2023-06-02T05:19:40
2022-01-11T07:23:17
Python
UTF-8
Java
false
false
1,115
java
/* * dev2 api schema * 'dev2.baidu.com' api schema * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package com.baidu.dev2.api.sdk.wttrade.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** * Model tests for WtTradeRequest */ public class WtTradeRequestTest { private final WtTradeRequest model = new WtTradeRequest(); /** * Model tests for WtTradeRequest */ @Test public void testWtTradeRequest() { // TODO: test WtTradeRequest } /** * Test the property 'cache' */ @Test public void cacheTest() { // TODO: test cache } }
20ac785bbb8d3c8ac190aced5989bbc499e79476
725cc464a24b7cc061377c4b4725fe3eebd09856
/UniqueProject/src/com/example/uniqueproject/Uniqueactivity.java
07d6463dd7f2c1d4a26541631a0b96e2b98ed8ef
[]
no_license
csexton95/ExamAppCMS
b14c35fd7cbf2d6bf61c0c608f0f901af838ea5b
7391d37d84ca3b2f880e4504ea358f836551803d
refs/heads/master
2020-05-29T11:42:15.651292
2015-04-08T20:06:22
2015-04-08T20:06:22
33,627,037
0
0
null
null
null
null
UTF-8
Java
false
false
954
java
package com.example.uniqueproject; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class Uniqueactivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_uniqueactivity); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.uniqueactivity, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "root@localhost" ]
root@localhost
21f6201c7870d7558b11ab875e57cd11d193415b
ae834eb34e7f592c0629f6d6b063b9176183529e
/src/main/java/common/ExportWordUtils.java
d88838dfb9a29626aa7d87995cb43fe505ae9476
[]
no_license
zhangjunchao666/aspose-test
08672e275973b2d1e0038ddb4cf36d68276cb278
98faa7d11f5674cd696b982447036f6700ac17ed
refs/heads/master
2020-05-30T15:15:58.435284
2019-06-03T09:09:37
2019-06-03T09:09:37
189,814,066
1
0
null
null
null
null
UTF-8
Java
false
false
2,999
java
package common; import cn.afterturn.easypoi.word.WordExportUtil; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.springframework.util.Assert; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.net.URLEncoder; import java.util.Map; /** * TODO easypoi工具类 * @author zhangjunchao * @date 2019/6/3 */ public class ExportWordUtils { /** * 导出word * <p>第一步生成替换后的word文件,只支持docx</p> * <p>第二步下载生成的文件</p> * <p>第三步删除生成的临时文件</p> * 模版变量中变量格式:{{foo}} * @param templatePath word模板地址 * @param temDir 生成临时文件存放地址 * @param fileName 文件名 * @param params 替换的参数 * @param request HttpServletRequest * @param response HttpServletResponse */ public static void exportWord(String templatePath, String temDir, String fileName, Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) { Assert.notNull(templatePath,"模板路径不能为空"); Assert.notNull(temDir,"临时文件路径不能为空"); Assert.notNull(fileName,"导出文件名不能为空"); Assert.isTrue(fileName.endsWith(".docx"),"word导出请使用docx格式"); if (!temDir.endsWith("/")){ temDir = temDir + File.separator; } File dir = new File(temDir); if (!dir.exists()) { dir.mkdirs(); } try { String userAgent = request.getHeader("user-agent").toLowerCase(); if (userAgent.contains("msie") || userAgent.contains("like gecko")) { fileName = URLEncoder.encode(fileName, "UTF-8"); } else { fileName = new String(fileName.getBytes("utf-8"), "ISO-8859-1"); } XWPFDocument doc = WordExportUtil.exportWord07(templatePath, params); String tmpPath = temDir + fileName; FileOutputStream fos = new FileOutputStream(tmpPath); doc.write(fos); // 设置强制下载不打开 response.setContentType("application/force-download"); // 设置文件名 response.addHeader("Content-Disposition", "attachment;fileName=" + fileName); OutputStream out = response.getOutputStream(); doc.write(out); out.close(); } catch (Exception e) { e.printStackTrace(); } finally { delFileWord(temDir,fileName);//这一步看具体需求,要不要删 } } /** * 删除零时生成的文件 */ public static void delFileWord(String filePath, String fileName){ File file =new File(filePath+fileName); File file1 =new File(filePath); file.delete(); file1.delete(); } }
a1f807210cc7a95a61a6af14dea5471da2675df6
719981adcefec962cd3613a14a8cf94c615f7a60
/src/main/java/com/example/service/impl/UserServiceImpl.java
73df06db135f010cfe81546759d799b1e2ec5990
[]
no_license
Alan-Grace/demo
e9d3b098733bb6dd876a1dfeb68df4595cbf083c
0c8ff69f69ab46a6119c4beb1e8af71ceae9b42e
refs/heads/master
2020-09-13T05:46:46.454236
2020-02-23T09:11:21
2020-02-23T09:11:21
222,668,546
0
0
null
null
null
null
UTF-8
Java
false
false
1,015
java
package com.example.service.impl; import com.example.dao.UsersMapper; import com.example.domain.Users; import com.example.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @Service public class UserServiceImpl implements UserService { @Autowired UsersMapper usersMapper; //value:缓存名 key:缓存的key @Override // @Cacheable(value = "user", key = "#id") @Cacheable(value = "user") public Users selectByPrimaryKey(Long id) { return usersMapper.selectByPrimaryKey(id); } @Override @CachePut(value = "user", key = "#record.id") public Users updateByPrimaryKey(Users record) { int res = usersMapper.updateByPrimaryKey(record); if (res > 0) { return usersMapper.selectByPrimaryKey(record.getId()); } return null; } }
99a73f813f4163895925918a03d8fedea1e9e41e
add25e6eabaf8a139eb98668a70d04372ad747d9
/service-jpa-demo/src/main/java/com/charles/Application.java
494a65a90b7d1021f364f8c44fe272c7e570b31d
[]
no_license
CharlesBanner/spring-cloud-demo
77181883709d0e3990f0940ffa01066ca5220b9c
b8f5086dc7dcb37aa0d006bf061610af61ee4c3c
refs/heads/master
2022-07-01T22:31:22.891314
2019-06-01T08:27:45
2019-06-01T08:27:45
182,950,898
0
0
null
2022-06-21T01:08:40
2019-04-23T06:42:44
Java
UTF-8
Java
false
false
415
java
package com.charles; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * Created with IntelliJ IDEA. * Description: * * @author: GanZiB * Date: 2019-04-28 * Time: 15:32 */ @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class,args); } }
0de4d40575e7194247864aa9f2b793cda12532c3
4aa04f7d476dbb33b95b40ea35ca155479d3c27f
/src/main/java/com/sunset/community/Service/impl/ActivityServiceImpl.java
a7013a1b8d00f97b0fd761c3b0475dfa8ddba6fc
[]
no_license
Ryoaky/sunset-community
0e85a3320e76b2b8104e200029e58924585090bc
17116b392b1d41874cfd7fa69566cfb7597dbd7d
refs/heads/master
2023-03-27T20:01:26.623311
2021-03-26T06:28:46
2021-03-26T06:28:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,484
java
package com.sunset.community.Service.impl; import com.sunset.community.Mapper.ActivityMapper; import com.sunset.community.Pojo.Activity; import com.sunset.community.Service.ActivityService; import com.sunset.community.Utils.Upload; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @Service public class ActivityServiceImpl implements ActivityService { @Autowired ActivityMapper activityMapper; /* * 发布活动功能 * * 作用:活动表增加活动,并且关系库新增 * * 返回值:true/false * * */ @Override @Transactional(rollbackFor = Exception.class) public boolean postActi(long uid,Activity activity,MultipartFile picture,MultipartFile audio,HttpServletRequest req){ try{ activityMapper.addActi(activity); long aid = activityMapper.lastId(); activityMapper.addPoster(uid,aid); //上传图片 activityMapper.addImage(Upload.pic(picture),aid); //上传音频 activityMapper.addAudio(Upload.audio(audio),aid); } catch (Exception e) { e.printStackTrace(); } return true; } //判断是否人数满 public boolean isFull(long aid) { return activityMapper.getJoinerNums(aid) == activityMapper.getNeedNums(aid); } Integer joiner_num; @Override public List<HashMap<String,Object>> getNearActi(long uid,String location) { //创建活动列表 List<HashMap<String,Object>> actiMapList = new ArrayList<HashMap<String,Object>>();; List<Activity> actiList = activityMapper.getActiListByLoc(location); //迭代每一个帮助对象,添加信息构造成哈希表并添加至活动列表中 for (Activity acti : actiList) { String startTime = acti.getPostTime().toString().replace("T,"," ").substring(0,16); String endTime = acti.getEndTime().toString().replace("T,"," ").substring(0,16); HashMap<String,Object> actiMap = new HashMap<>(); joiner_num = activityMapper.getJoinerNums(acti.getAid()); actiMap.put("peopleNum",joiner_num); //帮助id和对应参加人数 actiMap.put("needNum",acti.getNeedNum()); //帮助id和对应参加人数 actiMap.put("actiObject",acti); actiMap.put("isPoster",activityMapper.isPoster(uid,acti.getAid())); actiMap.put("hasJoined",activityMapper.hasJoined(uid,acti.getAid())); actiMap.put("pic",activityMapper.getActiPic(acti.getAid())); actiMap.put("audio",activityMapper.getActiAudio(acti.getAid())); actiMap.put("startTimeFormed",startTime); actiMap.put("endTimeFormed",endTime); // actiMap.put("picUrl",activityMapper.getPic(acti.getAid())); if(!actiMap.isEmpty()) actiMapList.add(actiMap); } return actiMapList; } // //根据活动名搜索活动 // public List<Activity> getActiByName(String name) { // return activityMapper.getActiListByName(name); // } // // public String getAudioUrlByAid(int aid) { // return activityMapper.getAudioUrlByAid(aid); // } @Override public boolean operActi(long uid, long aid) { if(activityMapper.isPoster(uid,aid)!=0){ activityMapper.deleteActi(aid); activityMapper.deleteActiPoster(aid); } else{ if(activityMapper.hasJoined(uid,aid)==0){ activityMapper.joinActi(uid,aid); } else { activityMapper.quitActi(uid,aid); } } return true; } @Override public List<HashMap<String,Object>> getActiByName(long uid,String name) { List<HashMap<String,Object>> actiMapList = new ArrayList<HashMap<String,Object>>();; List<Activity> actiList = activityMapper.getActiByName(name); for (Activity acti : actiList) { System.out.print(acti.getName()); String startTime = acti.getPostTime().toString().replace("T,"," ").substring(0,16); String endTime = acti.getEndTime().toString().replace("T,"," ").substring(0,16); HashMap<String,Object> actiMap = new HashMap<>(); joiner_num = activityMapper.getJoinerNums(acti.getAid()); actiMap.put("peopleNum",joiner_num); //帮助id和对应参加人数 actiMap.put("needNum",acti.getNeedNum()); //帮助id和对应参加人数 actiMap.put("actiObject",acti); actiMap.put("isPoster",activityMapper.isPoster(uid,acti.getAid())); actiMap.put("hasJoined",activityMapper.hasJoined(uid,acti.getAid())); actiMap.put("pic",activityMapper.getActiPic(acti.getAid())); actiMap.put("audio",activityMapper.getActiAudio(acti.getAid())); actiMap.put("startTimeFormed",startTime); actiMap.put("endTimeFormed",endTime); // actiMap.put("picUrl",activityMapper.getPic(acti.getAid())); if(!actiMap.isEmpty()) actiMapList.add(actiMap); } return actiMapList; } }
2d1f29901c8e8a7ca6f1f60c0477c1c0bf0c16ea
d4fea30375323de6744c96493222f1833fecb0b9
/src/lesson22/task2/Utils.java
dd3a248454ea6810fddf726f2d629433473eb3a2
[]
no_license
iomel/java-core-grom
6fc174e6390e3f5469e50628e9c36c88dece13cc
d042aec0da6d425e37618b14e3789aebb3d3913d
refs/heads/master
2021-08-24T01:41:42.560384
2017-12-07T14:03:07
2017-12-07T14:03:07
106,401,285
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package lesson22.task2; public class Utils { private static int limitTransactionsPerDayCount = 15; private static int limitTransactionsPerDayAmount = 200; private static int limitSimpleTransactionAmount = 40; private static String[] cities = {"Kiev", "Odessa"}; public static int getLimitTransactionPerDayCount() { return limitTransactionsPerDayCount; } public static int getLimitTransactionPerDayAmount() { return limitTransactionsPerDayAmount; } public static int getLimitSimpleTransactionAmount() { return limitSimpleTransactionAmount; } public static String[] getCities() { return cities; } }
51a7c2d72d42544766c07c167e821eee3d9a3042
2bf15ac36d177e27b27b5191e6bd17081fd9d00a
/AnyWall-Gr11/app/src/main/java/apps/edu/udea/co/anywall_gr11/LoginSignupActivity.java
0b34df12f01122f339bbcaf192e7b8f7cfe71a12
[]
no_license
lfelipemarin/labsGr11CM20152
fd528244970259b1471d4e4d815a8fb885f1401b
4b4e9d56f3b0a7388b02ebfe058f9bdd867a984a
refs/heads/master
2016-09-05T19:00:48.797123
2015-12-15T20:28:30
2015-12-15T20:28:30
42,358,580
0
0
null
null
null
null
UTF-8
Java
false
false
4,002
java
package apps.edu.udea.co.anywall_gr11; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.parse.LogInCallback; import com.parse.ParseException; import com.parse.ParseUser; import com.parse.SignUpCallback; public class LoginSignupActivity extends AppCompatActivity { Button loginButton; Button signupButton; String usernameTxt; String passwordTxt; EditText password; EditText username; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login_signup); username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); loginButton = (Button) findViewById(R.id.login); signupButton = (Button) findViewById(R.id.signup); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { usernameTxt = username.getText().toString(); passwordTxt = password.getText().toString(); ParseUser.logInInBackground(usernameTxt, passwordTxt, new LogInCallback() { @Override public void done(ParseUser user, ParseException e) { if (user != null) { Intent intent = new Intent(LoginSignupActivity.this, MainActivity.class); startActivity(intent); finish(); } else { Toast.makeText(getApplicationContext(), "This user doesn't exist. Please signup", Toast.LENGTH_SHORT).show(); } } }); } }); signupButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { usernameTxt = username.getText().toString(); passwordTxt = password.getText().toString(); if (usernameTxt.equals("") && passwordTxt.equals("")) { Toast.makeText(getApplicationContext(), "Please complete hte sign up form", Toast.LENGTH_SHORT).show(); } else { ParseUser user = new ParseUser(); user.setUsername(usernameTxt); user.setPassword(passwordTxt); user.signUpInBackground(new SignUpCallback() { @Override public void done(ParseException e) { if (e == null) { Toast.makeText(getApplicationContext(), "Successfully Signed up!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "Sign up error", Toast.LENGTH_SHORT).show(); } } }); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_login_signup, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
030f8f6f24891d2b7843cc5bf7c3174ab8938cc1
aa6997aba1475b414c1688c9acb482ebf06511d9
/src/com/sun/javadoc/SourcePosition.java
c8305182bb29a4fa5706f16f4511a5a0e28a80bc
[]
no_license
yueny/JDKSource1.8
eefb5bc88b80ae065db4bc63ac4697bd83f1383e
b88b99265ecf7a98777dd23bccaaff8846baaa98
refs/heads/master
2021-06-28T00:47:52.426412
2020-12-17T13:34:40
2020-12-17T13:34:40
196,523,101
4
2
null
null
null
null
UTF-8
Java
false
false
1,055
java
/* * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.javadoc; import java.io.File; /** * This interface describes a source position: filename, line number, * and column number. * * @author Neal M Gafter * @since 1.4 */ public interface SourcePosition { /** * The source file. Returns null if no file information is * available. */ File file(); /** * The line in the source file. The first line is numbered 1; * 0 means no line number information is available. */ int line(); /** * The column in the source file. The first column is * numbered 1; 0 means no column information is available. * Columns count characters in the input stream; a tab * advances the column number to the next 8-column tab stop. */ int column(); /** * Convert the source position to the form "Filename:line". */ String toString(); }
547661553b7f553ede6da5b054591175552185a0
f6a574b9b893ba2ea7c6892336c11611b03562fb
/src/googlemap/WGoogleMap.java
10cc94debbeb817dccc3590a0d2de1ac59f949f7
[]
no_license
wisegps/GoogleMapTest
5753c38985ded530bd7bb26aa1497b4c85ab705e
1ff3fad17b8d2d00bd5b70ee7ce52aea3e39a4ec
refs/heads/master
2021-01-20T19:34:26.566090
2016-06-01T06:29:47
2016-06-01T06:29:47
60,070,345
0
0
null
null
null
null
GB18030
Java
false
false
8,888
java
//package googlemap; // //import java.math.BigDecimal; //import java.util.List; // //import android.location.Location; // //import com.example.googlemaptest.R; //import com.google.android.gms.common.api.GoogleApiClient; //import com.google.android.gms.location.LocationListener; //import com.google.android.gms.location.LocationRequest; //import com.google.android.gms.location.LocationServices; //import com.google.android.gms.maps.CameraUpdateFactory; //import com.google.android.gms.maps.GoogleMap; //import com.google.android.gms.maps.model.BitmapDescriptor; //import com.google.android.gms.maps.model.BitmapDescriptorFactory; //import com.google.android.gms.maps.model.CameraPosition; //import com.google.android.gms.maps.model.LatLng; //import com.google.android.gms.maps.model.Marker; //import com.google.android.gms.maps.model.MarkerOptions; //import com.google.android.gms.maps.model.PolylineOptions; // ///** // * @author Wu // * @date 2016-05-27 // */ //public class WGoogleMap { // // public GoogleMap googleMap; // public CameraPosition cameraPosition; // // public static final int MAP_TYPE_NORMAL = 1;//普通街道地图 // public static final int MAP_TYPE_SATELLITE = 2;//卫星视图 // public static final int MAP_TYPE_TERRAIN = 3;//地势地图 // public static final int MAP_TYPE_HYBRID = 4;//卫星和路网的混合视图 // // public static final int DIS_TYPE_KM = 1;//千米 // public static final int DIS_TYPE_MI = 2;//英里 // public static final int DIS_TYPE_NMI= 3;//海里 // // public WGoogleMap(GoogleMap map){ // super(); // this.googleMap = map; // googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); // } // // /** // * @param enable 是否显示我的位置按钮 // */ // public void setMyLoaction(boolean enable){ // googleMap.setMyLocationEnabled(enable); // } // // /** // * @param enable 是否在视图上面显示缩放比例控件 // */ // public void setZoomControlsEnabled(boolean enable){ // googleMap.getUiSettings().setZoomControlsEnabled(enable); // } // // /** // * @param enable 当用户查看室内地图时候,层级选择器会出现在右侧边缘 // */ // public void setIndoorLevelPickerEnabled(boolean enable){ // googleMap.getUiSettings().setIndoorLevelPickerEnabled(enable); // } // // /** // * @param enable 地图工具栏(会跳转到Google导航软件或者地图软件) // */ // public void setMapToolbarEnabled(boolean enable){ // googleMap.getUiSettings().setMapToolbarEnabled(enable); // } // // /** // * @param enable 倾斜手势 (默认开启) // */ // public void setTiltGesturesEnabled(boolean enable){ // googleMap.getUiSettings().setTiltGesturesEnabled(enable); // } // // /** // * @param enable 旋转手势 (默认开启) // */ // public void setRotateGesturesEnabled(boolean enable){ // googleMap.getUiSettings().setRotateGesturesEnabled(enable); // } // // /** // * @param enable 缩放手势 (默认开启) // */ // public void setZoomGesturesEnabled(boolean enable){ // googleMap.getUiSettings().setZoomGesturesEnabled(enable); // } // // /** // * @param enable 平移手势 (默认开启) // */ // public void setScrollGesturesEnabled(boolean enable){ // googleMap.getUiSettings().setScrollGesturesEnabled(true); // } // // /** // * @param enable 在有些城市放大会显示3D视图 // */ // public void setBuildingsEnabled(boolean enable){ // googleMap.setBuildingsEnabled(enable); // } // // // /** // * @param mapType 1:普通街道视图 2:卫星视图 3:地势地图 4:卫星和街道混合视图(默认是normal) // */ // public void setMapType(int mapType){ // switch (mapType) { // case 1: // googleMap.setMapType(MAP_TYPE_NORMAL); // break; // case 2: // googleMap.setMapType(MAP_TYPE_SATELLITE); // break; // case 3: // googleMap.setMapType(MAP_TYPE_TERRAIN); // break; // case 4: // googleMap.setMapType(MAP_TYPE_HYBRID); // break; // default: // googleMap.setMapType(MAP_TYPE_NORMAL); // break; // } // } // // // /** // * @param target 设置要移动镜头的目标(移动这个点会在地图中心) // * @param zoom 设置缩放级别 // * @param bearing 设置相机的方向 // * @param tilt 镜头的倾斜度 // */ // public void animateCamera(LatLng target,int zoom,int bearing,int tilt){ // CameraPosition cameraPosition = new CameraPosition.Builder() // .target(target) // Sets the center of the map to Mountain View // .zoom(13) // Sets the zoom // .bearing(bearing) // Sets the orientation of the camera to east // .tilt(tilt) // Sets the tilt of the camera to 30 degrees // .build(); // Creates a CameraPosition from the builder // googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); // } // // // /** // * @param latlng 标签的位置 // * @param markName 标签显示的信息 // * @return Marker // */ // public Marker addMarker(LatLng latlng,String markName){ // return googleMap.addMarker(new MarkerOptions().position(latlng).title(markName)); // } // // /** // * @param latlng 把镜头移动到的点 // */ // public void moveCamera(LatLng latlng){ // googleMap.moveCamera(CameraUpdateFactory.newLatLng(latlng)); // } // // // // /** // * @param latlng // * @param resId // * @return MarkerOptions // */ // public MarkerOptions setMarkOptions(LatLng latlng,int resId){ // BitmapDescriptor bitmap = BitmapDescriptorFactory // .fromResource(R.drawable.person); // MarkerOptions markOption = new MarkerOptions().anchor(0.1f, 0.1f) // .position(latlng).icon(bitmap); // return markOption; // } // // // /** // * @param markOptions // * @return // */ // public Marker addMarker(MarkerOptions markOptions){ // return googleMap.addMarker(markOptions); // } // // // /** // * @param seconds 位置更新时间 (单位为:/s) // * @return LocationRequest // */ // public LocationRequest setLocationRequest(int seconds){ // LocationRequest REQUEST = LocationRequest.create() // .setInterval(1000 * seconds) // 5 seconds // .setFastestInterval(16) // 16ms = 60fps // .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); // return REQUEST; // } // // /** // * @param points 经纬度点集合 // * @param color 线颜色 // * @param width 线宽度 // */ // public void drawLine(List<LatLng> points,int color,float width){ // PolylineOptions options = new PolylineOptions(); // options.color(color); // options.width(width); // options.geodesic(true); // options.addAll(points); // googleMap.addPolyline(options); // } // // /** // * @param start 开始经纬度点 // * @param end 结束经纬度点 // * @param color 线颜色 // * @param width 线宽度 // */ // public void drawLine(LatLng start, LatLng end,int color,float width){ // googleMap.addPolyline((new PolylineOptions()) // .add(start,end) // .width(width) // .color(color) // .geodesic(true)); // } // // /** // * 清除地图上面的东西 // */ // public void clear(){ // googleMap.clear(); // } // // // /** // * @param marker 移除marker // */ // public void removeMarker(Marker marker){ // marker.remove(); // } // // // /** // * @param client GoogleApiClient // * @param seconds 定位时间间隔 // * @param listener 定位监听 // */ // public void setMyLocationListener(GoogleApiClient client,int seconds,LocationListener listener){ // LocationServices.FusedLocationApi.requestLocationUpdates( // client, // setLocationRequest(seconds), // listener); // LocationListener // } // // // /** // * 获取两点的距离 // * @param start 开始经纬度 // * @param end 结束点经纬度 // * @param type 1:km 2: mi 3:nmi // * @return // */ // public double getDistance(LatLng start, LatLng end,int type){ // float[] results = new float[1]; // double dis = 0; // Location.distanceBetween(start.latitude, start.longitude, end.latitude, end.longitude, results); // if(type == DIS_TYPE_KM){ // BigDecimal b = new BigDecimal(results[0]/1000); // dis = b.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); // }else if(type == DIS_TYPE_MI){ // BigDecimal b = new BigDecimal(results[0]/1000*0.6213712); // dis = b.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); // }else if(type == DIS_TYPE_NMI){ // BigDecimal b = new BigDecimal(results[0]/1000*0.5399568); // dis = b.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); // } // return dis; // } // // //}
[ "Administrator@PC--20150902QLW" ]
Administrator@PC--20150902QLW
ac8e20c0ca13e883d02b7d5b5297b94f3bbd3560
7e75063da1f4b58d21afe1ef687025fb94d523f0
/SelectionSort.java
07cb12e3a05c831bd7e0f876d660911cce3ae53f
[]
no_license
rhagavi/lab9-10
fe5e721e70713be284ac00eeba108a8d114ef4fa
f83b0bfc2801ee76b0870861ef447c9322f3b36b
refs/heads/master
2020-05-05T00:27:54.412216
2019-04-04T20:37:20
2019-04-04T20:37:20
179,567,477
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
public class SelectionSort { private int temp; /** Creates a new instance of SelectionSort */ public SelectionSort() { } /* A simple SelectionSort algorithm * pre-condition: * post-condition: * inputs: * outputs: * special conditions: */ public int[] basicSelectionSort(int[] x) { for (int i = 0; i < x.length; ++i) { for (int j= i+1; j < x.length; ++j) { if (x[i] > x[j]) { temp = x[i]; x[i] = x[j]; x[j] = temp; // fixed this part of the code // the temp value should be placed back into x[j] // for swapping } } // end of inner for loop } // end of outer for loop return x; } // end of basicSelectionSort method }
15c10c9902cfa48d228c327c0ee76648eab2e897
5455627427ba10f45cfccbd326fda5a53b664268
/app/src/main/java/ocdev/com/br/lyricseditor/Adpters/ArtistasRelacionadosAdapter.java
1bbc9e708e43db263308fd7bbcf1daecd382ef0c
[]
no_license
otocampos/lyrics-app
d0b29eb4fe778a29bd201f3ced8cc21a89f6824f
a3bfc39651982ef4a00a5b1c7e6bbba50b799077
refs/heads/master
2023-07-20T16:34:36.041987
2021-09-01T12:35:44
2021-09-01T12:35:44
402,053,124
0
0
null
null
null
null
UTF-8
Java
false
false
3,708
java
package ocdev.com.br.lyricseditor.Adpters; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.github.siyamed.shapeimageview.CircularImageView; import java.util.List; import ocdev.com.br.lyricseditor.Constants.Constants; import ocdev.com.br.lyricseditor.Model.RankingMusica.Artista.Related; import ocdev.com.br.lyricseditor.R; /** * Created by Oto on 04/04/2018. */ public class ArtistasRelacionadosAdapter extends RecyclerView.Adapter<ArtistasRelacionadosAdapter.ArtistasRelacionadosAdapterViewHolder> { private Context context; private List<Related> resutadolistadeArtistasRelacionados; int layoutIdForListItem; private GetClick getClick; public interface GetClick { void getIndiceRelArtistas(int id, String urlimg, String name); } public ArtistasRelacionadosAdapter(GetClick getClick) { this.getClick = getClick; } @Override public ArtistasRelacionadosAdapter.ArtistasRelacionadosAdapterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { context = parent.getContext(); layoutIdForListItem = R.layout.list_item_artistas_relacionados; LayoutInflater inflater = LayoutInflater.from(context); boolean shouldAttachToParentImmediately = false; View view = inflater.inflate(layoutIdForListItem, parent, shouldAttachToParentImmediately); return new ArtistasRelacionadosAdapter.ArtistasRelacionadosAdapterViewHolder(view); } @Override public void onBindViewHolder(ArtistasRelacionadosAdapter.ArtistasRelacionadosAdapterViewHolder holder, final int position) { final String urlimgrel = resutadolistadeArtistasRelacionados.get(position).getUrl(); holder.txtnomedoartistarel.setText(resutadolistadeArtistasRelacionados.get(position).getName()); Glide.with(context) .load(Constants.BASE_URL_ARTISTAS + urlimgrel + Constants.IMAGES + Constants.PROFILE_JPG) .asBitmap() .thumbnail(0.5f) .diskCacheStrategy(DiskCacheStrategy.ALL) .skipMemoryCache(true) .into(holder.imgartistarel); holder.view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { getClick.getIndiceRelArtistas(position, Constants.BASE_URL_ARTISTAS + urlimgrel + Constants.IMAGES + "profile.jpg", resutadolistadeArtistasRelacionados.get(position).getName()); } }); } @Override public int getItemCount() { if (resutadolistadeArtistasRelacionados == null) { return 0; } else { return resutadolistadeArtistasRelacionados.size(); } } public class ArtistasRelacionadosAdapterViewHolder extends RecyclerView.ViewHolder { private TextView txtnomedoartistarel; private CircularImageView imgartistarel; public View view; public ArtistasRelacionadosAdapterViewHolder(View view) { super(view); this.view = view; imgartistarel = (CircularImageView) view.findViewById(R.id.img_related_artista); txtnomedoartistarel = (TextView) view.findViewById(R.id.id_nome_artista_relacionado); } } public void setListadeArtistasRelacionados(List<Related> listadeArtistasRelacionados) { this.resutadolistadeArtistasRelacionados = listadeArtistasRelacionados; } }
5346179b98ead922da02c5e7f18834011b372e66
8e96ec971f249d281a2db94ccf039bbd0fdc0484
/src/main/java/com/everis/repository/ReactiveRepository.java
1c6ce07f1dded7dcd228df73d3a2d19e0f46f2bc
[]
no_license
jeffreyralvarez/TeacherMicroservice
94e969bc56187d16c26dc4b3d10607508672e5ee
f8b02ba231b2ad7d90364712ba5d80b3c4433af5
refs/heads/master
2023-07-10T15:00:33.570185
2019-09-27T22:29:00
2019-09-27T22:29:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,196
java
package com.everis.repository; import com.everis.model.Teacher; import java.io.Serializable; import java.util.Date; import org.springframework.data.mongodb.repository.ReactiveMongoRepository; import org.springframework.stereotype.Repository; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** * ReactiveRepository interface. * @author jeffrey * @version v1.0 */ @Repository public interface ReactiveRepository extends ReactiveMongoRepository<Teacher, Serializable> { /** * find by Full Name teacher document. * @param fullName full name * @return */ Flux<Teacher> findByFullName(String fullName); /** * find by identification document number teacher document. * @param documentNumber identification document number * @return */ Mono<Teacher> findByDocumentNumber(String documentNumber); /** * find by rank date of birth teacher document. * @param fromDate date * @param toDate date * @return */ Flux<Teacher> findByDateofBirthBetween(Date fromDate, Date toDate); /** * find by id teacher document. * @param idTeacher id * @return */ Mono<Teacher> findById(String idTeacher); }
c94c8668a021cf60104dd7227964ddd2b42493a6
7f37e7a3e065b371ffab6c03c40b932ad3e1b8d2
/src/Division.java
033de5bf2777101a8c9d15281c416d323a8d7026
[]
no_license
leosaurabh/DSAlgo
e09b79befbc97cb72e888c5e6ba1b96cadd90d61
01aa5e2b27a240accfba2a51cdc6acd5687ae7b9
refs/heads/master
2020-04-07T07:17:09.718416
2019-02-25T03:44:39
2019-02-25T03:44:39
158,170,592
0
0
null
null
null
null
UTF-8
Java
false
false
99
java
public class Division { long divide(long dividend, long divisor) { return 0l; } }
72d4b44fa8e9fcbde03c3508174209cf9718895b
6081bd7262011ae8d698cc53e9237c740c93df67
/src/main/java/org/dasein/cloud/azure/compute/disk/model/DiskModel.java
51f1aa09cfa64d6a3321b5de1e53d11c6d7a8e2f
[ "Apache-2.0" ]
permissive
dasein-cloud/dasein-cloud-azure
e8e9054b16c3ef7914f4361011a19edf0eba343e
e2abb775c0f23f0d0f2509fba31128c7b2027d7c
refs/heads/master
2021-01-02T23:07:28.619006
2016-02-08T13:29:48
2016-02-08T13:29:48
39,010,281
0
13
Apache-2.0
2022-01-17T01:10:20
2015-07-13T12:18:41
Java
UTF-8
Java
false
false
2,953
java
package org.dasein.cloud.azure.compute.disk.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name="Disk", namespace ="http://schemas.microsoft.com/windowsazure") @XmlAccessorType(XmlAccessType.FIELD) public class DiskModel { @XmlElement(name="AffinityGroup", namespace="http://schemas.microsoft.com/windowsazure") private String affinityGroup; @XmlElement(name="OS", namespace="http://schemas.microsoft.com/windowsazure") private String os; @XmlElement(name="Location", namespace="http://schemas.microsoft.com/windowsazure") private String location; @XmlElement(name="LogicalDiskSizeInGB", namespace="http://schemas.microsoft.com/windowsazure") private String logicalDiskSizeInGB; @XmlElement(name="MediaLink", namespace="http://schemas.microsoft.com/windowsazure") private String mediaLink; @XmlElement(name="Name", namespace="http://schemas.microsoft.com/windowsazure") private String name; @XmlElement(name="SourceImageName", namespace="http://schemas.microsoft.com/windowsazure") private String sourceImageName; @XmlElement(name="CreatedTime", namespace="http://schemas.microsoft.com/windowsazure") private String createdTime; @XmlElement(name="IOType", namespace="http://schemas.microsoft.com/windowsazure") private String ioType; @XmlElement(name="AttachedTo", namespace="http://schemas.microsoft.com/windowsazure") private AttachedToModel attachedTo; public String getAffinityGroup() { return affinityGroup; } public void setAffinityGroup(String affinityGroup) { this.affinityGroup = affinityGroup; } public String getOs() { return os; } public void setOs(String os) { this.os = os; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getLogicalDiskSizeInGB() { return logicalDiskSizeInGB; } public void setLogicalDiskSizeInGB(String logicalDiskSizeInGB) { this.logicalDiskSizeInGB = logicalDiskSizeInGB; } public String getMediaLink() { return mediaLink; } public void setMediaLink(String mediaLink) { this.mediaLink = mediaLink; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSourceImageName() { return sourceImageName; } public void setSourceImageName(String sourceImageName) { this.sourceImageName = sourceImageName; } public String getCreatedTime() { return createdTime; } public void setCreatedTime(String createdTime) { this.createdTime = createdTime; } public String getIoType() { return ioType; } public void setIoType(String ioType) { this.ioType = ioType; } public AttachedToModel getAttachedTo() { return attachedTo; } public void setAttachedTo(AttachedToModel attachedTo) { this.attachedTo = attachedTo; } }
9114d31300b9f6eec12f86f5bed4151f2b1365b1
3a5cbdd463493b0ef1c61258897e092f2158689b
/app/src/androidTest/java/com/example/labo7_meseguer/ExampleInstrumentedTest.java
a133e7541d209bcb94c1cf690a4989626873d47c
[]
no_license
dmeseguerw/Labo7_B74767
505953a92d7bf1c5d94db913057ffceb934c78f2
ce86bba2224efc8c0da0c8d9c978255fcd600f72
refs/heads/master
2023-01-19T12:39:21.787122
2020-11-21T05:35:48
2020-11-21T05:35:48
314,693,926
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.example.labo7_meseguer; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.labo7_meseguer", appContext.getPackageName()); } }
114bc086b821c7e4aa9cd3a1081f6a45066a66cb
104cb47b2b3c2f1f2cc2a460f41f8a23992246e6
/app/src/main/java/com/john/shadi/di/AppComponent.java
95ea88638475f837f79cf8c520bf7565fba04d6e
[]
no_license
imjohnmoses/userlist
0b1766b44eead87bae1131f19067ca5677c14629
0fda0b9b2e7ec85f7841bd523a12c01d3f3e7fee
refs/heads/main
2023-02-24T19:25:09.461686
2021-02-07T18:59:02
2021-02-07T18:59:02
336,864,881
0
0
null
null
null
null
UTF-8
Java
false
false
713
java
package com.john.shadi.di; import android.app.Application; import com.john.shadi.MyApp; import javax.inject.Singleton; import dagger.BindsInstance; import dagger.Component; import dagger.android.AndroidInjector; import dagger.android.support.AndroidSupportInjectionModule; @Singleton @Component(modules = {DataBaseModule.class, NetworkModule.class,AndroidSupportInjectionModule.class,ViewModelFactoryModule.class,MainViewModelModule.class,ActivityBuilderModule.class}) public interface AppComponent extends AndroidInjector<MyApp> { @Component.Builder interface Builder { @BindsInstance Builder application(Application application); AppComponent build(); } }
2ba70c586eeecb43e941a693af3e82c63983439d
0c42d7c6d0af9251a06228885fe5b2d94cc01b9a
/app/src/main/java/com/fubang/wanghong/ui/HistoryActivity.java
9ffe4b723f24c2c9df1ea5e9f1a7b87168e0b391
[]
no_license
jackycaojiaqi/wanghong
49e18c5b60c0121061625122907cc5e540348374
71b48f083448c3d0d076ff9e2a386d626666faf0
refs/heads/master
2021-07-04T07:20:53.701410
2017-09-25T01:20:36
2017-09-25T01:20:36
104,688,973
0
1
null
null
null
null
UTF-8
Java
false
false
4,939
java
package com.fubang.wanghong.ui; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.Toast; import com.fubang.wanghong.AppConstant; import com.fubang.wanghong.adapters.HistoryAdapter; import com.fubang.wanghong.api.ApiService; import com.fubang.wanghong.entities.HistoryEnity; import com.fubang.wanghong.entities.HistoryListEntiy; import com.fubang.wanghong.R; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshListView; import com.zhuyunjian.library.StartUtil; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.ViewById; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Converter; import retrofit2.Response; import retrofit2.Retrofit; /** * 历史记录页面 */ @EActivity(R.layout.activity_history) public class HistoryActivity extends BaseActivity implements PullToRefreshBase.OnRefreshListener, Callback<HistoryListEntiy> { @ViewById(R.id.history_listview) PullToRefreshListView listView; @ViewById(R.id.history_back_btn) ImageView backImage; private HistoryAdapter adapter; private List<HistoryEnity> data = new ArrayList<>(); private Call<HistoryListEntiy> call; @Override public void initView() { backImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); adapter = new HistoryAdapter(data,this); listView.setMode(PullToRefreshBase.Mode.PULL_FROM_START); listView.setOnRefreshListener(this); listView.setAdapter(adapter); } @Override public void initData() { Retrofit retrofit = new Retrofit.Builder().baseUrl(AppConstant.BASE_URL) .addConverterFactory(new Converter.Factory() { @Override public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { return new Converter<ResponseBody, HistoryListEntiy>() { @Override public HistoryListEntiy convert(ResponseBody value) throws IOException { HistoryListEntiy entity = null; try { entity = new HistoryListEntiy(); List<HistoryEnity> list = new ArrayList<>(); JSONArray array = new JSONArray(value.string()); for (int i = 0; i < array.length(); i++) { JSONObject object = array.getJSONObject(i); HistoryEnity historyEnity = new HistoryEnity(); historyEnity.setRoomname(object.getString("roomname")); historyEnity.setRoomid(object.getString("roomid")); historyEnity.setRoompic(object.getString("roompic")); historyEnity.setGateway(object.getString("gateway")); list.add(0,historyEnity); } entity.setEnities(list); }catch (JSONException e){ e.printStackTrace(); } return entity; } }; } }).build(); ApiService service = retrofit.create(ApiService.class); call = service.getHistoryEnity(Integer.parseInt(StartUtil.getUserId(this))); call.enqueue(this); } @Override public void onResponse(Call<HistoryListEntiy> call, Response<HistoryListEntiy> response) { listView.onRefreshComplete(); call.cancel(); data.clear(); List<HistoryEnity> list = response.body().getEnities(); if(list != null) { // Log.d("123", list.size() + "------------rich"); data.addAll(list); adapter.notifyDataSetChanged(); } } @Override public void onFailure(Call<HistoryListEntiy> call, Throwable t) { Toast.makeText(this, "网络错误", Toast.LENGTH_SHORT).show(); } @Override public void onRefresh(PullToRefreshBase refreshView) { Call<HistoryListEntiy> call2 = call.clone(); call2.enqueue(this); } }
84c2c3c15b80a318ab7403634b7d6ed5b9beca59
1f1e3484bd212026946165de8d4ada322330f044
/src/com/morac/algorithms/sorting/QuicksortOne.java
9d80363900320fc4d285e35f45b91103c14d6ddc
[]
no_license
CAMorales/HackerRank
054bd9d99af639bf15bd6db957319ae2fa409211
4585587a7b7e9d583c3de38e10d4a5c1e4371af9
refs/heads/master
2022-02-06T06:25:06.947905
2022-01-21T19:12:58
2022-01-21T19:12:58
56,018,844
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package com.morac.algorithms.sorting; import java.util.Scanner; /** * Created by Claudio Morales on 11/04/2016. */ public class QuicksortOne { static void partition(int[] ar) { int pivot=ar[0]; int []left=new int[ar.length]; int []right=new int[ar.length]; int i=0,j=0; for (int k = 1; k < ar.length; k++) { if (ar[k]<pivot) left[i++]=ar[k]; else right[j++]=ar[k]; } for (int k = 0; k < i; k++) { System.out.print(left[k]+ " "); } System.out.print(pivot); for (int k = 0; k < j; k++) { System.out.print(right[k]+ " "); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] ar = new int[n]; for(int i=0;i<n;i++){ ar[i]=in.nextInt(); } partition(ar); } }
f0d0509e2efca54dd5958d3035a8988cd764f840
ca85b4da3635bcbea482196e5445bd47c9ef956f
/iexhub/src/main/java/PDQSupplier/org/hl7/v3/IntraarticularRoute.java
d8816945d4496dcb3aeb678b2ece4803594ebb2b
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
bhits/iexhub-generated
c89a3a9bd127140f56898d503bc0c924d0398798
e53080ae15f0c57c8111a54d562101d578d6c777
refs/heads/master
2021-01-09T05:59:38.023779
2017-02-01T13:30:19
2017-02-01T13:30:19
80,863,998
0
1
null
null
null
null
UTF-8
Java
false
false
1,698
java
/******************************************************************************* * Copyright (c) 2015, 2016 Substance Abuse and Mental Health Services Administration (SAMHSA) * * 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. * * Contributors: * Eversolve, LLC - initial IExHub implementation for Health Information Exchange (HIE) integration * Anthony Sute, Ioana Singureanu *******************************************************************************/ package PDQSupplier.org.hl7.v3; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for IntraarticularRoute. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="IntraarticularRoute"> * &lt;restriction base="{urn:hl7-org:v3}cs"> * &lt;enumeration value="IARTINJ"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "IntraarticularRoute") @XmlEnum public enum IntraarticularRoute { IARTINJ; public String value() { return name(); } public static IntraarticularRoute fromValue(String v) { return valueOf(v); } }
dc875e18cdd47d774564dfee051da7b955ccb4d5
bf4ca133013c8b74534ce59e250eacf3ec11d3cc
/src/test/java/org/springframework/integration/flow/config/xml/FlowWithOptionalResponseTest.java
4c849645aa3a0d2d6375e7485b0e5c536749d746
[]
no_license
dimarassin/spring-integration-flow
d4a9806f67726e5ebdad765f3e5d0d6fdc69e3bc
a513a2b389eeb061ff4d8581fccf861e9e37806d
refs/heads/master
2021-01-18T18:28:14.539779
2012-02-22T20:02:18
2012-02-22T20:02:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,929
java
package org.springframework.integration.flow.config.xml; import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.Message; import org.springframework.integration.MessageChannel; import org.springframework.integration.MessagingException; import org.springframework.integration.core.MessageHandler; import org.springframework.integration.core.SubscribableChannel; import org.springframework.integration.message.GenericMessage; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:/FlowWithOptionalResponseTest-context.xml") public class FlowWithOptionalResponseTest { @Autowired @Qualifier("inputC") MessageChannel input; @Autowired @Qualifier("inputCO") MessageChannel inputForOptionalResponse; @Autowired @Qualifier("outputC") SubscribableChannel output; @Test public void testOneWay() { input.send(new GenericMessage<String>("hello")); } @Test public void testOptionResponse() { TestMessageHandler counter = new TestMessageHandler(); output.subscribe(counter); for (int i=0; i< 100; i++){ inputForOptionalResponse.send(new GenericMessage<String>("hello")); } assertTrue(String.valueOf(counter.count), counter.count >1 && counter.count < 100); } static class TestMessageHandler implements MessageHandler { int count = 0; @Override public void handleMessage(Message<?> message) throws MessagingException { count++; } } }
c7b9fb782065c1ab2b8709aa9a2aa43b21895542
6e999f027e3345dcebd63410cdaab661dd230f55
/android.shangxiang.app/src/com/shangxiang/android/spinnerwheel/WheelRecycler.java
af42376f61c0fbba7a92e4cc26fef2f426b1336c
[]
no_license
xiaoli3007/idear_android
df0dc2e17f2b71f482bca18fc0db53a2f3f3115a
8e21b13f3b169516cd38953db9f09de9f80141b8
refs/heads/master
2021-01-20T20:09:07.704234
2016-07-18T07:11:54
2016-07-18T07:11:54
61,523,504
0
0
null
null
null
null
UTF-8
Java
false
false
4,313
java
/* * android-spinnerwheel * https://github.com/ai212983/android-spinnerwheel * * based on * * Android Wheel Control. * https://code.google.com/p/android-wheel/ * * Copyright 2011 Yuri Kanivets * * 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.shangxiang.android.spinnerwheel; import java.util.LinkedList; import java.util.List; import android.view.View; import android.widget.LinearLayout; /** * Recycle stored spinnerwheel items to reuse. */ public class WheelRecycler { @SuppressWarnings("unused") private static final String LOG_TAG = WheelRecycler.class.getName(); // Cached items private List<View> items; // Cached empty items private List<View> emptyItems; // Wheel view private AbstractWheel wheel; /** * Constructor * @param wheel the spinnerwheel view */ public WheelRecycler(AbstractWheel wheel) { this.wheel = wheel; } /** * Recycles items from specified layout. * There are saved only items not included to specified range. * All the cached items are removed from original layout. * * @param layout the layout containing items to be cached * @param firstItem the number of first item in layout * @param range the range of current spinnerwheel items * @return the new value of first item number */ public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) { int index = firstItem; for (int i = 0; i < layout.getChildCount();) { if (!range.contains(index)) { recycleView(layout.getChildAt(i), index); layout.removeViewAt(i); if (i == 0) { // first item firstItem++; } } else { i++; // go to next item } index++; } return firstItem; } /** * Gets item view * @return the cached view */ public View getItem() { return getCachedView(items); } /** * Gets empty item view * @return the cached empty view */ public View getEmptyItem() { return getCachedView(emptyItems); } /** * Clears all views */ public void clearAll() { if (items != null) { items.clear(); } if (emptyItems != null) { emptyItems.clear(); } } /** * Adds view to specified cache. Creates a cache list if it is null. * @param view the view to be cached * @param cache the cache list * @return the cache list */ private List<View> addView(View view, List<View> cache) { if (cache == null) { cache = new LinkedList<View>(); } cache.add(view); return cache; } /** * Adds view to cache. Determines view type (item view or empty one) by index. * @param view the view to be cached * @param index the index of view */ private void recycleView(View view, int index) { int count = wheel.getViewAdapter().getItemsCount(); if ((index < 0 || index >= count) && !wheel.isCyclic()) { // empty view emptyItems = addView(view, emptyItems); } else { while (index < 0) { index = count + index; } index %= count; items = addView(view, items); } } /** * Gets view from specified cache. * @param cache the cache * @return the first view from cache. */ private View getCachedView(List<View> cache) { if (cache != null && cache.size() > 0) { View view = cache.get(0); cache.remove(0); return view; } return null; } }
c484d43a6a8d7194e7180b656a1c537bd37cb485
1e28f2b11336da69c227abd48604545e306b1571
/src/main/java/com/example/mysqlr2/Order.java
65db5434ad0ee81cadad060094ccf5bedb233864
[]
no_license
oursy/reactive-mysql-with-r2dbc-transactions
c80a0f72e20b8f95b5427b80b9c5cc50062a4671
1193b61f1e22021e5067b10e1419a0e44f8c467b
refs/heads/master
2020-06-02T16:19:06.123705
2019-06-10T18:34:29
2019-06-10T18:34:29
191,224,642
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package com.example.mysqlr2; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; import javax.validation.constraints.NotBlank; @AllArgsConstructor @NoArgsConstructor @Table(value = "`order`") @Data public class Order { @Id private Integer id; @NotBlank private String name; @NotBlank private String code; }
e7ecd0bd612b0ec5105082a363860108237a503c
7f0a642f55066d62473fc7c6e8e461a573188be1
/java/main/java/sensetiveword/GMT.java
6af71099ad7728f46c317d26bf37cea321680646
[]
no_license
mianghaha/test
ca0b96e4e2294f06d2409dbf12da1869110a9124
3db2a4e8cac9668f9f8e82c4ca1a1002a0f76a1e
refs/heads/master
2022-07-14T01:37:19.559376
2020-10-26T03:50:37
2020-10-26T03:50:37
184,978,975
0
0
null
2022-07-01T17:41:56
2019-05-05T04:24:20
Java
UTF-8
Java
false
false
9,848
java
package sensetiveword; import java.util.HashSet; import java.util.Set; public class GMT { public static void main(String[] args) { String s ="8萬沅=8萬沅, 1450625839 =1450625839 , HZSY89=HZSY89, THU420=THU420, 1-1-4-1-2-8-1-9-3-7-9-5=1-1-4-1-2-8-1-9-3-7-9-5, silly131115=silly131115, I00=I00, 82083732=82083732, c56b78=c56b78, 淘丶手游=淘丶手游, Q1208-537-333=Q1208-537-333, 252879983=252879983, 群49110=群49110, 9 1 5 9 1 3 3 3 8=9 1 5 9 1 3 3 3 8, appn69=appn69, 649694527=649694527, 611丶727丶411=611丶727丶411, 裙N6P=裙N6P, IOS代退=IOS代退, 190-440-406=190-440-406, 沅寶=沅寶, 2940696563=2940696563, rainbow-iii=rainbow-iii, daka876=daka876, Q群93366=Q群93366, taoshou游 =taoshou游 , 100沅=100沅, 加我徵吧咱俩玩还能聊点(污) =加我徵吧咱俩玩还能聊点(污) , n9/67/70=n9/67/70, yayacc 6=yayacc 6, 肆酒溜午山二山衣扒=肆酒溜午山二山衣扒, 422572203=422572203, cx77991=cx77991, 淘*手*you=淘*手*you, 916610009=916610009, 送128礼包=送128礼包, 神兽魂石加=神兽魂石加, guda678=guda678, 239733678=239733678, MH66=MH66, 把你充的钱原路退回不影响游戏先退VX:845253332=把你充的钱原路退回不影响游戏先退VX:845253332, V信=V信, 461384907=461384907, q876580700 =q876580700 , AcAck6=AcAck6, 加q裙:72648=加q裙:72648, 沅==沅=, 1062118571=1062118571, 15109986699=15109986699, 116093374586=116093374586, 2161456856=2161456856, 905082930=905082930, 326627699=326627699, ⒋⒐⒍⒌⒊⒉⒊⒈⒏=⒋⒐⒍⒌⒊⒉⒊⒈⒏, Taoshouyou=Taoshouyou, 1064390022=1064390022, daka654=daka654, 5万元宝送VIP8=5万元宝送VIP8, q897275991=q897275991, 2.3.2.8.0.3.0.4.9..9.=2.3.2.8.0.3.0.4.9..9., 沅葆=沅葆, 1,1,6,0,9,3,3,7,4,5,8,6,=1,1,6,0,9,3,3,7,4,5,8,6,, q740826964=q740826964, 钱多多砖业腿游戏历史茺直,(游戏不回)威信:luoxi8811=钱多多砖业腿游戏历史茺直,(游戏不回)威信:luoxi8811, zpyk0544=zpyk0544, 一个人玩好无聊,加个νχ以后一起吧=一个人玩好无聊,加个νχ以后一起吧, wujiewj123456789=wujiewj123456789, 視频带我玩吧我还可以给哥哥表演脱衣服的节目!=視频带我玩吧我还可以给哥哥表演脱衣服的节目!, 8444-1694=8444-1694, 244296.II78=244296.II78, 577877331=577877331, 妹子新手带一条送福利=妹子新手带一条送福利, q 裙 5 1 9 4 6= q 裙 5 1 9 4 6, 号:MH66 椡咐=号:MH66 椡咐, 7378066=7378066, 17752352450=17752352450, 762789926=762789926, 淘手游=淘手游, 1,1,6,0,9,3,3,7,4,5,8,6=1,1,6,0,9,3,3,7,4,5,8,6, 776995356=776995356, 809393256=809393256, 79335=79335, 541219840=541219840, 292263793=292263793, Q群83120=Q群83120, 2.3.2.8.0.3.0.4.9.9.=2.3.2.8.0.3.0.4.9.9., 2442961178=2442961178, yaYAcc6=yaYAcc6, c9426646=c9426646, 加个V,信=加个V,信, 2641044 =2641044 , txnbzc=txnbzc, I00二5万元宝=I00二5万元宝, vx:luoxi8811=vx:luoxi8811, kka5728=kka5728, ⑧⑦③-⑦⑨⑥=⑧⑦③-⑦⑨⑥, Q 251949745=Q 251949745, 妹妹下面好痒痒=妹妹下面好痒痒, 推荐了一款好游戏=推荐了一款好游戏, 加Q群4536.85843=加Q群4536.85843, 997001056=997001056, 762036576=762036576, 2328030499=2328030499, 接app消费找回,任何游戏月内消费都可以退,先退后付,需要的私聊=接app消费找回,任何游戏月内消费都可以退,先退后付,需要的私聊, 充值优惠=充值优惠, ccba122=ccba122, ·n·9·6·7·7·0·=·n·9·6·7·7·0·, 喜欢玩大小单双加V信=喜欢玩大小单双加V信, 胃r66677=胃r66677, daka=daka, 薪区=薪区, 728598110=728598110, 453685843=453685843, 淘丶手丶游=淘丶手丶游, 251949745=251949745, 18089693228=18089693228, 扣 氺 =扣 氺 , wx:nagedaig=wx:nagedaig, 4-9-6-5-3-2-3-1-8=4-9-6-5-3-2-3-1-8, 728598110=728598110, 退.款=退.款, 4965323I8=4965323I8, BADU345=BADU345, 82083732先货=82083732先货, 2226575365=2226575365, 8萬沅寶=8萬沅寶, 232-8030-499=232-8030-499, 2-3-2-8-0-3-0-4-9-9=2-3-2-8-0-3-0-4-9-9, 12084761829=12084761829, 49 б5 23I⒏=49 б5 23I⒏, 628丶185丶368=628丶185丶368, 981292888=981292888, 加我徵信看我流水=加我徵信看我流水, 1.1.4.1.2.8.1.9.3.7.9.5=1.1.4.1.2.8.1.9.3.7.9.5, 我下面好难受等你来安慰我=我下面好难受等你来安慰我, yayacc6=yayacc6, 茺直=茺直, 100元=8万园宝=100元=8万园宝, 100沅=8萬沅寶=100沅=8萬沅寶, yaYaCc6=yaYaCc6, 珈夏我薇,新吧 sS987T t 教个盆友, 一块組队完游戏=珈夏我薇,新吧 sS987T t 教个盆友, 一块組队完游戏, ➕我V,信=➕我V,信, 100沅=8萬沅寶=100沅=8萬沅寶, tuka345=tuka345, 805525714=805525714, 《n-9-6-7-7-0》=《n-9-6-7-7-0》, 77917569=77917569, 362981293=362981293, 2034535508=2034535508, 2921156175=2921156175, TAO丶手游=TAO丶手游, 452.225.813=452.225.813, 茺植=茺植, 100沅=100沅, 四九六五三二三一八=四九六五三二三一八, 工作室=工作室, 扣 裙 5 1 9 4 6=扣 裙 5 1 9 4 6, CYW286=CYW286, 49б5323I⒏=49б5323I⒏, 628185368=628185368, 278614=278614, appkkuu=appkkuu, K5777D=K5777D, n·9·6·7·7·0·=n·9·6·7·7·0·, 你来吗,来就加秋裙,教升战带冲榜=你来吗,来就加秋裙,教升战带冲榜, 3306665071=3306665071, kkUkk2=kkUkk2, 200元55万元宝抢购微信.YQYQWWQ先货=200元55万元宝抢购微信.YQYQWWQ先货, 216.145.6856=216.145.6856, 73777 8110=73777 8110, 进群领免=进群领免, I00二5万=I00二5万, 2690715749=2690715749, I00二5万元宝十时装=I00二5万元宝十时装, 50元=5万元宝=50元=5万元宝, 剑雨昆仑=剑雨昆仑, kkukk2=kkukk2, 淘*手*游=淘*手*游, 退款=退款, 915913338=915913338, 1689427015=1689427015, 100亓=10W亓宝=100亓=10W亓宝, 114.1177.445=114.1177.445, n9-67-70=n9-67-70, 褪款=褪款, 1。1。6。0。9。。3。3。7。4。5。8。6=1。1。6。0。9。。3。3。7。4。5。8。6, appletk1001=appletk1001, 送银毕=送银毕,  搜~薇心工众浩= 搜~薇心工众浩, CX77991=CX77991, 1725385358=1725385358, 淘手you=淘手you, 丶手丶游=丶手丶游, VX:845253332=VX:845253332, 72648=72648, 亓宝=亓宝, CCBA122=CCBA122, 关注微信公众号:M=关注微信公众号:M, 我的徵信114128193795看我抠水=我的徵信114128193795看我抠水, wnn88881=wnn88881, 374862002=374862002, TAO.shou.you=TAO.shou.you, 微信sde5566=微信sde5566, 644-705-5590=644-705-5590, 36SY =36SY , 砖业腿游戏历史冲值=砖业腿游戏历史冲值, 497-520-058=497-520-058, 2.3.2.8.0.3.0.4.9.9,=2.3.2.8.0.3.0.4.9.9,, ⒏⒈⒈⒏0.⒐⒎⒐⒎=⒏⒈⒈⒏0.⒐⒎⒐⒎, 791060025=791060025, ⑨⑤⑦⑨④=⑨⑤⑦⑨④, 9693366225=9693366225, →⒍⒈⑦0⒍⑥⑹⒏1=→⒍⒈⑦0⒍⑥⑹⒏1, ⑨⑤.⑦⑨.④=⑨⑤.⑦⑨.④, 811809797=811809797, 331 3386=331 3386, 13645067885=13645067885, 596692932=596692932, DDH884=DDH884, 8萬沅.宝=8萬沅.宝, 100快=10万员保[e:1]  =100快=10万员保[e:1]  , 老公不在家聊污吗?=老公不在家聊污吗?, 728598110=728598110, 1 2 0 6 3 1 2 0 5 8 3=1 2 0 6 3 1 2 0 5 8 3, n-9-6-7-7-0=n-9-6-7-7-0, n 9 6 7 7 0=n 9 6 7 7 0, daniu2436=daniu2436, 1141177445=1141177445, 伽我威 信n 9 6 7 7 0=伽我威 信n 9 6 7 7 0, 抠水=抠水, 你来就佳 Q秋裙=你来就佳 Q秋裙, Tuka345=Tuka345, S S 98 7tt=S S 98 7tt, 1089-8992=1089-8992, 1-1-6-0-9-3-3-7-4-5-8-6=1-1-6-0-9-3-3-7-4-5-8-6, 2827599409=2827599409, 496532318=496532318, :kka5728[=:kka5728[, 沅=8=沅=8, :daka876,=:daka876,, 150-2496=150-2496, 换个游戏=换个游戏, 8萬沅.宝=8萬沅.宝, Yayacc6=Yayacc6, loo二IO万元=loo二IO万元, y36mma=y36mma, 抠 水=抠 水, 61 42 21 550=61 42 21 550, 876580700=876580700, 萬沅=萬沅, 2195450191=2195450191, n~9~6~7~7~0=n~9~6~7~7~0, 二OO元=⑤=二OO元=⑤, 推荐了一款好游戏要不要一起=推荐了一款好游戏要不要一起, 2903920952=2903920952, Ccba122=Ccba122, buka678=buka678, 元宝都可以原路退回=元宝都可以原路退回, 545601171=545601171, 100.元=8萬沅.宝+=100.元=8萬沅.宝+, QQ1064390022=QQ1064390022, VX1062118571=VX1062118571, 1。1。6。0。9。3。。3。7。4。5。8。6=1。1。6。0。9。3。。3。7。4。5。8。6, Ss9 87tt=Ss9 87tt, QQ:728598110=QQ:728598110, 91591 3338=91591 3338, 二3.二8.030.四九九= 二3.二8.030.四九九, 6170.66681=6170.66681, 93366=93366, 看我抠水=看我抠水, 微sun6130505=微sun6130505, zpyk0544 免费送50=zpyk0544 免费送50, ④⑨⑥⑤③②③①⑧=④⑨⑥⑤③②③①⑧, 114128193795=114128193795, QQ2690715749=QQ2690715749, 1546345608=1546345608, 加我徵信114128193795 看我抠水=加我徵信114128193795 看我抠水, 18572457900=18572457900, 3490805626=3490805626, 771933O=771933O, sS 9 8 7 t t=sS 9 8 7 t t, KkUkK2=KkUkK2, 大神妹子语音带队=大神妹子语音带队, qq3027326465=qq3027326465, 君93366=君93366, 2685544746=2685544746, 19196 99995=19196 99995, Q群46124=Q群46124, 加我ν.Х: gax3187=加我ν.Х: gax3187, 4536.85843=4536.85843, 7778064=7778064"; String[] array = s.split(","); Set<String> senetiveWordS = new HashSet<String>(); for(String raw : array) { String[] array2 = raw.split("="); String sensitiveWord = array2[0].trim(); if(sensitiveWord.equals("")) { System.out.println("raw=" + raw); } senetiveWordS.add(sensitiveWord); } String content = "[at:谁与我479335355]"; for(String sensitiveWord : senetiveWordS) { if(content.contains(sensitiveWord)) { System.out.println("sensitiveWord=" + sensitiveWord); } } } }
03ea7b587cff94cdc45acdce29be68d51299f033
2565bb6d6e4f9e9775a81bf4c4ff0768b8071821
/src/com/company/Client.java
965b4510833deeb74b68bb31b2ec2c00151de2ce
[]
no_license
filipchukings/client-server-study
881cca38f1b927d5867baa089df60d05d1fe30df
0132d82a4b05c654951c6cbd70df36ea0be4921d
refs/heads/master
2020-04-28T01:56:04.469369
2019-03-11T08:12:02
2019-03-11T08:12:02
174,878,847
0
0
null
null
null
null
UTF-8
Java
false
false
1,306
java
package com.company; import java.io.*; import java.net.ServerSocket; import java.net.Socket; public class Client { private static int PORT = 4004; private static String IP = "localhost"; BufferedReader in; BufferedWriter out; BufferedReader reader; Socket socket; private void makeClient(){ try { socket = new Socket(IP, PORT); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Write tp server: "); String word = reader.readLine(); out.write(word + "\n"); out.flush(); String serverWord = in.readLine(); System.out.println(serverWord); } catch (IOException e) { e.printStackTrace(); }finally { try { in.close(); out.close(); socket.close(); reader.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void main(String[] args) { new Client().makeClient(); } }
6979c40cd81172a772993f4c13c1873d3b371426
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a006/A006687Test.java
fc6ea1cd906d5fbd7d9659b27f59246e519b3d6f
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package irvine.oeis.a006; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A006687Test extends AbstractSequenceTest { }
b59c213416fd4b8beb2b8e4d08314b89e2a026e4
64ca119963bf0aab5374ab5fbdb0846790213bfa
/src/main/java/zb/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
4fbd4f081a550ca25a3bf4dbe524d4b44967fc34
[]
no_license
bobo15850/simplespring
8186c8ae929724391d37e8605a3215caec832015
ee2b4547e663b8c2d1cdec712bbc0781811464ec
refs/heads/master
2021-01-11T01:30:35.702802
2016-11-14T04:32:15
2016-11-14T04:32:15
70,696,838
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
package zb.springframework.beans.factory.support; import zb.springframework.beans.factory.config.AutowireCapableBeanFactory; public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFactory implements AutowireCapableBeanFactory { }
e979ae44f78ba54995d595b219fb35fc0e8efe97
3baf6ee29cc9b428433bd0db7dda0ebec6ceb4b9
/store_alpha/src/store/utils/UploadDirectoryUtils.java
3fc44582be3ea2432f739ea4d5aa2f7f5cb6ce7e
[]
no_license
yangsiyuan0/TugouStore_alpha
e516b5909a08ee439f524517c8de3ca9100d7d34
7ba7785535585b7dcc810042e6de4362b38ad649
refs/heads/master
2021-01-01T15:46:12.786439
2017-07-19T09:04:30
2017-07-19T09:04:30
97,695,910
2
0
null
null
null
null
UTF-8
Java
false
false
673
java
package store.utils; /** * 目录分离算法: * 用于将上传文件自动分别存放到不同的文件夹下 * 返回值demo:4/14/2/2/ * @author yang * */ public class UploadDirectoryUtils { public static String getDividePath(String fileName){ StringBuilder sb = new StringBuilder(); int code = fileName.hashCode(); int d; for (int i = 0; i < 4; i++) { //总共搞四层目录(此处最多可以设置8层:因为int共4字节,可以按位右移4次) d = code & 0xf; //1级目录(取值范围:0~15):按位与运算 sb.append(d+"/"); // code = code >>> 4; // 三个大于号表示无符号右移 } return sb.toString(); } }
65162be532bcbb6aac169c3b49360375ab8f32b5
d336e0822bfb50f1ce63aa5a41c8d1d4af6944db
/core/src/main/java/com/draniksoft/ome/editor/support/actions/proj/SaveProjectAction.java
2585b888b58c2c8c51ef3a98e13ad9ce3cf8e985
[]
no_license
dranikpg/OME
cad52a8b1e44e4c5867f961c9c11677b6eab541c
35988239fd218e23e3d802732bb1ffd3e9c68fd6
refs/heads/master
2021-09-11T13:22:40.576750
2018-04-07T16:16:33
2018-04-07T16:16:33
100,270,204
1
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.draniksoft.ome.editor.support.actions.proj; import com.artemis.World; import com.draniksoft.ome.editor.support.actions.Action; import com.draniksoft.ome.editor.systems.file_mgmnt.ProjectLoadSystem; import org.jetbrains.annotations.NotNull; public class SaveProjectAction implements Action { @Override public void invoke(@NotNull World w) { w.getSystem(ProjectLoadSystem.class).save(); } @Override public void undo(World _w) { } @Override public boolean isUndoable() { return false; } @Override public boolean isCleaner() { return false; } @Override public String getSimpleConcl() { return "Saved Project"; } @Override public void destruct() { } }
dd0322f9c02938d49ed5c14a4923fcb3d70fec29
d867f801f1b5da92b32b670e0617ff09a3650138
/auth-3scale/src/main/java/io/apiman/plugins/auth3scale/util/report/batchedreporter/BatchedReportData.java
6593406415794bc5d422c223b94d92fe92d1a278
[ "Apache-2.0" ]
permissive
OSMOSA44/apiman-plugins
f21fd9829668b5814d68da1f291cdf7301b70d10
0f9a79720c33f8c544b66d101e6998f8f8eaee73
refs/heads/master
2021-06-11T10:34:42.170853
2021-03-03T16:22:09
2021-03-03T16:22:09
137,735,078
0
0
null
2018-06-18T09:50:34
2018-06-18T09:50:34
null
UTF-8
Java
false
false
996
java
/* * Copyright 2017 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.apiman.plugins.auth3scale.util.report.batchedreporter; import io.apiman.gateway.engine.beans.ApiRequest; import io.apiman.gateway.engine.threescale.beans.BackendConfiguration; /** * @author Marc Savy {@literal <[email protected]>} */ public interface BatchedReportData extends ReportData { ApiRequest getRequest(); Object[] getKeyElems(); BackendConfiguration getConfig(); }
250ba1a78ead0c03cb71e791c6609e09ffc8bc2f
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_515c86580d4babcdbd11b3fced0f09bfb477bfdd/DateHandler/9_515c86580d4babcdbd11b3fced0f09bfb477bfdd_DateHandler_t.java
342604a13c2b0b3d81103cbfcad4205f3f62f97c
[]
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
1,386
java
package io.undertow.server.handlers; import java.util.Date; import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; import io.undertow.util.DateUtils; import io.undertow.util.Headers; /** * Class that adds the Date: header to a HTTP response. * * The current date string is cached, and is updated every second in a racey * manner (i.e. it is possible for two thread to update it at once). * * @author Stuart Douglas */ public class DateHandler implements HttpHandler { private final HttpHandler next; private volatile String cachedDateString; private volatile long nextUpdateTime = -1; public DateHandler(final HttpHandler next) { this.next = next; } @Override public void handleRequest(final HttpServerExchange exchange) throws Exception { long time = System.nanoTime(); if(time < nextUpdateTime) { exchange.getResponseHeaders().put(Headers.DATE, cachedDateString); } else { long realTime = System.currentTimeMillis(); String dateString = DateUtils.toDateString(new Date(realTime)); cachedDateString = dateString; nextUpdateTime = time + 1000000000; exchange.getResponseHeaders().put(Headers.DATE, dateString); } next.handleRequest(exchange); } }
08660a6867e00bacdffbb7b9b504ee38e93b4fa6
de2fa32bf4a7bbb5054d066c94255460dd47f626
/OnlineExamSystemProject/src/main/java/com/lti/repository/UserRepositoryImpl.java
9ec0891552de5aef48783bbd709944a543f64307
[]
no_license
manikya-aravind/ONLINE-EXAM-SYSTEM-PROJECT
d7f801664a6b4b4b126cdc20e817320869a04f19
3d2e558366943bff30ebb40cd0053fb0e0cde953
refs/heads/master
2023-02-15T22:56:57.007846
2021-01-09T04:41:48
2021-01-09T04:41:48
328,068,501
0
0
null
null
null
null
UTF-8
Java
false
false
3,256
java
package com.lti.repository; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.lti.entity.Question; import com.lti.entity.Subject; import com.lti.entity.User; import com.lti.entity.UserReport; //class for User Repository Operations @Repository public class UserRepositoryImpl implements UserRepository { @PersistenceContext EntityManager em; // register/update a user @Transactional public long registerOrUpdateAUser(User user) { User u = em.merge(user); return u.getUserId(); } // login a user public User loginAUser(String userName, String userPassword) { String jpql = "select u from User u where u.userName=:uname and u.userPassword=:upass"; try { TypedQuery<User> query = em.createQuery(jpql, User.class); query.setParameter("uname", userName); query.setParameter("upass", userPassword); User user = (User) query.getSingleResult(); return user; } catch (Exception e) { return null; } } // find user by userId public User findUserById(long userId) { User user = em.find(User.class, userId); return user; } // find user by userName public User findUserByName(String userName) { String jpql = "select u from User u where u.userName=:uname"; try { TypedQuery<User> query = em.createQuery(jpql, User.class); query.setParameter("uname", userName); User user = (User) query.getSingleResult(); return user; } catch (Exception e) { return null; } } // find subject by subjectId public Subject findSubjectById(long subjectId) { Subject subject = em.find(Subject.class, subjectId); return subject; } // store user exam report @Transactional public UserReport storeExamReport(UserReport report) { UserReport userReport = em.merge(report); return userReport; } // retrieve latest user exam report public UserReport retrieveUserReportOfUserId(long userId) { String jpql = "select u from UserReport u where u.user.userId=:uId and u.completionTime=(select max(ur.completionTime) from UserReport ur) order by u.completionDate desc,u.completionTime desc"; try { TypedQuery<UserReport> query = em.createQuery(jpql, UserReport.class); query.setParameter("uId", userId); UserReport ur = (UserReport) query.getSingleResult(); return ur; } catch (Exception e) { return null; } } // retrieving correct answer for the question public Question retrieveCorrectAnswer(long questionId) { Question question = em.find(Question.class, questionId); return question; } // retrieving question based on level number public List<Question> retrieveQuestionBylevel(String level) { String jpql = "select q from Question q where q.questionLevelNo=:level"; try { TypedQuery<Question> query = em.createQuery(jpql, Question.class); query.setParameter("level", level); List<Question> questions = query.getResultList(); return questions; } catch (Exception e) { return null; } } }
5e3b4de4b5ba3f93c1104ef4a344609f4cf5f604
19a6c0e0e849a4e74c78fa2a75eb3a224a71d0c5
/Programmers/Level3/예산/Solution.java
43b5eb595ccb6e36336911fcfe56646b26b5cabe
[]
no_license
SunYoungKwon/Algorithms
b34c7477f5255c1359969e728b42541d80f3a2e5
4368e70c5b1149cc6e9b579587fd2ff8dabfd398
refs/heads/master
2023-06-06T04:43:07.717477
2021-06-28T11:17:36
2021-06-28T11:17:36
203,177,981
0
0
null
null
null
null
UTF-8
Java
false
false
1,150
java
import java.util.Arrays; class Solution { public int solution(int[] budgets, int M) { Arrays.sort(budgets); int answer = 0; int low = budgets[0]; int high = budgets[budgets.length - 1]; int mid; long totalBudget = getTotalBudget(budgets, high); // 예산요청 총 합보다 국가예산이 많은 경우 if(totalBudget <= M) { return high; } // 가장 작은 예산 요청 금액보다 국가예산이 적은 경우 if(low * budgets.length > M) { return M / budgets.length; } while (high - low > 1) { mid = (high + low) / 2; totalBudget = getTotalBudget(budgets, mid); if (totalBudget == M || answer == mid) { System.out.println(totalBudget); return mid; } else if (totalBudget > M) { high = mid + 1; } else { answer = mid; low = mid - 1; } } return answer; } private long getTotalBudget(int[] budgets, int limit) { long totalBudget = 0; for (int budget : budgets) { if (budget >= limit) { totalBudget += limit; } else { totalBudget += budget; } } return totalBudget; } }
1218823299872535499e3bfed70c8a9778b40b20
88752f401d19f8d6681b2dbbcde0e1c852fe7d3e
/lesson2/test2/Catalog.java
3e27478d2557ba995a073aac5f43be32f10ff165
[]
no_license
GHDmitro/JavaPr
e40b73629584e0c01def08bcf43d85dac27a1ef8
62624d521fede3ea6d2064b419e23b08263a8969
refs/heads/master
2021-01-10T17:30:46.328353
2016-02-23T13:36:27
2016-02-23T13:36:27
52,210,545
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package lesson2.test2; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @XmlRootElement(name = "catalog") //создается елемент типа бук (тег типа book) public class Catalog { @XmlElement(name = "book") private List<Book> books = new ArrayList<Book>(); public void add(Book book) { books.add(book); } @Override public String toString() { return Arrays.deepToString(books.toArray()); } }
149ba45179085574284dc0a7570f7681eee8cb93
976388d7174f8e4c380f10a5a7ce63ac9f1a4570
/model/src/main/java/com/egbert/apitest/vo/order/OrderMqVo.java
4d7cc5a351a6914b5e1a8a47c04fb4a412d27c0c
[]
no_license
EgbertHistorianPokling/apitest_parent
0e13e034919ec41d45c95b3bdf8ce3faf73bc187
2bc463f5b4fa715744a56f724250da18e03f16c9
refs/heads/master
2023-04-23T21:55:07.386091
2021-05-11T06:23:35
2021-05-11T06:23:35
363,910,855
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package com.egbert.apitest.vo.order; import com.egbert.apitest.vo.msm.MsmVo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @Data @ApiModel(description = "OrderMqVo") public class OrderMqVo { @ApiModelProperty(value = "可预约数") private Integer reservedNumber; @ApiModelProperty(value = "剩余预约数") private Integer availableNumber; @ApiModelProperty(value = "排班id") private String scheduleId; @ApiModelProperty(value = "短信实体") private MsmVo msmVo; }
e904f8efb8a20a57c0fdf109104f4b65f9392b1f
be99852e6de12c104d85eda8a101725e65600687
/src/main/java/com/project/dvdrental/exception/ErrorDetails.java
29a766b0ee33d30d484cab618aa9a617f5ff83f7
[]
no_license
mdfadly/dvd-api
648b6958fab0f39c2a78684c8db9511d10b3e092
39088b25dc469c7787f7005aa59020e43331c372
refs/heads/main
2023-03-02T07:27:06.912889
2021-02-10T06:10:29
2021-02-10T06:10:29
333,684,124
0
0
null
null
null
null
UTF-8
Java
false
false
745
java
package com.project.dvdrental.exception; import java.util.Date; public class ErrorDetails { private Date timeStamp; private String message; private String status; public ErrorDetails() { super(); } public ErrorDetails(Date timeStamp, String message, String status) { super(); this.timeStamp = timeStamp; this.message = message; this.status = status; } public Date getTimeStamp() { return timeStamp; } public void setTimeStamp(Date timeStamp) { this.timeStamp = timeStamp; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
[ "U541680@bca" ]
U541680@bca
76c8e5bca502e18a3044a4f67629ff68e8a08a7f
732c7e72eaf99bf7173aba7831dafe8dbc099d99
/app/src/main/java/com/propellerng/thepropeller/fragments/RecentPost.java
ddd3962856b8a30a35b471d559f2905554d10e98
[]
no_license
ESIDEM/ThePropeller
bc660199885ae66ceb417d82586c8889f9f13c50
161b752b23fdedfc098ca1f26dcc0593c47d2012
refs/heads/master
2021-01-01T16:23:40.409768
2017-07-20T22:03:57
2017-07-20T22:03:57
97,823,704
0
0
null
null
null
null
UTF-8
Java
false
false
7,343
java
package com.propellerng.thepropeller.fragments; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.propellerng.thepropeller.adapter.DbNewsAdapter; import com.propellerng.thepropeller.adapter.NewsAdapter; import com.propellerng.thepropeller.R; import com.propellerng.thepropeller.database.NewsContract; import com.propellerng.thepropeller.database.NewsDBHelper; import com.propellerng.thepropeller.sync.NewsSyncJobs; import com.propellerng.thepropeller.util.DividerItemDecoration; /** * A simple {@link Fragment} subclass. */ public class RecentPost extends Fragment implements LoaderManager.LoaderCallbacks<Cursor>{ public RecentPost() { // Required empty public constructor } private SQLiteDatabase mDb; private DbNewsAdapter politicsNewsAdapter; private DbNewsAdapter businessNewsAdapter; private static final int STOCK_LOADER = 0; private RecyclerView mRecyclerView; private RecyclerView politics_recyclerView; private RecyclerView business_recyclerView; //private SwipeRefreshLayout mSwipRefresh; private TextView mErrorTextView; private NewsAdapter mAdapter; private LinearLayoutManager linearLayoutManager; private LinearLayoutManager linearLayoutManagerbusiness; String[] PROJECTION = { NewsContract.Entry._ID, NewsContract.Entry.COLUMN_NAME_TITLE, NewsContract.Entry.COLUMN_NAME_PUBLISHED, NewsContract.Entry.COLUMN_NAME_LINK, NewsContract.Entry.COLUMN_NAME_DESCRIPTION, NewsContract.Entry.COLUMN_NAME_IMAGE_URL, NewsContract.Entry.COLUMN_NAME_FAV, }; Cursor politicsCursor; Cursor businessCursor; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_recent_post, container, false); NewsDBHelper dbHelper = new NewsDBHelper(getActivity()); mDb = dbHelper.getWritableDatabase(); mRecyclerView = (RecyclerView)view.findViewById(R.id.recycler_view_latest); politics_recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view_politics); business_recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view_business); // mSwipRefresh = (SwipeRefreshLayout)view.findViewById(R.id.swipe_refresh); mErrorTextView = (TextView)view.findViewById(R.id.error); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); linearLayoutManager = new LinearLayoutManager(getActivity()); linearLayoutManagerbusiness = new LinearLayoutManager(getActivity()); mAdapter = new NewsAdapter(getActivity()); mRecyclerView.setAdapter(mAdapter); mRecyclerView.setLayoutManager(layoutManager); // mSwipRefresh.setOnRefreshListener(this); // mSwipRefresh.setRefreshing(true); NewsSyncJobs.initialize(getActivity()); onRefresh(); getLoaderManager().initLoader(STOCK_LOADER, null, this); // Get all Business News from the database and save in a cursor politicsNewsAdapter = new DbNewsAdapter(getActivity()); businessNewsAdapter = new DbNewsAdapter(getActivity()); politics_recyclerView.setAdapter(politicsNewsAdapter); business_recyclerView.setAdapter(businessNewsAdapter); politics_recyclerView.setLayoutManager(linearLayoutManager); business_recyclerView.setLayoutManager(linearLayoutManagerbusiness); politics_recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST)); politics_recyclerView.setNestedScrollingEnabled(false); business_recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST)); business_recyclerView.setNestedScrollingEnabled(false); //politicsNewsAdapter.swapCursor(politicsCursor); return view; } @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return new CursorLoader(getActivity(), NewsContract.Entry.CONTENT_URI, // Contract.Quote.QUOTE_COLUMNS.toArray(new String[]{}), PROJECTION, null, null, NewsContract.Entry.COLUMN_NAME_PUBLISHED + " DESC" ); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (data.getCount() != 0) { mErrorTextView.setVisibility(View.GONE); } mAdapter.setCursor(data); politicsCursor = getPoliticsNews(); businessCursor = getBusinessNews(); politicsNewsAdapter.swapCursor(politicsCursor); businessNewsAdapter.swapCursor(businessCursor); } @Override public void onStart() { super.onStart(); } @Override public void onLoaderReset(Loader<Cursor> loader) { mAdapter.setCursor(null); // politicsNewsAdapter.swapCursor(null); } public void onRefresh() { NewsSyncJobs.syncImmediately(getActivity()); if (!networkUp() && mAdapter.getItemCount() == 0) { mErrorTextView.setText(getString(R.string.error_no_network)); mErrorTextView.setVisibility(View.VISIBLE); } else if (!networkUp()) { Toast.makeText(getActivity(), R.string.toast_no_connectivity, Toast.LENGTH_LONG).show(); } else { mErrorTextView.setVisibility(View.GONE); } } private boolean networkUp() { ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = cm.getActiveNetworkInfo(); return networkInfo != null && networkInfo.isConnectedOrConnecting(); } private Cursor getPoliticsNews() { return mDb.query( NewsContract.Entry.TABLE_NAME_POLITICS, null, // Column null, // Where clause null, // Arguments null, // Group by null, // having NewsContract.Entry.COLUMN_NAME_PUBLISHED + " DESC" // Sort_order ); } private Cursor getBusinessNews() { return mDb.query( NewsContract.Entry.TABLE_NAME_BUSINESS, null, // Column null, // Where clause null, // Arguments null, // Group by null, // having NewsContract.Entry.COLUMN_NAME_PUBLISHED + " DESC" // Sort_order ); } }
431364d2e71d1d794f055feb1b5380a54c0af514
65d6f5ec080577e347b6fe3d5ec48fb102553a3d
/learnSpring/09_ssmagain/src/main/java/cn/zyx/service/UserService.java
b312b93e34316e0b833553430dbad6377d031da5
[]
no_license
EssinZhang/JavaLearning
71aa6c8ded5e51203d3a669f71b025ac1dce00b8
941d89ee51274331d5cd5084549ad740ee1555ae
refs/heads/master
2022-12-22T02:33:42.194581
2021-04-08T11:45:05
2021-04-08T11:45:05
127,505,318
3
0
null
2022-12-15T23:57:38
2018-03-31T06:23:59
Java
UTF-8
Java
false
false
268
java
package cn.zyx.service; import cn.zyx.bean.User; import java.util.List; public interface UserService { void addUser(User user); void deleteUserById(int id); void updateUser(User user); List<User> selectUser(); User selectUserById(int id); }
0b1c9b3b7c2c7e474fa364c20a40d74ad0dc45dc
928d52e212133603ac3470b8d65b965547aa9664
/android/app/src/main/java/com/theah64/frenemy/android/utils/gpix/Callback.java
bfe97dff3b809ac1c1addec6bf2ae71a5116b3c1
[ "Apache-2.0" ]
permissive
theapache64/Frenemy
748b61ea072e194ec9da8b83595c8ae55b5e0053
5fbf1f874faf70add2654758d5dd8e29a5f78f4d
refs/heads/master
2021-01-25T06:23:56.018546
2018-03-14T09:39:43
2018-03-14T09:39:43
93,558,951
0
0
null
null
null
null
UTF-8
Java
false
false
285
java
package com.theah64.frenemy.android.utils.gpix; import org.jetbrains.annotations.NotNull; import java.util.List; /** * Created by theapache64 on 21/10/16. */ public interface Callback { void onResult(@NotNull List<Image> imageList); void onError(final String reason); }
7b49310515647b6f1dee7177113f27d83f908a6e
e9b7e78cbc5591ded1085de4be024ce4f78a1cff
/app/src/main/java/keyczar/Util.java
a9715a58a593cedf2138c394247a97c1968277b7
[]
no_license
shardullavekar/keyczar
2fa5bbda1fb420c46f5eccedf96c057e3d06ca22
04136fb6fcd5a2c759d1040df9c0375d8b626955
refs/heads/master
2021-01-01T03:37:11.004147
2016-05-11T03:53:52
2016-05-11T03:53:52
58,346,106
0
0
null
null
null
null
UTF-8
Java
false
false
9,774
java
package keyczar; import org.keyczar.Crypter; import org.keyczar.DefaultKeyType; import org.keyczar.Encrypter; import org.keyczar.GenericKeyczar; import org.keyczar.KeyMetadata; import org.keyczar.KeyVersion; import org.keyczar.KeyczarKey; import org.keyczar.SessionCrypter; import org.keyczar.enums.KeyPurpose; import org.keyczar.enums.KeyStatus; import org.keyczar.enums.RsaPadding; import org.keyczar.exceptions.KeyczarException; import org.keyczar.i18n.Messages; import org.keyczar.interfaces.KeyczarReader; import org.keyczar.keyparams.RsaKeyParameters; import org.keyczar.util.Base64Coder; import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; /** * Created by shardul on 08-05-2016. */ public class Util { private Util() { } /** * Returns a GenericKeyczar containing a new generated key of type. */ public static GenericKeyczar createKey(DefaultKeyType type, KeyPurpose purpose) throws KeyczarException { return createKey(type, purpose, type.applyDefaultParameters(null).getKeySize()); } /** * Returns a GenericKeyczar containing a new generated key of type. */ public static GenericKeyczar createKey(DefaultKeyType type, KeyPurpose purpose, final int size) throws KeyczarException { KeyMetadata metadata = new KeyMetadata("Key", purpose, type); KeyczarReader reader = new MemoryKeyReader(metadata, null); GenericKeyczar keyczar = new GenericKeyczar(reader); keyczar.addVersion(KeyStatus.PRIMARY, new RsaKeyParameters() { @Override public RsaPadding getRsaPadding() throws KeyczarException { return RsaPadding.OAEP; } @Override public int getKeySize() throws KeyczarException { return size; } }); return keyczar; } /** * Returns a KeyczarReader containing a new generated key of type. */ public static KeyczarReader generateKeyczarReader(DefaultKeyType type, KeyPurpose purpose) throws KeyczarException { return generateKeyczarReader(type, purpose, type.applyDefaultParameters(null).getKeySize()); } /** * Returns a KeyczarReader containing a new generated key of type. */ public static KeyczarReader generateKeyczarReader( DefaultKeyType type, KeyPurpose purpose, int size) throws KeyczarException { return readerFromKeyczar(createKey(type, purpose, size)); } /** * Writes input to a JSON file at path. */ public static void writeJsonToPath(GenericKeyczar input, String path) { try { FileOutputStream output = new FileOutputStream(path); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, "UTF-8")); JsonWriter.write(input, writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); } } public static Crypter crypterFromJson(String json) throws KeyczarException { KeyczarReader key = new KeyczarJsonReader(json); return new Crypter(key); } /** * Encrypts plaintext with a new session key, which is encrypted using crypter. The encrypted session * key and encrypted message are packed together using lenPrefixPack(). */ public static byte[] encryptWithSession(Encrypter crypter, byte[] plaintext) throws KeyczarException { // Create a session crypter SessionCrypter session = new SessionCrypter(crypter); byte[] rawEncrypted = session.encrypt(plaintext); byte[][] input = {session.getSessionMaterial(), rawEncrypted}; return org.keyczar.util.Util.lenPrefixPack(input); } /** * Decrypts message as a session by unpacking the encrypted session key, decrypting it with crypter, * then decrypting the message. */ public static byte[] decryptWithSession(Crypter crypter, byte[] ciphertext) throws KeyczarException { byte[][] unpacked = org.keyczar.util.Util.lenPrefixUnpack(ciphertext); SessionCrypter session = new SessionCrypter(crypter, unpacked[0]); return session.decrypt(unpacked[1]); } public static String encryptWithSession(Encrypter crypter, String plaintext) throws KeyczarException { try { return Base64Coder.encodeWebSafe(encryptWithSession(crypter, plaintext.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Should not happen", e); } } public static String decryptWithSession(Crypter crypter, String ciphertext) throws KeyczarException { try { return new String(decryptWithSession(crypter, Base64Coder.decodeWebSafe(ciphertext)), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Should not happen", e); } } // Hack to get access to KeyczarPrivateKey.getPublic(); see exportPublicKeys static final Method getPublicMethod; static { Class<?> iface; try { iface = Util.class.getClassLoader().loadClass("org.keyczar.KeyczarPrivateKey"); getPublicMethod = iface.getMethod("getPublic"); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } getPublicMethod.setAccessible(true); } /** * Returns a new Keyczar with public keys in privateKey. * * @throws KeyczarException */ // This is basically copied from GenericKeyczar.publicKeyExport, which is not public. // TODO: Get this into GenericKeyczar upstream? public static KeyczarReader exportPublicKeys(GenericKeyczar privateKey) throws KeyczarException { KeyMetadata kmd = privateKey.getMetadata(); // Can only export if type is *_PRIV KeyMetadata publicKmd = null; if (kmd.getType() == DefaultKeyType.DSA_PRIV) { if (kmd.getPurpose() == KeyPurpose.SIGN_AND_VERIFY) { publicKmd = new KeyMetadata(kmd.getName(), KeyPurpose.VERIFY, DefaultKeyType.DSA_PUB); } } else if (kmd.getType() == DefaultKeyType.RSA_PRIV) { switch (kmd.getPurpose()) { case DECRYPT_AND_ENCRYPT: publicKmd = new KeyMetadata(kmd.getName(), KeyPurpose.ENCRYPT, DefaultKeyType.RSA_PUB); break; case SIGN_AND_VERIFY: publicKmd = new KeyMetadata(kmd.getName(), KeyPurpose.VERIFY, DefaultKeyType.RSA_PUB); break; default: throw new IllegalArgumentException("Invalid key purpose: " + kmd.getPurpose()); } } if (publicKmd == null) { throw new KeyczarException( Messages.getString("KeyczarTool.CannotExportPubKey", kmd.getType(), kmd.getPurpose())); } HashMap<Integer, KeyczarKey> keys = new HashMap<Integer, KeyczarKey>(); for (KeyVersion version : privateKey.getVersions()) { // hack to work around keyczar's accessibility limits try { KeyczarKey key = privateKey.getKey(version); KeyczarKey publicKey = (KeyczarKey) getPublicMethod.invoke(key); publicKmd.addVersion(version); keys.put(version.getVersionNumber(), publicKey); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } } return new MemoryKeyReader(publicKmd, keys); } /** * Create a KeyczarReader from an existing key. Useful for creating a GenericKeyczar * to manipulate a keyset, then "re-open" the key as the correct type to use it * Example: Crypter crypter = new Crypter(Util.readerFromKeyczar(keyczar)); * * @param keyczar * @return */ public static KeyczarReader readerFromKeyczar(GenericKeyczar keyczar) { HashMap<Integer, KeyczarKey> keys = new HashMap<Integer, KeyczarKey>(); for (KeyVersion v : keyczar.getVersions()) { keys.put(v.getVersionNumber(), keyczar.getKey(v)); } return new MemoryKeyReader(keyczar.getMetadata(), keys); } /** * Basically a copy of ImportedKeyReader which is not public. */ public static final class MemoryKeyReader implements KeyczarReader { private final KeyMetadata metadata; private final Map<Integer, KeyczarKey> keys; public MemoryKeyReader(KeyMetadata metadata, Map<Integer, KeyczarKey> keys) { this.metadata = metadata; this.keys = keys; assert keys == null || metadata.getVersions().size() == keys.size(); } @Override public String getKey(int version) throws KeyczarException { return keys.get(version).toString(); } @Override public String getKey() throws KeyczarException { return keys.get(metadata.getPrimaryVersion().getVersionNumber()).toString(); } @Override public String getMetadata() throws KeyczarException { return metadata.toString(); } } }
ceb919f89142035190ad26ee8fdd6229f77b679f
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/MATH-84b-2-16-Single_Objective_GGA-IntegrationSingleObjective-/org/apache/commons/math/optimization/direct/MultiDirectional_ESTest.java
5beff56957a020602c2bbad8eaf395c61fca72c3
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
1,580
java
/* * This file was automatically generated by EvoSuite * Mon May 18 03:25:56 UTC 2020 */ package org.apache.commons.math.optimization.direct; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import java.util.Comparator; import org.apache.commons.math.optimization.OptimizationException; import org.apache.commons.math.optimization.RealPointValuePair; import org.apache.commons.math.optimization.direct.MultiDirectional; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class MultiDirectional_ESTest extends MultiDirectional_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { double double0 = 1481.683738566; double double1 = 0.292; MultiDirectional multiDirectional0 = new MultiDirectional(1481.683738566, 0.292); int int0 = (-2565); multiDirectional0.setMaxIterations((-2565)); Comparator<RealPointValuePair> comparator0 = null; try { multiDirectional0.iterateSimplex((Comparator<RealPointValuePair>) null); fail("Expecting exception: OptimizationException"); } catch(OptimizationException e) { // // org.apache.commons.math.MaxIterationsExceededException: Maximal number of iterations (-2,565) exceeded // verifyException("org.apache.commons.math.optimization.direct.DirectSearchOptimizer", e); } } }
0fe3e4cebf293b412609d3a5f8bdbd467ea29f8f
25492051f9151f5e6a557b7f72f29e5c9cf5b7ee
/src/iPadDpChecklist/MainActivity.java
293249edd693e97226554f2aa93410ece3b5e2ee
[]
no_license
jamesfdz/Checklist-Creation-Tool
40af1f01a933b3217a8770d4404db87692a85a1f
c34cd9185e06d02e4c418d3cc1b6dda3d43c20e5
refs/heads/master
2021-08-17T23:05:20.445203
2020-04-08T11:12:15
2020-04-08T11:12:15
155,890,482
0
0
null
null
null
null
UTF-8
Java
false
false
20,396
java
package iPadDpChecklist; import static java.awt.SystemColor.window; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import static java.lang.Integer.parseInt; import java.math.BigDecimal; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.logging.FileHandler; import java.util.logging.Logger; import java.util.logging.SimpleFormatter; import java.util.regex.Pattern; import java.util.regex.Matcher; import javax.swing.JOptionPane; import static jdk.nashorn.internal.objects.NativeMath.round; import org.apache.poi.common.usermodel.HyperlinkType; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Hyperlink; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFHyperlink; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.apache.poi.ss.usermodel.CreationHelper; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFFont; public class MainActivity { public static final String URL = "https://login.veevavault.com/"; public static Logger logger = Logger.getLogger("MyLog"); public static FileHandler fh; public static void main(String[] args) throws MalformedURLException, FileNotFoundException, IOException { // TODO Auto-generated method stub List<String> allfileSizes = new ArrayList<String>(); try{ //open browser System.setProperty("webdriver.chrome.driver","chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get(URL); WebElement usernameField = driver.findElement(By.id("j_username")); //takes input from excel FileInputStream fs = new FileInputStream("input.xlsx"); XSSFWorkbook inputWorkbook = new XSSFWorkbook(fs); Sheet inputSheet = inputWorkbook.getSheet("Sheet1"); Row row1 = inputSheet.getRow(0); Cell cell0 = row1.getCell(0); String username = cell0.getStringCellValue(); System.out.println(username); usernameField.sendKeys(username); usernameField.sendKeys(Keys.ENTER); new WebDriverWait(driver, 3000).until(ExpectedConditions.visibilityOfElementLocated(By.id("j_password"))); WebElement passwordField = driver.findElement(By.id("j_password")); Row row2 = inputSheet.getRow(1); Cell cell1 = row2.getCell(0); String password = cell1.getStringCellValue(); passwordField.sendKeys(password); System.out.println(password); passwordField.sendKeys(Keys.ENTER); new WebDriverWait(driver, 3000).until(ExpectedConditions.visibilityOfElementLocated(By.id("search_main_box"))); driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); WebElement searchField = driver.findElement(By.id("search_main_box")); Row row3 = inputSheet.getRow(2); Cell cell2 = row3.getCell(0); String searchString = cell2.getStringCellValue(); searchField.sendKeys(searchString); searchField.sendKeys(Keys.ENTER); System.out.println(searchString); new WebDriverWait(driver, 2000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@title='Detail View']"))); WebElement detailView = driver.findElement(By.xpath("//*[@title='Detail View']")); detailView.click(); new WebDriverWait(driver, 2000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("(//*[@class='docLink vv_doc_title_link'])[1]"))); WebElement presentationTitle = driver.findElement(By.xpath("(//*[@class='docLink vv_doc_title_link'])[1]")); presentationTitle.click(); new WebDriverWait(driver, 2000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@attrkey='name']"))); WebElement PresentationNameElement = driver.findElement(By.xpath("//*[@attrkey='name']")); WebElement PresentationBinderElement = driver.findElement(By.xpath("//*[@attrkey='DocumentNumber']")); WebElement PresentationZincIdElement = driver.findElement(By.xpath("//*[@attrkey='zincId']")); String PresentationNameText = PresentationNameElement.getText(); String PresentationBinderText = PresentationBinderElement.getText(); String PresentationZincIdText = PresentationZincIdElement.getText(); System.out.println(PresentationNameText); System.out.println(PresentationBinderText); System.out.println(PresentationZincIdText); FileInputStream fis = new FileInputStream("output.xlsx"); XSSFWorkbook outputWorkbook = new XSSFWorkbook(fis); Sheet outputSheet = outputWorkbook.getSheet("Checklist1"); CreationHelper createHelper = outputWorkbook.getCreationHelper(); XSSFCellStyle hlinkstyle = outputWorkbook.createCellStyle(); XSSFFont hlinkfont = outputWorkbook.createFont(); hlinkfont.setUnderline(XSSFFont.U_SINGLE); hlinkfont.setColor(HSSFColor.BLUE.index); hlinkstyle.setFont(hlinkfont); Cell NameCell = null; Cell BinderCell = null; Cell ZincIdCell = null; NameCell = outputSheet.getRow(12).getCell(1); NameCell.setCellValue(PresentationNameText); BinderCell = outputSheet.getRow(14).getCell(1); BinderCell.setCellValue(PresentationBinderText); ZincIdCell = outputSheet.getRow(22).getCell(1); ZincIdCell.setCellValue(PresentationZincIdText); String presentationUrl = driver.getCurrentUrl(); XSSFHyperlink presentationUrlLink = (XSSFHyperlink)createHelper.createHyperlink(HyperlinkType.URL); presentationUrlLink.setAddress(presentationUrl); NameCell.setHyperlink(presentationUrlLink); NameCell.setCellStyle(hlinkstyle); String presentationIdUrl = driver.getCurrentUrl(); XSSFHyperlink presentationIdUrlLink = (XSSFHyperlink)createHelper.createHyperlink(HyperlinkType.URL); presentationIdUrlLink.setAddress(presentationIdUrl); BinderCell.setHyperlink(presentationIdUrlLink); BinderCell.setCellStyle(hlinkstyle); WebElement multichannelProperties = driver.findElement(By.xpath("//*[@key='multichannelProperties']")); multichannelProperties.click(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); new WebDriverWait(driver, 3000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@attrkey='crmPresentationId_b']"))); WebElement PresentationIdElement = driver.findElement(By.xpath("//*[@attrkey='crmPresentationId_b']")); String PresentationIdText = PresentationIdElement.getText(); System.out.println(PresentationIdText); Cell PidCell = null; PidCell = outputSheet.getRow(13).getCell(1); PidCell.setCellValue(PresentationIdText); String pidUrl = driver.getCurrentUrl(); XSSFHyperlink pidUrlLink = (XSSFHyperlink)createHelper.createHyperlink(HyperlinkType.URL); pidUrlLink.setAddress(pidUrl); PidCell.setHyperlink(pidUrlLink); PidCell.setCellStyle(hlinkstyle); WebElement ClmProperties = driver.findElement(By.xpath("//*[@key='clmProperties']")); ClmProperties.click(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); new WebDriverWait(driver, 3000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@attrkey='crmEndDate_b']"))); WebElement PresentationEndDateElement = driver.findElement(By.xpath("//*[@attrkey='crmEndDate_b']")); String PresentationEndDate = PresentationEndDateElement.getText(); System.out.println(PresentationEndDate); Cell endDateCell = null; endDateCell = outputSheet.getRow(11).getCell(1); endDateCell.setCellValue(PresentationEndDate); new WebDriverWait(driver, 3000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@class='docNameLink vv_doc_title_link veevaTooltipBound']"))); List<WebElement> slideNames = driver.findElements(By.xpath("//*[@class='docNameLink vv_doc_title_link veevaTooltipBound']")); System.out.println(slideNames.size()); Cell docTitle = null; List<String> slideLinks = new ArrayList<String>(); int initialRowNumber = 25; for(WebElement slideName : slideNames){ docTitle = outputSheet.getRow(initialRowNumber).getCell(0); String slideNameText = slideName.getText(); docTitle.setCellValue(slideNameText); String slideNameLink = slideName.getAttribute("href"); slideLinks.add(slideNameLink); System.out.println(slideNameLink); XSSFHyperlink docTitlelink = (XSSFHyperlink)createHelper.createHyperlink(HyperlinkType.URL); docTitlelink.setAddress(slideNameLink); docTitle.setHyperlink((XSSFHyperlink) docTitlelink); docTitle.setCellStyle(hlinkstyle); System.out.println(slideName.getText()); initialRowNumber++; } List<WebElement> slideNums = driver.findElements(By.xpath("//*[@class='docNumber vv_doc_number']")); System.out.println(slideNames.size()); Cell docNumber = null; int initialRowNumberForBinder = 25; for(WebElement slideNum : slideNums){ docNumber = outputSheet.getRow(initialRowNumberForBinder).getCell(1); String slideNumText = slideNum.getText(); docNumber.setCellValue(slideNumText); System.out.println(slideNumText); initialRowNumberForBinder++; } WebElement firstDocElementScrolling = driver.findElement(By.id("search_main_box")); System.out.println("Going up"); ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView();", firstDocElementScrolling); new WebDriverWait(driver, 3000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@listidx='0']//div[@class='docInfo vv_doc_detail_content vv_col']//a[@class='docNameLink vv_doc_title_link veevaTooltipBound']"))); WebElement firstDocElement = driver.findElement(By.xpath("//*[@listidx='0']//div[@class='docInfo vv_doc_detail_content vv_col']//a[@class='docNameLink vv_doc_title_link veevaTooltipBound']")); firstDocElement.click(); new WebDriverWait(driver, 3000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@key='related_shared_resource__pm']"))); WebElement relatedSharedElementCheck = driver.findElement(By.xpath("//*[@key='related_shared_resource__pm']//span[@class='count vv_section_count']")); String relatedSharedElementCheckString = relatedSharedElementCheck.getText(); System.out.println(relatedSharedElementCheckString); if(relatedSharedElementCheckString.equals("(0)")){ System.out.println("No shared Resource"); }else{ WebElement relatedSharedElement = driver.findElement(By.xpath("//*[@key='related_shared_resource__pm']")); relatedSharedElement.click(); new WebDriverWait(driver, 3000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@class='vv_rd_c2']//a[@class='docName doc_link veevaTooltipBound']"))); WebElement sharedResource = driver.findElement(By.xpath("//*[@class='vv_rd_c2']//a[@class='docName doc_link veevaTooltipBound']")); sharedResource.click(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); new WebDriverWait(driver, 5000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@class='prev_page']"))); WebElement sharedResourceNameElement = driver.findElement(By.xpath("//*[@attrkey='name']")); String sharedNameText = sharedResourceNameElement.getText(); WebElement sharedDocNumber = driver.findElement(By.xpath("//*[@attrkey='DocumentNumber']")); String sharedNumText = sharedDocNumber.getText(); WebElement sharedRenditions = driver.findElement(By.xpath("//*[@key='renditions']")); sharedRenditions.click(); new WebDriverWait(driver, 5000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("(//*[@class='fileSize'])[1]"))); WebElement sharedFileSizeEm = driver.findElement(By.xpath("(//*[@class='fileSize'])[1]")); String sharedFileSizeText = sharedFileSizeEm.getText(); System.out.println("shared: " + sharedNameText); System.out.println("sharedNum: " + sharedNumText); System.out.println("shared File Size" + sharedFileSizeText); Cell sharedName = null; Cell sharedNum = null; sharedName = outputSheet.getRow(18).getCell(1); sharedName.setCellValue(sharedNameText); sharedNum = outputSheet.getRow(19).getCell(1); sharedNum.setCellValue(sharedNumText); String currentURL = driver.getCurrentUrl(); XSSFHyperlink sharedLinkForName = (XSSFHyperlink)createHelper.createHyperlink(HyperlinkType.URL); sharedLinkForName.setAddress(currentURL); sharedName.setHyperlink(sharedLinkForName); String currentURL1 = driver.getCurrentUrl(); XSSFHyperlink sharedLinkForNum = (XSSFHyperlink)createHelper.createHyperlink(HyperlinkType.URL); sharedLinkForNum.setAddress(currentURL1); sharedNum.setHyperlink(sharedLinkForNum); allfileSizes.add(sharedFileSizeText); } int initialRowForBinder = 25; for(String slideLink : slideLinks){ System.out.println(slideLink); Cell binder_cell = outputSheet.getRow(initialRowForBinder).getCell(1); XSSFHyperlink binder_cell_link = (XSSFHyperlink)createHelper.createHyperlink(HyperlinkType.URL); binder_cell_link.setAddress(slideLink); binder_cell.setHyperlink(binder_cell_link); binder_cell.setCellStyle(hlinkstyle); initialRowForBinder++; } driver.close(); for(String slideLink : slideLinks){ System.setProperty("webdriver.chrome.driver","chromedriver.exe"); WebDriver newDriver = new ChromeDriver(); newDriver.manage().window().maximize(); newDriver.get(slideLink); new WebDriverWait(newDriver, 5000).until(ExpectedConditions.visibilityOfElementLocated(By.id("j_username"))); WebElement newusernameField = newDriver.findElement(By.id("j_username")); newusernameField.sendKeys(username); newusernameField.sendKeys(Keys.ENTER); new WebDriverWait(newDriver, 5000).until(ExpectedConditions.visibilityOfElementLocated(By.id("j_password"))); WebElement newpasswordField = newDriver.findElement(By.id("j_password")); newpasswordField.sendKeys(password); newpasswordField.sendKeys(Keys.ENTER); new WebDriverWait(newDriver, 5000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@key='renditions']"))); WebElement renditions = newDriver.findElement(By.xpath("//*[@key='renditions']")); renditions.click(); new WebDriverWait(newDriver, 5000).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("(//*[@class='fileSize'])[1]"))); WebElement fileSizeEm = newDriver.findElement(By.xpath("(//*[@class='fileSize'])[1]")); newDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); String fileSizeTxt = fileSizeEm.getText(); System.out.println(fileSizeTxt); allfileSizes.add(fileSizeTxt); newDriver.close(); } String searchKB = "KB"; List<Float> MBfileSizes = new ArrayList<Float>(); List<Float> KBfileSizes = new ArrayList<Float>(); for(String fileSize : allfileSizes){ if(fileSize.contains(searchKB)){ //Spilt number and kb String[] partKB = fileSize.split(" "); System.out.println(partKB[0]); KBfileSizes.add(Float.parseFloat(partKB[0])); System.out.println("Added to KB list"); }else{ //spilt number and mb String[] partMB = fileSize.split(" "); System.out.println(partMB[0]); MBfileSizes.add(Float.parseFloat(partMB[0])); System.out.println("Added to MB list"); } } for(Float KBfileSize : KBfileSizes){ Float convertedtoMB = KBfileSize / 1024; BigDecimal bd = new BigDecimal(convertedtoMB); bd = bd.setScale(2, BigDecimal.ROUND_HALF_UP); Float finalValue = bd.floatValue(); System.out.println(finalValue); MBfileSizes.add(finalValue); System.out.println("Converted from KB to MB and added to list"); } float sum = 0; for(Float MBfileSize : MBfileSizes){ sum += MBfileSize; } BigDecimal bd1 = new BigDecimal(sum); bd1 = bd1.setScale(2, BigDecimal.ROUND_HALF_UP); Float finalValue1 = bd1.floatValue(); String SumOfAll = Float.toString(finalValue1); System.out.println(SumOfAll); Cell fileSizeCell = null; fileSizeCell = outputSheet.getRow(23).getCell(1); fileSizeCell.setCellValue(SumOfAll + " MB"); System.out.println("Final Answer: " + SumOfAll + " MB"); fis.close(); FileOutputStream output = new FileOutputStream(new File("output.xlsx")); outputWorkbook.write(output); output.close(); JOptionPane.showMessageDialog(null, "Completed Successfully"); }catch(Exception e){ fh = new FileHandler("LogFile.log"); logger.addHandler(fh); SimpleFormatter formatter = new SimpleFormatter(); fh.setFormatter(formatter); // the following statement is used to log any messages logger.info("" + e.getLocalizedMessage()); } } }
58e901cec783bc9d5a2aa93120a744907924c2e4
480883d7496ce8dd7f4e7e97d95814234641564d
/src/com/pancats/view/module/site/SiteOperate.java
6ea927ab053a6644fb92ba9099b0ee0dc87664bc
[]
no_license
MrLeiPan/PancatsBlogManager
822ffbab263f8dd65e7c66daf91bf1535ec99d6f
8509d00f908f8fb28a4fcfc3be34140975eb2268
refs/heads/master
2020-04-08T10:46:04.323976
2018-11-29T15:36:41
2018-11-29T15:36:41
158,995,872
0
0
null
null
null
null
UTF-8
Java
false
false
1,100
java
package com.pancats.view.module.site; import java.awt.Dimension; import java.util.List; import javax.swing.JPanel; import com.pancats.domain.Site; import com.pancats.view.component.utlis.DefaultTableData; import com.pancats.view.component.utlis.MyTableModel; import com.pancats.view.component.utlis.Operate; import com.pancats.view.component.utlis.OperateModel; import com.pancats.view.component.utlis.TableDatas; public class SiteOperate implements Operate<Site>{ private OperateModel om=null; private Object[] columnNames=null; private TableDatas<Site> td=null; public SiteOperate(Dimension ds) { om= new OperateModel(ds); } public void setTitle(String title) { om.setTitle(title); } public void setColumnNames(Object[] columnNames) { this.columnNames=columnNames; } public void initData(List<Site> datalist) { td=new TableDatas<>(datalist,Site.class); DefaultTableData dtd = new DefaultTableData(columnNames, td.getDatas()); om.setData(new MyTableModel(dtd)); } public JPanel getOperate() { return om.getOperatePanel(); } }
dec3f9ad0cc92527755c1f01a261ce29e85117e7
92ae37b86b554dfcc39d132266afe7c6059f613f
/src/main/java/org/example/axonspringgradle/domain/event/CardLimitChangedEvent.java
f9b69ba8218fac2d093fcc9f57a01c3d4d423f00
[]
no_license
offspringer/axon-spring-gradle
3f0af152e7697e3ff9323eadf720a1b3e0fc5f7a
b621a1c75cb3e18a77b14e35f7e024132fc95247
refs/heads/main
2023-05-07T04:38:35.165161
2021-05-30T23:02:47
2021-05-30T23:02:47
372,331,334
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package org.example.axonspringgradle.domain.event; import lombok.Getter; @Getter public class CardLimitChangedEvent extends BaseEvent<String> { private final String cardId; private final double limit; public CardLimitChangedEvent(String id, String cardId, double limit) { super(id); this.cardId = cardId; this.limit = limit; } }
30a1de11e7996ca32170c4f66adab0a5fa2764c9
792a5cffef4834c1c80d637f01cc69c7dfe9a51f
/app/src/main/java/com/example/android/myapplication/models/main/MainModel.java
6d815462ae129529cbd1d3c2b86c5b6510db885a
[]
no_license
mikkelofficial7/Android-Udacity-Advance
29933d86be13da125add1b0fb9d1cb38f0dcc22e
3fc065e0a402e6649416a589bfc1b59f2ef81b68
refs/heads/master
2021-01-22T10:56:25.238827
2017-05-28T13:42:23
2017-05-28T13:42:23
92,662,005
0
0
null
null
null
null
UTF-8
Java
false
false
183
java
package com.example.android.myapplication.models.main; import okhttp3.Request; /** * Created by Yosefricaro on 14/05/2017. */ public interface MainModel { Request build(); }
cc17064da931d9ebad19976987f7fdc40ee10aae
c565eb8f97f6852cf269f6c23a2334f260c08ea8
/src/main/java/com/phi/proyect/controller/ProcedimientoController.java
e1f237f2dc558f0161154fa46d8af8c2d28fbb02
[]
no_license
JuannAnntonio/Casa-Bolsa
ed5109bd50425728f8c7855a80ead48dffb69a44
60de88ed25b6da3adad5e3bf738f1b919534d6ac
refs/heads/main
2023-06-17T23:27:40.530332
2021-07-03T16:28:16
2021-07-03T16:28:16
350,518,735
0
1
null
null
null
null
UTF-8
Java
false
false
2,809
java
package com.phi.proyect.controller; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.databind.node.ObjectNode; import com.phi.proyect.service.DivisasService; @RestController @CrossOrigin(origins = "*", allowedHeaders = "*") @RequestMapping("/procedimiento") public class ProcedimientoController { private final DivisasService dvs; public ProcedimientoController(DivisasService dvs) { super(); this.dvs=dvs; } @GetMapping("/DistEst/{valor}") public float ejecutarProcedure(@PathVariable("valor") double valor) { float retornoValor = dvs.distEst(valor); return retornoValor; } @PostMapping("/VaRCapFloor") public double VaRCapFloor(@RequestBody ObjectNode obj) { String CdTransaccion = obj.get("CdTransaccion").asText(); Integer CdCurva = obj.get("CdCurva").asInt(); String fecha = obj.get("LdFecha").asText(); Date LdFecha = null; Integer CdCDescuento = obj.get("CdCDescuento").asInt(); try { LdFecha = new SimpleDateFormat("yyyy-MM-dd").parse(fecha); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } double retornoValor = dvs.VaRCapFloor(CdTransaccion, CdCurva, LdFecha, CdCDescuento); return retornoValor; } @PostMapping("/VaRFwdSwapStarting") public double VaRFwdSwapStarting(@RequestBody ObjectNode obj) { String CdTransaccion = obj.get("CdTransaccion").asText(); Integer CdCurva = obj.get("CdCurva").asInt(); String fecha = obj.get("LdFecha").asText(); Date LdFecha = null; try { LdFecha = new SimpleDateFormat("yyyy-MM-dd").parse(fecha); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } double retornoValor = dvs.VaRFwdSwapStarting(CdTransaccion, CdCurva, LdFecha); return retornoValor; } @PostMapping("/VaRSwapTIIE") public double VaRSwapTIIE(@RequestBody ObjectNode obj) { String CdTransaccion = obj.get("CdTransaccion").asText(); Integer CdCurva = obj.get("CdCurva").asInt(); String fecha = obj.get("LdFecha").asText(); Date LdFecha = null; try { LdFecha = new SimpleDateFormat("yyyy-MM-dd").parse(fecha); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } double retornoValor = dvs.VaRSwapTIIE(CdTransaccion, CdCurva, LdFecha); return retornoValor; } }
280f2aa5b0c1a5ccdb41c4e216348ac9f755400d
45bad237680a041452a473d5e39358c06cd440f3
/pier-exchange/src/main/java/com/pier/exchange/util/Parameters.java
ac08095ce121d75769f3bb5eaa815a841aafdc5f
[]
no_license
xzry6/pier_exchange
51b51b11bf48912ac1999cdf307759b881e952b0
0cb05602c93a9e4257d8cf7645561fc92c606cd2
refs/heads/master
2020-06-30T03:51:08.972757
2015-07-02T02:21:27
2015-07-02T02:21:27
38,088,233
0
0
null
null
null
null
UTF-8
Java
false
false
5,937
java
package com.pier.exchange.util; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.message.BasicNameValuePair; public class Parameters { public static void setLinkedIn(HttpRequestBase request) { request.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); request.setHeader("Accept-Language","zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3"); request.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.2; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0"); request.setHeader("Accept-Encoding","gzip, deflate"); request.setHeader("Host","www.linkedin.com"); request.setHeader("Connection","keep-alive"); if(request.getClass().toString().equals("class org.apache.http.client.methods.HttpPost")) { request.setHeader("Referer","https://www.linkedin.com/nhome/"); request.setHeader("Cookie", "lang=\"v=2&lang=en-us\"; JSESSIONID=\"ajax:4384913756679411556\"; bcookie=\"v=2&e53ff59a-9c5e-4d6a-8d8b-e91a721be3e5\"; bscookie=\"v=1&2015052608445162a22d18-1607-4777-851f-6bdf51d9a4fdAQFrksZwkq0q5BHOXTN7S2hx_pGmMOMd\"; lidc=\"b=VB63:g=181:u=1:i=1432723205:t=1432809605:s=AQE3VtuzlPp9-eOWQ4iFe6NGm0Aoc-o5\"; visit=\"v=1&M\"; L1e=390560fd; L1c=f30616b; __utma=226841088.1536829439.1432629938.1432629938.1432723302.2; __utmc=226841088; __utmz=226841088.1432723302.2.2.utmcsr=baidu|utmccn=(organic)|utmcmd=organic; __utmv=226841088.guest; _lipt=0_1-m7N8hG_p9JyMYw312193Dzhv80mFhF-C37B2_uiGeC-2vTRqdAjqWolR_r8z7RTY3Q5s8Tl6vtU19Rlkj3mVTL8uI7ct4KLOhWkYRlg-hc5e9kTPeDwnVSPHYUjdk5-xv7xfs1Mo1M7UWW6jMvdp9dgTMU2TBk_5oDNlUR6icL2Tv1fozxN4o65YeU_7IBEck0xxMUWLJbna_mp5OpG2l0TELPoDD7jSN3jVjQbil7yH_z8CK8J0iUrHl-H4UXb3QrwoVOBDQx4XUNub_6ld; share_setting=PUBLIC; sdsc=1%3A1SZM1shxDNbLt36wZwCgPgvN58iw%3D; oz_props_fetch_size1_318216681=1; leo_auth_token=\"GST:8OJ1tPAUz6DlBs-1oRbuR-z7t2PgM7pP8miuLoKI1PDoHuV5_JRz-m:1432723325:2730a708c93d5c43281a5a22bf44eb2e89a9bd90\"; __utmb=226841088.6.10.1432723302; __utmt=1"); } if(request.getClass().toString().equals("class org.apache.http.client.methods.HttpGet")) { request.setHeader("Referer",""); request.setHeader("Cookie", "lang=\"v=2&lang=en-us\"; JSESSIONID=\"ajax:4384913756679411556\"; bcookie=\"v=2&e53ff59a-9c5e-4d6a-8d8b-e91a721be3e5\"; lidc=\"b=VB63:g=181:u=1:i=1432723205:t=1432809605:s=AQE3VtuzlPp9-eOWQ4iFe6NGm0Aoc-o5\"; visit=\"v=1&M\"; L1e=390560fd; L1c=f30616b; __utma=226841088.1536829439.1432629938.1432629938.1432723302.2; __utmc=226841088; __utmz=226841088.1432723302.2.2.utmcsr=baidu|utmccn=(organic)|utmcmd=organic; __utmv=226841088.guest; _lipt=0_1-m7N8hG_p9JyMYw312193Dzhv80mFhF-C37B2_uiGeC-2vTRqdAjqWolR_r8z7RTY3Q5s8Tl6vtU19Rlkj3mVTL8uI7ct4KLOhWkYRlg-hc5e9kTPeDwnVSPHYUjdk5-xv7xfs1Mo1M7UWW6jMvdp9dgTMU2TBk_5oDNlUR6icL2Tv1fozxN4o65YeU_7IBEck0xxMUWLJbna_mp5OpG2l0TELPoDD7jSN3jVjQbil7yH_z8CK8J0iUrHl-H4UXb3QrwoVOBDQx4XUNub_6ld; share_setting=PUBLIC; sdsc=1%3A1SZM1shxDNbLt36wZwCgPgvN58iw%3D; oz_props_fetch_size1_318216681=1; __utmb=226841088.6.10.1432723302; __utmt=1; li_at=AQECARL3mekA_4bbAAABTZT3ZF4AAAFNlWVBXk2PI0i-lyH6Ea4mOLU9W6AK-GDnD7ITeo6BfSRDpHmz5cG6997b8iwsLA29x0wWPuNer73E1ihfpsIWhj7BKIOd5t1R-qomuNcoRdhcp2NhRB4MJKo");//+li_at); } } public static void setBOC(HttpRequestBase request) { request.setHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); request.setHeader("Accept-Encoding","gzip, deflate"); request.setHeader("Accept-Language","zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3"); request.setHeader("Connection","keep-alive"); request.setHeader("Cookie", "JSESSIONID=0000f9KaOFNclYZ3OM5cup1bR4U:-1"); request.setHeader("Host","srh.bankofchina.com"); request.setHeader("Referer", "http://srh.bankofchina.com/search/whpj/search.jsp"); request.setHeader("User-Agent","Mozilla/5.0 (Windows NT 6.2; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0"); } public static HttpPost setBOC(String url) { HttpPost request = new HttpPost(url); List<NameValuePair>list = new ArrayList<NameValuePair>(); list.add(new BasicNameValuePair("erectDate","")); list.add(new BasicNameValuePair("nothing","")); list.add(new BasicNameValuePair("pjname","1316")); try { request.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); } catch(UnsupportedEncodingException e){ e.printStackTrace(); } return request; } public static HttpPost setLinkedIn(String url, String user, String pwd){ HttpPost request = new HttpPost(url); List<NameValuePair>list = new ArrayList<NameValuePair>(); list.add(new BasicNameValuePair("client_n","718602494:212332562:346061556")); list.add(new BasicNameValuePair("client_output","-222948414")); list.add(new BasicNameValuePair("client_r",user+":718602494:212332562:346061556")); list.add(new BasicNameValuePair("client_ts","1432723389667")); list.add(new BasicNameValuePair("client_v","1.0.1")); list.add(new BasicNameValuePair("csrfToken","ajax:4384913756679411556")); list.add(new BasicNameValuePair("fromEmail","")); list.add(new BasicNameValuePair("isJsEnabled","true")); list.add(new BasicNameValuePair("loginCsrfParam","e53ff59a-9c5e-4d6a-8d8b-e91a721be3e5")); list.add(new BasicNameValuePair("session_key",user)); list.add(new BasicNameValuePair("session_password",pwd)); list.add(new BasicNameValuePair("session_redirect",null)); list.add(new BasicNameValuePair("signin","Sign In")); list.add(new BasicNameValuePair("sourceAlias","0_7r5yezRXCiA_H0CRD8sf6DhOjTKUNps5xGTqeX8EEoi")); list.add(new BasicNameValuePair("source_app",null)); list.add(new BasicNameValuePair("trk",null)); try { request.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); } catch(UnsupportedEncodingException e){ e.printStackTrace(); } return request; } }
ec43555fbc5523cf6d7ebfdaac981677e5a32ff8
6621222397d5be7ac0db1bae04afc509be235929
/app/src/main/java/com/example/basic/room/FacultyDatabase.java
db55ada3c61f46497996f7af9b8b1cce1fbd5eee
[]
no_license
Wanjohi-Erick/Attendance
598c771fb73bc1962e9a733b228cfcb35d9c9952
cc851247fbe6495c07508df0c0c96c56ed87b3cb
refs/heads/master
2023-09-06T07:50:12.653535
2021-11-17T02:53:20
2021-11-17T02:53:20
422,060,697
0
0
null
null
null
null
UTF-8
Java
false
false
703
java
package com.example.basic.room; import android.content.Context; import androidx.room.Database; import androidx.room.Room; import androidx.room.RoomDatabase; @Database(entities = Faculty.class, version = 1) public abstract class FacultyDatabase extends RoomDatabase { public abstract FacultyDao facultyDao(); public static FacultyDatabase facultyDatabase; public static FacultyDatabase getAllFaculty(Context context) { if (facultyDatabase == null) { facultyDatabase = Room.databaseBuilder(context.getApplicationContext(), FacultyDatabase.class, "facultyDatabase") .allowMainThreadQueries().build(); } return facultyDatabase; } }
445d7e166c615b923949a26d779bf32f261ad48b
3c38f016c3031d34df208c8e1cbdbc6b4c5e9935
/Ch08-Object/src/com/inter1/InterfaceEx01.java
0ba5887aa7c528100c01128f1b58eb897da6e338
[]
no_license
mellamonaranja/JAVA_Academy_Eng
a26d2ecd3b68aeaf8d3c66b7f90e25349cf7e0b7
bd5e8c9596babefe3c530f0e5c7b44afc8c30432
refs/heads/master
2022-03-20T20:42:39.765692
2019-12-04T14:27:32
2019-12-04T14:27:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
610
java
package com.inter1; interface InterfaceTest{ public static final int A=100; // element 1 : constant public abstract int getA(); // element 2 : abstract } public class InterfaceEx01 implements InterfaceTest{ // elements of InterfaceTest is inherited @Override public int getA() { return A; // after override from interface and then create signature } public static void main(String[] args) { // InterfaceTest test=new InterfaceTest(); // impossible to create the object InterfaceEx01 inter01 = new InterfaceEx01(); System.out.println(inter01.getA()); } }
04fbe40fcf8e9d3dd906203c2ebfb0f6154af1fd
7ca8ffcdfb39ab4ffc2d8ff291e46ffabc8db6a2
/hadoop-cloud-storage-project/hadoop-cos/src/main/java/org/apache/hadoop/fs/cosn/ByteBufferOutputStream.java
9e6a6fc5f36634d278f60b69164c0b4cd893608d
[ "CC-PDDC", "CC0-1.0", "CC-BY-3.0", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "CDDL-1.0", "GCC-exception-3.1", "MIT", "EPL-1.0", "Classpath-exception-2.0", "BSD-3-Clause", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-jdom", "CDDL-1.1", "BSD-2-Clause", "LicenseRef-scancode-unknown" ]
permissive
apache/hadoop
ea2a4a370dd00d4a3806dd38df5b3cf6fd5b2c64
42b4525f75b828bf58170187f030b08622e238ab
refs/heads/trunk
2023-08-18T07:29:26.346912
2023-08-17T16:56:34
2023-08-17T16:56:34
23,418,517
16,088
10,600
Apache-2.0
2023-09-14T16:59:38
2014-08-28T07:00:08
Java
UTF-8
Java
false
false
2,137
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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.fs.cosn; import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; /** * The input stream class is used for buffered files. * The purpose of providing this class is to optimize buffer write performance. */ public class ByteBufferOutputStream extends OutputStream { private ByteBuffer byteBuffer; private boolean isFlush; private boolean isClosed; public ByteBufferOutputStream(ByteBuffer byteBuffer) throws IOException { if (null == byteBuffer) { throw new IOException("byte buffer is null"); } this.byteBuffer = byteBuffer; this.byteBuffer.clear(); this.isFlush = false; this.isClosed = false; } @Override public void write(int b) { byte[] singleBytes = new byte[1]; singleBytes[0] = (byte) b; this.byteBuffer.put(singleBytes, 0, 1); this.isFlush = false; } @Override public void flush() { if (this.isFlush) { return; } this.isFlush = true; } @Override public void close() throws IOException { if (this.isClosed) { return; } if (null == this.byteBuffer) { throw new IOException("Can not close a null object"); } this.flush(); this.byteBuffer.flip(); this.byteBuffer = null; this.isFlush = false; this.isClosed = true; } }
1994cc14e2246b61e752d083ea5a86cf8c51882a
f258004690860ab810cea009e350568cf7281072
/fragmentdemo/src/main/java/com/qianfeng/fragmentdemo/fragment/MyFragment.java
d0337d2d64cffc0a99961df0800bc7131228f4e7
[]
no_license
dl7941786/AndroidBaseD
625087d7c4029ef192edb382cc741ad6467bee2e
06f8c723fb0a9ad0e1ceaba7a4f14cab8365553b
refs/heads/master
2021-01-11T00:21:04.155708
2016-10-11T01:32:04
2016-10-11T01:32:04
70,543,958
1
1
null
null
null
null
UTF-8
Java
false
false
5,916
java
package com.qianfeng.fragmentdemo.fragment; // _ooOoo_ // o8888888o // 88" . "88 // (| -_- |) // O\ = /O // ____/`---'\____ // . ' \\| |// `. // / \\||| : |||// \ // / _||||| -:- |||||- \ // | | \\\ - /// | | // | \_| ''\---/'' | | // \ .-\__ `-` ___/-. / // ___`. .' /--.--\ `. . __ // ."" '< `.___\_<|>_/___.' >'"". // | | : `- \`.;`\ _ /`;.`/ - ` : | | // \ \ `-. \_ __\ /__ _/ .-` / / // ======`-.____`-.___\_____/___.-`____.-'====== // `=---=' // // ............................................. // 佛祖镇楼 BUG辟易 // 佛曰: // 写字楼里写字间,写字间里程序员; // 程序人员写程序,又拿程序换酒钱。 // 酒醒只在网上坐,酒醉还来网下眠; // 酒醉酒醒日复日,网上网下年复年。 // 但愿老死电脑间,不愿鞠躬老板前; // 奔驰宝马贵者趣,公交自行程序员。 // 别人笑我忒疯癫,我笑自己命太贱; // 不见满街漂亮妹,哪个归得程序员? import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.qianfeng.fragmentdemo.R; /** * Created by jackiechan on 16/8/12. */ public class MyFragment extends Fragment { private TextView textView; private String name; /** * 依赖到 activity * @param activity */ @Override public void onAttach(Activity activity) { Log.e("自定义标签", "类名==MyFragment" + "方法名==onAttach=====:" + ""); super.onAttach(activity); } /** * 依赖到 activity,这个方法用于替换上面那个方法 * @param context activity 对象 */ @Override public void onAttach(Context context) { Log.e("自定义标签", "类名==MyFragment" + "方法名==onAttach=====:" + ""); super.onAttach(context); } /** * * @param savedInstanceState */ @Override public void onCreate(@Nullable Bundle savedInstanceState) { Log.e("自定义标签", "类名==MyFragment" + "方法名==onCreate=====:" + ""); Bundle arguments = getArguments(); if (arguments != null) { name = arguments.getString("name", "默认值"); } super.onCreate(savedInstanceState); } private View view; /** * 创建视图,正常来说只写这一个方法就行,将 fragment 需要的视图创建好然后返回,将控件的事件也在这里设置好 * * @param inflater 布局填充器 * @param container 容器 * @param savedInstanceState * @return */ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { if (view != null) { return view; } Log.e("自定义标签", "类名==MyFragment" + "方法名==onCreateView=====:" + ""); // View view= inflater.inflate(R.layout.fragment_my, null); View view = inflater.inflate(R.layout.fragment_my, container, false);//不添加到父容器,然后用父容器的宽高等参数 //操作视图了 textView = (TextView) view.findViewById(R.id.tv); // textView.setText(getClass().getSimpleName()); textView.setText(name); return view; } /** * 当 activity 创建后 * @param savedInstanceState */ @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { Log.e("自定义标签", "类名==MyFragment" + "方法名==onActivityCreated=====:" + ""); super.onActivityCreated(savedInstanceState); } /** * 启动了 */ @Override public void onStart() { Log.e("自定义标签", "类名==MyFragment" + "方法名==onStart=====:" + ""); super.onStart(); } /** * 可见了 */ @Override public void onResume() { Log.e("自定义标签", "类名==MyFragment" + "方法名==onResume=====:" + ""); super.onResume(); } /** * 暂停了 */ @Override public void onPause() { Log.e("自定义标签", "类名==MyFragment" + "方法名==onPause=====:" + ""); super.onPause(); } /** * 停止不可见了 */ @Override public void onStop() { Log.e("自定义标签", "类名==MyFragment" + "方法名==onStop=====:" + ""); view = getView(); super.onStop(); } /** * 销毁视图 */ @Override public void onDestroyView() { Log.e("自定义标签", "类名==MyFragment" + "方法名==onDestroyView=====:" + ""); super.onDestroyView(); } /** * 销毁 */ @Override public void onDestroy() { Log.e("自定义标签", "类名==MyFragment" + "方法名==onDestroy=====:" + ""); super.onDestroy(); } /** * 与 activity 解绑 */ @Override public void onDetach() { Log.e("自定义标签", "类名==MyFragment" + "方法名==onDetach=====:" + ""); super.onDetach(); } }
99853eca506e6ef9569563bd2d44e90b4dee5a60
328cf93d5d82c550dd870376ab141f752c7edd19
/android-lootSdk/app/src/main/java/io/loot/lootsdk/models/networking/contacts/ContactTransactionResponse.java
ed2f71773848507aee1a5f46d0d80ebc6069e1e8
[]
no_license
karolmalyszko/lootLibs
36e7ccd9d967a16e5b62e85815edbcb5b2cc4e8e
6756fe8e695980bdefc1655ee449e2c335bec9ce
refs/heads/master
2020-03-22T23:57:39.253481
2018-07-16T10:36:36
2018-07-16T10:36:36
140,836,443
0
0
null
null
null
null
UTF-8
Java
false
false
3,459
java
package io.loot.lootsdk.models.networking.contacts; import com.google.gson.annotations.SerializedName; import io.loot.lootsdk.models.data.contacts.Contact; import io.loot.lootsdk.models.data.contacts.ContactTransaction; import io.loot.lootsdk.models.orm.ContactTransactionEntity; import lombok.Data; @Data public class ContactTransactionResponse { @SerializedName("id") private String id; @SerializedName("description") private String description; @SerializedName("local_amount") private String localAmount; @SerializedName("local_currency") private String localCurrency; @SerializedName("post_transaction_balance") private String postTransactionBalance; @SerializedName("settlement_amount") private String settlementAmount; @SerializedName("settlement_currency") private String settlementCurrency; @SerializedName("settlement_date") private String settlementDate; @SerializedName("direction") private String direction; @SerializedName("type") private String type; @SerializedName("status") private String status; public static ContactTransaction parseToDataObject(ContactTransactionResponse response) { if (response == null) { response = new ContactTransactionResponse(); } ContactTransaction contactTransaction = new ContactTransaction(); contactTransaction.setId(response.getId()); contactTransaction.setDescription(response.getDescription()); contactTransaction.setLocalAmount(response.getLocalAmount()); contactTransaction.setLocalCurrency(response.getLocalCurrency()); contactTransaction.setPostTransactionBalance(response.getPostTransactionBalance()); contactTransaction.setSettlementAmount(response.getSettlementAmount()); contactTransaction.setSettlementCurrency(response.getSettlementCurrency()); contactTransaction.setSettlementDate(response.getSettlementDate()); contactTransaction.setDirection(response.getDirection()); contactTransaction.setType(response.getType()); contactTransaction.setStatus(response.getStatus()); return contactTransaction; } public static ContactTransactionEntity parseToEntityObject(ContactTransactionResponse response, String contactId) { if (response == null) { response = new ContactTransactionResponse(); } ContactTransactionEntity contactTransactionEntity = new ContactTransactionEntity(); contactTransactionEntity.setId(response.getId()); contactTransactionEntity.setContactId(contactId); contactTransactionEntity.setDescription(response.getDescription()); contactTransactionEntity.setLocalAmount(response.getLocalAmount()); contactTransactionEntity.setLocalCurrency(response.getLocalCurrency()); contactTransactionEntity.setPostTransactionBalance(response.getPostTransactionBalance()); contactTransactionEntity.setSettlementAmount(response.getSettlementAmount()); contactTransactionEntity.setSettlementCurrency(response.getSettlementCurrency()); contactTransactionEntity.setSettlementDate(response.getSettlementDate()); contactTransactionEntity.setDirection(response.getDirection()); contactTransactionEntity.setType(response.getType()); contactTransactionEntity.setStatus(response.getStatus()); return contactTransactionEntity; } }
9cb1ad806f45e1e27d81d807649dbb822e6a9440
506bc7d85d87d3ed29aad0c47751b6bcc8159995
/contacts-mobile-basic/src/main/java/org/jboss/quickstarts/wfk/model/Member.java
81db99e1e6ea3865efde3635e0587e0c85e81181
[ "Apache-2.0" ]
permissive
ralbuque/jboss-wfk-quickstarts
ffb3fbefa70d5e3dea111ba55bcc2470b786e295
ebe93075903eb0658fff6b83cb3618318ebe0510
refs/heads/2.5.x-develop
2021-01-18T01:52:15.426041
2014-03-21T12:31:11
2014-03-21T12:31:11
46,859,197
1
0
null
2015-11-25T12:04:44
2015-11-25T12:04:44
null
UTF-8
Java
false
false
3,972
java
/* * JBoss, Home of Professional Open Source * Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual * contributors by the @authors tag. See the copyright.txt in the * distribution for a full listing of individual contributors. * * 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.jboss.quickstarts.wfk.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; import javax.validation.constraints.Past; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotEmpty; @Entity @XmlRootElement @Table(name = "Member_contacts", uniqueConstraints = @UniqueConstraint(columnNames = "email")) public class Member implements Serializable { /** Default value included to remove warning. Remove or modify at will. **/ private static final long serialVersionUID = 1L; /* * The messages match the ones in the UI so that the user isn't confused by two similar error messages for the same * error after hitting submit, this is if the form submits while having validation errors. * * Each variable name exactly matches the ones used on the HTML form name attribute so that when an error for that * variable occurs it can be sent to the correct input field on the form. */ @Id @GeneratedValue(strategy = GenerationType.TABLE) private Long id; @NotNull @Size(min = 1, max = 25) @Pattern(regexp = "[A-Za-z-']+", message = "Please use a name without numbers or specials") @Column(name = "first_name") private String firstName; @NotNull @Size(min = 1, max = 25) @Pattern(regexp = "[A-Za-z-']+", message = "Please use a name without numbers or specials") @Column(name = "last_name") private String lastName; @NotNull @NotEmpty @Email(message = "The email address must be in the format of [email protected]") private String email; @NotNull @Column(name = "phone_number") private String phoneNumber; @NotNull @Past(message = "Birthdates can not be in the future. Please choose one from the past") @Column(name = "birth_date") private Date birthDate; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public Date getBirthDate() { return birthDate; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } }
c7105d9e1e9fd632ab91c4ed1c598a17d8ccd96c
d0dc762dc6f308f532c4837c06dd52f3269c65f4
/app/src/androidTest/java/com/android/aprendaingles/ExampleInstrumentedTest.java
87a9b4b87583ee6c95d5bfa81e9809e7b9088e2f
[]
no_license
CarolineMBorges/AppAprendaInglesAndroid
139f257afbe3412bd80dfa97046715ece99c6b7c
0dd9033149d095336c20c8e0682b75da1eba60a3
refs/heads/master
2020-04-24T12:17:44.433333
2019-02-21T21:53:44
2019-02-21T21:53:44
171,950,922
2
0
null
null
null
null
UTF-8
Java
false
false
734
java
package com.android.aprendaingles; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.android.aprendaingles", appContext.getPackageName()); } }
c8a095de24f44518d4a3a6d4b74ca1befdaeeaa6
8819d1bac4b53c5e3d71072ca972ce7802eca1f5
/DatabaseManager.java
020adbe41221e436b67418969cf3b4958faf6fca
[]
no_license
lakshya88/Email_Client
52478d42a89b634d208840265b01d5e6f5a79cc5
ff2bfa07fa232d99202756c7116239c5337b269e
refs/heads/master
2020-05-25T20:24:41.428645
2019-05-22T06:33:43
2019-05-22T06:33:43
187,976,326
0
0
null
null
null
null
UTF-8
Java
false
false
4,699
java
/** * DatabaseManager.java contains all the functions needed to communicate with the * HBase database * **/ import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.filter.PrefixFilter; import org.apache.hadoop.hbase.util.Bytes; public class DatabaseManager { // stores the name of our HBase table static final String TABLE_NAME = "messages"; // instance variables for the Configuration and HTable objects Configuration config; HTable table; HBaseAdmin admin; // initialize connection with database public DatabaseManager() { config = HBaseConfiguration.create(); try { // create instance of HBaseAdmin. Needed to dynamically create database admin = new HBaseAdmin(config); // check if HBase table exists, if not then create it if(!admin.tableExists(TABLE_NAME)) { // basically code below dynamically creates our HBase table HTableDescriptor tableDescriptor = new HTableDescriptor(Bytes.toBytes(TABLE_NAME)); HColumnDescriptor msg = new HColumnDescriptor(Bytes.toBytes("MSG")); tableDescriptor.addFamily(msg); admin.createTable(tableDescriptor); System.out.println("New table created"); } else { System.out.println("Table already exists"); } // reference the HBase table table = new HTable(config, TABLE_NAME); } catch (IOException e) { e.printStackTrace(); } } // releases any database resources public void finalize() { System.out.println("Database resources de-allocated"); try { admin.close(); table.close(); } catch (IOException e) { System.out.println("Error closing table"); e.printStackTrace(); } } public void storeMessage(Message msg) { // create composite rowKey with receiver email id, date and time byte[] rowKey = Bytes.toBytes(msg.getReceiverID() + "_" + msg.getDate() + "_" + msg.getTime() + "_" + msg.getMessageTitle()); Put p = new Put(rowKey); // add information into column family - MSG p.addColumn(Bytes.toBytes("MSG"), Bytes.toBytes("receiver_id"), Bytes.toBytes(msg.getReceiverID())); p.addColumn(Bytes.toBytes("MSG"), Bytes.toBytes("sender_id"), Bytes.toBytes(msg.getSenderID())); p.addColumn(Bytes.toBytes("MSG"), Bytes.toBytes("title"), Bytes.toBytes(msg.getMessageTitle())); p.addColumn(Bytes.toBytes("MSG"), Bytes.toBytes("body"), Bytes.toBytes(msg.getMessageBody())); p.addColumn(Bytes.toBytes("MSG"), Bytes.toBytes("date"), Bytes.toBytes(msg.getDate())); p.addColumn(Bytes.toBytes("MSG"), Bytes.toBytes("time"), Bytes.toBytes(msg.getTime())); try { // insert data into database table.put(p); System.out.println("Data inserted"); } catch (IOException e) { System.out.println("Error storing data into database"); e.printStackTrace(); } } public List<Message> getAllMessages(String receiverId) { // store messages in an array list of type Message List<Message> messageArray = new ArrayList<Message>(); // add a filter to check the prefix of row key for the receiver email id Filter filter = new PrefixFilter(Bytes.toBytes(receiverId)); Scan s = new Scan(); s.setFilter(filter); ResultScanner scanner; try { scanner = table.getScanner(s); for(Result result : scanner) { String receiver_id = Bytes.toString(result.getValue(Bytes.toBytes("MSG"), Bytes.toBytes("receiver_id"))); String sender_id = Bytes.toString(result.getValue(Bytes.toBytes("MSG"), Bytes.toBytes("sender_id"))); String date = Bytes.toString(result.getValue(Bytes.toBytes("MSG"), Bytes.toBytes("date"))); String time = Bytes.toString(result.getValue(Bytes.toBytes("MSG"), Bytes.toBytes("time"))); String messageBody = Bytes.toString(result.getValue(Bytes.toBytes("MSG"), Bytes.toBytes("body"))); String messageTitle = Bytes.toString(result.getValue(Bytes.toBytes("MSG"), Bytes.toBytes("title"))); // add retrieved message object into array list messageArray.add(new Message(receiver_id, sender_id, date, time, messageTitle, messageBody)); } scanner.close(); return messageArray; } catch (IOException e) { e.printStackTrace(); return null; } } }
a8cccd3b0148ed2ab3383f104bfb0e94a5cd587e
3c08b8f2c217b0731e8bc4a668395bb8d074b12c
/recommendation-ms/build/generated/source/proto/main/java/recommendation/Recommendation.java
0136eb99e15e5128be5d9c8e2c05b6227dbcc7ee
[]
no_license
LedesmaBruno/distribuidos
adf50fbdae3370d7a2287456db5499540476b09c
94208eab9ecf2abe39ebaa03f5fdf018f048b1ac
refs/heads/master
2020-05-29T18:55:05.777603
2019-05-09T16:32:25
2019-05-09T16:32:25
null
0
0
null
null
null
null
UTF-8
Java
false
true
64,161
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: recommendation/recommendation.proto package recommendation; public final class Recommendation { private Recommendation() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } public interface SupplyRecommendationRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:recommendation.SupplyRecommendationRequest) com.google.protobuf.MessageOrBuilder { /** * <code>int32 userId = 1;</code> */ int getUserId(); } /** * Protobuf type {@code recommendation.SupplyRecommendationRequest} */ public static final class SupplyRecommendationRequest extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:recommendation.SupplyRecommendationRequest) SupplyRecommendationRequestOrBuilder { private static final long serialVersionUID = 0L; // Use SupplyRecommendationRequest.newBuilder() to construct. private SupplyRecommendationRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private SupplyRecommendationRequest() { userId_ = 0; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private SupplyRecommendationRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { userId_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return recommendation.Recommendation.internal_static_recommendation_SupplyRecommendationRequest_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return recommendation.Recommendation.internal_static_recommendation_SupplyRecommendationRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( recommendation.Recommendation.SupplyRecommendationRequest.class, recommendation.Recommendation.SupplyRecommendationRequest.Builder.class); } public static final int USERID_FIELD_NUMBER = 1; private int userId_; /** * <code>int32 userId = 1;</code> */ public int getUserId() { return userId_; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (userId_ != 0) { output.writeInt32(1, userId_); } unknownFields.writeTo(output); } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (userId_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, userId_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof recommendation.Recommendation.SupplyRecommendationRequest)) { return super.equals(obj); } recommendation.Recommendation.SupplyRecommendationRequest other = (recommendation.Recommendation.SupplyRecommendationRequest) obj; boolean result = true; result = result && (getUserId() == other.getUserId()); result = result && unknownFields.equals(other.unknownFields); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + USERID_FIELD_NUMBER; hash = (53 * hash) + getUserId(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static recommendation.Recommendation.SupplyRecommendationRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static recommendation.Recommendation.SupplyRecommendationRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static recommendation.Recommendation.SupplyRecommendationRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(recommendation.Recommendation.SupplyRecommendationRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code recommendation.SupplyRecommendationRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:recommendation.SupplyRecommendationRequest) recommendation.Recommendation.SupplyRecommendationRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return recommendation.Recommendation.internal_static_recommendation_SupplyRecommendationRequest_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return recommendation.Recommendation.internal_static_recommendation_SupplyRecommendationRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( recommendation.Recommendation.SupplyRecommendationRequest.class, recommendation.Recommendation.SupplyRecommendationRequest.Builder.class); } // Construct using recommendation.Recommendation.SupplyRecommendationRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); userId_ = 0; return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return recommendation.Recommendation.internal_static_recommendation_SupplyRecommendationRequest_descriptor; } public recommendation.Recommendation.SupplyRecommendationRequest getDefaultInstanceForType() { return recommendation.Recommendation.SupplyRecommendationRequest.getDefaultInstance(); } public recommendation.Recommendation.SupplyRecommendationRequest build() { recommendation.Recommendation.SupplyRecommendationRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public recommendation.Recommendation.SupplyRecommendationRequest buildPartial() { recommendation.Recommendation.SupplyRecommendationRequest result = new recommendation.Recommendation.SupplyRecommendationRequest(this); result.userId_ = userId_; onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof recommendation.Recommendation.SupplyRecommendationRequest) { return mergeFrom((recommendation.Recommendation.SupplyRecommendationRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(recommendation.Recommendation.SupplyRecommendationRequest other) { if (other == recommendation.Recommendation.SupplyRecommendationRequest.getDefaultInstance()) return this; if (other.getUserId() != 0) { setUserId(other.getUserId()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { recommendation.Recommendation.SupplyRecommendationRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (recommendation.Recommendation.SupplyRecommendationRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int userId_ ; /** * <code>int32 userId = 1;</code> */ public int getUserId() { return userId_; } /** * <code>int32 userId = 1;</code> */ public Builder setUserId(int value) { userId_ = value; onChanged(); return this; } /** * <code>int32 userId = 1;</code> */ public Builder clearUserId() { userId_ = 0; onChanged(); return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFieldsProto3(unknownFields); } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:recommendation.SupplyRecommendationRequest) } // @@protoc_insertion_point(class_scope:recommendation.SupplyRecommendationRequest) private static final recommendation.Recommendation.SupplyRecommendationRequest DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new recommendation.Recommendation.SupplyRecommendationRequest(); } public static recommendation.Recommendation.SupplyRecommendationRequest getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<SupplyRecommendationRequest> PARSER = new com.google.protobuf.AbstractParser<SupplyRecommendationRequest>() { public SupplyRecommendationRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new SupplyRecommendationRequest(input, extensionRegistry); } }; public static com.google.protobuf.Parser<SupplyRecommendationRequest> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<SupplyRecommendationRequest> getParserForType() { return PARSER; } public recommendation.Recommendation.SupplyRecommendationRequest getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface EmptyOrBuilder extends // @@protoc_insertion_point(interface_extends:recommendation.Empty) com.google.protobuf.MessageOrBuilder { } /** * Protobuf type {@code recommendation.Empty} */ public static final class Empty extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:recommendation.Empty) EmptyOrBuilder { private static final long serialVersionUID = 0L; // Use Empty.newBuilder() to construct. private Empty(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Empty() { } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Empty( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return recommendation.Recommendation.internal_static_recommendation_Empty_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return recommendation.Recommendation.internal_static_recommendation_Empty_fieldAccessorTable .ensureFieldAccessorsInitialized( recommendation.Recommendation.Empty.class, recommendation.Recommendation.Empty.Builder.class); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { unknownFields.writeTo(output); } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof recommendation.Recommendation.Empty)) { return super.equals(obj); } recommendation.Recommendation.Empty other = (recommendation.Recommendation.Empty) obj; boolean result = true; result = result && unknownFields.equals(other.unknownFields); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static recommendation.Recommendation.Empty parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Empty parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Empty parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Empty parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Empty parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Empty parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Empty parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static recommendation.Recommendation.Empty parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static recommendation.Recommendation.Empty parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static recommendation.Recommendation.Empty parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static recommendation.Recommendation.Empty parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static recommendation.Recommendation.Empty parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(recommendation.Recommendation.Empty prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code recommendation.Empty} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:recommendation.Empty) recommendation.Recommendation.EmptyOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return recommendation.Recommendation.internal_static_recommendation_Empty_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return recommendation.Recommendation.internal_static_recommendation_Empty_fieldAccessorTable .ensureFieldAccessorsInitialized( recommendation.Recommendation.Empty.class, recommendation.Recommendation.Empty.Builder.class); } // Construct using recommendation.Recommendation.Empty.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return recommendation.Recommendation.internal_static_recommendation_Empty_descriptor; } public recommendation.Recommendation.Empty getDefaultInstanceForType() { return recommendation.Recommendation.Empty.getDefaultInstance(); } public recommendation.Recommendation.Empty build() { recommendation.Recommendation.Empty result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public recommendation.Recommendation.Empty buildPartial() { recommendation.Recommendation.Empty result = new recommendation.Recommendation.Empty(this); onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof recommendation.Recommendation.Empty) { return mergeFrom((recommendation.Recommendation.Empty)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(recommendation.Recommendation.Empty other) { if (other == recommendation.Recommendation.Empty.getDefaultInstance()) return this; this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { recommendation.Recommendation.Empty parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (recommendation.Recommendation.Empty) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFieldsProto3(unknownFields); } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:recommendation.Empty) } // @@protoc_insertion_point(class_scope:recommendation.Empty) private static final recommendation.Recommendation.Empty DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new recommendation.Recommendation.Empty(); } public static recommendation.Recommendation.Empty getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Empty> PARSER = new com.google.protobuf.AbstractParser<Empty>() { public Empty parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Empty(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Empty> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Empty> getParserForType() { return PARSER; } public recommendation.Recommendation.Empty getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface PingOrBuilder extends // @@protoc_insertion_point(interface_extends:recommendation.Ping) com.google.protobuf.MessageOrBuilder { } /** * Protobuf type {@code recommendation.Ping} */ public static final class Ping extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:recommendation.Ping) PingOrBuilder { private static final long serialVersionUID = 0L; // Use Ping.newBuilder() to construct. private Ping(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Ping() { } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Ping( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return recommendation.Recommendation.internal_static_recommendation_Ping_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return recommendation.Recommendation.internal_static_recommendation_Ping_fieldAccessorTable .ensureFieldAccessorsInitialized( recommendation.Recommendation.Ping.class, recommendation.Recommendation.Ping.Builder.class); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { unknownFields.writeTo(output); } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof recommendation.Recommendation.Ping)) { return super.equals(obj); } recommendation.Recommendation.Ping other = (recommendation.Recommendation.Ping) obj; boolean result = true; result = result && unknownFields.equals(other.unknownFields); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static recommendation.Recommendation.Ping parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Ping parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Ping parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Ping parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Ping parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Ping parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Ping parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static recommendation.Recommendation.Ping parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static recommendation.Recommendation.Ping parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static recommendation.Recommendation.Ping parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static recommendation.Recommendation.Ping parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static recommendation.Recommendation.Ping parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(recommendation.Recommendation.Ping prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code recommendation.Ping} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:recommendation.Ping) recommendation.Recommendation.PingOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return recommendation.Recommendation.internal_static_recommendation_Ping_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return recommendation.Recommendation.internal_static_recommendation_Ping_fieldAccessorTable .ensureFieldAccessorsInitialized( recommendation.Recommendation.Ping.class, recommendation.Recommendation.Ping.Builder.class); } // Construct using recommendation.Recommendation.Ping.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return recommendation.Recommendation.internal_static_recommendation_Ping_descriptor; } public recommendation.Recommendation.Ping getDefaultInstanceForType() { return recommendation.Recommendation.Ping.getDefaultInstance(); } public recommendation.Recommendation.Ping build() { recommendation.Recommendation.Ping result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public recommendation.Recommendation.Ping buildPartial() { recommendation.Recommendation.Ping result = new recommendation.Recommendation.Ping(this); onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof recommendation.Recommendation.Ping) { return mergeFrom((recommendation.Recommendation.Ping)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(recommendation.Recommendation.Ping other) { if (other == recommendation.Recommendation.Ping.getDefaultInstance()) return this; this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { recommendation.Recommendation.Ping parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (recommendation.Recommendation.Ping) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFieldsProto3(unknownFields); } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:recommendation.Ping) } // @@protoc_insertion_point(class_scope:recommendation.Ping) private static final recommendation.Recommendation.Ping DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new recommendation.Recommendation.Ping(); } public static recommendation.Recommendation.Ping getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Ping> PARSER = new com.google.protobuf.AbstractParser<Ping>() { public Ping parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Ping(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Ping> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Ping> getParserForType() { return PARSER; } public recommendation.Recommendation.Ping getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface PongOrBuilder extends // @@protoc_insertion_point(interface_extends:recommendation.Pong) com.google.protobuf.MessageOrBuilder { } /** * Protobuf type {@code recommendation.Pong} */ public static final class Pong extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:recommendation.Pong) PongOrBuilder { private static final long serialVersionUID = 0L; // Use Pong.newBuilder() to construct. private Pong(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Pong() { } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Pong( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return recommendation.Recommendation.internal_static_recommendation_Pong_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return recommendation.Recommendation.internal_static_recommendation_Pong_fieldAccessorTable .ensureFieldAccessorsInitialized( recommendation.Recommendation.Pong.class, recommendation.Recommendation.Pong.Builder.class); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { unknownFields.writeTo(output); } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof recommendation.Recommendation.Pong)) { return super.equals(obj); } recommendation.Recommendation.Pong other = (recommendation.Recommendation.Pong) obj; boolean result = true; result = result && unknownFields.equals(other.unknownFields); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static recommendation.Recommendation.Pong parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Pong parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Pong parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Pong parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Pong parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static recommendation.Recommendation.Pong parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static recommendation.Recommendation.Pong parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static recommendation.Recommendation.Pong parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static recommendation.Recommendation.Pong parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static recommendation.Recommendation.Pong parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static recommendation.Recommendation.Pong parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static recommendation.Recommendation.Pong parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(recommendation.Recommendation.Pong prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code recommendation.Pong} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:recommendation.Pong) recommendation.Recommendation.PongOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return recommendation.Recommendation.internal_static_recommendation_Pong_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return recommendation.Recommendation.internal_static_recommendation_Pong_fieldAccessorTable .ensureFieldAccessorsInitialized( recommendation.Recommendation.Pong.class, recommendation.Recommendation.Pong.Builder.class); } // Construct using recommendation.Recommendation.Pong.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } public Builder clear() { super.clear(); return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return recommendation.Recommendation.internal_static_recommendation_Pong_descriptor; } public recommendation.Recommendation.Pong getDefaultInstanceForType() { return recommendation.Recommendation.Pong.getDefaultInstance(); } public recommendation.Recommendation.Pong build() { recommendation.Recommendation.Pong result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public recommendation.Recommendation.Pong buildPartial() { recommendation.Recommendation.Pong result = new recommendation.Recommendation.Pong(this); onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof recommendation.Recommendation.Pong) { return mergeFrom((recommendation.Recommendation.Pong)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(recommendation.Recommendation.Pong other) { if (other == recommendation.Recommendation.Pong.getDefaultInstance()) return this; this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { recommendation.Recommendation.Pong parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (recommendation.Recommendation.Pong) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFieldsProto3(unknownFields); } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:recommendation.Pong) } // @@protoc_insertion_point(class_scope:recommendation.Pong) private static final recommendation.Recommendation.Pong DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new recommendation.Recommendation.Pong(); } public static recommendation.Recommendation.Pong getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Pong> PARSER = new com.google.protobuf.AbstractParser<Pong>() { public Pong parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Pong(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Pong> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Pong> getParserForType() { return PARSER; } public recommendation.Recommendation.Pong getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private static final com.google.protobuf.Descriptors.Descriptor internal_static_recommendation_SupplyRecommendationRequest_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_recommendation_SupplyRecommendationRequest_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_recommendation_Empty_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_recommendation_Empty_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_recommendation_Ping_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_recommendation_Ping_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_recommendation_Pong_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_recommendation_Pong_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n#recommendation/recommendation.proto\022\016r" + "ecommendation\"-\n\033SupplyRecommendationReq" + "uest\022\016\n\006userId\030\001 \001(\005\"\007\n\005Empty\"\006\n\004Ping\"\006\n" + "\004Pong2\256\001\n\025RecommendationService\0229\n\013Healt" + "hCheck\022\024.recommendation.Ping\032\024.recommend" + "ation.Pong\022Z\n\024SupplyRecommendation\022+.rec" + "ommendation.SupplyRecommendationRequest\032" + "\025.recommendation.Emptyb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; return null; } }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); internal_static_recommendation_SupplyRecommendationRequest_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_recommendation_SupplyRecommendationRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_recommendation_SupplyRecommendationRequest_descriptor, new java.lang.String[] { "UserId", }); internal_static_recommendation_Empty_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_recommendation_Empty_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_recommendation_Empty_descriptor, new java.lang.String[] { }); internal_static_recommendation_Ping_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_recommendation_Ping_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_recommendation_Ping_descriptor, new java.lang.String[] { }); internal_static_recommendation_Pong_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_recommendation_Pong_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_recommendation_Pong_descriptor, new java.lang.String[] { }); } // @@protoc_insertion_point(outer_class_scope) }
730132db479d5cd5214d01d161465cb038dfffc9
b9f73c7241d7a374e4b16fd74dcc5365724d9f0c
/src/io/github/s5uishida/iot/rainy/device/bme280/BME280MqttSender.java
d6552def7ca156bcf91685c985d47274f1338901
[ "MIT" ]
permissive
ilibx/rainy
27456de201bd3d997224ad84670d0f3728db79b0
50ea3e79df287de683fd98a9144349a914cd0eba
refs/heads/master
2022-03-16T16:46:14.241959
2019-12-07T10:52:59
2019-12-07T10:52:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,068
java
package io.github.s5uishida.iot.rainy.device.bme280; import java.io.IOException; import io.github.s5uishida.iot.rainy.device.bme280.data.BME280Data; import io.github.s5uishida.iot.rainy.sender.IDataSender; import io.github.s5uishida.iot.rainy.sender.mqtt.AbstractMqttSender; /* * @author s5uishida * */ public class BME280MqttSender extends AbstractMqttSender implements IDataSender { private static final BME280Config config = BME280Config.getInstance(); private final boolean prettyPrinting; public BME280MqttSender() throws IOException { super(); prettyPrinting = config.getPrettyPrinting(); } @Override public void send(Object object) throws IOException { if (!(object instanceof BME280Data)) { return; } BME280Data bme280 = (BME280Data)object; String subTopic = formatSubTopic(bme280.clientID + "_" + bme280.deviceID); String data = mapper.writeValueAsString(bme280); if (LOG.isDebugEnabled() && prettyPrinting) { LOG.debug("BME280 JSON -\n{}", prettyMapper.writeValueAsString(bme280)); } execute(subTopic, data); } }
25f5d8a1e4c87dd76b4c39b545cb5704ad3ae2b7
3053c815af5d8f6e5598f8bbe2b1f2cbebfc8c3f
/src/main/java/com/company/demo/java8features/methodreferences/StringUtils.java
38a75c70a6b9619fe898d37d1bc2ccd041fa3ed2
[ "MIT" ]
permissive
pkarafotis/java8features
6a9f6b1f9746cab665a85369c944db14fa69f802
8ae3ce2b710074e579d799420baf0e0398b18a54
refs/heads/master
2021-03-24T04:54:52.809602
2020-03-17T18:58:31
2020-03-17T18:58:31
247,518,361
2
1
null
null
null
null
UTF-8
Java
false
false
212
java
package com.company.demo.java8features.methodreferences; public class StringUtils { public static String capitalize(String str) { return str.substring(0, 1).toUpperCase() + str.substring(1); } }
23d32de4c38973a35c0c78f1d4e14ac10be3161e
a9970da88ec439ef1c461a4a279ebd8a8a347d6d
/applets-system/src/main/java/com/applets/system/mapper/SysUserOnlineMapper.java
4ad961c5678646699b74aa0e4431d33693c31974
[ "MIT" ]
permissive
LufeiClimb/applets
bb2206998debed537de1488b5627ca7f2c600630
c44259dc706ab182894600d952a9194cf46c9d84
refs/heads/master
2023-03-28T16:23:09.886856
2021-04-09T09:57:34
2021-04-09T09:57:34
340,248,614
0
0
null
null
null
null
UTF-8
Java
false
false
1,131
java
package com.applets.system.mapper; import com.applets.system.domain.SysUserOnline; import java.util.List; /** * 在线用户 数据层 * * @author LufeiClimb */ public interface SysUserOnlineMapper { /** * 通过会话序号查询信息 * * @param sessionId 会话ID * @return 在线用户信息 */ public SysUserOnline selectOnlineById(String sessionId); /** * 通过会话序号删除信息 * * @param sessionId 会话ID * @return 在线用户信息 */ public int deleteOnlineById(String sessionId); /** * 保存会话信息 * * @param online 会话信息 * @return 结果 */ public int saveOnline(SysUserOnline online); /** * 查询会话集合 * * @param userOnline 会话参数 * @return 会话集合 */ public List<SysUserOnline> selectUserOnlineList(SysUserOnline userOnline); /** * 查询过期会话集合 * * @param lastAccessTime 过期时间 * @return 会话集合 */ public List<SysUserOnline> selectOnlineByExpired(String lastAccessTime); }
0208330f7e88cb5d6e348e2f023aa18a7e006438
4aac8202dd16fc3e22ed70be102f975ca4da0eba
/projects/1-threads/students/Charity-Flea-Market/src/main/java/com/bukowskaewelina/app/Chairman.java
113c2d6956ef4787a1b38838b0fd82110acf9a35
[]
no_license
Wewe12/distributed-java-intro
8cb0304539e4e1fa50341626ad08b0ee3866f6f2
4d3d3a7ce93f717cedd42f5e6beb84ba68cde28c
refs/heads/master
2020-05-29T11:01:14.110029
2014-11-20T07:20:27
2014-11-20T07:20:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,974
java
package com.bukowskaewelina.app; import java.util.ArrayList; import java.util.Random; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; public class Chairman implements Runnable{ private final BlockingQueue<Item> queueOfItem = new ArrayBlockingQueue<Item>(10); private ArrayList<Recipient> listofRecipient = new ArrayList<Recipient>(10); private MarketManager manager; public Chairman (MarketManager manager){ this.manager = manager; } public Chairman(){ } public MarketManager getManager(){ return this.manager; } public void registerItem(Item i) throws InterruptedException { // System.out.println(queueOfItem.size()); if (queueOfItem.size() < 10) { queueOfItem.offer(i); System.out.println("Registering " + i.getName()); } else{ System.out.println("Queue is full"); Thread.sleep(1000); } } public void registerRecipient(Recipient r){ listofRecipient.add(r); System.out.println("Registering " + r.getName()); } Recipient winingRecipient() throws InterruptedException { Recipient recipient = new Recipient(); Random rand = new Random(); recipient = listofRecipient.get(rand.nextInt(10)); recipient.setItem(queueOfItem.take()); // notify(); return recipient; } public void run(){ while(!queueOfItem.isEmpty()) { try { Recipient recipient = winingRecipient(); System.out.println("Winnning Recipient: " + recipient.getName()); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println("Chairman says good bye"); } }
197d96e4233481bdacb25b4a089564b4b4024719
1bb31a420bdb0e6c99779f11ddcb42238ae2ae2e
/src/quiz/FrmSobre.java
cd0a4940027a8a9153ac10d8ffb21ba75b091852
[]
no_license
matsvilas/Projeto_APS_TerceiroSemestre
99fd683b1d99928f3af3ebc3d7ae190658c5df54
cc25a26c3075f3afa170cc4f7b836ca5b0a67554
refs/heads/master
2021-01-25T07:44:15.783222
2017-06-07T16:28:05
2017-06-07T16:28:05
93,656,415
0
0
null
null
null
null
UTF-8
Java
false
false
9,588
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 quiz; import javax.swing.SwingConstants; /** * * @author Matheus */ public class FrmSobre extends javax.swing.JFrame { /** * Creates new form FrmSobre */ public FrmSobre() { initComponents(); this.setLocationRelativeTo(null); this.setAlwaysOnTop(true); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Sobre"); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel1.setText("Sobre:"); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel2.setForeground(new java.awt.Color(204, 0, 51)); jLabel2.setText("Programa desenvolvido por:"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel3.setText("Matheus dos Santos Vilas Boas"); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel4.setText("Iago Henrique Correia Costa"); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel5.setText("Manoel Ferreira Duarte Junior"); jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel6.setForeground(new java.awt.Color(0, 0, 204)); jLabel6.setText("Orientado por:"); jLabel7.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel7.setText("Rivail "); jLabel8.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel8.setForeground(new java.awt.Color(255, 153, 0)); jLabel8.setText("Menção honrosa:"); jLabel9.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel9.setText("Nilton Duarte"); jLabel10.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel10.setText("Desenvolvido em 2017 com fins educativos!"); jLabel11.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel11.setText("Versão 1.0.0"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel1) .addGap(193, 193, 193)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(81, 81, 81)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(40, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9) .addComponent(jLabel10) .addComponent(jLabel11)) .addGap(40, 40, 40)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(91, 91, 91)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 268, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(101, 101, 101)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(23, 23, 23) .addComponent(jLabel1) .addGap(30, 30, 30) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel7) .addGap(18, 18, 18) .addComponent(jLabel8) .addGap(18, 18, 18) .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE) .addComponent(jLabel11) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel10) .addGap(26, 26, 26)) ); getAccessibleContext().setAccessibleName("Sobre"); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(FrmSobre.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(FrmSobre.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(FrmSobre.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(FrmSobre.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new FrmSobre().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; // End of variables declaration//GEN-END:variables }
aac850a94721240f99c49d51405f076959baf6bd
fca167b96e7bbe396a96e66f26de8d9ef324f955
/src/main/java/EchoServer.java
fac033cd41430986b254e7a84412d75f5f5dc89a
[]
no_license
AosPassword/netty_demo
225d7bdcc56bf54631eff3f286fddaa01c916dce
d2f528968286e8e7f1f551378107c7953425070b
refs/heads/master
2020-03-30T12:53:44.961075
2018-10-02T11:55:58
2018-10-02T11:55:58
151,246,682
0
0
null
null
null
null
UTF-8
Java
false
false
2,254
java
import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; public class EchoServer { private EventLoopGroup acceptGroup=null; private EventLoopGroup clientGroup=null; private ServerBootstrap b=null; public EchoServer(){ init(); } private void init() { acceptGroup=new NioEventLoopGroup(); clientGroup=new NioEventLoopGroup(); b=new ServerBootstrap(); b.childOption(ChannelOption.SO_KEEPALIVE,true); b.group(acceptGroup,clientGroup) .channel(NioServerSocketChannel.class); } public ChannelFuture accept(int port,final ChannelHandler... echoServerHandlers) throws InterruptedException { ChannelFuture future=null; try{ b.childHandler(new ChannelInitializer<SocketChannel>() { protected void initChannel(SocketChannel socketChannel) throws Exception { socketChannel.pipeline().addLast(echoServerHandlers); } }); future=b.bind(port).sync(); }catch (Exception e){ e.printStackTrace(); }finally { release(); } return future; } public void release(){ this.acceptGroup.shutdownGracefully(); this.clientGroup.shutdownGracefully(); } public static void main(String[] args) { ChannelFuture future=null; EchoServer echoServer=null; try{ echoServer = new EchoServer(); future=echoServer.accept(8080,new EchoServerHandler()); System.out.println("server started"); future.channel().closeFuture().sync(); } catch (InterruptedException e) { e.printStackTrace(); }finally { if (null!=future){ try { future.channel().closeFuture().sync(); } catch (InterruptedException e) { e.printStackTrace(); } } if (null!=echoServer){ echoServer.release(); } } } }
a2b4b75f56daf1f57c3359c9aab87ce792351ef0
4636de0e1fd7d12863b24a26a741acb4d329abe8
/app/src/main/java/com/example/knu_cclab/airpang/MainActivity.java
bd006cdd197933cf9a71c3fbbc70442c7ac28fe0
[]
no_license
pricelessmok/airpang
bc4b111c7e4291757e13b95c8ff6ffe8fab150e6
c1015e5f9a87fd02b27854a2d4216a9eb32bc236
refs/heads/master
2020-03-30T04:37:11.230741
2018-09-28T14:34:28
2018-09-28T14:34:28
150,753,296
0
0
null
null
null
null
UTF-8
Java
false
false
4,982
java
package com.example.knu_cclab.airpang; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.telephony.SmsManager; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; /* import app.akexorcist.bluetotohspp.library.BluetoothSPP; import app.akexorcist.bluetotohspp.library.BluetoothState; import app.akexorcist.bluetotohspp.library.DeviceList; */ public class MainActivity extends AppCompatActivity { //private BluetoothSPP bt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //bt = new BluetoothSPP(this);//initializing Button btnSendSMS = (Button)findViewById(R.id.sms); /*if (!bt.isBluetoothAvailable()) { //블루투스 사용 불가 Toast.makeText(getApplicationContext() , "Bluetooth is not available" , Toast.LENGTH_SHORT).show(); finish(); } bt.setOnDataReceivedListener(new BluetoothSPP.OnDataReceivedListener() { //데이터 수신 public void onDataReceived(byte[] data, String message) { Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show(); } }); bt.setBluetoothConnectionListener(new BluetoothSPP.BluetoothConnectionListener() { //연결됐을 때 public void onDeviceConnected(String name, String address) { Toast.makeText(getApplicationContext() , "Connected to " + name + "\n" + address , Toast.LENGTH_SHORT).show(); } public void onDeviceDisconnected() { //연결해제 Toast.makeText(getApplicationContext() , "Connection lost", Toast.LENGTH_SHORT).show(); } public void onDeviceConnectionFailed() { //연결실패 Toast.makeText(getApplicationContext() , "Unable to connect", Toast.LENGTH_SHORT).show(); } }); Button btnConnect = findViewById(R.id.btnConnect); //연결시도 btnConnect.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (bt.getServiceState() == BluetoothState.STATE_CONNECTED) { bt.disconnect(); } else { Intent intent = new Intent(getApplicationContext(), DeviceList.class); startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE); } } }); */ btnSendSMS.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { sendSMS("+821050413131", "HELP"); /*here i can send message to emulator 5556. In Real device *you can change number*/ } }); } /*public void onDestroy() { super.onDestroy(); bt.stopService(); //블루투스 중지 } public void onStart() { super.onStart(); if (!bt.isBluetoothEnabled()) { // Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(intent, BluetoothState.REQUEST_ENABLE_BT); } else { if (!bt.isServiceAvailable()) { bt.setupService(); bt.startService(BluetoothState.DEVICE_OTHER); //DEVICE_ANDROID는 안드로이드 기기 끼리 setup(); } } } public void setup() { Button btnSend = findViewById(R.id.btnSend); //데이터 전송 btnSend.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { bt.send("Text", true); } }); } public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == BluetoothState.REQUEST_CONNECT_DEVICE) { if (resultCode == Activity.RESULT_OK) bt.connect(data); } else if (requestCode == BluetoothState.REQUEST_ENABLE_BT) { if (resultCode == Activity.RESULT_OK) { bt.setupService(); bt.startService(BluetoothState.DEVICE_OTHER); setup(); } else { Toast.makeText(getApplicationContext() , "Bluetooth was not enabled." , Toast.LENGTH_SHORT).show(); finish(); } } }*/ //SMS전송 private void sendSMS(String phoneNumber, String message) { Log.d("success", "success"); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, null, null); } }
e52b630434c40f8bbf7f73fb22468a584e60a43e
d01357d7ad5be2ba1508f56a24d14df2af5b4889
/src/main/java/miw/klondike/factory/CardFactory.java
2fa162e5e0a77a7aaa6b32d3d4c599951f167cef
[]
no_license
chante29/Klondike_TDD
399d7efb7351937296d1bf19b6f8015a9c0ebcc7
969af7ad0a0449160c5b797c29f00bb3bc883985
refs/heads/master
2020-04-11T04:48:37.269584
2015-04-17T19:15:46
2015-04-17T19:15:46
33,688,224
0
0
null
null
null
null
UTF-8
Java
false
false
5,696
java
package miw.klondike.factory; import miw.klondike.Card; import miw.klondike.enumeration.Score; import miw.klondike.enumeration.Suit; import miw.klondike.score.As; import miw.klondike.score.Dame; import miw.klondike.score.Eight; import miw.klondike.score.Five; import miw.klondike.score.Four; import miw.klondike.score.Nine; import miw.klondike.score.Roi; import miw.klondike.score.Seven; import miw.klondike.score.Six; import miw.klondike.score.Ten; import miw.klondike.score.Three; import miw.klondike.score.Two; import miw.klondike.score.Valet; import miw.klondike.suit.Clubs; import miw.klondike.suit.Diamonds; import miw.klondike.suit.Hearts; import miw.klondike.suit.Spades; public class CardFactory { public static Card getCard(Score score, Suit suit, boolean covered) { switch(score){ case AS: switch(suit){ case HEARTS: return new As(new Hearts(), covered); case DIAMONDS: return new As(new Diamonds(), covered); case CLUBS: return new As(new Clubs(), covered); case SPADES: return new As(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case TWO: switch(suit){ case HEARTS: return new Two(new Hearts(), covered); case DIAMONDS: return new Two(new Diamonds(), covered); case CLUBS: return new Two(new Clubs(), covered); case SPADES: return new Two(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case THREE: switch(suit){ case HEARTS: return new Three(new Hearts(), covered); case DIAMONDS: return new Three(new Diamonds(), covered); case CLUBS: return new Three(new Clubs(), covered); case SPADES: return new Three(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case FOUR: switch(suit){ case HEARTS: return new Four(new Hearts(), covered); case DIAMONDS: return new Four(new Diamonds(), covered); case CLUBS: return new Four(new Clubs(), covered); case SPADES: return new Four(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case FIVE: switch(suit){ case HEARTS: return new Five(new Hearts(), covered); case DIAMONDS: return new Five(new Diamonds(), covered); case CLUBS: return new Five(new Clubs(), covered); case SPADES: return new Five(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case SIX: switch(suit){ case HEARTS: return new Six(new Hearts(), covered); case DIAMONDS: return new Six(new Diamonds(), covered); case CLUBS: return new Six(new Clubs(), covered); case SPADES: return new Six(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case SEVEN: switch(suit){ case HEARTS: return new Seven(new Hearts(), covered); case DIAMONDS: return new Seven(new Diamonds(), covered); case CLUBS: return new Seven(new Clubs(), covered); case SPADES: return new Seven(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case EIGHT: switch(suit){ case HEARTS: return new Eight(new Hearts(), covered); case DIAMONDS: return new Eight(new Diamonds(), covered); case CLUBS: return new Eight(new Clubs(), covered); case SPADES: return new Eight(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case NINE: switch(suit){ case HEARTS: return new Nine(new Hearts(), covered); case DIAMONDS: return new Nine(new Diamonds(), covered); case CLUBS: return new Nine(new Clubs(), covered); case SPADES: return new Nine(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case TEN: switch(suit){ case HEARTS: return new Ten(new Hearts(), covered); case DIAMONDS: return new Ten(new Diamonds(), covered); case CLUBS: return new Ten(new Clubs(), covered); case SPADES: return new Ten(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case VALET: switch(suit){ case HEARTS: return new Valet(new Hearts(), covered); case DIAMONDS: return new Valet(new Diamonds(), covered); case CLUBS: return new Valet(new Clubs(), covered); case SPADES: return new Valet(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case DAME: switch(suit){ case HEARTS: return new Dame(new Hearts(), covered); case DIAMONDS: return new Dame(new Diamonds(), covered); case CLUBS: return new Dame(new Clubs(), covered); case SPADES: return new Dame(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } case ROI: switch(suit){ case HEARTS: return new Roi(new Hearts(), covered); case DIAMONDS: return new Roi(new Diamonds(), covered); case CLUBS: return new Roi(new Clubs(), covered); case SPADES: return new Roi(new Spades(), covered); default: throw new IllegalArgumentException("Unexpected type card"); } default: throw new IllegalArgumentException("Unexpected type card"); } } }
3861580803c032c3afae5d2c6987dfaa2cb1ee6c
b7d5a0595cfb23d16b8e495f7afbd03191543ec5
/branches/V1.02/zhdj/src/main/java/cn/com/do1/component/util/uploadServlet.java
eb3bdbca81b1e8d8861f797e30bf8e1d75813b7d
[]
no_license
github188/Dangjian
a2a4aa6b875c5fa90c379fcb964ac1cdf25980fc
b510eb89c3b2edff9998105e043c4a56dbbe1106
refs/heads/master
2021-05-27T08:51:16.381332
2014-05-20T15:46:20
2014-05-20T15:46:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,323
java
package cn.com.do1.component.util; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; 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; import org.json.simple.JSONObject; import cn.com.do1.component.util.FileUploadUtil; public class uploadServlet extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub this.doPost(req, resp); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setCharacterEncoding("UTF-8"); response.setHeader("Charset","UTF-8"); PrintWriter out=response.getWriter(); JSONObject obj = new JSONObject(); //文件保存目录路径 String savePath = request.getSession().getServletContext().getRealPath("/") + "upload/file/"; //文件保存目录URL String saveUrl = request.getContextPath() +"/upload/file/"; // try { // saveUrl = ConfigMgr.get("imageSyn", "dpicUrl") + "/upload/news/"; // } catch (ConfigLoadExcetion e) { // e.printStackTrace(); // } //定义允许上传的文件扩展名 HashMap<String, String> extMap = new HashMap<String, String>(); extMap.put("image", "gif,jpg,jpeg,png,bmp"); extMap.put("flash", "swf,flv"); extMap.put("videoFile", "swf,flv,avi,rm,rmvb,3gp"); extMap.put("partyFile", "doc,ppt,xls,txt"); extMap.put("dataFile", "doc,ppt,xls,txt"); extMap.put("musicFile", "mp3"); extMap.put("versionFile", "apk,ipa"); extMap.put("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2"); //最大文件大小 long maxSize = 1000000000; response.setContentType("text/html; charset=UTF-8"); if(!ServletFileUpload.isMultipartContent(request)){ obj.put("tip", "请选择文件。"); out.println(obj.toJSONString()); return; } //检查目录 File uploadDir = new File(savePath); if(!uploadDir.isDirectory()){ uploadDir.mkdirs(); //out.println(getError("上传目录不存在。")); //return; } String dirName = request.getParameter("dir"); if (dirName == null) { dirName = "image"; } //创建文件夹 savePath += dirName + "/"; saveUrl += dirName + "/"; File saveDirFile = new File(savePath); if (!saveDirFile.exists()) { saveDirFile.mkdirs(); } SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); String ymd = sdf.format(new Date()); savePath += ymd + "/"; saveUrl += ymd + "/"; File dirFile = new File(savePath); if (!dirFile.exists()) { dirFile.mkdirs(); } DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(2048*1024); myProgressListener getBarListener = new myProgressListener(request); ServletFileUpload upload = new ServletFileUpload(factory); upload.setProgressListener(getBarListener); upload.setHeaderEncoding("UTF-8"); try { List formList = upload.parseRequest(request); Iterator<Object> formItem = formList.iterator(); // 将进度监听器加载进去 while (formItem.hasNext()) { FileItem item = (FileItem) formItem.next(); String fileName = item.getName(); long fileSize = item.getSize(); if (item.isFormField()) { System.out.println("Field Name:" + item.getFieldName()); if("file".equals(item.getFieldName())){ obj.put("tip", "请选择文件。"); out.println(obj.toJSONString()); return; } } else { //检查文件大小 if(item.getSize() > maxSize){ obj.put("tip", "上传文件大小超过限制。"); out.println(obj.toJSONString()); return; } //检查扩展名 String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); if(!Arrays.<String>asList(extMap.get(dirName).split(",")).contains(fileExt)){ obj.put("tip", "上传文件扩展名是不允许的扩展名。\n只允许" + extMap.get(dirName) + "格式。"); out.println(obj.toJSONString()); return; } String uuid = java.util.UUID.randomUUID().toString(); String newFileName = uuid + "." + fileExt; try{ File uploadedFile = new File(savePath, newFileName); item.write(uploadedFile); }catch(Exception e){ obj.put("tip", "上传文件失败。"); out.println(obj.toJSONString()); e.printStackTrace(); return; } // 同步图片至文件服务器 // File file=new File(savePath+newFileName); // String backURL=""; // FileUploadUtil up=new FileUploadUtil(); // try { // backURL=up.uploadFileBySMB(file, "upload/file/"+dirName+"/"+ymd, newFileName); // obj.put("url", backURL); // obj.put("result", "true"); // out.println(obj.toJSONString()); // } catch (Exception e1) { // obj.put("tip", "同步文件至文件服务器失败。"); // out.println(obj.toJSONString()); // e1.printStackTrace(); // } obj.put("url", "upload/file/"+dirName+"/"+ymd+"/"+newFileName); obj.put("result", "true"); out.println(obj.toJSONString()); } } } catch (FileUploadException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void init(ServletConfig config) throws ServletException { // TODO Auto-generated method stub super.init(config); } }
f93e8b778fbd20908ab483cc3920b2506a696c6e
2e17ca6a917410764d89ba052e700da5e47f0312
/src/com/goitjb4/projects/tictactoe/AIKoss.java
452433e2130632edd0596165b912341b914ee983
[]
no_license
vtolok/TicTacToe
3bc5328a429abc3006061e37c3c29fef1c4443e6
a3e821ad79b50880f9b53e44bc892b149eba6266
refs/heads/master
2021-01-10T01:31:45.098374
2016-11-21T20:41:07
2016-11-21T20:41:07
46,442,061
0
0
null
null
null
null
UTF-8
Java
false
false
2,472
java
package com.goitjb4.projects.tictactoe; import java.util.Arrays; public class AIKoss extends AbstractAI { private static final int BOARD_SIZE = 9; private static final int PLAYER_X = 1; private static final int PLAYER_O = -1; private static final int PLAYER_X_WON = 4; private static final int DRAWN_GAME = 3; private static final int PLAYER_O_WON = 2; private static final int[][] WIN_PATTERNS = { { 0, 1, 2 }, // Row 1 { 3, 4, 5 }, // Row 2 { 6, 7, 8 }, // Row 3 { 0, 3, 6 }, // Column 1 { 1, 4, 7 }, // Column 2 { 2, 5, 8 }, // Column 3 { 0, 4, 8 }, // Diagonal 1 { 2, 4, 6 } // Diagonal 2 }; private class Node { public int score; public int index; public Node() { } public Node(int score, int index) { this.score = score; this.index = index; } } private int[] board = new int[BOARD_SIZE]; @Override public int move(int[] board, int player) { this.board = Arrays.copyOf(board, BOARD_SIZE); int res = -1; if (isBoardEmpty()) { res = (int) (Math.random() * BOARD_SIZE); } else { Node node = minimax(player); res = node.index; } return res; } private boolean isBoardEmpty() { for (int i = 0; i < board.length; i++) { if (board[i] != 0) { return false; } } return true; } private boolean isBoardFull() { for (int i = 0; i < board.length; i++) { if (board[i] == 0) { return false; } } return true; } private int getWin() { for (int i = 0; i < WIN_PATTERNS.length; i++) { if (board[WIN_PATTERNS[i][0]] != 0 && board[WIN_PATTERNS[i][0]] == board[WIN_PATTERNS[i][1]] && board[WIN_PATTERNS[i][0]] == board[WIN_PATTERNS[i][2]]) { return board[WIN_PATTERNS[i][0]]; } } return 0; } private int isGameOver() { int win = getWin(); if (win == PLAYER_X) { return PLAYER_X_WON; } else if (win == PLAYER_O) { return PLAYER_O_WON; } else if (isBoardFull()) { return DRAWN_GAME; } else { return 0; } } private Node minimax(int player) { int end = isGameOver(); if (end != 0) { return new Node(end, 0); } Node best = new Node(); best.score = (player == PLAYER_X) ? Integer.MIN_VALUE : Integer.MAX_VALUE; for (int i = 0; i < board.length; i++) { if (board[i] == 0) { board[i] = player; Node opp = minimax(-player); board[i] = 0; if ((player * opp.score) > (player * best.score)) { best.index = i; best.score = opp.score; } } } return best; } }
5e0723866c7ee266811f8276e5a0b1bf28552e46
cf1cbd8fc45ddd893da512ce3f2e8d0e3d288291
/src/main/java/onethreeseven/stopmove/view/StopMoveMenuSupplier.java
2a92907269a3692ff04727acf152dfb0923e86f1
[ "MIT" ]
permissive
kapiya/137-stopmove
541cdbbf0b2ef456f6c9b55fe30251ff28c5db2d
b91a05a7319414433df529bfdab0ed4423729cae
refs/heads/master
2021-09-16T04:12:11.598560
2018-06-16T01:06:59
2018-06-16T01:06:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,609
java
package onethreeseven.stopmove.view; import javafx.stage.Stage; import onethreeseven.trajsuitePlugin.model.BaseTrajSuiteProgram; import onethreeseven.trajsuitePlugin.view.*; /** * Supplies stop/move menu to other modules * @author Luke Bermingham */ public class StopMoveMenuSupplier implements MenuSupplier { @Override public void supplyMenus(AbstractMenuBarPopulator populator, BaseTrajSuiteProgram program, Stage primaryStage) { TrajSuiteMenu preprocessingMenu = new TrajSuiteMenu("Pre-processing", 4); TrajSuiteMenu subMenuStopMove = new TrajSuiteMenu("Find Stops/Moves", 0); preprocessingMenu.addChild(subMenuStopMove); //posmit TrajSuiteMenuItem posmitMenuItem = new TrajSuiteMenuItem("POSMIT", ()->{ ViewUtil.loadUtilityView(StopMoveMenuSupplier.class, primaryStage, "POSMIT", "/onethreeseven/stopmove/view/posmit.fxml"); }); subMenuStopMove.addChild(posmitMenuItem); //cbsmot TrajSuiteMenuItem cbsmotMenuItem = new TrajSuiteMenuItem("CB-SMoT", ()->{ ViewUtil.loadUtilityView(StopMoveMenuSupplier.class, primaryStage, "CB-SMoT", "/onethreeseven/stopmove/view/cbsmot.fxml"); }); subMenuStopMove.addChild(cbsmotMenuItem); //gbsmot TrajSuiteMenuItem gbsmotMenuItem = new TrajSuiteMenuItem("GB-SMoT", ()->{ ViewUtil.loadUtilityView(StopMoveMenuSupplier.class, primaryStage, "GB-SMoT", "/onethreeseven/stopmove/view/gbsmot.fxml"); }); subMenuStopMove.addChild(gbsmotMenuItem); populator.addMenu(preprocessingMenu); } }
a7dbf65a10dcf3deb590ad492b65943f49cc65ff
d23ee237546bc8a89d6cc45ecbe000a55d38a4b3
/src/main/java/com/ccyang/stack/util/Main.java
5a39ab8f612df0baaf61cd4bb2d3aa2e133bbc7f
[]
no_license
yangSirKo/Data-Structures
15e5478cb47ebf5c8c468247bcede873e853606c
8135b7a95b8fd3e33a2d39c6e0e94d544069d62f
refs/heads/master
2020-03-26T19:53:13.309181
2018-08-21T15:13:33
2018-08-21T15:13:33
145,291,580
3
0
null
null
null
null
UTF-8
Java
false
false
1,136
java
package com.ccyang.stack.util; import java.util.Random; /** * @author ccyang * @date 2018/8/21 21:56 */ public class Main { private static double testStack(Stack<Integer> stack, int opCount){ long startTime = System.nanoTime(); Random random = new Random(); for (int i=0; i<opCount; i++) stack.push(random.nextInt(Integer.MAX_VALUE)); for (int i=0; i<opCount; i++) stack.pop(); long endTime = System.nanoTime(); return (endTime - startTime) / 1000000000.0 ; } public static void main(String[] args) { int opCount = 100000; ArrayStack<Integer> arrayStack = new ArrayStack<>(); double time1 = testStack(arrayStack, opCount); System.out.println("ArrayStack: time1 = " + time1 +"s"); // 0.0373s LinkedListStack<Integer> linkedListStack = new LinkedListStack<>(); double time2 = testStack(linkedListStack, opCount); System.out.println("LinkedListStack: time2 = " + time2 +"s"); // 0.0154s // 这个比较很复杂,因为LinkedListStack 中包含更多的 new操作 } }
decda456fe25dbc928b63ae4df759ab0888772a3
c4e1ae3fac4a55083c64ee9d0756240497850daf
/src/main/java/com/gds/entity/MyFile.java
694365f1aadcdd4ca72dcfd92268a6e099412286
[]
no_license
sxzyc/gds
6461b93311c638cc6ac84a7cfa681b3ad8c45d0e
00a1be1d296df5ec7ca3aa4cb2b153bb11799132
refs/heads/master
2021-09-15T14:08:14.995087
2018-06-04T03:42:18
2018-06-04T03:42:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,478
java
package com.gds.entity; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.Date; public class MyFile implements Serializable { private Integer fileId; private String fileName; private String fileUrl; private String fileIntroduce; private String uploadUsername; private Date fileCreatTime; private String plan001; private String plan002; public Integer getFileId() { return fileId; } public void setFileId(Integer fileId) { this.fileId = fileId; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName == null ? null : fileName.trim(); } public String getFileUrl() { return fileUrl; } public void setFileUrl(String fileUrl) { this.fileUrl = fileUrl == null ? null : fileUrl.trim(); } public String getFileIntroduce() { return fileIntroduce; } public void setFileIntroduce(String fileIntroduce) { this.fileIntroduce = fileIntroduce == null ? null : fileIntroduce.trim(); } public String getUploadUsername() { return uploadUsername; } public void setUploadUsername(String uploadUsername) { this.uploadUsername = uploadUsername == null ? null : uploadUsername.trim(); } public String getFileCreatTime() { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(fileCreatTime); } public void setFileCreatTime(Date fileCreatTime) { this.fileCreatTime = fileCreatTime; } public String getPlan001() { return plan001; } public void setPlan001(String plan001) { this.plan001 = plan001 == null ? null : plan001.trim(); } public String getPlan002() { return plan002; } public void setPlan002(String plan002) { this.plan002 = plan002 == null ? null : plan002.trim(); } @Override public String toString() { return "MyFile{" + "fileId=" + fileId + ", fileName='" + fileName + '\'' + ", fileUrl='" + fileUrl + '\'' + ", fileIntroduce='" + fileIntroduce + '\'' + ", uploadUsername='" + uploadUsername + '\'' + ", fileCreatTime=" + fileCreatTime + ", plan001='" + plan001 + '\'' + ", plan002='" + plan002 + '\'' + '}'; } }
75855c754a858987dbdb406261168f2709abaf85
daaaab604b7a94503dae01eace8ab793712d9142
/Elective/src/ua/nure/jurkov/SummaryTask4/controller/action/lecturer/ViewCoursesOfLecturerAction.java
6c448db4bf6c2c003d5d86bd5f4bae010cd8879c
[]
no_license
ilemon12/SummaryTask4
4a43407b6fa50ab020593563b7f8efa437ce39e1
1bf7e1b95a682303f39dc9f8f54e56c2c0013f83
refs/heads/master
2020-12-02T08:44:56.146643
2016-08-28T14:58:28
2016-08-28T14:58:28
66,823,143
0
1
null
null
null
null
UTF-8
Java
false
false
1,660
java
package ua.nure.jurkov.SummaryTask4.controller.action.lecturer; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import ua.nure.jurkov.SummaryTask4.controller.action.Action; import ua.nure.jurkov.SummaryTask4.controller.action.View; import ua.nure.jurkov.SummaryTask4.controller.action.View.TypeDispatch; import ua.nure.jurkov.SummaryTask4.domain.course.Course; import ua.nure.jurkov.SummaryTask4.domain.course.CoursesManager; import ua.nure.jurkov.SummaryTask4.domain.course.CoursesManagerImpl; import ua.nure.jurkov.SummaryTask4.domain.customer.Customer; public class ViewCoursesOfLecturerAction extends Action{ private static final Logger LOG = Logger.getLogger(ViewCoursesOfLecturerAction.class); @Override public View process(HttpServletRequest request, HttpServletResponse response) { LOG.debug("Start processing Action"); View view = new View("CoursesOfLecturer", TypeDispatch.FORWARD); HttpSession session = request.getSession(); Customer customer = (Customer)session.getAttribute("customer"); LOG.trace("Got customer from session: " + customer); CoursesManager coursesManager = new CoursesManagerImpl(daoFactory); List<Course> courses = coursesManager.getCoursesByLecturer(customer.getId()); LOG.trace("Got courses by id: " + customer.getId() + ", --> " + courses); request.setAttribute("courses", courses); LOG.trace("Set as attribute courses: " + courses); LOG.debug("Finished processing Action"); return view; } }
618b645cf5c8cde787ea065d64ec2f3795db6e7f
8de3c7c110596ff9934385561bd424b0c985c789
/app/src/main/java/com/example/dx/utilproject/net/SimpleHttp.java
7da61a9005d69290a04a85db7906ff9cd9ace541
[]
no_license
Blackunit/UtilProject
edfd51a50fc628cfd428764d822b4e20d026f17c
550eb0bb66f43379bbae4384543bbc609ed6b98b
refs/heads/master
2020-03-28T12:34:30.537135
2018-06-03T13:55:03
2018-06-03T13:55:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,843
java
package com.example.dx.utilproject.net; import android.os.Handler; import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.Map; /** * 扩展性不强,需要重新设计,需要更换使用Okhttp时怎么办,数据需要加解密,验证怎么办 * 自己简单的对HttpURLConnection进行了封装 * Created by DX on 2017/7/4. */ public class SimpleHttp { //是否允许输出日志 private static final boolean PRINT_LOG = true; private static final String DEFAULT_CHARSET = "UTF-8"; private static final String TAG = "SimpleHttp"; private int mConnTimeOut = 60000; private int mReadTimeOut = 2 * 60000; public static interface Listener { void onResponse(String response); } public SimpleHttp(int mConnTimeOut, int mReadTimeOut) { this.mConnTimeOut = mConnTimeOut; this.mReadTimeOut = mReadTimeOut; } public SimpleHttp() { } public SimpleHttp(int mConnTimeOut) { this.mConnTimeOut = mConnTimeOut; } private void logI(String msg) { if (PRINT_LOG) { Log.i(TAG, msg); } } private void logE(String msg) { Log.e(TAG, msg); } private String encodeStr(String data, String charset) { String str = data; try { str = URLEncoder.encode(data, charset); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return str; } private String encodeStr(String data) { return encodeStr(data, DEFAULT_CHARSET); } private String encodeParams(Map<String, String> params) { StringBuilder sb = new StringBuilder(); if (params != null && params.size() > 0) { for (Map.Entry<String, String> entry : params.entrySet()) { sb.append(entry.getKey()); sb.append("="); sb.append(encodeStr(entry.getValue())); sb.append("&"); } //移除最后一个多余的"&"符号 sb.deleteCharAt(sb.lastIndexOf("&")); } return sb.toString(); } private String encodeUrl(String urlStr, Map<String, String> params) { if (params == null || params.size() == 0) { return urlStr; } logI("encodeUrl-->url=" + urlStr); return urlStr+"?"+encodeParams(params); } public String get(String urlStr, Map<String, String> params) { String url = encodeUrl(urlStr, params); return get(url); } private String get(final String urlStr) { String result = ""; HttpURLConnection connection = null; BufferedReader reader = null; try { URL url = new URL(urlStr); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Accept-Charset", DEFAULT_CHARSET); connection.setRequestProperty("contentType", DEFAULT_CHARSET); connection.setReadTimeout(mReadTimeOut); connection.setConnectTimeout(mConnTimeOut); int code = connection.getResponseCode(); if (code == 200) { InputStream is = connection.getInputStream(); StringBuilder sb = new StringBuilder(); reader = new BufferedReader(new InputStreamReader(is, DEFAULT_CHARSET)); while ((result = reader.readLine()) != null) { sb.append(result); } result = sb.toString(); } else { logE("get:url=" + urlStr); logE("get:error code=" + code); } }catch (IOException e) { logE("get:url=" + urlStr); logE(e.toString()); } finally { if (connection != null) { connection.disconnect(); } if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return result; } public String post(String urlStr, String data) { return post(urlStr,null,data); } public String post(String url, Map<String, String> params, String data) { String urlStr=url; String result = ""; urlStr = encodeUrl(urlStr, params); StringBuilder sb = new StringBuilder(); HttpURLConnection connection = null; try { URL url_ = new URL(urlStr); connection = (HttpURLConnection) url_.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setConnectTimeout(mConnTimeOut); connection.setRequestProperty("Content-Type", "application/json; charset=" + DEFAULT_CHARSET);//application/x-www-form-urlencoded if (data!=null) { OutputStream os = connection.getOutputStream(); os.write(data.getBytes()); os.flush(); os.close(); } int code = connection.getResponseCode(); if (code == 200) { InputStream is = connection.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is, DEFAULT_CHARSET)); String line; while ((line = br.readLine()) != null) { sb.append(line); } br.close(); result = sb.toString(); } else { logE("post:url=" + urlStr); logE("post:error code=" + code); } }catch (IOException e) { logE("post:url=" + urlStr); logE(e.toString()); } finally { if (connection != null) { connection.disconnect(); } } return result; } public void getAsync(final String urlStr, final Listener listener, Handler handler) { handler.post(new Runnable() { @Override public void run() { String response = get(urlStr); if (listener != null) { listener.onResponse(response); } } }); } public void getAsync(final String urlStr, final Listener listener) { new Thread(new Runnable() { @Override public void run() { String response = get(urlStr); if (listener != null) { listener.onResponse(response); } } }).start(); } public void postAsync(final String urlStr, final Map<String, String> params, final String data, final Listener listener, Handler handler) { handler.post(new Runnable() { @Override public void run() { String response = post(urlStr, params,data); if (listener != null) { listener.onResponse(response); } } }); } public void postAsync(final String urlStr, final Map<String, String> params, final String data, final Listener listener) { new Thread(new Runnable() { @Override public void run() { String response = post(urlStr, params,data); if (listener != null) { listener.onResponse(response); } } }).start(); } }
f240c89fa85fd427022fa2ebc73ceaa1451be119
1539c20241768a8a016a9463dd04effe1b48285a
/data-structure/src/main/java/com/vista/drill/improve/f动态规划/MaxSubArray.java
ed812c1a6364de84521910a575c7bab8c89efc61
[]
no_license
VVvista/vista-drill
540477cfdd76325e104cd69933bb002c60a9f262
5433a468b1ed07ce6c72198b74a427c4aebc3a13
refs/heads/master
2021-04-08T03:41:06.672973
2021-02-19T02:48:50
2021-02-19T02:48:50
248,736,526
0
0
null
null
null
null
UTF-8
Java
false
false
2,022
java
package com.vista.drill.improve.f动态规划; /** * 1.最大连续子序列和 * 给定一个长度为 n 的整数序列,求它的最大连续子序列和 * 状态:dp(i) 以 nums(i)结尾的最大连续子序列和 * 初始状态:dp(0)=nums(0) * 状态转移方程: * 若dp(i-1)>0,dp(i)=dp(i-1)+nums(i) * 若dp(i-1)<=0,dp(i)=nums(i) *https://leetcode-cn.com/problems/maximum-subarray/ * @author WenTingTing by 2020/9/22 */ public class MaxSubArray { public static void main(String[] args) { int[] nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4}; System.out.println(maxSubArray1(nums)); System.out.println(maxSubArray2(nums)); } /** * 动态规划 * 方案1 * * 状态转移方程: * * 若dp(i-1)>0,dp(i)=dp(i-1)+nums(i) * * 若dp(i-1)<=0,dp(i)=nums(i) * * * * @param nums * @return */ private static int maxSubArray1(int[] nums) { if (nums == null || nums.length == 0) return Integer.MIN_VALUE; int[] dp = new int[nums.length]; int max = nums[0]; dp[0] = nums[0]; for (int i = 1; i < nums.length; i++) { if (dp[i - 1] > 0) { dp[i] = dp[i - 1] + nums[i]; } else { dp[i] = nums[i]; } max = Math.max(dp[i], max); } return max; } /** * 动态规划 * 方案2:方案1优化 * 1.在方案1基础上将中间状态由数组int[]保存改为变量int 存储 * 2.优化状态转移方程: * dp(i)=max{dp(i-1)+nums(i),nums(i)} * * @param nums * @return */ private static int maxSubArray2(int[] nums) { if (nums == null || nums.length == 0) return Integer.MIN_VALUE; int dp = nums[0];// 中间状态由变量保存 int max = nums[0]; for (int i = 1; i < nums.length; i++) { dp = Math.max(dp + nums[i], nums[i]); max = Math.max(dp, max); } return max; } }
f3840e05508ba5f0b25354537b8c167b2a520fe3
8de7fac429f41841120df6721d2c693fced70a02
/Marcu Ioan/we/Missle.java
56db780fc18ab9cda783b8402a69618a0ff3d20f
[ "MIT" ]
permissive
Ioan1995/labtemplate
7b30920c52817aa493e2d488254c1d811c578f4b
95dab619e60a8ef1d81d504eb57794c32f089a71
refs/heads/master
2021-09-04T04:06:44.982917
2018-01-15T17:19:26
2018-01-15T17:19:43
112,223,502
0
4
null
2017-11-27T16:57:42
2017-11-27T16:57:41
null
UTF-8
Java
false
false
2,715
java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.util.List; public class Missle extends Actor { public Airplane sar; public double posx,posy,veloc=3; public double targetx,targety; public boolean DEAD= false; private int jeda=0; public void addedToWorld(World Space) { List<Airplane> rockets= getWorld().getObjects(Airplane.class); if(rockets!=null && rockets.size()>0) { sar = rockets.get(0); } GreenfootImage image = new GreenfootImage(getImage()); image.scale((int)(0.5*image.getWidth()),(int)(0.5*image.getHeight())); setImage(image); targetx=posx=getX(); targety=posy=getY(); } public void move() { double rx = targetx-posx; double ry = targety-posy; double r = Math.sqrt(rx*rx+ry*ry); double angle= Math.atan2(ry,rx)*180/Math.PI; int direction = MainSudut.getDirection(getRotation(),(int)angle); int bts = 7; if(Math.abs(direction)>10){ direction= (direction<0)?-bts:bts; } direction+=getRotation(); posx+=veloc*Math.cos(1.0*direction*Math.PI/180); posy+=veloc*Math.sin(1.0*direction*Math.PI/180); setLocation((int)posx,(int)posy); setRotation(direction); } public void checkRocket() { Actor rocket = getOneIntersectingObject(Airplane.class); if(rocket!=null) { ((Airplane)rocket).Destr(); Destr(); } } public void Destr() { DEAD=true; for(int i=0;i<=10;i++) { Fereste fereste= new Fereste(); getWorld().addObject(fereste,getX()-50+Greenfoot.getRandomNumber(100),getY()-50+Greenfoot.getRandomNumber(100)); GreenfootImage img = new GreenfootImage(30,20); img.drawImage(getImage(),-Greenfoot.getRandomNumber(getImage().getWidth()),Greenfoot.getRandomNumber(getImage().getHeight())); fereste.setImage(img); } } public void act() { if(DEAD) { getWorld().removeObject(this); } else { if(sar!=null && !sar.DEAD) { targetx=sar.getX(); targety=sar.getY(); } else { if(jeda==0) { targetx=Greenfoot.getRandomNumber(getWorld().getWidth()); targety=Greenfoot.getRandomNumber(getWorld().getHeight()); jeda=100; } } move(); checkRocket(); if(jeda>0)jeda--; } } }
5f8d6f4a0753ad298f9b7c7479e463bad3fd29a7
36c56d5674a9015598e4f71d8d5ec744a086c8fb
/src/main/java/com/store/dto/ProductDTO.java
299270175c968b46cb7f63ec87a6ef85d952f0ae
[]
no_license
IvsonSantos/store-backend
5a10449dab0f74d17ed6ad722a5d02e329ac8d80
0edfe42968e67a10426732b1d3dd08b3960b6d6e
refs/heads/main
2023-06-18T17:03:31.118586
2021-07-16T10:45:11
2021-07-16T10:45:11
386,602,581
0
0
null
null
null
null
UTF-8
Java
false
false
1,494
java
package com.store.dto; import com.store.entity.Product; import com.store.service.ProductCategoryService; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; import javax.validation.constraints.NotEmpty; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; @Getter @Setter @NoArgsConstructor public class ProductDTO implements Serializable { private static final long serialVersionUID = 1L; private Long id; private Long category; @NotEmpty(message = "Field is required") private String name; @NotEmpty(message = "Field is required") private String description; @NotEmpty(message = "Field is required") private BigDecimal unitPrice; @NotEmpty(message = "Field is required") private String imageUrl; @NotEmpty(message = "Field is required") private boolean active; @NotEmpty(message = "Field is required") private int unitsInStock; private LocalDateTime dateCreated; public ProductDTO(Product product) { this.id = product.getId(); this.category = product.getCategory().getId(); this.name = product.getName(); this.description = product.getDescription(); this.unitPrice = product.getUnitPrice(); this.imageUrl = product.getImageUrl(); this.active = product.isActive(); this.unitsInStock = product.getUnitsInStock(); } }
[ "Belgique@2024" ]
Belgique@2024
54c2982bb5e44280e18da0c8a92b26fb18a74c94
27bbd4fd6f4eaf709b646d96e12c7db1351cb48e
/abc1/abc11/abc111/ABC111C.java
5cd6c47c1b55bc8df1bb2a813708bc1069c95215
[]
no_license
sanopi/my-atcoder-log
1eaddc512109e40b7360a120ae76887940d948da
7d586aad3471167c141623cb9a49b4e317f0f981
refs/heads/master
2023-08-31T01:30:13.933668
2023-08-18T16:05:31
2023-08-18T16:05:31
188,691,858
0
0
null
null
null
null
UTF-8
Java
false
false
2,122
java
import java.io.PrintWriter; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.stream.Collectors; public class ABC111C { public static void main(String[] args) { int n = nextInt(); int[] v = nextIntArray(n); Map<Integer, Integer> countsE = new HashMap<>(); Map<Integer, Integer> countsO = new HashMap<>(); for (int i = 0; i < n; i++) { countsE.put(v[i], countsE.getOrDefault(v[i], 0)+1); i++; countsO.put(v[i], countsO.getOrDefault(v[i], 0)+1); } int ans = Integer.MAX_VALUE; List<Map.Entry<Integer, Integer>> es = countsE.entrySet().stream().sorted(Comparator.comparing(entry -> -entry.getValue())).limit(2).collect(Collectors.toList()); List<Map.Entry<Integer, Integer>> os = countsO.entrySet().stream().sorted(Comparator.comparing(entry -> -entry.getValue())).limit(2).collect(Collectors.toList()); for (Map.Entry<Integer, Integer> e : es) { for (Map.Entry<Integer, Integer> o : os) { if (e.getKey().equals(o.getKey())) { continue; } ans = Math.min(ans, n-e.getValue()-o.getValue()); } } if (ans == Integer.MAX_VALUE) { ans = n/2; } out.println(ans); out.flush(); } static PrintWriter out = new PrintWriter(System.out); static Scanner scanner = new Scanner(System.in); static String next() { return scanner.next(); } static int nextInt() { return Integer.parseInt(next()); } static long nextLong() { return Long.parseLong(next()); } static double nextDouble() { return Double.parseDouble(next()); } static int[] nextIntArray(int n) { int[] array = new int[n]; for (int i = 0; i < n; i++) { array[i] = nextInt(); } return array; } static long[] nextLongArray(int n) { long[] array = new long[n]; for (int i = 0; i < n; i++) { array[i] = nextLong(); } return array; } }
02a9c9d7268f3f096bdaf3ba350277a794828081
2b1a7d8d5d1b74d783c5fa51ddfb29510f3c3ada
/src/main/java/com/extra/feature/dto/EmailReciver.java
fa0b54bd607816cc2277a5e8d2604e0df39d12be
[]
no_license
Nazifa-Mosharrat/extra_feature_gmail
e746a671f58c0506e01ac92e7071d5bf76b1dfa5
111863d47bb9c63725d1c234e69b75c7828fcd46
refs/heads/main
2023-06-01T06:50:58.495736
2021-06-06T15:02:15
2021-06-06T15:02:15
305,039,675
0
0
null
null
null
null
UTF-8
Java
false
false
430
java
package com.extra.feature.dto; public class EmailReciver { private String reciverName; private String reciverEmail; public String getReciverName() { return reciverName; } public void setReciverName(String reciverName) { this.reciverName = reciverName; } public String getReciverEmail() { return reciverEmail; } public void setReciverEmail(String reciverEmail) { this.reciverEmail = reciverEmail; } }
fd52afd3fbb8e313808181b04f9961c165f13e41
58573ac282df5fb5348f2666e5c1e5c790df8ac9
/app/src/main/java/com/xxx/willing/model/glide/GlideUrlUtil.java
e4ce353dc9cde701ad7d048eda99f8be336db893
[]
no_license
baskFuming/WILLing
e3caf92d4b988afbcce56dbc83e2b3d3d65533cb
6efffad5517ccb8826d3e2de1789da29045dd169
refs/heads/master
2020-12-02T03:00:21.736010
2019-12-30T06:44:20
2019-12-30T06:44:20
230,862,724
0
0
null
null
null
null
UTF-8
Java
false
false
2,780
java
package com.xxx.willing.model.glide; import android.content.Context; import android.view.View; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.xxx.willing.R; /** * Glide工具类 */ public class GlideUrlUtil { /** * 加载Url图片 */ public static void load(Context context, String url, int defaultImageId, ImageView imageView) { if (context != null) { Glide.with(context) .load(url) .asBitmap() .placeholder(defaultImageId)//设置加载中图片 .fallback(defaultImageId) .error(defaultImageId) .into(imageView); } } /** * 加载动图Url图片 */ public static void loadGif(Context context, String url, int defaultImageId, ImageView imageView) { if (context != null) { Glide.with(context) .load(url) .asGif() .placeholder(defaultImageId)//设置加载中图片 .fallback(defaultImageId) .error(defaultImageId) .into(imageView); } } /** * 加载圆形Url图片 */ public static void loadCircle(Context context, String url, int defaultImageId, ImageView imageView) { if (context != null) { Glide.with(context) .load(url) .asBitmap() .placeholder(defaultImageId)//设置加载中图片 .fallback(defaultImageId) .error(defaultImageId) .into(new CircleTransformation(context, imageView)); } } /** * 加载圆角Url图片 */ public static void loadFillet(Context context, String url, int defaultImageId, ImageView imageView) { if (context != null) { Glide.with(context) .load(url) .asBitmap() .placeholder(defaultImageId)//设置加载中图片 .fallback(defaultImageId) .error(defaultImageId) .into(new FilletTransformation(context, imageView)); } } /** * 加载背景Url图片 */ public static void loadBack(Context context, String url, int defaultImageId, View view) { if (context != null) { Glide.with(context) .load(url) .asBitmap() .placeholder(defaultImageId)//设置加载中图片 .fallback(defaultImageId) .error(defaultImageId) .into(new BackTransformation(context, view)); } } }
e3a55228fb1c14d5790b63f221e55e4d2e2da38d
1dc6292858c1474890c4b35b3aa679a93f81897a
/src/main/java/com/financial/exchange/market/models/dto/SearchTransactionDto.java
b7fc35b1236b38568ef973fb61c7665a6c5ac7c9
[]
no_license
javimayer14/financiera
2f2af799df78e17539417d82d17ef7bae1f7fee5
e5187caf942c7b1334e5ad5e2ca7c31045a37cc6
refs/heads/master
2023-04-11T15:04:49.078978
2021-04-13T13:02:13
2021-04-13T13:02:13
344,569,409
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
package com.financial.exchange.market.models.dto; import java.util.Date; import java.util.List; import com.financial.exchange.market.models.entity.OperationStatus; import com.financial.exchange.market.models.entity.OperationType; import lombok.Data; @Data public class SearchTransactionDto { Long id; Long accountId; List<OperationType> operationType; List<OperationStatus> operationStatus; Date timeSince; Date timeUntil; Float minAmount; Float maxAmount; }
93043f3363abc9db43d483ccf230df66690e1902
b5f910918f36dc399e2eaa745e43d5b04ad9ec41
/fabric-1.19.4/src/main/java/org/dynmap/fabric_1_19_4/FabricLogger.java
076e97946b2c492ec2fce3f28e3f4eb2cabf2a31
[ "Apache-2.0" ]
permissive
webbukkit/dynmap
ba2c8b04cc52c5b07f68f161717b2fabfff7b310
eed1a2b4440c5ef7f9e45f351c631bf4e573f552
refs/heads/v3.0
2023-08-31T17:57:45.191734
2023-08-30T15:59:46
2023-08-30T15:59:46
1,201,104
1,897
671
Apache-2.0
2023-09-14T00:54:20
2010-12-27T18:47:24
Java
UTF-8
Java
false
false
962
java
package org.dynmap.fabric_1_19_4; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.dynmap.utils.DynmapLogger; public class FabricLogger implements DynmapLogger { Logger log; public static final String DM = "[Dynmap] "; FabricLogger() { log = LogManager.getLogger("Dynmap"); } @Override public void info(String s) { log.info(DM + s); } @Override public void severe(Throwable t) { log.fatal(t); } @Override public void severe(String s) { log.fatal(DM + s); } @Override public void severe(String s, Throwable t) { log.fatal(DM + s, t); } @Override public void verboseinfo(String s) { log.info(DM + s); } @Override public void warning(String s) { log.warn(DM + s); } @Override public void warning(String s, Throwable t) { log.warn(DM + s, t); } }
32dc3e8e299ef83c4e1b517217df6866a340e063
8e17c72f50d78c52a9ba5837cbf28e0a05470424
/src/main/java/com/laotek/churchguru/daos/notification/NotificationDao.java
7a0bf453598555ffbf43ab10ab514775db9bd7c8
[]
no_license
larryoke/churchguru-web
7cbaf6ccfabc96727b9ce13b519c59ec9c449a0f
2d33a30a59a82d56a8e827e2a59286abf84e70a1
refs/heads/master
2021-01-11T14:58:31.286962
2018-12-05T17:18:46
2018-12-05T17:18:46
80,263,931
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package com.laotek.churchguru.daos.notification; import java.util.List; import java.util.Map; import com.laotek.churchguru.model.Notification; import com.laotek.churchguru.model.shared.enums.MemberSearchType; public interface NotificationDao { List<Notification> getNotifications(); void load(); void updateNotification(Notification notification); void createActivatableNotifications( BirthdayHTMLFormatter birthdayHTMLFormatter, DemographicsHTMLFormatter demographicsHTMLFormatter); public interface BirthdayHTMLFormatter { String formatWeekly(int lastWeekCount, int thisWeekCount, int nextWeekCount, String servername, String orgName); String formatDaily(int yesterday, int today, int tomorrow, String servername, String orgName); String formatMonthly(int thisMonthCount, String servername, String orgName); } public interface DemographicsHTMLFormatter { String format(Map<MemberSearchType, Integer> counts, String servername, String orgName); } }
30659f953bee5bfd7f283353a788e9aaa2701bcd
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project20/src/test/java/org/gradle/test/performance20_1/Test20_58.java
6bc41699bc4d501edb29466e14a65344f9d13d0f
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
289
java
package org.gradle.test.performance20_1; import static org.junit.Assert.*; public class Test20_58 { private final Production20_58 production = new Production20_58("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
854d6ad7502e7acdc30359371fedc6a378c67143
c32abb4d0a06055cb0fde3a3a3bb4b103feb98ae
/src/main/java/org/jinvestor/datasource/converter/FastRawCsvToDbRowConverter.java
9df05a4283391e5fe34861f7cd4d1d8cb2fab145
[]
no_license
v0rin/jinvestor
3ea3355ba9edb7a2d2b0706c3335ddbec0d3fc35
426fe2987b928ad3b8b74d306a36ca138f91f403
refs/heads/master
2022-05-28T15:04:43.056848
2021-04-02T09:33:36
2021-04-02T09:33:36
106,945,696
0
0
null
2022-05-20T20:45:38
2017-10-14T16:53:15
Java
UTF-8
Java
false
false
4,398
java
package org.jinvestor.datasource.converter; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.jinvestor.model.entity.EntityMetaDataFactory; import org.jinvestor.model.entity.IEntityMetaData; import static com.google.common.base.Preconditions.checkArgument; /** * * @author Adam */ public class FastRawCsvToDbRowConverter implements IConverter<String[], Object[]> { private boolean isFirstTimeCalled = true; private Map<String, String> inputToOutputColumnMappings; private IEntityMetaData<?> entityMetaData; public FastRawCsvToDbRowConverter(Map<String, String> inputToOutputColumnMappings, Class<?> entityClass) { this.inputToOutputColumnMappings = inputToOutputColumnMappings; this.entityMetaData = EntityMetaDataFactory.get(entityClass); } @Override public Object[] apply(String[] strings) { if (isFirstTimeCalled) { validateInputColumns(strings, inputToOutputColumnMappings, entityMetaData); isFirstTimeCalled = false; return new Object[0]; } return strings; } private void validateInputColumns(String[] inputColumns, Map<String, String> inputToOutputColumnMappings, IEntityMetaData<?> entityMetaData) { String[] entityColumns = entityMetaData.getColumns(); validateMappings(inputColumns, inputToOutputColumnMappings, entityColumns); validateColumnOrder(inputColumns, inputToOutputColumnMappings, entityColumns); } /** * Validates each column from (@code inputColumns} have a mapping in {@code inputToOutputColumnMappings} * @param inputColumns * @param inputToOutputColumnMappings * @throws IllegalArgumentException if validation fails */ private void validateMappings(String[] csvColumns, Map<String, String> inputToOutputColumnMappings, String[] entityColumns) { List<String> inputColumnList = Arrays.asList(csvColumns); Collection<String> mappedInputColumnList = inputToOutputColumnMappings.keySet(); Collection<String> mappedOutputColumnList = inputToOutputColumnMappings.values(); List<String> entityColumnList = Arrays.asList(entityColumns); checkArgument(collectionsEqualIgnoresOrder(inputColumnList, mappedInputColumnList) && collectionsEqualIgnoresOrder(mappedOutputColumnList, entityColumnList), "Incorrect mappings: " + getAsString(csvColumns, inputToOutputColumnMappings, entityColumns)); } private void validateColumnOrder(String[] csvColumns, Map<String, String> inputToOutputColumnMappings, String[] entityColumns) { List<String> mappedInputColumns = Arrays.asList(csvColumns) .stream() .map(inputToOutputColumnMappings::get) .collect(Collectors.toList()); if (!mappedInputColumns.equals(Arrays.asList(entityColumns))) { throw new UnsupportedOperationException("csv columns in different order than entity columms. " + getAsString(csvColumns, inputToOutputColumnMappings, entityColumns) + ". This is not supported in this fast implementation"); } } private String getAsString(String[] csvColumns, Map<String, String> inputToOutputColumnMappings, String[] entityColumns) { return new StringBuilder() .append("csv columns=").append(Arrays.asList(csvColumns)) .append("; column mappings=").append(inputToOutputColumnMappings) .append("; entity column=").append(Arrays.asList(entityColumns)) .toString(); } private <T> boolean collectionsEqualIgnoresOrder(Collection<T> col1, Collection<T> col2) { return new HashSet<>(col1).equals(new HashSet<>(col2)); } }
d9fdc0b0fbd4aeb28ca82912b04acbe458e18bd3
2fc504dbda37d30772d95139358b005f4a256d1d
/IdeaProjects/Week4/ADP/src/main/java/za/ac/cput/week4/correction/Manager.java
623c7ebeaf9edb662e99634f9806eb506435271f
[]
no_license
subaruwrx/Project
a3b5f985d7c6fc04262c8a80491f4f8b80363d4b
f95d345beecc4c11e6648be55b865591accc27c4
refs/heads/master
2021-01-01T20:12:34.764501
2015-04-26T20:30:26
2015-04-26T20:30:26
34,630,065
0
0
null
null
null
null
UTF-8
Java
false
false
199
java
package za.ac.cput.week4.correction; /** * Created by student on 2015/02/27. */ public class Manager { public String check() { return "check on the workers Supervisor"; } }
8ad40480b8d22ffc1572389805b23b90c110d41f
72a80e287df02d8c4a9c170b5df305ea9f9ee019
/app/src/main/java/ru/asedias/vkbugtracker/fragments/SettingsFragment.java
b74273055b629839d6a02818715786d94bd2f97e
[]
no_license
asedias/VK-Bugtracker-Android2
59f62f27e18b9c813dbafc8579c47f1f35f49451
7ee1a61aaba5f5ed047ae51aae490c88bf5cde0b
refs/heads/master
2020-04-02T07:23:47.097042
2019-10-14T21:35:53
2019-10-14T21:35:53
154,193,877
3
0
null
null
null
null
UTF-8
Java
false
false
10,798
java
package ru.asedias.vkbugtracker.fragments; import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.preference.PreferenceManager; import android.support.design.widget.TextInputEditText; import android.support.design.widget.TextInputLayout; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import org.w3c.dom.Text; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import ru.asedias.vkbugtracker.BTApp; import ru.asedias.vkbugtracker.BuildConfig; import ru.asedias.vkbugtracker.MainActivity; import ru.asedias.vkbugtracker.R; import ru.asedias.vkbugtracker.api.WebRequest; import ru.asedias.vkbugtracker.data.ProductsData; import ru.asedias.vkbugtracker.data.UserData; import ru.asedias.vkbugtracker.ui.LayoutHelper; import ru.asedias.vkbugtracker.ui.MaterialDialogBuilder; import ru.asedias.vkbugtracker.ui.ThemeController; import ru.asedias.vkbugtracker.ui.adapters.SettingsAdapter; import static ru.asedias.vkbugtracker.ui.ThemeController.KEY_BACKGROUND; import static ru.asedias.vkbugtracker.ui.ThemeController.KEY_BACKGROUND_CARD; import static ru.asedias.vkbugtracker.ui.ThemeController.KEY_PRIMARY; import static ru.asedias.vkbugtracker.ui.ThemeController.KEY_TEXTCOLOR; import static ru.asedias.vkbugtracker.ui.ThemeController.THEME_DARK; import static ru.asedias.vkbugtracker.ui.ThemeController.THEME_LIGHT; import static ru.asedias.vkbugtracker.ui.ThemeController.currentTheme; import static ru.asedias.vkbugtracker.ui.ThemeController.getValue; import static ru.asedias.vkbugtracker.ui.ThemeController.isDark; import static ru.asedias.vkbugtracker.ui.ThemeController.setTheme; /** * Created by Roma on 08.05.2019. */ public class SettingsFragment extends CardRecyclerFragment<SettingsAdapter> { private List<SettingsAdapter.SettingsItem> data = new ArrayList<>(); public SettingsFragment() { this.title = BTApp.String(R.string.action_settings); this.setTitleNeeded = true; this.showBottom = false; buildData(); this.mAdapter = new SettingsAdapter(this.data); } @Override public WebRequest getRequest() { this.showContent(); this.mSwipeRefresh.setEnabled(false); return null; } @Override public void onDestroy() { super.onDestroy(); } private void buildData() { this.data.add(new SettingsAdapter.SettingsItem(R.string.general_settings)); this.data.add(new SettingsAdapter.SettingsItem(R.string.dark_theme, isDark(), (buttonView, isChecked) -> { setTheme(isChecked ? THEME_DARK : THEME_LIGHT); animateChanges(); })); this.data.add(new SettingsAdapter.SettingsItem(R.string.others_settings)); this.data.add(new SettingsAdapter.SettingsItem(R.string.debug_settings, () -> { MaterialDialogBuilder builder = new MaterialDialogBuilder(this.parent); builder.setTitle(R.string.debug_settings); TextInputLayout input = new TextInputLayout(this.parent); input.addView(new TextInputEditText(this.parent)); input.setHint("Ключ"); input.setPadding(BTApp.dp(22), BTApp.dp(16), BTApp.dp(22), 0); input.getEditText().setTextColor(ThemeController.getTextColor()); builder.setView(input); builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel()); builder.setPositiveButton(android.R.string.ok, (dialog, which) -> { checkDebug(input.getEditText().getText().toString()); }); builder.show(); })); this.data.add(new SettingsAdapter.SettingsItem(R.string.prefs_about, () -> { MaterialDialogBuilder builder = new MaterialDialogBuilder(this.parent); View root = View.inflate(this.parent, R.layout.about, null); TextView version = (TextView)root.findViewById(R.id.version); version.setText(String.format(version.getText().toString(), BuildConfig.VERSION_NAME)); builder.setView(root); builder.setPositiveButton(android.R.string.ok, null); builder.show(); })); this.data.add(new SettingsAdapter.SettingsItem(R.string.prefs_logout, () -> { MaterialDialogBuilder builder = new MaterialDialogBuilder(this.parent); builder.setTitle(R.string.prefs_logout); builder.setMessage(R.string.logout_description); builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel()); builder.setPositiveButton(R.string.yes, (dialog, which) -> { ProductsData.clearCacheData(); UserData.clear(); parent.clearStacks(); parent.replaceFragment(new LoginFragment(), R.id.navigation_reports); dialog.cancel(); }); builder.show(); })); } private void animateChanges() { int newTheme = currentTheme; int prevTheme = isDark() ? THEME_LIGHT : THEME_DARK; ValueAnimator v1 = ValueAnimator.ofInt(getValue(KEY_PRIMARY, prevTheme), getValue(KEY_PRIMARY, newTheme)); v1.setEvaluator(new ArgbEvaluator()); v1.addUpdateListener(animation -> { int value = (int) animation.getAnimatedValue(); this.parent.getAppbarCard().setCardBackgroundColor(value); this.parent.getBottomNavView().setBackgroundColor(value); this.parent.getDrawerList().setBackgroundColor(value); }); getAllText((ViewGroup) this.parent.getFragmentManager().findFragmentById(R.id.appkit_content).getView()); ValueAnimator v2 = ValueAnimator.ofInt(getValue(KEY_BACKGROUND, prevTheme), getValue(KEY_BACKGROUND, newTheme)); v2.setEvaluator(new ArgbEvaluator()); v2.addUpdateListener(animation -> { int value = (int) animation.getAnimatedValue(); this.parent.getWindow().setBackgroundDrawable(new ColorDrawable(value)); }); ValueAnimator v3 = ValueAnimator.ofInt(getValue(KEY_BACKGROUND_CARD, prevTheme), getValue(KEY_BACKGROUND_CARD, newTheme)); v3.setEvaluator(new ArgbEvaluator()); v3.addUpdateListener(animation -> { int value = (int) animation.getAnimatedValue(); this.parent.getFragmentManager().findFragmentById(R.id.appkit_content).getView().setBackgroundColor(value); }); ValueAnimator v4 = ValueAnimator.ofInt(getValue(KEY_TEXTCOLOR, prevTheme), getValue(KEY_TEXTCOLOR, newTheme)); v4.setEvaluator(new ArgbEvaluator()); v4.addUpdateListener(animation -> { int value = (int) animation.getAnimatedValue(); this.parent.getToolbar().setTitleTextColor(value); }); AnimatorSet set = new AnimatorSet(); set.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { updateDecorator(); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); set.setDuration(200); set.playTogether(v1, v2, v3, v4); set.start(); //notifyDataSetChanged(); this.parent.getDrawerList().getAdapter().notifyDataSetChanged(); } private static void getAllText(ViewGroup viewGroup) { int newTheme = currentTheme; int prevTheme = isDark() ? THEME_LIGHT : THEME_DARK; for(int i = 0; i < viewGroup.getChildCount(); i++) { View view = viewGroup.getChildAt(i); if(view instanceof TextView && ((TextView)view).getCurrentTextColor() == getValue(KEY_TEXTCOLOR, prevTheme)) { ObjectAnimator anim = ObjectAnimator.ofInt((TextView)view, "textColor", getValue(KEY_TEXTCOLOR, prevTheme), getValue(KEY_TEXTCOLOR, newTheme)); anim.setEvaluator(new ArgbEvaluator()); anim.setDuration(400).start(); } else if(view instanceof ViewGroup) { getAllText((ViewGroup) view); } } } private void checkDebug(String key) { if(key.equalsIgnoreCase("profile")) { MaterialDialogBuilder builder = new MaterialDialogBuilder(this.parent); builder.setTitle("Открыть профиль по ID"); TextInputLayout input = new TextInputLayout(this.parent); input.addView(new TextInputEditText(this.parent)); input.setHint("ID"); input.setPadding(BTApp.dp(22), BTApp.dp(16), BTApp.dp(22), 0); input.getEditText().setTextColor(ThemeController.getTextColor()); builder.setView(input); builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel()); builder.setPositiveButton(android.R.string.ok, (dialog, which) -> { String text = input.getEditText().getText().toString(); int ID = Pattern.compile("[0-9]+").matcher(text).matches() ? Integer.parseInt(text) : 0; if(ID > 0) parent.replaceFragment(ProfileFragment.newInstance(ID), 0); }); builder.show(); } else if(key.equalsIgnoreCase("report")) { MaterialDialogBuilder builder = new MaterialDialogBuilder(this.parent); builder.setTitle("Открыть репорт по ID"); TextInputLayout input = new TextInputLayout(this.parent); input.addView(new TextInputEditText(this.parent)); input.setHint("ID"); input.setPadding(BTApp.dp(22), BTApp.dp(16), BTApp.dp(22), 0); input.getEditText().setTextColor(ThemeController.getTextColor()); builder.setView(input); builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel()); builder.setPositiveButton(android.R.string.ok, (dialog, which) -> { String text = input.getEditText().getText().toString(); int ID = Pattern.compile("[0-9]+").matcher(text).matches() ? Integer.parseInt(text) : 0; if(ID > 0) parent.replaceFragment(ViewReportFragment.newInstance(ID), 0); }); builder.show(); } } }
1886ad861679706761ff76ea61b0b3fb37c8c534
60f66e930f7139bd2b283e25dd4c3c694c6dad7a
/src/test/java/io/github/jhipster/application/security/DomainUserDetailsServiceIntTest.java
49577075e88ed2aacda5a56a2bf099a7372549b7
[]
no_license
BulkSecurityGeneratorProject/jhipdash
84356445917528d7cb2b379bf57b2aec83b44ad6
5830e9d72a0efcd8478509344011310729314c2f
refs/heads/master
2022-12-11T15:23:55.280314
2018-04-20T19:27:39
2018-04-20T19:27:39
296,557,350
0
0
null
2020-09-18T08:12:26
2020-09-18T08:12:25
null
UTF-8
Java
false
false
4,695
java
package io.github.jhipster.application.security; import io.github.jhipster.application.JhipdashApp; import io.github.jhipster.application.domain.User; import io.github.jhipster.application.repository.UserRepository; import org.apache.commons.lang3.RandomStringUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; /** * Test class for DomainUserDetailsService. * * @see DomainUserDetailsService */ @RunWith(SpringRunner.class) @SpringBootTest(classes = JhipdashApp.class) @Transactional public class DomainUserDetailsServiceIntTest { private static final String USER_ONE_LOGIN = "test-user-one"; private static final String USER_ONE_EMAIL = "test-user-one@localhost"; private static final String USER_TWO_LOGIN = "test-user-two"; private static final String USER_TWO_EMAIL = "test-user-two@localhost"; private static final String USER_THREE_LOGIN = "test-user-three"; private static final String USER_THREE_EMAIL = "test-user-three@localhost"; @Autowired private UserRepository userRepository; @Autowired private UserDetailsService domainUserDetailsService; private User userOne; private User userTwo; private User userThree; @Before public void init() { userOne = new User(); userOne.setLogin(USER_ONE_LOGIN); userOne.setPassword(RandomStringUtils.random(60)); userOne.setActivated(true); userOne.setEmail(USER_ONE_EMAIL); userOne.setFirstName("userOne"); userOne.setLastName("doe"); userOne.setLangKey("en"); userRepository.save(userOne); userTwo = new User(); userTwo.setLogin(USER_TWO_LOGIN); userTwo.setPassword(RandomStringUtils.random(60)); userTwo.setActivated(true); userTwo.setEmail(USER_TWO_EMAIL); userTwo.setFirstName("userTwo"); userTwo.setLastName("doe"); userTwo.setLangKey("en"); userRepository.save(userTwo); userThree = new User(); userThree.setLogin(USER_THREE_LOGIN); userThree.setPassword(RandomStringUtils.random(60)); userThree.setActivated(false); userThree.setEmail(USER_THREE_EMAIL); userThree.setFirstName("userThree"); userThree.setLastName("doe"); userThree.setLangKey("en"); userRepository.save(userThree); } @Test @Transactional public void assertThatUserCanBeFoundByLogin() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test @Transactional public void assertThatUserCanBeFoundByLoginIgnoreCase() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN.toUpperCase(Locale.ENGLISH)); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test @Transactional public void assertThatUserCanBeFoundByEmail() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); } @Test @Transactional public void assertThatUserCanBeFoundByEmailIgnoreCase() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL.toUpperCase(Locale.ENGLISH)); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); } @Test @Transactional public void assertThatEmailIsPrioritizedOverLogin() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_EMAIL.toUpperCase(Locale.ENGLISH)); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test(expected = UserNotActivatedException.class) @Transactional public void assertThatUserNotActivatedExceptionIsThrownForNotActivatedUsers() { domainUserDetailsService.loadUserByUsername(USER_THREE_LOGIN); } }
64912716cad8ed7a2b4f725229d75811aa037f58
170ec69654e17ce5d3a37ec234361f02a0c16a25
/src/main/java/com/controller/AddFlightDetail.java
e26432df46565ecd6adc426e38817f719f12523e
[]
no_license
ptlsohan/Flight_Booking
f183055031b5443781a9f79b7d50924914ac1ee9
c35e282ec0a00ae9966653d3f4301e8ae7a5e086
refs/heads/master
2020-03-25T22:26:52.819716
2018-10-11T19:52:05
2018-10-11T19:52:05
144,223,899
0
0
null
null
null
null
UTF-8
Java
false
false
4,433
java
package com.controller; import java.io.IOException; import java.sql.Date; import java.sql.Time; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.bean.Flight; import com.bean.Seat; import com.dao.FlightDao; import com.dao.SeatDao; import com.exception.DBException; @WebServlet("/addFlightDetail") public class AddFlightDetail extends HttpServlet { private static final long serialVersionUID = 1L; public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { int ret=0; String datepattern = "^([12]\\d)?(\\d\\d)[\\.\\/\\-](0?[1-9]|1[012])[\\.\\/\\-](0?[1-9]|[12]\\d|3[01])$"; Pattern r = Pattern.compile(datepattern); Matcher m1 = r.matcher(request.getParameter("ddate")); Matcher m2 = r.matcher(request.getParameter("adate")); String timepattern = "^([01]\\d|2[0-3]|[0-9])(:[0-5]\\d){1,2}(:[0-5]\\d){1,2}$"; Pattern r1 = Pattern.compile(timepattern); Matcher t1 = r1.matcher(request.getParameter("dtime")); Matcher t2 = r1.matcher(request.getParameter("atime")); if(!m1.matches() || !m2.matches() || !t1.matches() || !t2.matches()) { request.setAttribute("error", "Please enter correct date/time "); request.getRequestDispatcher("/Error.jsp").forward(request, response); return; } if(!isInteger(request.getParameter("fno")) || !isInteger(request.getParameter("air_id")) || !isInteger(request.getParameter("eseat")) || !isInteger(request.getParameter("bseat")) || !isInteger(request.getParameter("fseat")) ) { request.setAttribute("error", "Please enter correct number "); request.getRequestDispatcher("/Error.jsp").forward(request, response); return; } int fno = Integer.parseInt(request.getParameter("fno")); String a_time = request.getParameter("atime"); String a_date= request.getParameter("adate"); String d_time = request.getParameter("dtime"); String d_date= request.getParameter("ddate"); int air_id = Integer.parseInt(request.getParameter("air_id")); String d_city = request.getParameter("d_city"); String a_city= request.getParameter("a_city"); int eseat = Integer.parseInt(request.getParameter("eseat")); int fseat = Integer.parseInt(request.getParameter("fseat")); int bseat = Integer.parseInt(request.getParameter("bseat")); if(fno<=0 || a_time ==null || a_date == null || d_time==null || d_date==null || air_id<=0 || d_city==null || a_city == null || eseat<=0 || fseat<=0 || bseat<=0) { request.setAttribute("error", "Please enter correct details "); request.getRequestDispatcher("/Error.jsp").forward(request, response); return; } Date ddate= Date.valueOf(d_date); Date adate= Date.valueOf(a_date); Time dtime= Time.valueOf(d_time); Time atime = Time.valueOf(a_time); Flight f= new Flight(fno,atime,adate,dtime,ddate,air_id,d_city,a_city); // Airplane a= new Airplane(air_id,"Boeing",777); int v=1; Seat s=new Seat(fno,eseat,fseat,bseat,v); try { // AirplaneDao.insertAirplane(a); ret=FlightDao.insertFlight(f); System.out.println("ret value after insert"+ret); if(ret==1) { SeatDao.insertSeat(s); }else { request.setAttribute("error", "Unable to add flight details"); request.getRequestDispatcher("/Error.jsp").forward(request, response); } } catch (DBException e) { request.setAttribute("error", e.getMessage()); request.getRequestDispatcher("/Error.jsp").forward(request, response); } HttpSession session = request.getSession(false); session.setAttribute("alertMsg", "Flight details added"); //request.getRequestDispatcher("listFlight").forward(request, response); response.sendRedirect("listFlight"); } public static boolean isInteger(String str) { if (str == null) { return false; } if (str.isEmpty()) { return false; } int i = 0; if (str.charAt(0) == '-') { if (str.length() == 1) { return false; } i = 1; } for (; i < str.length(); i++) { char c = str.charAt(i); if (c < '0' || c > '9') { return false; } } return true; } }
a985bedf2cfe7cae078fb754b5ac93145bdf0a93
8edb63ad327fc8dcf39912e8bbfe23ecab754770
/src/main/java/com/ftgo/OrderHistoryService/domain/order/OrderDetails.java
27c164f21c8d8a31b031cde2e879436b3b849393
[]
no_license
TakumiOsawa/OrderHistoryService
24e5bd475b87ce73b42b3d5562d67de251cbd5f8
d2ab222cf60a7b3df2741088cb3193af0c2145b4
refs/heads/master
2023-07-28T08:49:43.403615
2021-09-13T05:15:19
2021-09-13T05:15:19
405,052,193
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package com.ftgo.OrderHistoryService.domain.order; import com.ftgo.OrderHistoryService.domain.Money; public class OrderDetails { private Long consumerId; private Long restaurantId; private OrderLineItems orderLineItems; private Money orderTotal; }
f5c451bb79fe3937b71e44049b4769eda2d10aaa
d086faa525964f17e20b3ed9b0ed6e590b414729
/app/src/main/java/com/coolweather/android/db/City.java
f1e1440454efe0191c5af4005c7461295b04f624
[ "Apache-2.0" ]
permissive
zhaoybz/coolweather
75e88a1b4722969370b11f0bd8575f5929739fa5
c8ad75fdf47dfdc6e44f69d20a6bf44e1324de4e
refs/heads/master
2020-04-23T09:28:51.253860
2019-02-17T12:19:39
2019-02-17T12:19:39
171,069,706
0
0
null
null
null
null
UTF-8
Java
false
false
799
java
package com.coolweather.android.db; import org.litepal.crud.DataSupport; public class City extends DataSupport { private int id; private String cityName; private int cityCode; private int provinceId; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } public int getCityCode() { return cityCode; } public void setCityCode(int cityCode) { this.cityCode = cityCode; } public int getProvinceId() { return provinceId; } public void setProvinceId(int provinceId) { this.provinceId = provinceId; } }
d61c169b0bce1e4e1f3af046ec379bffb830a460
2a78fd807e99d323853c2a968e5e0eb0df409ef4
/src/Ejercicio3.java
2841d99ee5a0c6bc74ced9e6422040e4362fdaa9
[]
no_license
danny73-storm/Unidad6ProgramacionModular
312a829a918a3d745017c2464f7bc4cc44fcd5bd
3e48c8d345f8b592d2f6293aee9a504bbf40d20f
refs/heads/main
2023-06-01T15:56:53.605178
2021-06-11T19:17:11
2021-06-11T19:17:11
375,891,329
0
0
null
null
null
null
UTF-8
Java
false
false
1,235
java
package src; import java.util.Scanner; public class Ejercicio3 { public static void main(String[] args) { Scanner leer = new Scanner(System.in); int[] array = new int[10]; int i; int numeBuscar; int verda; boolean decicion = true; for ( i= 0; i<8; i++){ int ElementoAleatorio = (int) Math.floor(Math.random()*100); array[i]= ElementoAleatorio; } System.out.println("Ingrese el valor a buscar"); numeBuscar = leer.nextInt(); System.out.println("================================================"); System.out.println("Los valores de los indices de los arreglos son: "); for (i= 0; i<8; i++){ System.out.print(array[i]+ ", "); } System.out.println(""); if (numeBuscar == array[i]) { verda = numeBuscar; System.out.println("================================================"); System.out.println("El numero "+numeBuscar+" se encotro? : verdadero"); }else{ System.out.println("El numero "+numeBuscar+" se encuetra entre los elemetos del arreglo? : falso"); } } }